From 08cce3334a2dc81d690b518136b0aaea64e48b0b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 14 六月 2023 09:55:50 +0800 Subject: [PATCH] 2023-06-14 --- src/menu/components/card/data-card/options.jsx | 326 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 300 insertions(+), 26 deletions(-) diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 67d8f47..9f2edb2 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -1,20 +1,38 @@ -import { fromJS } from 'immutable' import MenuUtils from '@/utils/utils-custom.js' /** * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 */ -export default function (wrap, subtype, columns = [], id = '', supNodes = []) { +export default function (wrap, subtype, columns = [], id = '', supNodes = [], setting, buttons = []) { let appType = sessionStorage.getItem('appType') let MenuType = '' - let menu = fromJS(window.GLOB.customMenu).toJS() + let menu = window.GLOB.customMenu + let laypage = setting && setting.laypage !== 'false' + let interfaces = [] + if (subtype === 'propcard' && menu.interfaces) { + menu.interfaces.forEach(item => { + if (item.status === 'true') { + interfaces.push({ + value: item.uuid, + label: item.name + }) + } + }) + } if (menu.parentId === 'BillPrintTemp') { MenuType = 'billPrint' } let modules = [] if (subtype === 'propcard' || subtype === 'datacard') { - modules = MenuUtils.getSupModules(menu.components, id) || [] + modules = MenuUtils.getSupModules(menu.components, id, menu.interfaces) + + if (subtype === 'propcard' && wrap.supModule && wrap.supModule.length > 0 && wrap.supModule[0] !== 'empty') { + let has = MenuUtils.checkSupModules(modules, wrap.supModule.slice(-1)[0]) + if (!has) { + wrap.supModule = '' + } + } } let roleList = sessionStorage.getItem('sysRoles') @@ -27,6 +45,21 @@ } } else { roleList = [] + } + + let menulist = [] + + if (appType === 'mob') { + menulist = sessionStorage.getItem('appMenus') + if (menulist) { + try { + menulist = JSON.parse(menulist) + } catch (e) { + menulist = [] + } + } else { + menulist = [] + } } const cardWrapForm = [ @@ -66,28 +99,99 @@ options: [ {value: 'dynamic', label: '鍔ㄦ��', priKeyType: 'static'}, {value: 'static', label: '闈欐��', priKeyType: 'static'}, + {value: 'public', label: '鍏叡鏁版嵁婧�', priKeyType: 'static'}, ], linkFields: ['priKeyType'], controlFields: [ - {field: 'goback', values: ['dynamic']}, - {field: 'empty', values: ['dynamic']}, + {field: 'goback', values: ['dynamic', 'public']}, + {field: 'empty', values: ['dynamic', 'public']}, + {field: 'jump', values: ['dynamic', 'public']}, + {field: 'broadcast', values: ['dynamic', 'public']}, + {field: 'autoExec', values: ['dynamic', 'public']}, {field: 'supModule', values: ['static']}, + {field: 'publicId', values: ['public']}, ], forbid: subtype !== 'propcard' + }, + { + type: 'select', + field: 'publicId', + label: '鏁版嵁婧�', + initval: wrap.publicId || '', + required: true, + options: interfaces, + reset_source: true, + forbid: subtype !== 'propcard', + callback: (map, record) => { + if (!record.publicId) return + + let interfaces = window.GLOB.customMenu.interfaces || [] + + let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0] + + if (!d || !d.columns) return + let columns = JSON.parse(JSON.stringify(d.columns)) + + let _broadcast = map.get('broadcast') + + if (_broadcast && !_broadcast.forbid) { + _broadcast.options = columns + _broadcast.oriOptions = columns + map.set('broadcast', _broadcast) + } + + let _jumpField = map.get('jumpField') + + if (_jumpField && !_jumpField.forbid) { + _jumpField.options = columns + _jumpField.oriOptions = columns + map.set('jumpField', _jumpField) + } + + let _link = map.get('link') + + if (_link && !_link.forbid) { + _link.options = columns + _link.oriOptions = columns + map.set('link', _link) + } + } + }, + { + type: 'radio', + field: 'layout', + label: '鍗$墖甯冨眬', + initval: wrap.layout || 'grid', + tooltip: appType === 'mob' ? '寮规�у竷灞�鏃讹紝婊戝姩鍔犺浇鏃犳晥' : '寮规�у竷灞�鏃讹紝宸﹀彸鍒囨崲鏃犳晥', + required: false, + options: [ + {value: 'grid', label: '鏍呮牸甯冨眬'}, + {value: 'flex', label: '寮规�у竷灞�'}, + ], + controlFields: subtype !== 'propcard' ? [ + {field: 'printHeight', values: ['flex']}, + {field: 'cardFloat', values: ['grid']}, + ] : [{field: 'cardFloat', values: ['grid']}], + forbid: subtype === 'tablecard' }, { type: 'radio', field: 'pagestyle', label: '鍒嗛〉椋庢牸', initval: wrap.pagestyle || 'page', - tooltip: '鏁版嵁婧愰�夋嫨鍒嗛〉鏃舵湁鏁堛�傛敞锛氭粦鍔ㄥ姞杞藉彧鏈夌涓�涓湁鏁�', + tooltip: '鏁版嵁婧愰�夋嫨鍒嗛〉鏃舵湁鏁堛�傛敞锛氬脊鎬у竷灞�鏃跺浐瀹氫负椤电爜銆�', required: false, + disabled: !laypage, options: [ {value: 'page', label: '椤电爜'}, - {value: 'switch', label: '宸﹀彸鍒囨崲', forbid: appType === 'mob'}, - {value: 'slide', label: '婊戝姩鍔犺浇', forbid: appType !== 'mob'}, + {value: 'switch', label: '宸﹀彸鍒囨崲', forbid: appType === 'mob' || subtype === 'tablecard'}, + {value: 'slide', label: '婊戝姩鍔犺浇', forbid: appType !== 'mob' || sessionStorage.getItem('editMenuType') === 'popview'}, + {value: 'more', label: '鏌ョ湅鏇村'}, ], - forbid: !(subtype === 'datacard' || (subtype === 'tablecard' && appType === 'mob')) + controlFields: [ + {field: 'slidetip', values: ['slide']}, + ], + forbid: subtype === 'propcard' }, { type: 'radio', @@ -121,20 +225,40 @@ {ParentID: 'dynamic', value: 'static', label: '闈欐�佸��'}, {ParentID: 'dynamic', value: 'dynamic', label: '鍔ㄦ�佸��'}, {ParentID: 'dynamic', value: 'joint', label: '鎷兼帴鍊�'}, + {ParentID: 'public', value: 'static', label: '闈欐�佸��'}, + {ParentID: 'public', value: 'dynamic', label: '鍔ㄦ�佸��'}, + {ParentID: 'public', value: 'joint', label: '鎷兼帴鍊�'}, ], forbid: subtype !== 'propcard' }, { - type: 'radio', + type: 'select', field: 'selected', - label: '棣栬閫変腑', + label: '鏁版嵁閫変腑', initval: wrap.selected || 'false', + tooltip: '鍒濆鍖栵細鏁版嵁鍔犺浇鏃堕�変腑棣栬鏁版嵁锛屼粎鎵ц涓�娆°�傛暟鎹姞杞斤細姣忔鏁版嵁鍔犺浇鏃跺潎閫変腑棣栬锛堝綋鎸夐挳鎵ц瀹屾垚骞惰繑鍥炰富閿�兼椂锛岄粯璁ら�変腑涓婚敭鍊煎搴旇锛夈�傞�変腑鏍囪锛氳繑鍥炴暟鎹腑瀛樺湪 selected 瀛楁锛屼笖鍊间负 true 鐨勬暟鎹閫変腑銆�', required: false, options: [ {value: 'false', label: '鏃�'}, {value: 'init', label: '鍒濆鍖�'}, {value: 'always', label: '鏁版嵁鍔犺浇'}, - ] + {value: 'sign', label: '閫変腑鏍囪'} + ], + forbid: subtype !== 'datacard' + }, + { + type: 'radio', + field: 'selected', + label: '鏁版嵁閫変腑', + initval: wrap.selected || 'false', + tooltip: '鍒濆鍖栵細鏁版嵁鍔犺浇鏃堕�変腑棣栬鏁版嵁锛屼粎鎵ц涓�娆°�傛暟鎹姞杞斤細姣忔鏁版嵁鍔犺浇鏃跺潎閫変腑棣栬銆�', + required: false, + options: [ + {value: 'false', label: '鏃�'}, + {value: 'init', label: '鍒濆鍖�'}, + {value: 'always', label: '鏁版嵁鍔犺浇'}, + ], + forbid: subtype !== 'propcard' }, { type: 'select', @@ -148,9 +272,13 @@ {value: 'active', label: '澶栭槾褰�'}, {value: 'backFont', label: '鑳屾櫙+鏂囧瓧'}, {value: 'font', label: '鏂囧瓧'}, - ...(subtype === 'datacard' && appType === 'mob' ? [{value: 'check', label: '鍕鹃��'}] : []) - ] - // forbid: subtype !== 'propcard' + {value: 'tabs', label: '鏍囩椤�'}, + ...(subtype === 'datacard' ? [ + {value: 'check', label: '鍕鹃�夛紙鍦嗘锛�'}, + {value: 'check square', label: '鍕鹃�夛紙鏂规锛�'} + ] : []) + ], + forbid: subtype === 'tablecard' }, // { // type: 'radio', @@ -169,7 +297,7 @@ field: 'cardFloat', label: '瀵归綈鏂瑰紡', initval: wrap.cardFloat || 'left', - tooltip: '璁剧疆涓哄眳涓榻愭垨鍙冲榻愶紝鍙湪鍗$墖涓�1琛屾椂鏈夋晥銆�', + tooltip: '璁剧疆鍗$墖鐨勫榻愭柟寮忋��', required: false, options: [ {value: 'left', label: '宸﹀榻�'}, @@ -193,6 +321,19 @@ }, { type: 'radio', + field: 'parity', + label: '濂囧伓鑳屾櫙', + initval: wrap.parity || 'false', + tooltip: '鍋舵暟琛屼細娣诲姞鑳屾櫙鑹层��', + required: false, + options: [ + {value: 'false', label: '鏃�'}, + {value: 'true', label: '鏈�'}, + ], + forbid: subtype === 'propcard' + }, + { + type: 'radio', field: 'printType', label: '缁勪欢绫诲瀷', initval: wrap.printType || 'content', @@ -202,14 +343,26 @@ {value: 'content', label: '鍐呭'}, {value: 'headerOrfooter', label: '椤电湁/椤佃剼'}, ], + controlFields: [ + {field: 'printHeight', values: ['content']}, + ], forbid: subtype !== 'propcard' || MenuType !== 'billPrint' + }, + { + type: 'number', + field: 'printHeight', + label: '鎹㈢畻楂樺害', + initval: wrap.printHeight || '', + tooltip: subtype !== 'propcard' ? '褰撳墠鏁版嵁鍗¢珮搴︾浉褰撲簬鍑犳潯鏁版嵁銆�' : '褰撳墠灞炴�у崱楂樺害鐩稿綋浜庡嚑鏉℃暟鎹��', + required: false, + forbid: subtype === 'tablecard' || MenuType !== 'billPrint' }, { type: 'select', field: 'broadcast', label: '璇煶鎾姤', initval: wrap.broadcast || '', - tooltip: '璇煶鎾姤鍦ㄧЩ鍔ㄧapp涓湁鏁堛�傛敞锛氫娇鐢ㄨ闊虫挱鎶ユ椂锛屾暟鎹簮涓嶈浣跨敤鍚屾鏌ヨ锛屾坊鍔犲畾鏃跺櫒鏃讹紝鍙惊鐜挱鎶�', + tooltip: '璇煶鎾姤鍦ㄧЩ鍔ㄧ鏈夋晥銆傛敞锛氬湪H5涓浣跨敤闊抽閾炬帴锛屾坊鍔犲畾鏃跺櫒鏃讹紝鍙惊鐜挱鎶�', required: false, options: columns, forbid: !columns || appType !== 'mob' || subtype !== 'propcard' @@ -217,15 +370,31 @@ { type: 'radio', field: 'goback', - label: '绌哄�艰繑鍥�', + label: appType === 'mob' ? '绌哄�艰繑鍥�' : '绌哄�煎叧闂�', initval: wrap.goback || 'false', - tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岃繑鍥炰笂涓�鐣岄潰銆�', + tooltip: appType === 'mob' ? '褰撴煡璇㈡暟鎹负绌烘椂锛岃繑鍥炰笂涓�鐣岄潰銆�' : '褰撴煡璇㈡暟鎹负绌烘椂锛屽叧闂綋鍓嶆爣绛鹃〉銆�', required: false, options: [ - {value: 'true', label: '鏄�'}, {value: 'false', label: '鍚�'}, + {value: 'true', label: '鏄�'}, ], - forbid: subtype !== 'propcard' || appType !== 'mob' + forbid: subtype !== 'propcard' || appType === 'pc' + }, + { + type: 'radio', + field: 'display', + label: '鏄剧ず鎺у埗', + initval: wrap.display || 'normal', + tooltip: '褰撲娇鐢ㄥ睘鎬у崱杩涜鏌愪簺涓氬姟鎿嶄綔锛屼笖涓嶉渶瑕佸睍绀哄崱鐗囦俊鎭椂锛屽彲璁剧疆涓轰笉鍙銆�', + required: false, + options: [ + {value: 'normal', label: '姝e父鏄剧ず'}, + {value: 'hidden', label: '涓嶅彲瑙�'}, + ], + controlFields: [ + {field: 'empty', values: ['normal']}, + ], + forbid: subtype !== 'propcard' }, { type: 'radio', @@ -239,6 +408,90 @@ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, ], + }, + { + type: 'select', + field: 'autoExec', + label: '鑷姩鎵ц', + initval: wrap.autoExec || '', + tooltip: '鏁版嵁鏇存柊鏃惰嚜鍔ㄦ墽琛屾寜閽�傛敞锛氭鎸夐挳鎵ц鎴愬姛鍚庤皑鎱庨�夋嫨鍒锋柊椤癸紝閬垮厤閫犳垚寰幆鎵ц銆�', + required: false, + options: buttons, + forbid: subtype !== 'propcard' + }, + { + type: 'radio', + field: 'jump', + label: '椤甸潰璺宠浆', + initval: wrap.jump || '', + tooltip: '閫氳繃鏌ヨ杩斿洖鍊煎垽鏂〉闈㈡槸鍚﹁璺宠浆銆�', + required: false, + options: [ + {value: '', label: '鏃�'}, + {value: 'menu', label: '鑿滃崟'}, + {value: 'link', label: '閾炬帴'}, + ], + controlFields: [ + {field: 'jumpField', values: ['menu', 'link']}, + {field: 'joint', values: ['menu', 'link']}, + {field: 'open', values: ['menu', 'link']}, + {field: 'menu', values: ['menu']}, + {field: 'link', values: ['link']}, + ], + forbid: subtype !== 'propcard' || appType !== 'mob' + }, + { + type: 'select', + field: 'jumpField', + label: '鎺у埗瀛楁', + initval: wrap.jumpField || '', + tooltip: '褰撳瓧娈靛�间负true鏃惰Е鍙戣烦杞��', + required: true, + options: columns, + forbid: subtype !== 'propcard' || appType !== 'mob' + }, + { + type: 'select', + field: 'menu', + label: '鑿滃崟', + initval: wrap.menu || '', + required: true, + options: menulist, + forbid: subtype !== 'propcard' || appType !== 'mob' + }, + { + type: 'select', + field: 'link', + label: '閾炬帴瀛楁', + initval: wrap.link || '', + tooltip: '璺宠浆閾炬帴涓烘煡璇㈡暟鎹殑杩斿洖鍊笺��', + required: true, + options: columns, + forbid: subtype !== 'propcard' || appType !== 'mob' + }, + { + type: 'radio', + field: 'joint', + label: '鍙傛暟鎷兼帴', + initval: wrap.joint || 'true', + required: false, + options: [ + {value: 'true', label: '鏄�'}, + {value: 'false', label: '鍚�'}, + ], + forbid: subtype !== 'propcard' || appType !== 'mob' + }, + { + type: 'radio', + field: 'open', + label: '鎵撳紑鏂瑰紡', + initval: wrap.open || 'blank', + required: false, + options: [ + {value: 'blank', label: '鏂扮獥鍙�'}, + {value: 'self', label: '褰撳墠绐楀彛'}, + ], + forbid: subtype !== 'propcard' || appType !== 'mob' }, { type: 'radio', @@ -280,9 +533,9 @@ { type: 'text', field: 'controlVal', - label: '鎺у埗鍊�', + label: '绂佺敤鍊�', initval: wrap.controlVal || '', - tooltip: '褰撳瓧娈靛�间笌鎺у埗鍊肩浉绛夋椂锛岃鏁版嵁浼氱鐢紝澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', + tooltip: '褰撳瓧娈靛�间笌绂佺敤鍊肩浉绛夋椂锛岃鏁版嵁浼氱鐢紝澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', required: false, forbid: subtype !== 'datacard' }, @@ -303,6 +556,18 @@ ] }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || (!appType ? 'true' : 'false'), + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', @@ -310,6 +575,15 @@ required: false, options: roleList, forbid: !!appType + }, + { + type: 'text', + field: 'slidetip', + label: '搴曢儴鎻愮ず', + initval: wrap.slidetip || wrap.slidetip === '' ? wrap.slidetip : '娌℃湁鏇村浜�', + tooltip: '婊戝姩鍔犺浇鑷冲簳閮ㄦ椂鐨勬彁绀轰俊鎭��', + required: false, + forbid: !laypage || appType !== 'mob' || subtype === 'propcard' }, { type: 'table', @@ -342,11 +616,11 @@ } ] - return cardWrapForm.map(item => { + return cardWrapForm.filter(item => { if (['pagestyle'].includes(item.field)) { item.options = item.options.filter(option => !option.forbid) } - return item + return !item.forbid }) } \ No newline at end of file -- Gitblit v1.8.0