From 75f3fd6e67851b9079e0b82c8cd94bf7649fe8bd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 08 三月 2021 18:53:44 +0800 Subject: [PATCH] 2021-03-08 --- src/views/pcdesign/index.jsx | 115 ++++++++++++++++++++++++++++----------------------------- 1 files changed, 57 insertions(+), 58 deletions(-) diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index f270f84..be7a609 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1,6 +1,7 @@ import React, { Component } from 'react' import { connect } from 'react-redux' import { DndProvider } from 'react-dnd' +import { withRouter } from 'react-router' import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' @@ -81,18 +82,26 @@ localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS, dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS }) + this.getAppMessage() } else if (param.type === 'view') { this.setState({ MenuId: param.MenuID + }, () => { + this.getMenuParam() }) } - this.getAppMessage() } catch { notification.warning({ top: 92, message: '鑿滃崟淇℃伅瑙f瀽閿欒锛�', duration: 5 }) + } + } + + UNSAFE_componentWillReceiveProps(nextProps) { + if (this.props.match.params.param !== nextProps.match.params.param) { + window.location.reload() } } @@ -142,8 +151,7 @@ return } - this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: menu.MenuID, type: 'view'})))) - window.location.reload() + this.props.history.push('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: menu.MenuID, copyMenuId: menu.copyMenuId || '', type: 'view'})))) } getAppMessage = () => { @@ -161,67 +169,58 @@ } let homeId = '' - if (this.state.MenuId) { - let appViewList = res.data && res.data.length > 0 ? res.data : [] - - homeId = this.state.MenuId - - sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) - } else { - let appViewList = [] - if (res.data && res.data.length > 0) { - appViewList = res.data - appViewList.forEach(item => { - if (item.keys_type === 'index') { - homeId = item.keys_id - } - }) - } - - if (!homeId) { - homeId = Utils.getuuid() - - let param = { - func: 's_kei_link_keyids_addupt', - BID: sessionStorage.getItem('appId'), - exec_type: 'y', - LText: '' + let appViewList = [] + if (res.data && res.data.length > 0) { + appViewList = res.data + appViewList.forEach(item => { + if (item.keys_type === 'index') { + homeId = item.keys_id } + }) + } - appViewList.unshift({ - appkey: window.GLOB.appkey || '', - bid: sessionStorage.getItem('appId') || '', - kei_no: sessionStorage.getItem('kei_no') || '', - keys_id: homeId, - keys_type: 'index', - remark: '棣栭〉' - }) + if (!homeId) { + homeId = Utils.getuuid() - param.LText = appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`) - param.LText = param.LText.join(' union all ') - param.LText = Utils.formatOptions(param.LText) - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - - Api.getSystemConfig(param).then(result => { - if (!result.status) { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - }) + let param = { + func: 's_kei_link_keyids_addupt', + BID: sessionStorage.getItem('appId'), + exec_type: 'y', + LText: '' } + appViewList.unshift({ + appkey: window.GLOB.appkey || '', + bid: sessionStorage.getItem('appId') || '', + kei_no: sessionStorage.getItem('kei_no') || '', + keys_id: homeId, + keys_type: 'index', + remark: '棣栭〉' + }) + + param.LText = appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`) + param.LText = param.LText.join(' union all ') + param.LText = Utils.formatOptions(param.LText) + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + + Api.getSystemConfig(param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } else { + sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) + this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'})))) + } + }) + } else { sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) + this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'})))) } - this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'})))) - - this.setState({MenuId: homeId}, () => { - this.getMenuParam() - }) }) } @@ -1221,4 +1220,4 @@ } } -export default connect(mapStateToProps, mapDispatchToProps)(MenuDesign) \ No newline at end of file +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(MenuDesign)) \ No newline at end of file -- Gitblit v1.8.0