| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- 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<SpecApi.RecordItem>,
- ): VxeTableGridOptions<SpecApi.RecordItem>['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: '规格值',
- },
- ];
- };
|