diff --git a/admin-ui/src/api/ai/dept.js b/admin-ui/src/api/ai/dept.js
new file mode 100644
index 0000000..415856b
--- /dev/null
+++ b/admin-ui/src/api/ai/dept.js
@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+export function listDept(query) {
+ return request({
+ url: '/ai/dept/list',
+ method: 'get',
+ params: query
+ })
+}
+
+export function listDeptExcludeChild(deptId) {
+ return request({
+ url: '/ai/dept/list/exclude/' + deptId,
+ method: 'get'
+ })
+}
+
+export function getDept(deptId) {
+ return request({
+ url: '/ai/dept/' + deptId,
+ method: 'get'
+ })
+}
+
+export function addDept(data) {
+ return request({
+ url: '/ai/dept',
+ method: 'post',
+ data: data
+ })
+}
+
+export function updateDept(data) {
+ return request({
+ url: '/ai/dept',
+ method: 'put',
+ data: data
+ })
+}
+
+export function delDept(deptId) {
+ return request({
+ url: '/ai/dept/' + deptId,
+ method: 'delete'
+ })
+}
diff --git a/admin-ui/src/api/ai/user.js b/admin-ui/src/api/ai/user.js
index 93c6cca..389afbc 100644
--- a/admin-ui/src/api/ai/user.js
+++ b/admin-ui/src/api/ai/user.js
@@ -81,3 +81,12 @@ export function updatePassword(id, newPassword) {
data: data
})
}
+
+/** 分配归属部门,deptId 可省略或 null 表示清空 */
+export function assignAiUserDept(data) {
+ return request({
+ url: '/ai/user/dept',
+ method: 'put',
+ data
+ })
+}
diff --git a/admin-ui/src/views/ai/dept/index.vue b/admin-ui/src/views/ai/dept/index.vue
new file mode 100644
index 0000000..ae3808d
--- /dev/null
+++ b/admin-ui/src/views/ai/dept/index.vue
@@ -0,0 +1,344 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 展开/折叠
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ parseTime(scope.row.createTime) }}
+
+
+
+
+ 修改
+ 新增
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{dict.label}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin-ui/src/views/ai/user/index.vue b/admin-ui/src/views/ai/user/index.vue
index c9ad232..1a893f5 100644
--- a/admin-ui/src/views/ai/user/index.vue
+++ b/admin-ui/src/views/ai/user/index.vue
@@ -50,6 +50,16 @@
/>
+
+
+
搜索
重置
@@ -78,6 +88,7 @@
+
@@ -103,8 +114,15 @@
-
+
+ 分配部门
+
+
+
+
+
+
+
+
+
+
@@ -207,12 +244,17 @@ import {
updateUser,
changeBalance,
changeUserStatus,
- updatePassword
+ updatePassword,
+ assignAiUserDept
} from "@/api/ai/user";
+import { listDept } from "@/api/ai/dept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "User",
dicts: ["sys_normal_disable", "sys_user_sex"],
+ components: { Treeselect },
data() {
return {
// 遮罩层
@@ -235,6 +277,12 @@ export default {
open: false,
openUpdatePassword: false,
openUpdateBalance: false,
+ assignDeptOpen: false,
+ deptOptions: [],
+ assignForm: {
+ id: null,
+ deptId: null
+ },
// 查询参数
queryParams: {
pageNum: 1,
@@ -252,7 +300,8 @@ export default {
paymentUrl: null,
loginTime: null,
balance: null,
- superiorName: null
+ superiorName: null,
+ deptId: null
},
// 表单参数
form: {},
@@ -268,9 +317,49 @@ export default {
};
},
created() {
+ this.loadDeptTree();
this.getList();
},
methods: {
+ loadDeptTree() {
+ listDept().then(res => {
+ this.deptOptions = this.handleTree(res.data, "deptId");
+ });
+ },
+ deptNormalizer(node) {
+ if (node.children && !node.children.length) {
+ delete node.children;
+ }
+ return {
+ id: node.deptId,
+ label: node.deptName,
+ children: node.children
+ };
+ },
+ handleOpenAssignDept(row) {
+ getUser(row.id).then(res => {
+ this.assignForm = {
+ id: res.data.id,
+ deptId: res.data.deptId
+ };
+ this.assignDeptOpen = true;
+ });
+ },
+ submitAssignDept() {
+ const payload = {
+ id: this.assignForm.id,
+ deptId: this.assignForm.deptId != null ? this.assignForm.deptId : null
+ };
+ assignAiUserDept(payload).then(() => {
+ this.$modal.msgSuccess("已保存");
+ this.assignDeptOpen = false;
+ this.getList();
+ });
+ },
+ cancelAssignDept() {
+ this.assignDeptOpen = false;
+ this.assignForm = { id: null, deptId: null };
+ },
// 更多操作触发
handleCommand(command, row) {
switch (command) {
diff --git a/admin-ui/src/views/system/dept/index.vue b/admin-ui/src/views/system/dept/index.vue
index 088f09d..75e9007 100644
--- a/admin-ui/src/views/system/dept/index.vue
+++ b/admin-ui/src/views/system/dept/index.vue
@@ -148,6 +148,19 @@
+
+
+
+
+
+
+