¶Ô±ÈÐÂÎļþ |
| | |
| | | import { BasicColumn } from '/@/components/Table'; |
| | | import { FormSchema } from '/@/components/Table'; |
| | | import { dictItemCheck } from './dict.api'; |
| | | import { rules } from '/@/utils/helper/validator'; |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | | title: 'åå
¸åç§°', |
| | | dataIndex: 'dictName', |
| | | width: 240, |
| | | }, |
| | | { |
| | | title: 'åå
¸ç¼ç ', |
| | | dataIndex: 'dictCode', |
| | | width: 240, |
| | | }, |
| | | { |
| | | title: 'æè¿°', |
| | | dataIndex: 'description', |
| | | // width: 120 |
| | | }, |
| | | ]; |
| | | |
| | | export const recycleBincolumns: BasicColumn[] = [ |
| | | { |
| | | title: 'åå
¸åç§°', |
| | | dataIndex: 'dictName', |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: 'åå
¸ç¼ç ', |
| | | dataIndex: 'dictCode', |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: 'æè¿°', |
| | | dataIndex: 'description', |
| | | width: 120, |
| | | }, |
| | | ]; |
| | | |
| | | export const searchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: 'åå
¸åç§°', |
| | | field: 'dictName', |
| | | component: 'Input', |
| | | colProps: { span: 6 }, |
| | | }, |
| | | { |
| | | label: 'åå
¸ç¼ç ', |
| | | field: 'dictCode', |
| | | component: 'Input', |
| | | colProps: { span: 6 }, |
| | | }, |
| | | ]; |
| | | |
| | | export const formSchema: FormSchema[] = [ |
| | | { |
| | | label: '', |
| | | field: 'id', |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | label: 'åå
¸åç§°', |
| | | field: 'dictName', |
| | | required: true, |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'åå
¸ç¼ç ', |
| | | field: 'dictCode', |
| | | component: 'Input', |
| | | dynamicDisabled: ({ values }) => { |
| | | return !!values.id; |
| | | }, |
| | | dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_dict', 'dict_code', model, schema, true), |
| | | }, |
| | | { |
| | | label: 'æè¿°', |
| | | field: 'description', |
| | | component: 'Input', |
| | | }, |
| | | ]; |
| | | |
| | | export const dictItemColumns: BasicColumn[] = [ |
| | | { |
| | | title: 'åç§°', |
| | | dataIndex: 'itemText', |
| | | width: 80, |
| | | }, |
| | | { |
| | | title: 'æ°æ®å¼', |
| | | dataIndex: 'itemValue', |
| | | width: 80, |
| | | }, |
| | | ]; |
| | | |
| | | export const dictItemSearchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: 'åç§°', |
| | | field: 'itemText', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'ç¶æ', |
| | | field: 'status', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | dictCode: 'dict_item_status', |
| | | stringToNumber: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | |
| | | export const itemFormSchema: FormSchema[] = [ |
| | | { |
| | | label: '', |
| | | field: 'id', |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | label: 'åç§°', |
| | | field: 'itemText', |
| | | required: true, |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'æ°æ®å¼', |
| | | field: 'itemValue', |
| | | component: 'Input', |
| | | dynamicRules: ({ values, model }) => { |
| | | return [ |
| | | { |
| | | required: true, |
| | | validator: (_, value) => { |
| | | if (!value) { |
| | | return Promise.reject('请è¾å
¥æ°æ®å¼'); |
| | | } |
| | | if (new RegExp("[`~!@#$^&*()=|{}'<>ãã/?ï¼ï¿¥ï¼ï¼âããâï¼ï¼ââãï¼ãï¼]").test(value)) { |
| | | return Promise.reject('æ°æ®å¼ä¸è½å
å«ç¹æ®å符ï¼'); |
| | | } |
| | | return new Promise<void>((resolve, reject) => { |
| | | let params = { |
| | | dictId: values.dictId, |
| | | id: model.id, |
| | | itemValue: value, |
| | | }; |
| | | dictItemCheck(params) |
| | | .then((res) => { |
| | | res.success ? resolve() : reject(res.message || 'æ ¡éªå¤±è´¥'); |
| | | }) |
| | | .catch((err) => { |
| | | reject(err.message || 'éªè¯å¤±è´¥'); |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æè¿°', |
| | | field: 'description', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | field: 'sortOrder', |
| | | label: 'æåº', |
| | | component: 'InputNumber', |
| | | defaultValue: 1, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | label: 'æ¯å¦å¯ç¨', |
| | | defaultValue: 1, |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | type: 'radioButton', |
| | | dictCode: 'dict_item_status', |
| | | stringToNumber: true, |
| | | }, |
| | | }, |
| | | ]; |