lex 2 gadi atpakaļ
vecāks
revīzija
aaef68cd58
2 mainītis faili ar 112 papildinājumiem un 94 dzēšanām
  1. 26 17
      src/api/process/work-order.js
  2. 86 77
      src/views/process/list/create.vue

+ 26 - 17
src/api/process/work-order.js

@@ -6,7 +6,7 @@ export function processStructure(params) {
   return request({
     url: "/api-oa/api/v1/work-order/process-structure",
     method: "get",
-    params
+    params,
   });
 }
 
@@ -15,7 +15,7 @@ export function createWorkOrder(data) {
   return request({
     url: "/api-oa/api/v1/work-order/create",
     method: "post",
-    data
+    data,
   });
 }
 
@@ -24,7 +24,7 @@ export function checkCourseReturnFee(data) {
   return request({
     url: "/api-web/oa/checkCourseReturnFee",
     method: "post",
-    data
+    data,
   });
 }
 
@@ -33,7 +33,7 @@ export function workOrderList(params) {
   return request({
     url: "/api-oa/api/v1/work-order/list",
     method: "get",
-    params
+    params,
   });
 }
 
@@ -42,7 +42,7 @@ export function handleWorkOrder(data) {
   return request({
     url: "/api-oa/api/v1/work-order/handle",
     method: "post",
-    data
+    data,
   });
 }
 
@@ -52,7 +52,7 @@ export function asyncPlayLog(data) {
     url: "api-web/oa/syncPayLog",
     method: "post",
     requestType: "form",
-    data: qs.stringify(data)
+    data: qs.stringify(data),
   });
 }
 
@@ -61,7 +61,7 @@ export function unityWorkOrder(params) {
   return request({
     url: "/api-oa/api/v1/work-order/unity",
     method: "get",
-    params
+    params,
   });
 }
 
@@ -70,7 +70,7 @@ export function inversionWorkOrder(data) {
   return request({
     url: "/api-oa/api/v1/work-order/inversion",
     method: "post",
-    data
+    data,
   });
 }
 
@@ -79,7 +79,7 @@ export function urgeWorkOrder(params) {
   return request({
     url: "/api-oa/api/v1/work-order/urge",
     method: "get",
-    params
+    params,
   });
 }
 
@@ -88,7 +88,7 @@ export function activeOrder(data, workOrderId) {
   return request({
     url: `/api-oa/api/v1/work-order/active-order/${workOrderId}`,
     method: "put",
-    data
+    data,
   });
 }
 
