From 9c6795fd3c44e46cf3955fbfd8f8eeca23acb7a9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 08 十月 2022 00:31:51 +0800 Subject: [PATCH] 2022-10-08 --- src/tabviews/commontable/index.jsx | 457 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 282 insertions(+), 175 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index aed2a1b..e9d8ba6 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -1,8 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { notification, Spin, Tabs, Icon, Switch, Row, Col } from 'antd' +import { notification, Spin, Tabs, Switch, Row, Col } from 'antd' import Api from '@/api' import zhCN from '@/locales/zh-CN/main.js' @@ -13,6 +12,7 @@ import { updateCommonTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' +import MkIcon from '@/components/mk-icon' import MKEmitter from '@/utils/events.js' import NotFount from '@/components/404' import './index.scss' @@ -26,6 +26,8 @@ const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent')) const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) +const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) +const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) const { TabPane } = Tabs @@ -49,7 +51,7 @@ searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� + arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -66,18 +68,19 @@ statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 - hasReqFields: false + hasReqFields: false, + autoMatic: null } /** * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, permMenus, param, MenuName } = this.props + const { param, MenuName, MenuID } = this.props let _param = { func: 'sPC_Get_LongParam', - MenuID: this.props.MenuID + MenuID: MenuID } let result = await Api.getCacheConfig(_param) @@ -87,16 +90,17 @@ try { // 閰嶇疆淇℃伅瑙f瀽 config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - config.MenuID = this.props.MenuID + config.MenuID = MenuID config.MenuName = MenuName config.setting.MenuName = MenuName + config.setting.$name = MenuName } catch (e) { console.warn('Parse Failure') config = '' } // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 - if (result.LongParamUser && this.props.menuType !== 'HS') { + if (result.LongParamUser && !window.GLOB.mkHS) { try { // 閰嶇疆淇℃伅瑙f瀽 let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) if (userConfig && !userConfig.version) { @@ -154,38 +158,59 @@ config = updateCommonTable(config) // 鏉冮檺杩囨护 - if (this.props.menuType !== 'HS') { - config.action = config.action.filter(item => permAction[item.uuid]) + if (!window.GLOB.mkHS) { + config.action = config.action.filter(item => item.hidden !== 'true' && window.GLOB.mkActions[item.uuid]) config.tabgroups.forEach(group => { - group.sublist = group.sublist.filter(tab => permAction[tab.linkTab]) + group.sublist = group.sublist.filter(tab => { + if (tab.supMenu === 'mainTable') { + tab.supMenu = MenuID + } + return window.GLOB.mkActions[tab.linkTab] + }) + }) + } else { + config.action = config.action.filter(item => item.hidden !== 'true') + config.tabgroups.forEach(group => { + group.sublist = group.sublist.map(tab => { + if (tab.supMenu === 'mainTable') { + tab.supMenu = MenuID + } + return tab + }) }) } // 鍘婚櫎绌鸿鏍囩 config.tabgroups = config.tabgroups.filter(group => group.sublist.length > 0) let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID - // 瑙嗗浘鏉冮檺 - config.charts = config.charts.filter(item => { - if (item.Hide === 'true') return false - if (!item.blacklist || item.blacklist.length === 0) return true - return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 - }) - if (config.charts.length <= 1) { - config.expand = true + let chartId = '' + + if (config.charts) { + // 瑙嗗浘鏉冮檺 + config.charts = config.charts.filter(item => { + if (item.Hide === 'true') return false + if (!item.blacklist || item.blacklist.length === 0) return true + return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 + }) + + if (config.charts.length <= 1) { + config.expand = true + } + chartId = config.charts[0] ? config.charts[0].uuid : '' } - let chartId = config.charts[0] ? config.charts[0].uuid : '' - // 瀛楁鏉冮檺榛戝悕鍗� + config.search = Utils.initSearchVal(config.search) + + // 瀛楁閫忚鍙婂繀濉爣蹇� + let hasReqFields = false config.search = config.search.map(item => { - item.oriInitval = item.initval if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) { item.initval = param.$searchval } - if (!item.blacklist || item.blacklist.length === 0) return item - if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { - item.Hide = 'true' + if (item.required) { + hasReqFields = true } return item @@ -223,8 +248,7 @@ if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ config.setting.dataresource = '' - } - if (/\s/.test(config.setting.dataresource)) { + } else if (/\s/.test(config.setting.dataresource)) { config.setting.dataresource = '(' + config.setting.dataresource + ') tb' } @@ -237,6 +261,25 @@ config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '') config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '') } + + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + + if (sessionStorage.getItem('isEditState') === 'true') { + userName = sessionStorage.getItem('CloudUserName') || '' + fullName = sessionStorage.getItem('CloudFullName') || '' + } + + let regs = [ + { reg: /@userName@/ig, value: `'${userName}'` }, + { reg: /@fullName@/ig, value: `'${fullName}'` } + ] + + regs.forEach(cell => { + config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) + config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) + }) + if (config.urlFields) { let _param = param || {} config.urlFields.forEach(field => { @@ -279,6 +322,7 @@ } if (item.position === 'toolbar') { + item.$toolbtn = true _actions.push(item) } else if (item.position === 'grid') { _operations.push(item) @@ -289,6 +333,22 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) + + if (col.linkmenu && col.linkmenu.length > 0) { + let menu_id = col.linkmenu.slice(-1)[0] + col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + } else { + col.linkThdMenu = '' + } + + if (col.type === 'number') { + col.decimal = col.decimal || 0 + col.round = Math.pow(10, col.decimal) + + if (col.format === 'percent') { + col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 + } + } col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { @@ -307,13 +367,6 @@ // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� config.columns.forEach((col, index) => { if (_hideCol.includes(col.uuid)) return - - if (col.linkmenu && col.linkmenu.length > 0) { - let menu_id = col.linkmenu.slice(-1)[0] - col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' - } else { - col.linkThdMenu = '' - } col.sort = index @@ -343,19 +396,39 @@ _columns.push(config.gridBtn) } - let valid = true // 鎼滅储鏉′欢蹇呭~楠岃瘉, 鍒濆鎼滅储鏉′欢, 濡傞�氳繃涓婄骇閫忚锛屽啓鍏ユ悳绱㈡潯浠� - let hasReqFields = false - config.search.forEach(item => { - if (item.required !== 'true') return - if (!item.initval) { - valid = false + if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { + config.setting.selected = 'false' + } else if (config.setting.selected === 'init' && config.setting.onload === 'false') { + config.setting.selected = 'false' + } else { + config.setting.orisel = true + } + + let autoMatic = null + if (config.autoMatic && config.autoMatic.enable === 'true') { + _actions.forEach(item => { + if (item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))) { + autoMatic = config.autoMatic + autoMatic.OpenType = item.execMode || item.OpenType + config.setting.selected = 'false' + item.autoMatic = true + } + }) + } + + if (config.setting.controlField) { + if (config.setting.controlVal) { + config.setting.controlVal = config.setting.controlVal.split(',') + } else { + config.setting.controlVal = [''] } - hasReqFields = true - }) + } this.setState({ + pageSize: config.setting.pageSize || 10, loadingview: false, absFields, + autoMatic, chartId, config, statFields, @@ -366,10 +439,10 @@ columns: _columns, arr_field: _arrField.join(','), BID: param && param.$BID ? param.$BID : '', - search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 + search: Utils.initMainSearch(config.search), hasReqFields }, () => { - if (config.setting.onload !== 'false' && valid) { // 鍒濆鍖栧彲鍔犺浇 + if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 this.loadData() } this.setShortcut() @@ -428,34 +501,27 @@ } } - loadData = () => { - const { setting, search, BIDs, loadCustomApi, hasReqFields } = this.state - let requireFields = [] - - if (hasReqFields) { - requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) - } + loadData = (id) => { + const { MenuID } = this.props + const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state this.setState({ - selectedData: [], - BIDs: { - ...BIDs, - mainTable: '', - mainTabledata: '' - } + selectedData: [] }) + MKEmitter.emit('changeTableLine', ContainerId, MenuID, '', '') - if (requireFields.length > 0) { - let labels = requireFields.map(item => item.label) - labels = Array.from(new Set(labels)) + if (hasReqFields) { + let requireFields = search.filter(item => item.required && item.value === '') - notification.warning({ - top: 92, - message: this.state.dict['form.required.input'] + labels.join('銆�') + ' !', - duration: 3 - }) - return - } else if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { + if (requireFields.length > 0) { + this.setState({ + loading: false + }) + return + } + } + + if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { notification.warning({ top: 92, message: '鏈缃寮忕郴缁熷湴鍧�!', @@ -471,17 +537,17 @@ this.loadOutResource() if (setting.execType === 'async') { - this.loadmaindata() + this.loadmaindata(id) } } else { - this.loadmaindata() + this.loadmaindata(id) } } loadOutResource = () => { const { setting, search, BID } = this.state - let param = UtilsDM.getPrevQueryParams(setting, search, BID, this.props.menuType) + let param = UtilsDM.getPrevQueryParams(setting, search, BID) if (setting.execType === 'sync') { this.setState({ @@ -525,12 +591,12 @@ let mkey = result.mk_api_key || '' - delete result.mk_ex_invoke + delete result.mk_ex_invoke // 鏄惁缁х画鎵ц delete result.status delete result.message delete result.ErrCode delete result.ErrMesg - delete result.mk_api_key + delete result.mk_api_key // 褰撳墠璇锋眰鐨刱ey鍊硷紝鐢ㄤ簬鍥炶皟 let param = {} @@ -540,7 +606,7 @@ }) Api.directRequest(url, setting.method, param, setting.cross).then(res => { - if (typeof(res) !== 'object' || Array.isArray(res)) { + if (typeof(res) !== 'object') { let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒' if (typeof(res) === 'string') { @@ -555,6 +621,9 @@ this.customCallbackRequest(_result) } else { + if (Array.isArray(res)) { + res = { data: res } + } res.mk_api_key = mkey this.customCallbackRequest(res) } @@ -570,7 +639,7 @@ } customCallbackRequest = (result) => { - const { setting } = this.state + const { setting, BID } = this.state let errSql = '' if (result.$ErrCode === 'E') { errSql = ` @@ -592,15 +661,7 @@ `)) sql = sql.join('') - param = UtilsDM.getCallBackQueryParams(setting, sql, errSql) - - if (this.state.BID) { - param.BID = this.state.BID - } - - if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } + param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, BID) } else { param.func = 's_ex_result_back' param.s_ex_result = lines.map((item, index) => ({ @@ -611,7 +672,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 @@ -645,25 +706,35 @@ /** * @description 涓昏〃鏁版嵁鍔犺浇 */ - async loadmaindata () { - const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields } = this.state + async loadmaindata (id) { + const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields, autoMatic } = this.state this.setState({ loading: true }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType) - - if (param.func === 'sPC_Get_TableData') { - param.menuname = this.props.MenuName || '' - } + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID) let result = await Api.genericInterface(param) this.getStatFieldsValue() - + if (result.status) { + let start = 1 + if (setting.laypage) { + start = pageSize * (pageIndex - 1) + 1 + } + + if (setting.selected !== 'false' || (setting.orisel && id)) { + setTimeout(() => { + MKEmitter.emit('mkTableCheckTopLine', this.props.MenuID, id) + }, 200) + if (setting.selected === 'init') { + this.setState({setting: {...setting, selected: 'false'}}) + } + } + this.setState({ data: result.data.map((item, index) => { if (absFields.length) { @@ -677,7 +748,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 }), @@ -685,10 +764,21 @@ loading: false, pickup: false }) + + if (autoMatic) { + if (result.data && result.data.length > 0) { + MKEmitter.emit('autoGetData', this.props.MenuID) + } else { + MKEmitter.emit('autoMaticOver', this.props.MenuID) + } + } } else { this.setState({ loading: false }) + if (autoMatic) { + MKEmitter.emit('autoMaticError', this.props.MenuID) + } notification.error({ top: 92, message: result.message, @@ -708,11 +798,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id) - - if (param.func === 'sPC_Get_TableData') { - param.menuname = this.props.MenuName || '' - } + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, id) let result = await Api.genericInterface(param) if (result.status) { @@ -736,6 +822,8 @@ 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 { return item @@ -747,7 +835,7 @@ } return item }) - } catch { + } catch (e) { console.warn('鏁版嵁鏌ヨ閿欒') } } @@ -778,11 +866,7 @@ if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType) - - if (param.func === 'sPC_Get_TableData') { - param.menuname = this.props.MenuName || '' - } + let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID) Api.genericInterface(param).then(res => { if (res.status) { @@ -833,7 +917,7 @@ this.loadData() }) } else { - MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆 + MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1, search: searches @@ -847,6 +931,15 @@ * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 */ refreshbytable = (pagination, filters, sorter) => { + if (!sorter) { + this.setState({ + pageIndex: pagination.pageIndex + }, () => { + this.loadData() + }) + return + } + if (sorter.order) { let _chg = { ascend: 'asc', @@ -867,17 +960,17 @@ /** * @description 琛ㄦ牸鍒锋柊 */ - reloadtable = (btn) => { + reloadtable = (btn, id = '') => { if (!btn || btn.resetPageIndex !== 'false') { - MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆 + MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1 }, () => { - this.loadData() + this.loadData(id) }) } else { - MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable', 'false') // 鍒楄〃閲嶇疆 - this.loadData() + MKEmitter.emit('resetTable', this.props.MenuID, 'false') // 鍒楄〃閲嶇疆 + this.loadData(id) } } @@ -887,7 +980,7 @@ reloadview = () => { this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, data: null, total: 0, loading: false, pageIndex: 1, shortcuts: null, - pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false + pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false, searchlist: null }, () => { this.loadconfig() }) @@ -896,13 +989,13 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - getexceloutparam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { MenuName, MenuID } = this.props const { arr_field, orderBy, search, setting} = this.state if (MenuID !== menuId) return - MKEmitter.emit('execExcelout', MenuID, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: search, @@ -915,21 +1008,6 @@ */ changeSelectedData = (selectedData) => { this.setState({selectedData}) - } - - /** - * @description 琛ㄦ牸Id鍙樺寲 - */ - handleTableId = (type, id, data) => { - const { BIDs } = this.state - - this.setState({ - BIDs: { - ...BIDs, - [type]: id, - [type + 'data']: data - } - }) } /** @@ -953,7 +1031,6 @@ const { MenuID } = this.props if (MenuID !== menuId) return - if (id === 'empty') return if (id === 'formtab') { // 琛ㄥ崟鏍囩椤靛埛鏂� this.reloadtable(btn) @@ -967,12 +1044,16 @@ } } - reloadMenuView = (menuId) => { + reloadMenuView = (menuId, position) => { const { MenuID } = this.props if (MenuID !== menuId) return - this.reloadview() + if (position === 'table') { + this.reloadtable() + } else { + this.reloadview() + } } resetActiveMenu = (menuId) => { @@ -983,32 +1064,35 @@ this.setShortcut() } + changeTableLine = (ContainerId, tableId, id, data) => { + if (this.state.ContainerId !== ContainerId) return + + this.setState({ + BIDs: {...this.state.BIDs, [tableId]: id, [tableId + 'data']: data} + }) + } + /** * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� * @param {*} menuId // 鑿滃崟Id * @param {*} position // 鍒锋柊浣嶇疆 * @param {*} btn // 鎵ц鐨勬寜閽� */ - refreshByButtonResult = (menuId, position, btn) => { + refreshByButtonResult = (menuId, position, btn, id, lines) => { const { MenuID } = this.props if (MenuID !== menuId) return - this.reloadtable(btn) + if (position === 'line' && lines && lines.length === 1) { + this.loadmainLinedata(lines[0].$$uuid) + } else { + this.reloadtable(btn, id) + } } UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 this.loadconfig() - } - - UNSAFE_componentWillReceiveProps(nextProps) { - if (!is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) { - let selectTab = nextProps.tabviews.filter(tab => tab.selected)[0] - if (selectTab && selectTab.MenuID === this.props.MenuID) { - this.setShortcut() - } - } } shouldComponentUpdate (nextProps, nextState) { @@ -1018,8 +1102,9 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('reloadMenuView', this.reloadMenuView) + MKEmitter.addListener('changeTableLine', this.changeTableLine) MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) - MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } @@ -1033,26 +1118,27 @@ document.onkeydown = () => {} MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) + MKEmitter.removeListener('changeTableLine', this.changeTableLine) MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) - MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } render() { - const { menuType } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts } = this.state + const { MenuID } = this.props + const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state return ( <div className="commontable" id={this.state.ContainerId}> {loadingview ? <Spin size="large" /> : null} {searchlist && searchlist.length ? - <MainSearch BID={BID} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null + <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null } - {setting ? <Row className="chart-view" gutter={16}> + {setting && config.charts ? <Row className="chart-view" gutter={16}> {/* 瑙嗗浘缁� */} {!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 => { @@ -1069,17 +1155,18 @@ actions={actions} columns={columns} dict={this.state.dict} - MenuID={this.props.MenuID} + MenuID={MenuID} selectedData={selectedData} ContainerId={this.state.ContainerId} /> </div> <div className="main-table-box"> {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? - <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null + <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null } <MainTable - tableId="mainTable" + MenuID={MenuID} + tableId={MenuID} pickup={pickup} setting={setting} columns={columns} @@ -1087,12 +1174,10 @@ dict={this.state.dict} data={this.state.data} total={this.state.total} - MenuID={this.props.MenuID} loading={this.state.loading} statFValue={this.state.statFValue} ContainerId={this.state.ContainerId} refreshdata={this.refreshbytable} - handleTableId={this.handleTableId} chgSelectData={this.changeSelectedData} /> </div> @@ -1104,14 +1189,13 @@ <CardComponent BID={BID} plot={item} + MenuID={MenuID} config={config} + tableId={MenuID} columns={columns} - tableId="mainTable" data={this.state.data} - MenuID={this.props.MenuID} loading={this.state.loading} ContainerId={this.state.ContainerId} - handleTableId={this.handleTableId} /> </Col> ) @@ -1130,50 +1214,73 @@ } })} </Row> : null } + {setting && !config.charts ? <div className="chart-view"> + <div className="commontable-main-action"> + <MainAction + BID={BID} + setting={setting} + actions={actions} + columns={columns} + dict={this.state.dict} + MenuID={MenuID} + selectedData={selectedData} + ContainerId={this.state.ContainerId} + /> + </div> + <div className="main-table-box"> + {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? + <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null + } + <MainTable + MenuID={MenuID} + tableId={MenuID} + pickup={pickup} + setting={setting} + columns={columns} + pageSize={pageSize} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + loading={this.state.loading} + statFValue={this.state.statFValue} + ContainerId={this.state.ContainerId} + refreshdata={this.refreshbytable} + chgSelectData={this.changeSelectedData} + /> + </div> + </div> : null } {setting && config.tabgroups.map(group => ( <Tabs key={group.uuid}> {group.sublist.map(_tab => { return ( <TabPane tab={ <span id={_tab.uuid}> - {_tab.icon ? <Icon type={_tab.icon} /> : null} + {_tab.icon ? <MkIcon type={_tab.icon} /> : null} {_tab.label} </span> } key={_tab.uuid}> <SubTable Tab={_tab} + SupMenuID={MenuID} MenuID={_tab.linkTab} mainSearch={_tab.searchPass === 'true' ? search : null} - SupMenuID={this.props.MenuID} ContainerId={this.state.ContainerId} BID={this.state.BIDs[_tab.supMenu] || ''} BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} - handleTableId={this.handleTableId} /> </TabPane> ) })} </Tabs>)) } - {menuType !== 'HS' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} - {menuType !== 'HS' && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts} permAction={this.props.permAction}/> : null} + {setting && window.GLOB.breakpoint ? <DebugTable /> : null} + {!window.GLOB.mkHS && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} + {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} + {!window.GLOB.mkHS && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) } } -const mapStateToProps = (state) => { - return { - menuType: state.editLevel, - tabviews: state.tabviews, - permAction: state.permAction, - permMenus: state.permMenus - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file +export default NormalTable \ No newline at end of file -- Gitblit v1.8.0