From 140adf41ca32aafcbc1f0d32dace9da81aa5ef3f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 02 三月 2023 17:57:05 +0800 Subject: [PATCH] Merge branch 'develop' --- src/templates/subtableconfig/index.jsx | 227 ++++++++++++++++++++------------------------------------ 1 files changed, 80 insertions(+), 147 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 1912281..37ec63e 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -5,7 +5,7 @@ import HTML5Backend from 'react-dnd-html5-backend' import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' -import moment from 'moment' +// import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -365,41 +365,41 @@ return } - let btnParam = { - func: 'sPC_Button_AddUpt', - Type: 40, - ParentID: _config.uuid, - MenuNo: _config.tabNo, - Template: 'SubTable', - PageParam: '', - LongParam: '', - LText: [] - } + // let btnParam = { + // func: 'sPC_Button_AddUpt', + // Type: 40, + // ParentID: _config.uuid, + // MenuNo: _config.tabNo, + // Template: 'SubTable', + // PageParam: '', + // LongParam: '', + // LText: [] + // } - let btntabs = [] + // let btntabs = [] - _config.action.forEach((item, index) => { - if (item.hidden === 'true') return - if (item.OpenType === 'popview') { - btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) - } - btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) - }) + // _config.action.forEach((item, index) => { + // if (item.hidden === 'true') return + // if (item.OpenType === 'popview') { + // btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) + // } + // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) + // }) - btnParam.LText = btnParam.LText.join(' union all ') - btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + // btnParam.LText = btnParam.LText.join(' union all ') + // btnParam.LText = Utils.formatOptions(btnParam.LText) + // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - let tabParam = { // 娣诲姞鏍囩鎸夐挳tab椤� - func: 'sPC_sMenusTab_AddUpt', - MenuID: _config.uuid, - LText: btntabs.join(' union all ') - } + // let tabParam = { // 娣诲姞鏍囩鎸夐挳tab椤� + // func: 'sPC_sMenusTab_AddUpt', + // MenuID: _config.uuid, + // LText: btntabs.join(' union all ') + // } - tabParam.LText = Utils.formatOptions(tabParam.LText) - tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) + // tabParam.LText = Utils.formatOptions(tabParam.LText) + // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) let param = { func: 'sPC_Tab_AddUpt', @@ -530,8 +530,16 @@ menuloading: false, menucloseloading: false }) - this.submitAction(btnParam, tabParam) + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 2 + }) + if (this.state.closeVisible) { + this.handleViewBack() + } }) + this.submitAction() } else { this.setState({ menuloading: false, @@ -550,131 +558,56 @@ /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� */ - submitAction = (btnParam, tabParam) => { + submitAction = () => { const { config } = this.state - new Promise(resolve => { - let deffers = [] + let oriActions = [] + this.state.originActions.forEach(item => { + let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� + if (!curBtn) return + if (curBtn.OpenType !== item.prebtn.OpenType) return + if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return - if (tabParam.LText) { - let defer = new Promise(resolve => { - Api.getSystemConfig(tabParam).then(result => { - resolve(result) - }) - }) - deffers.push(defer) - } - - if (btnParam.LText) { - let defer = new Promise(resolve => { - Api.getSystemConfig(btnParam).then(result => { - if (result.status) { - this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛� - copyActions: [] - }) - } - resolve(result) - }) - }) - deffers.push(defer) - } - - if (deffers.length === 0) { - resolve(true) - } else { - Promise.all(deffers).then(result => { - let error = false - result.forEach(res => { - if (!res.status) { - error = res - } - }) - - if (error) { - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - resolve(true) - } - }) - } - }).then(response => { - if (response === false) return response - - let oriActions = [] - this.state.originActions.forEach(item => { - let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� - if (!curBtn) return - if (curBtn.OpenType !== item.prebtn.OpenType) return - if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return - - oriActions.push({ - prebtn: item.prebtn, - curBtn: curBtn - }) + oriActions.push({ + prebtn: item.prebtn, + curBtn: curBtn }) + }) - if (oriActions.length === 0) return 'true' + if (oriActions.length === 0) return - oriActions.forEach(action => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: action.prebtn ? action.prebtn.uuid : '' - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' - - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + oriActions.forEach(action => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: action.prebtn ? action.prebtn.uuid : '' + }).then(result => { + if (result.status && result.LongParam) { + let _LongParam = '' - if (_LongParam) { - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: config.uuid, - MenuID: action.curBtn.uuid, - MenuNo: config.tabNo, - Template: _LongParam.type, - MenuName: action.curBtn.label, - PageParam: JSON.stringify({Template: _LongParam.type}), - LongParam: result.LongParam - } - Api.getSystemConfig(param).then(() => {}) + if (result.LongParam) { + try { + _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + } catch (e) { + console.warn('Parse Failure') + _LongParam = '' } } - }) - }) - return 'true' - }).then(response => { - if (response === 'true') { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - if (this.state.closeVisible) { - this.handleViewBack() - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) + + if (_LongParam) { + let param = { + func: 'sPC_ButtonParam_AddUpt', + ParentID: config.uuid, + MenuID: action.curBtn.uuid, + MenuNo: config.tabNo, + Template: _LongParam.type, + MenuName: action.curBtn.label, + PageParam: JSON.stringify({Template: _LongParam.type}), + LongParam: result.LongParam + } + Api.getSystemConfig(param).then(() => {}) + } } - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - } + }) }) } -- Gitblit v1.8.0