lex-xin 3 anni fa
parent
commit
99e3717518

+ 200 - 15
src/views/process/list/handle.vue

@@ -67,6 +67,13 @@
       <el-card class="box-card" style="margin-top: 15px;">
         <div slot="header" class="clearfix">
           <span>表单信息</span>
+          <!-- {{ (currentNode.hideTpls!==undefined &&
+                currentNode.hideTpls!==null &&
+                currentNode.hideTpls.indexOf(tplItem.form_structure.id)!==-1) ||
+                (currentNode.writeTpls===undefined ||
+                currentNode.writeTpls===null ||
+                currentNode.writeTpls.indexOf(tplItem.form_structure.id)===-1)||
+                (isActiveProcessing && currentNode.activeOrder)? true: false}} -->
         </div>
         <div class="text item">
           <template v-for="(tplItem, tplIndex) in processStructureValue.tpls">
@@ -76,13 +83,7 @@
                 currentNode.hideTpls.indexOf(tplItem.form_structure.id)===-1"
               :key="tplIndex"
               :ref="'generateForm-'+tplItem.id"
-              :preview="(currentNode.hideTpls!==undefined &&
-                currentNode.hideTpls!==null &&
-                currentNode.hideTpls.indexOf(tplItem.form_structure.id)!==-1) ||
-                (currentNode.writeTpls===undefined ||
-                currentNode.writeTpls===null ||
-                currentNode.writeTpls.indexOf(tplItem.form_structure.id)===-1)||
-                (isActiveProcessing && currentNode.activeOrder)?true:false"
+              :preview="true"
               :remote="remoteFunc"
               :value="tplItem.form_data"
               :data="tplItem.form_structure"
@@ -90,7 +91,7 @@
             />
           </template>
         </div>
-        <div v-if="processStructureValue.userAuthority">
+        <div v-if="processStructureValue.userAuthority && is_end == 0">
           <hr style="background-color: #d9d9d9; border:0; height:1px; margin-bottom: 15px">
           <el-form ref="dataFrom" label-position="left" :model="dataList" label-width="150">
             <el-form-item label="备注信息" prop="remarks" :rules="[{ required: true, message: '请输入备注信息', trigger: 'blur' }]">
@@ -197,6 +198,8 @@ import {
   queryAllOrgan
 } from '@/api/process/work-order'
 
+import { getInfo } from '@/api/user'
+
 import { listUser } from '@/api/system/sysuser'
 
 import { mapGetters } from 'vuex'
@@ -234,10 +237,11 @@ export default {
         tpls: [],
         tasks: []
       },
-      userId: null,
+      userIds: null,
       tenantId: 1,
       btn_group: [],
       is_end: 0, // 是否结束
