|
@@ -2,7 +2,7 @@
|
|
|
<div class="app-container">
|
|
|
<div class="containers">
|
|
|
<div class="canvas" ref="canvas"></div>
|
|
|
- <ul class="buttons">
|
|
|
+ <ul class="buttons buttons-left">
|
|
|
<li>
|
|
|
<a href="javascript:" class="active" ref="saveXML" title="保存为bpmn"
|
|
|
>保存为bpmn</a
|
|
@@ -58,12 +58,16 @@
|
|
|
>还原</a
|
|
|
>
|
|
|
</li>
|
|
|
+ </ul>
|
|
|
+ <ul class="buttons buttons-right">
|
|
|
+
|
|
|
<li>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
@click="submitBpmn"
|
|
|
v-if="!loading"
|
|
|
title="提交场景配置"
|
|
|
+ size="mini"
|
|
|
>提 交</el-button
|
|
|
>
|
|
|
<el-button
|
|
@@ -99,7 +103,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="24" v-if="checkSatus">
|
|
|
<el-form-item label="执行">
|
|
|
<el-tree
|
|
|
class="tree-border"
|
|
@@ -281,6 +285,10 @@ export default {
|
|
|
serviceTaskStatus: false,
|
|
|
//选中展开
|
|
|
checked: [],
|
|
|
+ checkSatus:false,
|
|
|
+
|
|
|
+ //返回节点计数器
|
|
|
+ FHdnum:0,
|
|
|
//表达式
|
|
|
showCronBox: false,
|
|
|
showClo: false,
|
|
@@ -406,8 +414,8 @@ export default {
|
|
|
let data = [];
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
|
if(JSON.stringify(data) == "[]"){
|
|
|
-
|
|
|
data[i] = {
|
|
|
+ name:undefined,
|
|
|
runName:undefined,
|
|
|
describe1:undefined,
|
|
|
describe2:undefined,
|
|
@@ -416,6 +424,7 @@ export default {
|
|
|
procedefKey:undefined,
|
|
|
nodes:[]
|
|
|
}
|
|
|
+ data[i].name = res.data[i].name
|
|
|
data[i].runName = res.data[i].runName
|
|
|
data[i].procedefKey = res.data[i].procedefKey
|
|
|
if(res.data[i].id == "1"){
|
|
@@ -432,33 +441,39 @@ export default {
|
|
|
}
|
|
|
data[i].nodes.push(res.data[i])
|
|
|
}else{
|
|
|
- if(res.data[i].procedefKey == nodes[i][i].procedefKey){
|
|
|
- data[i].nodes.push(res.data[i])
|
|
|
- }else{
|
|
|
- data[i] = {
|
|
|
- runName:undefined,
|
|
|
- describe1:undefined,
|
|
|
- describe2:undefined,
|
|
|
- blurry:undefined,
|
|
|
- deptName:undefined,
|
|
|
- procedefKey:undefined,
|
|
|
- nodes:[]
|
|
|
+ for(let a = 0;a<data.length;a++){
|
|
|
+ if(res.data[i].procedefKey == data[a].procedefKey){
|
|
|
+ data[a].nodes.push(res.data[i])
|
|
|
+ this.FHdnum = 1
|
|
|
}
|
|
|
- data[i].runName = res.data[i].runName
|
|
|
- data[i].procedefKey = res.data[i].procedefKey
|
|
|
- if(res.data[i].id == "1"){
|
|
|
- data[i].describe1 = JSON.parse(res.data[i].params)[0].describe
|
|
|
- data[i].describe2 = JSON.parse(res.data[i].params)[1].describe
|
|
|
- if(res.data[i].runParam){
|
|
|
- if(JSON.parse(res.data[i].runParam).blurry){
|
|
|
- data[i].blurry = JSON.parse(res.data[i].runParam).blurry
|
|
|
- }
|
|
|
- if(JSON.parse(res.data[i].runParam).deptName){
|
|
|
- data[i].deptName = JSON.parse(res.data[i].runParam).deptName
|
|
|
+ }
|
|
|
+ if(this.FHdnum == 0){
|
|
|
+ let arr = {
|
|
|
+ runName:undefined,
|
|
|
+ describe1:undefined,
|
|
|
+ describe2:undefined,
|
|
|
+ blurry:undefined,
|
|
|
+ deptName:undefined,
|
|
|
+ procedefKey:undefined,
|
|
|
+ nodes:[]
|
|
|
+ }
|
|
|
+ arr.runName = res.data[i].runName
|
|
|
+ arr.procedefKey = res.data[i].procedefKey
|
|
|
+ if(res.data[i].id == "1"){
|
|
|
+ arr.describe1 = JSON.parse(res.data[i].params)[0].describe
|
|
|
+ arr.describe2 = JSON.parse(res.data[i].params)[1].describe
|
|
|
+ if(res.data[i].runParam){
|
|
|
+ if(JSON.parse(res.data[i].runParam).blurry){
|
|
|
+ arr.blurry = JSON.parse(res.data[i].runParam).blurry
|
|
|
+ }
|
|
|
+ if(JSON.parse(res.data[i].runParam).deptName){
|
|
|
+ arr.deptName = JSON.parse(res.data[i].runParam).deptName
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- data[i].nodes.push(res.data[i])
|
|
|
+ arr.nodes.push(res.data[i])
|
|
|
+ data.push(arr)
|
|
|
+ this.FHdnum = 0
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -475,19 +490,23 @@ export default {
|
|
|
//获取选中节点
|
|
|
currentChecked(nodeObj, SelectedObj) {
|
|
|
//条件显示
|
|
|
- for (let i = 0; i < SelectedObj.checkedKeys.length; i++) {
|
|
|
- if (SelectedObj.checkedKeys[i] == 1) {
|
|
|
- this.status = true;
|
|
|
- this.formData.describe1 = JSON.parse(
|
|
|
- SelectedObj.checkedNodes[i].params
|
|
|
- )[0].describe;
|
|
|
- this.formData.describe2 = JSON.parse(
|
|
|
- SelectedObj.checkedNodes[i].params
|
|
|
- )[1].describe;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- this.status = false;
|
|
|
+ if(JSON.stringify(SelectedObj.checkedKeys) != "[]"){
|
|
|
+ for (let i = 0; i < SelectedObj.checkedKeys.length; i++) {
|
|
|
+ if (SelectedObj.checkedKeys[i] == 1) {
|
|
|
+ this.status = true
|
|
|
+ this.formData.describe1 = JSON.parse(
|
|
|
+ SelectedObj.checkedNodes[i].params
|
|
|
+ )[0].describe;
|
|
|
+ this.formData.describe2 = JSON.parse(
|
|
|
+ SelectedObj.checkedNodes[i].params
|
|
|
+ )[1].describe;
|
|
|
+ break;
|
|
|
+ }else{
|
|
|
+ this.status = false
|
|
|
+ }
|
|
|
}
|
|
|
+ }else{
|
|
|
+ this.status = false
|
|
|
}
|
|
|
//获取节点
|
|
|
let arr = [];
|
|
@@ -569,7 +588,7 @@ export default {
|
|
|
var elementRegistry = bpmnjs.get("elementRegistry");
|
|
|
var shape = e.element ? elementRegistry.get(e.element.id) : e.shape;
|
|
|
if (event == "shape.added") {
|
|
|
- let data = [
|
|
|
+ let data =
|
|
|
{
|
|
|
runName: undefined,
|
|
|
name:undefined,
|
|
@@ -580,9 +599,8 @@ export default {
|
|
|
deptName: undefined,
|
|
|
xlStatus: false,
|
|
|
procedefKey: undefined, //流程图节点canvas节点id
|
|
|
- },
|
|
|
- ];
|
|
|
- data[0].procedefKey = shape.id;
|
|
|
+ }
|
|
|
+ data.procedefKey = shape.id;
|
|
|
that.bpmnData.push(data);
|
|
|
console.log(
|
|
|
"新创建节点:",
|
|
@@ -682,7 +700,6 @@ export default {
|
|
|
// e.element.businessObject.$type,
|
|
|
// e.element.businessObject.name,that.data
|
|
|
// );
|
|
|
- e.element.businessObject.nodeId = that.formData.nodeId;
|
|
|
// e.element.businessObject.order = that.formData.order
|
|
|
// console.log(
|
|
|
// "点击了element",
|
|
@@ -705,43 +722,47 @@ export default {
|
|
|
},
|
|
|
// 节点取消按钮
|
|
|
cancel() {
|
|
|
+ let that = this
|
|
|
store.commit("STATUSCHANGE");
|
|
|
setTimeout(() => {
|
|
|
- this.serviceTask = false;
|
|
|
+ that.formData = {}
|
|
|
+ that.checked = []
|
|
|
+ that.serviceTask = false;
|
|
|
});
|
|
|
+ console.log(that.formData)
|
|
|
},
|
|
|
/** 节点提交按钮 */
|
|
|
submitForm() {
|
|
|
const that = this;
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.msgSuccess("节点属性保存成功");
|
|
|
- this.loading = false;
|
|
|
- //处理弹框无法关闭
|
|
|
- setTimeout(() => {
|
|
|
- that.cancel();
|
|
|
- }, 1);
|
|
|
- console.log(this.formData, this.$store.state.bpmn.nodeInfo.id);
|
|
|
this.formData.procedefKey = this.$store.state.bpmn.nodeInfo.id;
|
|
|
this.formData.runName = this.formData.name;
|
|
|
let arr = this.bpmnData;
|
|
|
if (arr.length > 0) {
|
|
|
- console.log(arr.length);
|
|
|
let num = 0;
|
|
|
+ // 相同节点
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
- if (this.formData.nodes[0].procedefKey == arr[i][0].procedefKey) {
|
|
|
+ if (this.formData.procedefKey == arr[i].procedefKey) {
|
|
|
arr[i] = JSON.parse(JSON.stringify(this.formData));
|
|
|
num++;
|
|
|
- break;
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
- if ((num = 0)) {
|
|
|
- num += 1;
|
|
|
+ // 不同节点
|
|
|
+ if (num == 0) {
|
|
|
this.bpmnData.push(JSON.parse(JSON.stringify(this.formData)));
|
|
|
+ num++;
|
|
|
}
|
|
|
} else {
|
|
|
this.bpmnData.push(JSON.parse(JSON.stringify(this.formData)));
|
|
|
}
|
|
|
+ this.loading = false;
|
|
|
+ //处理弹框无法关闭
|
|
|
+ setTimeout(() => {
|
|
|
+ that.cancel();
|
|
|
+ }, 1);
|
|
|
+ this.msgSuccess("节点属性保存成功");
|
|
|
}
|
|
|
console.log("节点提交", this.bpmnData);
|
|
|
});
|
|
@@ -763,6 +784,19 @@ export default {
|
|
|
if (this.bpmnData.length < 1) {
|
|
|
this.msgError("场景管理节点数据个数不能为零");
|
|
|
} else {
|
|
|
+ let arr = this.bpmnData
|
|
|
+ let nodeRepeat = []
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ for (let a = 0; a < arr[i].nodes.length; a++) {
|
|
|
+ if(nodeRepeat.indexOf(arr[i].nodes[a].id)>-1){
|
|
|
+ this.msgError("节点信息不能重复");
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ nodeRepeat.push(arr[i].nodes[a].id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(nodeRepeat,arr)
|
|
|
let params = {};
|
|
|
params.runStatus = this.bpmnForm.runStatus;
|
|
|
params.name = this.bpmnForm.name;
|
|
@@ -773,30 +807,28 @@ export default {
|
|
|
params.runCron = undefined;
|
|
|
params.id = undefined;
|
|
|
params.runCron = this.bpmnForm.runCron;
|
|
|
- let arr = this.bpmnData;
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
for (let a = 0; a < arr[i].nodes.length; a++) {
|
|
|
- params.nodes[a] = {};
|
|
|
- params.nodes[a].name = arr[i].name;
|
|
|
- params.nodes[a].procedefKey = arr[i].procedefKey;
|
|
|
- params.nodes[a].nodeId = undefined;
|
|
|
- params.nodes[a].nodeId = arr[i].nodes[a].id;
|
|
|
- params.nodes[a].param = {};
|
|
|
+ let node = {}
|
|
|
+ node.name = arr[i].runName;
|
|
|
+ node.procedefKey = arr[i].procedefKey;
|
|
|
+ node.nodeId = arr[i].nodes[a].id;
|
|
|
+ node.param = {};
|
|
|
let data = JSON.parse(arr[i].nodes[a].params);
|
|
|
for (let b = 0; b < data.length; b++) {
|
|
|
if (data[b].name === "blurry") {
|
|
|
- params.nodes[a].param.blurry = arr[i].blurry;
|
|
|
+ node.param.blurry = arr[i].blurry;
|
|
|
} else if (data[b].name === "deptName") {
|
|
|
- params.nodes[a].param.deptName = arr[i].deptName;
|
|
|
+ node.param.deptName = arr[i].deptName;
|
|
|
} else {
|
|
|
- params.nodes[a].param[data[0].name] = data[0].value;
|
|
|
+ node.param[data[0].name] = data[0].value;
|
|
|
}
|
|
|
}
|
|
|
+ node.param = JSON.stringify(node.param)
|
|
|
+ params.nodes.push(node)
|
|
|
}
|
|
|
}
|
|
|
- for (let i = 0; i < params.nodes.length; i++) {
|
|
|
- params.nodes[i].param = JSON.stringify(params.nodes[i].param);
|
|
|
- }
|
|
|
+ console.log(params)
|
|
|
if (this.bpmnDataFH.id) {
|
|
|
params.id = this.bpmnDataFH.id;
|
|
|
updataBpmnZkReProcdef(params).then((res) => {
|
|
@@ -863,7 +895,6 @@ export default {
|
|
|
if (element.businessObject) {
|
|
|
if (element.businessObject.$type === "bpmn:ServiceTask") {
|
|
|
that.serviceTask = this.$store.state.bpmn.nodeVisible;
|
|
|
- //console.log("watch:",that.bpmnData)
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
@@ -890,21 +921,23 @@ export default {
|
|
|
console.log(element);
|
|
|
if (status == false) {
|
|
|
console.log("弹框关闭",this.$store.state.bpmn.nodeInfo.id);
|
|
|
- console.log(this.$store.state.bpmn.nodeInfo.businessObject.name,this.formData.name)
|
|
|
+ that.checkSatus = false
|
|
|
} else {
|
|
|
console.log("弹框开启",this.$store.state.bpmn.nodeInfo.id);
|
|
|
- if (element.businessObject) {
|
|
|
- let status = this.$store.state.bpmn.status;
|
|
|
+ that.checkSatus = true
|
|
|
+ }
|
|
|
+ if (element.businessObject) {
|
|
|
if (element.businessObject.$type === "bpmn:ServiceTask") {
|
|
|
//新增修改数据赋值
|
|
|
let data = this.bpmnData;
|
|
|
console.log(data)
|
|
|
+ let checkedKeys = [];
|
|
|
if (data.length > 0) {
|
|
|
that.formData.runName = undefined;
|
|
|
that.formData.name = undefined;
|
|
|
that.formData = {}
|
|
|
that.status = false
|
|
|
- let checkedKeys = [];
|
|
|
+ that.checked = []
|
|
|
checkedKeys.forEach((v) => {
|
|
|
that.$nextTick(() => {
|
|
|
that.$refs.menu.setChecked(v, true, false);
|
|
@@ -917,24 +950,26 @@ export default {
|
|
|
//多选框赋值
|
|
|
if(data[i].runName){
|
|
|
// 修改
|
|
|
- checkedKeys.push(data[i].nodes[a].id);
|
|
|
- checkedKeys.forEach((v) => {
|
|
|
- that.$nextTick(() => {
|
|
|
- that.$refs.menu.setChecked(v, true, false);
|
|
|
- that.checked = checkedKeys;
|
|
|
+ if(that.checkSatus){
|
|
|
+ if(-1 == checkedKeys.indexOf(data[i].nodes[a].id)){
|
|
|
+ checkedKeys.push(data[i].nodes[a].id);
|
|
|
+ }
|
|
|
+ checkedKeys.forEach((v) => {
|
|
|
+ that.$nextTick(() => {
|
|
|
+ that.$refs.menu.setChecked(v, true, false);
|
|
|
+ that.checked = checkedKeys;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
//多选框外部参数
|
|
|
that.formData.runName = data[i].runName;
|
|
|
that.formData.name = data[i].runName;
|
|
|
that.formData.nodes = data[i].nodes
|
|
|
- console.log('数据',data[i].runName)
|
|
|
that.formData.procedefKey = data[i].procedefKey;
|
|
|
if (data[i].nodes[a].id == "1") {
|
|
|
that.formData.describe1 = data[i].describe1
|
|
|
that.formData.describe2 = data[i].describe2
|
|
|
- console.log(111111)
|
|
|
if (data[i].blurry) {
|
|
|
that.formData.blurry = data[i].blurry
|
|
|
that.status = true
|
|
@@ -943,29 +978,26 @@ export default {
|
|
|
that.formData.deptName = data[i].deptName
|
|
|
that.status = true
|
|
|
}
|
|
|
- break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- console.log(that.status,that.formData)
|
|
|
} else {
|
|
|
that.formData.nodes = [];
|
|
|
}
|
|
|
that.serviceTask = that.$store.state.bpmn.nodeVisible;
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ console.log(that.bpmnData,that.formData,that.checked)
|
|
|
},
|
|
|
scriptTask(val) {
|
|
|
this.$store.state.bpmn.nodeVisible = val;
|
|
|
- console.log(3);
|
|
|
},
|
|
|
sequenceFlow(val) {
|
|
|
const element = this.$store.state.bpmn.nodeInfo;
|
|
|
const modeling = this.bpmnModeler.get("modeling");
|
|
|
modeling.updateLabel(element, val);
|
|
|
- console.log(4);
|
|
|
},
|
|
|
"formData.name": {
|
|
|
handler(val, old) {
|
|
@@ -975,10 +1007,6 @@ export default {
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
- // status(oldVal, newVal){
|
|
|
-
|
|
|
- // console.log(this.status)
|
|
|
- // }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -1008,10 +1036,16 @@ export default {
|
|
|
top: 0;
|
|
|
width: 300px;
|
|
|
}
|
|
|
-.buttons {
|
|
|
+.buttons-left {
|
|
|
position: absolute;
|
|
|
- left: 80px;
|
|
|
- bottom: 20px;
|
|
|
+ left: -30px;
|
|
|
+}
|
|
|
+.buttons-right {
|
|
|
+ position: absolute;
|
|
|
+ right: 0px !important;
|
|
|
+}
|
|
|
+.buttons {
|
|
|
+ bottom: 0px;
|
|
|
}
|
|
|
.buttons li {
|
|
|
display: inline-block;
|
|
@@ -1051,4 +1085,8 @@ export default {
|
|
|
.el-tree-node__children {
|
|
|
margin-left: 15px;
|
|
|
}
|
|
|
+.tree-border {
|
|
|
+ overflow:auto;
|
|
|
+ max-height:400px !important;
|
|
|
+}
|
|
|
</style>
|