| | |
| | | import { formRule, btnClasses } from '@/utils/option.js' |
| | | |
| | | /** |
| | | * @description 获取树形页面设置表单配置信息 |
| | | * @param {object} setting // 菜单全局设置信息 |
| | | * @param {array} usefulFields // 可用开始字符 |
| | | * @param {string} MenuID // 菜单ID |
| | | */ |
| | | export function getTreeSettingForm (setting, usefulFields = [], MenuID) { |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | let rules = [{ |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | |
| | | if (usefulFields.length > 0) { |
| | | rules.push({ |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }) |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'tableName', |
| | | label: '表名', |
| | | initVal: setting.tableName || '', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'title', |
| | | label: '标题', |
| | | initVal: setting.title || '', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'interType', |
| | | label: '接口类型', |
| | | initVal: setting.interType || 'inner', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'inner', text: '内部' }, |
| | | { value: 'outer', text: '外部' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysInterface', |
| | | label: '系统接口', |
| | | initVal: setting.sysInterface || 'false', |
| | | tooltip: '单点登录系统', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'interface', |
| | | label: '接口地址', |
| | | initVal: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (setting.interface || ''), |
| | | required: true, |
| | | readonly: setting.sysInterface === 'true', |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'outerFunc', |
| | | label: '外部函数', |
| | | initVal: setting.outerFunc || '', |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: '内部函数', |
| | | initVal: setting.innerFunc || '', |
| | | tooltip: usefulFields.length ? '开头可用字符:' + usefulFields.join(', ') : '', |
| | | placement: 'bottomLeft', |
| | | required: false, |
| | | readonly: false, |
| | | rules: rules |
| | | }, |
| | | { |
| | | type: 'datasource', |
| | | key: 'dataresource', |
| | | label: '数据源', |
| | | initVal: setting.dataresource || '', |
| | | tooltip: '使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'', |
| | | help: '数据ID:' + MenuID, |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: 'Value', |
| | | initVal: setting.valueField || '', |
| | | tooltip: '数据值字段。', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'labelField', |
| | | label: 'Label', |
| | | initVal: setting.labelField || '', |
| | | tooltip: '显示文字字段。', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'parentField', |
| | | label: 'Parent', |
| | | initVal: setting.parentField || '', |
| | | tooltip: '父级字段。', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'order', |
| | | label: '排序', |
| | | initVal: setting.order || '', |
| | | placeholder: 'ID asc, UID desc', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'mark', |
| | | label: '顶级标识', |
| | | initVal: setting.mark || '', |
| | | tooltip: '父级字段值与顶级标识相同时,视为顶级节点。', |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 2, |
| | | max: 12, |
| | | label: '宽度', |
| | | tooltip: '栅格布局,每行等分为24列,树形比例可设置为2-12(最大50%)', |
| | | initVal: setting.width || 5, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchable', |
| | | label: '搜索', |
| | | initVal: setting.searchable || 'true', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '显示' }, |
| | | { value: 'false', text: '隐藏' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'default', |
| | | label: '默认sql', |
| | | initVal: setting.default || 'true', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '执行' }, |
| | | { value: 'false', text: '不执行' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'showIcon', |
| | | label: '显示图标', |
| | | initVal: setting.showIcon || 'false', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'showLine', |
| | | label: '显示分割线', |
| | | initVal: setting.showLine || 'false', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | import React from 'react' |
| | | /** |
| | | * @description 获取搜索条件表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | |
| | | }, { |
| | | value: 'group', |
| | | text: '日期(组合)' |
| | | }, { |
| | | value: 'range', |
| | | text: '数值(区间)' |
| | | }, { |
| | | value: 'switch', |
| | | text: '开关' |
| | |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: '初始值', |
| | | tooltip: '类型为下拉菜单时,初始值应为数据的Value值(使用数据源时,应为《值·字段》的值);类型为数值(区间)时,初始值使用逗号拼接,例如 3,10;文本与下拉菜单中可使用@username@、@fullName@', |
| | | initVal: card.initval, |
| | | required: false |
| | | }, |
| | |
| | | text: '数据源' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'setAll', |
| | | // label: '设置全部', |
| | | // initVal: card.setAll || 'true', |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: '是' |
| | | // }, { |
| | | // value: 'false', |
| | | // text: '否' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'fields', |
| | | label: '字段集', |
| | | initVal: card.fields || [], |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'codemirror', |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | tooltip: '数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'fields', |
| | | label: '字段集', |
| | | initVal: card.fields || [], |
| | | required: true, |
| | | columns: [ |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | strict: true, |
| | | forbids: ['value', 'parentid', 'pid'], |
| | | initval: 'field', |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '请使用数字、字母、汉字以及_-' |
| | | }], |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字体颜色', |
| | | dataIndex: 'color', |
| | | inputType: 'color', |
| | | editable: true, |
| | | initval: 'rgba(0, 0, 0, 0.85)', |
| | | width: '20%', |
| | | render: (text, record) => { |
| | | return <span style={{color: text}}>示例</span> |
| | | } |
| | | }, |
| | | { |
| | | title: '字体大小', |
| | | dataIndex: 'fontSize', |
| | | inputType: 'number', |
| | | min: 12, |
| | | max: 50, |
| | | editable: true, |
| | | initval: 14, |
| | | width: '20%', |
| | | }, |
| | | { |
| | | title: '对齐方式', |
| | | dataIndex: 'align', |
| | | inputType: 'select', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 'left', |
| | | options: [ |
| | | {value: 'left', text: '居左'}, |
| | | {value: 'center', text: '居中'}, |
| | | {value: 'right', text: '居右'}, |
| | | // {value: 'justify', text: 'justify'} |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'center') { |
| | | return '居中' |
| | | } else if (text === 'right') { |
| | | return '居右' |
| | | } else { |
| | | return '居左' |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'options', |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'orderType', |
| | | label: '排序方式', |
| | | initVal: card.orderType || 'asc', |
| | |
| | | initVal: card.labelwidth || 33.3, |
| | | tooltip: '名称占据搜索条件宽度的百分比。注:存在多列搜索时,当前搜索如果想要占据整行可参照以下比例,两列(16.5)、三列(10.8)、四列(8)', |
| | | required: true, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'dateShift', |
| | | label: '日期偏移', |
| | | initVal: card.dateShift || '', |
| | | tooltip: '可以填入上级字段,用于控制初始值,例如:上级字段值为2023-12-10,初始值为本月,则初始区间为 2023-12-01 ~ 2023-12-31。', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | | * @param {*} card 编辑按钮 |
| | | * @param {*} config 页面配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | | text: '弹窗(表单)' |
| | | }, { |
| | | value: 'prompt', |
| | | text: '提示框' |
| | | }, { |
| | | value: 'exec', |
| | | text: '直接执行' |
| | | }, { |
| | | value: 'excelIn', |
| | | text: '导入Excel' |
| | | }, { |
| | | value: 'excelOut', |
| | | text: '导出Excel' |
| | | }, { |
| | | value: 'popview', |
| | | text: '弹窗(标签)' |
| | | }, { |
| | | value: 'tab', |
| | | text: '标签页' |
| | | }, { |
| | | value: 'innerpage', |
| | | text: '新页面' |
| | | }, { |
| | | value: 'funcbutton', |
| | | text: '功能按钮' |
| | | } |
| | | ] |
| | | |
| | | if (card.execSuccess === 'view' || card.execSuccess === 'refresh') { // refresh为表单标签页 |
| | | card.execSuccess = 'grid' |
| | | } |
| | | if (card.execError === 'view' || card.execError === 'refresh') { |
| | | card.execError = 'grid' |
| | | } |
| | | if (card.popClose === 'view') { |
| | | card.popClose = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'outerpage') { |
| | | card.pageTemplate = 'custom' |
| | | card.OpenType = 'innerpage' |
| | | } |
| | | |
| | | let refresh = [] |
| | | |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | | if (card.focus) { |
| | | card.popClose = 'maingrid' |
| | | } |
| | | refresh.push({ |
| | | value: 'maingrid', |
| | | text: '刷新主表(行)' |
| | | }, { |
| | | value: 'equaltab', |
| | | text: '刷新同级标签' |
| | | }) |
| | | } else if (card.execSuccess === 'maingrid') { |
| | | card.execSuccess = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'blank') { |
| | | card.OpenType = 'tab' |
| | | } |
| | | if (!card.control && card.controlField) { |
| | | card.control = 'disabled' |
| | | } |
| | | |
| | | if (card.intertype === 'outer' && !card.procMode && !card.innerFunc) { // 兼容外部函数直传类型 |
| | | card.procMode = 'none' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'select', |
| | | key: 'OpenType', |
| | | label: '打开方式', |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '按钮名称', |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'funcType', |
| | | label: '功能类型', |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: [{ |
| | | value: 'print', |
| | | text: '标签打印' |
| | | }, { |
| | | value: 'refund', |
| | | text: '退款' |
| | | }, { |
| | | value: 'changeuser', |
| | | text: '切换用户' |
| | | }, { |
| | | value: 'closetab', |
| | | text: '标签关闭' |
| | | }, { |
| | | value: 'megvii', |
| | | text: '旷视面板机' |
| | | }, { |
| | | value: 'filezip', |
| | | text: '文件压缩包' |
| | | }] |
| | | }, |
| | | { // 旷视面板机接口 待扩展 |
| | | type: 'radio', |
| | | key: 'subFunc', |
| | | label: '接口名称', |
| | | initVal: card.subFunc || 'addUser', |
| | | required: true, |
| | | options: [ |
| | | { value: 'addUser', text: '添加用户' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'execMode', |
| | | label: '执行方式', |
| | | initVal: card.execMode || 'exec', |
| | | required: true, |
| | | options: [{ |
| | | value: 'exec', |
| | | text: '直接执行' |
| | | }, { |
| | | value: 'prompt', |
| | | text: '提示框' |
| | | }, { |
| | | value: 'pop', |
| | | text: '弹窗(表单)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'intertype', |
| | | label: '接口类型', |
| | | initVal: card.intertype || 'system', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'procMode', |
| | | label: '参数处理', |
| | | initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), |
| | | tooltip: '当返回值存在 mk_ex_invoke 且值为 false 时,不会调用外部接口。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'system', |
| | | text: '系统函数' |
| | | }, { |
| | | value: 'inner', |
| | | text: '内部函数' |
| | | }, { |
| | | value: 'none', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sqlType', |
| | | label: '操作类型', |
| | | initVal: card.sqlType || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sql', |
| | | label: '表名', |
| | | initVal: card.sql || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: '内部函数', |
| | | initVal: card.innerFunc || '', |
| | | tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始。` : '', |
| | | fields: usefulFields, |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlkey', |
| | | label: '地址字段', |
| | | initVal: card.urlkey || '', |
| | | tooltip: '图片(文件)链接的字段名。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ...tabs |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'pageTemplate', |
| | | label: '页面类型', |
| | | initVal: card.pageTemplate || '', |
| | | required: true, |
| | | options: [{ |
| | | // value: 'print', |
| | | // text: '标签打印模板' |
| | | // }, { |
| | | // value: 'billprintTemp', |
| | | // text: '单据打印模板' |
| | | // }, { |
| | | value: 'billprint', |
| | | text: '单据打印' |
| | | }, { |
| | | value: 'pay', |
| | | text: '支付' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'printTemp', |
| | | label: '打印模板', |
| | | initVal: card.printTemp || '', |
| | | required: true, |
| | | options: printTemps |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'url', |
| | | label: '页面地址', |
| | | initVal: card.url || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysInterface', |
| | | label: '系统接口', |
| | | initVal: card.sysInterface || 'false', |
| | | tooltip: '单点登录系统', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'outerFunc', |
| | | label: '外部函数', |
| | | initVal: card.outerFunc || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'interface', |
| | | label: '测试地址', |
| | | initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), |
| | | required: true, |
| | | readonly: card.sysInterface === 'true' |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'proInterface', |
| | | label: '正式地址', |
| | | initVal: card.proInterface || '', |
| | | tooltip: '正式系统所使用的接口地址。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | | tooltip: '使用后台脚本执行时,需要配合计划任务。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'script', |
| | | text: '自定义脚本' |
| | | }, { |
| | | value: 'default', |
| | | text: '后台脚本' |
| | | }, { |
| | | value: 'func', |
| | | text: '回调函数' |
| | | }, { |
| | | value: 'none', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'cbTable', |
| | | label: '回调表名', |
| | | initVal: card.cbTable || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'callbackFunc', |
| | | label: '回调函数', |
| | | initVal: card.callbackFunc || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'position', |
| | | label: '显示位置', |
| | | initVal: card.position || 'toolbar', |
| | | required: true, |
| | | options: [{ |
| | | value: 'toolbar', |
| | | text: '工具栏' |
| | | }, { |
| | | value: 'grid', |
| | | text: '表格' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Ot', |
| | | label: '行设置', |
| | | initVal: card.Ot || 'requiredSgl', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'refreshTab', |
| | | label: '刷新标签', |
| | | initVal: card.refreshTab || [], |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execSuccess', |
| | | label: '成功后', |
| | | initVal: card.execSuccess || 'grid', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execError', |
| | | label: '失败后', |
| | | initVal: card.execError || 'never', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'popClose', |
| | | label: '关闭后', |
| | | initVal: card.popClose || 'grid', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resetPageIndex', |
| | | label: '刷新时', |
| | | initVal: card.resetPageIndex || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '重置页码' |
| | | }, { |
| | | value: 'false', |
| | | text: '不重置' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'class', |
| | | label: '颜色', |
| | | initVal: card.class, |
| | | required: false, |
| | | options: btnClasses |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'openmenu', |
| | | label: '打开菜单', |
| | | initVal: card.openmenu || [], |
| | | tooltip: '执行成功后需要打开的菜单。', |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | | tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。', |
| | | initVal: card.output || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tipTitle', |
| | | label: '确认提示', |
| | | initVal: card.tipTitle || '', |
| | | tooltip: '注:弹窗(表单)在显示为是否框时有效。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sheet', |
| | | label: '表名', |
| | | initVal: card.sheet || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pagination', |
| | | label: '分页', |
| | | initVal: card.pagination || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'search', |
| | | label: '搜索条件', |
| | | initVal: card.search || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '必填' |
| | | }, { |
| | | value: 'false', |
| | | text: '非必填' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示方式', |
| | | initVal: card.display || 'modal', |
| | | required: true, |
| | | options: [{ |
| | | value: 'modal', |
| | | text: '模态框' |
| | | }, { |
| | | value: 'drawer', |
| | | text: '抽屉' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'ratio', |
| | | min: 1, |
| | | max: 3000, |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | | tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'placement', |
| | | label: '弹出方向', |
| | | initVal: card.placement || 'right', |
| | | required: false, |
| | | options: [{ |
| | | value: 'right', |
| | | text: '右侧' |
| | | }, { |
| | | value: 'left', |
| | | text: '左侧' |
| | | }, { |
| | | value: 'top', |
| | | text: '上侧' |
| | | }, { |
| | | value: 'bottom', |
| | | text: '下侧' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'clickouter', |
| | | label: '点击蒙层', |
| | | initVal: card.clickouter || 'unclose', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unclose', |
| | | text: '不关闭' |
| | | }, { |
| | | value: 'close', |
| | | text: '关闭' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'control', |
| | | label: '按钮控制', |
| | | initVal: card.control || '', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'disabled', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'hidden', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '控制字段,可根据数据控制按钮的隐藏或禁用。', |
| | | initVal: card.controlField || '', |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会隐藏或禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'reason', |
| | | label: '禁用原因', |
| | | initVal: card.reason || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | | tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'progress', |
| | | label: '进度提示', |
| | | initVal: card.progress || 'number', |
| | | required: false, |
| | | options: [{ |
| | | value: 'number', |
| | | text: '剩余数' |
| | | }, { |
| | | value: 'progressbar', |
| | | text: '进度条' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取显示列表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} menulist // 菜单列表-用于字段透视 |
| | | */ |
| | | export function getColumnForm (card, menulist = [], fields = []) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '名称', |
| | | initVal: card.label, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: '字段', |
| | | initVal: card.field, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: '类型', |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: '文本' |
| | | }, { |
| | | value: 'number', |
| | | text: '数字' |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'video', |
| | | text: '视频' |
| | | }, { |
| | | value: 'link', |
| | | text: '链接' |
| | | }, { |
| | | value: 'textarea', |
| | | text: '多行文本' |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'nameField', |
| | | label: '名称字段', |
| | | initVal: card.nameField, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '列宽', |
| | | initVal: card.Width, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: '隐藏', |
| | | initVal: card.Hide || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: '排序', |
| | | initVal: card.IsSort || 'true', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Align', |
| | | label: '对齐方式', |
| | | initVal: card.Align || 'left', |
| | | required: true, |
| | | options: [{ |
| | | value: 'left', |
| | | text: '左对齐' |
| | | }, { |
| | | value: 'center', |
| | | text: '居中' |
| | | }, { |
| | | value: 'right', |
| | | text: '右对齐' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'startTime', |
| | | precision: 0, |
| | | label: '开始时间', |
| | | initVal: card.startTime || 0, |
| | | tooltip: '视频开始播放的时间,用于调整视频初始化展示的界面。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'aspectRatio', |
| | | label: '长宽比', |
| | | initVal: card.aspectRatio || '16:9', |
| | | required: true, |
| | | options: [ |
| | | { value: '4:3', text: '4:3' }, |
| | | { value: '16:9', text: '16:9' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'rowspan', |
| | | label: '行合并', |
| | | initVal: card.rowspan || 'false', |
| | | tooltip: '相邻行信息相同时,单元格合并。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sum', |
| | | label: '显示合计', |
| | | initVal: card.sum || 'false', |
| | | tooltip: '合计信息只在使用系统数据源,且当前列未隐藏时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | min: 0, |
| | | max: 18, |
| | | decimal: 0, |
| | | label: '小数位', |
| | | initVal: card.decimal || 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: '字段长度', |
| | | initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'format', |
| | | label: '格式化', |
| | | initVal: card.format || 'none', |
| | | options: [{ |
| | | value: 'none', |
| | | text: '无' |
| | | }, { |
| | | value: 'thdSeparator', |
| | | text: '千分位' |
| | | }, { |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'abs', |
| | | text: '绝对值' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'textFormat', |
| | | label: '格式化', |
| | | initVal: card.textFormat || 'none', |
| | | options: [{ |
| | | value: 'none', |
| | | text: '无' |
| | | }, { |
| | | value: 'encryption', |
| | | text: '加密' |
| | | }, { |
| | | value: 'YYYY-MM-DD', |
| | | text: 'YYYY-MM-DD' |
| | | }, { |
| | | value: 'YYYY-MM-DD HH:mm:ss', |
| | | text: 'YYYY-MM-DD HH:mm:ss' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'prefix', |
| | | label: '前缀', |
| | | initVal: card.prefix || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'postfix', |
| | | label: '后缀', |
| | | initVal: card.postfix || '', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'span', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '图片宽度', |
| | | initVal: card.span || 24, |
| | | tooltip: '栅格布局,等分为24份。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'lenWidRadio', |
| | | label: '长宽比', |
| | | initVal: card.lenWidRadio || '1:1', |
| | | required: true, |
| | | options: [ |
| | | { value: '1:1', text: '1:1' }, |
| | | { value: '4:3', text: '4:3' }, |
| | | { value: '3:2', text: '3:2' }, |
| | | { value: '16:9', text: '16:9' }, |
| | | { value: '2:1', text: '2:1' }, |
| | | { value: '3:1', text: '3:1' }, |
| | | { value: '4:1', text: '4:1' }, |
| | | { value: '5:1', text: '5:1' }, |
| | | { value: '6:1', text: '6:1' }, |
| | | { value: '7:1', text: '7:1' }, |
| | | { value: '8:1', text: '8:1' }, |
| | | { value: '9:1', text: '9:1' }, |
| | | { value: '10:1', text: '10:1' }, |
| | | { value: '3:4', text: '3:4' }, |
| | | { value: '2:3', text: '2:3' }, |
| | | { value: '9:16', text: '9:16' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'scale', |
| | | label: '点击缩放', |
| | | initVal: card.scale || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'perspective', |
| | | label: '字段透视', |
| | | initVal: card.perspective || '', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'linkmenu', |
| | | text: '菜单' |
| | | }, { |
| | | value: 'linkurl', |
| | | text: '链接' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'linkmenu', |
| | | label: '菜单', |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkfields', |
| | | label: '关联字段', |
| | | initVal: card.linkfields || [], |
| | | required: false, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取图表视图外部配置表单 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {Array} actions // 按钮组excel |
| | | * @param {Array} extraActions // 常规按钮 |
| | | */ |
| | | export function getChartViewForm (card, _columns, actions, extraActions) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let _charts = [{ |
| | | value: 'line', |
| | | text: '折线图' |
| | | }, { |
| | | value: 'bar', |
| | | text: '柱状图' |
| | | }, { |
| | | value: 'pie', |
| | | text: '饼图' |
| | | }, { |
| | | value: 'card', |
| | | text: '卡片' |
| | | }] |
| | | |
| | | if (card.chartType === 'table') { |
| | | _charts = [{ |
| | | value: 'table', |
| | | text: '表格' |
| | | }] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'title', |
| | | label: '标题', |
| | | initVal: card.title, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'chartType', |
| | | label: '图表类型', |
| | | initVal: card.chartType, |
| | | required: true, |
| | | readonly: card.chartType === 'table', |
| | | options: _charts |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 100, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '高度', |
| | | initVal: card.height || 400, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: '隐藏', |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '图表宽度', |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width || 24, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'cardWidth', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '卡片宽度', |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.cardWidth || 6, |
| | | hidden: true, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'bgfield', |
| | | label: '背景控制', |
| | | initVal: card.bgfield || '', |
| | | required: false, |
| | | readonly: false, |
| | | hidden: true, |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hidden', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'switch', |
| | | label: '数据切换', |
| | | initVal: card.switch || 'true', |
| | | required: false, |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'extraAction', |
| | | label: '扩展卡片', |
| | | initVal: card.extraAction || '', |
| | | tooltip: '绑定不选行的按钮,卡片尾部会增加功能卡片', |
| | | required: false, |
| | | options: extraActions |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'actions', |
| | | label: '扩展按钮', |
| | | initVal: card.actions || [], |
| | | tooltip: '可绑定已有的excel导入、导出按钮', |
| | | required: false, |
| | | options: actions |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取图表视图配置表单 |
| | | * @param {object} card // 图表对象 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {String} setting // 页面设置 |
| | | */ |
| | | export function getChartOptionForm (card, columns, setting) { |
| | | let shapes = [] |
| | | |
| | | if (card.chartType === 'line') { |
| | | shapes = [ |
| | | { field: 'smooth', label: 'smooth' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'dot', label: 'dot' }, |
| | | { field: 'dash', label: 'dash' }, |
| | | { field: 'hv', label: 'hv' }, |
| | | { field: 'vh', label: 'vh' }, |
| | | { field: 'hvh', label: 'hvh' }, |
| | | { field: 'vhv', label: 'vhv' } |
| | | ] |
| | | } else if (card.chartType === 'bar') { |
| | | shapes = [ |
| | | { field: 'rect', label: 'rect' }, |
| | | { field: 'hollow-rect', label: 'hollow-rect' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'tick', label: 'tick' }, |
| | | { field: 'funnel', label: 'funnel' }, |
| | | { field: 'pyramid', label: 'pyramid' } |
| | | ] |
| | | } else if (card.chartType === 'pie') { |
| | | shapes = [ |
| | | { field: 'pie', label: '饼图' }, |
| | | { field: 'ring', label: '环图' } |
| | | ] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'radio', |
| | | key: 'datatype', |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'query', |
| | | tooltip: '统计图表适用于表格不分页,且数据需要转换', |
| | | required: false, |
| | | readonly: !(setting.laypage === 'false'), |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [ |
| | | { value: 'query', text: '查询' }, |
| | | { value: 'statistics', text: '统计' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Xaxis', |
| | | label: card.chartType === 'pie' ? 'Text' : 'X-轴', |
| | | initVal: card.Xaxis || '', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Yaxis', |
| | | label: card.chartType === 'pie' ? 'Value' : 'Y-轴', |
| | | initVal: card.chartType === 'pie' ? card.Yaxis || '' : card.Yaxis || [], |
| | | multi: card.chartType !== 'pie', |
| | | hidden: card.datatype === 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'InfoType', |
| | | label: '类型', |
| | | initVal: card.InfoType || '', |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'InfoValue', |
| | | label: '值', |
| | | initVal: card.InfoValue || '', |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'legend', |
| | | label: '图例位置', |
| | | initVal: card.legend || 'bottom', |
| | | required: false, |
| | | options: [ |
| | | { field: 'top', label: 'top' }, |
| | | { field: 'top-left', label: 'top-left' }, |
| | | { field: 'top-right', label: 'top-right' }, |
| | | { field: 'right', label: 'right' }, |
| | | { field: 'right-top', label: 'right-top' }, |
| | | { field: 'right-bottom', label: 'right-bottom' }, |
| | | { field: 'left', label: 'left' }, |
| | | { field: 'left-top', label: 'left-top' }, |
| | | { field: 'left-bottom', label: 'left-bottom' }, |
| | | { field: 'bottom', label: 'bottom' }, |
| | | { field: 'bottom-left', label: 'bottom-left' }, |
| | | { field: 'bottom-right', label: 'bottom-right' }, |
| | | { field: 'hidden', label: 'hidden' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'shape', |
| | | label: '形状', |
| | | initVal: card.shape || (shapes[0] && shapes[0].field), |
| | | required: false, |
| | | forbid: !['line', 'bar', 'pie'].includes(card.chartType), |
| | | options: shapes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'tooltip', |
| | | label: '提示信息', |
| | | initVal: card.tooltip || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'coordinate', |
| | | label: '坐标', |
| | | initVal: card.coordinate || 'angle', |
| | | required: false, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'angle', |
| | | text: '二维坐标' |
| | | }, { |
| | | value: 'polar', |
| | | text: '极坐标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'point', |
| | | label: '点图', |
| | | initVal: card.point || 'false', |
| | | required: false, |
| | | forbid: !['line'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'transpose', |
| | | label: '变换', |
| | | initVal: card.transpose || 'false', |
| | | required: false, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pieshow', |
| | | label: '显示值', |
| | | initVal: card.pieshow || 'percent', |
| | | required: false, |
| | | forbid: !['pie'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'value', |
| | | text: '数值' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'label', |
| | | label: '标注-值', |
| | | initVal: card.label || (card.chartType === 'pie' ? 'true' : 'false'), |
| | | required: false, |
| | | forbid: !['pie', 'bar', 'line'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelLayout', |
| | | label: '标签布局', |
| | | initVal: card.labelLayout || 'normal', |
| | | required: false, |
| | | forbid: !['pie'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '常规' |
| | | }, { |
| | | value: 'overlap', |
| | | text: '防重叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'adjust', |
| | | label: '多柱排列', |
| | | initVal: card.adjust || 'dodge', |
| | | required: false, |
| | | forbid: !['bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'dodge', |
| | | text: '分组' |
| | | }, { |
| | | value: 'stack', |
| | | text: '堆叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'repeat', |
| | | label: '重复数据', |
| | | initVal: card.repeat || 'unrepeat', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unrepeat', |
| | | text: '去重' |
| | | }, { |
| | | value: 'average', |
| | | text: '平均' |
| | | }, { |
| | | value: 'cumsum', |
| | | text: '累加' |
| | | }] |
| | | }, { |
| | | type: 'number', |
| | | key: 'InfoDefNumber', |
| | | label: '展示数', |
| | | tooltip: '默认显示类型数量', |
| | | min: 1, |
| | | max: 50, |
| | | decimal: 0, |
| | | initVal: card.InfoDefNumber || 5, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true |
| | | }, { |
| | | type: 'number', |
| | | key: 'barSize', |
| | | label: '柱形宽度', |
| | | tooltip: '空值时,宽度自适应。', |
| | | min: 5, |
| | | max: 100, |
| | | decimal: 0, |
| | | initVal: card.barSize, |
| | | forbid: !['bar'].includes(card.chartType), |
| | | required: false |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表单配置信息 |
| | | * @param {*} card // 表单对象 |
| | | * @param {*} inputfields // 可写入表单 |
| | | * @param {*} tabfields // 可切换表单 |
| | | * @param {*} linkableFields // 可关联表单 |
| | | * @param {*} linksupFields // 上级表单 |
| | | */ |
| | | export function getModalForm (card, inputfields = [], tabfields = [], linkableFields, linksupFields, columns = []) { |
| | | export function getModalForm (card, fields, columns = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | |
| | | } |
| | | } else { |
| | | msgTemps = [] |
| | | } |
| | | |
| | | let inputfields = [] |
| | | let tabfields = [] |
| | | let linkableFields = [] |
| | | let linksupFields = [] |
| | | |
| | | fields.forEach(item => { |
| | | if (!item.field || card.field === item.field) return |
| | | |
| | | if (['text', 'number', 'textarea', 'select'].includes(item.type)) { |
| | | inputfields.push({ |
| | | field: item.field, |
| | | label: item.label |
| | | }) |
| | | } |
| | | if (item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { |
| | | tabfields.push({ |
| | | field: item.field, |
| | | label: item.label |
| | | }) |
| | | } |
| | | |
| | | if (['switch', 'check', 'popSelect'].includes(item.type)) { |
| | | linksupFields.push({ |
| | | field: item.field, |
| | | label: item.label |
| | | }) |
| | | } |
| | | |
| | | if (!['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) return |
| | | |
| | | linksupFields.push({ |
| | | field: item.field, |
| | | label: item.label |
| | | }) |
| | | |
| | | if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return |
| | | |
| | | linkableFields.push({ |
| | | field: item.field, |
| | | label: item.label + '-表单' |
| | | }) |
| | | }) |
| | | |
| | | let _fields = linkableFields.map(cell => cell.field) |
| | | columns.forEach(col => { |
| | | if (col.field && !_fields.includes(col.field)) { |
| | | linkableFields.push({ |
| | | field: col.field, |
| | | label: col.label + '-显示列' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (card.linkSubField && card.linkSubField.length > 0) { |
| | | let fields = inputfields.map(item => item.field) |
| | | card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) |
| | | } |
| | | |
| | | inputfields = inputfields.map((item, index) => { |
| | |
| | | }, { |
| | | value: 'link', |
| | | text: '联动菜单' |
| | | }, { |
| | | value: 'popSelect', |
| | | text: '选择器' |
| | | }, { |
| | | value: 'switch', |
| | | text: '开关' |
| | |
| | | text: '16:9' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'setAll', |
| | | // label: '设置空值', |
| | | // initVal: card.setAll || 'false', |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: '是' |
| | | // }, { |
| | | // value: 'false', |
| | | // text: '否' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'codemirror', |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | tooltip: '数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值:@ID@、@BID@。', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'fields', |
| | | label: '字段集', |
| | | initVal: card.fields || [], |
| | | required: true, |
| | | readonly: false |
| | | readonly: false, |
| | | columns: [ |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | strict: true, |
| | | forbids: ['value', 'parentid', 'pid'], |
| | | initval: 'field', |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '请使用数字、字母、汉字以及_-' |
| | | }], |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字体颜色', |
| | | dataIndex: 'color', |
| | | inputType: 'color', |
| | | editable: true, |
| | | initval: 'rgba(0, 0, 0, 0.85)', |
| | | width: '20%', |
| | | render: (text, record) => { |
| | | return <span style={{color: text}}>示例</span> |
| | | } |
| | | }, |
| | | { |
| | | title: '字体大小', |
| | | dataIndex: 'fontSize', |
| | | inputType: 'number', |
| | | min: 12, |
| | | max: 50, |
| | | editable: true, |
| | | initval: 14, |
| | | width: '20%', |
| | | }, |
| | | { |
| | | title: '对齐方式', |
| | | dataIndex: 'align', |
| | | inputType: 'select', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 'left', |
| | | options: [ |
| | | {value: 'left', text: '居左'}, |
| | | {value: 'center', text: '居中'}, |
| | | {value: 'right', text: '居右'}, |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'center') { |
| | | return '居中' |
| | | } else if (text === 'right') { |
| | | return '居右' |
| | | } else { |
| | | return '居左' |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'columns', |
| | | label: '字段集', |
| | | initVal: card.columns || [], |
| | | required: true, |
| | | readonly: false, |
| | | columns: [ |
| | | { |
| | | title: '名称', |
| | | dataIndex: 'label', |
| | | inputType: 'input', |
| | | editable: true, |
| | | initval: 'label', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | strict: true, |
| | | copy: true, |
| | | initval: 'field', |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '请使用数字、字母、汉字以及_-' |
| | | }], |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '隐藏', |
| | | dataIndex: 'Hide', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 'false', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'}, |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'true') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '排序', |
| | | dataIndex: 'IsSort', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 'false', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'}, |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'true') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '列宽', |
| | | dataIndex: 'Width', |
| | | inputType: 'number', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 120 |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'primaryKey', |
| | | label: '主键', |
| | | initVal: card.primaryKey || '', |
| | | required: true, |
| | | readonly: false, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'order', |
| | | label: '默认排序', |
| | | initVal: card.order || '', |
| | | placeholder: 'ID asc', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'showField', |
| | | label: '显示字段', |
| | | initVal: card.showField || '', |
| | | tooltip: '用于控制选择框中的显示内容。', |
| | | required: true, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '禁用字段', |
| | | initVal: card.controlField || '', |
| | | tooltip: '用于控制行数据是否可选择。字段值为true时,选项不可选。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'searchKey', |
| | | label: '搜索字段', |
| | | initVal: card.searchKey || '', |
| | | tooltip: '多个值请用逗号分隔。', |
| | | required: false, |
| | | rules: [{ |
| | | pattern: /^[0-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母以及_-', |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'popWidth', |
| | | label: '弹窗宽度', |
| | | initVal: card.popWidth || 60, |
| | | tooltip: '小于100时为百分率,大于100时为绝对值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'options', |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'codemirror', |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值:@ID@、@BID@。', |
| | | required: true, |
| | | readonly: false |
| | | type: 'radio', |
| | | key: 'laypage', |
| | | label: '分页', |
| | | initVal: card.laypage || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'onload', |
| | | label: '初始化', |
| | | initVal: card.onload || 'true', |
| | | tooltip: '当没有设置搜索字段时,初始化加载数据。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '加载' |
| | | }, { |
| | | value: 'false', |
| | | text: '不加载' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'orderType', |
| | | label: '排序方式', |
| | | initVal: card.orderType || 'asc', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'notZero', |
| | | label: "不可为0", |
| | | initVal: card.notZero || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: '数据库', |
| | | initVal: card.database || 'local', |
| | |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'format', |
| | | label: '格式化', |
| | | tooltip: '使用千分位时,数值将以千分位格式显示,提交时为原数值。', |
| | | initVal: card.format || '', |
| | | forbid: appType === 'mob', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'thdSeparator', |
| | | text: '千分位' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | key: 'inputType', |
| | | label: '加密显示', |
| | | initVal: card.inputType || 'text', |
| | | tooltip: '输入框内容以 ****** 显示。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'interception', |
| | | label: '截取方式', |
| | | label: '文本预处理', |
| | | initVal: card.interception || 'true', |
| | | tooltip: '提交时的文本处理方式,空白字符指开头或结尾的空白字符。', |
| | | tooltip: '提交时的文本处理方式。注:全角转半角时会去除首尾空格', |
| | | options: [{ |
| | | value: 'false', |
| | | text: '无' |
| | | }, { |
| | | value: 'true', |
| | | text: '空白字符' |
| | | text: '去掉首尾空格' |
| | | // }, { |
| | | // value: 'char', |
| | | // text: '全角转半角' |
| | | }, { |
| | | value: 'charTure', |
| | | text: '全角转半角' |
| | | }, { |
| | | value: 'func', |
| | | text: '自定义函数' |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'mkfocus', |
| | | label: '聚焦时', |
| | | initVal: card.mkfocus || 'def', |
| | | options: [{ |
| | | value: 'def', |
| | | text: '默认' |
| | | }, { |
| | | value: 'check', |
| | | text: '全选' |
| | | }, { |
| | | value: 'clear', |
| | | text: '清空' |
| | | }], |
| | | forbid: appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sendType', |
| | | label: '发送方式', |
| | | initVal: card.sendType || 'local', |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'opacity', |
| | | label: '是否可见', |
| | | initVal: card.opacity || 'true', |
| | | tooltip: '不可见时仅用作表单分隔,不显示名称。', |
| | | required: false, |
| | | forbid: appType === 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '可见' |
| | | }, { |
| | | value: 'false', |
| | | text: '不可见' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'regularExtra', |
| | | label: '正则扩展符', |
| | | initVal: card.regularExtra || '', |
| | | tooltip: '正则验证时允许添加的自定义字符,包括~!@#$%^&*()_+:;{}<>,.-', |
| | | required: false, |
| | | readonly: false |
| | | readonly: false, |
| | | rules: [{ |
| | | pattern: /^[~!@#$%^&*()_+:;{}<>,.-]*$/, |
| | | message: '扩展符包括~!@#$%^&*()_+:;{}<>,.-' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | key: 'enter', |
| | | label: '回车事件', |
| | | initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'), |
| | | tooltip: '点击Enter键,或文本类表单输入回车符。', |
| | | tooltip: '1、点击Enter键或文本类表单输入回车符;2、下拉选择、时间、开关的选项切换。', |
| | | options: [{ |
| | | value: 'sub', |
| | | text: '提交' |
| | |
| | | options: roleList, |
| | | forbid: appType === 'mob' |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取子菜单基本信息表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {string} supMenu // 上级菜单ID |
| | | * @param {array} menus // 可选的上级菜单列表 |
| | | * @param {array} equalTab // 同级菜单IDs |
| | | * @param {array} equalTabs // 可选的同级菜单列表 |
| | | * @param {string} type // 菜单类型,主表或树形结构 |
| | | */ |
| | | export function getTabForm (card, supMenu, menus, equalTab, equalTabs, type) { |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '标签名称', |
| | | initVal: card.label || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: '上级标签', |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: '同级标签', |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'level', |
| | | label: '显示级别', |
| | | tooltip: '标签显示控制,选择指定级别时显示标签,级别为空时始终显示。', |
| | | initVal: card.level, |
| | | min: 0, |
| | | max: 10, |
| | | required: false, |
| | | forbid: type !== 'TreePage', |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchPass', |
| | | label: '主表搜索', |
| | | initVal: card.searchPass || 'false', |
| | | tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。', |
| | | required: false, |
| | | forbid: type !== 'CommonTable', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不使用' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取卡片详情表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {array} _columns // 显示列 |
| | | * @param {string} _type // 类型,卡片的部位 |
| | | * @param {array} _actions // 按钮列表 |
| | | */ |
| | | export function getCardDetailForm (card, _columns, _type, _actions = []) { |
| | | let actions = '' |
| | | if (_type === 'bottom') { |
| | | actions = card.actions ? card.actions.map(cell => cell.value) : [] |
| | | } else if (_type === 'header') { |
| | | _actions.unshift({ |
| | | value: '', |
| | | text: '空' |
| | | }) |
| | | actions = card.actions[0] ? card.actions[0].value : '' |
| | | } |
| | | return [ |
| | | { |
| | | type: 'radio', |
| | | key: 'datatype', |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'dynamic', |
| | | required: true, |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'dynamic', |
| | | text: '动态' |
| | | }, { |
| | | value: 'static', |
| | | text: '静态' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'type', |
| | | label: '类型', |
| | | initVal: card.type || 'picture', |
| | | required: true, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'icon', |
| | | text: '图标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'content', |
| | | label: '内容', |
| | | initVal: card.content || '', |
| | | required: _type !== 'header', |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'field', |
| | | label: '字段', |
| | | initVal: card.field || '', |
| | | required: true, |
| | | forbid: !['detail', 'header', 'avatar'].includes(_type), |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fontSize', |
| | | min: 12, |
| | | max: 50, |
| | | label: '字体大小', |
| | | initVal: card.fontSize || 14, |
| | | required: true, |
| | | forbid: !['detail'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'fontWeight', |
| | | label: '字体粗细', |
| | | initVal: card.fontWeight || 'normal', |
| | | required: true, |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '正常' |
| | | }, { |
| | | value: 'bold', |
| | | text: 'bold' |
| | | }, { |
| | | value: 'bolder', |
| | | text: 'bolder' |
| | | }, { |
| | | value: 'lighter', |
| | | text: 'lighter' |
| | | }, { |
| | | value: '100', |
| | | text: '100' |
| | | }, { |
| | | value: '200', |
| | | text: '200' |
| | | }, { |
| | | value: '300', |
| | | text: '300' |
| | | }, { |
| | | value: '400', |
| | | text: '400' |
| | | }, { |
| | | value: '500', |
| | | text: '500' |
| | | }, { |
| | | value: '600', |
| | | text: '600' |
| | | }, { |
| | | value: '700', |
| | | text: '700' |
| | | }, { |
| | | value: '800', |
| | | text: '800' |
| | | }, { |
| | | value: '900', |
| | | text: '900' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 10, |
| | | max: 100, |
| | | precision: 1, |
| | | label: '宽度(%)', |
| | | initVal: card.width || 100, |
| | | required: true, |
| | | forbid: !['detail', 'avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 1, |
| | | max: 10, |
| | | label: '高度(行)', |
| | | initVal: card.height || 1, |
| | | required: true, |
| | | forbid: !['detail'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'radius', |
| | | label: '圆角', |
| | | initVal: card.radius || 'true', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '有' |
| | | }, { |
| | | value: 'false', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'size', |
| | | label: '字体大小', |
| | | initVal: card.size || 28, |
| | | min: 12, |
| | | max: 500, |
| | | required: false, |
| | | hidden: true, |
| | | forbid: !['avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'align', |
| | | label: '对齐', |
| | | initVal: card.align || 'left', |
| | | required: false, |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'left', |
| | | text: '左' |
| | | }, { |
| | | value: 'align-center', |
| | | text: '居中' |
| | | }, { |
| | | value: 'align-right', |
| | | text: '右' |
| | | }] |
| | | }, |
| | | { |
| | | type: _type === 'bottom' ? 'multiselect' : 'select', |
| | | key: 'actions', |
| | | label: '按钮组', |
| | | tooltip: '', |
| | | initVal: actions, |
| | | required: false, |
| | | forbid: !['header', 'bottom'].includes(_type), |
| | | options: _actions |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: '显示', |
| | | initVal: card.show || 'icon', |
| | | required: false, |
| | | forbid: !['bottom', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'icon', |
| | | text: '图标' |
| | | }, { |
| | | value: 'text', |
| | | text: '文字' |
| | | }, { |
| | | value: 'all', |
| | | text: '全部' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示', |
| | | initVal: card.display || 'inline', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'block', |
| | | text: '整行' |
| | | }, { |
| | | value: 'inline', |
| | | text: '自动' |
| | | }] |
| | | }, |
| | | ] |
| | | } |