diff --git a/src/components/work-flow/super-flow.vue b/src/components/work-flow/super-flow.vue index ec4099faf2aa9aac322cb354a18a35bf3642419d..3389d19784cdfe0a56197acdfdf777e52d507238 100644 --- a/src/components/work-flow/super-flow.vue +++ b/src/components/work-flow/super-flow.vue @@ -4,11 +4,11 @@
- +
{{ scale_num }}%
- +
@@ -27,13 +27,15 @@
@@ -412,9 +415,15 @@ export default { }, deep: true, }, + origin: { + handler() { + this.origins = this.origin; + }, + }, }, data() { return { + origins: [0, 0], scale_num: 100, nodeList: [], linkList: [], @@ -514,7 +523,7 @@ export default { { label: "删除", selected: (link) => { - console.log(link); + // console.log(link); link.remove(); }, }, @@ -619,6 +628,8 @@ export default { max_time_type_1: 1, max_time_check_0: false, max_time_check_1: false, + line_hieght: 41, + font_size: 16, }; }, mounted() { @@ -678,9 +689,10 @@ export default { clientX - conf.offsetLeft, clientY - conf.offsetTop ); - console.log(clientX, conf.offsetLeft, coordinate); + // console.log(clientX, conf.offsetLeft, coordinate); // 添加节点 - let query = { width: 120, height: 48, meta: {} }; + let scale = this.scale_num / 100; + let query = { width: 120 * scale, height: 48 * scale, meta: {} }; query.meta.type = conf.info.meta.type; if (!conf.info.meta.id) { query.meta.id = @@ -688,7 +700,6 @@ export default { "a" + parseInt(Math.random() * 1000 * 1000); } - console.log(query); this.$refs.superFlow.addNode({ coordinate, ...query, @@ -723,7 +734,6 @@ export default { }; } this.nodeParamsList.push(obj); - console.log(this.nodeParamsList); } conf.isMove = false; } @@ -733,6 +743,7 @@ export default { } }, nodeItemMouseDown(evt, info) { + console.log("dwad"); const { clientX, clientY, currentTarget } = evt; const { top, left } = evt.currentTarget.getBoundingClientRect(); const conf = this.dragConf; @@ -755,17 +766,25 @@ export default { clickItem(index) { let item = this.nodeParams(index); this.nodeItem = item; - console.log(item); + // console.log(item); }, blurItem() { this.nodeItem = { id: "", }; - console.log(this.nodeItem); + // console.log(this.nodeItem); }, getData() { + let objs = this.$refs.superFlow.toJSON(); + let scale = this.scale_num / 100; + objs.nodeList.forEach((item) => { + item.width = parseInt(item.width / scale); + item.height = parseInt(item.height / scale); + item.coordinate[0] = parseInt(item.coordinate[0] / scale); + item.coordinate[1] = parseInt(item.coordinate[1] / scale); + }); return { - obj: this.$refs.superFlow.toJSON(), + obj: objs, params: this.nodeParamsList, }; }, @@ -1022,7 +1041,7 @@ export default { let index = self.nodeParamsList.findIndex((item) => { return item.id == self.nodeItem.id; }); - console.log(self.nodeParamsList[index]); + // console.log(self.nodeParamsList[index]); let plugin_index = self.nodeParamsList[index].plugins.findIndex( (item) => { return item.plugin_type == 1; @@ -1221,23 +1240,22 @@ export default { let obj = this.$refs.superFlow.toJSON(); let nodes = obj.nodeList; let links = obj.linkList; - let node_meta_id = ""; + let node_id = ""; for (let i = 0; i < nodes.length; i++) { - console.log(nodes[i]); - if (nodes[i].id == item) { - node_meta_id = nodes[i].meta.id; + if (nodes[i].meta.id == item) { + node_id = nodes[i].id; nodes.splice(i, 1); } } for (let i = 0; i < links.length; i++) { - console.log(links[i]); - if (links[i].startId == item || links[i].endId == item) { + // console.log(links[i]); + if (links[i].startId == node_id || links[i].endId == node_id) { links.splice(i, 1); i--; } } - let index = this.nodeParamsList.findIndex((item) => { - return item.id == node_meta_id; + let index = this.nodeParamsList.findIndex((ele) => { + return ele.id == item; }); this.nodeParamsList.splice(index, 1); this.nodeList = nodes; @@ -1246,11 +1264,60 @@ export default { id: "", name: "", }; - console.log(this.nodeList, this.linkList, this.nodeParamsList); + // console.log(this.nodeList, this.linkList, this.nodeParamsList); + }, + changeScale(size) { + let old_scale = this.scale_num / 100; + if (this.scale_num > 50 && this.scale_num < 150) { + this.scale_num += size; + } else if (this.scale_num == 50) { + if (size > 0) { + this.scale_num += size; + } + } else if (this.scale_num == 150) { + if (size < 0) { + this.scale_num += size; + } + } + let scale = this.scale_num / 100; + // console.log(scale); + let obj = this.$refs.superFlow.toJSON(); + // console.log(obj); + obj.nodeList.forEach((item) => { + item.width /= old_scale; + item.width *= scale; + item.height /= old_scale; + item.height *= scale; + item.coordinate[0] /= old_scale; + item.coordinate[0] *= scale; + item.coordinate[1] /= old_scale; + item.coordinate[1] *= scale; + }); + this.line_hieght = 41 * scale; + this.font_size = 16 * scale; + this.nodeList = obj.nodeList; + this.linkList = obj.linkList; + }, + superMove(e) { + if (e.srcElement.id == "superFlow") { + this.$refs.superFlow.$el.style.cursor = "move"; + let old_X = e.clientX; + let old_Y = e.clientY; + let origin_left = this.origins[0]; + let origin_top = this.origins[1]; + document.onmousemove = (e) => { + let left = origin_left + e.clientX - old_X; + let top = origin_top + e.clientY - old_Y; + this.origins = [left, top]; + }; + document.onmouseup = (e) => { + this.$refs.superFlow.$el.style.cursor = "auto"; + document.onmousemove = null; + document.onmouseup = null; + }; + } else { + } }, - changeScale(type) { - - } }, }; @@ -1427,6 +1494,7 @@ export default { justify-content: space-around; border-radius: 8px; border: solid 2px #e3e5ef; + background-color: #fff; height: 40px; font-size: 16px; line-height: 36px; @@ -1435,10 +1503,12 @@ export default { .less { padding: 0 10px; border-right: solid 2px #e3e5ef; + cursor: pointer; } .add { padding: 0 10px; border-left: solid 2px #e3e5ef; + cursor: pointer; } .num { color: #58617a; @@ -1657,7 +1727,6 @@ export default { border: none; background-color: transparent; border-radius: 8px; - font-size: 16px; /deep/ .node_span { text-align: center; overflow: hidden; @@ -1667,7 +1736,6 @@ export default { .flow-node-begin { width: 100%; height: 100%; - line-height: 42px; padding: 0 6px; border-radius: 8px; border: solid 3px #109e93; @@ -1678,7 +1746,6 @@ export default { .flow-node-end { width: 100%; height: 100%; - line-height: 42px; padding: 0 6px; border-radius: 8px; background-color: #f78181; @@ -1689,7 +1756,6 @@ export default { .flow-node-default { width: 100%; height: 100%; - line-height: 42px; padding: 0 6px; border-radius: 8px; background-color: #fff; @@ -1699,7 +1765,6 @@ export default { .flow-node-default-active { width: 100%; height: 100%; - line-height: 42px; padding: 0 6px; border-radius: 8px; border: solid 3px #b4c6f5; diff --git a/src/pages/workbench/component-center/process-management/process-design/edit.vue b/src/pages/workbench/component-center/process-management/process-design/edit.vue index 2f1bceabff06427b908fe89ac32bfd60ea0911dd..e7f063d0ed4fc9d715fb1b663c1d92eac5a66f5e 100644 --- a/src/pages/workbench/component-center/process-management/process-design/edit.vue +++ b/src/pages/workbench/component-center/process-management/process-design/edit.vue @@ -151,6 +151,7 @@ export default { workflows_id: "", sector: 0, }, + loop: 0, }; }, methods: { @@ -172,8 +173,6 @@ export default { }); item.meta = da; item.node_code = da.node_code; - item.coordinate[0] = parseInt(item.coordinate[0]); - item.coordinate[1] = parseInt(item.coordinate[1]); if (item.meta.type == 1) { start_num++; start_id = item.id; @@ -198,6 +197,10 @@ export default { out_edge++; } }); + this.loop = 0; + datas.nodeList.forEach((item) => { + this.checkClosedLoop(datas.linkList, item.id, end_id); + }); datas.linkList.forEach((item) => { if (start_id == item.endId) { start_before++; @@ -230,10 +233,31 @@ export default { type: "warning", }); return false; + } else if (this.loop != 0) { + this.$message({ + message: "存在闭环", + type: "warning", + }); } else { return datas; } }, + checkClosedLoop(arr, id, endding_id) { + // let self = this; + // arr.forEach((item) => { + // if (item.startId == id) { + // if (item.endId == endding_id) { + // return false; + // } else if (item.endId == id) { + // self.loop++; + // } else { + // this.checkClosedLoop(arr, item.endId, endding_id); + // } + // } else { + // return false; + // } + // }); + }, backToList() { this.$router.push("/progress/designer"); }, diff --git a/src/pages/workbench/component-center/process-management/process-design/index.vue b/src/pages/workbench/component-center/process-management/process-design/index.vue index 69d94a4cba2e988c4faf816f9b1f003a5d467c05..45e7e70319d334921175a4b4878f1ba72fa153cf 100644 --- a/src/pages/workbench/component-center/process-management/process-design/index.vue +++ b/src/pages/workbench/component-center/process-management/process-design/index.vue @@ -136,6 +136,7 @@ export default { }, workplace_list: [], origin: [], + loop: 0, }; }, methods: { @@ -157,8 +158,6 @@ export default { }); item.meta = da; item.node_code = da.node_code; - item.coordinate[0] = parseInt(item.coordinate[0]); - item.coordinate[1] = parseInt(item.coordinate[1]); if (item.meta.type == 1) { start_num++; start_id = item.id; @@ -183,6 +182,10 @@ export default { out_edge++; } }); + this.loop = 0; + datas.nodeList.forEach((item) => { + this.checkClosedLoop(datas.linkList, item.id, end_id); + }); datas.linkList.forEach((item) => { if (start_id == item.endId) { start_before++; @@ -215,10 +218,31 @@ export default { type: "warning", }); return false; + } else if (this.loop != 0) { + this.$message({ + message: "存在闭环", + type: "warning", + }); } else { return datas; } }, + checkClosedLoop(arr, id, endding_id) { + // let self = this; + // arr.forEach((item) => { + // if (item.startId == id) { + // if (item.endId == endding_id) { + // return false; + // } else if (item.endId == id) { + // self.loop++; + // } else { + // this.checkClosedLoop(arr, item.endId, endding_id); + // } + // } else { + // return false; + // } + // }); + }, backToList() { this.$router.push("/progress/designer"); }, diff --git a/src/pages/workbench/fwzc_fwcs.vue b/src/pages/workbench/fwzc_fwcs.vue index 93c09480b01a3ed087bc3cd16d968db7541f7aee..2615bb66bee5e234089585499129eb2cbc143e16 100644 --- a/src/pages/workbench/fwzc_fwcs.vue +++ b/src/pages/workbench/fwzc_fwcs.vue @@ -539,7 +539,7 @@ export default { trigger: "blur", }, ], - area: [{ required: true, message: "请选择服务领域", trigger: "blur" }], + area: [{ required: true, message: "请选择服务领域", trigger: "change" }], origin: [ { required: true, message: "请选择所属组织", trigger: "blur" }, ],