diff --git a/apps/web-antd/src/views/crm/customer/limitConfig/data.ts b/apps/web-antd/src/views/crm/customer/limitConfig/data.ts index a969e1dc..bdf5ea41 100644 --- a/apps/web-antd/src/views/crm/customer/limitConfig/data.ts +++ b/apps/web-antd/src/views/crm/customer/limitConfig/data.ts @@ -3,6 +3,7 @@ import type { VbenFormSchema } from '@vben/common-ui'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; import { handleTree } from '@vben/utils'; import { LimitConfType } from '#/api/crm/customer/limitConfig'; @@ -20,6 +21,14 @@ export function useFormSchema(confType: LimitConfType): VbenFormSchema[] { show: () => false, }, }, + { + fieldName: 'type', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, { fieldName: 'userIds', label: '规则适用人群', @@ -30,10 +39,10 @@ export function useFormSchema(confType: LimitConfType): VbenFormSchema[] { label: 'nickname', value: 'id', }, - mode: 'tags', + mode: 'multiple', allowClear: true, + placeholder: '请选择规则适用人群', }, - rules: 'required', }, { fieldName: 'deptIds', @@ -49,7 +58,6 @@ export function useFormSchema(confType: LimitConfType): VbenFormSchema[] { placeholder: '请选择规则适用部门', treeDefaultExpandAll: true, }, - rules: 'required', }, { fieldName: 'maxCount', @@ -58,21 +66,29 @@ export function useFormSchema(confType: LimitConfType): VbenFormSchema[] { ? '拥有客户数上限' : '锁定客户数上限', component: 'InputNumber', + componentProps: { + placeholder: `请输入${ + LimitConfType.CUSTOMER_QUANTITY_LIMIT === confType + ? '拥有客户数上限' + : '锁定客户数上限' + }`, + }, + rules: 'required', }, { fieldName: 'dealCountEnabled', label: '成交客户是否占用拥有客户数', component: 'RadioGroup', componentProps: { - options: [ - { label: '是', value: true }, - { label: '否', value: false }, - ], + options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'), + buttonStyle: 'solid', + optionType: 'button', }, dependencies: { triggerFields: [''], show: () => confType === LimitConfType.CUSTOMER_QUANTITY_LIMIT, }, + defaultValue: false, }, ]; } diff --git a/apps/web-antd/src/views/crm/customer/limitConfig/index.vue b/apps/web-antd/src/views/crm/customer/limitConfig/index.vue index e9b29eae..2885f5b4 100644 --- a/apps/web-antd/src/views/crm/customer/limitConfig/index.vue +++ b/apps/web-antd/src/views/crm/customer/limitConfig/index.vue @@ -21,16 +21,25 @@ import Form from './modules/form.vue'; const configType = ref(LimitConfType.CUSTOMER_QUANTITY_LIMIT); -/** 刷新表格 */ -function onRefresh() { - gridApi.query(); -} - const [FormModal, formModalApi] = useVbenModal({ connectedComponent: Form, destroyOnClose: true, }); +/** 刷新表格 */ +function handleRefresh() { + gridApi.query(); +} + +/** 处理配置类型的切换 */ +function handleChangeConfigType(key: number | string) { + configType.value = key as LimitConfType; + gridApi.setGridOptions({ + columns: useGridColumns(configType.value), + }); + handleRefresh(); +} + /** 创建规则 */ function handleCreate(type: LimitConfType) { formModalApi.setData({ type }).open(); @@ -54,10 +63,8 @@ async function handleDelete( }); try { await deleteCustomerLimitConfig(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.id]), - }); - onRefresh(); + message.success($t('ui.actionMessage.deleteSuccess', [row.id])); + handleRefresh(); } finally { hideLoading(); } @@ -82,6 +89,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, rowConfig: { keyField: 'id', + isHover: true, }, toolbarConfig: { refresh: true, @@ -89,14 +97,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, } as VxeTableGridOptions, }); - -function onChangeConfigType(key: number | string) { - configType.value = key as LimitConfType; - gridApi.setGridOptions({ - columns: useGridColumns(configType.value), - }); - onRefresh(); -} - + + diff --git a/apps/web-antd/src/views/crm/customer/limitConfig/modules/form.vue b/apps/web-antd/src/views/crm/customer/limitConfig/modules/form.vue index 7d082bf1..392a8527 100644 --- a/apps/web-antd/src/views/crm/customer/limitConfig/modules/form.vue +++ b/apps/web-antd/src/views/crm/customer/limitConfig/modules/form.vue @@ -34,7 +34,7 @@ const [Form, formApi] = useVbenForm({ class: 'w-full', }, formItemClass: 'col-span-2', - labelWidth: 120, + labelWidth: 200, }, layout: 'horizontal', schema: useFormSchema(confType.value),