Browse Source

字典替换

zhengnaiwen_citu 4 months ago
parent
commit
3e4b5f0baf
1 changed files with 13 additions and 5 deletions
  1. 13 5
      src/views/humanResources/roster/rosterHistory.vue

+ 13 - 5
src/views/humanResources/roster/rosterHistory.vue

@@ -33,9 +33,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import {
-  EMPLOYEE_STATUS
-} from '@/utils/dict'
+import DICT from '@/utils/dict'
 import {
 import {
   getRosterList
   getRosterList
 } from '@/api/system'
 } from '@/api/system'
@@ -46,6 +44,7 @@ export default {
       drawer: false,
       drawer: false,
       loading: false,
       loading: false,
       items: [],
       items: [],
+      employeeStatus: [],
       headers: [
       headers: [
         { label: '上级机构', prop: 'parentOrganizationName' },
         { label: '上级机构', prop: 'parentOrganizationName' },
         { label: '部门', prop: 'deptName' },
         { label: '部门', prop: 'deptName' },
@@ -56,8 +55,8 @@ export default {
           label: '员工状态',
           label: '员工状态',
           prop: 'employeeStatus',
           prop: 'employeeStatus',
           handle: (v) => {
           handle: (v) => {
-            const item = EMPLOYEE_STATUS.find(e => e.value === v)
-            return item.text
+            const item = this.employeeStatus.find(e => +e.value === v)
+            return item.label
           }
           }
         },
         },
         { label: '人员类别', prop: 'personnelCategory' },
         { label: '人员类别', prop: 'personnelCategory' },
@@ -78,6 +77,7 @@ export default {
       this.drawer = true
       this.drawer = true
       this.loading = true
       this.loading = true
       this.items = []
       this.items = []
+      await this.getEmployeeStatus()
       try {
       try {
         const { data } = await getRosterList({
         const { data } = await getRosterList({
           page: { size: 9999, current: 1, orders: [{ column: 'create_date', asc: false }] },
           page: { size: 9999, current: 1, orders: [{ column: 'create_date', asc: false }] },
@@ -92,6 +92,14 @@ export default {
       } finally {
       } finally {
         this.loading = false
         this.loading = false
       }
       }
+    },
+    async getEmployeeStatus () {
+      try {
+        const data = await DICT.get('EMPLOYEE_STATUS')
+        this.employeeStatus = data
+      } catch (error) {
+        this.$snackbar.error(error)
+      }
     }
     }
   }
   }
 }
 }