| | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { formRule } from '@/utils/option.js' |
| | | import { formRule, btnClasses } from '@/utils/option.js' |
| | | |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let options = card.options || [] |
| | | if (['select', 'link'].includes(card.type) && card.setAll === 'true') { // 兼容 |
| | | options.unshift({ |
| | | key: 'empty', |
| | | Value: '', |
| | | Text: '全部', |
| | | ParentID: '' |
| | | }) |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: Formdict['model.name'], |
| | | initVal: card.label || '', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: Formdict['model.form.field'], |
| | | initVal: card.field || '', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | key: 'datefield', |
| | | label: '时间字段', |
| | | initVal: card.datefield || '', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'resourceType', |
| | | label: Formdict['header.form.resourceType'], |
| | | label: '选项来源', |
| | | initVal: card.resourceType || '0', |
| | | required: true, |
| | | options: [{ |
| | |
| | | text: Formdict['header.form.datasource'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'setAll', |
| | | label: Formdict['header.form.setAll'], |
| | | initVal: card.setAll || 'true', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'setAll', |
| | | // label: '设置全部', |
| | | // initVal: card.setAll || 'true', |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: Formdict['model.true'] |
| | | // }, { |
| | | // value: 'false', |
| | | // text: Formdict['model.false'] |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'cardValField', |
| | | label: Formdict['header.form.valueField'], |
| | | label: '值·字段', |
| | | initVal: card.cardValField || 'Value', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlField', |
| | | label: '地址字段', |
| | | initVal: card.urlField || '', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | key: 'fields', |
| | | label: '字段集', |
| | | initVal: card.fields || [], |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'dataSource', |
| | | label: Formdict['header.form.datasource'], |
| | | initVal: card.dataSource || '', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'options', |
| | | key: 'options', |
| | | label: '选项', |
| | | initVal: card.options || [], |
| | | required: true, |
| | | readonly: false |
| | | initVal: options, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'checkbox', |
| | |
| | | label: '选项', |
| | | initVal: card.items || ['day', 'week', 'month', 'quarter', 'year', 'customized'], |
| | | required: true, |
| | | readonly: false, |
| | | options: [{ |
| | | value: 'day', |
| | | label: '日' |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '选择形式', |
| | | initVal: card.multiple || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '单选' |
| | | }, { |
| | | value: 'true', |
| | | text: '多选' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkField', |
| | | label: Formdict['header.form.linkField'], |
| | | label: '关联字段', |
| | | initVal: card.linkField || '', |
| | | required: true, |
| | | readonly: false, |
| | | allowClear: true, |
| | | options: linkableFields |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: Formdict['header.form.valueField'], |
| | | label: '值·字段', |
| | | initVal: card.valueField || '', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueText', |
| | | label: Formdict['header.form.valueText'], |
| | | label: '文本·字段', |
| | | initVal: card.valueText || '', |
| | | required: true, |
| | | readonly: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'orderBy', |
| | | label: Formdict['header.form.orderBy'], |
| | | label: '排序·字段', |
| | | initVal: card.orderBy || '', |
| | | required: false, |
| | | readonly: false |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'orderType', |
| | | label: Formdict['header.form.orderType'], |
| | | label: '排序方式', |
| | | initVal: card.orderType || 'asc', |
| | | options: [{ |
| | | value: 'asc', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: Formdict['header.form.database'], |
| | | label: '数据库', |
| | | initVal: card.database || 'local', |
| | | options: [{ |
| | | value: 'local', |
| | | text: Formdict['header.form.database.local'] |
| | | text: '本地' |
| | | }, { |
| | | value: 'sso', |
| | | text: Formdict['header.form.database.sso'] |
| | | text: '系统' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | initVal: card.ratio || 6, |
| | | forbid: appType === 'mob', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '可多选', |
| | | initVal: card.multiple || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = []) { |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | |
| | | card.popClose = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'outerpage') { |
| | | card.pageTemplate = 'custom' |
| | | card.OpenType = 'innerpage' |
| | | } |
| | | |
| | | let refresh = [] |
| | | |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | |
| | | } |
| | | refresh.push({ |
| | | value: 'maingrid', |
| | | text: Formdict['header.form.refresh.maingrid'] |
| | | text: '刷新主表(行)' |
| | | }, { |
| | | value: 'equaltab', |
| | | text: Formdict['header.form.refresh.equaltab'] |
| | | text: '刷新同级标签' |
| | | }) |
| | | } |
| | | |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'funcType', |
| | | label: Formdict['header.form.funcType'], |
| | | label: '功能类型', |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: [{ |
| | | value: 'changeuser', |
| | | text: Formdict['header.form.func.changeuser'] |
| | | text: '切换用户' |
| | | }, { |
| | | value: 'print', |
| | | text: '标签打印' |
| | |
| | | initVal: card.innerFunc || '', |
| | | tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始。`, |
| | | fields: usefulFields, |
| | | tooltipClass: 'middle', |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | options: [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ...tabs |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'position', |
| | | label: Formdict['header.form.position'], |
| | | label: '显示位置', |
| | | initVal: card.position || 'toolbar', |
| | | required: true, |
| | | options: [{ |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: Formdict['model.icon'], |
| | | initVal: card.icon, |
| | | required: false, |
| | | options: [] |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: Formdict['model.form.color'], |
| | | initVal: card.class, |
| | | required: false, |
| | | options: [] |
| | | options: btnClasses |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'pagination', |
| | | label: Formdict['header.form.pagination'], |
| | | label: '分页', |
| | | initVal: card.pagination || 'false', |
| | | required: false, |
| | | options: [{ |
| | |
| | | type: 'number', |
| | | key: 'ratio', |
| | | min: 1, |
| | | max: 24, |
| | | max: 3000, |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | |
| | | key: 'placement', |
| | | label: '抽屉方向', |
| | | initVal: card.placement || 'right', |
| | | tooltip: '使用抽屉时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'right', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'clickouter', |
| | | label: '点击蒙层', |
| | | initVal: card.clickouter || 'unclose', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unclose', |
| | | text: '不关闭' |
| | | }, { |
| | | value: 'close', |
| | | text: '关闭' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'preFunc', |
| | | label: '前置函数', |
| | | initVal: card.preFunc || '', |
| | | tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始;前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。`, |
| | | fields: usefulFields, |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | |
| | | text: Formdict['model.empty'] |
| | | }, { |
| | | value: 'thdSeparator', |
| | | text: Formdict['header.form.thdSeparator'] |
| | | text: '千分位' |
| | | }, { |
| | | value: 'percent', |
| | | text: '百分比' |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'scale', |
| | | label: Formdict['header.form.clickscale'], |
| | | initVal: card.scale || 'false', |
| | | label: '点击缩放', |
| | | initVal: card.scale || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | readonly: !(setting.laypage === 'false'), |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [ |
| | | { value: 'query', text: Formdict['header.form.query'] }, |
| | | { value: 'statistics', text: Formdict['header.form.statistics'] } |
| | | { value: 'query', text: '查询' }, |
| | | { value: 'statistics', text: '统计' } |
| | | ] |
| | | }, |
| | | { |
| | |
| | | text: '分隔线' |
| | | }, { |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | text: '关联主表' |
| | | }] |
| | | |
| | | let _fieldlength = 50 |
| | |
| | | _fieldlength = 8000 |
| | | } |
| | | |
| | | let options = card.options || [] |
| | | if (['select', 'radio', 'link'].includes(card.type) && card.setAll === 'true') { // 兼容 |
| | | options.unshift({ |
| | | key: 'empty', |
| | | Value: '', |
| | | Text: card.emptyText || '空', |
| | | ParentID: '' |
| | | }) |
| | | } |
| | | |
| | | let initval = card.initval || '' |
| | | if (card.type === 'switch') { |
| | | initval = card.initval === true |
| | | } else if (card.type === 'number') { |
| | | initval = card.initval || 0 |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: Formdict['header.form.initval'], |
| | | tooltip: '下拉多选与多选框,添加多个初始值请使用“,”号分隔。注:下拉选择、联动菜单或单选框中$first表示选择第一项', |
| | | initVal: card.initval || '', |
| | | initVal: initval, |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | key: 'openText', |
| | | label: '开启提示', |
| | | initVal: card.openText || '', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'closeText', |
| | | label: '关闭提示', |
| | | initVal: card.closeText || '', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resourceType', |
| | | label: Formdict['header.form.resourceType'], |
| | | label: '选项来源', |
| | | initVal: card.resourceType || '0', |
| | | required: true, |
| | | options: [{ |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'cardValField', |
| | | label: Formdict['header.form.valueField'], |
| | | label: '值·字段', |
| | | initVal: card.cardValField || 'Value', |
| | | required: true, |
| | | readonly: false |
| | |
| | | text: '16:9' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'setAll', |
| | | label: '设置空值', |
| | | initVal: card.setAll || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'setAll', |
| | | // label: '设置空值', |
| | | // initVal: card.setAll || 'false', |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: Formdict['model.true'] |
| | | // }, { |
| | | // value: 'false', |
| | | // text: Formdict['model.false'] |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'fields', |
| | | key: 'fields', |
| | |
| | | type: 'options', |
| | | key: 'options', |
| | | label: '选项', |
| | | initVal: card.options || [], |
| | | initVal: options, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '选择形式', |
| | | initVal: card.multiple || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '单选' |
| | | }, { |
| | | value: 'true', |
| | | text: '多选' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkField', |
| | | label: Formdict['header.form.linkField'], |
| | | label: '关联字段', |
| | | initVal: card.linkField || '', |
| | | required: true, |
| | | readonly: false, |
| | | allowClear: true, |
| | | options: linkableFields |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: Formdict['header.form.valueField'], |
| | | label: '值·字段', |
| | | initVal: card.valueField || '', |
| | | required: true, |
| | | readonly: false |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'valueText', |
| | | label: Formdict['header.form.valueText'], |
| | | label: '文本·字段', |
| | | initVal: card.valueText || '', |
| | | required: true, |
| | | readonly: false |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'orderBy', |
| | | label: Formdict['header.form.orderBy'], |
| | | label: '排序·字段', |
| | | initVal: card.orderBy || '', |
| | | required: false, |
| | | readonly: false |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'orderType', |
| | | label: Formdict['header.form.orderType'], |
| | | label: '排序方式', |
| | | initVal: card.orderType || 'asc', |
| | | options: [{ |
| | | value: 'asc', |
| | |
| | | tooltip: '设置禁用字段,且字段值为true时,选项不可选。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '可多选', |
| | | initVal: card.multiple || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | min: 1, |
| | | max: 1000000, |
| | | max: 100000, |
| | | precision: 0, |
| | | label: Formdict['model.form.field'] + Formdict['model.length'], |
| | | tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512', |
| | | // tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512', |
| | | initVal: card.fieldlength || _fieldlength, |
| | | required: false |
| | | }, |
| | |
| | | min: 1, |
| | | max: 100, |
| | | precision: 0, |
| | | label: appType === 'mob' ? '行数' : Formdict['header.form.maxRows'], |
| | | label: appType === 'mob' ? '行数' : '最大行数', |
| | | tooltip: appType === 'mob' ? '行数为空时,高度自适应' : '', |
| | | initVal: card.maxRows || (appType === 'mob' ? '' : 6), |
| | | required: false |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'regular', |
| | | label: Formdict['header.form.regular'], |
| | | label: '正则校验', |
| | | initVal: card.regular || '', |
| | | options: [{ |
| | | value: '', |
| | |
| | | text: Formdict['header.form.letter'] |
| | | }, { |
| | | value: 'letter&number', |
| | | text: Formdict['header.form.letter&number'] |
| | | text: '字母+数字' |
| | | }, { |
| | | value: 'phone', |
| | | text: '手机号' |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'readonly', |
| | | label: Formdict['header.form.readonly'], |
| | | label: '只读', |
| | | initVal: card.readonly || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: Formdict['header.form.database'], |
| | | label: '数据库', |
| | | initVal: card.database || 'local', |
| | | options: [{ |
| | | value: 'local', |
| | | text: Formdict['header.form.database.local'] |
| | | text: '本地' |
| | | }, { |
| | | value: 'sso', |
| | | text: Formdict['header.form.database.sso'] |
| | | text: '系统' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'readin', |
| | | label: Formdict['header.form.readin'], |
| | | label: '自动填充', |
| | | tooltip: '是否将表格选中的数据自动填充到表单(字段相同)', |
| | | initVal: card.readin || 'true', |
| | | options: [{ |
| | |
| | | type: 'select', |
| | | key: 'supField', |
| | | label: '上级表单', |
| | | tooltip: '上级表单为下拉选择、联动菜单、单选框及多选框,添加后该表单显示及隐藏将受上级表单控制,注:受控关系在该表单隐藏时失效。', |
| | | tooltip: '该表单显示或隐藏受上级表单控制。', |
| | | initVal: card.supField || '', |
| | | required: false, |
| | | readonly: false, |
| | | allowClear: true, |
| | | options: linksupFields |
| | | }, |
| | | { |
| | |
| | | label: '显示值', |
| | | tooltip: '请填写显示值,只有上级表单值与显示值相同时,该表单才会显示,注:1、多个值用逗号分隔;2、上级表单初始值为$first时暂未处理。', |
| | | initVal: card.supvalue || '', |
| | | required: true, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | initVal: card.placeholder || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'emptyText', |
| | | label: '空值文本', |
| | | tooltip: '空值的提示文本,选择设置空值时有效,默认值为《空》。', |
| | | initVal: card.emptyText || '', |
| | | required: false |
| | | }, |
| | | // { |
| | | // type: 'text', |
| | | // key: 'emptyText', |
| | | // label: '空值文本', |
| | | // tooltip: '空值的提示文本,选择设置空值时有效,默认值为《空》。', |
| | | // initVal: card.emptyText || '', |
| | | // required: false |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'enter', |
| | |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['model.form.linkform'], |
| | | tooltip: '在切换选项时会把信息自动填入关联的表单(文本或数字表单)中。注:使用选项卡且设为可多选时无效。', |
| | | label: '填充表单', |
| | | tooltip: '在切换选项时会把信息自动填入关联的表单(文本或数字表单)中。', |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | }, |
| | |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: Formdict['model.icon'], |
| | | initVal: card.icon || '', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: Formdict['model.empty'] |
| | | }, { |
| | | value: 'table', |
| | | text: 'table' |
| | | }, { |
| | | value: 'bar-chart', |
| | | text: 'bar-chart' |
| | | }, { |
| | | value: 'pie-chart', |
| | | text: 'pie-chart' |
| | | }, { |
| | | value: 'line-chart', |
| | | text: 'line-chart' |
| | | }], |
| | | forbid: type === 'CalendarPage' |
| | | }, |
| | | { |