diff --git a/apps/web-antd/src/views/crm/product/category/data.ts b/apps/web-antd/src/views/crm/product/category/data.ts index 01d0996e..dcee3aa5 100644 --- a/apps/web-antd/src/views/crm/product/category/data.ts +++ b/apps/web-antd/src/views/crm/product/category/data.ts @@ -57,6 +57,10 @@ export function useGridFormSchema(): VbenFormSchema[] { fieldName: 'name', label: '分类名称', component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入分类名称', + }, }, ]; } diff --git a/apps/web-antd/src/views/crm/product/category/index.vue b/apps/web-antd/src/views/crm/product/category/index.vue index 994b6315..5ff229dd 100644 --- a/apps/web-antd/src/views/crm/product/category/index.vue +++ b/apps/web-antd/src/views/crm/product/category/index.vue @@ -23,8 +23,15 @@ const [FormModal, formModalApi] = useVbenModal({ destroyOnClose: true, }); +/** 切换树形展开/收缩状态 */ +const isExpanded = ref(false); +function handleExpand() { + isExpanded.value = !isExpanded.value; + gridApi.grid.setAllTreeExpand(isExpanded.value); +} + /** 刷新表格 */ -function onRefresh() { +function handleRefresh() { gridApi.query(); } @@ -51,22 +58,13 @@ async function handleDelete(row: CrmProductCategoryApi.ProductCategory) { }); try { await deleteProductCategory(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.name]), - }); - onRefresh(); + message.success($t('ui.actionMessage.deleteSuccess', [row.name])); + handleRefresh(); } finally { hideLoading(); } } -/** 切换树形展开/收缩状态 */ -const isExpanded = ref(false); -function toggleExpand() { - isExpanded.value = !isExpanded.value; - gridApi.grid.setAllTreeExpand(isExpanded.value); -} - const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), @@ -87,14 +85,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, rowConfig: { keyField: 'id', + isHover: true, }, toolbarConfig: { refresh: true, + search: true, }, treeConfig: { parentField: 'parentId', rowField: 'id', transform: true, + expandAll: true, reserve: true, }, } as VxeTableGridOptions, @@ -110,7 +111,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ /> - + -