| | |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import MenuUtils, { getInterfaces } from '@/utils/utils-custom.js' |
| | | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, subtype, columns = [], id = '', supNodes = [], setting, buttons = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let MenuType = '' |
| | | let isprint = sessionStorage.getItem('MenuType') === 'billPrint' |
| | | let ispop = sessionStorage.getItem('editMenuType') === 'popview' |
| | | let menu = window.GLOB.customMenu |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | let interfaces = [] |
| | | if (subtype === 'propcard' && menu.interfaces) { |
| | | menu.interfaces.forEach(item => { |
| | | if (item.status === 'true') { |
| | | interfaces.push({ |
| | | value: item.uuid, |
| | | label: item.name |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | let interfaces = [] |
| | | if (subtype === 'propcard') { |
| | | interfaces = getInterfaces() |
| | | } |
| | | let modules = [] |
| | | if (subtype === 'propcard' || subtype === 'datacard') { |
| | |
| | | } |
| | | } |
| | | |
| | | let interaction = [] |
| | | let interOptions = [] |
| | | |
| | | if (wrap.scale === 'true') { |
| | | interaction.push('scale') |
| | | } |
| | | if (wrap.parity === 'true') { |
| | | interaction.push('parity') |
| | | } |
| | | if (wrap.hover === 'true') { |
| | | interaction.push('hover') |
| | | } |
| | | |
| | | if (subtype === 'datacard') { |
| | | interOptions = [ |
| | | {value: 'parity', label: '奇偶异色'}, |
| | | ] |
| | | if (appType !== 'mob') { |
| | | interOptions.push( |
| | | {value: 'hover', label: '悬浮变色'}, |
| | | {value: 'scale', label: '悬浮放大'} |
| | | ) |
| | | } |
| | | } else if (subtype === 'propcard' && appType !== 'mob') { |
| | | interOptions = [ |
| | | {value: 'scale', label: '悬浮放大'} |
| | | ] |
| | | } else if (subtype === 'tablecard') { |
| | | interOptions = [ |
| | | {value: 'parity', label: '奇偶异色'}, |
| | | ] |
| | | if (appType !== 'mob') { |
| | | interOptions.push( |
| | | {value: 'hover', label: '悬浮变色'} |
| | | ) |
| | | } |
| | | } |
| | | |
| | | if (interaction.length && interOptions.length) { |
| | | interaction = interaction.filter(m => interOptions.findIndex(cell => cell.value === m) > -1) |
| | | } |
| | | |
| | | // let interItem = null |
| | | |
| | | // if (interOptions.length === 1) { |
| | | // interItem = { |
| | | // type: 'radio', |
| | | // field: interOptions[0].value, |
| | | // label: interOptions[0].label, |
| | | // initval: interaction.length === 1 ? 'true' : 'false', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'true', label: '启用'}, |
| | | // {value: 'false', label: '禁用'} |
| | | // ] |
| | | // } |
| | | // } else { |
| | | // interItem = { |
| | | // type: 'checkbox', |
| | | // field: 'interaction', |
| | | // label: '交互效果', |
| | | // initval: interaction, |
| | | // required: false, |
| | | // options: interOptions, |
| | | // forbid: interOptions.length === 0 |
| | | // } |
| | | // } |
| | | |
| | | const cardWrapForm = [ |
| | | { |
| | | type: 'text', |
| | |
| | | field: 'datatype', |
| | | label: '数据来源', |
| | | initval: wrap.datatype || 'dynamic', |
| | | tooltip: '选择静态值,无需配置数据源。', |
| | | tooltip: '选择静态时,无需配置数据源,可展示上级组件或url参数字段。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'dynamic', label: '动态', priKeyType: 'static'}, |
| | |
| | | {value: 'public', label: '公共数据源', priKeyType: 'static'}, |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | | controlFields: subtype === 'propcard' ? [ |
| | | {field: 'goback', values: ['dynamic', 'public']}, |
| | | {field: 'empty', values: ['dynamic', 'public']}, |
| | | {field: 'jump', values: ['dynamic', 'public']}, |
| | | {field: 'broadcast', values: ['dynamic', 'public']}, |
| | | {field: 'supModule', values: ['static']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | ], |
| | | {field: 'emptyExec', values: ['dynamic', 'public']}, |
| | | ] : null, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | |
| | | options: interfaces, |
| | | reset_source: true, |
| | | forbid: subtype !== 'propcard', |
| | | callback: (map, record) => { |
| | | callback: (record) => { |
| | | if (!record.publicId) return |
| | | |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0] |
| | | let d = interfaces.filter(m => m.value === record.publicId)[0] |
| | | |
| | | if (!d || !d.columns) return |
| | | let columns = JSON.parse(JSON.stringify(d.columns)) |
| | | |
| | | let _broadcast = map.get('broadcast') |
| | | |
| | | if (_broadcast && !_broadcast.forbid) { |
| | | _broadcast.options = columns |
| | | _broadcast.oriOptions = columns |
| | | map.set('broadcast', _broadcast) |
| | | } |
| | | |
| | | let _jumpField = map.get('jumpField') |
| | | |
| | | if (_jumpField && !_jumpField.forbid) { |
| | | _jumpField.options = columns |
| | | _jumpField.oriOptions = columns |
| | | map.set('jumpField', _jumpField) |
| | | } |
| | | |
| | | let _link = map.get('link') |
| | | |
| | | if (_link && !_link.forbid) { |
| | | _link.options = columns |
| | | _link.oriOptions = columns |
| | | map.set('link', _link) |
| | | return { |
| | | broadcast: d.columns, |
| | | jumpField: d.columns, |
| | | link: d.columns |
| | | } |
| | | } |
| | | }, |
| | |
| | | controlFields: subtype !== 'propcard' ? [ |
| | | {field: 'printHeight', values: ['flex']}, |
| | | {field: 'cardFloat', values: ['grid']}, |
| | | {field: 'zHeight', values: ['grid']}, |
| | | ] : [{field: 'cardFloat', values: ['grid']}], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'zHeight', |
| | | label: '最大高度', |
| | | initval: wrap.zHeight || '', |
| | | tooltip: '卡片内容区的最大高度(不包含标题、翻页等元素),添加高度后组件中第一个属性卡将固定于头部。注:小于等于100大于0时为高度的百分比,小于0时为窗口高度减去此值。', |
| | | min: -1000, |
| | | max: 3000, |
| | | precision: 0, |
| | | required: false, |
| | | forbid: subtype !== 'datacard' || appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | options: [ |
| | | {value: 'page', label: '页码'}, |
| | | {value: 'switch', label: '左右切换', forbid: appType === 'mob' || subtype === 'tablecard'}, |
| | | {value: 'slide', label: '滑动加载', forbid: appType !== 'mob' || sessionStorage.getItem('editMenuType') === 'popview'}, |
| | | {value: 'slide', label: '滑动加载', forbid: appType !== 'mob' || ispop}, |
| | | {value: 'more', label: '查看更多'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'slidetip', values: ['slide']}, |
| | | {field: 'maxPageSize', values: ['page']}, |
| | | ], |
| | | forbid: subtype === 'propcard' |
| | | }, |
| | |
| | | {field: 'checkAll', values: ['checkbox']}, |
| | | {field: 'selected', values: ['radio', 'checkbox']}, |
| | | {field: 'selStyle', values: ['radio', 'checkbox']}, |
| | | // {field: 'priKeyType', values: ['radio', 'checkbox']}, |
| | | {field: 'pickup', values: ['radio', 'checkbox']}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | |
| | | 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: '拼接值'}, |
| | | {ParentID: 'public', value: 'static', label: '静态值'}, |
| | | {ParentID: 'public', value: 'dynamic', label: '动态值'}, |
| | | {ParentID: '', value: 'static', label: '静态值'}, |
| | | {ParentID: 'dynamic', value: 'joint', label: '拼接值'}, |
| | | {ParentID: 'public', value: 'joint', label: '拼接值'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | |
| | | type: 'select', |
| | | field: 'selStyle', |
| | | label: '选中风格', |
| | | initval: wrap.selStyle || 'active', |
| | | initval: wrap.selStyle || 'none', |
| | | tooltip: '存在边框时,边框会使用系统色。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'none', label: '无'}, |
| | | {value: 'active', label: '外阴影'}, |
| | | {value: 'backFont', label: '背景+文字'}, |
| | | {value: 'backFont', label: '背景(浅)+文字(深)'}, |
| | | {value: 'deepBackFont', label: '背景(深)+文字(浅)'}, |
| | | {value: 'font', label: '文字'}, |
| | | {value: 'tabs', label: '标签页'}, |
| | | ...(subtype === 'datacard' ? [ |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'scale', |
| | | label: '放大效果', |
| | | initval: wrap.scale || 'false', |
| | | tooltip: '鼠标悬浮于卡片上方时,卡片放大1.05倍。', |
| | | field: 'pickup', |
| | | label: '收起开关', |
| | | initval: wrap.pickup || 'false', |
| | | tooltip: '数据卡右上角会显示收起开关。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: subtype === 'tablecard' || appType === 'mob' |
| | | forbid: subtype !== 'datacard' || appType === 'mob' |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'scale', |
| | | // label: '放大效果', |
| | | // initval: wrap.scale || 'false', |
| | | // tooltip: '鼠标悬浮于卡片上方时,卡片放大1.05倍。', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'false', label: '无'}, |
| | | // {value: 'true', label: '有'}, |
| | | // ], |
| | | // forbid: subtype === 'tablecard' || appType === 'mob' |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'parity', |
| | | label: '奇偶背景', |
| | | initval: wrap.parity || 'false', |
| | | tooltip: '偶数行会添加背景色。', |
| | | type: 'checkbox', |
| | | field: 'interaction', |
| | | label: '交互效果', |
| | | initval: interaction, |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: subtype === 'propcard' |
| | | options: interOptions, |
| | | forbid: interOptions.length === 0 |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | controlFields: [ |
| | | {field: 'printHeight', values: ['content']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || MenuType !== 'billPrint' |
| | | forbid: subtype !== 'propcard' || !isprint |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | initval: wrap.printHeight || '', |
| | | tooltip: subtype !== 'propcard' ? '当前数据卡高度相当于几条数据。' : '当前属性卡高度相当于几条数据。', |
| | | required: false, |
| | | forbid: subtype === 'tablecard' || MenuType !== 'billPrint' |
| | | forbid: subtype === 'tablecard' || !isprint |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: '语音播报', |
| | | initval: wrap.broadcast || '', |
| | | tooltip: '语音播报在移动端有效。注:在H5中请使用音频链接,添加定时器时,可循环播报', |
| | | timestamp: new Date().getTime(), |
| | | required: false, |
| | | options: columns, |
| | | forbid: !columns || appType !== 'mob' || subtype !== 'propcard' |
| | |
| | | {value: 'normal', label: '正常显示'}, |
| | | {value: 'hidden', label: '不可见'}, |
| | | ], |
| | | controlFields: [ |
| | | controlFields: subtype === 'propcard' ? [ |
| | | {field: 'empty', values: ['normal']}, |
| | | ], |
| | | ] : null, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'empSign', values: ['show']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'empSign', |
| | | label: '空值图标', |
| | | initval: wrap.empSign || 'show', |
| | | tooltip: '当查询数据为空时,是否显示空值提示图标。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'show', label: '显示'}, |
| | | {value: 'hidden', label: '隐藏'}, |
| | | ], |
| | | forbid: subtype === 'propcard' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'autoExec', |
| | | label: '自动执行', |
| | | initval: wrap.autoExec || '', |
| | | tooltip: '数据更新时自动执行按钮。注:此按钮执行成功后谨慎选择刷新项,避免造成循环执行。', |
| | | tooltip: subtype === 'propcard' ? '数据更新时自动执行按钮。注:此按钮执行成功后谨慎选择刷新项,避免造成循环执行。' : '初始化自动执行按钮。', |
| | | required: false, |
| | | options: buttons, |
| | | forbid: subtype !== 'propcard' && subtype !== 'datacard', |
| | | controlFields: [ |
| | | {field: 'emptyExec', notNull: true}, |
| | | {field: 'execDelay', notNull: true}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'execDelay', |
| | | label: '执行延时', |
| | | initval: wrap.execDelay, |
| | | tooltip: '自动执行按钮的延时执行时间,单位毫秒。', |
| | | required: false, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'emptyExec', |
| | | label: '空值执行', |
| | | initval: wrap.emptyExec || 'true', |
| | | tooltip: '当查询数据为空时,自动执行按钮是否执行。', |
| | | required: false, |
| | | forbid: subtype !== 'propcard', |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | ], |
| | | controlFields: [ |
| | | {field: 'jumpField', values: ['menu', 'link']}, |
| | | {field: 'joint', values: ['menu', 'link']}, |
| | | {field: 'open', values: ['menu', 'link']}, |
| | | {field: 'menu', values: ['menu']}, |
| | | {field: 'link', values: ['link']}, |
| | |
| | | label: '控制字段', |
| | | initval: wrap.jumpField || '', |
| | | tooltip: '当字段值为true时触发跳转。', |
| | | timestamp: new Date().getTime(), |
| | | required: true, |
| | | options: columns, |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | |
| | | label: '链接字段', |
| | | initval: wrap.link || '', |
| | | tooltip: '跳转链接为查询数据的返回值。', |
| | | timestamp: new Date().getTime(), |
| | | 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' |
| | | }, |
| | | { |
| | |
| | | {value: 'true', label: '验证'}, |
| | | {value: 'false', label: '忽略'}, |
| | | ], |
| | | forbid: subtype !== 'datacard' |
| | | forbid: subtype !== 'datacard' || isprint |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | |
| | | required: false, |
| | | options: modules, |
| | | allowClear: true, |
| | | forbid: subtype !== 'propcard' |
| | | forbid: subtype !== 'propcard' || isprint |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | tooltip: '用于控制行数据是否可选择。', |
| | | required: false, |
| | | allowClear: true, |
| | | joint: true, |
| | | options: columns, |
| | | controlFields: [ |
| | | {field: 'controlVal', notNull: true}, |
| | |
| | | initval: wrap.supType || 'single', |
| | | tooltip: '上级组件为单一组件或多个组件。', |
| | | required: false, |
| | | forbid: subtype !== 'datacard' || appType === 'mob', |
| | | forbid: subtype !== 'datacard' || appType === 'mob' || isprint, |
| | | options: [ |
| | | {value: 'single', label: '单组件'}, |
| | | {value: 'multi', label: '多组件'}, |
| | |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: !appType ? '继承菜单' : '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: ispop || isprint |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cacheLocal', |
| | | label: '本地缓存', |
| | | initval: wrap.cacheLocal || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '继承菜单'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: ispop || isprint |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cacheSearch', |
| | | label: '搜索缓存', |
| | | initval: wrap.cacheSearch || 'false', |
| | | tooltip: '启用搜索条件缓存后,在菜单刷新时搜索条件不变。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: !!appType || subtype === 'propcard' || isprint |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'searchBtn', |
| | | label: '搜索按钮', |
| | | initval: wrap.searchBtn || 'hidden', |
| | | required: false, |
| | | options: [ |
| | | {value: 'hidden', label: '隐藏'}, |
| | | {value: 'show', label: '显示'}, |
| | | ], |
| | | forbid: appType === 'mob' || subtype === 'propcard' || isprint, |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'shifting', |
| | | label: '按钮偏移', |
| | | initval: wrap.shifting || 'false', |
| | | tooltip: '启用时,工具栏按钮将显示在标题栏右上角。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !!appType || subtype !== 'datacard' || isprint |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'maxPageSize', |
| | | label: '每页最大数', |
| | | initval: wrap.maxPageSize || '', |
| | | tooltip: '分页时每页可显示的最大数量。', |
| | | min: 10, |
| | | max: 500, |
| | | precision: 0, |
| | | required: false, |
| | | forbid: !laypage || appType === 'mob' || subtype !== 'datacard' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | initval: wrap.blacklist || [], |
| | | required: false, |
| | | options: roleList, |
| | | forbid: !!appType |
| | | forbid: !!appType || isprint |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | label: '上级组件', |
| | | initval: supNodes, |
| | | required: true, |
| | | forbid: subtype !== 'datacard' || appType === 'mob', |
| | | forbid: subtype !== 'datacard' || appType === 'mob' || isprint, |
| | | span: 24, |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | columns: [ |
| | | { |
| | | title: '序号', |
| | |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '菜单', |
| | | title: '组件', |
| | | dataIndex: 'nodes', |
| | | inputType: 'cascader', |
| | | editable: true, |