| | |
| | | import { fromJS } from 'immutable' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, subtype, columns = [], id = '', supNodes = []) { |
| | | export default function (wrap, subtype, columns = [], id = '', supNodes = [], setting, buttons = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let MenuType = '' |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | let MenuType = sessionStorage.getItem('MenuType') || 'custom' |
| | | 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 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | let modules = [] |
| | | if (subtype === 'propcard' || subtype === 'datacard') { |
| | | modules = MenuUtils.getSupModules(menu.components, id) || [] |
| | | modules = MenuUtils.getSupModules(menu.components, id, menu.interfaces) |
| | | |
| | | if (subtype === 'propcard' && wrap.supModule && wrap.supModule.length > 0 && wrap.supModule[0] !== 'empty') { |
| | | let has = MenuUtils.checkSupModules(modules, wrap.supModule.slice(-1)[0]) |
| | | if (!has) { |
| | | wrap.supModule = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | |
| | | } |
| | | } 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 = [ |
| | |
| | | options: [ |
| | | {value: 'dynamic', label: '动态', priKeyType: 'static'}, |
| | | {value: 'static', label: '静态', priKeyType: 'static'}, |
| | | {value: 'public', label: '公共数据源', priKeyType: 'static'}, |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | | {field: 'goback', values: ['dynamic']}, |
| | | {field: 'empty', values: ['dynamic']}, |
| | | {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']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'publicId', |
| | | label: '数据源', |
| | | initval: wrap.publicId || '', |
| | | required: true, |
| | | options: interfaces, |
| | | reset_source: true, |
| | | forbid: subtype !== 'propcard', |
| | | callback: (map, record) => { |
| | | if (!record.publicId) return |
| | | |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[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) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | 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', |
| | | field: 'pagestyle', |
| | | label: '分页风格', |
| | | initval: wrap.pagestyle || 'page', |
| | | tooltip: '数据源选择分页时有效。注:滑动加载只有第一个有效', |
| | | tooltip: '数据源选择分页时有效。注:弹性布局时固定为页码。', |
| | | required: false, |
| | | disabled: !laypage, |
| | | options: [ |
| | | {value: 'page', label: '页码'}, |
| | | {value: 'switch', label: '左右切换', forbid: appType === 'mob'}, |
| | | {value: 'slide', label: '滑动加载', forbid: appType !== 'mob'}, |
| | | {value: 'switch', label: '左右切换', forbid: appType === 'mob' || subtype === 'tablecard'}, |
| | | {value: 'slide', label: '滑动加载', forbid: appType !== 'mob' || sessionStorage.getItem('editMenuType') === 'popview'}, |
| | | {value: 'more', label: '查看更多'}, |
| | | ], |
| | | forbid: !(subtype === 'datacard' || (subtype === 'tablecard' && appType === 'mob')) |
| | | controlFields: [ |
| | | {field: 'slidetip', values: ['slide']}, |
| | | ], |
| | | forbid: subtype === 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | {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: 'public', value: 'joint', label: '拼接值'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | field: 'selected', |
| | | label: '首行选中', |
| | | label: '数据选中', |
| | | initval: wrap.selected || 'false', |
| | | tooltip: '初始化:数据加载时选中首行数据,仅执行一次。数据加载:每次数据加载时均选中首行(当按钮执行完成并返回主键值时,默认选中主键值对应行)。选中标记:返回数据中存在 selected 字段,且值为 true 的数据被选中。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'init', label: '初始化'}, |
| | | {value: 'always', label: '数据加载'}, |
| | | ] |
| | | {value: 'sign', label: '选中标记'} |
| | | ], |
| | | forbid: subtype !== 'datacard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'selected', |
| | | label: '数据选中', |
| | | initval: wrap.selected || 'false', |
| | | tooltip: '初始化:数据加载时选中首行数据,仅执行一次。数据加载:每次数据加载时均选中首行。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'init', label: '初始化'}, |
| | | {value: 'always', label: '数据加载'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | {value: 'active', label: '外阴影'}, |
| | | {value: 'backFont', label: '背景+文字'}, |
| | | {value: 'font', label: '文字'}, |
| | | ...(subtype === 'datacard' && appType === 'mob' ? [{value: 'check', label: '勾选'}] : []) |
| | | ] |
| | | // forbid: subtype !== 'propcard' |
| | | {value: 'tabs', label: '标签页'}, |
| | | ...(subtype === 'datacard' ? [ |
| | | {value: 'check', label: '勾选(圆框)'}, |
| | | {value: 'check square', label: '勾选(方框)'} |
| | | ] : []) |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'checkAll', |
| | | // label: '全选', |
| | | // initval: wrap.checkAll || 'hidden', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'hidden', label: '隐藏'}, |
| | | // {value: 'show', label: '显示'}, |
| | | // ], |
| | | // forbid: subtype !== 'datacard' || appType !== 'mob' |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cardFloat', |
| | | label: '对齐方式', |
| | | initval: wrap.cardFloat || 'left', |
| | | tooltip: '设置为居中对齐或右对齐,只在卡片为1行时有效。', |
| | | tooltip: '设置卡片的对齐方式。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'left', label: '左对齐'}, |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'parity', |
| | | label: '奇偶背景', |
| | | initval: wrap.parity || 'false', |
| | | tooltip: '偶数行会添加背景色。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: subtype === 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'printType', |
| | | label: '组件类型', |
| | | initval: wrap.printType || 'content', |
| | | tooltip: '选择类型为《页眉/页脚》时,打印的每页里都会带有该组件。', |
| | | tooltip: '选择类型为《页眉/页脚》时,打印的每页里都会带有该组件。注:页眉页脚中文本元素将替换 @pageIndex@(页码)、@total@(总数)、@date@(当前日期)、@datetime@(当前时间),使用分页参数时注意打印模板的页面布局使用分页。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'content', 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', |
| | | field: 'broadcast', |
| | | label: '语音播报', |
| | | initval: wrap.broadcast || '', |
| | | tooltip: '语音播报在移动端app中有效。注:使用语音播报时,数据源不要使用同步查询,添加定时器时,可循环播报', |
| | | tooltip: '语音播报在移动端有效。注:在H5中请使用音频链接,添加定时器时,可循环播报', |
| | | required: false, |
| | | options: columns, |
| | | forbid: !columns || appType !== 'mob' || subtype !== 'propcard' |
| | |
| | | { |
| | | type: 'radio', |
| | | field: 'goback', |
| | | label: '空值返回', |
| | | label: appType === 'mob' ? '空值返回' : '空值关闭', |
| | | initval: wrap.goback || 'false', |
| | | tooltip: '当查询数据为空时,返回上一界面。', |
| | | tooltip: appType === 'mob' ? '当查询数据为空时,返回上一界面。' : '当查询数据为空时,关闭当前标签页。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | {value: 'true', label: '是'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | forbid: subtype !== 'propcard' || appType === 'pc' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'display', |
| | | label: '显示控制', |
| | | initval: wrap.display || 'normal', |
| | | tooltip: '当使用属性卡进行某些业务操作,且不需要展示卡片信息时,可设置为不可见。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'normal', label: '正常显示'}, |
| | | {value: 'hidden', label: '不可见'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'empty', values: ['normal']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'autoExec', |
| | | label: '自动执行', |
| | | initval: wrap.autoExec || '', |
| | | tooltip: '数据更新时自动执行按钮。注:此按钮执行成功后谨慎选择刷新项,避免造成循环执行。', |
| | | required: false, |
| | | options: buttons, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | 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: 'open', 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: 'open', |
| | | label: '打开方式', |
| | | initval: wrap.open || 'blank', |
| | | required: false, |
| | | options: [ |
| | | {value: 'blank', label: '新窗口'}, |
| | | {value: 'self', label: '当前窗口'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | { |
| | | type: 'text', |
| | | field: 'controlVal', |
| | | label: '控制值', |
| | | label: '禁用值', |
| | | initval: wrap.controlVal || '', |
| | | tooltip: '当字段值与控制值相等时,行数据会禁用,多个值用逗号分隔。', |
| | | tooltip: '当字段值与禁用值相等时,行数据会禁用,多个值用逗号分隔。', |
| | | required: false, |
| | | forbid: subtype !== 'datacard' |
| | | }, |
| | |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: !appType ? '继承菜单' : '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cacheLocal', |
| | | label: '本地缓存', |
| | | initval: wrap.cacheLocal || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '继承菜单'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | |
| | | required: false, |
| | | 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', |
| | |
| | | } |
| | | ] |
| | | |
| | | 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 |
| | | }) |
| | | } |