| | |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { formRule } from '@/utils/option.js' |
| | | |
| | | const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | /** |
| | | * @description 获取树形页面设置表单配置信息 |
| | |
| | | } |
| | | |
| | | let refresh = [] |
| | | |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | | if (card.focus) { |
| | | card.popClose = 'maingrid' |
| | | } |
| | | refresh.push({ |
| | | value: 'maingrid', |
| | | text: Formdict['header.form.refresh.maingrid'] |
| | |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '按钮名称', |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'procMode', |
| | | label: '参数处理', |
| | |
| | | initVal: card.sqlType || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '按钮名称', |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'url', |
| | | label: Formdict['model.form.newpage.url'], |
| | | label: Formdict['model.pageUrl'], |
| | | initVal: card.url || '', |
| | | required: true |
| | | }, |
| | |
| | | { |
| | | type: 'textarea', |
| | | key: 'interface', |
| | | label: Formdict['header.form.interface'], |
| | | label: '测试地址', |
| | | initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), |
| | | required: true, |
| | | readonly: card.sysInterface === 'true' |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '跨域请求', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || 'script', |
| | | tooltip: '使用默认方式执行时,需要配合计划任务。', |
| | | tooltip: '使用后台脚本执行时,需要配合计划任务。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'default', |
| | | text: '默认脚本' |
| | | }, { |
| | | value: 'script', |
| | | text: '自定义脚本' |
| | | }, { |
| | | value: 'default', |
| | | text: '后台脚本' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} menulist // 菜单列表-用于字段透视 |
| | | */ |
| | | export function getColumnForm (card, menulist = []) { |
| | | export function getColumnForm (card, menulist = [], fields = []) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | | |
| | | return [ |
| | |
| | | }, { |
| | | value: 'textarea', |
| | | text: Formdict['model.form.textarea'] |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | type: 'radio', |
| | | key: 'perspective', |
| | | label: '字段透视', |
| | | initVal: card.perspective || 'linkmenu', |
| | | initVal: card.perspective || '', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'linkmenu', |
| | | text: '菜单' |
| | | }, { |
| | |
| | | key: 'linkmenu', |
| | | label: Formdict['model.menu'], |
| | | initVal: card.linkmenu || [], |
| | | required: false, |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'text', |
| | | type: 'textarea', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkfields', |
| | | label: '关联字段', |
| | | initVal: card.linkfields || [], |
| | | required: false, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | }) |
| | | } |
| | | |
| | | if (['textarea', 'fileupload', 'multiselect', 'checkbox', 'brafteditor'].includes(card.type)) { |
| | | if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) { |
| | | _fieldlength = 512 |
| | | } else if (['textarea', 'brafteditor'].includes(card.type)) { |
| | | _fieldlength = 8000 |
| | | } |
| | | |
| | | return [ |
| | |
| | | value: 'textarea', |
| | | text: Formdict['model.form.textarea'] |
| | | }, { |
| | | value: 'hint', |
| | | text: '提示' |
| | | }, { |
| | | value: 'color', |
| | | text: Formdict['model.form.color'] |
| | | }, { |
| | |
| | | }, { |
| | | value: 'funcvar', |
| | | text: Formdict['header.form.funcvar'] |
| | | }, { |
| | | value: 'hint', |
| | | text: '提示' |
| | | }, { |
| | | value: 'split', |
| | | text: '分隔线' |
| | | }, |
| | | ..._openType] |
| | | }, |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '卡片宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | min: 0, |
| | | max: 18, |
| | | precision: 0, |
| | | label: Formdict['header.form.decimal'], |
| | | initVal: card.decimal || 0, |
| | | required: true |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | min: 1, |
| | | max: 1000000, |
| | | precision: 0, |
| | | label: Formdict['model.form.field'] + Formdict['model.length'], |
| | | tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512', |
| | | initVal: card.fieldlength || _fieldlength, |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'maxRows', |
| | | min: 2, |
| | | max: 100, |
| | | precision: 0, |
| | | label: Formdict['header.form.maxRows'], |
| | | initVal: card.maxRows || 6, |
| | | required: false |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'maxfile', |
| | | min: 1, |
| | | max: 1000000, |
| | | precision: 0, |
| | | label: '最大文件数', |
| | | initVal: card.maxfile || '', |
| | | required: false |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'entireLine', |
| | | label: '占据整行', |
| | | initVal: card.entireLine || 'false', |
| | | required: false, |
| | | key: 'declareType', |
| | | label: '数据类型', |
| | | tooltip: '声明变量时的类型,时间格式datetime或文本格式nvarchar(50)。', |
| | | initVal: card.declareType || 'datetime', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | value: 'datetime', |
| | | text: 'datetime' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | value: 'nvarchar(50)', |
| | | text: 'nvarchar(50)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'span', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '表单宽度', |
| | | initVal: card.span || (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type) ? 24 : 12), |
| | | tooltip: '栅格布局整行24等分。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'labelwidth', |
| | | min: 1, |
| | | max: 100, |
| | | precision: 1, |
| | | label: '名称宽度', |
| | | initVal: card.labelwidth || 33.3, |
| | | tooltip: '名称占据表单宽度的百分比。注:存在多列表单时,当前表单如果想要占据整行可参照以下比例,两列(16.2)、三列(10.5)、四列(7.7)', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'interception', |
| | | label: '截取', |
| | | label: '截取空格', |
| | | initVal: card.interception || 'false', |
| | | tooltip: '提交时,是否截取首尾的空白字符。', |
| | | options: [{ |
| | |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'extra', |
| | | label: '底部提示', |
| | | tooltip: '显示于表单底部。', |
| | | initVal: card.extra || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'emptyText', |
| | | label: '空值文本', |
| | | tooltip: '空值的提示文本,选择设置空值时有效,默认值为《空》。', |