From 8e003c1a94d26cc4d477e7aa03593ccb4d7e6c61 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 11 十月 2024 17:47:40 +0800 Subject: [PATCH] 2024-10-11 --- src/views/rolemanage/index.jsx | 48 +++++++++++++++++++++++++++++------------------- 1 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx index e030560..bb9d731 100644 --- a/src/views/rolemanage/index.jsx +++ b/src/views/rolemanage/index.jsx @@ -3,7 +3,7 @@ import { Spin, notification, Button, Table, Modal, Tree, Input, Empty } from 'antd' import moment from 'moment' import md5 from 'md5' -import { ApiOutlined } from '@ant-design/icons' +import { ApiOutlined, SoundOutlined } from '@ant-design/icons' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -26,12 +26,13 @@ columns: [ { title: '鑿滃崟鍚嶇О', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => { - if (record.extra) { - return <span style={{color: '#1890ff'}}>{text}</span> - } else if (record.interfaces === 'true') { - return <span><ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="鑿滃崟涓娇鐢ㄤ簡澶栭儴鎺ュ彛" />{text}</span> + let className = window.backend && record.backend !== 'level1' ? 'unbackend' : '' + if (record.extra || this.state.appKeys.includes(record.MenuID)) { + return <span className={className} style={{color: '#1890ff'}}>{text}</span> + } else if (record.interfaces === 'true' || record.msg === 'true') { + return <span className={className}>{record.interfaces === 'true' ? <ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="鑿滃崟涓娇鐢ㄤ簡澶栭儴鎺ュ彛" /> : null}{record.msg === 'true' ? <SoundOutlined style={{color: 'orange', marginRight: '5px'}} title="鑿滃崟涓彂閫佷簡娑堟伅" /> : null}{text}</span> } - return text + return <span className={className}>{text}</span> } }, { @@ -74,7 +75,8 @@ trees: null, expandedKeys: [], searchkey: '', - appViewList: [] + appViewList: [], + appKeys: [] } oriTrees = null @@ -118,7 +120,9 @@ }) return } - this.setState({appViewList: result.data || []}) + + let data = result.data || [] + this.setState({appViewList: data, appKeys: data.map(item => item.keys_id)}) }) } @@ -154,9 +158,15 @@ let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist))) item.nodes = pageParam item.interfaces = pageParam.interfaces || 'false' + item.msg = pageParam.msg || 'false' + item.backend = pageParam.backend || '' if (pageParam.type) { item.type = pageParam.type + } + + if (item.type === 'navbar' || item.type === 'im') { + item.backend = 'level1' } if (pageParam.version !== '1.0') { @@ -186,10 +196,10 @@ }) if (!im) { - menus.push({nodes: '', type: 'none', extra: true, MenuID: app.instantMessage, MenuName: '鍗虫椂閫氫俊'}) + menus.push({nodes: '', type: 'none', backend: 'level1', extra: true, MenuID: app.instantMessage, MenuName: '鍗虫椂閫氫俊'}) } if (!ub) { - menus.push({nodes: '', type: 'none', extra: true, MenuID: app.userbind, MenuName: '鐢ㄦ埛缁戝畾'}) + menus.push({nodes: '', type: 'none', backend: 'level1', extra: true, MenuID: app.userbind, MenuName: '鐢ㄦ埛缁戝畾'}) } this.setState({ @@ -406,7 +416,7 @@ deleteMenu = (record) => { const { app, appViewList } = this.state - const _this = this + const that = this let param = { func: 'sPC_MainMenu_Del', @@ -447,7 +457,7 @@ message: '鎿嶄綔鎴愬姛锛�', duration: 3 }) - _this.getMenuList(true) + that.getMenuList(true) if (_param) { Api.getCloudConfig(_param).then(res => { @@ -458,7 +468,7 @@ duration: 5 }) } else { - _this.setState({appViewList: _appViewList}) + that.setState({appViewList: _appViewList}) } }) } @@ -679,12 +689,12 @@ } initTree = () => { - const _this = this + const that = this confirm({ content: '鏉冮檺鏍戜細閲嶆柊鐢熸垚锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.getMenuList(true, resolve) + that.getMenuList(true, resolve) }) }, onCancel() {} @@ -692,13 +702,13 @@ } syncTree = () => { - const _this = this + const that = this confirm({ content: '鍚屾浼氭牴鎹彍鍗曞垹闄ゆ垨鏂板鑺傜偣锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.syncMenutree(resolve) + that.syncMenutree(resolve) }) }, onCancel() {} @@ -707,7 +717,7 @@ saveTree = () => { // const { trees } = this.state - const _this = this + const that = this // if (!trees || trees.length === 0) { // notification.warning({ @@ -722,7 +732,7 @@ content: '纭畾鎵ц鍚楋紵', onOk() { return new Promise(resolve => { - _this.execSave(resolve) + that.execSave(resolve) }) }, onCancel() {} -- Gitblit v1.8.0