Bladeren bron

fix: 添加生成员工工号,添加合同签订和到期时间展示

Sunny ma 1 jaar geleden
bovenliggende
commit
2b2a2f1465

+ 4 - 0
client/src/api/oa/staffRecords/index.ts

@@ -14,3 +14,7 @@ export const getRecordsPage = (params) => {
 export const editRecordsDetail = (params) => {
   return request.post({ url: '/adm/staff-records/update', data: params })
 }
+//生成员工工号
+export const generateStaffNum = () => {
+  return request.post({ url: '/adm/staff-records/generateNum' })
+}

+ 20 - 3
client/src/views/OaSystem/personnelManagement/ygdaPage/index.ts

@@ -50,7 +50,18 @@ export const formConfigList = [
       },
       {
         name: 'drzw',
-        title: '在岗职位'
+        title: '在岗职位',
+        type: 'select',
+        options: [
+          {
+            value: '1',
+            label: 'JAVA工程师'
+          },
+          {
+            value: '2',
+            label: '前端工程师'
+          }
+        ]
       },
       {
         name: 'nation',
@@ -58,7 +69,8 @@ export const formConfigList = [
       },
       {
         name: 'loginName',
-        title: '员工工号'
+        title: '员工工号',
+        type: 'button'
       },
       {
         name: 'deptName',
@@ -195,9 +207,14 @@ export const formConfigList = [
       },
       {
         name: 'htdqs',
-        title: '合同时间',
+        title: '合同到期时间',
         type: 'time'
       }
+      // {
+      //   name: 'htdqs',
+      //   title: '合同时间',
+      //   type: 'timerange'
+      // }
     ]
   },
   {

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

@@ -2,7 +2,7 @@
 defineOptions({ name: 'StaffDetail' })
 
 import { useQuery, useMutation } from '@tanstack/vue-query'
-import { getRecordsDetail, editRecordsDetail } from '@/api/oa/staffRecords'
+import { getRecordsDetail, editRecordsDetail, generateStaffNum } from '@/api/oa/staffRecords'
 import { formConfigList } from './index'
 import { ElRow, FormInstance } from 'element-plus'
 import TechCertificate from './TechCertificate.vue'
@@ -47,6 +47,22 @@ const { mutate: addUserMutate } = useMutation({
   }
 })
 
+/**生成工号 */
+const { mutate: generateStaffNumber } = useMutation({
+  mutationFn: async () => {
+    return await generateStaffNum()
+  },
+  onSuccess(res) {
+    formData.value['loginName'] = res
+  },
+  onError() {
+    ElMessage({
+      message: '工号生成失败!',
+      type: 'error'
+    })
+  }
+})
+
 /**表单保存 */
 const submitForm = (formEl: FormInstance | undefined) => {
   if (!formEl) return
@@ -114,6 +130,16 @@ const isEdit = computed(() => {
                     v-model="formData[child?.name]"
                     placeholder=""
                   />
+                  <div v-if="child?.type === 'button'" class="generate-num">
+                    <el-input v-model="formData[child?.name]" placeholder="" />
+                    <ElButton
+                      v-if="isEdit"
+                      type="primary"
+                      style="width: 70px; height: 30px; margin-left: 10px"
+                      @click="generateStaffNumber()"
+                      >生成工号</ElButton
+                    >
+                  </div>
                 </el-form-item>
               </li>
               <li></li>
@@ -254,4 +280,9 @@ const isEdit = computed(() => {
     }
   }
 }
+
+.generate-num {
+  display: flex;
+  width: 100%;
+}
 </style>