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: 'orderNo', label: '订单号', }, { component: 'Input', fieldName: 'customerName', label: '客户名称', }, { component: 'Select', componentProps: { options: getDictOptions('wy_khlx') }, fieldName: 'customerType', label: '客户类型', }, { component: 'Select', componentProps: { options: getDictOptions('wy_zlfs') }, fieldName: 'rentalType', label: '租赁方式', }, { component: 'Select', componentProps: { options: getDictOptions('pro_charging_status') }, fieldName: 'paymentStatus', label: '支付状态', }, ]; export const columns: VxeGridProps['columns'] = [ {type: 'checkbox', width: 60}, { title: '订单号', field: 'orderNo', width: 100 }, { title: '客户名称', field: 'customerName', width: 100 }, { title: '客户类型', field: 'customerType', slots: { default: ({ row }) => { return renderDict(row.customerType, 'wy_khlx'); }, }, width: 100 }, { title: '租赁周期', field: 'rentalPeriod', slots: { default: ({ row }) => { return renderDict(row.rentalPeriod, 'wy_sjdw'); }, }, width: 100 }, { title: '租赁开始时间', field: 'startTime', width: 120 }, { title: '租赁结束时间', field: 'endTime', width: 120 }, { title: '应付总额', field: 'totalAmount', width: 100 }, { title: '租赁方式', field: 'rentalType', slots: { default: ({ row }) => { return renderDict(row.rentalType, 'wy_zlfs'); }, }, width: 100 }, { title: '租赁商品', field: 'planId', // slots: {default: 'planId'}, width: 100 }, { title: '支付状态', field: 'paymentStatus', slots: { default: ({ row }) => { return renderDict(row.paymentStatus, 'pro_charging_status'); }, }, width: 100 }, { title: '是否续租', field: 'isRelet', slots: { default: ({ row }) => { return renderDict(row.isRelet, 'wy_sf'); }, }, width: 100 }, { title: '合同状态', field: 'contractStatus', slots: { default: ({ row }) => { return renderDict(row.contractStatus, 'wy_htzt'); }, }, width: 100 }, { title: '签署时间', field: 'signTime', width: 100 }, { field: 'action', fixed: 'right', slots: {default: 'action'}, title: '操作', minWidth: 180, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: '主键', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '客户名称', fieldName: 'customerName', component: 'Input', rules: 'required', }, { label: '客户类型', fieldName: 'customerType', component: 'Select', componentProps: { options: getDictOptions('wy_khlx') }, rules: 'selectRequired', }, { label: '租赁周期', fieldName: 'rentalPeriod', component: 'Select', componentProps: { options: getDictOptions('wy_time_unit') }, rules: 'selectRequired', }, { label: '租赁时间', fieldName: 'rentalTime', component: 'RangePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', }, rules: 'selectRequired', }, { label: '租赁方式', fieldName: 'rentalType', component: 'Select', componentProps: { options: getDictOptions('wy_zlfs') }, rules: 'selectRequired', formItemClass: 'col-span-2' }, { label: '租赁方案', fieldName: 'planId', component: 'Select', dependencies: { // 仅当 租赁方式 为 2(套餐) 时显示 show: (formValues) => formValues.rentalType === '2', triggerFields: ['rentalType'], }, rules: 'selectRequired', formItemClass: 'col-span-2' }, { label: '方案详情', fieldName: 'planInfo', component: 'Input', dependencies: { // 仅当 租赁方式 为 2(套餐) 时显示 show: (formValues) => formValues.rentalType === '2' && formValues.planId != null, triggerFields: ['rentalType'], }, formItemClass: 'col-span-2' }, { label: '绿植产品', fieldName: 'productId', component: 'Select', dependencies: { // 仅当 租赁方式 为 1(单点) 时显示 show: (formValues) => formValues.rentalType === '1', triggerFields: ['rentalType'], }, rules: 'selectRequired', formItemClass: 'col-span-2' }, { label: '租赁数量', fieldName: 'productNum', component: 'InputNumber', componentProps: { min: 1, precision: 0, step: 1, placeholder:'租赁数量不可超出绿植产品库存数量' }, dependencies: { // 仅当 租赁方式 为 1(单点) 时显示 show: (formValues) => formValues.rentalType === '1', triggerFields: ['rentalType', 'productId'], }, rules: 'required', }, // { // label: '应付总额', // fieldName: 'totalAmount', // component: 'Input', // rules: 'required', // }, // { // label: '支付状态', // fieldName: 'paymentStatus', // component: 'Select', // componentProps: { // options: getDictOptions('pro_charging_status'), // }, // rules: 'selectRequired', // }, // { // label: '是否续租', // fieldName: 'isRelet', // component: 'RadioGroup', // componentProps: { // buttonStyle: 'solid', // optionType: 'button', // options: getDictOptions('wy_sf'), // }, // }, { label: '合同状态', fieldName: 'contractStatus', component: 'Select', componentProps: { options: getDictOptions('wy_htzt'), }, rules: 'selectRequired' }, { label: '合同编号', fieldName: 'contractCode', component: 'Input', dependencies: { show: (formValues) => formValues.contractStatus != null && formValues.contractStatus != 1, triggerFields: ['contractStatus'], }, rules: 'required' }, { label: '签署时间', fieldName: 'signTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', }, dependencies: { show: (formValues) => formValues.contractStatus != null && formValues.contractStatus != 1, triggerFields: ['contractStatus'], }, rules: 'required' }, ];