diff --git a/frontend/src/components/pure/ms-table/base-table.vue b/frontend/src/components/pure/ms-table/base-table.vue index 638efa19a7..54bdd3b9cf 100644 --- a/frontend/src/components/pure/ms-table/base-table.vue +++ b/frontend/src/components/pure/ms-table/base-table.vue @@ -79,6 +79,11 @@ +
{ + propsRes.value.tableErrorStatus = status; + }; + /** * 分页设置 * @param current //当前页数 @@ -120,9 +130,7 @@ export default function useTableProps( const setPagination = ({ current, total }: SetPaginationPrams) => { if (propsRes.value.msPagination && typeof propsRes.value.msPagination === 'object') { propsRes.value.msPagination.current = current; - if (total) { - propsRes.value.msPagination.total = total; - } + propsRes.value.msPagination.total = total || 0; } }; @@ -171,14 +179,18 @@ export default function useTableProps( } return item; }); + if (data.total === 0) { + setTableErrorStatus('empty'); + } else { + setTableErrorStatus(false); + } setPagination({ current: data.current, total: data.total }); return data; } catch (err) { - // eslint-disable-next-line no-console - // TODO 表格异常放到solt的empty - console.log(err); + setTableErrorStatus('error'); } finally { setLoading(false); + if (propsRes.value.debug) console.info(propsRes.value); } }; diff --git a/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue b/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue index 9c1e50e5b6..f8096a2862 100644 --- a/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue +++ b/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue @@ -29,7 +29,7 @@ import useTable from '@/components/pure/ms-table/useTable'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import { useTableStore } from '@/store'; - import { ref, reactive, watchEffect } from 'vue'; + import { ref, reactive, watchEffect, watch } from 'vue'; import type { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { postOrgTable } from '@/api/modules/setting/system/organizationAndProject'; import { TableKeyEnum } from '@/enums/tableEnum'; @@ -172,20 +172,24 @@ scroll: { y: 'auto', x: '1300px' }, selectable: false, noDisable: false, + debug: true, size: 'default', }); const fetchData = async () => { + setKeyword(props.keyword); await loadList(); }; const handleAddUserModalCancel = () => { userVisible.value = false; }; - watchEffect(() => { - setKeyword(props.keyword); - fetchData(); - }); + watch( + () => props.keyword, + () => { + fetchData(); + } + );