From 076c2b693da1d42cf3a468c0f3d631c1ed424285 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 08 十一月 2023 18:22:56 +0800 Subject: [PATCH] 2023-11-08 --- src/templates/subtableconfig/index.jsx | 589 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 295 insertions(+), 294 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 3459581..8e48352 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -3,7 +3,7 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' +import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd' import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' // import moment from 'moment' @@ -22,11 +22,11 @@ import './index.scss' const { Panel } = Collapse -const { confirm } = Modal +// const { confirm } = Modal -const Versions = asyncComponent(() => import('@/menu/versions')) +// const Versions = asyncComponent(() => import('@/menu/versions')) // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) -const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) +// const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -282,331 +282,332 @@ /** * @description 鏍囩椤典繚瀛� */ - submitConfig = () => { - const { delActions, openEdition } = this.state - let _config = fromJS(this.state.config).toJS() - let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig + // submitConfig = () => { + // const { delActions, openEdition } = this.state + // let _config = fromJS(this.state.config).toJS() + // let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig - // 鍩烘湰淇℃伅楠岃瘉 - if (!_config.tabName || !_config.tabNo) { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } + // // 鍩烘湰淇℃伅楠岃瘉 + // if (!_config.tabName || !_config.tabNo) { + // notification.warning({ + // top: 92, + // message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + // duration: 5 + // }) + // this.setState({activeKey: '0'}) + // return + // } - if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { - notification.warning({ - top: 92, - message: '姝ゆ爣绛句负澶嶅埗鏍囩锛岃淇敼鏍囩鍚嶇О鍜屾爣绛惧弬鏁帮紝涓嶅彲浠ユ椂闂存牸寮� YYYY-MM-DD HH:mm:ss 缁撳熬锛�', - duration: 5 - }) - return - } + // if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { + // notification.warning({ + // top: 92, + // message: '姝ゆ爣绛句负澶嶅埗鏍囩锛岃淇敼鏍囩鍚嶇О鍜屾爣绛惧弬鏁帮紝涓嶅彲浠ユ椂闂存牸寮� YYYY-MM-DD HH:mm:ss 缁撳熬锛�', + // duration: 5 + // }) + // return + // } - if (_config.isAdd) { - if (_config.search[0] && _config.search[0].origin) { - _config.search = _config.search.filter(item => !item.origin) - } - if (_config.action[0] && _config.action[0].origin) { - _config.action = _config.action.filter(item => !item.origin) - } - if (_config.columns[0] && _config.columns[0].origin) { - _config.columns = _config.columns.filter(item => !item.origin) - } - } + // if (_config.isAdd) { + // if (_config.search[0] && _config.search[0].origin) { + // _config.search = _config.search.filter(item => !item.origin) + // } + // if (_config.action[0] && _config.action[0].origin) { + // _config.action = _config.action.filter(item => !item.origin) + // } + // if (_config.columns[0] && _config.columns[0].origin) { + // _config.columns = _config.columns.filter(item => !item.origin) + // } + // } - if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { - _config.setting.doubleClick = '' - } + // if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { + // _config.setting.doubleClick = '' + // } - // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false - let result = this.verifyconfig(_config) + // // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false + // let result = this.verifyconfig(_config) - if (result !== true) { - _config.enabled = false - } + // if (result !== true) { + // _config.enabled = false + // } - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } + // if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� + // this.setState({ + // menucloseloading: true + // }) + // } else { + // this.setState({ + // menuloading: true + // }) + // } - let _LongParam = '' + // let _LongParam = '' - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd + // // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser + // delete _config.type + // delete _config.isAdd - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) + // try { + // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + // } catch (e) { + // notification.warning({ + // top: 92, + // message: '缂栬瘧閿欒', + // duration: 5 + // }) - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } + // this.setState({ + // menucloseloading: false, + // menuloading: false + // }) + // 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', - MenuID: _config.uuid, - MenuNo: _config.tabNo, - Template: 'SubTable', - MenuName: _config.tabName, - Remark: _config.Remark, - Sort: 0, - PageParam: JSON.stringify({Template: 'SubTable'}), - LongParam: _LongParam - } + // let param = { + // func: 'sPC_Tab_AddUpt', + // MenuID: _config.uuid, + // MenuNo: _config.tabNo, + // Template: 'SubTable', + // MenuName: _config.tabName, + // Remark: _config.Remark, + // Sort: 0, + // PageParam: JSON.stringify({Template: 'SubTable'}), + // LongParam: _LongParam + // } - if (openEdition) { - param.open_edition = openEdition - } + // if (openEdition) { + // param.open_edition = openEdition + // } - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 - new Promise(resolve => { - if (delActions.length > 0) { - let deffers = delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item.card.uuid - } + // // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� + // // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 + // new Promise(resolve => { + // if (delActions.length > 0) { + // let deffers = delActions.map(item => { + // let _param = { + // func: 'sPC_MainMenu_Del', + // MenuID: item.card.uuid + // } - let _ParentParam = null + // let _ParentParam = null - try { - _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) - } catch (e) { - console.warn('Stringify Failure') - _ParentParam = null - } + // try { + // _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) + // } catch (e) { + // console.warn('Stringify Failure') + // _ParentParam = null + // } - if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� - _param.ParentParam = _ParentParam - } + // if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� + // _param.ParentParam = _ParentParam + // } - return new Promise(resolve => { - Api.getCloudConfig(_param).then(response => { - resolve(response) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response - } - }) + // return new Promise(resolve => { + // Api.getCloudConfig(_param).then(response => { + // resolve(response) + // }) + // }) + // }) + // Promise.all(deffers).then(result => { + // let error = null + // result.forEach(response => { + // if (!response.status) { + // error = response + // } + // }) - if (error) { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(true) - } - }) - } else if (delActions.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return + // if (error) { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: error.message, + // duration: 5 + // }) + // resolve(false) + // } else { + // this.setState({ + // delActions: [] + // }) + // resolve(true) + // } + // }) + // } else if (delActions.length === 0) { + // resolve(true) + // } + // }).then(resp => { + // if (resp === false) return - return true - }).then(res => { - if (res === true || res === false) return res + // return true + // }).then(res => { + // if (res === true || res === false) return res - let msg = res.filter(Boolean)[0] - if (msg) { - notification.warning({ - top: 92, - message: msg, - duration: 5 - }) - return false - } else { - return true - } - }).then(resp => { - if (resp === false) return + // let msg = res.filter(Boolean)[0] + // if (msg) { + // notification.warning({ + // top: 92, + // message: msg, + // duration: 5 + // }) + // return false + // } else { + // return true + // } + // }).then(resp => { + // if (resp === false) return - Api.getCloudConfig(param).then(response => { - if (response.status) { - this.setState({ - openEdition: response.open_edition || '', - config: _config, - originConfig: fromJS(_config).toJS() - }, () => { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - if (this.state.closeVisible) { - this.handleViewBack() - } - }) - this.submitAction() - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - } + // Api.getCloudConfig(param).then(response => { + // if (response.status) { + // this.setState({ + // openEdition: response.open_edition || '', + // config: _config, + // originConfig: fromJS(_config).toJS() + // }, () => { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.success({ + // top: 92, + // message: '淇濆瓨鎴愬姛', + // duration: 2 + // }) + // if (this.state.closeVisible) { + // this.handleViewBack() + // } + // }) + // this.submitAction() + // } else { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: response.message, + // duration: 5 + // }) + // } + // }) + // }) + // } /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� */ - submitAction = () => { - const { config } = this.state + // submitAction = () => { + // const { config } = this.state - 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 + // 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 + // if (oriActions.length === 0) return - oriActions.forEach(action => { - Api.getCloudConfig({ - func: 'sPC_Get_LongParam', - MenuID: action.prebtn ? action.prebtn.uuid : '' - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' + // oriActions.forEach(action => { + // Api.getCloudConfig({ + // 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 = '' - } - } + // if (result.LongParam) { + // try { + // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // } catch (e) { + // console.warn('Parse Failure') + // _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.getCloudConfig(param).then(() => {}) - } - } - }) - }) - } + // 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.getCloudConfig(param).then(() => {}) + // } + // } + // }) + // }) + // } cancelConfig = () => { - const { config, originConfig } = this.state + // const { config, originConfig } = this.state - let _this = this + // let _this = this - if (originConfig.isAdd) { - confirm({ - content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.handleViewBack() - }, - onCancel() {} - }) - } else { - if (!is(fromJS(originConfig), fromJS(config))) { - this.setState({ - closeVisible: true - }) - } else { - this.handleViewBack() - } - } + // if (originConfig.isAdd) { + // confirm({ + // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', + // onOk() { + // _this.handleViewBack() + // }, + // onCancel() {} + // }) + // } else { + // if (!is(fromJS(originConfig), fromJS(config))) { + // this.setState({ + // closeVisible: true + // }) + // } else { + // this.handleViewBack() + // } + // } + this.handleViewBack() } /** @@ -910,7 +911,7 @@ } render () { - const { activeKey, config, chartview, openEdition } = this.state + const { activeKey, config, chartview } = this.state if (!config) return null @@ -994,11 +995,11 @@ </div> } bordered={false} extra={ <div> - <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> + {/* <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} - <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> + {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> */} + {/* <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> */} + {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> */} <Button onClick={this.cancelConfig}>杩斿洖</Button> </div> } style={{ width: '100%' }}> @@ -1080,7 +1081,7 @@ </Card> </div> </DndProvider> - <Modal + {/* <Modal bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} closable={false} maskClosable={false} @@ -1094,7 +1095,7 @@ destroyOnClose > 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> + </Modal> */} {this.state.loading && <Spin size="large" />} </div> ) -- Gitblit v1.8.0