| | |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | | * @param {*} card 编辑按钮 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | * @description 获取元素配置信息 |
| | | * @param {*} card |
| | | * @param {*} type |
| | | */ |
| | | export function getCardCellForm (card, type) { |
| | | export function getCardCellForm (card, type, subtype, cardCell) { |
| | | let _options = [ |
| | | { value: 'text', text: '文本'}, |
| | | { value: 'number', text: '数值'}, |
| | |
| | | { value: 'barcode', text: '条形码'}, |
| | | { value: 'qrcode', text: '二维码'}, |
| | | { value: 'currentDate', text: '当前时间'}, |
| | | { value: 'formula', text: '公式'}, |
| | | ] |
| | | |
| | | if (type === 'table') { |
| | | if (type === 'table' || (type === 'card' && subtype === 'datacard')) { |
| | | _options.push({value: 'sequence', text: '序号'}) |
| | | } |
| | | |
| | | let appMenus = [] |
| | | const isApp = sessionStorage.getItem('appType') === 'pc' |
| | | |
| | | if (isApp) { |
| | | appMenus = sessionStorage.getItem('appMenus') |
| | | if (appMenus) { |
| | | try { |
| | | appMenus = JSON.parse(appMenus) |
| | | } catch (e) { |
| | | appMenus = [] |
| | | } |
| | | } else { |
| | | appMenus = [] |
| | | } |
| | | } |
| | | |
| | | let dataTypes = [ |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | if (cardCell.$cardType === 'extendCard') { |
| | | card.datatype = 'static' |
| | | dataTypes = [ |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | } |
| | | |
| | | let forms = [ |
| | |
| | | options: _options |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon, |
| | | required: true, |
| | | options: [ |
| | | { value: 'question-circle', text: 'question-circle'}, |
| | | { value: 'alert', text: 'alert'}, |
| | | { value: 'cloud', text: 'cloud'}, |
| | | { value: 'eye', text: 'eye'}, |
| | | { value: 'eye-invisible', text: 'eye-invisible'}, |
| | | { value: 'android', text: 'android'}, |
| | | { value: 'apple', text: 'apple'}, |
| | | { value: 'windows', text: 'windows'}, |
| | | { value: 'ie', text: 'ie'}, |
| | | { value: 'chrome', text: 'chrome'}, |
| | | { value: 'github', text: 'github'}, |
| | | { value: 'aliwangwang', text: 'aliwangwang'}, |
| | | { value: 'dingding', text: 'dingding'}, |
| | | { value: 'wechat', text: 'wechat'}, |
| | | { value: 'alipay', text: 'alipay'}, |
| | | { value: 'weibo-square', text: 'weibo-square'}, |
| | | { value: 'weibo-circle', text: 'weibo-circle'}, |
| | | { value: 'taobao-circle', text: 'taobao-circle'}, |
| | | { value: 'weibo', text: 'weibo'}, |
| | | { value: 'twitter', text: 'twitter'}, |
| | | { value: 'youtube', text: 'youtube'}, |
| | | { value: 'alipay-circle', text: 'alipay-circle'}, |
| | | { value: 'taobao', text: 'taobao'}, |
| | | { value: 'skype', text: 'skype'}, |
| | | { value: 'qq', text: 'qq'}, |
| | | { value: 'gitlab', text: 'gitlab'}, |
| | | { value: 'zhihu', text: 'zhihu'}, |
| | | { value: 'slack', text: 'slack'}, |
| | | { value: 'sketch', text: 'sketch'}, |
| | | { value: 'yahoo', text: 'yahoo'}, |
| | | { value: 'reddit', text: 'reddit'}, |
| | | { value: 'dribbble', text: 'dribbble'}, |
| | | ] |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'static', |
| | | required: true, |
| | | options: [ |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | options: dataTypes |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | min: 0, |
| | | label: '内容', |
| | | initVal: card.value || '', |
| | | tooltip: '文本类型,会替换内容中的@username@、@fullName@、@login_city@。', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'link', |
| | | label: '链接', |
| | | initVal: card.link || '', |
| | | required: false, |
| | | options: [ |
| | | { value: '', text: '无' }, |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | 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' } |
| | | { value: '3:2', text: '3:2' }, |
| | | { value: '16:9', text: '16:9' }, |
| | | { value: '2:1', text: '2:1' }, |
| | | { value: '3:1', text: '3:1' }, |
| | | { value: '4:1', text: '4:1' }, |
| | | { value: '5:1', text: '5:1' }, |
| | | { value: '6:1', text: '6:1' }, |
| | | { value: '7:1', text: '7:1' }, |
| | | { value: '8:1', text: '8:1' }, |
| | | { value: '9:1', text: '9:1' }, |
| | | { value: '10:1', text: '10:1' }, |
| | | { value: '3:4', text: '3:4' }, |
| | | { value: '2:3', text: '2:3' }, |
| | | { value: '9:16', text: '9:16' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'maxWidth', |
| | | min: 10, |
| | | max: 2000, |
| | | label: '最大宽度', |
| | | initVal: card.maxWidth || '', |
| | | tooltip: '图片宽度的最大值。', |
| | | required: false, |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'noValue', |
| | | label: '空值', |
| | | initVal: card.noValue || 'show', |
| | | required: false, |
| | | options: [ |
| | | { value: 'show', text: '显示' }, |
| | | { value: 'hide', text: '隐藏' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'link', |
| | | label: '链接', |
| | | initVal: card.link || '', |
| | | tooltip: '动态地址为绑定字段值。', |
| | | required: false, |
| | | forbid: isApp, |
| | | options: [ |
| | | { value: '', text: '无' }, |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'link', |
| | | label: '链接', |
| | | initVal: card.link || '', |
| | | required: false, |
| | | forbid: !isApp, |
| | | options: [ |
| | | { value: '', text: '无' }, |
| | | { value: 'linkpage', text: '关联菜单' }, |
| | | { value: 'custom', text: '链接' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'scale', |
| | | label: '图片放大', |
| | | initVal: card.scale || 'false', |
| | | required: false, |
| | | options: [ |
| | | { value: 'false', text: '不可以' }, |
| | | { value: 'true', text: '可以' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || '', |
| | | required: true, |
| | | forbid: !isApp, |
| | | options: appMenus |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | required: false, |
| | | forbid: !isApp, |
| | | options: [ |
| | | { value: 'blank', text: '新页面' }, |
| | | { value: 'self', text: '当前页面' } |
| | | ] |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'copyMenuId', |
| | | // label: '复制菜单', |
| | | // initVal: card.copyMenuId || '', |
| | | // required: false, |
| | | // forbid: !isApp, |
| | | // options: appMenus |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: Formdict['model.form.paramJoint'], |
| | | initVal: card.joint || 'true', |
| | |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'formula', |
| | | label: '公式', |
| | | initVal: card.formula || '', |
| | | tooltip: '执行时会使用查询到的数据替换相应的字段,展示获得的结果。', |
| | | placeholder: '例如:@price@ * @number@', |
| | | required: true |
| | | }, |
| | | ] |
| | | |
| | | return forms |