| | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | |
| | | const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | /** |
| | | * @description 获取显示列表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} menulist // 菜单列表-用于字段透视 |
| | | */ |
| | | export function getColumnForm (card, menulist = [], fields = []) { |
| | | export function getColumnForm (card, fields = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let menulist = [] |
| | | |
| | | if (appType === 'pc') { |
| | | menulist = sessionStorage.getItem('appMenus') |
| | | } else if (!appType) { |
| | | menulist = sessionStorage.getItem('fstMenuList') |
| | | } |
| | | |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch (e) { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | |
| | | let options = [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'number', |
| | | text: Formdict['model.form.number'] |
| | | }, { |
| | | value: 'picture', |
| | | text: Formdict['model.form.picture'] |
| | | }, { |
| | | value: 'link', |
| | | text: Formdict['model.form.href'] |
| | | }, { |
| | | value: 'textarea', |
| | | text: Formdict['model.form.textarea'] |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义列' |
| | | }, { |
| | | value: 'colspan', |
| | | text: '合并列' |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | |
| | | if (!card.isSub) { |
| | | options.push({ |
| | | value: 'action', |
| | | text: '操作' |
| | | }) |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | | |
| | | return [ |
| | |
| | | label: Formdict['model.form.type'], |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'number', |
| | | text: Formdict['model.form.number'] |
| | | }, { |
| | | value: 'picture', |
| | | text: Formdict['model.form.picture'] |
| | | }, { |
| | | value: 'link', |
| | | text: Formdict['model.form.href'] |
| | | }, { |
| | | value: 'textarea', |
| | | text: Formdict['model.form.textarea'] |
| | | }] |
| | | options: options |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'nameField', |
| | | label: Formdict['model.name'] + Formdict['model.form.field'], |
| | | initVal: card.nameField || '', |
| | | required: false, |
| | | options: [{uuid: 'empty', field: '', label: '空'}, ...fields] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | min: 1, |
| | | min: 20, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: Formdict['model.form.columnWidth'], |
| | | initVal: card.Width, |
| | | initVal: card.Width || 120, |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | label: Formdict['model.sort'], |
| | | initVal: card.IsSort || 'true', |
| | | required: true, |
| | | forbidden: card.isSub, |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | |
| | | key: 'rowspan', |
| | | label: '行合并', |
| | | initVal: card.rowspan || 'false', |
| | | tooltip: '相邻行信息相同时,单元格合并。注:为防止表格信息错乱,行合并只能添加一个字段。', |
| | | tooltip: '相邻行信息相同时,单元格合并。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | key: 'sum', |
| | | label: '显示合计', |
| | | initVal: card.sum || 'false', |
| | | tooltip: '合计信息只在使用系统数据源,且当前列未隐藏时有效。', |
| | | tooltip: '合计信息只在使用系统数据源时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: Formdict['model.form.field'] + Formdict['model.length'], |
| | | initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'format', |
| | | label: Formdict['header.form.format'], |
| | | initVal: card.format || '', |
| | | initVal: card.format || 'none', |
| | | options: [{ |
| | | value: '', |
| | | value: 'none', |
| | | text: Formdict['model.empty'] |
| | | }, { |
| | | value: 'thdSeparator', |
| | |
| | | type: 'select', |
| | | key: 'textFormat', |
| | | label: Formdict['header.form.format'], |
| | | initVal: card.textFormat || '', |
| | | initVal: card.textFormat || 'none', |
| | | options: [{ |
| | | value: '', |
| | | value: 'none', |
| | | text: Formdict['model.empty'] |
| | | }, { |
| | | value: 'YYYY-MM-DD', |
| | |
| | | key: 'postfix', |
| | | label: Formdict['header.form.postfix'], |
| | | initVal: card.postfix || '', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'maxHeight', |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '最大高度', |
| | | tooltip: '图片在表格中显示的最大高度', |
| | | tooltipClass: 'middle', |
| | | initVal: card.maxHeight || 128, |
| | | 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: 'picSort', |
| | | label: '图片排列', |
| | | initVal: card.picSort || '1', |
| | | tooltip: '同一单元格内,含有多张图片时的列数。', |
| | | required: false, |
| | | options: [{ |
| | | value: '1', |
| | | text: '1' |
| | | }, { |
| | | value: '2', |
| | | text: '2' |
| | | }, { |
| | | value: '3', |
| | | text: '3' |
| | | }, { |
| | | value: '4', |
| | | text: '4' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | type: 'radio', |
| | | key: 'perspective', |
| | | label: '字段透视', |
| | | initVal: card.perspective || 'linkmenu', |
| | | initVal: card.perspective || '', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'linkmenu', |
| | | text: '菜单' |
| | | }, { |
| | | value: 'linkurl', |
| | | text: '链接' |
| | | }] |
| | | }], |
| | | forbidden: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | type: appType === 'pc' ? 'select' : 'cascader', |
| | | key: 'linkmenu', |
| | | label: Formdict['model.menu'], |
| | | initVal: card.linkmenu || [], |
| | | required: false, |
| | | options: menulist |
| | | initVal: card.linkmenu || (appType === 'pc' ? '' : []), |
| | | required: true, |
| | | options: menulist, |
| | | forbidden: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | type: 'textarea', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: false |
| | | required: true, |
| | | forbidden: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkfields', |
| | | label: '关联字段', |
| | | initVal: card.linkfields || [], |
| | | required: false, |
| | | options: fields, |
| | | forbidden: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | required: false, |
| | | forbid: appType !== 'pc', |
| | | options: [ |
| | | { value: 'blank', text: '新窗口' }, |
| | | { value: 'self', text: '当前窗口' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'multiselect', |