Просмотр исходного кода

工作流按照字段配置节点

hujunwei@agilestar.cn 1 год назад
Родитель
Сommit
5ef44ce581
2 измененных файлов с 286 добавлено и 12 удалено
  1. 72 7
      src/components/workflowBase.vue
  2. 214 5
      src/pages/main/workflowdef/qathList.vue

+ 72 - 7
src/components/workflowBase.vue

@@ -131,6 +131,8 @@ export default {
       manyReassignment: false,
       actives: "",
       resourceId: '',
+      paramsJson: '',
+      getNextPathindex: 0
     };
   },
   props: {
@@ -419,7 +421,13 @@ export default {
         processId: processDefinitionKey,
       };
       e ? (list.resourceId = e) : list;
-
+      console.log(this.paramsJson);
+      console.log(this.getNextPathindex);
+      // if (this.getNextPathindex == 3) {
+      if (this.paramsJson.length > 1) {
+        list.paramsJson = this.paramsJson
+      }
+      // }
       this.$http({
         url: "/market/waf/queryPath",
         method: "post",
@@ -467,7 +475,57 @@ export default {
             this.node = res.data.body;
           } else {
             this.resourceId = res.data.body.nextShapes[0].resourceId
-            this.getNextPath(res.data.body.nextShapes[0].resourceId, 2);
+            // alert(111)
+            // if (this.getNextPathindex == 2) {
+            let paramsJson = '|'
+            let biggestNum = 0;
+            this.$http({
+              url: "/market/CfgWorkflowChooseNode/queryList",//筛选自定义候选节点
+              method: "post",
+              headers: {
+                "Content-Type": "application/json",
+              },
+              data: {
+                tableName: this.requestForm.processDefinitionKey,
+                fresourceId: this.requestForm.fresourceId,
+                resourceid: this.resourceId,
+              },
+            }).then((ress) => {
+              let arr = []
+              if (ress.data.length > 0) {
+                ress.data.map((item) => {
+                  if (item.paramsJson.length > biggestNum) {
+                    biggestNum = item.paramsJson.length
+                    arr = item.paramsJson.split('|').slice(1)
+                    arr.pop()
+                    console.log(arr);
+
+                  }
+                })
+                arr.map((items, index) => {
+                  console.log(items.split(':'));
+                  paramsJson += items.split(':')[0] + ':' + this.list[items.split(':')[0]] + '|'
+                })
+                // this.getNextPathindex = 0
+                // for (var key in JSON.parse(ress.data[0].paramsJson)) {
+                //   console.log(key, JSON.parse(ress.data[0].paramsJson)[key])
+                //   if (this.requestForm.processDefinitionKey == ress.data[0].tableName) {
+                //     
+                //   }
+                // }
+                // console.log(key)
+              }
+              // paramsJson.nodeResourceId=ress.data[0].nodeResourceId
+              console.log(paramsJson);
+              this.paramsJson = paramsJson
+              this.getNextPathindex++
+              this.getNextPath(res.data.body.nextShapes[0].resourceId, 2);
+            })
+            // }
+
+            // console.log(this.paramsJson);
+
+
           }
         }
         if (status === 3) {
@@ -490,6 +548,7 @@ export default {
     //查询候选人接口
     getTreeLists(e, status) {
       let paramsJson = {}
+      let biggestNum = 0;
       this.$http({
         url: "/market/CfgWorkflowChoosePerson/queryList",//筛选自定义候选人
         method: "post",
@@ -503,12 +562,18 @@ export default {
         },
       }).then((res) => {
         if (res.data.length > 0) {
-          for (var key in JSON.parse(res.data[0].paramsJson)) {
-            console.log(key, JSON.parse(res.data[0].paramsJson)[key])
-            if (this.requestForm.processDefinitionKey == res.data[0].tableName) {
-              paramsJson[key] = this.list[key]
+          res.data.map((item) => {
+            if (item.paramsJson.length > biggestNum) {
+              biggestNum = item.paramsJson.length
+              for (var key in JSON.parse(item.paramsJson)) {
+                console.log(key, JSON.parse(item.paramsJson)[key])
+                if (this.requestForm.processDefinitionKey == item.tableName) {
+                  paramsJson[key] = this.list[key]
+                }
+              }
             }
-          }
+          })
+
           // console.log(key)
         }
         console.log(paramsJson);

+ 214 - 5
src/pages/main/workflowdef/qathList.vue

@@ -1,14 +1,14 @@
 <template>
     <div class="flex-box1">
         <Seach :list="filterDataTwo" @seachList="seachList"></Seach>
-        <el-table :data="tableData" style="width: 100%;min-height: 600px;" ref="refTable" height="600px">
+        <el-table :data="tableData" v-loading="loading" style="width: 100%;min-height: 600px;" ref="refTable"
+            height="600px">
             <el-table-column type="expand">
                 <template slot-scope="props">
                     <el-table :data="props.row.nextNodes" size="mini" style="width: 95%;margin-left: 5%;"
                         @cell-click="getRowList">
                         <el-table-column label="下一步环节" prop="name"></el-table-column>
                         <el-table-column label="resourceId" prop="resourceId"></el-table-column>
-
                     </el-table>
                 </template>
             </el-table-column>
@@ -20,12 +20,14 @@
                 <template slot-scope="scope">
                     <el-button size="mini" type="text" @click="getRiskadminform(scope.row)">
                         配置候选人</el-button>
+                    <el-button size="mini" type="text" @click="getRiskadminform2(scope.row)">
+                        配置候选节点</el-button>
                 </template>
             </el-table-column>
         </el-table>
 
 
-        <el-dialog title="配置信息" :visible.sync="dialogStatus" width="100%" style="height: 100%" :fullscreen="true"
+        <el-dialog title="配置候选人信息" :visible.sync="dialogStatus" width="100%" style="height: 100%" :fullscreen="true"
             :before-close="handleClose1" :modal="false" v-if="dialogStatus" :destroy-on-close="true">
             <el-button type="primary" @click="dialogTreeStatus2 = true">新增</el-button>
             <el-button type="primary" v-if="delarr.length > 0" @click="delarrbtn">批量删除</el-button>
@@ -53,8 +55,75 @@
                 :total="adminpageData.total" @size-change="adminhandleSizeChange"
                 @current-change="adminhandleCurrentChange" />
         </el-dialog>
+        <el-dialog title="配置节点信息" :visible.sync="dialogStatus2" width="100%" style="height: 100%" :fullscreen="true"
+            :before-close="handleClose4" :modal="false" v-if="dialogStatus2" :destroy-on-close="true">
+            <!-- <el-button type="primary" @click="dialogTreeStatus3 = true">新增</el-button> -->
+            <!-- <el-button type="primary" v-if="delarr.length > 0" @click="delarrbtn2">批量删除</el-button> -->
+            <div style="display: flex;">
+                <el-table :data="tableData3" style="width: 100%;min-height: 600px;" ref="refTable4" height="600px"
+                    @selection-change="selectionChange">
+                    <!-- 是否多选 -->
+                    <!-- <el-table-column type="selection" width="55">
+                    </el-table-column> -->
+                    <el-table-column type="expand">
+                        <template slot-scope="props">
+                            <el-table :data="props.row.nextNodes" size="mini" style="width: 95%;margin-left: 5%;"
+                                @cell-click="getRowList">
+                                <el-table-column type="expand">
+                                    <template slot-scope="props">
+                                        <el-table :data="props.row.nextNodes" size="mini"
+                                            style="width: 95%;margin-left: 5%;" @cell-click="getRowList">
+                                            <el-table-column label="name" prop="name"></el-table-column>
+                                            <el-table-column label="resourceId" prop="resourceId"></el-table-column>
+                                            <el-table-column label="json" prop="json">
+                                            </el-table-column>
+                                            <el-table-column label="操作" align="center">
+                                                <template slot-scope="scope">
+                                                    <el-button size="mini" type="text" @click="jiedianedit(scope.row)">
+                                                        配置字段</el-button>
+                                                    <el-button size="mini" type="text" @click="delarrbtn2(scope.row)">
+                                                        删除字段</el-button>
+                                                </template>
+                                            </el-table-column>
+                                        </el-table>
+                                    </template>
+                                </el-table-column>
+                                <el-table-column label="name" prop="name"></el-table-column>
+                                <el-table-column label="resourceId" prop="resourceId"></el-table-column>
+                                <el-table-column label="json" prop="json">
+                                </el-table-column>
+                                <el-table-column label="操作" align="center">
+                                    <template slot-scope="scope">
+                                        <el-button size="mini" type="text" @click="jiedianedit(scope.row)">
+                                            配置字段</el-button>
+                                        <el-button size="mini" type="text" @click="delarrbtn2(scope.row)">
+                                            删除字段</el-button>
+                                    </template>
+                                </el-table-column>
+                            </el-table>
+                        </template>
+                    </el-table-column>
+                    <el-table-column label="name" prop="name">
+                    </el-table-column>
+                    <el-table-column label="resourceId" prop="resourceId">
+                    </el-table-column>
+                    <el-table-column label="json" prop="json">
+                    </el-table-column>
+                    <el-table-column label="操作" align="center">
+                        <template slot-scope="scope">
+                            <el-button size="mini" type="text" @click="jiedianedit(scope.row)">
+                                配置字段</el-button>
+                            <el-button size="mini" type="text" @click="delarrbtn2(scope.row)">
+                                删除字段</el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
 
-        <el-dialog title="配置字段" :visible.sync="dialogTreeStatus2" width="100%" style="height: 100%" :fullscreen="true"
+            </div>
+         
+        </el-dialog>
+
+        <el-dialog title="配置候选人字段" :visible.sync="dialogTreeStatus2" width="100%" style="height: 100%" :fullscreen="true"
             :before-close="handleClose2" :modal="false" v-if="dialogTreeStatus2" :destroy-on-close="true">
             <div style="height: 100%">
                 <div style="height: 100%">
@@ -81,6 +150,34 @@
                 </div>
             </div>
         </el-dialog>
+        <el-dialog title="配置节点字段" :visible.sync="dialogTreeStatus3" width="100%" style="height: 100%" :fullscreen="true"
+            :before-close="handleClose5" :modal="false" v-if="dialogTreeStatus3" :destroy-on-close="true">
+            <div style="height: 100%">
+                <div style="height: 100%">
+                    <!-- 上一级resourceId: <el-input v-model="resourceId"></el-input> -->
+                    <el-form ref="form" :model="fromList" :rules="rule" label-width="130px" style="margin-top: 30px">
+                        <div v-for="(item, index) in fromList.limitList">
+                            <el-form-item label="字段名称:">
+                                <el-input v-model="item.needName"></el-input>
+                            </el-form-item>
+                            <el-form-item label="字段值:">
+                                <el-input v-model="item.needCode"></el-input>
+                            </el-form-item>
+                        </div>
+                    </el-form>
+
+                    <div style="text-align: center; margin-top: 30px">
+                        <el-button style="width: 80px;margin-right: 20px;margin-left: 40px" @click="addNewLimitAuth()">添加
+                        </el-button>
+                        <el-button type="primary" @click="clickSave(3)">确 定</el-button>
+                        <el-button @click="dialogTreeStatus3 = false;">取 消</el-button>
+                        <el-button style="width: 80px;margin-right: 20px;margin-left: 40px" type="danger"
+                            v-if="fromList.limitList.length > 1" @click="delNewLimitAuth()">删除
+                        </el-button>
+                    </div>
+                </div>
+            </div>
+        </el-dialog>
         <el-dialog title="配置人员" :visible.sync="dialogTreeStatus" width="100%" style="height: 100%" :fullscreen="true"
             :before-close="handleClose3" :modal="false" v-if="dialogTreeStatus" :destroy-on-close="true">
             <div style="height: 100%">
@@ -111,8 +208,10 @@ export default {
         return {
             loading: false,
             dialogStatus: false,
+            dialogStatus2: false,
             dialogTreeStatus: false,
             dialogTreeStatus2: false,
+            dialogTreeStatus3: false,
             rule: {
                 needCode: [
                     { required: true, message: "请添加字段值", trigger: "blur" },
@@ -142,6 +241,7 @@ export default {
             searchBox: {},
             tableData: [],
             tableData2: [],
+            tableData3: [],
             adminpageData: {
                 total: 15, // 总条数
                 pageSizes: 10, // 每页数量
@@ -151,11 +251,14 @@ export default {
                 limitList: [{}]
             },
             resourceId: '',
+            nodeResourceId: '',
             treeListonly: [],
             defaultList: [],
             delarr: [],
             depttype: 0,
             closeList: false,
+            updatestatusId: '',
+
 
         }
     },
@@ -173,6 +276,22 @@ export default {
         getRowList() {
 
         },
+        jiedianedit(v) {
+            console.log(v);
+            if (v.id) {
+                this.updatestatusId = v.id
+            } else {
+                this.updatestatusId = ''
+            }
+            this.resourceId = v.parentResourceId
+            this.nodeResourceId = v.resourceId
+            this.dialogTreeStatus3 = true
+        },
+        jiedianadd(v) {
+
+            this.nodeResourceId = v.resourceId
+            this.dialogTreeStatus3 = true
+        },
         delarrbtn() {///CfgWorkflowChoosePerson/delBatch
             this.$http({
                 url: "/market/CfgWorkflowChoosePerson/delBatch",
@@ -190,6 +309,27 @@ export default {
                 this.getRiskadminform(this.resourceId)
             });
         },
+        delarrbtn2(v) {///CfgWorkflowChoosePerson/delBatch
+            this.$http({
+                url: "/market/CfgWorkflowChooseNode/del",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json",
+                },
+                data: {
+                    id: v.id
+                },
+            }).then((res) => {
+                this.$notify({
+                    title: res.data.desc,
+                    message: res.data.desc,
+                    type: "success",
+                });
+                this.dialogStatus2 = false;
+                this.getRiskadminList(this.searchBox)
+                this.getRiskadminList(this.searchBox)
+            });
+        },
         del(v) {///CfgWorkflowChoosePerson/delBatch
             this.$http({
                 url: "/market/CfgWorkflowChoosePerson/del",
@@ -245,6 +385,21 @@ export default {
             });
 
         },
+        getRiskadminform2(v) {///CfgWorkflowChoosePerson/queryPage
+            console.log(v);
+            let list = this.searchBox
+            // list.resourceid = v.resourceId
+            // list.tableName = v.processId
+            // list.type='1'
+            if (v.resourceId) {
+                this.resourceId = v.resourceId
+            }
+            // this.loading = true
+            this.tableData3 = v.nextNodes
+            this.dialogStatus2 = true
+         
+
+        },
         async clickSave(v) {
             if (v == 1) {
                 this.$refs.form.validate((valid) => {
@@ -255,7 +410,7 @@ export default {
                         return false;
                     }
                 });
-            } else {
+            } else if (v == 2) {
                 // console.log(this.treeListonly);
                 // console.log(this.fromList);
                 // console.log(this.resourceId);
@@ -295,6 +450,49 @@ export default {
                     this.dialogStatus = false;
                     this.dialogTreeStatus2 = false;
                 });
+            } else if (v == 3) {
+                console.log(this.fromList);
+                console.log(this.nodeResourceId);
+                let paramsJson = '|'
+                this.fromList.limitList.map((item) => {
+                    console.log(item);
+                    paramsJson += item.needName + ':' + item.needCode + '|'
+                })
+                let url = '/market/CfgWorkflowChooseNode/add'
+                let list = {
+                    tableName: this.searchBox.processId,
+                    fresourceid: this.searchBox.fresourceId,
+                    resourceid: this.resourceId,
+                    nodeResourceId: this.nodeResourceId,
+                    paramsJson: paramsJson,
+                }
+                if (this.updatestatusId) {
+                    url = '/market/CfgWorkflowChooseNode/update'
+                    list.id = this.updatestatusId
+                }
+
+                console.log(paramsJson);
+
+                this.$http({
+                    url: url,
+                    method: "post",
+                    headers: {
+                        "Content-Type": "application/json",
+                    },
+                    data: list,
+                }).then((res) => {
+                    this.$notify({
+                        title: res.data.desc,
+                        message: res.data.desc,
+                        type: "success",
+                    });
+                    this.dialogTreeStatus = false;
+                    this.dialogStatus = false;
+                    this.dialogStatus2 = false;
+                    this.dialogTreeStatus3 = false;
+                    this.getRiskadminList(this.searchBox)
+                    this.getRiskadminList(this.searchBox)
+                });
             }
 
 
@@ -311,6 +509,12 @@ export default {
         handleClose1() {//关闭弹窗
             this.dialogStatus = false;
         },
+        handleClose4() {//关闭弹窗
+            this.dialogStatus2 = false;
+        },
+        handleClose5() {//关闭弹窗
+            this.dialogTreeStatus3 = false;
+        },
         handleClose2() {//关闭弹窗
             this.dialogTreeStatus2 = false;
         },
@@ -318,6 +522,10 @@ export default {
             this.dialogTreeStatus = false;
         },
         getRiskadminList(e) {
+            let form = {}
+            form = this.searchBox
+            // form.type = '0'
+            this.loading = true
             this.$http({
                 url: "/market/waf/queryPathList",
                 method: "post",
@@ -327,6 +535,7 @@ export default {
                 data: this.searchBox,
             }).then((res) => {
                 this.tableData = res.data.body;
+                this.loading = false
 
             });
         },