| | |
| | | /** |
| | | * @description 升级表单信息 |
| | | * @param {Object} config 表单配置信息 |
| | | * @return {Object} config |
| | | */ |
| | | export function updateForm (config) { |
| | | if (!config.version && config.groups) { |
| | | config.version = '1.0' |
| | | if (config.groups && config.groups.length > 0) { |
| | | let fields = [] |
| | | config.groups.forEach(group => { |
| | | if (group.sublist.length === 0) return |
| | | |
| | | if (!group.default) { |
| | | fields.push({ |
| | | type: 'split', |
| | | label: group.label, |
| | | uuid: group.uuid, |
| | | span: 24 |
| | | }) |
| | | } |
| | | |
| | | fields.push(...group.sublist) |
| | | }) |
| | | config.fields = fields |
| | | } |
| | | delete config.groups |
| | | |
| | | let _col = config.setting.cols || '2' |
| | | |
| | | config.fields = config.fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | | if (_col === '1' || item.entireLine === 'true' || ['textarea','hint','checkcard','brafteditor'].includes(item.type)) { |
| | | item.span = 24 |
| | | if (_col === '2') { |
| | | item.labelwidth = 16.3 |
| | | } else if (_col === '3') { |
| | | item.labelwidth = 10.5 |
| | | } else if (_col === '4') { |
| | | item.labelwidth = 8.3 |
| | | } |
| | | } else if (_col === '2') { |
| | | item.span = 12 |
| | | } else if (_col === '3') { |
| | | item.span = 8 |
| | | } else if (_col === '4') { |
| | | item.span = 6 |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | return config |
| | | } |
| | | |
| | | /** |
| | | * @description 升级主表信息 |
| | | * @param {Object} config 页面配置信息 |
| | | * @return {Object} config |
| | |
| | | config.action = config.action.map(item => { |
| | | if (item.execMode) { |
| | | item.OpenType = 'funcbutton' |
| | | } else if (item.OpenType === 'blank') { |
| | | item.OpenType = 'tab' |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (config.version < '2.0') { |
| | | config.version = '2.0' |
| | | // 去除传统table中的标签,调整数据结构 |
| | | if (config.charts && config.charts.length === 1) { |
| | | config.charts = null |
| | | } |
| | | } |
| | | |
| | | config.Template = 'CommonTable' |
| | |
| | | config.action = config.action.map(item => { |
| | | if (item.execMode) { |
| | | item.OpenType = 'funcbutton' |
| | | } else if (item.OpenType === 'blank') { |
| | | item.OpenType = 'tab' |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (config.version < '2.0') { |
| | | config.version = '2.0' |
| | | // 去除传统table中的标签,调整数据结构 |
| | | if (config.charts && config.charts.length === 1) { |
| | | config.charts = null |
| | | } |
| | | } |
| | | |
| | | config.Template = 'SubTable' |
| | | |
| | | return config |
| | | } |
| | | |
| | | /** |
| | | * @description 升级弹窗子表信息 |
| | | * @param {Object} config 页面配置信息 |
| | | * @return {Object} config |
| | | */ |
| | | export function updateSubTabTable (config) { |
| | | if (!config.version || config.version < '1.1') { |
| | | config.version = '1.1' |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc) { |
| | | config.setting.interType = 'system' |
| | | } |
| | | // 兼容接口类型 |
| | | config.action = config.action.map(item => { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | item.intertype = 'system' |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (config.version < '1.2') { |
| | | config.version = '1.2' |
| | | // 兼容功能按钮 |
| | | config.action = config.action.map(item => { |
| | | if (item.execMode) { |
| | | item.OpenType = 'funcbutton' |
| | | } else if (item.OpenType === 'blank') { |
| | | item.OpenType = 'tab' |
| | | } |
| | | return item |
| | | }) |