| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { CommonStatusEnum, DICT_TYPE } from '#/packages/constants/src'; |
| | | import { getDictOptions } from '#/packages/effects/hooks/src'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | |
| | | /** 表æ
å
表å */ |
| | | export function usePackFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'icon', |
| | | label: 'å°é¢', |
| | | component: 'ImageUpload', |
| | | componentProps: { |
| | | maxNumber: 1, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | maxlength: 64, |
| | | placeholder: '请è¾å
¥è¡¨æ
å
åç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'sort', |
| | | label: 'æåº', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | min: 0, |
| | | max: 9999, |
| | | }, |
| | | rules: z.number().default(0), |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |
| | | buttonStyle: 'solid', |
| | | optionType: 'button', |
| | | }, |
| | | rules: z.number().default(CommonStatusEnum.ENABLE), |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 表æ
å
æç´¢è¡¨å */ |
| | | export function usePackGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'name', |
| | | label: '表æ
å
', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥è¡¨æ
å
åç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |
| | | placeholder: 'è¯·éæ©ç¶æ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'createTime', |
| | | label: 'å建æ¶é´', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 表æ
å
åæ®µ */ |
| | | export function usePackGridColumns(): VxeTableGridOptions['columns'] { |
| | | return [ |
| | | { type: 'checkbox', width: 40 }, |
| | | { |
| | | field: 'id', |
| | | title: 'ç¼å·', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'icon', |
| | | title: 'å°é¢', |
| | | width: 80, |
| | | slots: { default: 'icon' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'åç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'sort', |
| | | title: 'æåº', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.COMMON_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'å建æ¶é´', |
| | | minWidth: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 表æ
表å */ |
| | | export function useItemFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'packId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'url', |
| | | label: '表æ
å¾', |
| | | component: 'ImageUpload', |
| | | componentProps: { |
| | | maxNumber: 1, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '表æ
å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | maxlength: 64, |
| | | placeholder: '请è¾å
¥è¡¨æ
å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'width', |
| | | label: '宽度', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | min: 1, |
| | | max: 2048, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'height', |
| | | label: 'é«åº¦', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | min: 1, |
| | | max: 2048, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'sort', |
| | | label: 'æåº', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | min: 0, |
| | | max: 9999, |
| | | }, |
| | | rules: z.number().default(0), |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |
| | | buttonStyle: 'solid', |
| | | optionType: 'button', |
| | | }, |
| | | rules: z.number().default(CommonStatusEnum.ENABLE), |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 表æ
æç´¢è¡¨å */ |
| | | export function useItemGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'name', |
| | | label: '表æ
å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥è¡¨æ
å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |
| | | placeholder: 'è¯·éæ©ç¶æ', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 表æ
åæ®µ */ |
| | | export function useItemGridColumns(): VxeTableGridOptions['columns'] { |
| | | return [ |
| | | { type: 'checkbox', width: 40 }, |
| | | { |
| | | field: 'id', |
| | | title: 'ç¼å·', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'url', |
| | | title: '表æ
å¾', |
| | | width: 80, |
| | | slots: { default: 'image' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: '表æ
å', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | title: '尺寸', |
| | | width: 120, |
| | | slots: { default: 'size' }, |
| | | }, |
| | | { |
| | | field: 'sort', |
| | | title: 'æåº', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.COMMON_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** ç¨æ·è¡¨æ
æç´¢è¡¨å */ |
| | | export function useUserItemGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'userId', |
| | | label: 'ç¨æ·ç¼å·', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ç¨æ·ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '表æ
å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥è¡¨æ
å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'createTime', |
| | | label: 'æ·»å æ¶é´', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** ç¨æ·è¡¨æ
åæ®µ */ |
| | | export function useUserItemGridColumns(): VxeTableGridOptions['columns'] { |
| | | return [ |
| | | { |
| | | field: 'id', |
| | | title: 'ç¼å·', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'url', |
| | | title: '表æ
å¾', |
| | | width: 80, |
| | | slots: { default: 'image' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: '表æ
å', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | title: 'æå±ç¨æ·', |
| | | minWidth: 180, |
| | | slots: { default: 'user' }, |
| | | }, |
| | | { |
| | | title: '尺寸', |
| | | width: 120, |
| | | slots: { default: 'size' }, |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'æ·»å æ¶é´', |
| | | minWidth: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 100, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |