From 2d9fc62d86ae62d885601151cbe8c965ebabd8a8 Mon Sep 17 00:00:00 2001 From: xuziqiang <1344691446@qq.com> Date: Mon, 1 Jul 2024 16:04:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=A3=E5=86=B3=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B9=8B=E5=90=8E=E9=80=89=E4=B8=AD=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B8=85=E9=99=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/view/organizationManage/usermanage/index.vue | 1 + lib/component/table/table-action.vue | 5 ++++- lib/component/table/table.vue | 9 ++++++--- lib/use/use-action.ts | 9 ++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue b/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue index 00af572..a6ce9d3 100644 --- a/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue +++ b/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue @@ -338,6 +338,7 @@ }, confirm: true, isReload: true, + isClearCheck: true, api: origanizemanage.batchDel, dynamicParams: { userIds: 'userId[]' }, }, diff --git a/lib/component/table/table-action.vue b/lib/component/table/table-action.vue index 8866e5f..fd0c476 100644 --- a/lib/component/table/table-action.vue +++ b/lib/component/table/table-action.vue @@ -72,8 +72,11 @@ }, setup(props) { const { columnActions, searchData, data } = toRefs(props); + const reload = inject('reload', () => {}); - const { filterAction, transformAction } = useAction({ reload }); + const clearCheck = inject('clearCheck', () => {}); + + const { filterAction, transformAction } = useAction({ reload, clearCheck }); const route = useRoute(); const getData = computed(() => { return { diff --git a/lib/component/table/table.vue b/lib/component/table/table.vue index 02855bf..ce2add4 100644 --- a/lib/component/table/table.vue +++ b/lib/component/table/table.vue @@ -232,6 +232,10 @@ loadErrorMessage: '', loadinterval: 0, }); + const clearCheck = () => { + tableState.selectedRowKeys = []; + tableState.selectedRows = []; + }; const route = useRoute(); const { getColumnActionWidth } = useTableColumn({ columnActions: Object.assign({}, tableConfig.columnActions, props.columnActions), @@ -410,8 +414,6 @@ return false; }); - console.log(getPagination.value); - const getTableBindValues = computed(() => { const { params, dynamicParams } = props; return { @@ -511,7 +513,6 @@ tableState.loadError = false; tableState.loadErrorMessage = ''; dataRef.value = res; - console.log(props.listField); tableData.value = get(unref(dataRef), props.listField); //saas项目配置 if (attrs['getPageParams']) { @@ -617,10 +618,12 @@ } provide('reload', reload); //提供刷新功能 + provide('clearCheck', clearCheck); //提供清空选中功能 return { navigateBack, reload, + clearCheck, formElRef, tableElRef, getColumnActions, diff --git a/lib/use/use-action.ts b/lib/use/use-action.ts index c5c2f53..cbc816e 100644 --- a/lib/use/use-action.ts +++ b/lib/use/use-action.ts @@ -39,6 +39,7 @@ export interface Action { type?: string; //按钮 primary | ghost | dashed | link | text | default dynamicDisabled?: boolean | Function; isReload?: boolean; + isClearCheck?: boolean; // 清空table选中行数据 state?: String; // edit 为编辑态 其他为编辑中 extra?: Recordable; } @@ -50,11 +51,12 @@ export interface Action { */ interface actionParams { reload?: Function; + clearCheck?: Function; } export function useAction(actionParams: actionParams = {}) { const router = useRouter(); const route = useRoute(); - const { reload } = actionParams; + const { reload, clearCheck } = actionParams; const { getPath } = usePath(); const { httpRequest } = useApi(); const authService = authorizationService(); @@ -169,6 +171,7 @@ export function useAction(actionParams: actionParams = {}) { checkDefaultParams, handle, isReload = false, + isClearCheck = false, extra, } = action; const { getParams } = useParams(); @@ -239,6 +242,7 @@ export function useAction(actionParams: actionParams = {}) { api: null, handle, isReload, + isClearCheck, }; let modelInstance: Recordable = {}; if (name && name.toLowerCase().includes('exports')) { @@ -332,6 +336,9 @@ export function useAction(actionParams: actionParams = {}) { if (isReload) { isFunction(reload) && reload(); } + if (isClearCheck) { + isFunction(clearCheck) && clearCheck(); + } setTimeout(() => { modeUpdate({ okButtonProps: {