From b69b5f6329ca5f87932436b7a6c1ddfc3377e10f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 16 五月 2024 10:56:41 +0800 Subject: [PATCH] 2024-05-16 --- src/menu/components/card/balcony/options.jsx | 446 +++++++++++++++++++++++++++++++------------------------ 1 files changed, 254 insertions(+), 192 deletions(-) diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx index ecd14d8..c73bf93 100644 --- a/src/menu/components/card/balcony/options.jsx +++ b/src/menu/components/card/balcony/options.jsx @@ -1,195 +1,257 @@ +import React from 'react' +import MenuUtils from '@/utils/utils-custom.js' + /** * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 */ -export const balconyWrapForm = [ - { - type: 'text', - field: 'name', - label: '缁勪欢鍚嶇О', - initval: '', - tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', - required: true - }, - { - type: 'number', - field: 'width', - label: '瀹藉害', - initval: '', - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', - min: 1, - max: 24, - precision: 0, - required: true - }, - { - type: 'radio', - field: 'datatype', - label: '鏁版嵁鏉ユ簮', - initval: '', - tooltip: '閫夋嫨闈欐�佸�硷紝鏃犻渶閰嶇疆鏁版嵁婧愩��', - required: false, - options: [ - {value: 'dynamic', label: '鍔ㄦ��'}, - {value: 'static', label: '闈欐��'}, - ] - }, - { - type: 'radio', - field: 'linkType', - label: '鍙楁帶绫诲瀷', - initval: 'static', - tooltip: '缁勪欢涓庡叾浠栫粍浠朵箣闂寸殑鎺у埗绫诲瀷锛岀嫭绔嬭〃绀轰笌鍏朵粬娌℃湁鍏宠仈銆�', - required: false, - options: [ - {value: 'static', label: '鐙珛'}, - {value: 'sync', label: '鍚屾'}, - {value: 'sup', label: '涓婄骇'}, - ], - controlFields: [ - {field: 'supModule', values: ['sup']}, - {field: 'supControl', values: ['sup']}, - {field: 'syncModule', values: ['sync']}, - {field: 'checkAll', values: ['sync']}, - ] - }, - { - type: 'cascader', - field: 'supModule', - label: '涓婄骇缁勪欢', - initval: '', - required: true, - options: [] - }, - { - type: 'radio', - field: 'supControl', - label: '鏄剧ず鎺у埗', - tooltip: '褰撳墠缁勪欢鍦ㄤ富琛ㄩ�変腑琛屾椂鏄剧ず锛岃繕鏄缁堟樉绀恒��', - initval: 'show', - required: false, - options: [ - {value: 'hidden', label: '閫夎'}, - {value: 'show', label: '濮嬬粓'}, - ] - }, - { - type: 'cascader', - field: 'syncModule', - label: '鍚屾缁勪欢', - initval: '', - required: true, - options: [] - }, - { - type: 'radio', - field: 'checkAll', - label: '鍏ㄩ��', - initval: 'hidden', - tooltip: '褰撳悓姝ョ粍浠跺彲澶氶�夋椂锛岃缃叏閫夋湁鏁堛��', - required: false, - options: [ - {value: 'hidden', label: '闅愯棌'}, - {value: 'show', label: '鏄剧ず'}, - ] - }, - { - type: 'radio', - field: 'position', - label: '浣嶇疆', - initval: 'relative', - tooltip: '浣跨敤鍥哄畾瀹氫綅鏃讹紝璇峰湪娴嬭瘯鐜涓煡鐪嬪畾浣嶆晥鏋溿��', - required: false, - options: [ - {value: 'relative', label: '鐩稿瀹氫綅'}, - {value: 'fixed', label: '鍥哄畾瀹氫綅'}, - ], - controlFields: [ - {field: 'quick', values: ['fixed']}, - {field: 'top', values: ['fixed']}, - {field: 'right', values: ['fixed']}, - {field: 'bottom', values: ['fixed']}, - {field: 'left', values: ['fixed']}, - {field: 'realwidth', values: ['fixed']}, - {field: 'transform', values: ['fixed']}, - ] - }, - { - type: 'select', - field: 'quick', - label: '蹇嵎閫夋嫨', - initval: '', - required: false, - subFields: ['top', 'left', 'right', 'bottom', 'transform'], - options: [ - {value: 'top', label: '涓�', top: '0px', left: '0px', right: '0px', bottom: '', transform: ''}, - {value: 'top-left', label: '宸︿笂', top: '0px', left: '0px', right: '', bottom: '', transform: ''}, - {value: 'top-right', label: '鍙充笂', top: '0px', left: '', right: '0px', bottom: '', transform: ''}, - {value: 'left-middle', label: '宸︿腑', top: '50%', left: '0px', right: '', bottom: '', transform: 'translateY(-50%)'}, - {value: 'right-middle', label: '鍙充腑', top: '50%', left: '', right: '0px', bottom: '', transform: 'translateY(-50%)'}, - {value: 'bottom-left', label: '宸︿笅', top: '', left: '0px', right: '', bottom: '0px', transform: ''}, - {value: 'bottom-right', label: '鍙充笅', top: '', left: '', right: '0px', bottom: '0px', transform: ''}, - {value: 'bottom', label: '涓�', top: '', left: '0px', right: '0px', bottom: '0px', transform: ''}, - {value: 'middle', label: '涓棿', top: '50%', left: '50%', right: '', bottom: '', transform: 'translate(-50%, -50%)'} - ] - }, - { - type: 'styleInput', - field: 'top', - label: '璺濅笂', - initval: '', - required: false - }, - { - type: 'styleInput', - field: 'right', - label: '璺濆彸', - initval: '', - required: false - }, - { - type: 'styleInput', - field: 'bottom', - label: '璺濅笅', - initval: '', - required: false - }, - { - type: 'styleInput', - field: 'left', - label: '璺濆乏', - initval: '', - required: false - }, - { - type: 'styleInput', - field: 'realwidth', - label: '瀹為檯瀹藉害', - initval: '', - required: false - }, - { - type: 'select', - field: 'transform', - label: '鍙樻崲', - initval: '', - required: false, - options: [ - {value: 'translateY(-50%)', label: '涓婄Щ50%'}, - {value: 'translateY(50%)', label: '涓嬬Щ50%'}, - {value: 'translateX(-50%)', label: '宸︾Щ50%'}, - {value: 'translateX(50%)', label: '鍙崇Щ50%'}, - {value: 'translate(-50%, -50%)', label: '宸︿笂绉�50%'}, - {value: 'translate(-50%, 50%)', label: '宸︿笅绉�50%'}, - {value: 'translate(50%, -50%)', label: '鍙充笂绉�50%'}, - {value: 'translate(50%, 50%)', label: '鍙充笅绉�50%'}, - ] - }, - { - type: 'multiselect', - field: 'blacklist', - label: '榛戝悕鍗�', - initval: '', - required: false, - options: [] - }, -] \ No newline at end of file +export default function (wrap, buttons, columns) { + let menu = window.GLOB.customMenu + let isprint = sessionStorage.getItem('MenuType') === 'billPrint' + let ispop = sessionStorage.getItem('editMenuType') === 'popview' + + let modules = MenuUtils.getLinkModules(menu.components) || [] + let supmodules = MenuUtils.getSupModules(menu.components, '', menu.interfaces) + let roleList = sessionStorage.getItem('sysRoles') + let appType = sessionStorage.getItem('appType') + + let interfaces = [] + if (menu.interfaces) { + menu.interfaces.forEach(item => { + if (item.status === 'true') { + interfaces.push({ + value: item.uuid, + label: item.name + }) + } + }) + } + + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch (e) { + roleList = [] + } + } else { + roleList = [] + } + + const balconyWrapForm = [ + { + type: 'text', + field: 'name', + label: '缁勪欢鍚嶇О', + initval: wrap.name || '', + tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', + required: true + }, + { + type: 'number', + field: 'width', + label: '瀹藉害', + initval: wrap.width || 24, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + min: 1, + max: 24, + precision: 0, + required: true + }, + { + type: 'radio', + field: 'datatype', + label: '鏁版嵁鏉ユ簮', + initval: wrap.datatype || 'static', + tooltip: '閫夋嫨闈欐�佸�硷紝鏃犻渶閰嶇疆鏁版嵁婧愩��', + required: false, + options: [ + {value: 'dynamic', label: '鍔ㄦ��'}, + {value: 'static', label: '闈欐��'}, + {value: 'public', label: '鍏叡鏁版嵁婧�'}, + ], + controlFields: [ + {field: 'empty', values: ['dynamic']}, + {field: 'publicId', values: ['public']}, + {field: 'bgField', values: ['dynamic', 'public']}, + ] + }, + { + type: 'select', + field: 'publicId', + label: '鏁版嵁婧�', + initval: wrap.publicId || '', + required: true, + options: interfaces, + reset_source: true, + 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 _bgField = map.get('bgField') + + if (_bgField && !_bgField.forbid) { + _bgField.options = columns + _bgField.oriOptions = columns + map.set('bgField', _bgField) + } + } + }, + { + type: 'radio', + field: 'linkType', + label: '鍙楁帶绫诲瀷', + initval: wrap.linkType || 'static', + tooltip: <div> + <div>缁勪欢涓庡叾浠栫粍浠朵箣闂寸殑鎺у埗绫诲瀷: </div> + <div>1銆佺嫭绔嬭〃绀轰笌鍏朵粬缁勪欢娌℃湁鍏宠仈銆�</div> + <div>2銆佸悓姝ョ被鍨嬩腑鍏紡銆佹寜閽互鍙婂叏閫夊厓绱犳瘮杈冪壒娈婏紝鎿嶄綔鏁版嵁涓哄叾鍚屾缁勪欢鐨勬暟鎹��</div> + <div>3銆佷笂绾х被鍨嬮渶娣诲姞褰撳墠缁勪欢鐨勪笂绾х粍浠讹紝骞跺彲璁剧疆褰撳墠缁勪欢涓哄缁堟樉绀猴紝杩樻槸鍙湁鍦ㄤ笂绾х粍浠堕�夎鍚庢墠鏄剧ず銆�</div> + </div>, + toolWidth: 400, + required: false, + options: [ + {value: 'static', label: '鐙珛'}, + {value: 'sync', label: '鍚屾'}, + {value: 'sup', label: '涓婄骇'}, + ], + controlFields: [ + {field: 'supModule', values: ['sup']}, + {field: 'supControl', values: ['sup']}, + {field: 'syncModule', values: ['sync']}, + {field: 'checkAll', values: ['sync']}, + ], + forbid: isprint + }, + { + type: 'cascader', + field: 'supModule', + label: '涓婄骇缁勪欢', + initval: wrap.supModule || [], + // tooltip: '褰撲笂绾х粍浠朵笉瀛樺湪鎴栨病鏈夋潈闄愭椂锛屽綋鍓嶇粍浠朵笉鏄剧ず銆�', + required: true, + options: supmodules, + forbid: isprint + }, + { + type: 'radio', + field: 'supControl', + label: '鏄剧ず鎺у埗', + initval: wrap.supControl || 'show', + tooltip: '褰撳墠缁勪欢鍦ㄤ富琛ㄩ�変腑琛屾椂鏄剧ず锛岃繕鏄缁堟樉绀恒��', + required: false, + options: [ + {value: 'hidden', label: '閫夎'}, + {value: 'show', label: '濮嬬粓'}, + ], + forbid: isprint + }, + { + type: 'cascader', + field: 'syncModule', + label: '鍚屾缁勪欢', + initval: wrap.syncModule || '', + tooltip: '褰撳悓姝ョ粍浠朵笉瀛樺湪鎴栨病鏈夋潈闄愭椂锛屽綋鍓嶇粍浠朵笉鏄剧ず銆�', + required: true, + options: modules, + forbid: isprint + }, + { + type: 'radio', + field: 'checkAll', + label: '鍏ㄩ��', + initval: wrap.checkAll || 'hidden', + tooltip: '褰撳悓姝ョ粍浠跺彲澶氶�夋椂锛岃缃叏閫夋湁鏁堛��', + required: false, + options: [ + {value: 'hidden', label: '闅愯棌'}, + {value: 'show', label: '鏄剧ず'}, + ], + forbid: isprint + }, + { + type: 'radio', + field: 'empty', + label: '绌哄�奸殣钘�', + initval: wrap.empty || 'show', + tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', + required: false, + skip: true, + options: [ + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, + ], + }, + { + type: 'select', + field: 'bgField', + label: '鑳屾櫙鍥�', + initval: wrap.bgField || '', + tooltip: '鍔ㄦ�佽儗鏅紝鑳屾櫙鍥剧墖鐢卞瓧娈靛�兼帶鍒躲�傝娉ㄦ剰璋冩暣鑳屾櫙鏍峰紡銆�', + required: false, + options: columns + }, + { + type: 'radio', + field: 'printType', + label: '缁勪欢绫诲瀷', + initval: wrap.printType || 'content', + tooltip: '閫夋嫨绫诲瀷涓恒�婇〉鐪�/椤佃剼銆嬫椂锛屾墦鍗扮殑姣忛〉閲岄兘浼氬甫鏈夎缁勪欢銆傛敞锛氶〉鐪夐〉鑴氫腑鏂囨湰鍏冪礌灏嗘浛鎹� @pageIndex@锛堥〉鐮侊級銆丂total@锛堟�绘暟锛夈�丂date@锛堝綋鍓嶆棩鏈燂級銆丂datetime@锛堝綋鍓嶆椂闂达級锛屼娇鐢ㄥ垎椤靛弬鏁版椂娉ㄦ剰鎵撳嵃妯℃澘鐨勯〉闈㈠竷灞�浣跨敤鍒嗛〉銆�', + required: false, + options: [ + {value: 'content', label: '娴姩鍗�'}, + {value: 'headerOrfooter', label: '椤电湁/椤佃剼'}, + ], + forbid: !isprint + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || (!appType ? 'true' : 'false'), + required: false, + options: [ + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: ispop || isprint + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: ispop || isprint + }, + { + type: 'select', + field: 'linkbtn', + label: '鍏宠仈鎸夐挳', + initval: wrap.linkbtn || '', + required: false, + options: buttons, + forbid: isprint + }, + { + type: 'multiselect', + field: 'blacklist', + label: '榛戝悕鍗�', + initval: wrap.blacklist || [], + required: false, + options: roleList, + forbid: !!appType || isprint + }, + ] + + return balconyWrapForm +} \ No newline at end of file -- Gitblit v1.8.0