whj há 11 meses atrás
pai
commit
74f27d38ee

+ 9 - 0
src/views/custom/form/modules/BaseForm.vue

@@ -59,6 +59,15 @@
         </a-checkbox-group>
       </a-form-item>
     </a-form>
+    <a-form v-show="current===3">
+      <a-form-item label="绑定流程" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+        <a-select v-model="flowId">
+          <a-select-option v-for="(label,value) in categoryMap" :value="value" :key="value">
+            {{ label }}
+          </a-select-option>
+        </a-select>
+      </a-form-item>
+    </a-form>
   </a-card>
 </template>
 

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

@@ -49,12 +49,13 @@ export default {
       details: [
         {
           name: '发起人',
-          id: '1',
+          id: String(+new Date()),
           type: 1,
           sortNum: 1,
           y: 100,
           x: 500,
           children: [],
+          parentIds: [],
         },
       ],
     }
@@ -190,6 +191,7 @@ export default {
           return
         }
         val.source.__vue__.detail.children.push(val.target.__vue__.detail.id)
+        val.target.__vue__.detail.parentIds.push(val.source.__vue__.detail.id)
       })
       // 删除连接
       this.instance.bind(EVENT_CONNECTION_DBL_CLICK, (conn) => {
@@ -200,6 +202,10 @@ export default {
               conn.source.__vue__.detail.children.indexOf(conn.target.__vue__.detail.id),
               1
             )
+            conn.target.__vue__.detail.parentIds.splice(
+              conn.target.__vue__.detail.parentIds.indexOf(conn.source.__vue__.detail.id),
+              1
+            )
             that.instance.deleteConnection(conn)
           },
         })
@@ -229,6 +235,7 @@ export default {
         titleColumnCode: '',
         handleNameId: '',
         sortNum: record.sortNum++,
+        parentIds: [record.id],
       }
       if (record.children.length > 0) {
         const children = this.details
@@ -278,6 +285,7 @@ export default {
       this.instance.unmanage(document.getElementById(record.id))
       this.details = this.details.filter((item) => {
         item.children = item.children.filter((child) => child !== record.id)
+        item.parentIds = item.parentIds.filter((child) => child !== record.id)
         return item.id !== record.id
       })
     },
@@ -313,7 +321,7 @@ export default {
       this.details = [
         {
           name: '发起人',
-          id: '1',
+          id: String(+new Date()),
           type: 1,
           sortNum: 1,
           y: 100,