diff --git a/src/components/advanced/table-header-operation.vue b/src/components/advanced/table-header-operation.vue
new file mode 100644
index 00000000..e76af078
--- /dev/null
+++ b/src/components/advanced/table-header-operation.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+ {{ $t('common.add') }}
+
+
+
+
+
+
+
+ {{ $t('common.batchDelete') }}
+
+
+ {{ $t('common.confirmDelete') }}
+
+
+
+
+
+ {{ $t('common.refresh') }}
+
+
+
+
+
+
diff --git a/src/hooks/common/table.ts b/src/hooks/common/table.ts
index b41dcf68..3c0277be 100644
--- a/src/hooks/common/table.ts
+++ b/src/hooks/common/table.ts
@@ -71,7 +71,7 @@ export function useTable[0]> = reactive(apiParams || {});
+ const searchParams: NonNullable[0]> = reactive({ ...apiParams });
const { columns, filteredColumns, reloadColumns } = useTableColumn(config.columns);
@@ -125,9 +125,7 @@ export function useTable {
- searchParams[key as keyof typeof searchParams] = undefined;
- });
+ Object.assign(searchParams, apiParams);
}
if (immediate) {
@@ -158,8 +156,8 @@ export function useTable {
const { records = [], current = 1, size = 10, total = 0 } = res.data || {};
@@ -90,6 +95,9 @@ const { columns, filteredColumns, data, loading, pagination, getData, searchPara
]
});
+// provide searchParams
+setupRoleSearchContext(searchParams);
+
const operateType = ref('add');
function handleAdd() {
@@ -135,70 +143,17 @@ function getIndex(index: number) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('common.reset') }}
-
-
-
-
-
- {{ $t('common.search') }}
-
-
-
-
-
-
+
-
-
-
-
-
- {{ $t('common.add') }}
-
-
-
-
-
-
-
- {{ $t('common.batchDelete') }}
-
-
- {{ $t('common.confirmDelete') }}
-
-
-
-
-
- {{ $t('common.refresh') }}
-
-
-
+
+import { watch } from 'vue';
+import { $t } from '@/locales';
+import { roleStatusOptions } from '@/constants/business';
+import { translateOptions } from '@/utils/common';
+import { useRoleSearchContext } from './context';
+
+defineOptions({
+ name: 'RoleSearch'
+});
+
+interface Emits {
+ (e: 'reset'): void;
+ (e: 'search'): void;
+}
+
+const emit = defineEmits();
+
+// inject searchParams
+const { searchParams } = useRoleSearchContext();
+
+function reset() {
+ emit('reset');
+}
+
+function search() {
+ emit('search');
+}
+
+watch(
+ () => searchParams,
+ val => {
+ console.log('val: ', val);
+ },
+ {
+ deep: true
+ }
+);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('common.reset') }}
+
+
+
+
+
+ {{ $t('common.search') }}
+
+
+
+
+
+
+
+
+