|
|
|
@ -21,17 +21,15 @@ export class ListItemModel extends Model<{
|
|
|
|
|
this.model.connectionSelected = name; |
|
|
|
|
}, |
|
|
|
|
deleteConnection: (name: string) => { |
|
|
|
|
api.deleteConnection(name).then(re => api.getConnectionlist()) |
|
|
|
|
.then(connections => { |
|
|
|
|
this.model.connections = connections.data; |
|
|
|
|
this.model.connections.forEach(item => { |
|
|
|
|
// 后端传过来的是字符串,转为对象
|
|
|
|
|
item.connectionData = JSON.parse(item.connectionData); |
|
|
|
|
api.getConnectionStatus(name).then(re => { |
|
|
|
|
if (re.data && re.data === 'success') { |
|
|
|
|
this.removeConnection(name); |
|
|
|
|
} else { |
|
|
|
|
BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_Is_Using', re.errorMsg), { |
|
|
|
|
level: 'error', |
|
|
|
|
}); |
|
|
|
|
if (name === this.model.connectionSelected) { |
|
|
|
|
this.model.connectionSelected = ''; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
setPageIndex(pageIndex: string) { |
|
|
|
|
this.model.pageIndex = pageIndex; |
|
|
|
@ -39,4 +37,18 @@ export class ListItemModel extends Model<{
|
|
|
|
|
|
|
|
|
|
testConnection: () => api.testConnection(this.model.connectionSelectedOne), |
|
|
|
|
} |
|
|
|
|
removeConnection(name: string) { |
|
|
|
|
api.deleteConnection(name).then(re => api.getConnectionlist()) |
|
|
|
|
.then(connections => { |
|
|
|
|
this.model.connections = connections.data; |
|
|
|
|
this.model.connections.forEach(item => { |
|
|
|
|
// 后端传过来的是字符串,转为对象
|
|
|
|
|
item.connectionData = JSON.parse(item.connectionData); |
|
|
|
|
}); |
|
|
|
|
if (name === this.model.connectionSelected) { |
|
|
|
|
this.model.connectionSelected = ''; |
|
|
|
|
} |
|
|
|
|
api.shutdownConnectionStatus(name); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|