whj 11 maanden geleden
bovenliggende
commit
188876c110

+ 22 - 16
src/views/workflow/workflow/modules/BaseForm.vue

@@ -1,5 +1,5 @@
 <template>
-  <div v-show="visible">
+  <div v-if="visible">
     <div class="title">
       <h3>{{modalTitle}}</h3>
       <a-space>
@@ -19,7 +19,7 @@
         </a-space>
       </div>
       <div ref="container" class="container" :style="{transform: `scale(${scale / 100})`}">
-        <Node v-for="(item, index) in details" :key="index" :detail="item" :ref="item.id" @add="add" @edit="edit" @delete="handleDelete" />
+        <Node v-for="(item, index) in details" :key="index" :detail="item" :id="item.id" @add="add" @edit="edit" @delete="handleDelete" />
       </div>
       <BaseForm ref="baseModal" />
     </div>
@@ -61,20 +61,24 @@ export default {
   },
   mounted() {},
   created() {},
+  destroyed() {
+    console.log('de')
+  },
   methods: {
     base(record) {
       this.visible = true
       // 如果是空标识添加
       if (this.BaseTool.Object.isBlank(record)) {
         this.modalTitle = '添加'
-        this.init()
-        return
+      } else {
+        this.record = record
+        this.name = record.name
+        this.modalTitle = '编辑'
+        this.details = JSON.parse(record.json)
       }
-      this.record = record
-      this.name = record.name
-      this.modalTitle = '编辑'
-      this.details = JSON.parse(record.json)
-      this.init()
+      this.$nextTick(() => {
+        this.init()
+      })
     },
     init() {
       const that = this
@@ -134,8 +138,8 @@ export default {
           item.children.forEach((children) => {
             that.instance.connect({
               // 获取节点1和节点2的引用
-              source: this.$refs[item.id][0].$el,
-              target: this.$refs[children][0].$el,
+              source: document.getElementById(item.id),
+              target: document.getElementById(children),
               // 连接方式,这里设置为连续
               // paintStyle: { stroke: children.label == '同意' ? '#345' : 'red', strokeWidth: 3 },
               // 连接器类型,这里设置为Flowchart
@@ -217,7 +221,7 @@ export default {
     add(record, type) {
       const newVal = {
         name: type === 2 ? '条件分支' : '审核人',
-        id: +new Date(),
+        id: String(+new Date()),
         verifier: '',
         userName: '',
         reflect: '',
@@ -249,7 +253,7 @@ export default {
         record.children.push(newVal.id)
         this.details.push({
           x: record.x,
-          y: record.y + 250,
+          y: record.y + 240,
           type,
           children: [],
           ...newVal,
@@ -258,8 +262,8 @@ export default {
       this.$nextTick(() => {
         this.instance.connect({
           // 获取节点1和节点2的引用
-          source: this.$refs[record.id][0].$el,
-          target: this.$refs[newVal.id][0].$el,
+          source: document.getElementById(record.id),
+          target: document.getElementById(newVal.id),
           // 连接方式,这里设置为连续
           // paintStyle: { stroke: children.label == '同意' ? '#345' : 'red', strokeWidth: 3 },
           // 连接器类型,这里设置为Flowchart
@@ -271,8 +275,9 @@ export default {
     },
     //删除节点
     handleDelete(record) {
-      this.instance.unmanage(this.$refs[record.id][0].$el, true)
+      this.instance.unmanage(document.getElementById(record.id), true)
       this.details = this.details.filter((item) => {
+        item.children = item.children.filter((child) => child !== record.id)
         return item.id !== record.id
       })
     },
@@ -316,6 +321,7 @@ export default {
           children: [],
         },
       ]
+
       this.$emit('ok')
     },
   },

+ 5 - 2
src/views/workflow/workflow/modules/modules/BaseForm.vue

@@ -94,7 +94,6 @@ export default {
   },
   created() {
     this.handleConditionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.TREATMENT_CONDITION)
-    console.log(this.handleConditionMap)
     getDeptTree().then((res) => {
       this.treeData = this.setTree(res.data)
     })
@@ -106,16 +105,20 @@ export default {
     base(record) {
       this.visible = true
       this.record = record
+      record.deptId && this.handleDept(record.deptId)
+      record.titleCode && this.handleTitleCode(record.titleCode)
+      record.titleColumnCode && this.handleTitleColumnCode(record.titleColumnCode)
+
       const {
         form: { setFieldsValue },
       } = this
-
       this.$nextTick(() => {
         setFieldsValue(
           Object.assign(
             pick(record, [
               'name',
               'verifier',
+              'deptId',
               'reflect',
               'titleCode',
               'titleColumnCode',