| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import { BasicColumn, FormSchema } from '/@/components/Table';
- import { listDictModel } from '/@/api/common';
- import { validateStr } from '/@/utils/validate';
- export const columns: BasicColumn[] = [
- {
- title: '字典名称',
- dataIndex: 'dictName',
- },
- {
- title: '字典编码',
- dataIndex: 'dictCode',
- },
- {
- title: '字典类型',
- dataIndex: 'dictType',
- },
- {
- title: '状态',
- dataIndex: 'disable',
- width: 80,
- },
- {
- title: '备注',
- dataIndex: 'remark',
- },
- ];
- export const searchFormSchema: FormSchema[] = [
- {
- field: 'dictName',
- label: '字典名称',
- component: 'Input',
- componentProps: {
- placeholder: '请输入字典名称',
- },
- },
- {
- field: 'dictCode',
- label: '字典编码',
- component: 'Input',
- componentProps: {
- placeholder: '请输入字典编码',
- },
- },
- {
- field: 'dictType',
- label: '字典类型',
- component: 'ApiSelect',
- componentProps: {
- api: listDictModel,
- params: {
- dictCode: 'sys_dict_type',
- },
- },
- defaultValue: '0',
- ifShow: false,
- },
- ];
- export const dataFormSchema: FormSchema[] = [
- {
- field: 'dictName',
- label: '字典名称',
- component: 'Input',
- required: true,
- componentProps: {
- placeholder: '请输入字典名称',
- },
- },
- {
- field: 'dictCode',
- label: '字典编码',
- component: 'Input',
- required: true,
- componentProps: {
- placeholder: '请输入字典编码',
- },
- dynamicRules: () => {
- return [
- {
- required: true,
- validator: async (_, value) => {
- if (!value) {
- return Promise.reject('字典项编码不能为空');
- }
- if (validateStr(value)) {
- return Promise.reject('字典项编码为字母或数字组成');
- }
- return Promise.resolve();
- },
- },
- ];
- },
- },
- {
- field: 'dictType',
- label: '字典类型',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: listDictModel,
- params: {
- dictCode: 'sys_dict_type',
- },
- },
- },
- {
- field: 'disable',
- label: '状态',
- component: 'ApiRadioGroup',
- required: true,
- componentProps: {
- api: listDictModel,
- params: {
- dictCode: 'sys_disable_type',
- },
- },
- defaultValue: '0',
- },
- {
- label: '备注',
- field: 'remark',
- component: 'InputTextArea',
- componentProps: {
- placeholder: '请输入备注',
- },
- },
- ];
|