From 31741895b1381df8335e012d7ab0a5cfb6ba1f32 Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Tue, 10 Mar 2026 06:48:08 +0000
Subject: [PATCH] 用户信息添加二级岗位信息

---
 eladmin-web-master/src/views/system/user/index.vue |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/eladmin-web-master/src/views/system/user/index.vue b/eladmin-web-master/src/views/system/user/index.vue
index f7d46ed..bf9fea0 100644
--- a/eladmin-web-master/src/views/system/user/index.vue
+++ b/eladmin-web-master/src/views/system/user/index.vue
@@ -125,6 +125,16 @@
                 placeholder="选择部门"
               />
             </el-form-item>
+            <el-form-item label="排班" prop="sysRostering.id">
+              <el-select v-model="form.sysRostering.id" clearable style="width: 184px" placeholder="请选择">
+                <el-option
+                  v-for="item in rosterings"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                />
+              </el-select>
+            </el-form-item>
             <el-form-item label="岗位" prop="jobs">
               <el-select
                 v-model="jobDatas"
@@ -144,13 +154,14 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item label="排班" prop="sysRostering.id">
-              <el-select v-model="form.sysRostering.id" clearable style="width: 184px" placeholder="请选择">
+            <el-form-item label="二级岗位" prop="jobSecondId">
+              <el-select v-model="form.jobSecondId" clearable style="width: 184px" placeholder="请选择">
                 <el-option
-                  v-for="item in rosterings"
-                  :key="item.id"
+                  v-for="item in jobSeconds"
+                  :key="item.name"
                   :label="item.name"
                   :value="item.id"
+                  :disabled="!item.enabled"
                 />
               </el-select>
             </el-form-item>
@@ -299,6 +310,7 @@
 import { getDepts, getDeptSuperior } from '@/api/system/dept'
 import { getAll, getLevel } from '@/api/system/role'
 import crudJob from '@/api/system/job'
+import crudJobSecond from '@/api/system/jobSecond'
 import CRUD, { presenter, header, form, crud } from '@crud/crud'
 import rrOperation from '@crud/RR.operation'
 import crudOperation from '@crud/CRUD.operation'
@@ -316,7 +328,7 @@
 let userRoles = []
 let userJobs = []
 let userCompanys = []
-const defaultForm = { id: null, username: null, company: { id: null }, internshipTime: null, nickName: null, gender: '男', email: null, enabled: 'false', loginEnabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, weComId: null, sysRostering: { id: null }, levelId: null, companys: [] }
+const defaultForm = { id: null, username: null, company: { id: null }, internshipTime: null, nickName: null, gender: '男', email: null, enabled: 'false', loginEnabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, weComId: null, sysRostering: { id: null }, levelId: null, companys: [], jobSecondId: null }
 export default {
   name: 'User',
   components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
@@ -339,7 +351,7 @@
     }
     return {
       height: document.documentElement.clientHeight - 180 + 'px;',
-      deptName: '', depts: [], deptDatas: [], jobs: [], level: 3, roles: [],
+      deptName: '', depts: [], deptDatas: [], jobs: [], jobSeconds: [], level: 3, roles: [],
       jobDatas: [], roleDatas: [], companyDatas: [], // 多选时使用
       defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' },
       permission: {
@@ -458,6 +470,9 @@
         // 用户表单
         this.form.levelId = null
       }
+      if (value.length > 0) {
+        this.getJobSeconds()
+      }
     },
     changeCompany(value) {
       userCompanys = []
@@ -533,6 +548,8 @@
         const com = { id: company.id }
         userCompanys.push(com)
       })
+      // 获取可选二级岗位
+      this.getJobSeconds()
     },
     // 提交前做的操作
     [CRUD.HOOK.afterValidateCU](crud) {
@@ -685,6 +702,13 @@
         this.jobs = res
       }).catch(() => { })
     },
+    // 获取弹窗内二级岗位数据
+    getJobSeconds() {
+      const that = this
+      crudJobSecond.getAll({ jobIds: that.jobDatas }).then(res => {
+        that.jobSeconds = res
+      }).catch(() => { })
+    },
     // 获取权限级别
     getRoleLevel() {
       getLevel().then(res => {

--
Gitblit v1.9.3