From 2bccb9ec7bdefe23292a22bc153463cfa1479a49 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 六月 2024 16:25:42 +0800 Subject: [PATCH] 2024-06-21 --- src/views/pcdesign/index.jsx | 88 +++++++++++++++++++++++++++---------------- 1 files changed, 55 insertions(+), 33 deletions(-) diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index bc099f8..b1abf07 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -3,15 +3,14 @@ import { withRouter } from 'react-router' import { is, fromJS } from 'immutable' import HTML5Backend from 'react-dnd-html5-backend' -import { ConfigProvider, notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' +import { notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' import Api from '@/api' import Utils, { setGLOBFuncs } from '@/utils/utils.js' -import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' -import antdZhCN from 'antd/es/locale/zh_CN' +import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' import asyncComponent from '@/utils/asyncComponent' @@ -100,12 +99,21 @@ try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + if (param.lang) { + sessionStorage.setItem('lang', param.lang) + } + if (param.type === 'app') { sessionStorage.setItem('appId', param.ID || '') sessionStorage.setItem('appName', param.remark || '') - sessionStorage.setItem('lang', param.lang || 'zh-CN') sessionStorage.setItem('kei_no', param.kei_no || '') sessionStorage.setItem('sysBgColor', param.sysBgColor || '#ffffff') + + if (param.applangList) { + sessionStorage.setItem('applangList', param.applangList) + } else { + sessionStorage.removeItem('applangList') + } this.getAppMessage(param.MenuID) } else if (param.type === 'view') { @@ -240,7 +248,8 @@ MenuID: menu.MenuID, copyMenuId: menu.copyMenuId || '', clearMenu: menu.clearMenu !== 'false', - type: 'view' + type: 'view', + lang: sessionStorage.getItem('lang') } // param.MenuNo = menu.MenuNo || '' @@ -287,7 +296,7 @@ let param = { func: 's_kei_link_keyids_addupt', BID: sessionStorage.getItem('appId'), - exec_type: 'y', + exec_type: 'x', LText: '' } @@ -302,7 +311,7 @@ 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.LText = Utils.formatOptions(param.LText, 'x') param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) @@ -316,12 +325,12 @@ }) } 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', lang: sessionStorage.getItem('lang')})))) } }) } else { sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) - this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view'})))) + this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view', lang: sessionStorage.getItem('lang')})))) } }) } @@ -877,7 +886,7 @@ return } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { item.action && item.action.forEach(btn => { - if (btn.hidden === 'true') return + if (btn.hidden === 'true' || btn.permission === 'false') return m.children.push({ key: btn.uuid, @@ -886,7 +895,7 @@ }) item.subcards.forEach(card => { card.elements && card.elements.forEach(cell => { - if (cell.eleType !== 'button' || cell.hidden === 'true') return + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.permission === 'false') return m.children.push({ key: cell.uuid, @@ -895,7 +904,7 @@ }) card.backElements && card.backElements.forEach(cell => { - if (cell.eleType !== 'button' || cell.hidden === 'true') return + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.permission === 'false') return m.children.push({ key: cell.uuid, @@ -905,7 +914,7 @@ }) } else if (item.type === 'balcony') { item.elements && item.elements.forEach(cell => { - if (cell.eleType !== 'button' || cell.hidden === 'true') return + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.permission === 'false') return m.children.push({ key: cell.uuid, @@ -923,7 +932,7 @@ } } else if (item.type === 'table') { item.action.forEach(btn => { - if (btn.hidden === 'true') return + if (btn.hidden === 'true' || btn.permission === 'false') return m.children.push({ key: btn.uuid, @@ -936,7 +945,7 @@ loopCol(col.subcols) } else if (col.type === 'custom') { col.elements.forEach(cell => { - if (cell.eleType !== 'button' || cell.hidden === 'true') return + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.permission === 'false') return m.children.push({ key: cell.uuid, title: cell.label, @@ -1140,6 +1149,18 @@ if (!this.checkBase()) { return + } else if (this.checklog()) { + if (sessionStorage.getItem('applangList') && !config.trans) { + + } else { + notification.success({ + top: 92, + message: '褰撳墠閰嶇疆鏈慨鏀癸紝鏃犻渶淇濆瓨銆�', + duration: 5 + }) + MKEmitter.emit('completeSave') + return + } } this.setState({ @@ -1208,6 +1229,7 @@ let interfaces = getFuncsAndInters(config) roleParam.interfaces = interfaces + let langSql = getLangTrans(config) let param = { func: 'sPC_TrdMenu_AddUpt', @@ -1224,12 +1246,16 @@ PageParam: JSON.stringify({Template: 'webPage', interfaces}), menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), open_edition: config.open_edition, - LText: '', - LTexttb: '', + // LText: '', + // LTexttb: '', menus_used_list, debug_md5: key, debug_url: url, debug_list: window.btoa(tbs) + } + + if (langSql) { + param.lang_translation = window.btoa(window.encodeURIComponent(langSql)) } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -1310,8 +1336,8 @@ PageParam: JSON.stringify({Template: NavBar.type}), menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roles))), open_edition: NavBar.open_edition, - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } _param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(NavBar))) @@ -1352,13 +1378,13 @@ let kparam = { func: 's_kei_link_keyids_addupt', BID: sessionStorage.getItem('appId'), - exec_type: 'y', + exec_type: 'x', LText: '' } kparam.LText = _appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`) kparam.LText = kparam.LText.join(' union all ') - kparam.LText = Utils.formatOptions(kparam.LText) + kparam.LText = Utils.formatOptions(kparam.LText, 'x') kparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') kparam.secretkey = Utils.encrypt('', kparam.timestamp) @@ -1550,12 +1576,6 @@ this.setState({config}) window.GLOB.customMenu = config - - notification.success({ - top: 92, - message: '绮樿创鎴愬姛锛�', - duration: 2 - }) } setHomeView = () => { @@ -1573,7 +1593,7 @@ let param = { func: 's_kei_link_keyids_addupt', BID: sessionStorage.getItem('appId'), - exec_type: 'y', + exec_type: 'x', LText: '' } @@ -1592,7 +1612,7 @@ 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.LText = Utils.formatOptions(param.LText, 'x') param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) @@ -1632,7 +1652,7 @@ let param = { func: 's_kei_link_keyids_addupt', BID: sessionStorage.getItem('appId'), - exec_type: 'y', + exec_type: 'x', LText: '' } @@ -1651,7 +1671,7 @@ 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.LText = Utils.formatOptions(param.LText, 'x') param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) @@ -1685,6 +1705,8 @@ } updateLogConfig = (config) => { + config.open_edition = this.state.config.open_edition || '' + this.setState({ config: null }, () => { @@ -1700,7 +1722,7 @@ const { view, loading, comloading, activeKey, settingshow, controlshow, MenuId, config, menuloading, eyeopen, needUpdate } = this.state return ( - <ConfigProvider locale={antdZhCN}> + <> <DndProvider backend={HTML5Backend}> {view !== 'popview' ? <div className={'mk-pc-view '} id="mk-pc-design-view"> {loading ? <Spin className="view-spin" size="large" /> : null} @@ -1777,7 +1799,7 @@ <StyleController /> <StyleCombController /> <ModalController /> - </ConfigProvider> + </> ) } } -- Gitblit v1.8.0