From 9e716f3bd30820a08757845b592db73363faa48c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 25 四月 2022 14:53:37 +0800 Subject: [PATCH] 2022-04-25 --- src/tabviews/subtable/index.jsx | 80 +++++++++++++++++++++++++++------------- 1 files changed, 54 insertions(+), 26 deletions(-) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index afe536d..5f39261 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { notification, Spin, Switch, Row, Col, Icon, Tabs} from 'antd' +import { notification, Spin, Switch, Row, Col, Tabs} from 'antd' import Api from '@/api' import zhCN from '@/locales/zh-CN/main.js' @@ -13,6 +13,7 @@ import { updateSubTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' +import MkIcon from '@/components/mk-icon' import NotFount from '@/components/404' import MKEmitter from '@/utils/events.js' @@ -83,7 +84,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, permMenus, Tab, BID, BData } = this.props + const { permAction, permMenus, Tab } = this.props let param = { func: 'sPC_Get_LongParam', @@ -318,11 +319,22 @@ config.setting.selected = 'false' } else if (config.setting.selected === 'init' && config.setting.onload === 'false') { config.setting.selected = 'false' + } else { + config.setting.orisel = true + } + + if (config.setting.controlField) { + if (config.setting.controlVal) { + config.setting.controlVal = config.setting.controlVal.split(',') + } else { + config.setting.controlVal = [''] + } } this.setState({ - BID: BID || '', - BData: BData || '', + pageSize: config.setting.pageSize || 10, + BID: this.props.BID || '', + BData: this.props.BData || '', loadingview: false, chartId, config, @@ -336,7 +348,7 @@ search: Utils.initMainSearch(config.search), hasReqFields }, () => { - if (config.setting.onload !== 'false' && (!Tab.supMenu || BID || Tab.isTreeNode)) { // 鍒濆鍖栧彲鍔犺浇 + if (config.setting.onload !== 'false' && (!Tab.supMenu || this.props.BID || Tab.isTreeNode)) { // 鍒濆鍖栧彲鍔犺浇 this.loadData() } }) @@ -355,7 +367,7 @@ } } - loadData = () => { + loadData = (id) => { const { mainSearch } = this.props const { setting, BID, search, loadCustomApi, hasReqFields } = this.state @@ -404,10 +416,10 @@ this.loadOutResource(searches) if (setting.execType === 'async') { - this.loadmaindata() + this.loadmaindata(id) } } else { - this.loadmaindata() + this.loadmaindata(id) } } @@ -547,7 +559,7 @@ Sort: index + 1 })) - if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) { + if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { let sql = lines.map(item => (` ${item.insert} ${item.selects.join(` union all @@ -581,7 +593,7 @@ /** * @description 瀛愯〃鏁版嵁鍔犺浇 */ - async loadmaindata () { + async loadmaindata (id) { const { mainSearch } = this.props const { setting, BID, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state @@ -607,9 +619,9 @@ start = pageSize * (pageIndex - 1) + 1 } - if (setting.selected !== 'false') { + if (setting.selected !== 'false' || (setting.orisel && id)) { setTimeout(() => { - MKEmitter.emit('mkTableCheckTopLine', this.props.MenuID) + MKEmitter.emit('mkTableCheckTopLine', this.props.MenuID, id) }, 200) if (setting.selected === 'init') { this.setState({setting: {...setting, selected: 'false'}}) @@ -628,8 +640,15 @@ } item.key = index item.$$uuid = item[setting.primaryKey] || '' + item.$$key = '' + item.key + item.$$uuid item.$$BID = BID || '' item.$Index = start + index + '' + + if (setting.controlField) { + if (setting.controlVal.includes(item[setting.controlField])) { + item.$disabled = true + } + } return item }), @@ -693,6 +712,7 @@ data = data.map(item => { if (item.$$uuid === _data.$$uuid) { _data.key = item.key + _data.$$key = '' + item.key + item.$$uuid _data.$Index = item.$Index return _data } else { @@ -809,17 +829,17 @@ /** * @description 琛ㄦ牸鍒锋柊 */ - reloadtable = (btn) => { + reloadtable = (btn, id = '') => { if (!btn || btn.resetPageIndex !== 'false') { MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1 }, () => { - this.loadData() + this.loadData(id) }) } else { MKEmitter.emit('resetTable', this.props.Tab.uuid, 'false') // 鍒楄〃閲嶇疆 - this.loadData() + this.loadData(id) } } @@ -874,7 +894,6 @@ const { MenuID } = this.props if (menuId.indexOf(MenuID) === -1) return - if (id === 'empty') return if (!id) { this.reloadtable() @@ -889,7 +908,7 @@ * @param {*} position // 鍒锋柊浣嶇疆 * @param {*} btn // 鎵ц鐨勬寜閽� */ - refreshByButtonResult = (menuId, position, btn) => { + refreshByButtonResult = (menuId, position, btn, id, lines) => { const { MenuID } = this.props if (MenuID !== menuId) return @@ -897,17 +916,23 @@ const { Tab, SupMenuID } = this.props const { BID } = this.state - if (position === 'grid' || position === 'view') { - this.reloadtable(btn) + if (position === 'line') { + if (lines && lines.length === 1) { + this.loadmainLinedata(lines[0].$$uuid) + } else { + this.reloadtable(btn, id) + } + } else if (position === 'grid' || position === 'view') { + this.reloadtable(btn, id) } else if (position === 'maingrid' || position === 'mainline') { - this.reloadtable(btn) - if (Tab.supMenu) { - MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 涓昏〃閲嶇疆 - } else if (!Tab.supMenu && Tab.level === 0) { - MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 鏍戝舰缁撴瀯锛�0绾ф爣绛� + this.reloadtable(btn, id) + if (Tab.supMenu && BID) { + MKEmitter.emit('reloadData', Tab.supMenu, BID) // 涓昏〃閲嶇疆 + } else if (!Tab.supMenu && Tab.level === 0 && BID) { + MKEmitter.emit('reloadData', SupMenuID, BID) // 鏍戝舰缁撴瀯锛�0绾ф爣绛� } } else if (position === 'equaltab') { - this.reloadtable(btn) + this.reloadtable(btn, id) if (Tab.equalTab && Tab.equalTab.length > 0) { MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 鍚岀骇鏍囩閲嶇疆 } @@ -916,10 +941,13 @@ changeTableLine = (ContainerId, tableId, id, data) => { const { Tab } = this.props + const { setting } = this.state if (!Tab.supMenu || tableId !== Tab.supMenu) return this.setState({BData: data, BID: id}) + + if (!setting) return if (id !== this.state.BID || id !== '') { MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 @@ -973,7 +1001,7 @@ {/* 瑙嗗浘缁� */} {!config.expand ? <Tabs activeKey={chartId} onChange={this.changeChart}> {config.charts.map(item => ( - <TabPane tab={<Icon type={item.icon} />} key={item.uuid}></TabPane> + <TabPane tab={<MkIcon type={item.icon} />} key={item.uuid}></TabPane> ))} </Tabs> : null} {config.charts.map(item => { -- Gitblit v1.8.0