Browse Source

fix: 员工档案相关字段对应字典

qiny 1 year ago
parent
commit
8008b6cb65

+ 59 - 1
client/src/views/OaSystem/mineCenter/rightChild/index.ts

@@ -1,3 +1,5 @@
+import { getDictOptions } from '@/utils/dict'
+import { cloneDeep } from 'lodash-es'
 export const formConfigList = [
   {
     title: '基本信息',
@@ -44,7 +46,8 @@ export const formConfigList = [
       },
       {
         name: 'nation',
-        title: '民族'
+        title: '民族',
+        type: 'select'
       },
       {
         name: 'cjgzsj',
@@ -156,3 +159,58 @@ export const formConfigList = [
     ]
   }
 ]
+const getDictList = () => {
+  const dictOptionsObj: any = {}
+  // 性别
+  // const sex = getDictOptions('system_user_sex')
+  // 状态
+  const state = getDictOptions('staff_state_type')
+  // 在岗职位
+  const drzw = getDictOptions('post_type')
+  // 民族
+  const nation = getDictOptions('nation_type')
+  // 婚姻情况
+  const hyzk = getDictOptions('hy_type')
+  // 户口性质
+  const hkxz = getDictOptions('hk_type')
+  // 政治面貌
+  const zzmm = getDictOptions('polity_type')
+  // 能力等级
+  const nldj = getDictOptions('ABILITY_LEVEL')
+  // 最高学历
+  const zgxl = getDictOptions('xl_type')
+  // 紧急联系人关系
+  const jjlxrgx = getDictOptions('contact_type')
+
+  // dictOptionsObj.sex = sex
+  dictOptionsObj.state = state
+  dictOptionsObj.drzw = drzw
+  dictOptionsObj.nation = nation
+  dictOptionsObj.hyzk = hyzk
+  dictOptionsObj.hkxz = hkxz
+  dictOptionsObj.zzmm = zzmm
+  dictOptionsObj.nldj = nldj
+  dictOptionsObj.zgxl = zgxl
+  dictOptionsObj.jjlxrgx = jjlxrgx
+  return dictOptionsObj
+}
+export const getConfigDict = () => {
+  const dictList = getDictList()
+  const configList = cloneDeep(formConfigList)
+  const numberType = ['sex', 'state', 'hyzk', 'hkxz', 'zzmm', 'zgxl', 'jjlxrgx']
+  configList.forEach((item) => {
+    item.children.forEach((child: any) => {
+      if (child.type == 'select' && dictList[child.name]) {
+        const options = dictList[child.name].map((item) => {
+          return {
+            label: item.label,
+            value: numberType.includes(child.name) ? Number(item.value) : item.value
+          }
+        })
+        child.options = options
+      }
+    })
+  })
+
+  return configList
+}

+ 3 - 1
client/src/views/OaSystem/mineCenter/rightChild/wdda.vue

@@ -2,9 +2,11 @@
 import { useQuery } from '@tanstack/vue-query'
 import { getRecordsDetail } from '@/api/oa/staffRecords'
 import { useUserStore } from '@/store/modules/user'
-import { formConfigList } from './index'
+import { getConfigDict } from './index'
 import TechCertificate from '../../personnelManagement/ygdaPage/TechCertificate.vue'
 
+const formConfigList = getConfigDict()
+
 const userId = useUserStore().getUser.id // 当前登录的编号
 
 const { data } = useQuery(['fetch-staff-detail', userId], async () => {

+ 80 - 4
client/src/views/OaSystem/personnelManagement/ygdaPage/index.ts

@@ -1,3 +1,41 @@
+import { getDictOptions } from '@/utils/dict'
+import { cloneDeep } from 'lodash-es'
+const getDictList = () => {
+  const dictOptionsObj: any = {}
+  // 性别
+  // const sex = getDictOptions('system_user_sex')
+  // 状态
+  const state = getDictOptions('staff_state_type')
+  // 在岗职位
+  const drzw = getDictOptions('post_type')
+  // 民族
+  const nation = getDictOptions('nation_type')
+  // 婚姻情况
+  const hyzk = getDictOptions('hy_type')
+  // 户口性质
+  const hkxz = getDictOptions('hk_type')
+  // 政治面貌
+  const zzmm = getDictOptions('polity_type')
+  // 能力等级
+  const nldj = getDictOptions('ABILITY_LEVEL')
+  // 最高学历
+  const zgxl = getDictOptions('xl_type')
+  // 紧急联系人关系
+  const jjlxrgx = getDictOptions('contact_type')
+
+  // dictOptionsObj.sex = sex
+  dictOptionsObj.state = state
+  dictOptionsObj.drzw = drzw
+  dictOptionsObj.nation = nation
+  dictOptionsObj.hyzk = hyzk
+  dictOptionsObj.hkxz = hkxz
+  dictOptionsObj.zzmm = zzmm
+  dictOptionsObj.nldj = nldj
+  dictOptionsObj.zgxl = zgxl
+  dictOptionsObj.jjlxrgx = jjlxrgx
+  return dictOptionsObj
+}
+
 export const formConfigList = [
   {
     title: '基本信息',
@@ -333,11 +371,33 @@ export const formConfigList = [
   }
 ]
 
+export const getConfigDict = () => {
+  const dictList = getDictList()
+  const configList = cloneDeep(formConfigList)
+  const numberType = ['sex', 'state', 'hyzk', 'hkxz', 'zzmm', 'zgxl', 'jjlxrgx']
+  configList.forEach((item) => {
+    item.children.forEach((child: any) => {
+      if (child.type == 'select' && dictList[child.name]) {
+        const options = dictList[child.name].map((item) => {
+          return {
+            label: item.label,
+            value: numberType.includes(child.name) ? Number(item.value) : item.value
+          }
+        })
+        child.options = options
+      }
+    })
+  })
+
+  return configList
+}
+
 export const formRules = {
   nickname: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
 }
 
-export const tableColumnConfigList = [
+// 表格
+export const tableColumnConfig = [
   {
     name: 'deptName',
     title: '所属部门'
@@ -466,10 +526,8 @@ export const tableColumnConfigList = [
     type: 'time'
   }
 ]
-
 //搜索
-
-export const searchConfigList = [
+export const searchConfig = [
   {
     name: 'nickname',
     title: '员工名称'
@@ -573,3 +631,21 @@ export const searchConfigList = [
     ]
   }
 ]
+
+export const getTableConfigDict = (dataSource) => {
+  const dictList = getDictList()
+  const configList = cloneDeep(dataSource)
+  const numberType = ['sex', 'state', 'hyzk', 'hkxz', 'zzmm', 'zgxl', 'jjlxrgx']
+  configList.forEach((item) => {
+    if (item.type == 'select' && dictList[item.name]) {
+      const options = dictList[item.name].map((item) => {
+        return {
+          label: item.label,
+          value: numberType.includes(item.name) ? Number(item.value) : item.value
+        }
+      })
+      item.options = options
+    }
+  })
+  return configList
+}

+ 5 - 2
client/src/views/OaSystem/personnelManagement/ygdaPage/index.vue

@@ -108,11 +108,14 @@
 <script setup lang="ts">
 import * as StaffRecordsApi from '@/api/oa/staffRecords'
 import { dateFormatter2 } from '@/utils/formatTime'
-import { tableColumnConfigList, searchConfigList } from './index'
-import DeptSelect from '@/components/DeptSelect/index.vue'
+import { getTableConfigDict, tableColumnConfig, searchConfig } from './index'
+// import DeptSelect from '@/components/DeptSelect/index.vue'
 import TableLayout from '../../oaViews/layout/TableLayout.vue'
 import DeptTree from '@/views/OaSystem/components/DeptTree/index.vue'
 
+const tableColumnConfigList = getTableConfigDict(tableColumnConfig)
+const searchConfigList = getTableConfigDict(searchConfig)
+
 defineOptions({ name: 'YgdaPage' })
 const queryParams = reactive({
   pageNo: 1,

+ 2 - 1
client/src/views/OaSystem/personnelManagement/ygdaPage/staffDetail.vue

@@ -3,12 +3,13 @@ defineOptions({ name: 'StaffDetail' })
 
 import { useQuery, useMutation } from '@tanstack/vue-query'
 import { getRecordsDetail, editRecordsDetail, generateStaffNum } from '@/api/oa/staffRecords'
-import { formConfigList } from './index'
+import { getConfigDict } from './index'
 import { ElRow, FormInstance } from 'element-plus'
 import TechCertificate from './TechCertificate.vue'
 import avatarImg from '@/assets/imgs/avatar.jpg'
 import DeptSelect from '@/components/DeptSelect/index.vue'
 import { createImageViewer } from '@/components/ImageViewer'
+const formConfigList = getConfigDict()
 
 const { query } = useRoute()
 const { id, type } = query