+      ownerApply: false, // 是否是自己提交的申请
       remoteFunc: {
         // 获取用户列表
         userList(resolve) {
@@ -259,26 +263,92 @@ export default {
   async created() {
     await this.getUserInfo()
     this.getAllOrgan()
-    this.getProcessNodeList()
+    await this.getProcessNodeList()
+    // 获取用户信息
+    try {
+        let user = await getInfo()
+        this.userInfo = user.data
+        console.log(this.processStructureValue.workOrder.creator, user.data.userId)
+        this.ownerApply = this.processStructureValue.workOrder.creator == user.data.userId ? true : false
+    } catch {
+        //
+    }
   },
   methods: {
     async getUserInfo() {
       await queryUserInfo().then(res => {
         console.log(res)
         if(res.code == 200) {
-          this.userId = res.data.id
+          this.userIds = res.data.id
           this.tenantId = res.data.tenantId
         } else {
           this.$message.error(res.data)
         }
       })
     },
-    getProcessNodeList() {
-      processStructure({
+    async getProcessNodeList() {
+      await processStructure({
         processId: this.$route.query.processId,
         workOrderId: this.$route.query.workOrderId,
-        userId: this.userId
+        userId: this.userIds
       }).then(response => {
+        let tempData = response.data.tpls;
+        console.log(response);
+        // 获取对应模板中,下拉框的key, value
+        let selectList = this.getSelectValueObject(tempData);
+        console.log(selectList);
+
+        // 获取对应模板中,需要隐藏的字段
+        let hiddenFormList = this.getSelectValueObject(
+          tempData,
+          "hiddenForm",
+          selectList
+        );
+
+        tempData.forEach((temp, index) => {
+          let tempList = temp.form_structure.list || [];
+          tempList.forEach(item => {
+            if (hiddenFormList[index].length > 0) {
+              if (item.type != "text" && !item.options.relationStatus) {
+                item.hidden = true;
+              } else {
+                item.hidden = false;
+              }
+              // item.hidden = false
+              if (hiddenFormList[index].includes(item.model)) {
+                item.hidden = false;
+              }
+            } else {
+              item.hidden = false;
+            }
+            // 子表单
+            if (item.type == "subform") {
+              let childList = item.columns || [];
+              let subFormStatus = true;
+              childList.forEach(child => {
+                let childList = child.list || [];
+                childList.forEach(c => {
+                  if (hiddenFormList[index].length > 0) {
+                    if (c.type != "text" && !c.options.relationStatus) {
+                      c.hidden = true;
+                    } else {
+                      c.hidden = false;
+                      subFormStatus = false;
+                    }
+                    if (hiddenFormList[index].includes(c.model)) {
+                      c.hidden = false;
+                      subFormStatus = false;
+                    }
+                  } else {
+                    c.hidden = false;
+                    subFormStatus = false;
+                  }
+                });
+              });
+              item.hidden = subFormStatus;
+            }
+          });
+        });
         this.isActiveProcessing = false
         this.processStructureValue = response.data
         this.circulationHistoryList = this.processStructureValue.circulationHistory
@@ -352,6 +422,109 @@ export default {
         this.getAlertMessage()
       })
     },
+     getSelectValueObject(tpls, type = "value", tplValues = []) {
+      const tempData = tpls || [];
+      let selectList = [];
+      tempData.forEach((temp, index) => {
+        let tempList = temp.form_structure.list || [];
+        let tempSelectList = tplValues[index] || [];
+        let listArray = [];
+        tempList.forEach(list => {
+          if (list.type == "select") {
+            if (type == "value") {
+              const result = this.getFormDataDetail(temp.form_data, list.model);
+              if (result.status) {
+                listArray.push(result);
+              }
+            } else {
+              let selectOptions = [];
+              let selectValue = [];
+              tempSelectList.forEach(tsl => {
+                if (tsl.model == list.model) {
+                  selectOptions = list.options.options || [];
+                  selectValue = tsl.value || [];
+                }
+              });
+              selectOptions.forEach(so => {
+                if (selectValue.includes(so.value)) {
+                  let tempRo = so.relationOptions || [];
+                  listArray.push(...tempRo);
+                }
+              });
+            }
+          }
+          if (list.type == "subform") {
+            let childList = list.columns || [];
+            childList.forEach(child => {
+              let childList = child.list || [];
+              childList.forEach(c => {
+                if (c.type == "select") {
+                  if (type == "value") {
+                    const originObj = JSON.parse(JSON.stringify(c));
+                    const result = this.getFormDataDetail(
+                      temp.form_data,
+                      originObj.model
+                    );
+                    if (result.status) {
+                      listArray.push(result);
+                    }
+                  } else {
+                    let selectOptions = [];
+                    let selectValue = [];
+                    tempSelectList.forEach(tsl => {
+                      if (tsl.model == c.model) {
+                        selectOptions = c.options.options || [];
+                        selectValue = tsl.value || [];
+                      }
+                    });
+                    selectOptions.forEach(so => {
+                      if (selectValue.includes(so.value)) {
+                        let tempRo = so.relationOptions || [];
+                        listArray.push(...tempRo);
+                      }
+                    });
+                  }
+                }
+              });
+            });
+          }
+        });
+        selectList.push(listArray);
+      });
+      return selectList;
+    },
+    // 获取对应元素的值
+    getFormDataDetail(formData, model) {
+      let modelStatus = {
+        status: false,
+        value: null
+      };
+      for (let data in formData) {
+        if (typeof formData[data] == "object") {
+          // 没有子表单里面有子表单
+          for (let child in formData[data]) {
+            if (child == model) {
+              modelStatus = {
+                status: true,
+                model: child,
+                value: formData[data][child]
+                  ? formData[data][child].split(",")
+                  : []
+              };
+            }
+          }
+        } else {
+          if (data == model) {
+            modelStatus = {
+              status: true,
+              model: data,
+              value: formData[data] ? formData[data].split(",") : []
+            };
+          }
+        }
+      }
+      return modelStatus;
+    },
     submitAction(item) {
       var promiseList = []
       this.tpls = []
@@ -368,6 +541,18 @@ export default {
             for (var tplDataIndex in this.tpls) {
               this.tpls[tplDataIndex].tplValue = values[tplDataIndex]
             }
+
+            let fileList = []
+            this.tpls && this.tpls.forEach(tpl => {
+                for(let val in tpl.tplValue) {
+                    if(val.indexOf('file') != -1) {
+                        const file = tpl.tplValue[val] || []
+                        file.forEach(item => {
+                            fileList.push(item.url)
+                        })
+                    }
+                }
+            })
             handleWorkOrder({
               tasks: this.processStructureValue.process.task,
               source_state: this.processStructureValue.workOrder.current_state,
@@ -381,7 +566,7 @@ export default {
               if (response.code === 200) {
               // this.$router.push({ name: 'upcoming' })
 
-              await asyncPlayLog({ workOrderId: parseInt(this.$route.query.workOrderId) })
+              await asyncPlayLog({ workOrderId: parseInt(this.$route.query.workOrderId), fileUrl: fileList.join(',') })
               // window.location.reload()
                 this.getProcessNodeList()
               }

File diff suppressed because it is too large
+ 0 - 0
web/index.html


File diff suppressed because it is too large
+ 0 - 0
web/static/web/css/chunk-5acc8ea8.f855a224.css


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/app.5b02dd3a.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/app.fc65673a.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/chunk-5acc8ea8.7a4590da.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/chunk-73f7679b.a575d08c.js


Some files were not shown because too many files changed in this diff