import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; import { getDictOptions } from '#/utils/dict'; import { renderDict } from '#/utils/render'; export const querySchema: FormSchemaGetter = () => [ { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护 options: getDictOptions('pro_expense_type'), }, fieldName: 'costType', label: '费用类型', }, { component: 'Input', fieldName: 'chargeItem', label: '收费项目', }, { component: 'Input', fieldName: 'costMark', label: '费用标识', }, { component: 'Select', componentProps: { }, fieldName: 'paymentType', label: '付费类型', }, { component: 'Input', fieldName: 'chargeCycle', label: '缴费周期', }, { component: 'Input', fieldName: 'isMobilePay', label: '是否手机缴费', }, { component: 'Input', fieldName: 'roundingMode', label: '进位方式', }, { component: 'Input', fieldName: 'currencyDecimals', label: '保留小数', }, { component: 'Input', fieldName: 'state', label: '启用状态', }, { component: 'Input', fieldName: 'formula', label: '计算公式', }, { component: 'Input', fieldName: 'unitPrice', label: '计费单价', }, { component: 'Input', fieldName: 'surcharge', label: '附加费', }, { component: 'Input', fieldName: 'searchValue', label: '搜索值', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '主键', field: 'id', }, { title: '费用类型', field: 'costType', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护 return renderDict(row.costType, 'pro_expense_type'); }, }, }, { title: '收费项目', field: 'chargeItem', }, { title: '费用标识', field: 'costMark', }, { title: '付费类型', field: 'paymentType', }, { title: '缴费周期', field: 'chargeCycle', }, { title: '是否手机缴费', field: 'isMobilePay', }, { title: '进位方式', field: 'roundingMode', }, { title: '保留小数', field: 'currencyDecimals', }, { title: '启用状态', field: 'state', }, { title: '计算公式', field: 'formula', }, { title: '计费单价', field: 'unitPrice', }, { title: '附加费', field: 'surcharge', }, { title: '搜索值', field: 'searchValue', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: '主键', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '费用类型', fieldName: 'costType', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护 options: getDictOptions('pro_expense_type'), }, rules: 'selectRequired', }, { label: '收费项目', fieldName: 'chargeItem', component: 'Input', rules: 'required', }, { label: '费用标识', fieldName: 'costMark', component: 'Input', rules: 'required', }, { label: '付费类型', fieldName: 'paymentType', component: 'Select', componentProps: { }, rules: 'selectRequired', }, { label: '缴费周期', fieldName: 'chargeCycle', component: 'Input', }, { label: '是否手机缴费', fieldName: 'isMobilePay', component: 'Input', }, { label: '进位方式', fieldName: 'roundingMode', component: 'Input', }, { label: '保留小数', fieldName: 'currencyDecimals', component: 'Input', }, { label: '启用状态', fieldName: 'state', component: 'Input', }, { label: '计算公式', fieldName: 'formula', component: 'Input', }, { label: '计费单价', fieldName: 'unitPrice', component: 'Input', }, { label: '附加费', fieldName: 'surcharge', component: 'Input', }, { label: '搜索值', fieldName: 'searchValue', component: 'Input', }, ];