2025-06-23 09:27:28 +08:00
|
|
|
import type { FormSchemaGetter } from '#/adapter/form';
|
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
2025-07-04 17:56:14 +08:00
|
|
|
import {getDictOptions} from "#/utils/dict";
|
|
|
|
import {renderDict} from "#/utils/render";
|
2025-06-23 09:27:28 +08:00
|
|
|
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'projectName',
|
|
|
|
label: '产品名称',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
2025-07-04 17:56:14 +08:00
|
|
|
options: getDictOptions('value_added_type'),
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
fieldName: 'type',
|
|
|
|
label: '类型',
|
|
|
|
},
|
|
|
|
{
|
2025-07-04 17:56:14 +08:00
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('product_management_status'),
|
|
|
|
},
|
2025-06-23 09:27:28 +08:00
|
|
|
fieldName: 'state',
|
|
|
|
label: '状态',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const columns: VxeGridProps['columns'] = [
|
|
|
|
{ type: 'checkbox', width: 60 },
|
|
|
|
{
|
|
|
|
title: '产品名称',
|
|
|
|
field: 'projectName',
|
|
|
|
},
|
|
|
|
{
|
2025-07-04 17:56:14 +08:00
|
|
|
title: '单价(元)',
|
2025-06-23 09:27:28 +08:00
|
|
|
field: 'price',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '单位',
|
|
|
|
field: 'unit',
|
2025-07-05 17:47:26 +08:00
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
return renderDict(row.unit, 'pro_product_unit');
|
|
|
|
},
|
|
|
|
},
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '类型',
|
|
|
|
field: 'type',
|
2025-07-04 17:56:14 +08:00
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
return renderDict(row.type, 'value_added_type');
|
|
|
|
},
|
|
|
|
},
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '状态',
|
|
|
|
field: 'state',
|
2025-07-04 17:56:14 +08:00
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
return renderDict(row.state, 'product_management_status');
|
|
|
|
},
|
|
|
|
},
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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',
|
2025-07-04 17:56:14 +08:00
|
|
|
component: 'Input',
|
2025-06-23 09:27:28 +08:00
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '单价',
|
|
|
|
fieldName: 'price',
|
|
|
|
component: 'Input',
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '单位',
|
|
|
|
fieldName: 'unit',
|
2025-07-05 17:47:26 +08:00
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('pro_product_unit'),
|
|
|
|
},
|
|
|
|
rules: 'selectRequired',
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '类型',
|
|
|
|
fieldName: 'type',
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
2025-07-04 17:56:14 +08:00
|
|
|
options: getDictOptions('value_added_type'),
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
rules: 'selectRequired',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '状态',
|
|
|
|
fieldName: 'state',
|
2025-07-04 17:56:14 +08:00
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('product_management_status'),
|
|
|
|
},
|
|
|
|
rules: 'selectRequired',
|
2025-06-23 09:27:28 +08:00
|
|
|
},
|
|
|
|
];
|