| | |
| | | * @description 获取显示列表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | | */ |
| | | export function getColumnForm (card, fields = [], columns = []) { |
| | | export function getColumnForm (card, fields = [], columns = [], wrap) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | |
| | | value: 'colspan', |
| | | text: '合并列' |
| | | }, { |
| | | value: 'extend', |
| | | text: '扩展列' |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | |
| | | let editCols = [ |
| | | // { |
| | | // field: '$sub', |
| | | // label: '提交' |
| | | // }, |
| | | { |
| | | field: '$sub', |
| | | label: '提交' |
| | | field: '$noAct', |
| | | label: '无动作' |
| | | }, |
| | | { |
| | | field: '$next', |
| | | label: '下一行' |
| | | }, |
| | | { |
| | | field: '$noAct', |
| | | label: '无动作' |
| | | } |
| | | ] |
| | | |
| | | if (card.enter === '$sub') { |
| | | card.enter = '$noAct' |
| | | } |
| | | if (wrap.commit === 'change') { |
| | | editCols[0].label = '失去焦点' |
| | | } |
| | | |
| | | let cols = [] |
| | | let getcols = (columns, suplabel = '') => { |
| | |
| | | label: col.label + '(下一行)' |
| | | }) |
| | | }) |
| | | |
| | | editCols.push({ |
| | | field: '$next_' + card.uuid, |
| | | label: card.label + '(下一行)' |
| | | }) |
| | | |
| | | if (wrap.commit === 'change') { |
| | | editCols.push({ |
| | | field: '$noActX', |
| | | label: '无动作', |
| | | disabled: card.editType !== 'select' |
| | | }) |
| | | } else if (card.enter === '$noActX') { |
| | | card.enter = '$noAct' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'colUnit', |
| | | label: '单位', |
| | | initVal: card.colUnit || 'day', |
| | | required: true, |
| | | options: [{ |
| | | value: 'day', |
| | | text: '天' |
| | | }, { |
| | | value: 'hour', |
| | | text: '小时' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'shift', |
| | | label: '偏移量', |
| | | initVal: card.shift || 0, |
| | | min: -1000, |
| | | max: 1000, |
| | | decimal: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'quota', |
| | | label: '指标数', |
| | | initVal: card.quota || 7, |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'dayFormat', |
| | | label: '格式化', |
| | | initVal: card.dayFormat || 'M/DD', |
| | | required: true, |
| | | options: [{ |
| | | value: 'M/DD', |
| | | label: 'M/DD(4/29)' |
| | | }, { |
| | | value: 'M-DD', |
| | | label: 'M-DD(4-29)' |
| | | }, { |
| | | value: 'M月DD日', |
| | | label: 'M月DD日(4月29日)' |
| | | }, { |
| | | value: 'M/DD week', |
| | | label: 'M/DD week(4/29 星期一)' |
| | | }, { |
| | | value: 'M-DD week', |
| | | label: 'M-DD week(4-29 星期一)' |
| | | }, { |
| | | value: 'M月DD日 week', |
| | | label: 'M月DD日 week(4月29日 星期一)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'hourFormat', |
| | | label: '格式化', |
| | | initVal: card.hourFormat || 'H:00', |
| | | required: true, |
| | | options: [{ |
| | | value: 'H:00', |
| | | label: 'H:00(15:00)' |
| | | }, { |
| | | value: 'H point', |
| | | label: 'H(15点)' |
| | | }, { |
| | | value: 'h:00', |
| | | label: 'h:00(3:00 pm)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'supField', |
| | | label: '上级字段', |
| | | initVal: card.supField || '', |
| | | tooltip: '来源于上级组件的字段集(上级组件为空时从url参数中选取),该字段值(用逗号分隔)可控制扩展列的列名。', |
| | | required: false, |
| | | rules: [{ |
| | | pattern: /^[0-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母以及_' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'editable', |
| | | label: '可编辑', |
| | | initVal: card.editable || 'false', |
| | |
| | | }, { |
| | | value: 'nvarchar(50)', |
| | | text: 'nvarchar(50)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: '必填', |
| | | initVal: card.required || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'showField', |
| | | label: '显示字段', |
| | | initVal: card.showField || '', |
| | | tooltip: '用于控制单元格中的显示内容。', |
| | | required: false, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '禁用字段', |
| | | initVal: card.controlField || '', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: '必填', |
| | | initVal: card.required || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: '数据库', |
| | | initVal: card.database || 'local', |
| | |
| | | key: 'enter', |
| | | label: '回车切换', |
| | | initVal: card.enter || '$noAct', |
| | | tooltip: '包括文本或数值回车事件、下拉菜单选中事件、开关切换事件。', |
| | | tooltip: '包括文本或数值回车事件、下拉菜单、选择器、时间变化事件、开关切换事件。', |
| | | options: editCols |
| | | }, |
| | | { |
| | |
| | | initVal: card.ctrlValue || '', |
| | | tooltip: '多个值用逗号分隔。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'clearField', |
| | | label: '清空字段', |
| | | initVal: card.clearField || '', |
| | | tooltip: '当前字段编辑时需要清空的字段。', |
| | | allowClear: true, |
| | | required: false, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | key: 'noValue', |
| | | label: '空值', |
| | | initVal: card.noValue || 'show', |
| | | tooltip: '当值为0时是否显示', |
| | | tooltip: '数值为 0 或时间小于 1949-10-02 时,是否显示', |
| | | required: false, |
| | | options: [{ |
| | | value: 'show', |