From 21d92eff0e23974d76e3e5a79ba50e3fc1c0b879 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 四月 2022 01:08:15 +0800 Subject: [PATCH] 2022-04-15 --- src/menu/components/timeline/normal-timeline/options.jsx | 12 + src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx | 12 + src/menu/components/tree/antd-tree/options.jsx | 12 + src/tabviews/formtab/index.jsx | 9 + src/menu/components/editor/braft-editor/options.jsx | 12 + src/menu/components/table/normal-table/options.jsx | 12 + src/components/header/index.jsx | 14 + src/mob/components/tabs/antv-tabs/options.jsx | 13 + src/menu/components/card/balcony/options.jsx | 12 + src/views/rolemanage/index.jsx | 37 +++- src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx | 12 + src/menu/components/table/edit-table/options.jsx | 12 + src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx | 12 + src/menu/components/code/sandbox/options.jsx | 12 + src/views/mobdesign/index.jsx | 57 +++++- src/components/header/index.scss | 19 + src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 12 + src/mob/components/search/single-search/options.jsx | 13 + src/menu/components/carousel/data-card/options.jsx | 12 + src/menu/components/card/data-card/options.jsx | 12 + src/views/pcdesign/index.jsx | 38 ++++ src/mob/components/menubar/normal-menubar/index.jsx | 2 src/menu/components/tabs/antv-tabs/options.jsx | 12 + src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx | 12 + src/menu/components/group/normal-group/options.jsx | 12 + src/mob/components/menubar/normal-menubar/options.jsx | 13 + src/mob/components/navbar/normal-navbar/options.jsx | 13 + src/pc/components/navbar/normal-navbar/options.jsx | 13 + src/menu/components/form/normal-form/options.jsx | 12 + src/menu/components/search/main-search/options.jsx | 12 + 30 files changed, 417 insertions(+), 40 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 1b78675..5b2824b 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -38,7 +38,8 @@ visible: false, // 淇敼瀵嗙爜妯℃�佹 dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, confirmLoading: false, - userName: sessionStorage.getItem('User_Name'), + userName: '', + fullName: '', logourl: window.GLOB.mainlogo, appVersion: window.GLOB.appVersion, loginVisible: false, @@ -609,6 +610,15 @@ UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 this.getRolesMenu() + + let fullName = sessionStorage.getItem('Full_Name') || '' + let userName = sessionStorage.getItem('User_Name') || '' + + if (fullName.toLowerCase() === userName.toLowerCase()) { + userName = '' + } + + this.setState({fullName, userName}) } componentDidMount () { @@ -838,7 +848,7 @@ <div> <img src={this.state.avatar || avatar} alt=""/> <span> - <span className="username">{this.state.userName}</span> <DownOutlined /> + <span className="username"><span>{this.state.fullName}</span>{this.state.userName ? <span>{this.state.userName}</span> : null}</span> <DownOutlined /> </span> </div> </Dropdown> diff --git a/src/components/header/index.scss b/src/components/header/index.scss index 78fb275..27850ef 100644 --- a/src/components/header/index.scss +++ b/src/components/header/index.scss @@ -97,12 +97,21 @@ color: #ffffff; font-size: 0.95rem; .username { + vertical-align: middle; display: inline-block; - height: 30px; - max-width: 95px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + span { + display: block; + line-height: 15px; + padding: 0 3px; + font-size: 0.95rem; + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + span + span { + font-size: 12px; + } } } } diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx index bee1eb8..905f045 100644 --- a/src/menu/components/card/balcony/options.jsx +++ b/src/menu/components/card/balcony/options.jsx @@ -203,6 +203,18 @@ ] }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 01a1f13..e7387f6 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -408,6 +408,18 @@ ] }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/carousel/data-card/options.jsx b/src/menu/components/carousel/data-card/options.jsx index a770500..36441fe 100644 --- a/src/menu/components/carousel/data-card/options.jsx +++ b/src/menu/components/carousel/data-card/options.jsx @@ -136,6 +136,18 @@ ], }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 51a9e51..e88e500 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -58,6 +58,18 @@ required: true }, { + type: 'radio', + key: 'permission', + label: '鏉冮檺楠岃瘉', + initVal: card.permission || 'false', + required: false, + options: [ + {value: 'true', text: '鍚敤'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx index 248a75b..3add00e 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx @@ -58,6 +58,18 @@ required: true }, { + type: 'radio', + key: 'permission', + label: '鏉冮檺楠岃瘉', + initVal: card.permission || 'false', + required: false, + options: [ + {value: 'true', text: '鍚敤'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx index 4cf1a15..494a36f 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx @@ -111,6 +111,18 @@ ] }, { + type: 'radio', + key: 'permission', + label: '鏉冮檺楠岃瘉', + initVal: card.permission || 'false', + required: false, + options: [ + {value: 'true', text: '鍚敤'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx index f8135fd..79b4f14 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx @@ -53,6 +53,18 @@ required: true }, { + type: 'radio', + key: 'permission', + label: '鏉冮檺楠岃瘉', + initVal: card.permission || 'false', + required: false, + options: [ + {value: 'true', text: '鍚敤'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx index 58786ea..26955ae 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx @@ -64,6 +64,18 @@ required: true }, { + type: 'radio', + key: 'permission', + label: '鏉冮檺楠岃瘉', + initVal: card.permission || 'false', + required: false, + options: [ + {value: 'true', text: '鍚敤'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/code/sandbox/options.jsx b/src/menu/components/code/sandbox/options.jsx index 3576742..6aab039 100644 --- a/src/menu/components/code/sandbox/options.jsx +++ b/src/menu/components/code/sandbox/options.jsx @@ -48,6 +48,18 @@ ] }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/editor/braft-editor/options.jsx b/src/menu/components/editor/braft-editor/options.jsx index 7f53cc7..0cf69e3 100644 --- a/src/menu/components/editor/braft-editor/options.jsx +++ b/src/menu/components/editor/braft-editor/options.jsx @@ -90,6 +90,18 @@ required: false }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/form/normal-form/options.jsx b/src/menu/components/form/normal-form/options.jsx index 93a7c7a..13dddcf 100644 --- a/src/menu/components/form/normal-form/options.jsx +++ b/src/menu/components/form/normal-form/options.jsx @@ -92,6 +92,18 @@ forbid: config.subtype === 'tabform' }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/group/normal-group/options.jsx b/src/menu/components/group/normal-group/options.jsx index bd3bb75..114af09 100644 --- a/src/menu/components/group/normal-group/options.jsx +++ b/src/menu/components/group/normal-group/options.jsx @@ -93,6 +93,18 @@ forbid: appType === 'mob' }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: setting.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/search/main-search/options.jsx b/src/menu/components/search/main-search/options.jsx index 996e994..117f5ff 100644 --- a/src/menu/components/search/main-search/options.jsx +++ b/src/menu/components/search/main-search/options.jsx @@ -70,6 +70,18 @@ ] }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/table/edit-table/options.jsx b/src/menu/components/table/edit-table/options.jsx index a48dcdc..d99be1f 100644 --- a/src/menu/components/table/edit-table/options.jsx +++ b/src/menu/components/table/edit-table/options.jsx @@ -255,6 +255,18 @@ required: false }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx index 22d3d39..fdbc79c 100644 --- a/src/menu/components/table/normal-table/options.jsx +++ b/src/menu/components/table/normal-table/options.jsx @@ -247,6 +247,18 @@ ], }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/tabs/antv-tabs/options.jsx b/src/menu/components/tabs/antv-tabs/options.jsx index 41fa966..c0430ab 100644 --- a/src/menu/components/tabs/antv-tabs/options.jsx +++ b/src/menu/components/tabs/antv-tabs/options.jsx @@ -223,6 +223,18 @@ required: false }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: setting.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/timeline/normal-timeline/options.jsx b/src/menu/components/timeline/normal-timeline/options.jsx index b1f0327..61cc83d 100644 --- a/src/menu/components/timeline/normal-timeline/options.jsx +++ b/src/menu/components/timeline/normal-timeline/options.jsx @@ -104,6 +104,18 @@ options: columns }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/tree/antd-tree/options.jsx b/src/menu/components/tree/antd-tree/options.jsx index f03e80a..ee531ff 100644 --- a/src/menu/components/tree/antd-tree/options.jsx +++ b/src/menu/components/tree/antd-tree/options.jsx @@ -122,6 +122,18 @@ ] }, { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx index 4416b94..13b61c7 100644 --- a/src/mob/components/menubar/normal-menubar/index.jsx +++ b/src/mob/components/menubar/normal-menubar/index.jsx @@ -51,7 +51,7 @@ name: card.name, subtype: card.subtype, setting: { interType: 'system' }, - wrap: { name: card.name, width: card.width || 24, title: '' }, + wrap: { name: card.name, width: card.width || 24, title: '', permission: 'true' }, style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' }, headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, subMenus: [{ diff --git a/src/mob/components/menubar/normal-menubar/options.jsx b/src/mob/components/menubar/normal-menubar/options.jsx index 97bc816..fc8d7f2 100644 --- a/src/mob/components/menubar/normal-menubar/options.jsx +++ b/src/mob/components/menubar/normal-menubar/options.jsx @@ -63,7 +63,18 @@ {value: 'true', label: '鍙坊鍔�'}, {value: 'false', label: '涓嶅彲娣诲姞'}, ] - } + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ] + }, ] return menuWrapForm diff --git a/src/mob/components/navbar/normal-navbar/options.jsx b/src/mob/components/navbar/normal-navbar/options.jsx index 2a7ebc2..1b4f32e 100644 --- a/src/mob/components/navbar/normal-navbar/options.jsx +++ b/src/mob/components/navbar/normal-navbar/options.jsx @@ -38,7 +38,18 @@ max: 200, precision: 0, required: true - } + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ] + }, ] return wrapForm diff --git a/src/mob/components/search/single-search/options.jsx b/src/mob/components/search/single-search/options.jsx index 7a75575..7acafab 100644 --- a/src/mob/components/search/single-search/options.jsx +++ b/src/mob/components/search/single-search/options.jsx @@ -120,7 +120,18 @@ precision: 0, initval: wrap.height || 32, required: false - } + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ] + }, ] return wrapForm diff --git a/src/mob/components/tabs/antv-tabs/options.jsx b/src/mob/components/tabs/antv-tabs/options.jsx index 2638256..74643d9 100644 --- a/src/mob/components/tabs/antv-tabs/options.jsx +++ b/src/mob/components/tabs/antv-tabs/options.jsx @@ -167,7 +167,18 @@ label: '鑳屾櫙(鏍囬鏍�)', initval: setting.backgroundColor || 'transparent', required: false - } + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: setting.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ] + }, ] return tabForm diff --git a/src/pc/components/navbar/normal-navbar/options.jsx b/src/pc/components/navbar/normal-navbar/options.jsx index 4940158..51b2f10 100644 --- a/src/pc/components/navbar/normal-navbar/options.jsx +++ b/src/pc/components/navbar/normal-navbar/options.jsx @@ -111,7 +111,18 @@ {value: 'false', label: '涓嶅惎鐢�'}, {value: 'true', label: '鍚敤'}, ] - } + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ] + }, ] return wrapForm diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 719ade8..a94d93b 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -113,6 +113,15 @@ return permAction[tab.linkTab] }) }) + } else { + config.tabgroups.forEach(group => { + group.sublist = group.sublist.filter(tab => { + if (tab.supMenu === 'mainTable') { + tab.supMenu = MenuID + } + return true + }) + }) } // 鎸夐挳绫诲瀷鍏煎 diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 09de4d2..98854e4 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -857,7 +857,8 @@ const { config } = this.state let traversal = (components) => { - let list = components.map(item => { + let list = [] + components.forEach(item => { let m = { key: item.uuid, title: item.name, @@ -868,23 +869,46 @@ return null } else if (item.type === 'tabs') { let tabs = [] + let mm = [] item.subtabs.forEach(tab => { let s = traversal(tab.components) if (s.length === 0) return - + tabs.push({ key: tab.uuid, title: tab.label, children: s }) + + mm.push(...s) }) if (tabs.length > 0) { m.children = tabs } + + if (item.setting.permission === 'true') { + list.push(m) + } else if (mm.length) { + list.push(...mm) + } + + return null } else if (item.type === 'group') { m.children = traversal(item.components) + + if (item.setting.permission === 'true') { + list.push(m) + } else if (m.children.length) { + list.push(...m.children) + } + + return null + } if (item.plot && item.plot.permission !== 'true') { + return null + } if (item.wrap && item.wrap.permission !== 'true') { + return null } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { item.action && item.action.forEach(btn => { this.checkBtn(btn) @@ -961,10 +985,8 @@ }) } - return m + list.push(m) }) - - list = list.filter(Boolean) return list } @@ -1101,14 +1123,20 @@ config.enabled = false } - let roleParam = {type: 'view', key: config.uuid, title: config.MenuName, children: []} + let roleParam = {type: 'view', version: '1.0', key: config.uuid, title: config.MenuName, children: []} roleParam.children = this.getMenuMessage() config.loginview = false config.tabview = false + if (config.permission !== 'true') { + roleParam.pass = true + roleParam.children = [] + } + config.components.forEach(item => { if (item.type === 'login') { roleParam.login = true + roleParam.children = [] config.loginview = true } else if (item.type === 'navbar') { config.tabview = true @@ -1172,17 +1200,22 @@ let roles = { type: 'navbar', + version: '1.0', key: item.uuid, title: item.name, children: [] } - roles.children = item.menus.map(menu => { - return { - key: menu.MenuID, - title: menu.name - } - }) + if (item.wrap.permission === 'true') { + roles.children = item.menus.map(menu => { + return { + key: menu.MenuID, + title: menu.name + } + }) + } else { + roles.pass = true + } let _param = { func: 'sPC_TrdMenu_AddUpt', diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 2c4121e..9628aa8 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -854,11 +854,12 @@ getMenuMessage = () => { const { config } = this.state - let nodes = {type: 'view', key: config.uuid, title: config.MenuName, children: []} + let nodes = {type: 'view', version: '1.0', key: config.uuid, title: config.MenuName, children: []} let popviews = [] let traversal = (components) => { - let list = components.map(item => { + let list = [] + components.forEach(item => { let m = { key: item.uuid, title: item.name, @@ -868,6 +869,7 @@ return null } else if (item.type === 'tabs') { let tabs = [] + let mm = [] item.subtabs.forEach(tab => { let s = traversal(tab.components) @@ -878,13 +880,35 @@ title: tab.label, children: s }) + + mm.push(...s) }) if (tabs.length > 0) { m.children = tabs } + + if (item.setting.permission === 'true') { + list.push(m) + } else if (mm.length) { + list.push(...mm) + } + + return null } else if (item.type === 'group') { m.children = traversal(item.components) + + if (item.setting.permission === 'true') { + list.push(m) + } else if (m.children.length) { + list.push(...m.children) + } + + return null + } if (item.plot && item.plot.permission !== 'true') { + return null + } if (item.wrap && item.wrap.permission !== 'true') { + return null } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { item.action && item.action.forEach(btn => { this.checkBtn(btn) @@ -990,10 +1014,8 @@ }) } - return m + list.push(m) }) - - list = list.filter(Boolean) return list } @@ -1005,6 +1027,11 @@ if (config.components.findIndex(item => item.type === 'login') > -1) { nodes.login = true + nodes.children = [] + } + if (config.permission !== 'true') { + nodes.pass = true + nodes.children = [] } return nodes @@ -1112,6 +1139,7 @@ let roles = { type: 'navbar', + version: '1.0', key: item.uuid, title: item.name, children: [] diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx index 06a4db8..1b0eda4 100644 --- a/src/views/rolemanage/index.jsx +++ b/src/views/rolemanage/index.jsx @@ -101,7 +101,7 @@ }) } - getMenuList = (reset) => { + getMenuList = (reset, resolve) => { const { app } = this.state let param = { func: 's_get_app_menus', @@ -114,9 +114,11 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) - this.setState({ - loading: true - }) + if (!resolve) { + this.setState({ + loading: true + }) + } Api.getCloudConfig(param).then(result => { if (result.status) { @@ -130,7 +132,10 @@ try { let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist))) item.nodes = pageParam - if (pageParam.login) { + + if (pageParam.version !== '1.0') { + item.nodes = '' + } else if (pageParam.login || pageParam.pass) { item.nodes = '' } else if (pageParam.type === 'navbar') { item.type = 'navbar' @@ -141,6 +146,8 @@ } catch (e) { item.nodes = '' } + + delete item.menus_rolelist } if (!ub && app.userbind === item.MenuID) { @@ -163,7 +170,9 @@ this.setState({ menulist: menus }, () => { - if (reset && (!this.oriTrees || this.oriTrees.length === 0)) { + if (resolve) { + this.initMenutree(resolve) + } else if (reset && (!this.oriTrees || this.oriTrees.length === 0)) { this.initMenutree() } else if (!reset && this.oriTrees && this.oriTrees.length === 0) { this.initMenutree() @@ -503,14 +512,22 @@ try { let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist))) item.nodes = pageParam - if (pageParam.login) { + + if (pageParam.version !== '1.0') { + item.nodes = '' + } else if (pageParam.login || pageParam.pass) { item.nodes = '' } else if (pageParam.type === 'navbar') { item.type = 'navbar' + } else if (pageParam.type === 'im') { + item.type = 'im' + item.nodes = '' } } catch (e) { item.nodes = '' } + + delete item.menus_rolelist } if (targetKeys.includes(item.MenuID) && item.nodes && item.nodes.popviews && item.nodes.popviews.length > 0) { @@ -645,10 +662,10 @@ initTree = () => { const _this = this confirm({ - content: '鍒濆鍖栦細鏍规嵁鑿滃崟閲嶇疆鏉冮檺鏍戯紝纭畾鎵ц鍚楋紵', + content: '鏉冮檺鏍戜細閲嶆柊鐢熸垚锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.initMenutree(resolve) + _this.getMenuList(true, resolve) }) }, onCancel() {} @@ -889,7 +906,7 @@ </div> <div className="right-view"> <div className="app-action"> - <Button className="mk-primary" onClick={this.initTree}>鍚屾</Button> + <Button className="mk-primary" onClick={this.initTree}>閲嶇疆</Button> {/* <Button className="mk-purple" onClick={this.syncTree}>鍚屾</Button> */} <Button className="mk-green save" onClick={this.saveTree}>淇濆瓨</Button> </div> -- Gitblit v1.8.0