From b8e1395f02c929eaa96b949cf6027ee2a43856a6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 06 九月 2022 19:03:37 +0800 Subject: [PATCH] 2022-09-06 --- src/menu/components/card/cardcellcomponent/formconfig.jsx | 365 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 311 insertions(+), 54 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 526d6e6..1529d90 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -8,7 +8,7 @@ * @param {*} card * @param {*} type */ -export function getCardCellForm (card, type, subtype, cardCell) { +export function getCardCellForm (card, type, subtype, cardCell, anchors) { let _options = [ { value: 'text', text: '鏂囨湰'}, { value: 'number', text: '鏁板��'}, @@ -20,11 +20,13 @@ { 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' @@ -33,8 +35,7 @@ if (appMenus) { try { appMenus = JSON.parse(appMenus) - appMenus = appMenus.map(item => ({value: item.MenuID, text: item.MenuName})) - } catch { + } catch (e) { appMenus = [] } } else { @@ -42,15 +43,9 @@ } } - let dataTypes = [ - { value: 'dynamic', text: '鍔ㄦ��' }, - { value: 'static', text: '闈欐��' } - ] + let tooltip = '' if (cardCell.$cardType === 'extendCard') { - card.datatype = 'static' - dataTypes = [ - { value: 'static', text: '闈欐��' } - ] + tooltip = '鍦ㄦ墿灞曞崱鐗囦腑锛屽姩鎬佹暟鎹樉绀哄�间负鑾峰彇鍒扮殑绗竴琛屾暟鎹��' } let forms = [ @@ -74,8 +69,12 @@ key: 'datatype', label: '鏁版嵁绫诲瀷', initVal: card.datatype || 'static', + tooltip, required: true, - options: dataTypes + options: [ + { value: 'dynamic', text: '鍔ㄦ��' }, + { value: 'static', text: '闈欐��' } + ] }, { type: 'select', @@ -91,13 +90,14 @@ 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 @@ -125,6 +125,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: '鏍煎紡鍖�', @@ -135,7 +181,18 @@ { value: '', text: '鏃�' }, { value: 'percent', text: '鐧惧垎鏁�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' }, - { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' } + { 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锛�' }, + { value: 'ahh:mm', text: '鑷畾涔�1锛堜緥锛氫笂鍗�10:57锛�' }, + { value: 'MM鏈圖D鏃� ahh:mm', text: '鑷畾涔�2锛堜緥锛�12鏈�17鏃� 涓婂崍10:57锛�' }, + { value: 'calendar1', text: '鑷畾涔�3锛堜緥锛氫粖澶� 涓婂崍10:57锛�' }, + { value: 'calendar2', text: '鑷畾涔�4锛堜緥锛氬垰鍒氥�佹槰澶┿��5澶╁墠锛�' }, ] }, { @@ -175,11 +232,93 @@ required: false }, { + type: 'radio', + key: 'showType', + label: '灞曠幇褰㈠紡', + initVal: card.showType || 'line', + required: false, + options: [ + { value: 'line', text: '杩涘害鏉�' }, + { value: 'circle', text: '杩涘害鍦�' }, + { value: 'dashboard', text: '浠〃鐩�' }, + ] + }, + { type: 'color', key: 'color', label: '棰滆壊', - initVal: card.color || 'rgba(0, 0, 0, 0.85)', + tooltip: '杩涘害鏉″畬鎴愬尯鍩熴�佸垎鍓茬嚎鎴栦簩缁寸爜鐨勯鑹层��', + initVal: card.color || '#1890ff', required: true + }, + { + type: 'color', + key: 'trailColor', + label: '鏈畬鎴愰鑹�', + initVal: card.trailColor || '#f5f5f5', + required: false + }, + { + type: 'radio', + key: 'showInfo', + label: '杩涘害鍊�', + initVal: card.showInfo || 'false', + required: false, + options: [ + { value: 'true', text: '鏄剧ず' }, + { value: 'false', text: '闅愯棌' } + ] + }, + { + type: 'color', + key: 'infoColor', + label: '杩涘害鍊奸鑹�', + initVal: card.infoColor || 'rgba(0, 0, 0, 0.65)', + required: false + }, + { + type: 'radio', + key: 'strokeLinecap', + label: '绾垮瀷', + initVal: card.strokeLinecap || 'round', + required: false, + options: [ + { value: 'round', text: '鍦嗚' }, + { value: 'square', text: '鐩磋' }, + ] + }, + { + type: 'radio', + key: 'textAlign', + label: '瀵归綈鏂瑰紡', + initVal: card.textAlign || 'left', + required: false, + options: [ + { value: 'left', text: '宸�' }, + { value: 'center', text: '涓�' }, + { value: 'right', text: '鍙�' }, + ] + }, + { + type: 'number', + key: 'strokeWidth', + min: 1, + max: 200, + precision: 0, + label: '绾挎潯瀹藉害', + initVal: card.strokeWidth || 8, + required: true, + }, + { + type: 'number', + key: 'outlineWidth', + min: 10, + max: 2000, + precision: 0, + label: '澶栧舰瀹藉害', + initVal: card.outlineWidth || '', + tooltip: '澶栧舰瀹藉害涓虹┖鏃讹紝瀹藉害涓哄厓绱犵殑瀹藉害銆傛敞锛氳秴鍑烘椂鎸夊厓绱犲搴﹁绠椼��', + required: false }, { type: 'number', @@ -207,15 +346,34 @@ min: 1, max: 10, label: '楂樺害(琛�)', - initVal: card.height, - tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲锛屾敞锛氳嚜閫傚簲楂樺害浠呭湪璁剧疆鍗$墖楂樺害鍚庢湁鏁堛��', + initVal: card.height !== undefined ? card.height : 1, + tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲銆�', required: false + }, + { + type: 'select', + key: 'bgImage', + label: '鍔ㄦ�佽儗鏅�', + initVal: card.bgImage || '', + tooltip: '缁戝畾鏁版嵁婧愬瓧娈碉紝鍙牴鎹繑鍥炲�兼敼鍙樿儗鏅浘銆�', + required: false, + allowClear: true, + options: [] + }, + { + type: 'cascader', + key: 'anchors', + label: '璺宠浆閿氱偣', + initVal: card.anchors || [], + tooltip: sessionStorage.getItem('appType') === 'mob' ? '娉細灏忕▼搴忎腑鏃犳晥' : '', + required: false, + options: anchors }, { type: 'number', key: 'barHeight', min: 5, - max: 50, + max: 500, label: '楂樺害', initVal: card.barHeight || 25, required: true, @@ -224,8 +382,8 @@ type: 'number', key: 'qrWidth', min: 5, - max: 500, - label: '瀹藉害', + max: 1000, + label: '浜岀淮鐮佸昂瀵�', initVal: card.qrWidth || 50, required: true, }, @@ -256,7 +414,8 @@ min: 0, max: 50, label: '绾垮', - initVal: card.borderWidth || 1, + initVal: card.borderWidth === undefined ? 1 : card.borderWidth, + tooltip: '绾垮涓�0鏃讹紝涓烘柟渚垮湪寮�鍙戞椂閫変腑榛樿楂樺害涓�10px锛岃娉ㄦ剰璋冩暣鍐呭杈硅窛銆�', required: true }, { @@ -292,6 +451,7 @@ label: '鏈�澶у搴�', initVal: card.maxWidth || '', tooltip: '鍥剧墖瀹藉害鐨勬渶澶у�笺��', + help: '娉細姝ゅ�煎瓨鍦ㄦ椂锛屽乏鍙冲杈硅窛涓�0灞呬腑鏄剧ず銆�', required: false, }, { @@ -312,7 +472,6 @@ initVal: card.link || '', tooltip: '鍔ㄦ�佸湴鍧�涓虹粦瀹氬瓧娈靛�笺��', required: false, - forbid: isApp, options: [ { value: '', text: '鏃�' }, { value: 'dynamic', text: '鍔ㄦ��' }, @@ -320,17 +479,26 @@ ] }, { - type: 'select', - key: 'link', - label: '閾炬帴', - initVal: card.link || '', + type: 'radio', + key: 'linkType', + label: '閾炬帴绫诲瀷', + initVal: card.linkType || 'other', required: false, - forbid: !isApp, options: [ - { value: '', text: '鏃�' }, - // { value: 'page', text: '鑿滃崟' }, - { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, - { value: 'custom', text: '閾炬帴' } + { value: 'tel', text: '鐢佃瘽' }, + { value: 'email', text: '閭' }, + { value: 'other', text: '鍏朵粬' } + ] + }, + { + type: 'radio', + key: 'scale', + label: '鍥剧墖鏀惧ぇ', + initVal: card.scale || 'false', + required: false, + options: [ + { value: 'false', text: '涓嶅彲浠�' }, + { value: 'true', text: '鍙互' } ] }, { @@ -342,27 +510,26 @@ 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 || '', + // type: 'radio', + // key: 'open', + // label: '鎵撳紑鏂瑰紡', + // initVal: card.open || 'blank', // required: false, // forbid: !isApp, - // options: appMenus + // options: [ + // { value: 'blank', text: '鏂伴〉闈�' }, + // { value: 'self', text: '褰撳墠椤甸潰' } + // ] // }, + { + type: 'select', + key: 'linkurl', + label: '閾炬帴鍦板潃', + initVal: card.linkurl || '', + required: true, + options: [] + }, { type: 'radio', key: 'joint', @@ -378,12 +545,102 @@ }] }, { - type: 'select', - key: 'linkurl', - label: '閾炬帴鍦板潃', - initVal: card.linkurl || '', - required: true, - options: [] + type: 'radio', + key: 'eval', + label: '瑙f瀽', + initVal: card.eval || 'true', + tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'textarea', + key: 'formula', + label: '鍏紡', + initVal: card.formula || '', + tooltip: '鎵ц鏃朵細浣跨敤鏌ヨ鍒扮殑鏁版嵁鏇挎崲鐩稿簲鐨勫瓧娈碉紝灞曠ず鑾峰緱鐨勭粨鏋滐紝鍦ㄤ笉浣跨敤瑙f瀽鏃舵崲琛岀鎴栫┖鏍间細鏇挎崲涓洪〉闈㈠厓绱犮�傚彲浣跨敤JS鐨勪竴浜涜娉曪紝濡傦細涓夊厓琛ㄨ揪寮� @field1@ > @field2@ ? 0 : 1锛汳ath瀵硅薄锛屽彇缁濆鍊� Math.abs(@field@)銆佸洓鑸嶄簲鍏� Math.round(@field@)绛�', + placeholder: '渚嬪锛欯price@ * @number@', + required: true + }, + { + type: 'radio', + key: 'noValue', + label: '绌哄��', + initVal: card.noValue || 'show', + tooltip: '褰撳厓绱犲唴瀹逛负绌烘椂锛屾槸鍚︽樉绀哄綋鍓嶅厓绱犮��', + required: false, + options: [ + { value: 'show', text: '鏄剧ず' }, + { value: 'hide', text: '闅愯棌' } + ] + }, + { + type: 'radio', + key: 'fixStyle', + label: '鍓嶅悗缂�', + initVal: card.fixStyle || '', + tooltip: '鍓嶇紑涓庡悗缂�锛屼娇鐢ㄤ笌鍐呭缁熶竴鐨勬牱寮忚繕鏄嫭绔嬫牱寮忋��', + required: false, + options: [ + { value: '', text: '缁熶竴鏍峰紡' }, + { value: 'alone', text: '鐙珛鏍峰紡' } + ] + }, + { + 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: 300, + label: '瀛椾綋澶у皬', + initVal: card.fixSize || 14, + tooltip: '鍓嶇紑銆佸悗缂�鐨勫瓧浣撳ぇ灏忋��', + required: true + }, + { + type: 'color', + key: 'fixColor', + label: '瀛椾綋棰滆壊', + initVal: card.fixColor || 'rgba(0, 0, 0, 0.65)', + tooltip: '鍓嶇紑銆佸悗缂�鐨勫瓧浣撻鑹层��', + required: true + }, + { + type: 'number', + key: 'fixLeft', + min: 0, + max: 1000, + label: '宸﹁竟璺�', + initVal: card.fixLeft || 0, + tooltip: '鍓嶇紑銆佸悗缂�鐨勫乏杈硅窛銆�', + required: false + }, + { + type: 'number', + key: 'fixRight', + min: 0, + max: 1000, + label: '鍙宠竟璺�', + initVal: card.fixRight || 0, + tooltip: '鍓嶇紑銆佸悗缂�鐨勫彸杈硅窛銆�', + required: false }, ] -- Gitblit v1.8.0