| | |
| | | roleList = [] |
| | | } |
| | | |
| | | let typeOptions = [] |
| | | |
| | | if (sessionStorage.getItem('appType') === 'mob') { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'checkcard', |
| | | text: '选项卡' |
| | | }, { |
| | | value: 'date', |
| | | text: Formdict['model.form.dateday'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }] |
| | | if (!['text', 'checkcard', 'date', 'datemonth'].includes(card.type)) { |
| | | card.type = 'text' |
| | | } |
| | | } else { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'select', |
| | | text: Formdict['model.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: Formdict['model.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: Formdict['model.form.link'] |
| | | }, { |
| | | value: 'checkcard', |
| | | text: '选项卡' |
| | | }, { |
| | | value: 'date', |
| | | text: Formdict['model.form.dateday'] |
| | | }, { |
| | | value: 'dateweek', |
| | | text: Formdict['model.form.dateweek'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: Formdict['model.form.daterange'] |
| | | }, { |
| | | value: 'group', |
| | | text: Formdict['model.form.dategroup'] |
| | | }] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | label: Formdict['model.form.type'], |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'select', |
| | | text: Formdict['model.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: Formdict['model.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: Formdict['model.form.link'] |
| | | }, { |
| | | value: 'date', |
| | | text: Formdict['model.form.dateday'] |
| | | }, { |
| | | value: 'dateweek', |
| | | text: Formdict['model.form.dateweek'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: Formdict['model.form.daterange'] |
| | | }, { |
| | | value: 'group', |
| | | text: Formdict['model.form.dategroup'] |
| | | }] |
| | | options: typeOptions |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示', |
| | | initVal: card.display || 'text', |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: '文本' |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '卡片宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'cardValField', |
| | | label: Formdict['header.form.valueField'], |
| | | initVal: card.cardValField || 'Value', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlField', |
| | | label: '地址字段', |
| | | initVal: card.urlField || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'picratio', |
| | | label: '图片比例', |
| | | initVal: card.picratio || '1:1', |
| | | required: true, |
| | | options: [{ |
| | | value: '1:1', |
| | | text: '1:1' |
| | | }, { |
| | | value: '3:2', |
| | | text: '3:2' |
| | | }, { |
| | | value: '4:3', |
| | | text: '4:3' |
| | | }, { |
| | | value: '16:9', |
| | | text: '16:9' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'fields', |
| | | label: '字段集', |
| | | initVal: card.fields || [], |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'dataSource', |
| | | label: Formdict['header.form.datasource'], |
| | |
| | | { |
| | | type: 'options', |
| | | key: 'options', |
| | | label: '', |
| | | label: '选项', |
| | | initVal: card.options || [], |
| | | required: true, |
| | | readonly: false |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '可多选', |
| | | initVal: card.multiple || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: Formdict['model.required'], |
| | | initVal: card.required || 'false', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'borderColor', |
| | | label: '边框颜色', |
| | | initVal: card.borderColor || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: Formdict['header.form.blacklist'], |
| | |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, config, usefulFields, type, menulist = [], printTemps = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | |
| | | value: 'false', |
| | | text: '非必填' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '禁用控制字段,可根据数据控制按钮是否禁用。', |
| | | initVal: card.controlField || '', |
| | | required: false, |
| | | options: [{label: '无', field: ''}, ...columns] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | } |
| | | ] |
| | | } |
| | |
| | | type: 'select', |
| | | key: 'fileType', |
| | | label: '显示方式', |
| | | initVal: card.fileType || 'text', |
| | | initVal: card.fileType || (appType === 'mob' ? 'picture-card' : 'text'), |
| | | options: [{ |
| | | value: 'text', |
| | | text: '文件' |
| | | }, { |
| | | value: 'picture', |
| | | text: '图文信息' |
| | | }, { |
| | | value: 'picture-card', |
| | | text: '图片卡' |
| | | }, { |
| | | value: 'text', |
| | | text: '文件' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'maxfile', |
| | | min: 1, |
| | | max: 1000000, |
| | | min: 0, |
| | | max: 1000, |
| | | precision: 0, |
| | | label: '最大文件数', |
| | | initVal: card.maxfile || '', |
| | | tooltip: '等于0时不做限制。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'borderColor', |
| | | label: '边框颜色', |
| | | initVal: card.borderColor || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'declareType', |
| | | label: '数据类型', |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'compress', |
| | | label: '前端压缩', |
| | | label: '压缩', |
| | | initVal: card.compress || 'false', |
| | | tooltip: '前端压缩必须为图片。', |
| | | tooltip: '文件压缩必须为图片,图片格式为jpg、png、gif 或 jpeg', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |