| | |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, action = [], columns = []) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | const wrapForm = [ |
| | | // { |
| | | // type: 'text', |
| | | // field: 'title', |
| | | // label: '标题', |
| | | // initval: wrap.title || '', |
| | | // required: false |
| | | // }, |
| | | // { |
| | | // type: 'text', |
| | | // field: 'name', |
| | | // label: '组件名称', |
| | | // initval: wrap.name || '', |
| | | // tooltip: '用于组件间的区分。', |
| | | // required: true |
| | | // }, |
| | | // { |
| | | // type: 'number', |
| | | // field: 'width', |
| | | // label: '宽度', |
| | | // initval: wrap.width || 24, |
| | | // tooltip: '栅格布局,每行等分为24列。', |
| | | // min: 1, |
| | | // max: 24, |
| | | // precision: 0, |
| | | // required: true |
| | | // }, |
| | | { |
| | | type: 'number', |
| | | field: 'height', |
| | | label: '表格高度', |
| | | initval: wrap.height || '', |
| | | tooltip: '表格高度,空值时高度自适应。', |
| | | min: 10, |
| | | max: 3000, |
| | | precision: 0, |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'tableType', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'tableHeader', |
| | | label: '表头', |
| | | initval: wrap.tableHeader || 'show', |
| | | required: false, |
| | | options: [ |
| | | {value: 'show', label: '显示'}, |
| | | {value: 'hidden', label: '隐藏'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'collapse', |
| | | label: '可收起', |
| | | initval: wrap.collapse || 'false', |
| | | field: 'actionfixed', |
| | | label: '按钮固定', |
| | | initval: wrap.actionfixed || 'false', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | forbid: appType === 'mob' || appType === 'pc' |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'mode', |
| | | label: '模式', |
| | | initval: wrap.mode || 'default', |
| | | required: false, |
| | | options: [ |
| | | {value: 'default', label: '常规'}, |
| | | {value: 'ghost', label: '透明'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'selected', |
| | | label: '首行选中', |
| | | initval: wrap.selected || 'false', |
| | |
| | | {value: 'false', label: '无'}, |
| | | {value: 'init', label: '初始化'}, |
| | | {value: 'always', label: '数据加载'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'tableMode', |
| | | label: '加载模式', |
| | | initval: wrap.tableMode || 'compatible', |
| | | tooltip: '使用急速模式时,表格中的标记、双击事件、格式化、行合并、前缀、后缀、字段透视等效果将无效,且数据都会以文本格式显示。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'compatible', label: '兼容'}, |
| | | {value: 'fast', label: '急速'}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'height', |
| | | label: '表格高度', |
| | | initval: wrap.height || '', |
| | | tooltip: '表格高度,空值时高度自适应。', |
| | | min: 10, |
| | | max: 3000, |
| | | precision: 0, |
| | | required: false, |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'doubleClick', |
| | | label: '双击事件', |
| | |
| | | required: false, |
| | | allowClear: true, |
| | | options: action.map(item => ({value: item.uuid, label: item.label})), |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | initval: wrap.controlVal || '', |
| | | tooltip: '当字段值与禁用值相等时,行数据会禁用,多个值用逗号分隔。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'empty', |
| | | label: '空值隐藏', |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'supKey', |
| | | label: '上级主键', |
| | | initval: wrap.supKey || 'true', |
| | | tooltip: '当设置上级组件时,上级主键值为空是否进行数据查询。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '验证'}, |
| | | {value: 'false', label: '忽略'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | | initval: wrap.blacklist || [], |
| | | required: false, |
| | | options: roleList, |
| | | forbid: !!appType |
| | | }, |
| | | } |
| | | ] |
| | | |
| | | return wrapForm |