From 072227ec43346c50c93cda3bf21c346f463eb551 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 19 十月 2023 22:28:56 +0800 Subject: [PATCH] 2023-10-19 --- src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 186 +++++++++++++++++++++++++++++----------------- 1 files changed, 118 insertions(+), 68 deletions(-) diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx index 7630d36..afb5789 100644 --- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -3,7 +3,6 @@ * @param {object} card // 鎼滅储鏉′欢瀵硅薄 */ export function getColumnForm (card, fields = []) { - let appType = sessionStorage.getItem('appType') let roleList = sessionStorage.getItem('sysRoles') if (roleList) { try { @@ -15,13 +14,7 @@ roleList = [] } - let menulist = [] - - if (appType === 'pc') { - menulist = sessionStorage.getItem('appMenus') - } else if (!appType) { - menulist = sessionStorage.getItem('fstMenuList') - } + let menulist = sessionStorage.getItem('fstMenuList') if (menulist) { try { @@ -40,8 +33,17 @@ value: 'number', text: '鏁板瓧' }, { + value: 'custom', + text: '鑷畾涔夊垪' + }, { + value: 'formula', + text: '鍏紡' + }, { value: 'picture', text: '鍥剧墖' + }, { + value: 'video', + text: '瑙嗛' }, { value: 'link', text: '閾炬帴' @@ -49,28 +51,16 @@ value: 'textarea', text: '澶氳鏂囨湰' }, { - value: 'custom', - text: '鑷畾涔夊垪' - }, { value: 'colspan', text: '鍚堝苟鍒�' - }, { - value: 'formula', - text: '鍏紡' }, { value: 'index', text: '搴忓彿' }] - if (!card.isSub) { - options.push({ - value: 'action', - text: '鎿嶄綔' - }) - } - - if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { - card.perspective = '' + let decimal = card.decimal === undefined ? 0 : card.decimal + if (card.type === 'formula' && typeof(card.decimal) !== 'number') { + decimal = '' } return [ @@ -79,7 +69,11 @@ key: 'label', label: '鍒楀ご鏂囧瓧', initVal: card.label, - required: true + required: true, + rules: [{ + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] }, { type: 'select', @@ -90,20 +84,30 @@ options: options }, { - type: 'select', + type: card.isSub ? 'select' : 'text', key: 'field', label: '瀛楁', initVal: card.field, required: true, - options: fields + options: card.isSub ? fields : [], + rules: [{ + pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, + message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] }, { - type: 'select', + type: 'text', key: 'nameField', label: '鍚嶇О瀛楁', initVal: card.nameField || '', required: false, - options: [{uuid: 'empty', field: '', label: '绌�'}, ...fields] + rules: [{ + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] }, { type: 'number', @@ -147,7 +151,7 @@ type: 'radio', key: 'IsSort', label: '鎺掑簭', - initVal: card.IsSort || (card.isSub ? 'false' : 'true'), + initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'), required: true, options: [{ value: 'true', @@ -155,6 +159,32 @@ }, { value: 'false', text: '鍚�' + }] + }, + { + type: 'select', + key: 'sortField', + label: '鎺掑簭瀛楁', + initVal: card.sortField || '', + required: true, + options: fields + }, + { + type: 'radio', + key: 'eval', + label: '瑙f瀽鏂瑰紡', + initVal: card.eval || 'false', + tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滆绠椻�濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃瓧娈垫浛鎹⑩�濓紝浣跨敤鍑芥暟鏃跺叆鍙備负data锛堟暟缁勶級銆�', + required: false, + options: [{ + value: 'false', + text: '瀛楁鏇挎崲' + }, { + value: 'true', + text: '璁$畻' + }, { + value: 'func', + text: '鍑芥暟' }] }, { @@ -173,6 +203,26 @@ value: 'right', text: '鍙冲榻�' }] + }, + { + type: 'number', + key: 'startTime', + precision: 0, + label: '寮�濮嬫椂闂�', + initVal: card.startTime || 0, + 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', @@ -202,7 +252,16 @@ }, { value: 'false', text: '鍚�' - }] + }], + forbid: card.isSub || card.sum !== 'true' + }, + { + type: 'number', + key: 'fieldlength', + label: '瀛楁闀垮害', + initVal: card.fieldlength || 50, + required: true, + forbid: card.isSub }, { type: 'number', @@ -211,8 +270,8 @@ max: 18, decimal: 0, label: '灏忔暟浣�', - initVal: card.decimal || 0, - required: true + initVal: decimal, + required: !card.isSub }, { type: 'select', @@ -260,7 +319,11 @@ label: '鍓嶇紑', initVal: card.prefix || '', required: false, - readonly: false + readonly: false, + rules: [{ + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] }, { type: 'text', @@ -268,7 +331,11 @@ label: '鍚庣紑', initVal: card.postfix || '', required: false, - readonly: false + readonly: false, + rules: [{ + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] }, { type: 'number', @@ -308,6 +375,18 @@ }, { type: 'radio', + key: 'backgroundSize', + label: '鍥惧儚澶у皬', + initVal: card.backgroundSize || 'cover', + required: false, + options: [ + { value: 'cover', text: '瑕嗙洊' }, + { value: 'contain', text: '鍖呭惈' }, + { value: 'auto', text: '鑷�傚簲' }, + ] + }, + { + type: 'radio', key: 'scale', label: '鐐瑰嚮缂╂斁', initVal: card.scale || 'true', @@ -335,24 +414,21 @@ value: 'linkurl', text: '閾炬帴' }], - forbidden: appType === 'mob' }, { - type: appType === 'pc' ? 'select' : 'cascader', + type: 'cascader', key: 'linkmenu', label: '鑿滃崟', - initVal: card.linkmenu || (appType === 'pc' ? '' : []), + initVal: card.linkmenu || [], required: true, - options: menulist, - forbidden: appType === 'mob' + options: menulist }, { type: 'textarea', key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', - required: true, - forbidden: appType === 'mob' + required: true }, { type: 'multiselect', @@ -361,31 +437,6 @@ initVal: card.linkfields || [], required: false, options: fields, - forbidden: appType === 'mob' - }, - { - type: 'radio', - key: 'open', - label: '鎵撳紑鏂瑰紡', - initVal: card.open || 'blank', - required: false, - forbid: appType !== 'pc', - options: [ - { value: 'blank', text: '鏂扮獥鍙�' }, - { value: 'self', text: '褰撳墠绐楀彛' } - ] - }, - { - type: 'radio', - key: 'eval', - label: '瑙f瀽', - initVal: card.eval || 'true', - tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', - required: false, - options: [ - { value: 'true', text: '鏄�' }, - { value: 'false', text: '鍚�' } - ] }, { type: 'textarea', @@ -402,8 +453,7 @@ label: '榛戝悕鍗�', initVal: card.blacklist || [], required: false, - options: roleList, - forbidden: appType === 'mob' + options: roleList } ] } -- Gitblit v1.8.0