From 4f0295acb1497e08e6a665fee340304b441619cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8C=BF=E5=B0=8F=E5=A4=A9?= <1638245306@qq.com>
Date: Sun, 9 Apr 2023 22:26:26 +0800
Subject: [PATCH] =?UTF-8?q?refactor(=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86):?=
=?UTF-8?q?=20=E2=99=BB=EF=B8=8F=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/dvadmin/system/views/dept.py | 1 +
web/src/views/system/user/api.ts | 9 ++
web/src/views/system/user/crud.tsx | 19 ++-
web/src/views/system/user/index.vue | 178 +++++++++++++--------------
4 files changed, 113 insertions(+), 94 deletions(-)
diff --git a/backend/dvadmin/system/views/dept.py b/backend/dvadmin/system/views/dept.py
index c5179d0..e362bd0 100644
--- a/backend/dvadmin/system/views/dept.py
+++ b/backend/dvadmin/system/views/dept.py
@@ -123,6 +123,7 @@ class DeptViewSet(CustomModelViewSet):
data = serializer.data
return SuccessResponse(data=data)
+ @action(methods=["GET"], detail=False, permission_classes=[IsAuthenticated], extra_filter_class=[])
def dept_lazy_tree(self, request, *args, **kwargs):
parent = self.request.query_params.get('parent')
is_superuser = request.user.is_superuser
diff --git a/web/src/views/system/user/api.ts b/web/src/views/system/user/api.ts
index aa00f9e..fb96384 100644
--- a/web/src/views/system/user/api.ts
+++ b/web/src/views/system/user/api.ts
@@ -2,6 +2,15 @@ import { request } from '/@/utils/service';
import { PageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
export const apiPrefix = '/api/system/user/';
+
+export function GetDept(query: PageQuery) {
+ return request({
+ url: "/api/system/dept/dept_lazy_tree/",
+ method: 'get',
+ params: query,
+ });
+}
+
export function GetList(query: PageQuery) {
return request({
url: apiPrefix,
diff --git a/web/src/views/system/user/crud.tsx b/web/src/views/system/user/crud.tsx
index 9825255..f86143f 100644
--- a/web/src/views/system/user/crud.tsx
+++ b/web/src/views/system/user/crud.tsx
@@ -63,8 +63,10 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
search: {
show: true,
},
- minWidth: 100,
type: 'input',
+ column:{
+ minWidth: 100 //最小列宽
+ },
form: {
rules: [
// 表单校验规则
@@ -114,6 +116,9 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
show: true,
},
type: 'input',
+ column:{
+ minWidth: 100 //最小列宽
+ },
form: {
rules: [
// 表单校验规则
@@ -147,6 +152,9 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
});
},
}),
+ column:{
+ minWidth: 150 //最小列宽
+ },
form: {
rules: [
// 表单校验规则
@@ -190,6 +198,9 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
});
},
}),
+ column:{
+ minWidth: 100 //最小列宽
+ },
form: {
rules: [
// 表单校验规则
@@ -211,6 +222,9 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
show: true,
},
type: 'input',
+ column:{
+ minWidth: 120 //最小列宽
+ },
form: {
rules: [
{
@@ -269,6 +283,9 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
dict: dict({
data: dictionary('user_type'),
}),
+ column:{
+ minWidth: 100 //最小列宽
+ },
form: {
show: false,
value: 0,
diff --git a/web/src/views/system/user/index.vue b/web/src/views/system/user/index.vue
index 7d130b6..c6fe04d 100644
--- a/web/src/views/system/user/index.vue
+++ b/web/src/views/system/user/index.vue
@@ -1,124 +1,116 @@
-
-
-
-
-
- 用户列表
-
-
-
-
-
-
-
- {{ node.label }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ 部门列表
+
+
+
+
+
+
+
+
+
+ {{ node.label }}
+
+
+
+
+
+
+
+
+
+
+
+
+