| | |
| | | */ |
| | | export function getSearchForm (card, linkableFields) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | |
| | | |
| | | let typeOptions = [] |
| | | |
| | | if (sessionStorage.getItem('appType') === 'mob') { |
| | | if (appType === 'mob') { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | value: 'range', |
| | | text: '数值(区间)' |
| | | }, { |
| | | value: 'checkcard', |
| | | text: '选项卡' |
| | |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: Formdict['model.form.daterange'] |
| | | }] |
| | | if (!['text', 'checkcard', 'date', 'datemonth'].includes(card.type)) { |
| | | card.type = 'text' |
| | | } |
| | | } else { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | |
| | | value: 'group', |
| | | text: Formdict['model.form.dategroup'] |
| | | }] |
| | | } |
| | | |
| | | if (card.focus) { |
| | | if (['text', 'multiselect'].includes(card.type)) { |
| | | card.match = 'like' |
| | | } else if (['select', 'link', 'checkcard'].includes(card.type)) { |
| | | card.match = '=' |
| | | } else if (card.type === 'date') { |
| | | card.match = '>=' |
| | | } else if (['datemonth', 'dateweek', 'daterange', 'range'].includes(card.type)) { |
| | | card.match = 'between' |
| | | } |
| | | } |
| | | |
| | | return [ |
| | |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: Formdict['header.form.initval'], |
| | | tooltip: '类型为下拉菜单时,初始值应为数据的Value值(使用数据源时,应为《值·字段》的值)', |
| | | tooltip: '类型为下拉菜单时,初始值应为数据的Value值(使用数据源时,应为《值·字段》的值);类型为数值(区间)时,初始值使用逗号拼接,例如 3,10', |
| | | initVal: card.initval, |
| | | required: false |
| | | }, |
| | |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '卡片宽度', |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | required: true |
| | |
| | | max: 24, |
| | | label: Formdict['header.form.ratio'], |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.ratio, |
| | | initVal: card.ratio || 6, |
| | | forbid: appType === 'mob', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'number', |
| | | key: 'maxValue', |
| | | label: '最大值', |
| | | initVal: card.maxValue, |
| | | forbid: appType !== 'mob', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'minValue', |
| | | label: '最小值', |
| | | initVal: card.minValue, |
| | | forbid: appType !== 'mob', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'step', |
| | | label: '步长', |
| | | initVal: card.step, |
| | | tooltip: '步长取值必须大于 0,并且可被 (max - min) 整除', |
| | | forbid: appType !== 'mob', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'labelShow', |
| | | label: '显示名称', |
| | |
| | | key: 'advanced', |
| | | label: '高级搜索', |
| | | initVal: card.advanced || 'false', |
| | | forbid: sessionStorage.getItem('appType') === 'mob', |
| | | forbid: appType === 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'dropdown', |
| | | label: '下拉框', |
| | | initVal: card.dropdown || 'true', |
| | | forbid: appType === 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '定宽' |
| | | }, { |
| | | value: 'false', |
| | | text: '自适应' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'inputType', |
| | | label: '输入样式', |
| | | initVal: card.inputType || 'input', |
| | | tooltip: '使用高级搜索时无效。', |
| | | required: false, |
| | | forbid: sessionStorage.getItem('appType') === null, |
| | | options: [{ |
| | | value: 'input', |
| | | text: '输入框' |
| | |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | tooltip: '设置背景色后,选中效果由背景颜色控制。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | | * @param {*} card 编辑按钮 |
| | | * @param {*} functip 生成存储过程提示 |
| | | * @param {*} config 页面配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, config, usefulFields, type, menulist = [], printTemps = []) { |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'funcType', |
| | | label: Formdict['header.form.funcType'], |
| | | initVal: card.funcType || '', |
| | |
| | | }, { |
| | | value: 'print', |
| | | text: '标签打印' |
| | | }, { |
| | | value: 'closetab', |
| | | text: '标签关闭' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | key: 'innerFunc', |
| | | label: Formdict['header.form.innerFunc'], |
| | | initVal: card.innerFunc || '', |
| | | tooltip: functip, |
| | | tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始。`, |
| | | fields: usefulFields, |
| | | tooltipClass: 'middle', |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'tabType', |
| | | // label: Formdict['model.form.tabType'], |
| | | // initVal: card.tabType || 'SubTable', |
| | | // required: true, |
| | | // options: [{ |
| | | // value: 'SubTable', |
| | | // text: Formdict['model.menu.tab.subtable'] |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'refreshTab', |
| | | label: '刷新标签', |
| | | initVal: card.refreshTab || [], |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'afterExecSuccess', |
| | | label: Formdict['header.form.afterExecSuccess'], |
| | |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'openmenu', |
| | | label: '打开菜单', |
| | | initVal: card.openmenu || [], |
| | | tooltip: '执行成功后需要打开的菜单。', |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | | tooltip: '执行成功后的返回值。', |
| | | initVal: card.output || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: Formdict['model.form.paramJoint'], |
| | |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | } |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示方式', |
| | | initVal: card.display || 'modal', |
| | | required: true, |
| | | options: [{ |
| | | value: 'modal', |
| | | text: '模态框' |
| | | }, { |
| | | value: 'drawer', |
| | | text: '抽屉' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'ratio', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | | tooltip: '小于100为宽度(或高度)百分比,大于100为像素值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'placement', |
| | | label: '抽屉方向', |
| | | initVal: card.placement || 'right', |
| | | tooltip: '使用抽屉时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'right', |
| | | text: '右侧' |
| | | }, { |
| | | value: 'left', |
| | | text: '左侧' |
| | | }, { |
| | | value: 'top', |
| | | text: '上侧' |
| | | }, { |
| | | value: 'bottom', |
| | | text: '下侧' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'preFunc', |
| | | label: '前置函数', |
| | | initVal: card.preFunc || '', |
| | | tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始;前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行。`, |
| | | fields: usefulFields, |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | ] |
| | | } |
| | | |
| | |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | |
| | | label: role.text |
| | | } |
| | | }) |
| | | } catch { |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | |
| | | }, { |
| | | value: 'split', |
| | | text: '分隔线' |
| | | }, { |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | }] |
| | | |
| | | let _fieldlength = 50 |
| | |
| | | value: 'split', |
| | | text: '分隔线' |
| | | }] |
| | | } else if (subtable) { |
| | | _openType.push({ |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | }) |
| | | } |
| | | |
| | | if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) { |
| | |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '卡片宽度', |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | required: true |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'disableField', |
| | | label: '禁用·字段', |
| | | initVal: card.disableField || '', |
| | | tooltip: '设置禁用字段,且字段值为true时,选项不可选。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '可多选', |
| | |
| | | }, { |
| | | value: 'letter&number', |
| | | text: Formdict['header.form.letter&number'] |
| | | }, { |
| | | value: 'phone', |
| | | text: '手机号' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | initVal: card.maxfile || '', |
| | | tooltip: '等于0时不做限制。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidelabel', |
| | | label: '隐藏名称', |
| | | initVal: card.hidelabel || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | type: 'radio', |
| | | key: 'readin', |
| | | label: Formdict['header.form.readin'], |
| | | tooltip: Formdict['header.form.readin.tooltip'], |
| | | tooltip: '是否将表格选中的数据自动填充到表单(字段相同)', |
| | | initVal: card.readin || 'true', |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }, { |
| | | value: 'top', |
| | | text: '首行' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'dropdown', |
| | | label: '下拉框', |
| | | initVal: card.dropdown || 'true', |
| | | forbid: appType === 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '定宽' |
| | | }, { |
| | | value: 'false', |
| | | text: '自适应' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidelabel', |
| | | label: '隐藏名称', |
| | | initVal: card.hidelabel || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'arrange', |
| | | label: '元素排列', |
| | | initVal: card.arrange || 'adaptive', |
| | | forbid: appType !== 'mob', |
| | | options: [{ |
| | | value: 'line', |
| | | text: '整行' |
| | | }, { |
| | | value: 'adaptive', |
| | | text: '自适应' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | tooltip: '设置背景色后,选中效果由背景颜色控制。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'splitline', |
| | | label: '分割线', |
| | | initVal: card.splitline || 'true', |
| | | forbid: appType !== 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'count', |
| | | label: '计数功能', |
| | | initVal: card.count || 'false', |
| | |
| | | type: 'text', |
| | | key: 'supvalue', |
| | | label: '显示值', |
| | | tooltip: '请填写显示值,只有上级表单值与显示值相同时,该表单才会显示,注:多个值用逗号分隔。', |
| | | tooltip: '请填写显示值,只有上级表单值与显示值相同时,该表单才会显示,注:1、多个值用逗号分隔;2、上级表单初始值为$first时暂未处理。', |
| | | initVal: card.supvalue || '', |
| | | required: true, |
| | | readonly: false |
| | |
| | | initVal: card.extra || '', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'placeholder', |
| | | label: '提示信息', |
| | | tooltip: '字段预期值的提示信息。', |
| | | initVal: card.placeholder || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | initVal: card.label || '', |
| | | required: true |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'type', |
| | | // label: Formdict['model.form.tabType'], |
| | | // initVal: card.type || 'SubTable', |
| | | // required: true, |
| | | // options: [{ |
| | | // value: 'SubTable', |
| | | // text: Formdict['model.menu.tab.subtable'] |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |