From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/menu/components/card/cardcellcomponent/formconfig.jsx | 207 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 125 insertions(+), 82 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index c664528..35cb31d 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -1,14 +1,11 @@ -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' - -const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +import MenuUtils from '@/utils/utils-custom.js' /** * @description 鑾峰彇鍏冪礌閰嶇疆淇℃伅 * @param {*} card * @param {*} type */ -export function getCardCellForm (card, type, subtype, cardCell) { +export function getCardCellForm (card, cards, cardCell) { let _options = [ { value: 'text', text: '鏂囨湰'}, { value: 'number', text: '鏁板��'}, @@ -23,36 +20,25 @@ { value: 'formula', text: '鍏紡'}, ] - if (type === 'table' || (type === 'card' && subtype === 'datacard')) { + let anchors = [] + if (window.GLOB.customMenu.Template === 'BaseTable') { + anchors = null + } else { + anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] + } + + if (cards.type === 'table' || (cards.type === 'card' && cards.subtype === 'datacard')) { _options.push({value: 'sequence', text: '搴忓彿'}) + } else if (card.eleType === 'sequence') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.eleType = '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 = [] - } + if (card.eleType === 'icon' && card.datatype === 'dynamic' && !card.field) { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.datatype = 'static' } + let appType = sessionStorage.getItem('appType') - let dataTypes = [ - { value: 'dynamic', text: '鍔ㄦ��' }, - { value: 'static', text: '闈欐��' } - ] let tooltip = '' if (cardCell.$cardType === 'extendCard') { - // card.datatype = 'static' - // dataTypes = [ - // { value: 'static', text: '闈欐��' } - // ] tooltip = '鍦ㄦ墿灞曞崱鐗囦腑锛屽姩鎬佹暟鎹樉绀哄�间负鑾峰彇鍒扮殑绗竴琛屾暟鎹��' } @@ -66,20 +52,16 @@ options: _options }, { - type: 'icon', - key: 'icon', - label: '鍥炬爣', - initVal: card.icon, - required: true - }, - { type: 'radio', key: 'datatype', label: '鏁版嵁绫诲瀷', initVal: card.datatype || 'static', tooltip, required: true, - options: dataTypes + options: [ + { value: 'dynamic', text: '鍔ㄦ��' }, + { value: 'static', text: '闈欐��' } + ] }, { type: 'select', @@ -90,18 +72,26 @@ options: [] }, { + type: 'icon', + key: 'icon', + label: '鍥炬爣', + initVal: card.icon, + required: true + }, + { type: 'text', key: 'value', min: 0, label: '鍐呭', initVal: card.value || '', - tooltip: '鏂囨湰绫诲瀷锛屼細鏇挎崲鍐呭涓殑@username@銆丂fullName@銆丂login_city@銆�', + tooltip: '鏂囨湰绫诲瀷锛屼細鏇挎崲鍐呭涓殑@username@銆丂fullName@銆丂mk_city@銆丂appname@銆丂bid@銆�', required: true }, { type: 'file', key: 'url', label: '鍥剧墖/鏂囦欢', + tooltip: '浣跨敤闈欐�佸浘鐗囨椂锛孈icon@浠h〃澶村儚銆�', initVal: card.url || '', maxfile: 1, required: true @@ -129,6 +119,52 @@ ] }, { + type: 'number', + key: 'startTime', + precision: 0, + label: '寮�濮嬫椂闂�', + initVal: card.startTime || 0, + tooltip: '瑙嗛寮�濮嬫挱鏀剧殑鏃堕棿锛岀敤浜庤皟鏁磋棰戝垵濮嬪寲灞曠ず鐨勭晫闈€��', + required: false + }, + { + type: 'radio', + key: 'posterType', + label: '棰勮鍥�', + initVal: card.posterType || '', + required: false, + options: [ + { value: '', text: '鏃�' }, + { value: 'dynamic', text: '鍔ㄦ��' }, + { value: 'static', text: '闈欐��' } + ] + }, + { + type: 'file', + key: 'posterUrl', + label: '棰勮鍦板潃', + initVal: card.posterUrl || '', + maxfile: 1, + required: true + }, + { + type: 'select', + key: 'posterField', + label: '棰勮鍦板潃', + initVal: card.posterField || '', + required: true + }, + { + type: 'number', + key: 'decimal', + min: 0, + max: 18, + decimal: 0, + label: '灏忔暟浣�', + initVal: card.decimal === undefined ? '' : card.decimal, + required: false + }, + { type: 'select', key: 'format', label: '鏍煎紡鍖�', @@ -140,7 +176,10 @@ { value: 'percent', text: '鐧惧垎鏁�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' }, { value: 'abs', text: '缁濆鍊�' }, + { value: 'encryption', text: '鍔犲瘑'}, { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }, + { 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' }, { value: 'MM鏈圖D鏃�', text: 'MM鏈圖D鏃�' }, { value: 'YYYY骞碝M鏈圖D鏃�', text: 'YYYY骞碝M鏈圖D鏃�' }, { value: 'HH:mm', text: '鏃跺垎锛堜緥锛�16:57锛�' }, @@ -165,16 +204,6 @@ ] }, { - type: 'number', - key: 'decimal', - min: 0, - max: 18, - decimal: 0, - label: '灏忔暟浣�', - initVal: card.decimal === undefined ? '' : card.decimal, - required: false - }, - { type: 'text', key: 'prefix', label: '鍓嶇紑', @@ -193,7 +222,8 @@ key: 'tooltip', label: '鎻愮ず淇℃伅', initVal: card.tooltip || '', - tooltip: '榧犳爣鎮诞鏃舵樉绀恒��', + tooltip: '榧犳爣鎮诞鏃舵樉绀恒�傛敞锛氬浣跨敤鍔ㄦ�佷俊鎭紝璇峰湪姝ゅ濉啓鐩稿簲鐨勫瓧娈靛悕銆�', + forbid: appType === 'mob', required: false }, { @@ -311,8 +341,8 @@ min: 1, max: 10, label: '楂樺害(琛�)', - initVal: card.height, - tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲锛屾敞锛氳嚜閫傚簲楂樺害浠呭湪璁剧疆鍗$墖楂樺害鍚庢湁鏁堛��', + initVal: card.height !== undefined ? card.height : 1, + tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲銆�', required: false }, { @@ -324,6 +354,16 @@ required: false, allowClear: true, options: [] + }, + { + type: 'cascader', + key: 'anchors', + label: '璺宠浆閿氱偣', + initVal: card.anchors || [], + tooltip: sessionStorage.getItem('appType') === 'mob' ? '娉細灏忕▼搴忎腑鏃犳晥' : '', + required: false, + options: anchors, + forbid: !anchors }, { type: 'number', @@ -370,7 +410,8 @@ min: 0, max: 50, label: '绾垮', - initVal: card.borderWidth || 1, + initVal: card.borderWidth === undefined ? 1 : card.borderWidth, + tooltip: '绾垮涓�0鏃讹紝涓烘柟渚垮湪寮�鍙戞椂閫変腑榛樿楂樺害涓�10px锛岃娉ㄦ剰璋冩暣鍐呭杈硅窛銆�', required: true }, { @@ -399,6 +440,18 @@ ] }, { + type: 'radio', + key: 'backgroundSize', + label: '鍥惧儚澶у皬', + initVal: card.backgroundSize || 'cover', + required: false, + options: [ + { value: 'cover', text: '瑕嗙洊' }, + { value: 'contain', text: '鍖呭惈' }, + { value: 'auto', text: '鑷�傚簲' }, + ] + }, + { type: 'number', key: 'maxWidth', min: 10, @@ -406,6 +459,7 @@ label: '鏈�澶у搴�', initVal: card.maxWidth || '', tooltip: '鍥剧墖瀹藉害鐨勬渶澶у�笺��', + help: '娉細姝ゅ�煎瓨鍦ㄦ椂锛屽乏鍙冲杈硅窛涓�0灞呬腑鏄剧ず銆�', required: false, }, { @@ -426,7 +480,6 @@ initVal: card.link || '', tooltip: '鍔ㄦ�佸湴鍧�涓虹粦瀹氬瓧娈靛�笺��', required: false, - // forbid: isApp, options: [ { value: '', text: '鏃�' }, { value: 'dynamic', text: '鍔ㄦ��' }, @@ -439,7 +492,6 @@ label: '閾炬帴绫诲瀷', initVal: card.linkType || 'other', required: false, - // forbid: isApp, options: [ { value: 'tel', text: '鐢佃瘽' }, { value: 'email', text: '閭' }, @@ -459,27 +511,6 @@ }, { 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: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', @@ -489,15 +520,15 @@ { type: 'radio', key: 'joint', - label: Formdict['model.form.paramJoint'], + label: '鎷兼帴鍙傛暟', initVal: card.joint || 'true', required: false, options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] + text: '鍚�' }] }, { @@ -509,10 +540,10 @@ required: false, options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] + text: '鍚�' }] }, { @@ -529,7 +560,7 @@ key: 'noValue', label: '绌哄��', initVal: card.noValue || 'show', - tooltip: '褰撳厓绱犲唴瀹逛负绌烘椂锛屾槸鍚︽樉绀哄綋鍓嶅厓绱犮��', + tooltip: '褰撳厓绱犲唴瀹逛负绌烘椂锛屾槸鍚︽樉绀哄綋鍓嶅厓绱犮�傛敞锛氭暟鍊肩被鍨嬪厓绱犲寘鎷暟瀛�0锛堥潪鏂囨湰锛夈��', required: false, options: [ { value: 'show', text: '鏄剧ず' }, @@ -549,10 +580,22 @@ ] }, { + type: 'radio', + key: 'copyable', + label: '鍙鍒�', + initVal: card.copyable || 'false', + tooltip: '鍏冪礌鏄惁鍙鍒讹紝澶嶅埗鍐呭涓嶅寘鎷墠缂�涓庡悗缂�銆�', + required: false, + options: [ + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' } + ] + }, + { type: 'number', key: 'fixSize', min: 10, - max: 100, + max: 300, label: '瀛椾綋澶у皬', initVal: card.fixSize || 14, tooltip: '鍓嶇紑銆佸悗缂�鐨勫瓧浣撳ぇ灏忋��', -- Gitblit v1.8.0