Bläddra i källkod

Update workflowBase.vue

胡俊炜 2 år sedan
förälder
incheckning
2f2dfceb53
1 ändrade filer med 204 tillägg och 103 borttagningar
  1. 204 103
      src/components/workflowBase.vue

+ 204 - 103
src/components/workflowBase.vue

@@ -10,12 +10,8 @@
               <div class="flex-path-list">
                 <div v-if="transferStatus" @click="clickTransfer(1)">转派</div>
                 <div v-if="copyStatus" @click="clickTransfer(2)">抄送</div>
-                <div
-                  v-for="(item, index) in node.nextShapes"
-                  :key="index"
-                  :class="seleIndex == index ? 'active' : ''"
-                  @click="clickGetTree(item, index)"
-                >
+                <div v-for="(item, index) in node.nextShapes" :key="index" :class="seleIndex == index ? 'active' : ''"
+                  @click="clickGetTree(item, index)">
                   {{ item.properties.name }}
                 </div>
               </div>
@@ -24,18 +20,11 @@
           <div class="flex-commons">
             <div class="flex-left-header-text">
               常用意见
-              <span @click="clickEdit" class="flex-icon"
-                ><i class="el-icon-edit"></i>修改</span
-              >
+              <span @click="clickEdit" class="flex-icon"><i class="el-icon-edit"></i>修改</span>
             </div>
             <div class="flex-slide">
-              <div
-                v-for="(item, index) in commonlyList"
-                :key="index"
-                ref="common"
-                class="flex-common"
-                @click="clickCommonly($event)"
-              >
+              <div v-for="(item, index) in commonlyList" :key="index" ref="common" class="flex-common"
+                @click="clickCommonly($event)">
                 {{ item.dataName }}
               </div>
             </div>
@@ -43,30 +32,17 @@
         </div>
         <div class="flex-opinion">
           <div class="flex-left-header-text">意见内容</div>
-          <el-input
-            type="textarea"
-            autosize
-            placeholder="请输入内容"
-            v-model="textarea"
-          >
+          <el-input type="textarea" autosize placeholder="请输入内容" v-model="textarea">
           </el-input>
         </div>
       </div>
       <div class="flex-right" :class="{ copyClass: CopyStatus }">
-        <div
-          class="flex-left-header-text"
-          :class="{ 'flex-right-text': CopyStatus }"
-        >
+        <div class="flex-left-header-text" :class="{ 'flex-right-text': CopyStatus }">
           本部门人员办理
           <div style="display: flex">
             <div class="flex-header-text-tree">
               候选人
-              <deptTree
-                ref="defTree"
-                class="flex-slide"
-                :treeList="treeList"
-                @changeTree="changeTree"
-              />
+              <deptTree ref="defTree" class="flex-slide" :treeList="treeList" @changeTree="changeTree" />
             </div>
             <div class="flex-header-text-tree">
               已选人员
@@ -79,12 +55,7 @@
           <div style="display: flex">
             <div class="flex-header-text-tree">
               抄送人
-              <deptTree
-                ref="defTrees"
-                class="flex-slide"
-                :treeList="treeCopyList"
-                @changeTree="changeTreeCopy"
-              />
+              <deptTree ref="defTrees" class="flex-slide" :treeList="treeCopyList" @changeTree="changeTreeCopy" />
             </div>
             <div class="flex-header-text-tree">
               已选人员
@@ -99,23 +70,12 @@
         <el-button type="primary" @click="submitWork()">提交</el-button>
       </div>
     </div>
-    <el-dialog
-      title="修改常用意见"
-      :visible.sync="editStatus"
-      width="100%"
-      :before-close="editCloses"
-      :modal="false"
-      :destroy-on-close="true"
-    >
+    <el-dialog title="修改常用意见" :visible.sync="editStatus" width="100%" :before-close="editCloses" :modal="false"
+      :destroy-on-close="true">
       <div style="overflow-y: scroll; overflow-x: hidden; height: 240px">
-        <div
-          v-for="(item, index) in commonlyList"
-          :key="index"
-          ref="common"
-          class="flex-common"
-        >
+        <div v-for="(item, index) in commonlyList" :key="index" ref="common" class="flex-common">
           {{ item.dataName
-          }}<i class="el-icon-circle-close" @click="deleStatus(item)"></i>
+}}<i class="el-icon-circle-close" @click="deleStatus(item)"></i>
         </div>
         <div class="flex-common">
           <i class="el-icon-circle-plus-outline" @click="addStatus()"></i>
