| | |
| | | export function getTreeSettingForm (setting, usefulFields = [], MenuID) { |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | let rules = [{ |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | |
| | | if (usefulFields.length > 0) { |
| | | rules.push({ |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }) |
| | | } |
| | | |
| | | return [ |
| | | { |
| | |
| | | key: 'innerFunc', |
| | | label: Formdict['header.form.innerFunc'], |
| | | initVal: setting.innerFunc || '', |
| | | tooltip: '开头可用字符:' + usefulFields.join(', '), |
| | | tooltip: usefulFields.length ? '开头可用字符:' + usefulFields.join(', ') : '', |
| | | placement: 'bottomLeft', |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | rules: rules |
| | | }, |
| | | { |
| | | type: 'datasource', |
| | |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} linkableFields // 可关联字段 |
| | | */ |
| | | export function getSearchForm (card, linkableFields) { |
| | | export function getSearchForm (card, linkableFields, columns) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | if (roleList) { |
| | |
| | | let typeOptions = [] |
| | | |
| | | if (appType === 'mob') { |
| | | // let adapters = sessionStorage.getItem('adapter') |
| | | // if (adapters) { |
| | | // adapters = adapters.split(',') |
| | | // } else { |
| | | // adapters = [] |
| | | // } |
| | | // (adapters.includes('wxmini') ? '(小程序暂不支持)' : '') |
| | | |
| | | typeOptions = [{ |
| | | value: 'range', |
| | | text: '数值(区间)' |
| | |
| | | // value: 'daterange', |
| | | // text: Formdict['model.form.daterange'] |
| | | }] |
| | | |
| | | } else { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | |
| | | key: 'field', |
| | | label: Formdict['model.form.field'], |
| | | initVal: card.field || '', |
| | | required: true |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'color', |
| | | text: '色块' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | type: 'codemirror', |
| | | key: 'dataSource', |
| | | label: Formdict['header.form.datasource'], |
| | | initVal: card.dataSource || '', |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'labelwidth', |
| | | min: 1, |
| | | max: 100, |
| | | precision: 1, |
| | | label: '名称宽度', |
| | | initVal: card.labelwidth || 33.3, |
| | | tooltip: '名称占据搜索条件宽度的百分比。注:存在多列搜索时,当前搜索如果想要占据整行可参照以下比例,两列(16.5)、三列(10.8)、四列(8)', |
| | | required: true, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'precision', |
| | | label: '精确度', |
| | | initVal: card.precision || 'day', |
| | | options: [{ |
| | | value: 'day', |
| | | text: '天' |
| | | }, { |
| | | value: 'hour', |
| | | text: '小时' |
| | | }, { |
| | | value: 'minute', |
| | | text: '分钟' |
| | | }, { |
| | | value: 'second', |
| | | text: '秒' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: Formdict['model.required'], |
| | |
| | | key: 'advanced', |
| | | label: '高级搜索', |
| | | initVal: card.advanced || 'false', |
| | | tooltip: '在隐藏搜索按钮时,高级搜索无效。', |
| | | forbid: appType === 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'selectStyle', |
| | | label: '选中效果', |
| | | tooltip: '背景及文字变化时会使用系统色。', |
| | | initVal: card.selectStyle || (card.backgroundColor ? 'custom' : 'background'), |
| | | options: [{ |
| | | value: 'background', |
| | | text: '背景变化' |
| | | }, { |
| | | value: 'font', |
| | | text: '文字变化' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | tooltip: '设置背景色后,选中效果由背景颜色控制。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'borderColor', |
| | | label: '边框颜色', |
| | | initVal: card.borderColor || '', |
| | | required: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | label: Formdict['header.form.blacklist'], |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList || [] |
| | | options: roleList || [], |
| | | forbid: appType === 'mob' |
| | | } |
| | | ] |
| | | } |
| | |
| | | */ |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | usefulFields = [] |
| | | |
| | | let opentypes = [ |
| | | { |
| | |
| | | }, { |
| | | value: 'closetab', |
| | | text: '标签关闭' |
| | | }, { |
| | | value: 'megvii', |
| | | text: '旷视面板机' |
| | | }, { |
| | | value: 'filezip', |
| | | text: '文件压缩包' |
| | | }] |
| | | }, |
| | | { // 旷视面板机接口 待扩展 |
| | | type: 'radio', |
| | | key: 'subFunc', |
| | | label: '接口名称', |
| | | initVal: card.subFunc || 'addUser', |
| | | required: true, |
| | | options: [ |
| | | { value: 'addUser', text: '添加用户' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | key: 'innerFunc', |
| | | label: Formdict['header.form.innerFunc'], |
| | | initVal: card.innerFunc || '', |
| | | tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始。`, |
| | | tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始。` : '', |
| | | fields: usefulFields, |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlkey', |
| | | label: '地址字段', |
| | | initVal: card.urlkey || '', |
| | | tooltip: '图片(文件)链接的字段名。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execSuccess', |
| | | label: Formdict['model.form.afterSuccess'], |
| | | initVal: card.execSuccess || 'never', |
| | | initVal: card.execSuccess || 'grid', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | | tooltip: '执行成功后的返回值。', |
| | | tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,如@id);自定义函数可指定返回字段(如id)。', |
| | | initVal: card.output || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tipTitle', |
| | | label: '确认提示', |
| | | initVal: card.tipTitle || '', |
| | | tooltip: '注:弹窗(表单)在显示为是否框时有效。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | | tooltip: '小于100为宽度(或高度)百分比,大于100为像素值。', |
| | | tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | key: 'preFunc', |
| | | label: '前置函数', |
| | | initVal: card.preFunc || '', |
| | | tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始;前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。`, |
| | | tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始;前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。` : '', |
| | | fields: usefulFields, |
| | | required: false, |
| | | readonly: false |
| | |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'reason', |
| | | label: '禁用原因', |
| | | initVal: card.reason || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | | tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'progress', |
| | | label: '进度提示', |
| | | initVal: card.progress || 'number', |
| | | required: false, |
| | | options: [{ |
| | | value: 'number', |
| | | text: '剩余数' |
| | | }, { |
| | | value: 'progressbar', |
| | | text: '进度条' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'datetime', |
| | | text: Formdict['model.form.datetime'] |
| | | // }, { |
| | | // value: 'datetime', |
| | | // text: '日期(分/秒)' |
| | | }, { |
| | | value: 'textarea', |
| | | text: Formdict['model.form.textarea'] |
| | |
| | | }, { |
| | | value: 'linkMain', |
| | | text: '关联主表' |
| | | }, { |
| | | value: 'formula', |
| | | text: '公式' |
| | | }] |
| | | |
| | | let _fieldlength = 50 |
| | |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'datetime', |
| | | text: Formdict['model.form.datetime'] |
| | | // }, { |
| | | // value: 'datetime', |
| | | // text: '日期(分/秒)' |
| | | }, { |
| | | value: 'textarea', |
| | | text: Formdict['model.form.textarea'] |
| | |
| | | }, { |
| | | value: 'linkMain', |
| | | text: '关联主表' |
| | | }, { |
| | | value: 'formula', |
| | | text: '公式' |
| | | }] |
| | | } |
| | | |
| | |
| | | _fieldlength = 512 |
| | | } else if (['textarea', 'brafteditor'].includes(card.type)) { |
| | | _fieldlength = 8000 |
| | | } else if (card.type === 'datetime') { |
| | | card.type = 'date' |
| | | card.precision = 'second' |
| | | } |
| | | |
| | | let options = card.options || [] |
| | |
| | | initval = card.initval === true |
| | | } else if (card.type === 'number') { |
| | | initval = card.initval || 0 |
| | | } |
| | | |
| | | if (appType === 'mob' && ![24, 12, 8, 6].includes(card.span)) { |
| | | card.span = 24 |
| | | } |
| | | |
| | | return [ |
| | |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'color', |
| | | text: '色块' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'ratio', |
| | | key: 'picratio', |
| | | label: '图片比例', |
| | | initVal: card.ratio || '1:1', |
| | | initVal: card.picratio || card.ratio || '1:1', |
| | | required: true, |
| | | options: [{ |
| | | value: '1:1', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'precision', |
| | | label: '精确度', |
| | | initVal: card.precision || 'day', |
| | | options: [{ |
| | | value: 'day', |
| | | text: '天' |
| | | }, { |
| | | value: 'hour', |
| | | text: '小时' |
| | | }, { |
| | | value: 'minute', |
| | | text: '分钟' |
| | | }, { |
| | | value: 'second', |
| | | text: '秒' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | min: 1, |
| | |
| | | label: Formdict['model.form.field'] + Formdict['model.length'], |
| | | // tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512', |
| | | initVal: card.fieldlength || _fieldlength, |
| | | required: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | initVal: card.regular || '', |
| | | options: [{ |
| | | value: '', |
| | | text: Formdict['model.empty'] |
| | | text: '空' |
| | | }, { |
| | | value: 'number', |
| | | text: Formdict['model.form.number'] |
| | | text: '数字' |
| | | }, { |
| | | value: 'letter', |
| | | text: Formdict['header.form.letter'] |
| | | text: '字母' |
| | | }, { |
| | | value: 'letter&number', |
| | | text: '字母+数字' |
| | | text: '数字、字母以及_@_.' |
| | | }, { |
| | | value: 'phone', |
| | | text: '手机号' |
| | | }, { |
| | | value: 'email', |
| | | text: '邮箱' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'selectStyle', |
| | | label: '选中效果', |
| | | tooltip: '背景及文字变化时会使用系统色。', |
| | | initVal: card.selectStyle || (card.backgroundColor ? 'custom' : 'background'), |
| | | options: [{ |
| | | value: 'background', |
| | | text: '背景变化' |
| | | }, { |
| | | value: 'font', |
| | | text: '文字变化' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | tooltip: '设置背景色后,选中效果由背景颜色控制。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'borderColor', |
| | | label: '边框颜色', |
| | | initVal: card.borderColor || '', |
| | | required: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | type: 'radio', |
| | | key: 'interception', |
| | | label: '截取空格', |
| | | initVal: card.interception || 'false', |
| | | initVal: card.interception || 'true', |
| | | tooltip: '提交时,是否截取首尾的空白字符。', |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'formula', |
| | | label: '公式', |
| | | initVal: card.formula || '', |
| | | tooltip: '动态替换相应的字段,展示获得的结果。可使用JS的一些语法,如:三元表达式 @field1@ > @field2@ ? 0 : 1;Math对象,取绝对值 Math.abs(@field@)、四舍五入 Math.round(@field@)等', |
| | | rows: 2, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'true', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'postfix', |
| | | label: '后缀', |
| | | initVal: card.postfix || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'compress', |
| | | label: '压缩', |
| | | label: '文件处理', |
| | | initVal: card.compress || 'false', |
| | | tooltip: '文件压缩必须为图片,图片格式为jpg、png、gif 或 jpeg', |
| | | tooltip: '文件压缩或base64必须为图片,图片格式为jpg、png、gif 或 jpeg。注:base64只可上传一张图片。', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | text: '无' |
| | | }, { |
| | | value: 'true', |
| | | text: '压缩' |
| | | }, { |
| | | value: 'base64', |
| | | text: 'base64' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | tooltip: '栅格布局整行24等分。', |
| | | required: true, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'span', |
| | | label: '表单宽度', |
| | | initVal: card.span || 24, |
| | | tooltip: '栅格布局整行24等分。', |
| | | required: true, |
| | | forbid: appType !== 'mob', |
| | | options: [{ |
| | | value: 24, |
| | | text: 24 |
| | | }, { |
| | | value: 12, |
| | | text: 12 |
| | | }, { |
| | | value: 8, |
| | | text: 8 |
| | | }, { |
| | | value: 6, |
| | | text: 6 |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'lenControl', |
| | | label: '长度控制', |
| | | initVal: card.lenControl || 'limit', |
| | | tooltip: '在设置字段长度后,对长度的控制方式。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'limit', |
| | | text: '限制输入' |
| | | }, { |
| | | value: 'left', |
| | | text: '左截' |
| | | }, { |
| | | value: 'right', |
| | | text: '右截' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'supvalue', |
| | | max: 512, |
| | | label: '显示值', |
| | | tooltip: '请填写显示值,只有上级表单值与显示值相同时,该表单才会显示,注:1、多个值用逗号分隔;2、上级表单初始值为$first时暂未处理。', |
| | | initVal: card.supvalue || '', |
| | |
| | | initVal: card.extra || '', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'enterReplace', |
| | | label: '回车符替换', |
| | | tooltip: '回车符会替换为英文逗号。', |
| | | initVal: card.enterReplace || 'false', |
| | | required: false, |
| | | forbid: appType !== 'mob', |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'marginTop', |
| | | label: '上边距(px)', |
| | | initVal: card.marginTop || 0, |
| | | min: 0, |
| | | max: 1000, |
| | | precision: 0, |
| | | required: false, |
| | | forbid: appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'marginBottom', |
| | | label: '下边距(px)', |
| | | initVal: card.marginBottom || 0, |
| | | min: 0, |
| | | max: 1000, |
| | | precision: 0, |
| | | required: false, |
| | | forbid: appType !== 'mob' |
| | | }, |
| | | // { |
| | | // type: 'number', |
| | | // key: 'marginTop', |
| | | // label: '上边距(px)', |
| | | // initVal: card.marginTop || 0, |
| | | // min: -100, |
| | | // max: 1000, |
| | | // precision: 0, |
| | | // required: false, |
| | | // forbid: appType !== 'mob' |
| | | // }, |
| | | // { |
| | | // type: 'number', |
| | | // key: 'marginBottom', |
| | | // label: '下边距(px)', |
| | | // initVal: card.marginBottom || 0, |
| | | // min: -100, |
| | | // max: 1000, |
| | | // precision: 0, |
| | | // required: false, |
| | | // forbid: appType !== 'mob' |
| | | // }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: Formdict['header.form.blacklist'], |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | options: roleList, |
| | | forbid: appType === 'mob' |
| | | } |
| | | ] |
| | | } |