From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/templates/subtableconfig/index.jsx | 112 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index c7f9293..1912281 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' @@ -9,8 +8,6 @@ import moment from 'moment' import Api from '@/api' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import { updateSubTable } from '@/utils/utils-update.js' @@ -51,7 +48,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆 visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 menuloading: false, // 鑿滃崟淇濆瓨涓� @@ -66,7 +62,7 @@ thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 chartview: null, // 褰撳墠瑙嗗浘 - openEdition: '' // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� + openEdition: '', // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� } /** @@ -118,7 +114,7 @@ this.setState({ openEdition: editSubTab ? (editSubTab.open_edition || '') : (editTab.open_edition || ''), - chartview: _config.charts[0].uuid, + chartview: _config.charts ? _config.charts[0].uuid : '', originActions: _oriActions, config: _config, activeKey: _activeKey || '0', @@ -152,6 +148,28 @@ let _shortcut = `${preKey}+${keyCode}` if (_shortcut === 'ctrl+83') { + let modals = document.querySelectorAll('.mk-pop-modal') + let msg = null + for (let i = 0; i < modals.length; i++) { + if (msg) { + break + } + + let node = modals[i].querySelector('.mk-com-name') + + if (node) { + msg = node.innerText + } + } + if (msg) { + notification.warning({ + top: 92, + message: '璇蜂繚瀛�' + msg, + duration: 5 + }) + return false + } + let node = document.getElementById('save-config') if (node && node.click) { node.click() @@ -275,7 +293,7 @@ if (!_config.tabName || !_config.tabNo) { notification.warning({ top: 92, - message: this.state.dict['model.menu.basemsg'], + message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', duration: 5 }) this.setState({activeKey: '0'}) @@ -361,6 +379,7 @@ 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`) } @@ -858,26 +877,6 @@ } }) - config.action && config.action.forEach((btn) => { - if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { - let hascheck = false - btn.verify.scripts.forEach(item => { - if (item.status === 'false') return - - if (/\$check@|@check\$/ig.test(item.sql)) { - hascheck = true - } - }) - if (hascheck) { - notification.warning({ - top: 92, - message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, - duration: 5 - }) - } - } - }) - if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { return '鏁版嵁婧愪腑涓嶆墽琛岄粯璁ql锛屼笖鏈坊鍔犺嚜瀹氫箟鑴氭湰锛屼笉鍙惎鐢紒' } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { @@ -986,7 +985,7 @@ config: null }, () => { this.setState({ - chartview: _config.charts[0].uuid, + chartview: _config.charts ? _config.charts[0].uuid : '', config: _config, openEdition: res.open_edition || '', activeKey: '0', @@ -1021,7 +1020,6 @@ <Panel forceRender={true} header={'鏍囩鍩烘湰淇℃伅'} key="0" id="subtable-basedata"> {/* 鑿滃崟淇℃伅 */} <MenuForm - dict={this.state.dict} config={config} updatemenu={this.updateconfig} /> @@ -1033,7 +1031,7 @@ /> </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} - <Panel header={this.state.dict['header.menu.search']} key="1"> + <Panel header="鎼滅储" key="1"> <div className="search-element"> {Source.searchItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) @@ -1042,7 +1040,7 @@ <FieldsComponent config={config} type="search" /> </Panel> {/* 鎸夐挳娣诲姞 */} - <Panel header={this.state.dict['header.menu.action']} key="2"> + <Panel header="鎸夐挳" key="2"> <div className="search-element"> {Source.actionItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) @@ -1072,7 +1070,7 @@ })} </Panel> {/* 娣诲姞鏄剧ず鍒� */} - <Panel header={this.state.dict['header.menu.column']} key="3"> + <Panel header="鏄剧ず鍒�" key="3"> <div className="search-element"> {Source.columnItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) @@ -1092,10 +1090,10 @@ <div> <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> - <EditComponent dict={this.state.dict} type="table" options={['search', 'form', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/> + <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} 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}>{this.state.dict['model.save']}</Button> - <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> + <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> + <Button onClick={this.cancelConfig}>杩斿洖</Button> </div> } style={{ width: '100%' }}> <SettingComponent @@ -1108,12 +1106,12 @@ config={config} updatesearch={this.updatesearch} /> - <div className="chart-view" style={{position: 'relative'}}> - {/* 瑙嗗浘缁� 鏉冮檺 浼氬憳绛夌骇20+ */} - {this.props.memberLevel >= 20 ? <ChartGroupComponent + {config.charts ? <div className="chart-view" style={{position: 'relative'}}> + {/* 瑙嗗浘缁� 宸插純鐢� */} + <ChartGroupComponent config={config} updatechartgroup={this.updatechartgroup} - /> : null} + /> {config.charts.map(item => { if (!config.expand && chartview !== item.uuid) return '' @@ -1158,7 +1156,21 @@ ) } })} - </div> + </div> : <> + <ActionComponent + type="subtable" + menu={{MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo, fstMenuList: this.props.menu.fstMenuList}} + config={config} + tabs={this.state.tabviews} + setSubConfig={this.setSubConfig} + updateaction={this.updateaction} + /> + <ColumnComponent + config={config} + menu={this.props.menu} + updatecolumn={this.updateconfig} + /> + </>} </Card> </div> </DndProvider> @@ -1169,13 +1181,13 @@ visible={this.state.closeVisible} onCancel={() => { this.setState({closeVisible: false}) }} footer={[ - <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['model.save']}</Button>, - <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['model.notsave']}</Button>, - <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['model.cancel']}</Button> + <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>淇濆瓨</Button>, + <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>涓嶄繚瀛�</Button>, + <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>鍙栨秷</Button> ]} destroyOnClose > - {this.state.dict['header.menu.config.placeholder']} + 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� </Modal> {this.state.loading && <Spin size="large" />} </div> @@ -1183,14 +1195,4 @@ } } -const mapStateToProps = (state) => { - return { - memberLevel: state.memberLevel - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(SubTableConfig) +export default SubTableConfig -- Gitblit v1.8.0