@@ -134,6 +94,7 @@ export default {
   name: "workflow",
   data() {
     return {
+      manyPeopleStatus: false, //多人处理下发任务
       editStatus: false, //常用意见控制
       transferStatus: false, //转派按钮控制
       TransferStatus: false, //是否点击转派状态
@@ -151,6 +112,10 @@ export default {
       initialList: [], //第一次进入是加载节点
       clicknextName: "", //获取的流程节点
       backThree: [],
+      treeCopyList: [],
+      demand: "",
+      nextDealManList: "",
+      isLastManStatus: false,
     };
   },
   props: {
@@ -168,48 +133,137 @@ export default {
     this.getMetirialType();
   },
   methods: {
+    async nextWorks(lists, list) {
+      let _this = this;
+      let obj = {
+        url: _this.$url.formList.nextWork, //下一步工作流接口
+        data: lists,
+        status: "form",
+      };
+      await this.common.httpPost(obj, success);
+      function success(data) {
+        let updateList = {
+          taskId: data.taskid,
+          id: _this.list.id,
+          resourceId: _this.nodes.currentShape[0].resourceId,
+          tableName: _this.requestForm.processDefinitionKey,
+        };
+        list.taskId = data.taskid;
+        _this.setUpdate(updateList);
+        _this.getLastManList(list);
+      }
+    },
     submitWork() {
-      if (this.TransferStatus === true) {
-        if (this.backThree.length > 0) {
-          this.nextWork();
+      //多人会签处理环节
+      let list = {
+        userId: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员id
+        taskId: this.list.taskId, //表单标识
+        // procinstid: this.list.processId,
+        taskName: this.clicknextName, //流程节点
+        userCode: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员code
+        content: this.textarea, //意见内容
+      };
+      let newlist = {
+        userId: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员id
+        taskId: this.list.taskId, //表单标识
+        // procinstid: this.list.processId,
+        taskName: this.clicknextName, //流程节点
+        userCode: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员code
+        content: this.textarea, //意见内容
+      };
+      if (this.manyPeopleStatus == true) {
+        list.procinstid = this.list.processId;
+        if (this.backThree.length <= 1) {
+          this.$message.error("请选择多人");
+          return;
         } else {
-          this.$message.error("请选择候选人");
-          return false;
-        }
-      } else {
-        let list = {
-          userId: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员id
-          taskId: this.list.taskId, //表单标识
-          taskName: this.clicknextName, //流程节点
-          userCode: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员code
-          content: this.textarea, //意见内容
-          // resolution: this.nodes.currentShape[0].condition.resolution, //流程图线节点
-          // nextDealMan: this.backThree[0].loginNoStr || '', //下一步处理人
-        };
-        if (this.copyUser) {
-          //抄送
-          list.copyman = this.backCopyThree[0].loginNoStr;
+          list.lastmanList = this.nextDealManList;
         }
         if (this.nodes.currentShape) {
-          list.resolution = this.nodes.currentShape[0].condition.resolution;
-          list.approve = this.nodes.currentShape[0].condition.approve;
+          newlist.resolution = this.nodes.currentShape[0].condition.resolution;
+          newlist.approve = this.nodes.currentShape[0].condition.approve;
+        }
+        if (this.backThree.length > 0) {
+          newlist.nextDealMan = "admin";
+        }
+        this.nextWorks(newlist, list);
+      } else {
+        console.log(456);
+        //生成需求决策编号
+        if (this.clicknextName === "起草人发送") {
+          this.getDemand();
         }
-        if (this.clicknextName === "") {
-          this.$message.error("请选择流程节点");
+        if (!this.list.taskId) {
+          this.$message.error("请先保存表单后处理");
           return false;
         }
-        if (this.backThree.length > 0) {
-          list.nextDealMan = this.backThree[0].loginNoStr;
-        } else {
-          if (this.clicknextName === "流程结束"||this.clicknextName === "提交至任务发起人") {
+        if (this.TransferStatus === true) {
+          if (this.backThree.length > 0) {
+            this.nextWork();
           } else {
             this.$message.error("请选择候选人");
             return false;
           }
+        } else {
+          if (this.treeCopyList.length) {
+            //抄送
+            list.copyman = this.treeCopyList[0].loginNoStrCopy;
+          }
+          if (this.isLastManStatus == true) {
+            list.lastman = "yes";
+          }
+          if (this.nodes.currentShape) {
+            list.resolution = this.nodes.currentShape[0].condition.resolution;
+            list.approve = this.nodes.currentShape[0].condition.approve;
+          }
+          if (this.clicknextName === "") {
+            this.$message.error("请选择流程节点");
+            return false;
+          }
+          if (this.backThree.length > 0) {
+            if (this.manyPeopleStatus == true) {
+              list.nextDealManList = this.nextDealManList;
+            } else {
+              list.nextDealMan = this.backThree[0].loginNoStr;
+            }
+          } else {
+            if (this.clicknextName === "流程结束") {
+            } else {
+              this.$message.error("请选择候选人");
+              return false;
+            }
+          }
+          this.nextWork(list);
         }
-        this.nextWork(list);
       }
     },
+    //生成需求决策编号接口
+    getDemand() {
+      this.$http({
+        url: "/market/waf/getBusi",
+        method: "post",
+        headers: {
+          "Content-Type": "application/json",
+        },
+        data: {},
+      }).then((res) => {
+        this.demand = res.data;
+      });
+    },
+    async getLastManList(e) {
+      let _this = this;
+      let obj = {
+        url: _this.$url.formList.getComplateLastMan, //开始工作流接口
+        data: e,
+        // status: "form",
+        headers: {
+          "Content-Type": "application/json",
+        },
+      };
+
+      let res = await this.common.httpPost(obj, success);
+      function success(data) { }
+    },
     async nextWork(list) {
       //e:yes||no,list:传入数组,title:结束标签,res:驳回标签,id:工单更新id
       let _this = this;
@@ -223,7 +277,6 @@ export default {
           userId: _this.backThree[0].loginNoStr,
           taskId: _this.list.taskId,
           content: _this.textarea,
-          tableName: _this.requestForm.processDefinitionKey,
         };
         obj.url = _this.$url.formList.transferTask + _this.list.taskId;
         obj.data = lists;
@@ -249,8 +302,10 @@ export default {
             };
             if (data.copytaskid) {
               list.copytaskid = data.copytaskid;
-              list.copyman = _this.backCopyThree[0].loginNoStr;
-              // list.tableName = _this.requestForm.processDefinitionKey;
+              list.copyman = _this.treeCopyList[0].loginNoStrCopy;
+            }
+            if (_this.demand) {
+              list.needNo = _this.demand;
             }
             _this.setUpdate(list);
           }
@@ -262,8 +317,6 @@ export default {
           };
           _this.setUpdate(list);
         }
-        _this.dialogStatus = false;
-        _this.handleCloses();
       }
     },
     setUpdate(e) {
@@ -280,15 +333,12 @@ export default {
     },
     //查询路径接口
     getNextPath(e, status) {
+      let { fresourceId, processDefinitionKey } = this.requestForm;
       let list = {
-        // fresourceId: "bf79721c-33f3-11ed-ba0b-00505687dcd3", //测试环境
-        fresourceId: this.requestForm.fresourceId, // 本地环境
-        processId: this.requestForm.processDefinitionKey,
-        // resourceId: e,
+        fresourceId: fresourceId,
+        processId: processDefinitionKey,
       };
-      if (e) {
-        list.resourceId = e;
-      }
+      e ? (list.resourceId = e) : list;
       this.$http({
         url: "/market/waf/queryPath",
         method: "post",
@@ -300,6 +350,14 @@ export default {
         if (status === 1) {
           //第一次进入取路径
           this.initialList = res.data.body;
+          if (res.data.body.nextShapes[0].multi !== null) {
+            if (res.data.body.nextShapes[0].multi.multi === "true") {
+              // this.getqueryMultiTaskId();
+              this.isLastManStatus = true;
+            } else {
+              this.isLastManStatus = false;
+            }
+          }
           if (res.data.body.nextShapes[0].loop !== null) {
             if (res.data.body.nextShapes[0].loop.loop === "true") {
               this.transferStatus = true; //转派按钮生效
@@ -310,9 +368,9 @@ export default {
             this.transferStatus = false;
           }
           if (res.data.body.nextShapes[0].copy !== null) {
-            console.log(res.data.body.nextShapes[0].copy.copy);
             if (res.data.body.nextShapes[0].copy.copy === "true") {
-              this.copyStatus = true; //抄送按钮生效
+              // this.copyStatus = true; //抄送按钮生效
+              this.CopyStatus = true;
             } else {
               this.copyStatus = false;
             }
@@ -333,12 +391,22 @@ export default {
         if (status === 3) {
           this.nodes = res.data.body;
           this.getTreeLists(res.data.body, 1);
+
+          if (res.data.body.nextShapes[0].multi !== null) {
+            if (res.data.body.nextShapes[0].multi.multi === "true") {
+              this.manyPeopleStatus = true; //转派按钮生效
+            } else {
+              this.manyPeopleStatus = false;
+            }
+          } else {
+            this.manyPeopleStatus = false;
+          }
         }
       });
     },
     //查询候选人接口
     getTreeLists(e, status) {
-      let createdId = "createId";
+      let createdId = "createld";
       let id =
         e.nextShapes[0].properties.documentation === createdId
           ? this.list.createId
@@ -374,6 +442,8 @@ export default {
     },
     //点击节点获取下一步的处理人字段
     clickGetTree(e, index) {
+      this.$refs.defTree.userList = [];
+      this.backThree = [];
       this.CopyStatus = false;
       this.TransferStatus = false;
       //   this.clickTaskName = e.properties.name;
@@ -391,15 +461,29 @@ export default {
     },
     //选择树的回调
     changeTree(e) {
-      if (e.length > 1) {
-        this.$message.error("只能选择一个人");
-        return;
-      } else {
+      if (this.manyPeopleStatus == true) {
         this.backThree = e;
-        if (e[0]) {
-          this.selectUser = e[0].loginNameStr;
+
+        let arr = [];
+        this.backThree.map((item) => {
+          arr.push(item.loginNoStr);
+        });
+        this.nextDealManList = arr.toString();
+      } else {
+        if (e.length > 1) {
+          this.$message.error("只能选择一个人");
+          return;
         } else {
-          this.selectUser = "暂无选择";
+          this.backThree = e;
+          if (this.CopyStatus === true) {
+            this.getTreeLists(e[0].loginNoStr, 2);
+          }
+
+          if (e[0]) {
+            this.selectUser = e[0].loginNameStr;
+          } else {
+            this.selectUser = "暂无选择";
+          }
         }
       }
     },
@@ -510,28 +594,34 @@ export default {
   width: 50%;
   text-align: center;
 }
+
 .flex-icon {
   float: right;
   margin-right: 20px;
   color: #4277a1;
 }
+
 .flex-handle {
   width: 100%;
   padding: 30px;
   display: flex;
+
   .flex-right {
     width: 50%;
     border: 1px solid #e1e1e1;
     margin-left: 20px;
   }
 }
+
 .flex-left {
   width: 50%;
   display: flex;
   flex-direction: column;
+
   .flex-left-header {
     display: flex;
     justify-content: space-around;
+
     .flex-path {
       height: 280px;
       border: 1px solid #e1e1e1;
@@ -539,10 +629,12 @@ export default {
     }
   }
 }
+
 .flex-common {
   padding: 10px 5%;
   font-size: 18px;
 }
+
 .flex-left-header-text {
   height: 40px;
   line-height: 40px;
@@ -552,40 +644,49 @@ export default {
   font-size: 18px;
   font-weight: bold;
 }
+
 .flex-path-list {
   overflow-y: scroll;
   overflow-x: hidden;
   height: 14rem;
 }
+
 .flex-slide {
   overflow-y: scroll;
   overflow-x: hidden;
 }
+
 .active {
   background-color: #f3faff;
 }
+
 .flex-opinion {
   height: 280px;
   border: 1px solid #e1e1e1;
   width: 100%;
   margin-top: 20px;
 }
+
 .flex-right-text {
   margin-right: 20px;
   width: 50%;
 }
+
 .flex-commons {
   height: 280px;
   border: 1px solid #e1e1e1;
   width: 30%;
 }
+
 .flex-footer-botton {
   display: flex;
   justify-content: space-evenly;
 }
+
 .flex-button {
   margin-top: 10px;
   margin-bottom: 10px;
+
   ::v-deep .el-button--primary {
     width: 222px;
   }