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 @@