| | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | /** |
| | | * @description 获取图表视图配置表单 |
| | | * @param {object} card // 图表对象 |
| | | */ |
| | | export function getBaseForm (card) { |
| | | export function getBaseForm (card, columns = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let isprint = sessionStorage.getItem('MenuType') === 'billPrint' |
| | | let ispop = sessionStorage.getItem('editMenuType') === 'popview' |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let menulist = [] |
| | | |
| | | if (appType === 'pc') { |
| | | menulist = sessionStorage.getItem('appMenus') |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch (e) { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | } else if (appType === '') { |
| | | menulist = sessionStorage.getItem('fstMenuList') |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch (e) { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | } |
| | | |
| | | return [ |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | type: 'styleInput', |
| | | key: 'height', |
| | | label: '高度', |
| | | label: '图表高度', |
| | | initVal: card.height, |
| | | min: 100, |
| | | max: 1000, |
| | | decimal: 0, |
| | | required: true |
| | | tooltip: '图表绘图区域的高度,不包括标题及内外边距。', |
| | | required: true, |
| | | options: ['px', 'vh', 'vw'] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | {value: 'true', text: '启用'}, |
| | | {value: 'false', text: '禁用'}, |
| | | ], |
| | | forbid: !appType |
| | | forbid: !appType || ispop || isprint |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cacheLocal', |
| | | label: '本地缓存', |
| | | initVal: card.cacheLocal || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', text: '继承菜单'}, |
| | | {value: 'false', text: '禁用'}, |
| | | ], |
| | | forbid: ispop || isprint |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | multi: true, |
| | | required: false, |
| | | options: roleList, |
| | | forbid: !!appType |
| | | forbid: !!appType || isprint |
| | | }, |
| | | // { |
| | | // type: 'cascader', |
| | | // key: 'linkmenu', |
| | | // label: '关联菜单', |
| | | // initVal: card.linkmenu || [], |
| | | // tooltip: '在使用柱形图且未启用自定义设置时有效。', |
| | | // required: false, |
| | | // forbid: appType === 'pc' || appType === 'mob', |
| | | // options: menulist |
| | | // }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'linkmenu', |
| | | // label: '关联菜单', |
| | | // initVal: card.linkmenu || '', |
| | | // tooltip: '双击柱状图,会打开关联的菜单。', |
| | | // required: false, |
| | | // forbid: appType !== 'pc', |
| | | // options: menulist |
| | | // }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'open', |
| | | // label: '打开方式', |
| | | // initVal: card.open || 'blank', |
| | | // required: false, |
| | | // forbid: appType !== 'pc', |
| | | // options: [ |
| | | // { value: 'blank', text: '新窗口' }, |
| | | // { value: 'self', text: '当前窗口' } |
| | | // ] |
| | | // } |
| | | { |
| | | type: 'radio', |
| | | key: 'click', |
| | | label: '点击事件', |
| | | initVal: card.click || '', |
| | | tooltip: '点击柱子时触发的事件,启用自定义设置时无效。', |
| | | required: false, |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | options: [ |
| | | {value: '', label: '数据切换'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'menus', label: '菜单组'} |
| | | ] |
| | | }, |
| | | { |
| | | type: appType === '' ? 'cascader' : 'select', |
| | | key: 'menu', |
| | | label: '关联菜单', |
| | | initVal: card.menu || (appType === '' ? [] : ''), |
| | | tooltip: '在使用柱形图且未启用自定义设置时有效。', |
| | | required: true, |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menu', |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'menuType', |
| | | label: '菜单类型', |
| | | initVal: card.menuType || '', |
| | | required: true, |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menus', |
| | | options: columns, |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | required: false, |
| | | options: [ |
| | | {value: 'blank', label: '新窗口'}, |
| | | {value: 'self', label: '当前窗口'}, |
| | | ], |
| | | forbid: appType !== 'pc' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menu' && card.click !== 'menus' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '参数拼接', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menu' && card.click !== 'menus' |
| | | }, |
| | | { |
| | | type: 'table', |
| | | key: 'menus', |
| | | label: '菜单组', |
| | | initVal: card.menus || [], |
| | | required: true, |
| | | span: 24, |
| | | actions: ['view'], |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menus', |
| | | columns: [ |
| | | { |
| | | title: '标识', |
| | | dataIndex: 'sign', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | required: false, |
| | | width: '35%' |
| | | }, |
| | | { |
| | | title: '菜单', |
| | | dataIndex: 'menu', |
| | | inputType: !appType ? 'cascader' : 'select', |
| | | editable: true, |
| | | required: true, |
| | | extends: !appType ? 'Menu' : [{key: 'label', value: 'label'}], |
| | | width: '35%', |
| | | render: (text, record) => record.label, |
| | | options: menulist |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | |
| | |
| | | |
| | | 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' } |
| | | { 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' } |
| | | { 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(角锥)' } |
| | | ] |
| | | } |
| | | |
| | |
| | | text: '底部' |
| | | }]) |
| | | } |
| | | |
| | | let _label = card.label || 'false' |
| | | |
| | | return [ |
| | | { |
| | |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | text: '否' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: '显示', |
| | | initVal: card.show || 'value', |
| | | tooltip: '当使用自定义设置时,可在显示(值/%)处单独设置显示类型。注:自定义为空时使用此处设置。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'value', |
| | |
| | | }, { |
| | | type: labelOptions.length > 20 ? 'select' : 'radio', |
| | | key: 'label', |
| | | label: '标签', |
| | | initVal: card.label || 'false', |
| | | label: '标注', |
| | | initVal: _label, |
| | | tooltip: '图形节点处的数值。', |
| | | required: false, |
| | | options: labelOptions |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelColor', |
| | | label: '标签颜色', |
| | | label: '标注颜色', |
| | | initVal: card.labelColor || 'system', |
| | | tooltip: '使用系统色时,使用色系选项设置的系统颜色,使用自定义为颜色设置中定义的图形颜色。', |
| | | required: false, |
| | | hidden: _label !== 'true', |
| | | options: [{ |
| | | value: 'system', |
| | | text: '系统' |
| | |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | // }, { |
| | | // type: 'radio', |
| | | // key: 'offset', |
| | | // label: '标注位置', |
| | | // initVal: card.offset || 'outer', |
| | | // required: false, |
| | | // options: [{ |
| | | // value: 'outer', |
| | | // text: '外部' |
| | | // }, { |
| | | // value: 'inner', |
| | | // text: '内部' |
| | | // }], |
| | | // forbid: card.chartType !== 'bar' |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelValue', |
| | | label: '标注值', |
| | | initVal: card.labelValue || 'default', |
| | | tooltip: '标注值的显示规则。', |
| | | required: false, |
| | | hidden: _label === 'false', |
| | | options: [{ |
| | | value: 'default', |
| | | text: '默认' |
| | | }, { |
| | | value: 'zero', |
| | | text: '隐藏 0 值' |
| | | }], |
| | | }, { |
| | | type: 'radio', |
| | | key: 'adjust', |
| | |
| | | initVal: card.max, |
| | | required: false |
| | | }, { |
| | | type: 'number', |
| | | key: 'XLimit', |
| | | min: 2, |
| | | label: '字符限制', |
| | | tooltip: 'X轴最大字符限制。', |
| | | initVal: card.XLimit || 11, |
| | | forbid: appType === 'mob', |
| | | required: false |
| | | }, { |
| | | type: 'color', |
| | | key: 'color', |
| | | label: '色系', |