Procházet zdrojové kódy

账户管理接口

ZaiZai před 2 roky
rodič
revize
1d8b93bf34
1 změnil soubory, kde provedl 25 přidání a 1 odebrání
  1. 25 1
      src/views/system/user.vue

+ 25 - 1
src/views/system/user.vue

@@ -84,7 +84,7 @@
                             </el-col>
                             <el-col :span="7">
                                 <el-form-item prop="principal">
-                                    <el-select v-model="item.isLader" placeholder="是否为部门负责人">
+                                    <el-select v-model="item.isLader" placeholder="是否为部门负责人" :disabled="item.isLaderDisabled" @change="isLaderChange($event, index)">
                                         <el-option label="是" :value="1"/>
                                         <el-option label="否" :value="0"/>
                                     </el-select>
@@ -317,15 +317,39 @@ const getSectionData = async () => {
 const postData = ref([])
 const initPostData = async (id, index) => {
     if (id) {
+        //获取岗位数据
         const { error, code, data } = await organizationApi.getList({parentId: id})
         if (!error && code === 200) {
             postData.value[index] = getArrValue(data)
         } else {
             postData.value[index] = []
         }
+        //处理负责人限制
+        const deptList = formModel.value.deptList
+        let isLader = 0;
+        deptList.forEach((item, indexs) => {
+            if (item.isLader === 1 && isLader !== 1) {
+                isLader = 1
+            }
+            if (item.deptId === id && indexs !== index) {
+                formModel.value.deptList[indexs].isLader = isLader
+                formModel.value.deptList[indexs].isLaderDisabled = true
+            }
+        })
+        formModel.value.deptList[index].isLaderDisabled = false
     }
 }
 
+//是否为部门负责人
+const isLaderChange = (id, index) => {
+    const deptList = formModel.value.deptList
+    const deptId = deptList[index].deptId
+    deptList.forEach((item, indexs) => {
+        if (item.deptId === deptId) {
+            formModel.value.deptList[indexs].isLader = item.isLader
+        }
+    })
+}
 
 //新增组织
 const addOrganizationClick = () => {