From 4d6b9f8a2d7b316633e43b489eae9ada949c07b5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 10 九月 2024 10:18:08 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/views/rolemanage/index.jsx | 137 +++++++++++++++++++++++---------------------- 1 files changed, 69 insertions(+), 68 deletions(-) diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx index c8bdd69..2fdc6e4 100644 --- a/src/views/rolemanage/index.jsx +++ b/src/views/rolemanage/index.jsx @@ -1,10 +1,9 @@ import React, {Component} from 'react' import { fromJS } from 'immutable' -import { Spin, notification, Button, Table, Modal, ConfigProvider, Tree, Input, Empty } from 'antd' +import { Spin, notification, Button, Table, Modal, Tree, Input, Empty } from 'antd' import moment from 'moment' import md5 from 'md5' -import zhCN from 'antd/es/locale/zh_CN' -import { ApiOutlined } from '@ant-design/icons' +import { ApiOutlined, SoundOutlined } from '@ant-design/icons' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -27,10 +26,10 @@ columns: [ { title: '鑿滃崟鍚嶇О', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => { - if (record.extra) { + if (record.extra || this.state.appKeys.includes(record.MenuID)) { return <span style={{color: '#1890ff'}}>{text}</span> - } else if (record.interfaces === 'true') { - return <span><ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="鑿滃崟涓娇鐢ㄤ簡澶栭儴鎺ュ彛" />{text}</span> + } else if (record.interfaces === 'true' || record.msg === 'true') { + return <span>{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 } @@ -75,7 +74,8 @@ trees: null, expandedKeys: [], searchkey: '', - appViewList: [] + appViewList: [], + appKeys: [] } oriTrees = null @@ -119,7 +119,9 @@ }) return } - this.setState({appViewList: result.data || []}) + + let data = result.data || [] + this.setState({appViewList: data, appKeys: data.map(item => item.keys_id)}) }) } @@ -155,6 +157,7 @@ let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist))) item.nodes = pageParam item.interfaces = pageParam.interfaces || 'false' + item.msg = pageParam.msg || 'false' if (pageParam.type) { item.type = pageParam.type @@ -407,7 +410,7 @@ deleteMenu = (record) => { const { app, appViewList } = this.state - const _this = this + const that = this let param = { func: 'sPC_MainMenu_Del', @@ -448,7 +451,7 @@ message: '鎿嶄綔鎴愬姛锛�', duration: 3 }) - _this.getMenuList(true) + that.getMenuList(true) if (_param) { Api.getCloudConfig(_param).then(res => { @@ -459,7 +462,7 @@ duration: 5 }) } else { - _this.setState({appViewList: _appViewList}) + that.setState({appViewList: _appViewList}) } }) } @@ -680,12 +683,12 @@ } initTree = () => { - const _this = this + const that = this confirm({ content: '鏉冮檺鏍戜細閲嶆柊鐢熸垚锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.getMenuList(true, resolve) + that.getMenuList(true, resolve) }) }, onCancel() {} @@ -693,13 +696,13 @@ } syncTree = () => { - const _this = this + const that = this confirm({ content: '鍚屾浼氭牴鎹彍鍗曞垹闄ゆ垨鏂板鑺傜偣锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.syncMenutree(resolve) + that.syncMenutree(resolve) }) }, onCancel() {} @@ -708,7 +711,7 @@ saveTree = () => { // const { trees } = this.state - const _this = this + const that = this // if (!trees || trees.length === 0) { // notification.warning({ @@ -723,7 +726,7 @@ content: '纭畾鎵ц鍚楋紵', onOk() { return new Promise(resolve => { - _this.execSave(resolve) + that.execSave(resolve) }) }, onCancel() {} @@ -920,61 +923,59 @@ return ( <div className="mk-role-manage"> - <ConfigProvider locale={zhCN}> - <Header app={app} /> - {loading ? - <div className="loading-mask"> - <Spin size="large" /> - </div> : null - } - <div className="view-wrap"> - <div className="left-view"> - <div className="app-table"> - <div className="app-action"> - <Button className="mk-green" onClick={this.triggerThaw}>瑙e喕鑿滃崟</Button> - <Search placeholder="缁煎悎鎼滅储" onSearch={value => this.setState({ searchkey: value })} enterButton /> - </div> - <Table - rowKey="MenuID" - columns={columns} - dataSource={_menulist} - pagination={false} - onChange={this.changeTable} - /> - </div> - </div> - <div className="right-view"> + <Header app={app} /> + {loading ? + <div className="loading-mask"> + <Spin size="large" /> + </div> : null + } + <div className="view-wrap"> + <div className="left-view"> + <div className="app-table"> <div className="app-action"> - <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> + <Button className="mk-green" onClick={this.triggerThaw}>瑙e喕鑿滃崟</Button> + <Search placeholder="缁煎悎鎼滅储" onSearch={value => this.setState({ searchkey: value })} enterButton /> </div> - {trees && trees.length ? <Tree - className="draggable-tree" - defaultExpandedKeys={this.state.expandedKeys} - // showLine - draggable - blockNode - onDrop={this.onDrop} - > - {this.renderNode(trees)} - </Tree> : <div className="empty"> - <Empty /> - </div>} + <Table + rowKey="MenuID" + columns={columns} + dataSource={_menulist} + pagination={false} + onChange={this.changeTable} + /> </div> </div> - <Modal - title="瑙i櫎鍐荤粨" - visible={this.state.visible} - width={600} - onOk={this.thawSubmit} - confirmLoading={this.state.confirmLoading} - onCancel={() => this.setState({visible: false, targetKeys: []})} - destroyOnClose - > - <TransferForm onChange={(vals) => this.setState({targetKeys: vals})} menulist={this.state.thawmenulist}/> - </Modal> - </ConfigProvider> + <div className="right-view"> + <div className="app-action"> + <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> + {trees && trees.length ? <Tree + className="draggable-tree" + defaultExpandedKeys={this.state.expandedKeys} + // showLine + draggable + blockNode + onDrop={this.onDrop} + > + {this.renderNode(trees)} + </Tree> : <div className="empty"> + <Empty /> + </div>} + </div> + </div> + <Modal + title="瑙i櫎鍐荤粨" + visible={this.state.visible} + width={600} + onOk={this.thawSubmit} + confirmLoading={this.state.confirmLoading} + onCancel={() => this.setState({visible: false, targetKeys: []})} + destroyOnClose + > + <TransferForm onChange={(vals) => this.setState({targetKeys: vals})} menulist={this.state.thawmenulist}/> + </Modal> </div> ) } -- Gitblit v1.8.0