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