123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- import { convertEnumArr } from "@/utils";
- import { ProFormColumnsType } from "@ant-design/pro-components";
- function formConfig(enumList?: any): ProFormColumnsType<{
- name: string;
- state: string;
- }>[] {
- let templateTypeEnum = enumList?.TEMPLATE_TYPE?.values || []
- let ORDER_TYPEEnum = enumList?.ORDER_TYPE?.values || []
- let COLOREnum = enumList?.COLOR?.values || []
- let VIP_DAYSEnum = enumList?.VIP_DAYS?.values || []
- return [
- {
- title: '模板名称',
- dataIndex: 'templateName',
- colProps:{
- span:24
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: '充值模板描述',
- dataIndex: 'templateDescription',
- valueType: 'textarea',
- },
- {
- title: '备注',
- dataIndex: 'remark',
- valueType: 'textarea',
- },
- {
- title: '首充档位',
- dataIndex: 'rechargeConfigList',
- valueType: 'formList',
- fieldProps: {
- min: 4,
- max: 6,
- creatorButtonProps: {
- creatorButtonText: "添加一个首充档位配置",
- },
- },
- colProps: {
- span: 24
- },
- columns: [
- {
- valueType: 'group',
- colProps: {
- span: 24
- },
- columns: [
- {
- title: '类型',
- dataIndex: 'gearType',
- valueType: 'select',
- width: "100%",
- initialValue:1,
- fieldProps: { placeholder: "请选择档位类型" },
- colProps: {
- span: 4
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- },
- valueEnum: new Map(ORDER_TYPEEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
- },
- {
- valueType: 'dependency',
- name: ['gearType'],
- columns: ({ gearType }) => {
- return [
- {
- title: '价格',
- dataIndex: 'price',
- valueType: 'money',
- width: "100%",
- hideInForm: gearType === 3,
- fieldProps: { placeholder: "输入价格" },
- colProps: {
- span: 5
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: '赠送',
- dataIndex: 'gift',
- valueType: 'digit',
- width: "100%",
- hideInForm: gearType !== 1,
- fieldProps: { placeholder: "输入赠送书币数" },
- colProps: {
- span: 5
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: 'vip天数',
- dataIndex: 'vipDays',
- valueType: 'select',
- width: "100%",
- hideInForm: gearType !== 2,
- fieldProps: { placeholder: "选择VIP天数" },
- colProps: {
- span: 4
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- },
- valueEnum: new Map(VIP_DAYSEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
- },
- {
- title: '价格',
- width: "100%",
- fieldProps: { placeholder: "价格在小说管理设置", disabled: true },
- hideInForm: gearType !== 3,
- colProps: {
- span: 5
- }
- },
- {
- title: '文案',
- dataIndex: 'description',
- width: "100%",
- fieldProps: { placeholder: "输入展示文案" },
- hideInForm: gearType !== 3,
- colProps: {
- span: 5
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: '角标',
- dataIndex: 'subscript',
- width: "100%",
- fieldProps: { placeholder: "右上角角标文案" },
- colProps: {
- span: 5
- }
- },
- {
- title: '底色',
- dataIndex: "color",
- valueType: "radioButton",
- width: "100%",
- initialValue: false,
- colProps: {
- span: 4
- },
- valueEnum: new Map(COLOREnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
- }
- ]
- }
- },
- ]
- }
- ]
- },
- {
- title: '非首充档位',
- dataIndex: 'rechargeConfigList1',
- valueType: 'formList',
- fieldProps: {
- min: 4,
- max: 6,
- creatorButtonProps: {
- creatorButtonText: "添加一个非首充档位配置",
- },
- },
- colProps: {
- span: 24
- },
- columns: [
- {
- valueType: 'group',
- colProps: {
- span: 24
- },
- columns: [
- {
- title: '类型',
- dataIndex: 'gearType',
- valueType: 'select',
- width: "100%",
- initialValue:1,
- fieldProps: { placeholder: "请选择档位类型" },
- colProps: {
- span: 4
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- },
- valueEnum: new Map(ORDER_TYPEEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
- },
- {
- valueType: 'dependency',
- name: ['gearType'],
- columns: ({ gearType }) => {
- return [
- {
- title: '价格',
- dataIndex: 'price',
- valueType: 'money',
- width: "100%",
- hideInForm: gearType === 3,
- fieldProps: { placeholder: "输入价格" },
- colProps: {
- span: 5
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: '赠送',
- dataIndex: 'gift',
- valueType: 'digit',
- width: "100%",
- hideInForm: gearType !== 1,
- fieldProps: { placeholder: "输入赠送书币数" },
- colProps: {
- span: 5
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: 'vip天数',
- dataIndex: 'vipDays',
- valueType: 'select',
- width: "100%",
- hideInForm: gearType !== 2,
- fieldProps: { placeholder: "选择VIP天数" },
- colProps: {
- span: 4
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- },
- valueEnum: new Map(VIP_DAYSEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
- },
- {
- title: '价格',
- width: "100%",
- fieldProps: { placeholder: "价格在小说管理设置", disabled: true },
- hideInForm: gearType !== 3,
- colProps: {
- span: 5
- }
- },
- {
- title: '文案',
- dataIndex: 'description',
- width: "100%",
- fieldProps: { placeholder: "输入展示文案" },
- hideInForm: gearType !== 3,
- colProps: {
- span: 5
- },
- formItemProps: {
- rules: [
- {
- required: true,
- message: '此项为必填项',
- },
- ],
- }
- },
- {
- title: '角标',
- dataIndex: 'subscript',
- width: "100%",
- fieldProps: { placeholder: "右上角角标文案" },
- colProps: {
- span: 5
- }
- },
- {
- title: '底色',
- dataIndex: "color",
- valueType: "radioButton",
- width: "100%",
- initialValue: false,
- colProps: {
- span: 4
- },
- valueEnum: new Map(COLOREnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
- }
- ]
- }
- },
- ]
- }
- ]
- },
- {
- title: '激活当前模板',
- dataIndex: 'activateTemplate',
- valueType: 'switch',
- formItemProps: { layout: 'horizontal' },
- colProps: { offset: 19 }
- },
- ]
- }
- export default formConfig
|