@@ -96,7 +96,7 @@ export function activeOrder(data, workOrderId) {
 export function deleteWorkOrder(workOrderId) {
   return request({
     url: `/api-oa/api/v1/work-order/delete/${workOrderId}`,
-    method: "delete"
+    method: "delete",
   });
 }
 
@@ -104,7 +104,7 @@ export function deleteWorkOrder(workOrderId) {
 export function reopenWorkOrder(id) {
   return request({
     url: `/api-oa/api/v1/work-order/reopen/${id}`,
-    method: "post"
+    method: "post",
   });
 }
 
@@ -112,15 +112,24 @@ export function reopenWorkOrder(id) {
 export function queryAllOrgan() {
   return request({
     url: `/api-web/eduOrganization/queryAllOrgan`,
-    method: "get"
+    method: "get",
+  });
+}
+
+// 获取所有分部
+export function queryTeacherOrgan(params) {
+  return request({
+    url: "/api-teacher/teacher/queryOrganList",
+    method: "get",
+    params,
   });
 }
 
 export function queryUserInfo(data) {
   return request({
-    url: "/api-web/employee/queryUserInfo",
+    url: "/api-auth/api/queryUserInfo",
     method: "get",
-    params: data
+    params: data,
   });
 }
 
@@ -129,7 +138,7 @@ export function getOrganCooperation(params) {
   return request({
     url: `/api-web/eduOrganization/getOrganCooperation`,
     method: "get",
-    params
+    params,
   });
 }
 
@@ -138,6 +147,6 @@ export function orderComment(data) {
   return request({
     url: "/api-oa/api/v1/work-order/comment",
     method: "post",
-    data
+    data,
   });
 }

+ 86 - 77
src/views/process/list/create.vue

@@ -54,8 +54,8 @@
           <fm-generate-form
             v-show="
               currentNode.hideTpls === undefined ||
-                currentNode.hideTpls === null ||
-                currentNode.hideTpls.indexOf(tplItem.id) === -1
+              currentNode.hideTpls === null ||
+              currentNode.hideTpls.indexOf(tplItem.id) === -1
             "
             :key="tplIndex"
             :ref="'generateForm-' + tplItem.id"
@@ -79,8 +79,8 @@
           />
         </template>
       </div>
-      <hr style="background-color: #d9d9d9; border:0; height:1px;" />
-      <div class="text item" style="text-align: center;margin-top:18px">
+      <hr style="background-color: #d9d9d9; border: 0; height: 1px" />
+      <div class="text item" style="text-align: center; margin-top: 18px">
         <el-button
           v-for="(item, index) in btn_group"
           :key="index"
@@ -105,7 +105,8 @@ import {
   createWorkOrder,
   checkCourseReturnFee,
   queryAllOrgan,
-  queryUserInfo
+  queryTeacherOrgan,
+  queryUserInfo,
 } from "@/api/process/work-order";
 import { listUser } from "@/api/system/sysuser";
 export default {
@@ -120,6 +121,7 @@ export default {
       socialId: null, // 是否是社保分部
       userId: null,
       tenantId: 1,
+      userType: "SYSTEM",
       ruleForm: {
         priority: 1,
         deptId: null, // 社保部分
@@ -131,17 +133,17 @@ export default {
         process_method: "",
         tpls: {
           form_structure: [],
-          form_data: []
+          form_data: [],
         },
-        tasks: []
+        tasks: [],
       },
       rules: {
         deptId: [
-          { required: true, message: "请选择申请部门", trigger: "change" }
+          { required: true, message: "请选择申请部门", trigger: "change" },
         ],
         priority: [
-          { required: true, message: "请选择工单优先级", trigger: "blur" }
-        ]
+          { required: true, message: "请选择工单优先级", trigger: "blur" },
+        ],
       },
       deptList: [], // 分部列表
       btn_group: [],
@@ -149,13 +151,13 @@ export default {
         // 获取用户列表
         userList(resolve) {
           listUser({
-            pageSize: 999999
-          }).then(response => {
+            pageSize: 999999,
+          }).then((response) => {
             const options = response.data.list;
             resolve(options);
           });
-        }
-      }
+        },
+      },
     };
   },
   async mounted() {
@@ -165,48 +167,57 @@ export default {
   },
   methods: {
     async getUserInfo() {
-      await queryUserInfo().then(res => {
+      await queryUserInfo().then((res) => {
         if (res.code == 200) {
           this.userId = res.data.id;
           this.tenantId = res.data.tenantId;
+          this.userType = res.data.userType;
         } else {
           this.$message.error(res.data);
         }
       });
     },
-    async getAllOrgan() {
+    getAllOrgan() {
       // 获取分部
-      await queryAllOrgan({ tenantId: this.tenantId }).then(res => {
-        if (res.code == 200) {
-          const result = res.data;
-          const filterOrganId = [
-            36,
-            39,
-            41,
-            42,
-            43,
-            44,
-            45,
-            46,
-            47,
-            48,
-            49,
-            50,
-            52,
-            54,
-            55,
-            56
-          ];
-          let tempOrgan = [];
-          // 过滤不会显示的分部
-          result.forEach(item => {
-            if (!filterOrganId.includes(item.id)) {
-              tempOrgan.push(item);
-            }
-          });
-          this.organList = tempOrgan;
-        }
-      });
+      console.log(this.tenantId, "tenantId");
+      if (this.userType.indexOf("SYSTEM") != -1) {
+        queryAllOrgan({ tenantId: this.tenantId }).then((res) => {
+          if (res.code == 200) {
+            const result = res.data;
+            const filterOrganId = [
+              36, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 54, 55, 56,
+            ];
+            let tempOrgan = [];
+            // 过滤不会显示的分部
+            result.forEach((item) => {
+              if (!filterOrganId.includes(item.id)) {
+                tempOrgan.push(item);
+              }
+            });
+            this.organList = tempOrgan;
+          }
+        });
+      } else {
+        queryTeacherOrgan({ tenantId: this.tenantId }).then((res) => {
+          if (res.code == 200) {
+            const result = res.data;
+            const filterOrganId = [
+              36, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 54, 55, 56,
+            ];
+            let tempOrgan = [];
+            // 过滤不会显示的分部
+            result.forEach((item) => {
+              if (!filterOrganId.includes(item.key)) {
+                tempOrgan.push({
+                  id: item.key,
+                  name: item.value,
+                });
+              }
+            });
+            this.organList = tempOrgan;
+          }
+        });
+      }
     },
     getProcessNodeList() {
       const processId = this.$route.query.processId;
@@ -215,8 +226,8 @@ export default {
       }
       processStructure({
         processId: this.$route.query.processId,
-        userId: this.userId
-      }).then(response => {
+        userId: this.userId,
+      }).then((response) => {
         let tempData = response.data.tpls;
         console.log(response);
         // 获取对应模板中,下拉框的key, value
@@ -232,7 +243,7 @@ export default {
 
         tempData.forEach((temp, index) => {
           let tempList = temp.form_structure.list || [];
-          tempList.forEach(item => {
+          tempList.forEach((item) => {
             if (hiddenFormList[index].length > 0) {
               if (item.type != "text" && !item.options.relationStatus) {
                 item.hidden = true;
@@ -250,9 +261,9 @@ export default {
             if (item.type == "subform") {
               let childList = item.columns || [];
               let subFormStatus = true;
-              childList.forEach(child => {
+              childList.forEach((child) => {
                 let childList = child.list || [];
-                childList.forEach(c => {
+                childList.forEach((c) => {
                   if (hiddenFormList[index].length > 0) {
                     if (c.type != "text" && !c.options.relationStatus) {
                       c.hidden = true;
@@ -298,7 +309,7 @@ export default {
 
         const psv = response.data.edges || [];
         const btn_group = [];
-        psv.forEach(item => {
+        psv.forEach((item) => {
           if (item.source === this.currentNode.id && item.flowProperties == 1) {
             if (item.flowProperties == 1) {
               item.className = "primary";
@@ -320,7 +331,7 @@ export default {
           // })
           this.$alert("您当前暂未设置所属部门,请联系管理员", "提示", {
             confirmButtonText: "确定",
-            callback: action => {}
+            callback: (action) => {},
           });
         }
       });
@@ -332,7 +343,7 @@ export default {
         let tempList = temp.form_structure.list || [];
         let tempSelectList = tplValues[index] || [];
         let listArray = [];
-        tempList.forEach(list => {
+        tempList.forEach((list) => {
           if (list.type == "select") {
             if (type == "value") {
               const result = this.getFormDataDetail(temp.form_data, list.model);
@@ -342,13 +353,13 @@ export default {
             } else {
               let selectOptions = [];
               let selectValue = [];
-              tempSelectList.forEach(tsl => {
+              tempSelectList.forEach((tsl) => {
                 if (tsl.model == list.model) {
                   selectOptions = list.options.options || [];
                   selectValue = tsl.value || [];
                 }
               });
-              selectOptions.forEach(so => {
+              selectOptions.forEach((so) => {
                 if (selectValue.includes(so.value)) {
                   let tempRo = so.relationOptions || [];
                   listArray.push(...tempRo);
@@ -358,9 +369,9 @@ export default {
           }
           if (list.type == "subform") {
             let childList = list.columns || [];
-            childList.forEach(child => {
+            childList.forEach((child) => {
               let childList = child.list || [];
-              childList.forEach(c => {
+              childList.forEach((c) => {
                 if (c.type == "select") {
                   if (type == "value") {
                     const originObj = JSON.parse(JSON.stringify(c));
@@ -374,13 +385,13 @@ export default {
                   } else {
                     let selectOptions = [];
                     let selectValue = [];
-                    tempSelectList.forEach(tsl => {
+                    tempSelectList.forEach((tsl) => {
                       if (tsl.model == c.model) {
                         selectOptions = c.options.options || [];
                         selectValue = tsl.value || [];
                       }
                     });
-                    selectOptions.forEach(so => {
+                    selectOptions.forEach((so) => {
                       if (selectValue.includes(so.value)) {
                         let tempRo = so.relationOptions || [];
                         listArray.push(...tempRo);
@@ -400,7 +411,7 @@ export default {
     getFormDataDetail(formData, model) {
       let modelStatus = {
         status: false,
-        value: null
+        value: null,
       };
       for (let data in formData) {
         if (typeof formData[data] == "object") {
@@ -412,7 +423,7 @@ export default {
                 model: child,
                 value: formData[data][child]
                   ? formData[data][child].split(",")
-                  : []
+                  : [],
               };
             }
           }
@@ -421,7 +432,7 @@ export default {
             modelStatus = {
               status: true,
               model: data,
-              value: formData[data] ? formData[data].split(",") : []
+              value: formData[data] ? formData[data].split(",") : [],
             };
           }
         }
@@ -429,16 +440,15 @@ export default {
       return modelStatus;
     },
     submitAction(target) {
-      this.$refs["ruleForm"].validate(valid => {
+      this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           this.submitDisabled = true;
           var stateMap = {};
           this.ruleForm.process = parseInt(this.$route.query.processId);
           this.ruleForm.classify = this.processStructureValue.process.classify;
           stateMap["id"] = target;
-          this.ruleForm.source_state = this.processStructureValue.nodes[
-            this.active
-          ].label;
+          this.ruleForm.source_state =
+            this.processStructureValue.nodes[this.active].label;
           for (var v of this.processStructureValue.nodes) {
             if (v.id === target) {
               if (v.assignType !== undefined) {
@@ -455,7 +465,7 @@ export default {
 
           this.ruleForm.tpls = {
             form_structure: [],
-            form_data: []
+            form_data: [],
           };
           // 绑定流程任务
           this.ruleForm.tasks =
@@ -482,10 +492,9 @@ export default {
             promiseList.push(this.$refs["generateForm-" + tpl.id][0].getData());
           }
           Promise.all(promiseList)
-            .then(async values => {
-              this.ruleForm.source = this.processStructureValue.nodes[
-                this.active
-              ].id;
+            .then(async (values) => {
+              this.ruleForm.source =
+                this.processStructureValue.nodes[this.active].id;
               this.ruleForm.tpls.form_data = values;
               const formData = values[0];
               const tplInfo = this.processStructureValue.tpls[0]; // 默认只用第一个模板
@@ -493,11 +502,11 @@ export default {
               // 校验数据
               const res = await checkCourseReturnFee({
                 tplInfoId: tplInfo.id,
-                formData
+                formData,
               });
               if (res.code == 200) {
                 await createWorkOrder(this.ruleForm)
-                  .then(response => {
+                  .then((response) => {
                     if (response.code === 200) {
                       this.$message.success("工单申请成功");
                       this.$router.push({ path: "/process/my-create" });
@@ -516,7 +525,7 @@ export default {
             });
         }
       });
-    }
-  }
+    },
+  },
 };
 </script>