| | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, subtype, columns, id) { |
| | | export default function (wrap, subtype, columns = [], id = '', supNodes = [], setting) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let MenuType = '' |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | } |
| | | let modules = [] |
| | | if (subtype === 'propcard') { |
| | | if (subtype === 'propcard' || subtype === 'datacard') { |
| | | modules = MenuUtils.getSupModules(menu.components, id) || [] |
| | | } |
| | | |
| | |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let menulist = [] |
| | | |
| | | if (appType === 'mob') { |
| | | menulist = sessionStorage.getItem('appMenus') |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch (e) { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | } |
| | | |
| | | const cardWrapForm = [ |
| | |
| | | tooltip: '选择静态值,无需配置数据源。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'dynamic', label: '动态'}, |
| | | {value: 'static', label: '静态'}, |
| | | {value: 'dynamic', label: '动态', priKeyType: 'static'}, |
| | | {value: 'static', label: '静态', priKeyType: 'static'}, |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | | {field: 'goback', values: ['dynamic']}, |
| | | {field: 'empty', values: ['dynamic']}, |
| | | {field: 'jump', values: ['dynamic']}, |
| | | {field: 'supModule', values: ['static']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'layout', |
| | | label: '卡片布局', |
| | | initval: wrap.layout || 'grid', |
| | | tooltip: appType === 'mob' ? '弹性布局时,滑动加载无效' : '弹性布局时,左右切换无效', |
| | | required: false, |
| | | options: [ |
| | | {value: 'grid', label: '栅格布局'}, |
| | | {value: 'flex', label: '弹性布局'}, |
| | | ], |
| | | controlFields: subtype !== 'propcard' ? [ |
| | | {field: 'printHeight', values: ['flex']}, |
| | | {field: 'cardFloat', values: ['grid']}, |
| | | ] : [{field: 'cardFloat', values: ['grid']}], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | initval: wrap.pagestyle || 'page', |
| | | tooltip: '数据源选择分页时有效。注:滑动加载只有第一个有效', |
| | | required: false, |
| | | disabled: !laypage, |
| | | options: [ |
| | | {value: 'page', label: '页码'}, |
| | | {value: 'switch', label: '左右切换', forbid: appType === 'mob'}, |
| | | {value: 'slide', label: '滑动加载', forbid: appType !== 'mob'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'slidetip', values: ['slide']}, |
| | | ], |
| | | forbid: !(subtype === 'datacard' || (subtype === 'tablecard' && appType === 'mob')) |
| | | }, |
| | |
| | | {field: 'checkAll', values: ['checkbox']}, |
| | | {field: 'selected', values: ['radio', 'checkbox']}, |
| | | {field: 'selStyle', values: ['radio', 'checkbox']}, |
| | | // {field: 'priKeyType', values: ['radio', 'checkbox']}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'priKeyType', |
| | | label: '主键', |
| | | initval: wrap.priKeyType || 'static', |
| | | tooltip: '拼接值为动态主键与用户自定义的静态主键使用逗号拼接。', |
| | | required: false, |
| | | linkField: 'datatype', |
| | | options: [ |
| | | {ParentID: 'static', value: 'static', label: '静态值'}, |
| | | {ParentID: 'dynamic', value: 'static', label: '静态值'}, |
| | | {ParentID: 'dynamic', value: 'dynamic', label: '动态值'}, |
| | | {ParentID: 'dynamic', value: 'joint', label: '拼接值'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'selected', |
| | | label: '首行选中', |
| | | initval: wrap.selected || 'false', |
| | | tooltip: '当按钮执行完成并返回主键值时,默认选中主键值对应行。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'init', label: '初始化'}, |
| | | {value: 'always', label: '数据加载', disabled: subtype === 'propcard'}, |
| | | ] |
| | | {value: 'always', label: '数据加载'}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'supType', |
| | | label: '上级类型', |
| | | initval: wrap.supType || 'single', |
| | | tooltip: '上级组件为单一组件或多个组件。', |
| | | required: false, |
| | | forbid: subtype !== 'datacard' || appType === 'mob', |
| | | options: [ |
| | | {value: 'single', label: '单组件'}, |
| | | {value: 'multi', label: '多组件'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: subtype === 'propcard' ? 'select' : 'radio', |
| | | type: 'select', |
| | | field: 'selStyle', |
| | | label: '选中风格', |
| | | initval: wrap.selStyle || 'active', |
| | | tooltip: '存在边框时,边框会使用系统色。', |
| | | required: false, |
| | | options: subtype === 'propcard' ? [ |
| | | options: [ |
| | | {value: 'none', label: '无'}, |
| | | {value: 'active', label: '外阴影'}, |
| | | {value: 'backFont', label: '背景+文字'}, |
| | | {value: 'font', label: '文字'}, |
| | | ] : [ |
| | | {value: 'none', label: '无'}, |
| | | {value: 'active', label: '外阴影'}, |
| | | ] |
| | | // forbid: subtype !== 'propcard' |
| | | {value: 'tabs', label: '标签页'}, |
| | | ...(subtype === 'datacard' && appType === 'mob' ? [{value: 'check', label: '勾选'}] : []) |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | |
| | | field: 'cardFloat', |
| | | label: '对齐方式', |
| | | initval: wrap.cardFloat || 'left', |
| | | tooltip: '设置为居中对齐或右对齐,只在卡片为1行时有效。', |
| | | tooltip: '设置卡片的对齐方式。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'left', label: '左对齐'}, |
| | |
| | | {value: 'content', label: '内容'}, |
| | | {value: 'headerOrfooter', label: '页眉/页脚'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'printHeight', values: ['content']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || MenuType !== 'billPrint' |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'printHeight', |
| | | label: '换算高度', |
| | | initval: wrap.printHeight || '', |
| | | tooltip: subtype !== 'propcard' ? '当前数据卡高度相当于几条数据。' : '当前属性卡高度相当于几条数据。', |
| | | required: false, |
| | | forbid: subtype === 'tablecard' || MenuType !== 'billPrint' |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | tooltip: '语音播报在移动端app中有效。注:使用语音播报时,数据源不要使用同步查询,添加定时器时,可循环播报', |
| | | required: false, |
| | | options: columns, |
| | | forbid: !columns || appType !== 'mob' |
| | | forbid: !columns || appType !== 'mob' || subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'empty', |
| | | label: '空值隐藏', |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'jump', |
| | | label: '页面跳转', |
| | | initval: wrap.jump || '', |
| | | tooltip: '通过查询返回值判断页面是否要跳转。', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '无'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'link', label: '链接'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'jumpField', values: ['menu', 'link']}, |
| | | {field: 'joint', values: ['menu', 'link']}, |
| | | {field: 'menu', values: ['menu']}, |
| | | {field: 'link', values: ['link']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'jumpField', |
| | | label: '控制字段', |
| | | initval: wrap.jumpField || '', |
| | | tooltip: '当字段值为true时', |
| | | required: true, |
| | | options: columns, |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'menu', |
| | | label: '菜单', |
| | | initval: wrap.menu || '', |
| | | required: true, |
| | | options: menulist, |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'link', |
| | | label: '链接字段', |
| | | initval: wrap.link || '', |
| | | tooltip: '跳转链接为查询数据的返回值。', |
| | | required: true, |
| | | options: columns, |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'joint', |
| | | label: '参数拼接', |
| | | initval: wrap.joint || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'supKey', |
| | | label: '上级主键', |
| | | initval: wrap.supKey || 'true', |
| | | tooltip: '当设置上级组件时,上级主键值为空是否进行数据查询。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '验证'}, |
| | | {value: 'false', label: '忽略'}, |
| | | ], |
| | | forbid: subtype !== 'datacard' |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | field: 'supModule', |
| | | label: '上级组件', |
| | |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'controlField', |
| | | label: '禁用字段', |
| | | initval: wrap.controlField || '', |
| | | tooltip: '用于控制行数据是否可选择。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: columns, |
| | | controlFields: [ |
| | | {field: 'controlVal', notNull: true}, |
| | | ], |
| | | forbid: subtype !== 'datacard' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'controlVal', |
| | | label: '禁用值', |
| | | initval: wrap.controlVal || '', |
| | | tooltip: '当字段值与禁用值相等时,行数据会禁用,多个值用逗号分隔。', |
| | | required: false, |
| | | forbid: subtype !== 'datacard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'supType', |
| | | label: '上级类型', |
| | | initval: wrap.supType || 'single', |
| | | tooltip: '上级组件为单一组件或多个组件。', |
| | | required: false, |
| | | forbid: subtype !== 'datacard' || appType === 'mob', |
| | | options: [ |
| | | {value: 'single', label: '单组件'}, |
| | | {value: 'multi', label: '多组件'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'supNodes', values: ['multi']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | |
| | | options: roleList, |
| | | forbid: !!appType |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'slidetip', |
| | | label: '底部提示', |
| | | initval: wrap.slidetip || wrap.slidetip === '' ? wrap.slidetip : '没有更多了', |
| | | tooltip: '滑动加载至底部时的提示信息。', |
| | | required: false, |
| | | forbid: !laypage || appType !== 'mob' || subtype === 'propcard' |
| | | }, |
| | | { |
| | | type: 'table', |
| | | field: 'supNodes', |
| | | label: '上级组件', |
| | | initval: supNodes, |
| | | required: true, |
| | | forbid: subtype !== 'datacard' || appType === 'mob', |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | | title: '序号', |
| | | dataIndex: '$index', |
| | | editable: false, |
| | | required: false, |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '菜单', |
| | | dataIndex: 'nodes', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | required: true, |
| | | extends: [{key: 'label', value: 'label'}], |
| | | width: '50%', |
| | | render: (text, record) => record.label, |
| | | options: modules |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | |
| | | return cardWrapForm.map(item => { |
| | | return cardWrapForm.filter(item => { |
| | | if (['pagestyle'].includes(item.field)) { |
| | | item.options = item.options.filter(option => !option.forbid) |
| | | } |
| | | |
| | | return item |
| | | return !item.forbid |
| | | }) |
| | | } |