增加任务流程修改未保存校验
parent
75ab3073b4
commit
bd7d5997ab
|
@ -128,15 +128,24 @@ export default {
|
|||
top: r.node.top,
|
||||
left: r.node.left
|
||||
})
|
||||
this.checkData.nodeList.push({
|
||||
id: r.node.id,
|
||||
type: r.node.type,
|
||||
typeName: r.node.typeName,
|
||||
nodeName: r.node.nodeName,
|
||||
top: r.node.top,
|
||||
left: r.node.left
|
||||
})
|
||||
// 连线添加
|
||||
if (r.line) {
|
||||
r.line.forEach(v => {
|
||||
this.data.lineList.push({
|
||||
from: v.from,
|
||||
to: v.to,
|
||||
label: "连线名称",
|
||||
id: GenNonDuplicateID(8),
|
||||
Remark: ""
|
||||
to: v.to
|
||||
});
|
||||
this.checkData.lineList.push({
|
||||
from: v.from,
|
||||
to: v.to
|
||||
});
|
||||
})
|
||||
}
|
||||
|
@ -145,8 +154,8 @@ export default {
|
|||
this.nodeHandle()
|
||||
// 连线去重
|
||||
this.data.lineList = this.lineHandle(this.data.lineList)
|
||||
this.checkData.lineList = this.lineHandle(this.data.lineList)
|
||||
})
|
||||
this.flag = true
|
||||
},
|
||||
// 节点批量处理-初始化
|
||||
nodeHandle() {
|
||||
|
@ -200,18 +209,53 @@ export default {
|
|||
// 3. 激活接口将参数传递到后端
|
||||
batch(nodeData,this.$route.query.taskCode).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.flag = true
|
||||
})
|
||||
console.log(nodeData)
|
||||
},
|
||||
// 返回校验
|
||||
returnBack() {
|
||||
if (this.flag){
|
||||
const newNodeList = this.data.nodeList
|
||||
const oldNodeList = this.checkData.nodeList
|
||||
const newLineList = this.data.lineList
|
||||
const oldLineList = this.checkData.lineList
|
||||
// this.$router.push({path: '/quest/task'})
|
||||
if (this.checkNodeList(newNodeList,oldNodeList) && this.checkLineList(newLineList,oldLineList)){
|
||||
this.$router.push({path: '/quest/task'})
|
||||
}else{
|
||||
this.checkReturn()
|
||||
}
|
||||
|
||||
},
|
||||
// 节点校验
|
||||
checkNodeList(newNodeList, oldNodeList) {
|
||||
let newLen = newNodeList.length
|
||||
let oldLen = oldNodeList.length
|
||||
if (newLen !== oldLen) return false;
|
||||
for (let i = 0; i < newLen; i++) {
|
||||
if (newNodeList[i].id === oldNodeList[i].id &&
|
||||
newNodeList[i].nodeName === oldNodeList[i].nodeName &&
|
||||
newNodeList[i].type === oldNodeList[i].type &&
|
||||
newNodeList[i].left === oldNodeList[i].left &&
|
||||
newNodeList[i].top === oldNodeList[i].top){
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
checkLineList(newLineList,oldLineList) {
|
||||
let newLen = newLineList.length
|
||||
let oldLen = oldLineList.length
|
||||
if (newLen !== oldLen) return false;
|
||||
for (let i = 0; i < newLen; i++) {
|
||||
if (newLineList[i].from === oldLineList[i].from &&
|
||||
newLineList[i].to === oldLineList[i].to){
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 未保存 返回按钮
|
||||
checkReturn() {
|
||||
this.$confirm('更改未保存,是否保存?', '未保存提示', {
|
||||
confirmButtonText: '保存',
|
||||
|
@ -219,13 +263,14 @@ export default {
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.save()
|
||||
this.$router.push({path: '/quest/task'})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '返回成功'
|
||||
});
|
||||
});
|
||||
this.$router.push({path: '/quest/task'})
|
||||
});
|
||||
},
|
||||
// 修改状态更新
|
||||
checkFlag(){
|
||||
|
|
Loading…
Reference in New Issue