ZaiZai пре 2 година
родитељ
комит
a5f6c3c799
2 измењених фајлова са 49 додато и 6 уклоњено
  1. 8 0
      src/api/modules/system/organization.js
  2. 41 6
      src/views/system/user.vue

+ 8 - 0
src/api/modules/system/organization.js

@@ -31,4 +31,12 @@ export default {
             data: form
         }, false);
     },
+    //获取相关数据
+    async getList(form) {
+        return httpApi({
+            url: '/api/blade-system/dept/list',
+            method: 'get',
+            params: form
+        }, false);
+    },
 }

+ 41 - 6
src/views/system/user.vue

@@ -3,8 +3,7 @@
         <template #header>
             <div class="w-40">
                 <el-select v-model="searchForm.deptId" placeholder="选择岗位类型" clearable size="large">
-                    <el-option label="暂无接口1" :value="1"/>
-                    <el-option label="暂无接口2" :value="2"/>
+                    <el-option v-for="item in searchOrganization" :label="item.deptName" :value="item.id"/>
                 </el-select>
             </div>
             <div class="w-64 ml-3">
@@ -68,13 +67,13 @@
                         <el-row :gutter="10">
                             <el-col :span="7">
                                 <el-form-item prop="deptId">
-                                    <el-select v-model="item.deptId" placeholder="选择部门">
-                                        <el-option label="暂无接口" :value="1"/>
+                                    <el-select v-model="item.deptId" placeholder="选择部门" @change="initPostData(item.deptId)">
+                                        <el-option v-for="item in sectionData" :label="item.deptName" :value="item.id"/>
                                     </el-select>
                                 </el-form-item>
                             </el-col>
                             <el-col :span="7">
-                                <el-form-item prop="postId">
+                                <el-form-item prop="postId" :getInit="initPostData(item.deptId)">
                                     <el-select v-model="item.postId" placeholder="选择岗位">
                                         <el-option label="暂无接口" :value="1"/>
                                     </el-select>
@@ -132,14 +131,29 @@
 <script setup>
 import {ref, onMounted} from "vue";
 import {arrIndex, isPhone} from "js-fast-way"
-import mainApi from '~api/system/user.js';
+import mainApi from '~api/system/user';
+import organizationApi from '~api/system/organization';
 import {getArrValue} from "js-fast-way"
 import {Plus, Delete} from '@element-plus/icons-vue'
 
 onMounted(() => {
     getTableData()
+    getOrganization()
 })
 
+//获取搜索时的组织结构节点
+const searchOrganization = ref([])
+const getOrganization = async () => {
+    const { error, code, data } = await organizationApi.getList({
+        deptType: 3
+    })
+    if (!error && code === 200) {
+        searchOrganization.value = getArrValue(data)
+    } else {
+        searchOrganization.value = []
+    }
+}
+
 const searchForm = ref({deptId: null, realName: '', current: 1, size: 20, total: 0})
 
 //分页被点击
@@ -270,6 +284,7 @@ const addUserClick = () => {
         organization: [{}],
     }
     formModal.value = true
+    getSectionData()
 }
 
 //编辑用户信息
@@ -278,8 +293,28 @@ const rowEidtClick = (row) => {
     row.password = ''
     formModel.value = row
     formModal.value = true
+    getSectionData()
 }
 
+//部门下拉数据
+const sectionData = ref([])
+const getSectionData = async () => {
+    const { error, code, data } = await organizationApi.getList({
+        deptType: 2
+    })
+    if (!error && code === 200) {
+        sectionData.value = getArrValue(data)
+    } else {
+        sectionData.value = []
+    }
+}
+
+//获取岗位数据
+const initPostData = () => {
+
+}
+
+
 //新增组织
 const addOrganizationClick = (row) => {
     formModel.value.organization.push({})