import type { OnActionClickFn, VbenFormSchema, VxeTableGridOptions, } from '#/adapter'; import type { BasicOptionResult } from '#/api/model'; import type { SpecApi } from '#/api/shop'; import { h } from 'vue'; export const paramsTypeOptions: BasicOptionResult[] = [ { label: '文本框', value: 0, color: 'success' }, { label: '复选框', value: 1, color: 'error' }, { label: '单选框', value: 2, color: 'warning' }, ]; export const useSearchSchema = (): VbenFormSchema[] => { return [ { component: 'Input', fieldName: 'name', label: '名称', }, ]; }; export function useColumns( onActionClick?: OnActionClickFn, ): VxeTableGridOptions['columns'] { return [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', field: 'name', title: '名称', width: 82, }, { align: 'left', field: 'specDetails', title: '规格值', slots: { default: 'specDetails' }, }, { field: 'sort', title: '排序', width: 82, }, { align: 'right', cellRender: { attrs: { nameField: 'name', nameTitle: '名称', onClick: onActionClick, }, name: 'CellAction', options: [ { code: 'edit', auth: ['spec:edit'], }, { code: 'delete', auth: ['spec:delete'], }, ], }, field: 'operation', fixed: 'right', headerAlign: 'center', showOverflow: false, title: '操作', width: 100, }, ]; } export const useSchema = (): VbenFormSchema[] => { return [ { component: 'Input', componentProps: { placeholder: '请输入', }, fieldName: 'name', label: '名称', rules: 'required', }, { component: 'InputNumber', componentProps: { placeholder: '请输入排序', }, fieldName: 'sort', label: '排序', rules: 'required', }, { component: h('div', { class: 'text-sm font-thin' }, [ h( 'div', null, 'SKU模型值只支持:中文、英文、数字、中文输入大写符号、英文小写二个符号(-、/)', ), ]), formItemClass: 'items-start', fieldName: 'remark', label: '说明', }, { component: 'Input', componentProps: { placeholder: '请输入', }, fieldName: 'specDetails', label: '规格值', }, ]; };