From e2254651ca3e83f4343c5590b10635331fa801a0 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期三, 24 四月 2024 23:46:05 +0800
Subject: [PATCH] fix 修复 !pr107 遗留问题

---
 src/views/system/user/index.vue |   12 +++++++++++-
 src/views/system/post/index.vue |   25 ++++++++++++-------------
 src/api/system/post/index.ts    |    7 +++++--
 3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/api/system/post/index.ts b/src/api/system/post/index.ts
index 1b565a8..5f6ab18 100644
--- a/src/api/system/post/index.ts
+++ b/src/api/system/post/index.ts
@@ -20,11 +20,14 @@
 }
 
 // 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�
-export function optionselect(query: PostQuery): AxiosPromise<PostVO[]> {
+export function optionselect(deptId?: number | string, postIds?: (number | string)[]): AxiosPromise<PostVO[]> {
   return request({
     url: '/system/post/optionselect',
     method: 'get',
-    params: query
+    params: {
+      postIds: postIds,
+      deptId: deptId
+    }
   });
 }
 
diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue
index 87ccf92..fa1c6dc 100644
--- a/src/views/system/post/index.vue
+++ b/src/views/system/post/index.vue
@@ -40,7 +40,8 @@
                     :props="{ value: 'id', label: 'label', children: 'children' }"
                     value-key="id"
                     placeholder="璇烽�夋嫨閮ㄩ棬"
-                    check-strictly/>
+                    check-strictly
+                  />
                 </el-form-item>
                 <el-form-item label="鐘舵��" prop="status">
                   <el-select v-model="queryParams.status" placeholder="宀椾綅鐘舵��" clearable>
@@ -114,18 +115,16 @@
             <el-form-item label="宀椾綅鍚嶇О" prop="postName">
               <el-input v-model="form.postName" placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" />
             </el-form-item>
-            <el-col>
-              <el-form-item label="閮ㄩ棬" prop="deptId">
-                <el-tree-select
-                  v-model="form.deptId"
-                  :data="deptOptions"
-                  :props="{ value: 'id', label: 'label', children: 'children' }"
-                  value-key="id"
-                  placeholder="璇烽�夋嫨閮ㄩ棬"
-                  check-strictly
-                />
-              </el-form-item>
-            </el-col>
+            <el-form-item label="閮ㄩ棬" prop="deptId">
+              <el-tree-select
+                v-model="form.deptId"
+                :data="deptOptions"
+                :props="{ value: 'id', label: 'label', children: 'children' }"
+                value-key="id"
+                placeholder="璇烽�夋嫨閮ㄩ棬"
+                check-strictly
+              />
+            </el-form-item>
             <el-form-item label="宀椾綅缂栫爜" prop="postCode">
               <el-input v-model="form.postCode" placeholder="璇疯緭鍏ョ紪鐮佸悕绉�" />
             </el-form-item>
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 1e15998..e8e0c23 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -287,10 +287,11 @@
 import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
 import { DeptVO } from '@/api/system/dept/types';
 import { RoleVO } from '@/api/system/role/types';
-import { PostVO } from '@/api/system/post/types';
+import {PostQuery, PostVO} from '@/api/system/post/types';
 import { treeselect } from '@/api/system/dept';
 import { globalHeaders } from '@/utils/request';
 import { to } from 'await-to-js';
+import {optionselect} from "@/api/system/post";
 
 const router = useRouter();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -645,6 +646,15 @@
     initPassword.value = response.data;
   });
 });
+
+// 鐩戞祴閮ㄩ棬鍙樺寲鍔犺浇宀椾綅
+watch(
+  () => form.value.deptId,
+  async () => {
+    const response = await optionselect(form.value.deptId);
+    postOptions.value = response.data;
+  }
+);
 </script>
 
 <style lang="scss" scoped></style>

--
Gitblit v1.9.3