| | |
| | | * @param {*} setting 组件配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | */ |
| | | export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) { |
| | | export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side, position) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview |
| | | let setting = config.setting || {} |
| | |
| | | card.formType = 'switch' |
| | | } |
| | | |
| | | let width = card.width || (card.width === 0 ? 0 : 12) |
| | | if (/x/.test(card.width)) { |
| | | width = +width.replace(/x/, '.5') |
| | | } |
| | | |
| | | let extraParam = [] |
| | | if (card.recordUser === 'true') { |
| | | extraParam.push('recordUser') |
| | | } |
| | | if (card.dataM === 'true') { |
| | | extraParam.push('dataM') |
| | | } |
| | | |
| | | if (!appType) { |
| | | if (typeof(card.openmenu) === 'string') { |
| | | card.openmenu = [] |
| | | } |
| | | } else { |
| | | if (typeof(card.openmenu) !== 'string') { |
| | | card.openmenu = '' |
| | | } |
| | | } |
| | | |
| | | let forms = [ |
| | | { |
| | | type: 'select', |
| | |
| | | initVal: card.linkmenu || (isApp ? '' : []), |
| | | required: true, |
| | | extendName: 'MenuNo', |
| | | options: isApp ? appMenus : menulist |
| | | options: isApp ? appMenus : (menulist.length ? [...menulist, {value: 'multiMenu', label: '多菜单'}] : []) |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'prefix', |
| | | label: '前缀', |
| | | initVal: card.prefix || '', |
| | | tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid开头。', |
| | | tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid(:或,)开头,mkbid(:或,)跳转后将被去除。例如:mkbid:123456 跳转后页面BID为 123456。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | key: 'width', |
| | | min: 0, |
| | | max: 24, |
| | | precision: 0, |
| | | precision: 1, |
| | | label: '宽度', |
| | | initVal: card.width || (card.width === 0 ? 0 : 12), |
| | | tooltip: '栅格布局,每行等分为24列。为 0 时宽度自适应。', |
| | | initVal: width, |
| | | tooltip: '栅格布局,每行等分为24列。为 0 时宽度自适应。可设置半列即.5。', |
| | | forbid: type !== 'card', |
| | | required: true |
| | | }, |
| | |
| | | }, { |
| | | value: 'link', |
| | | text: '文字+图标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hover', |
| | | label: '悬浮效果', |
| | | initVal: card.hover || '', |
| | | tooltip: '鼠标悬浮按钮上方时的颜色变化。', |
| | | required: false, |
| | | forbid: type === 'card' || appType === 'mob', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'mk-btn-hover-bg', |
| | | text: '背景变化' |
| | | }, { |
| | | value: 'mk-btn-hover-border', |
| | | text: '边框变化' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。', |
| | | initVal: card.output || '', |
| | | required: false, |
| | | forbid: viewType === 'popview' |
| | | // forbid: viewType === 'popview' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tipTitle', |
| | | label: '确认提示', |
| | | initVal: card.tipTitle || '', |
| | | tooltip: '注:弹窗(表单)在显示为是否框时有效。', |
| | | tooltip: '提示框的确认提示信息。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | tooltip: '鼠标悬浮在按钮上方时的提示信息。', |
| | | forbid: appType === 'mob', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'showName', |
| | | label: '显示内容', |
| | | initVal: card.showName || '', |
| | | tooltip: '行级按钮可通过行信息控制按钮显示内容。', |
| | | required: false, |
| | | allowClear: true, |
| | | forbid: position !== 'line', |
| | | options: columns.map(item => ({ |
| | | value: item.field, |
| | | text: `${item.label}(${item.field})` |
| | | })) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'recordUser', |
| | | label: '记录用户', |
| | | initVal: card.recordUser || 'false', |
| | | tooltip: '当选择“是”时,内部函数的传参会增加 username 与 fullname。', |
| | | type: 'checkbox', |
| | | key: 'extraParam', |
| | | label: '扩展参数', |
| | | initVal: extraParam, |
| | | tooltip: '选择“用户信息”时,内部函数的传参会增加 username 与 fullname。选择“数据管理员”时,内部函数的传参会增加 dataM ,管理员值为“Y”,普通用户为空。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | value: 'recordUser', |
| | | text: '用户信息' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | value: 'dataM', |
| | | text: '数据管理员' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | initVal: card.reason || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'formCache', |
| | | label: '表单缓存', |
| | | initVal: card.formCache || 'false', |
| | | tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '不清空' |
| | | }, { |
| | | value: 'clear', |
| | | text: '清空' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'formCache', |
| | | // label: '表单缓存', |
| | | // initVal: card.formCache || 'false', |
| | | // tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | // required: false, |
| | | // options: [{ |
| | | // value: 'false', |
| | | // text: '不清空' |
| | | // }, { |
| | | // value: 'clear', |
| | | // text: '清空' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'permission', |
| | | label: '权限验证', |
| | | initVal: card.permission || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', text: '继承菜单'}, |
| | | {value: 'false', text: '禁用'}, |
| | | ], |
| | | forbid: viewType === 'popview' |
| | | }, |
| | | { |
| | | type: 'splitLine', |
| | |
| | | options: modules |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysId', |
| | | label: '自定义ID', |
| | | initVal: card.sysId || '', |
| | | tooltip: '不选行按钮可在前端生成ID值(32位),作为后续菜单的BID,存在标记时,ID值后将拼接标记值。', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: '空' |
| | | }, { |
| | | value: 'js', |
| | | text: '前端生成' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sign', |
| | | label: '标记', |
| | | initVal: card.sign || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'table', |
| | | key: 'multiMenus', |
| | | label: '菜单列表', |
| | | initVal: card.multiMenus || [], |
| | | required: true, |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | columns: [ |
| | | { |
| | | title: '名称', |
| | | dataIndex: 'name', |
| | | inputType: 'text', |
| | | editable: true, |
| | | required: false, |
| | | width: '30%' |
| | | }, |
| | | { |
| | | title: '菜单', |
| | | dataIndex: 'menuId', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | required: true, |
| | | extends: [{key: 'label', value: 'label', mutilLabel: 'name'}], |
| | | width: '30%', |
| | | render: (text, record) => record.label, |
| | | options: menulist |
| | | }, |
| | | { |
| | | title: '标记', |
| | | dataIndex: 'sign', |
| | | inputType: 'text', |
| | | editable: true, |
| | | required: false, |
| | | width: '20%' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'preHandle', |
| | | label: '自定义脚本', |
| | | initVal: card.preHandle || 'false', |
| | | // tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'true', |
| | | text: '启用' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'codemirror', |
| | | key: 'pre_func', |
| | | label: '自定义脚本', |
| | | initVal: card.pre_func || '', |
| | | required: true, |
| | | } |
| | | ] |
| | | |
| | |
| | | * @param {*} setting 组件配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | */ |
| | | export function getBaseTableActionForm (card, functip, config, usefulFields, modules) { |
| | | export function getBaseTableActionForm (card, functip, config, usefulFields, modules, position) { |
| | | let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview |
| | | let setting = config.setting || {} |
| | | let columns = config.columns || [] |
| | |
| | | |
| | | if (card.OpenType === 'form') { // 拖拽添加类型转换 |
| | | card.OpenType = 'pop' |
| | | } |
| | | |
| | | let extraParam = [] |
| | | if (card.recordUser === 'true') { |
| | | extraParam.push('recordUser') |
| | | } |
| | | if (card.dataM === 'true') { |
| | | extraParam.push('dataM') |
| | | } |
| | | |
| | | let forms = [ |
| | |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | extendName: 'MenuNo', |
| | | options: menulist |
| | | options: menulist.length ? [...menulist, {value: 'multiMenu', label: '多菜单'}] : [] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hover', |
| | | label: '悬浮效果', |
| | | initVal: card.hover || '', |
| | | tooltip: '鼠标悬浮按钮上方时的颜色变化。', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'mk-btn-hover-bg', |
| | | text: '背景变化' |
| | | }, { |
| | | value: 'mk-btn-hover-border', |
| | | text: '边框变化' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | |
| | | tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。', |
| | | initVal: card.output || '', |
| | | required: false, |
| | | forbid: viewType === 'popview' |
| | | // forbid: viewType === 'popview' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tipTitle', |
| | | label: '确认提示', |
| | | initVal: card.tipTitle || '', |
| | | tooltip: '注:弹窗(表单)在显示为是否框时有效。', |
| | | tooltip: '提示框的确认提示信息。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | initVal: card.hoverTitle || '', |
| | | tooltip: '鼠标悬浮在按钮上方时的提示信息。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'showName', |
| | | label: '显示内容', |
| | | initVal: card.showName || '', |
| | | tooltip: '行级按钮可通过行信息控制按钮显示内容。', |
| | | required: false, |
| | | allowClear: true, |
| | | forbid: position !== 'line', |
| | | options: columns.map(item => ({ |
| | | value: item.field, |
| | | text: `${item.label}(${item.field})` |
| | | })) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'recordUser', |
| | | label: '记录用户', |
| | | initVal: card.recordUser || 'false', |
| | | tooltip: '当选择“是”时,内部函数的传参会增加 username 与 fullname。', |
| | | type: 'checkbox', |
| | | key: 'extraParam', |
| | | label: '扩展参数', |
| | | initVal: extraParam, |
| | | tooltip: '选择“用户信息”时,内部函数的传参会增加 username 与 fullname。选择“数据管理员”时,内部函数的传参会增加 dataM ,管理员值为“Y”,普通用户为空。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | value: 'recordUser', |
| | | text: '用户信息' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | value: 'dataM', |
| | | text: '数据管理员' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | initVal: card.reason || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'formCache', |
| | | label: '表单缓存', |
| | | initVal: card.formCache || 'false', |
| | | tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '不清空' |
| | | }, { |
| | | value: 'clear', |
| | | text: '清空' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'formCache', |
| | | // label: '表单缓存', |
| | | // initVal: card.formCache || 'false', |
| | | // tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | // required: false, |
| | | // options: [{ |
| | | // value: 'false', |
| | | // text: '不清空' |
| | | // }, { |
| | | // value: 'clear', |
| | | // text: '清空' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'permission', |
| | | label: '权限验证', |
| | | initVal: card.permission || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', text: '启用'}, |
| | | {value: 'false', text: '禁用'}, |
| | | ], |
| | | forbid: viewType === 'popview' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | options: modules |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysId', |
| | | label: '自定义ID', |
| | | initVal: card.sysId || '', |
| | | tooltip: '不选行按钮可在前端生成ID值(32位),作为后续菜单的BID,存在标记时,ID值后将拼接标记值。', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: '空' |
| | | }, { |
| | | value: 'js', |
| | | text: '前端生成' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sign', |
| | | label: '标记', |
| | | initVal: card.sign || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'table', |
| | | key: 'multiMenus', |
| | | label: '菜单列表', |
| | | initVal: card.multiMenus || [], |
| | | required: true, |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | columns: [ |
| | | { |
| | | title: '名称', |
| | | dataIndex: 'name', |
| | | inputType: 'text', |
| | | editable: true, |
| | | required: false, |
| | | width: '30%' |
| | | }, |
| | | { |
| | | title: '菜单', |
| | | dataIndex: 'menuId', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | required: true, |
| | | extends: [{key: 'label', value: 'label', mutilLabel: 'name'}], |
| | | width: '30%', |
| | | render: (text, record) => record.label, |
| | | options: menulist |
| | | }, |
| | | { |
| | | title: '标记', |
| | | dataIndex: 'sign', |
| | | inputType: 'text', |
| | | editable: true, |
| | | required: false, |
| | | width: '20%' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'preHandle', |
| | | label: '自定义脚本', |
| | | initVal: card.preHandle || 'false', |
| | | // tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'true', |
| | | text: '启用' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'codemirror', |
| | | key: 'pre_func', |
| | | label: '自定义脚本', |
| | | initVal: card.pre_func || '', |
| | | required: true, |
| | | } |
| | | ] |
| | | |