From 01394c69042bd6cf8f01ffaffa728002bd756a02 Mon Sep 17 00:00:00 2001 From: sheng <15292050171@163.com> Date: Wed, 2 Aug 2023 17:40:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=20=E9=83=A8=E9=97=A8=E8=AF=A6=E6=83=85=E4=B8=8E=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E7=9A=84=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/dept/components/DeptUserCom/api.ts | 11 +- .../dept/components/DeptUserCom/crud.tsx | 13 +- .../dept/components/DeptUserCom/index.vue | 182 ++++++++++++++---- web/src/views/system/dept/types.ts | 13 ++ 4 files changed, 172 insertions(+), 47 deletions(-) diff --git a/web/src/views/system/dept/components/DeptUserCom/api.ts b/web/src/views/system/dept/components/DeptUserCom/api.ts index a18ba94..561fa10 100644 --- a/web/src/views/system/dept/components/DeptUserCom/api.ts +++ b/web/src/views/system/dept/components/DeptUserCom/api.ts @@ -1,6 +1,8 @@ import { request, downloadFile } from '/@/utils/service'; import { PageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud'; +type GetListType = PageQuery & { show_all: string } + export const apiPrefix = '/api/system/user/'; export function GetDept(query: PageQuery) { @@ -11,7 +13,7 @@ export function GetDept(query: PageQuery) { }); } -export function GetList(query: PageQuery) { +export function GetList(query: GetListType) { return request({ url: apiPrefix, method: 'get', @@ -56,3 +58,10 @@ export function exportData(params: any) { method: 'get' }) } + +export function getDeptInfoById(id: string, type: string) { + return request({ + url: `/api/system/dept/dept_info/?dept_id=${id}&show_all=${type}`, + method: 'get', + }); +} diff --git a/web/src/views/system/dept/components/DeptUserCom/crud.tsx b/web/src/views/system/dept/components/DeptUserCom/crud.tsx index 5b853fc..3ab08e9 100644 --- a/web/src/views/system/dept/components/DeptUserCom/crud.tsx +++ b/web/src/views/system/dept/components/DeptUserCom/crud.tsx @@ -5,9 +5,10 @@ import * as api from './api'; import { dictionary } from '/@/utils/dictionary'; import { successMessage } from '/@/utils/message'; -export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet { +export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { const pageRequest = async (query: UserPageQuery) => { - const res = await api.GetList(query); + const show_all = context?.isShowChildFlag.value ? '1' : '0'; + const res = await api.GetList({ ...query, show_all }); /** * 处理crud警告:Invalid prop: type check failed for prop "name". Expected String with value "2", got Number with value 2. */ @@ -24,10 +25,14 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp return await api.UpdateObj(form); }; const delRequest = async ({ row }: DelReq) => { - return await api.DelObj(row.id); + const res = await api.DelObj(row.id); + context?.getDeptInfo(); + return res; }; const addRequest = async ({ form }: AddReq) => { - return await api.AddObj(form); + const res = await api.AddObj(form); + context?.getDeptInfo(); + return res; }; const exportRequest = async (query: UserPageQuery) => { diff --git a/web/src/views/system/dept/components/DeptUserCom/index.vue b/web/src/views/system/dept/components/DeptUserCom/index.vue index 80f5616..a0533c1 100644 --- a/web/src/views/system/dept/components/DeptUserCom/index.vue +++ b/web/src/views/system/dept/components/DeptUserCom/index.vue @@ -1,26 +1,34 @@