| | |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} roleList // 角色列表-黑名单 |
| | | */ |
| | | export function getChartViewForm (card, roleList = []) { |
| | | export function getChartViewForm (card, roleList = [], _columns) { |
| | | let _charts = [{ |
| | | value: 'line', |
| | | text: '折线图' |
| | |
| | | value: 'roll', |
| | | text: '滚动' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'bgfield', |
| | | label: '背景控制', |
| | | initVal: card.bgfield || '', |
| | | required: false, |
| | | readonly: false, |
| | | hidden: true, |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'dynamic', |
| | | required: true, |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'dynamic', |
| | | 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: true |
| | | required: true, |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: '字段', |
| | | initVal: card.field || '', |
| | | required: true, |
| | | forbid: !['detail', 'header', 'avatar'].includes(_type), |
| | | options: _columns |
| | | }, |
| | | { |
| | |
| | | label: '加粗', |
| | | initVal: card.bold || 'false', |
| | | required: true, |
| | | forbid: _type !== 'detail', |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | |
| | | label: '宽度', |
| | | initVal: card.width || '', |
| | | required: false, |
| | | forbid: _type !== 'detail', |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: '', |
| | | text: '100%' |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'widthType', |
| | | label: '宽度设置', |
| | | initVal: card.widthType || 'absolute', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'ratio', |
| | | text: '比例' |
| | | }, { |
| | | value: 'absolute', |
| | | text: '绝对值' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | label: '宽度值', |
| | | initVal: card.width || 32, |
| | | min: 1, |
| | | max: card.widthType === 'ratio' ? 100 : 500, |
| | | required: false, |
| | | hidden: true, |
| | | forbid: !['avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'size', |
| | | label: '字体大小', |
| | | initVal: card.size || 14, |
| | | min: 12, |
| | | max: 500, |
| | | required: false, |
| | | hidden: true, |
| | | forbid: !['avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'align', |
| | | label: '对齐', |
| | | initVal: card.align || '', |
| | | initVal: card.align || 'left', |
| | | required: false, |
| | | forbid: _type !== 'detail', |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: '', |
| | | value: 'left', |
| | | text: '左' |
| | | }, { |
| | | value: 'align-center', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: '显示', |
| | | initVal: card.show || '', |
| | | required: false, |
| | | forbid: !['bottom'].includes(_type), |
| | | options: [{ |
| | | value: 'icon', |
| | | text: '图标' |
| | | }, { |
| | | value: 'text', |
| | | text: '文字' |
| | | }, { |
| | | value: 'all', |
| | | text: '全部' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'actions', |
| | | label: '按钮组', |
| | | tooltip: '', |
| | | initVal: card.actions || [], |
| | | initVal: card.actions ? card.actions.map(cell => cell.value) : [], |
| | | required: false, |
| | | forbid: _type !== 'header', |
| | | forbid: !['header', 'bottom'].includes(_type), |
| | | options: _actions |
| | | }, |
| | | ] |