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: 'Input', fieldName: 'projectName', label: '产品名称', }, { component: 'Select', componentProps: { options: getDictOptions('value_added_type'), }, fieldName: 'type', label: '类型', }, { component: 'Select', componentProps: { options: getDictOptions('product_management_status'), }, fieldName: 'state', label: '状态', }, ]; export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '产品名称', field: 'projectName', }, { title: '单价(元)', field: 'price', }, { title: '单位', field: 'unit', }, { title: '类型', field: 'type', slots: { default: ({ row }) => { return renderDict(row.type, 'value_added_type'); }, }, }, { title: '状态', field: 'state', slots: { default: ({ row }) => { return renderDict(row.state, 'product_management_status'); }, }, }, { 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: 'projectName', component: 'Input', rules: 'required', }, { label: '单价', fieldName: 'price', component: 'Input', rules: 'required', }, { label: '单位', fieldName: 'unit', component: 'Input', rules: 'required', }, { label: '类型', fieldName: 'type', component: 'Select', componentProps: { options: getDictOptions('value_added_type'), }, rules: 'selectRequired', }, { label: '状态', fieldName: 'state', component: 'Select', componentProps: { options: getDictOptions('product_management_status'), }, rules: 'selectRequired', }, ];