diff --git a/src/components/PageContent/index.vue b/src/components/PageContent/index.vue index 7ec2e6ab..96172935 100644 --- a/src/components/PageContent/index.vue +++ b/src/components/PageContent/index.vue @@ -76,6 +76,10 @@ + + @@ -149,11 +153,7 @@ :disabled="!hasAuth(`${contentConfig.pageName}:modify`)" @change=" pageData.length > 0 && - handleSwitchChange( - col.prop, - scope.row[col.prop], - scope.row - ) + handleModify(col.prop, scope.row[col.prop], scope.row) " /> @@ -316,7 +316,7 @@ export interface IContentConfig { } >; // 表格工具栏右侧图标 - defaultToolbar?: ("refresh" | "filter")[]; + defaultToolbar?: ("refresh" | "filter" | "search")[]; // table组件列属性(额外的属性templet,operat,slotName) cols: Array<{ type?: "default" | "selection" | "index" | "expand"; @@ -365,12 +365,11 @@ const props = defineProps<{ const emit = defineEmits<{ addClick: []; exportClick: []; + searchClick: []; toolbarClick: [name: string]; editClick: [row: IObject]; operatClick: [data: IOperatData]; }>(); -// 暴露的属性和方法 -defineExpose({ fetchPageData, exportPageData }); // 主键 const pk = props.contentConfig.pk ?? "id"; @@ -380,6 +379,7 @@ const toolbar = props.contentConfig.toolbar ?? ["add", "delete"]; const defaultToolbar = props.contentConfig.defaultToolbar ?? [ "refresh", "filter", + "search", ]; // 表格列 const cols = ref( @@ -468,6 +468,9 @@ function handleToolbar(name: string) { case "refresh": handleRefresh(); break; + case "search": + emit("searchClick"); + break; case "add": emit("addClick"); break; @@ -522,7 +525,7 @@ function exportPageData(queryParams: IObject = {}) { } } // 属性修改 -function handleSwitchChange( +function handleModify( field: string, value: boolean | string | number, row: Record @@ -537,6 +540,9 @@ function handleSwitchChange( ElMessage.error("未配置modifyAction"); } } + +// 暴露的属性和方法 +defineExpose({ fetchPageData, exportPageData }); diff --git a/src/components/PageSearch/index.vue b/src/components/PageSearch/index.vue index 21a5e346..33545529 100644 --- a/src/components/PageSearch/index.vue +++ b/src/components/PageSearch/index.vue @@ -1,5 +1,9 @@