From 006cedaa4188d5bd5f99ef0721572a24c89d7ce4 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期六, 20 八月 2022 17:19:08 +0800
Subject: [PATCH] Default Changelist

---
 src/views/specialWorkSystem/workTicket/myJobApply/index.vue |   55 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/src/views/specialWorkSystem/workTicket/myJobApply/index.vue b/src/views/specialWorkSystem/workTicket/myJobApply/index.vue
index 1a502f1..741d565 100644
--- a/src/views/specialWorkSystem/workTicket/myJobApply/index.vue
+++ b/src/views/specialWorkSystem/workTicket/myJobApply/index.vue
@@ -58,12 +58,12 @@
                 </div>
                 <el-dialog v-model="dialogDetails" title="作业申请详情" center>
                     <fire v-if="dialogType == 1" :details = details></fire>
-                    <space v-if="dialogType == 2" :details = details></space>
-                    <hoist v-if="dialogType == 3" :details = details></hoist>
-                    <ground v-if="dialogType == 4" :details = details></ground>
-                    <broken v-if="dialogType == 5" :details = details></broken>
-                    <height v-if="dialogType == 6" :details = details></height>
-                    <power v-if="dialogType == 7" :details = details></power>
+                    <space v-else-if="dialogType == 2" :details = details></space>
+                    <hoist v-else-if="dialogType == 3" :details = details></hoist>
+                    <ground v-else-if="dialogType == 4" :details = details></ground>
+                    <broken v-else-if="dialogType == 5" :details = details></broken>
+                    <height v-else-if="dialogType == 6" :details = details></height>
+                    <power v-else-if="dialogType == 7" :details = details></power>
                     <plate v-else :details = details></plate>
                     <template #footer>
                       <span class="dialog-footer">
@@ -196,6 +196,7 @@
 import { FormInstance, FormRules, ElMessage } from 'element-plus';
 import { workApplyApi } from '/@/api/specialWorkSystem/workApply';
 import type { TabsPaneContext } from 'element-plus';
+import {teamManageApi} from "/@/api/systemManage/basicDateManage/personShiftManage/teamManage";
 
 // 定义接口来定义对象的类型
 interface stateType {
@@ -219,13 +220,18 @@
     statusInfo: {};
     workType: Array<type>;
     depType: Array<type>;
-    dialogType: number
+    dialogType: number | null;
+    departmentList: Array<any>;
+    departmentRecursionList: Array<DepartmentState>;
 }
 interface type {
     id: number;
     name: string;
 }
-
+interface DepartmentState {
+    depId: number;
+    depName: string;
+}
 export default defineComponent({
     name: 'myApply',
     components: {
@@ -248,6 +254,8 @@
             totalSize1: 0,
             dialogType: null,
             activeName: '1',
+            departmentList: [],
+            departmentRecursionList: [],
             chosenIndex: null,
             searchWord: '',
             applyData: [],
@@ -304,6 +312,32 @@
             console.log(tab, event);
         };
 
+        // 获取部门列表
+        const getAllDepartment = async () => {
+            let res = await teamManageApi().getAllDepartment();
+            if (res.data.code === '200') {
+                state.departmentList = JSON.parse(JSON.stringify(res.data.data))
+                recursion(state.departmentList);
+                console.log(state.departmentRecursionList,'99999999999')
+            } else {
+                ElMessage({
+                    type: 'warning',
+                    message: res.data.msg
+                });
+            }
+        };
+
+        const recursion = (value: any) => {
+            for (let i of value) {
+                if (i.children.length !== 0) {
+                    state.departmentRecursionList.push(i);
+                    recursion(i.children);
+                } else {
+                    state.departmentRecursionList.push(i);
+                }
+            }
+        };
+
         // 分页获取工作时间组列表
         const getListByPage = async () => {
             const data = { pageSize: state.pageSize1, pageIndex: state.pageIndex1, searchParams: { workType: state.searchWord } };
@@ -319,7 +353,6 @@
                     return item;
                 });
                 state.totalSize1 = res.data.total;
-                console.log( state.applyData,'0212121');
             } else {
                 ElMessage({
                     type: 'warning',
@@ -422,7 +455,6 @@
         // 查看记录
         const viewRecord = (row: any) => {
             state.dialogType = row.workType
-            console.log(state.dialogType,'工作类型')
             state.details = JSON.parse(JSON.stringify(row));
             if(state.details.workDetail.otherSpecialWork == '' || !state.details.workDetail.otherSpecialWork){
                 state.details.workDetail.otherSpecialWork=[]
@@ -440,7 +472,7 @@
             else {
                 const a = state.details.workDetail.involvedDepIds
                 state.details.workDetail.involvedDepIds = a.split(',').map((item) => {
-                    return state.depType.find((i: { id: number }) => i.id === Number(item))?.name;
+                    return state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(item))?.depName;
                 });
             }
             console.log(state.details,'details')
@@ -457,6 +489,7 @@
         // 页面载入时执行方法
         onMounted(() => {
             getListByPage();
+            getAllDepartment()
         });
 
         return {

--
Gitblit v1.9.2