| | |
| | | */ |
| | | export function getSearchForm (card, linkableFields) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | |
| | | |
| | | 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: appType === 'mob', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | |
| | | label: '输入样式', |
| | | initVal: card.inputType || 'input', |
| | | required: false, |
| | | forbid: sessionStorage.getItem('appType') === null, |
| | | forbid: appType === null, |
| | | options: [{ |
| | | value: 'input', |
| | | text: '输入框' |
| | |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | tooltip: '设置背景色后,选中效果由背景颜色控制。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '卡片宽度', |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | required: true |
| | |
| | | }, { |
| | | 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', |
| | |
| | | label: '扫码', |
| | | initVal: card.scan || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '启用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不启用' |
| | | text: '禁用' |
| | | }, { |
| | | value: 'simple', |
| | | text: '单次' |
| | | }, { |
| | | value: 'multi', |
| | | text: '连续' |
| | | }], |
| | | forbid: appType !== 'mob' |
| | | }, |
| | |
| | | }] |
| | | }, |
| | | { |
| | | 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 |
| | |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'placeholder', |
| | | label: '提示信息', |
| | | tooltip: '字段预期值的提示信息。', |
| | | initVal: card.placeholder || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'emptyText', |
| | | label: '空值文本', |
| | | tooltip: '空值的提示文本,选择设置空值时有效,默认值为《空》。', |