|
|
@ -14,20 +14,9 @@ const Model: ModelType = { |
|
|
|
* @param name |
|
|
|
* @param name |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
setLinkSelected(name: string) { |
|
|
|
setLinkSelected(name: string) { |
|
|
|
if (this.model.linkSelected && this.model.linkSelected.isSelected) { |
|
|
|
this.noSaveConfirm(() => { |
|
|
|
dialog.confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
|
|
|
if (isConfirm) { |
|
|
|
|
|
|
|
saveConnection(this.model.linkUpdate).then(() => { |
|
|
|
|
|
|
|
this.setEdit(false); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.setCancel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this._setLinkSelected(name); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this._setLinkSelected(name); |
|
|
|
this._setLinkSelected(name); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
_setLinkSelected(name: string) { |
|
|
|
_setLinkSelected(name: string) { |
|
|
|
this.model.linkList.forEach((item: LinkType) => { |
|
|
|
this.model.linkList.forEach((item: LinkType) => { |
|
|
@ -55,7 +44,9 @@ const Model: ModelType = { |
|
|
|
this._textLink(id); |
|
|
|
this._textLink(id); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case '复制': |
|
|
|
case '复制': |
|
|
|
this.copyLink(id); |
|
|
|
this.noSaveConfirm(() => { |
|
|
|
|
|
|
|
this.copyLink(id); |
|
|
|
|
|
|
|
}); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
@ -83,22 +74,21 @@ const Model: ModelType = { |
|
|
|
data = item; |
|
|
|
data = item; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
const newCopy = { |
|
|
|
|
|
|
|
...data, |
|
|
|
|
|
|
|
isSelected: true, |
|
|
|
|
|
|
|
connectionName:name, |
|
|
|
|
|
|
|
connectionId: '', |
|
|
|
|
|
|
|
}; |
|
|
|
this.model.linkList = [ |
|
|
|
this.model.linkList = [ |
|
|
|
{ |
|
|
|
newCopy, |
|
|
|
...data, |
|
|
|
|
|
|
|
isSelected: true, |
|
|
|
|
|
|
|
connectionName:name, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
...this.model.linkList, |
|
|
|
...this.model.linkList, |
|
|
|
]; |
|
|
|
]; |
|
|
|
this.model.linkSelected = { |
|
|
|
this.model.linkSelected = { |
|
|
|
...data, |
|
|
|
...newCopy, |
|
|
|
isSelected: true, |
|
|
|
|
|
|
|
connectionName:name, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
this.model.linkUpdate = { |
|
|
|
this.model.linkUpdate = { |
|
|
|
...data, |
|
|
|
...newCopy, |
|
|
|
connectionName:name, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
setLinkUpdate(value: any) { |
|
|
|
setLinkUpdate(value: any) { |
|
|
@ -114,7 +104,6 @@ const Model: ModelType = { |
|
|
|
setCancel() { |
|
|
|
setCancel() { |
|
|
|
const linkSelected: LinkType = this.model.linkSelected; |
|
|
|
const linkSelected: LinkType = this.model.linkSelected; |
|
|
|
const linkList: LinkType[] = this.model.linkList; |
|
|
|
const linkList: LinkType[] = this.model.linkList; |
|
|
|
|
|
|
|
|
|
|
|
if (linkSelected.connectionId) { |
|
|
|
if (linkSelected.connectionId) { |
|
|
|
this.setEdit(false); |
|
|
|
this.setEdit(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -134,20 +123,9 @@ const Model: ModelType = { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
setNewLink(value: string) { |
|
|
|
setNewLink(value: string) { |
|
|
|
if (this.model.linkSelected && this.model.linkSelected.isSelected) { |
|
|
|
this.noSaveConfirm(() => { |
|
|
|
dialog.confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
|
|
|
if (isConfirm) { |
|
|
|
|
|
|
|
saveConnection(this.model.linkUpdate).then(() => { |
|
|
|
|
|
|
|
this.setEdit(true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.setCancel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this._setNewLink(value); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this._setNewLink(value); |
|
|
|
this._setNewLink(value); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
_setNewLink(value: string) { |
|
|
|
_setNewLink(value: string) { |
|
|
|
const name = getCnnectionName(this.model.linkList); |
|
|
|
const name = getCnnectionName(this.model.linkList); |
|
|
@ -178,6 +156,22 @@ const Model: ModelType = { |
|
|
|
setConnectionNameErr(err: string) { |
|
|
|
setConnectionNameErr(err: string) { |
|
|
|
this.model.connectionNameErr = err; |
|
|
|
this.model.connectionNameErr = err; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
noSaveConfirm(cb: Function) { |
|
|
|
|
|
|
|
if (this.model.linkSelected && this.model.linkSelected.isSelected) { |
|
|
|
|
|
|
|
dialog.confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
|
|
|
if (isConfirm) { |
|
|
|
|
|
|
|
saveConnection(this.model.linkUpdate).then(() => { |
|
|
|
|
|
|
|
this.setEdit(true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.setCancel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cb(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
cb(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
BI.model(className, BI.inherit(Fix.Model, Model)); |
|
|
|
BI.model(className, BI.inherit(Fix.Model, Model)); |
|
|
|