Browse Source

fix: 去掉无用的类型定义

qufenxi
alan 5 years ago
parent
commit
3727ee4b94
  1. 10
      src/modules/pages/connection/list/list.model.ts
  2. 3
      src/modules/pages/connection/list/list.ts

10
src/modules/pages/connection/list/list.model.ts

@ -1,13 +1,13 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { ConnectionModel } from '../connection.model'; import { ApiFactory } from '../../..//crud/apiFactory';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { AppModel } from '../../../app.model';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const ConnectionListModelXtype = 'dec.dcm.model.connection.list'; export const ConnectionListModelXtype = 'dec.dcm.model.connection.list';
@model(ConnectionListModelXtype) @model(ConnectionListModelXtype)
export class ConnectionListModel extends Model<{ export class ConnectionListModel extends Model<{
context : { context : {
connections: ConnectionModel['$$childContext']['connections']; connections: AppModel['$$childContext']['connections'];
connectionSelected: ConnectionModel['$$childContext']['connectionSelected']; connectionSelected: AppModel['$$childContext']['connectionSelected'];
} }
}> { }> {
context = ['connections', 'connectionSelected']; context = ['connections', 'connectionSelected'];
@ -18,7 +18,7 @@ export class ConnectionListModel extends Model<{
this.model.connections = data.data; this.model.connections = data.data;
this.model.connections.forEach(item => { this.model.connections.forEach(item => {
// 后端传过来的是字符串,转为对象 // 后端传过来的是字符串,转为对象
item.connectionData = JSON.parse(item.connectionData); item.connectionData = JSON.parse(item.connectionData as string);
}); });
this.model.connectionSelected = data.data[0].connectionName; this.model.connectionSelected = data.data[0].connectionName;
} else { } else {

3
src/modules/pages/connection/list/list.ts

@ -2,7 +2,6 @@ import { shortcut, store } from '@core/core';
import { CenterAdapt, Label, Layout, Vtape, Loader } from 'ui'; import { CenterAdapt, Label, Layout, Vtape, Loader } from 'ui';
import { ListItemXtype } from './list_item/list_item'; import { ListItemXtype } from './list_item/list_item';
import { ConnectionListModel, ConnectionListModelXtype } from './list.model'; import { ConnectionListModel, ConnectionListModelXtype } from './list.model';
import { Connection } from '../../../crud/crud.typings';
import { getCreator, getDatabaseType } from './list.service'; import { getCreator, getDatabaseType } from './list.service';
export const ConnectionListXtype = 'dec.dcm.connection.list'; export const ConnectionListXtype = 'dec.dcm.connection.list';
@shortcut(ConnectionListXtype) @shortcut(ConnectionListXtype)
@ -68,7 +67,7 @@ export class ConnectionList extends BI.LoadingPane {
} }
private renderList(start = 0, end = 0) { private renderList(start = 0, end = 0) {
return this.model.connections.slice(start, end).map((item: Connection, index: number) => { return this.model.connections.slice(start, end).map((item, index) => {
return { return {
type: ListItemXtype, type: ListItemXtype,
name: item.connectionName, name: item.connectionName,

Loading…
Cancel
Save