From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 八月 2021 22:42:51 +0800 Subject: [PATCH] 2021-08-31 --- src/menu/components/card/cardcellcomponent/formconfig.jsx | 397 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 303 insertions(+), 94 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 7a33eda..92ccfc4 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -1,16 +1,59 @@ -// import zhCN from '@/locales/zh-CN/model.js' -// import enUS from '@/locales/en-US/model.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' -// const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS /** - * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅 - * @param {*} card 缂栬緫鎸夐挳 - * @param {*} setting 缁勪欢閰嶇疆 - * @param {*} permFuncField 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� - * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 + * @description 鑾峰彇鍏冪礌閰嶇疆淇℃伅 + * @param {*} card + * @param {*} type */ -export function getCardCellForm (card) { +export function getCardCellForm (card, type, subtype, cardCell) { + let _options = [ + { value: 'text', text: '鏂囨湰'}, + { value: 'number', text: '鏁板��'}, + { value: 'picture', text: '鍥剧墖'}, + { value: 'video', text: '瑙嗛'}, + { value: 'icon', text: '鍥炬爣'}, + { value: 'slider', text: '杩涘害鏉�'}, + { value: 'splitline', text: '鍒嗗壊绾�'}, + { value: 'barcode', text: '鏉″舰鐮�'}, + { value: 'qrcode', text: '浜岀淮鐮�'}, + { value: 'currentDate', text: '褰撳墠鏃堕棿'}, + { value: 'formula', text: '鍏紡'}, + ] + + 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 { + appMenus = [] + } + } else { + appMenus = [] + } + } + + let dataTypes = [ + { value: 'dynamic', text: '鍔ㄦ��' }, + { value: 'static', text: '闈欐��' } + ] + if (cardCell.$cardType === 'extendCard') { + card.datatype = 'static' + dataTypes = [ + { value: 'static', text: '闈欐��' } + ] + } + let forms = [ { type: 'select', @@ -18,56 +61,14 @@ label: '鍏冪礌绫诲瀷', initVal: card.eleType, required: true, - options: [ - { value: 'text', text: '鏂囨湰'}, - { value: 'number', text: '鏁板��'}, - { value: 'picture', text: '鍥剧墖'}, - { value: 'icon', text: '鍥炬爣'}, - { value: 'link', text: '閾炬帴'}, - { value: 'slider', text: '杩涘害鏉�'}, - { value: 'splitline', text: '鍒嗗壊绾�'}, - ] + 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', @@ -75,10 +76,7 @@ label: '鏁版嵁绫诲瀷', initVal: card.datatype || 'static', required: true, - options: [ - { value: 'dynamic', text: '鍔ㄦ��' }, - { value: 'static', text: '闈欐��' } - ] + options: dataTypes }, { type: 'select', @@ -89,27 +87,71 @@ options: [] }, { - type: 'file', - key: 'url', - label: '鍥剧墖', - initVal: card.url || '', - maxfile: 1, - required: false - }, - { type: 'text', key: 'value', + min: 0, label: '鍐呭', initVal: card.value || '', + tooltip: '鏂囨湰绫诲瀷锛屼細鏇挎崲鍐呭涓殑@username@銆丂fullName@銆丂login_city@銆�', required: true }, { - type: 'select', - key: 'labelfield', - label: '鎻愮ず瀛楁', - initVal: card.labelfield || '', + type: 'file', + key: 'url', + label: '鍥剧墖/鏂囦欢', + initVal: card.url || '', + maxfile: 1, + required: true + }, + { + type: 'radio', + key: 'autoPlay', + label: '鑷姩鎾斁', + initVal: card.autoPlay || 'false', required: false, - options: [] + options: [ + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' } + ] + }, + { + type: 'radio', + key: 'loop', + label: '寰幆鎾斁', + initVal: card.loop || 'false', + required: false, + options: [ + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' } + ] + }, + { + type: 'select', + key: 'format', + label: '鏍煎紡鍖�', + initVal: card.format || '', + required: false, + options: [], + oriOptions: [ + { value: '', text: '鏃�' }, + { value: 'percent', text: '鐧惧垎鏁�' }, + { value: 'thdSeparator', text: '鍗冨垎浣�' }, + { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' } + ] + }, + { + type: 'select', + key: 'dateFormat', + label: '鏍煎紡鍖�', + initVal: card.dateFormat || 'YYYY-MM-DD', + required: true, + options: [ + { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }, + { value: 'YYYY', text: 'YYYY' }, + { value: 'YYYY-MM', text: 'YYYY-MM' }, + { value: 'YYYY-MM-DD HH:mm', text: 'YYYY-MM-DD HH:mm' }, + { value: 'YYYY-MM-DD HH:mm:ss', text: 'YYYY-MM-DD HH:mm:ss' }, + ] }, { type: 'text', @@ -134,24 +176,10 @@ required: false }, { - type: 'select', - key: 'format', - label: '鏍煎紡鍖�', - initVal: card.format || '', - tooltip: '娉細鐧惧垎鏁般�佸崈鍒嗕綅瀵逛簬鏁板�肩被鍨嬫湁鏁堬紝YYYY-MM-DD瀵逛簬鏃堕棿绫诲瀷鐨勬枃鏈湁鏁堛��', - required: false, - options: [ - { value: '', text: '鏃�' }, - { value: 'percent', text: '鐧惧垎鏁�' }, - { value: 'thdSeparator', text: '鍗冨垎浣�' }, - { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' } - ] - }, - { type: 'color', key: 'color', label: '棰滆壊', - initVal: card.color, + initVal: card.color || 'rgba(0, 0, 0, 0.85)', required: true }, { @@ -169,9 +197,9 @@ min: 1, max: 24, precision: 0, - label: '瀹藉害', + label: '鍏冪礌瀹藉害', initVal: card.width || 12, - tooltip: '姣忚绛夊垎涓�24浠姐��', + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', required: true }, { @@ -180,8 +208,57 @@ min: 1, max: 10, label: '楂樺害(琛�)', - initVal: card.height || 1, + initVal: card.height, + tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲锛屾敞锛氳嚜閫傚簲楂樺害浠呭湪璁剧疆鍗$墖楂樺害鍚庢湁鏁堛��', + required: false + }, + { + type: 'number', + key: 'barHeight', + min: 5, + max: 50, + label: '楂樺害', + initVal: card.barHeight || 25, required: true, + }, + { + type: 'number', + key: 'qrWidth', + min: 5, + max: 500, + label: '瀹藉害', + initVal: card.qrWidth || 50, + required: true, + }, + { + type: 'number', + key: 'interval', + min: 0.1, + max: 10, + precision: 1, + label: '绾挎潯闂撮殧', + initVal: card.interval || 1, + required: true, + }, + { + type: 'radio', + key: 'displayValue', + label: '鏄剧ず鍊�', + initVal: card.displayValue || 'false', + required: false, + options: [ + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' } + ] + }, + { + type: 'number', + key: 'borderWidth', + min: 0, + max: 50, + label: '绾垮', + initVal: card.borderWidth || 1, + required: true }, { type: 'select', @@ -191,22 +268,154 @@ required: true, options: [ { value: '1:1', text: '1:1' }, + { value: '4:3', text: '4:3' }, { 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', + key: 'aspectRatio', + label: '闀垮姣�', + initVal: card.aspectRatio || '16:9', + required: true, + options: [ { value: '4:3', text: '4:3' }, { value: '16:9', text: '16:9' } ] }, { type: 'radio', - key: 'radius', - label: '鍦嗚', - initVal: card.radius || 'false', + key: 'noValue', + label: '绌哄��', + initVal: card.noValue || 'show', required: false, options: [ - { value: 'true', text: '鏈�' }, - { value: 'false', text: '鏃�' } + { 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', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + 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 -- Gitblit v1.8.0