From a94b0a4d15b26ecf8fe99f0a1c3e60d60b97766d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 15 八月 2023 14:22:03 +0800 Subject: [PATCH] 2023-08-15 --- src/tabviews/commontable/index.jsx | 507 +++++++++++++++++++++---------------------------------- 1 files changed, 195 insertions(+), 312 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 7a8fb75..43da736 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -1,14 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { notification, Spin, Tabs, Switch, Row, Col } from 'antd' +import { notification, Spin, Tabs, Switch, Row, Col, Modal } from 'antd' import Api from '@/api' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' -import options from '@/store/options.js' import UtilsDM from '@/utils/utils-datamanage.js' import { updateCommonTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' @@ -26,8 +22,7 @@ const SubTable = asyncSpinComponent(() => import('@/tabviews/subtable')) 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 @@ -36,11 +31,11 @@ param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鎼滅储鏉′欢绛夊弬鏁� MenuID: PropTypes.string, // 鑿滃崟Id MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string // 鑿滃崟鍚嶇О + MenuName: PropTypes.string, // 鑿滃崟鍚嶇О + changeTemp: PropTypes.func } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id BID: null, // 椤甸潰璺宠浆鏃舵惡甯D loadingview: true, // 椤甸潰鍔犺浇涓� @@ -48,10 +43,9 @@ lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 shortcuts: null, // 蹇嵎閿� - searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� + arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -67,16 +61,15 @@ statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� - loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 - hasReqFields: false, - autoMatic: null + autoMatic: null, + visible: false } /** * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, permMenus, param, MenuName, MenuID } = this.props + const { param, MenuName, MenuID } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -90,17 +83,38 @@ try { // 閰嶇疆淇℃伅瑙f瀽 config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - config.MenuID = MenuID - config.MenuName = MenuName - config.setting.MenuName = MenuName - config.setting.$name = MenuName } catch (e) { console.warn('Parse Failure') config = '' } + + // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� + if (!config) { + this.setState({ + loadingview: false, + viewlost: true + }) + return + } + + // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 + if (!config.enabled) { + this.setState({ + loadingview: false, + viewlost: true, + lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭鍚敤锛岃鑱旂郴绠$悊鍛樸��' + }) + return + } + + // 妯℃澘閿欒 + if (config.Template === 'BaseTable' || config.Template === 'CustomPage') { + this.props.changeTemp(MenuID, config.Template) + return + } // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 - if (result.LongParamUser && this.props.menuType !== 'HS') { + if (result.LongParamUser) { try { // 閰嶇疆淇℃伅瑙f瀽 let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) if (userConfig && !userConfig.version) { @@ -135,45 +149,38 @@ } } - // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� - if (!config) { - this.setState({ - loadingview: false, - viewlost: true - }) - return - } - - // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 - if (!config.enabled) { - this.setState({ - loadingview: false, - viewlost: true, - lostmsg: this.state.dict['main.view.unenabled'] - }) - return - } + // 淇℃伅鍒濆鍖栬祴鍊� + config.MenuID = MenuID + config.MenuName = MenuName + config.setting.MenuName = MenuName + config.setting.$name = MenuName // 鐗堟湰鍏煎 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 => { if (tab.supMenu === 'mainTable') { tab.supMenu = MenuID } - return permAction[tab.linkTab] + tab.ContainerId = this.state.ContainerId + + // return window.GLOB.mkActions[tab.linkTab] + return tab }) }) } 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 } + tab.ContainerId = this.state.ContainerId + return tab }) }) @@ -182,31 +189,30 @@ 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) + Utils.initSearchVal(config) // 瀛楁閫忚鍙婂繀濉爣蹇� - let hasReqFields = false config.search = config.search.map(item => { if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) { item.initval = param.$searchval } - - if (item.required) { - hasReqFields = true - } - return item }) @@ -221,6 +227,7 @@ // 鏍囪涓婚〉闈紝鐢ㄤ簬鎸夐挳鍥哄畾鍙婅〃鍗曟寕杞借缃� config.setting.tabType = 'main' + config.setting.ContainerId = this.state.ContainerId // 鏁版嵁婧愪俊鎭澶勭悊 config.setting.laypage = config.setting.laypage !== 'false' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 @@ -228,7 +235,7 @@ config.setting.customScript = '' // 鑷畾涔夎剼鏈� config.setting.dataresource = config.setting.dataresource || '' - if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { + if (config.setting.interType === 'system') { if (config.setting.scripts && config.setting.scripts.length > 0) { let _customScript = '' config.setting.scripts.forEach(item => { @@ -247,10 +254,8 @@ } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') - config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') - config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') - config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/') + config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/') + config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/') } else { config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '') config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '') @@ -258,17 +263,10 @@ let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' - let city = sessionStorage.getItem('city') || '' - - 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}'` }, - { reg: /@login_city@/ig, value: `'${city}'` } + { reg: /@fullName@/ig, value: `'${fullName}'` } ] regs.forEach(cell => { @@ -300,6 +298,8 @@ config.action.forEach(item => { item.logLabel = MenuName + '-' + item.label // 鐢ㄤ簬sPC_TableData_InUpDe璁板綍鎿嶄綔鎸夐挳 item.$menuId = this.props.MenuID + item.$old = true + item.ContainerId = this.state.ContainerId if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 鎵撳嵃鏈鸿缃� let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) @@ -316,8 +316,17 @@ } } } + + if (item.controlField) { + if (/,/ig.test(item.controlVal)) { + item.controlVals = item.controlVal.split(',') + } else { + item.controlVals = [(item.controlVal || '')] + } + } if (item.position === 'toolbar') { + item.$toolbtn = true _actions.push(item) } else if (item.position === 'grid') { _operations.push(item) @@ -331,9 +340,18 @@ 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] || '' + 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) // 閾炬帴鍚嶅瓧娈� @@ -386,6 +404,8 @@ 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 @@ -408,6 +428,19 @@ } } + config.type = 'table' + config.wrap = { + show: config.setting.show || '', + float: config.setting.float || '', + advanceType: config.setting.advanceType || '', + advanceWidth: config.setting.advanceWidth || '', + drawerPlacement: config.setting.drawerPlacement || '', + searchRatio: config.setting.searchRatio || '', + searchLwidth: config.setting.searchLwidth, + borderRadius: config.setting.borderRadius, + resetContrl: config.setting.resetContrl, + } + this.setState({ pageSize: config.setting.pageSize || 10, loadingview: false, @@ -416,15 +449,13 @@ chartId, config, statFields, - shortcuts, + shortcuts: shortcuts.length > 0 ? shortcuts : null, setting: config.setting, - searchlist: config.search, actions: _actions, columns: _columns, arr_field: _arrField.join(','), BID: param && param.$BID ? param.$BID : '', - search: Utils.initMainSearch(config.search), - hasReqFields + search: Utils.initMainSearch(config.search) }, () => { if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 this.loadData() @@ -447,11 +478,6 @@ setShortcut = () => { const { shortcuts } = this.state - if (!shortcuts || shortcuts.length === 0) { - document.onkeydown = () => {} - return - } - document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -469,6 +495,15 @@ let _shortcut = `${preKey}+${keyCode}` + if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') { + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + + MKEmitter.emit('debugChange') + } + + if (!shortcuts) return + shortcuts.some(item => { if (item.$shortcut === _shortcut) { MKEmitter.emit('triggerBtnId', item.uuid) @@ -485,16 +520,16 @@ } } - loadData = () => { + loadData = (id) => { const { MenuID } = this.props - const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state + const { setting, search, config, ContainerId } = this.state this.setState({ selectedData: [] }) MKEmitter.emit('changeTableLine', ContainerId, MenuID, '', '') - if (hasReqFields) { + if (config.$s_req) { let requireFields = search.filter(item => item.required && item.value === '') if (requireFields.length > 0) { @@ -505,200 +540,22 @@ } } - if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { + if (setting.interType === 'custom') { notification.warning({ top: 92, - message: '鏈缃寮忕郴缁熷湴鍧�!', + message: '绯荤粺涓嶅湪鏀寔鑷畾涔夋帴鍙�!', duration: 3 }) return } - if (setting.interType === 'custom' && loadCustomApi) { - if (setting.execTime === 'once') { - this.setState({loadCustomApi: false}) - } - - this.loadOutResource() - if (setting.execType === 'async') { - this.loadmaindata() - } - } else { - this.loadmaindata() - } - } - - loadOutResource = () => { - const { setting, search, BID } = this.state - - let param = UtilsDM.getPrevQueryParams(setting, search, BID, this.props.menuType) - - if (setting.execType === 'sync') { - this.setState({ - loading: true - }) - } - - Api.genericInterface(param).then(res => { - if (res.status) { - if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { - this.loadmaindata() - } else { - this.customOuterRequest(res) - } - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 - }) - } - }, () => { - this.setState({ - loading: false - }) - }) - } - - customOuterRequest = (result) => { - const { setting } = this.state - let url = '' - - if (window.GLOB.systemType === 'production') { - url = setting.proInterface - } else { - url = setting.interface - } - - let mkey = result.mk_api_key || '' - - delete result.mk_ex_invoke // 鏄惁缁х画鎵ц - delete result.status - delete result.message - delete result.ErrCode - delete result.ErrMesg - delete result.mk_api_key // 褰撳墠璇锋眰鐨刱ey鍊硷紝鐢ㄤ簬鍥炶皟 - - let param = {} - - Object.keys(result).forEach(key => { - key = key.replace(/^mk_/ig, '') - param[key] = result[key] - }) - - Api.directRequest(url, setting.method, param, setting.cross).then(res => { - if (typeof(res) !== 'object') { - let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒' - - if (typeof(res) === 'string') { - error = res.replace(/'/ig, '"') - } - - let _result = { - mk_api_key: mkey, - $ErrCode: 'E', - $ErrMesg: error - } - - this.customCallbackRequest(_result) - } else { - if (Array.isArray(res)) { - res = { data: res } - } - res.mk_api_key = mkey - this.customCallbackRequest(res) - } - }, (e) => { - let _result = { - mk_api_key: mkey, - $ErrCode: 'E', - $ErrMesg: e && e.statusText ? e.statusText : '' - } - - this.customCallbackRequest(_result) - }) - } - - customCallbackRequest = (result) => { - const { setting } = this.state - let errSql = '' - if (result.$ErrCode === 'E') { - errSql = ` - set @ErrorCode='E' - set @retmsg='${result.$ErrMesg}' - ` - delete result.$ErrCode - delete result.$ErrMesg - } - - let lines = UtilsDM.getCallBackSql(setting, result) - let param = {} - - if (setting.callbackType === 'script') { // 浣跨敤鑷畾涔夎剼鏈� - let sql = lines.map(item => (` - ${item.insert} - ${item.selects.join(` union all - `)} - `)) - 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) - } - } else { - param.func = 's_ex_result_back' - param.s_ex_result = lines.map((item, index) => ({ - MenuID: this.state.config.MenuID, - MenuName: this.state.config.MenuName, - TableName: item.table, - LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), - Sort: index + 1 - })) - - if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) { - let sql = lines.map(item => (` - ${item.insert} - ${item.selects.join(` union all - `)} - `)) - sql = sql.join('') - console.info(sql.replace(/\n\s{10}/ig, '\n')) - } - } - - Api.genericInterface(param).then(res => { - if (res.status) { - this.loadmaindata() - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 - }) - } - }, () => { - this.setState({ - loading: false - }) - }) + this.loadmaindata(id) } /** * @description 涓昏〃鏁版嵁鍔犺浇 */ - async loadmaindata () { + async loadmaindata (id) { const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields, autoMatic } = this.state this.setState({ @@ -706,7 +563,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID) let result = await Api.genericInterface(param) @@ -718,9 +575,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'}}) @@ -740,11 +597,12 @@ 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])) { + if (setting.controlVal.includes(item[setting.controlField] + '')) { item.$disabled = true } } @@ -770,11 +628,18 @@ if (autoMatic) { MKEmitter.emit('autoMaticError', this.props.MenuID) } - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + if (result.ErrCode === 'N') { + Modal.error({ + title: result.message, + }) + } else { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } } } @@ -789,7 +654,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, id) let result = await Api.genericInterface(param) if (result.status) { @@ -813,6 +678,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 { @@ -853,10 +719,10 @@ getStatFieldsValue = () => { const { setting, search, BID, orderBy, statFields } = this.state - if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return + if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType) + let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID) Api.genericInterface(param).then(res => { if (res.status) { @@ -950,17 +816,17 @@ /** * @description 琛ㄦ牸鍒锋柊 */ - reloadtable = (btn) => { + reloadtable = (btn, id = '') => { if (!btn || btn.resetPageIndex !== 'false') { MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1 }, () => { - this.loadData() + this.loadData(id) }) } else { MKEmitter.emit('resetTable', this.props.MenuID, 'false') // 鍒楄〃閲嶇疆 - this.loadData() + this.loadData(id) } } @@ -970,7 +836,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, searchlist: null + pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false }, () => { this.loadconfig() }) @@ -979,13 +845,13 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { MenuName, MenuID } = this.props const { arr_field, orderBy, search, setting} = this.state if (MenuID !== menuId) return - MKEmitter.emit('returnModuleParam', MenuID, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: search, @@ -1021,7 +887,6 @@ const { MenuID } = this.props if (MenuID !== menuId) return - if (id === 'empty') return if (id === 'formtab') { // 琛ㄥ崟鏍囩椤靛埛鏂� this.reloadtable(btn) @@ -1077,8 +942,12 @@ if (position === 'line' && lines && lines.length === 1) { this.loadmainLinedata(lines[0].$$uuid) } else { - this.reloadtable(btn) + this.reloadtable(btn, id) } + } + + debugChange = () => { + this.setState({visible: !this.state.visible}) } UNSAFE_componentWillMount () { @@ -1092,6 +961,7 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) + MKEmitter.addListener('debugChange', this.debugChange) MKEmitter.addListener('reloadMenuView', this.reloadMenuView) MKEmitter.addListener('changeTableLine', this.changeTableLine) MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) @@ -1108,6 +978,7 @@ } document.onkeydown = () => {} MKEmitter.removeListener('reloadData', this.reloadData) + MKEmitter.removeListener('debugChange', this.debugChange) MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) MKEmitter.removeListener('changeTableLine', this.changeTableLine) MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) @@ -1116,16 +987,16 @@ } render() { - const { menuType, MenuID } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state + const { MenuID } = this.props + const { BID, setting, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts } = this.state return ( <div className="commontable" id={this.state.ContainerId}> {loadingview ? <Spin size="large" /> : null} - {searchlist && searchlist.length ? - <MainSearch BID={BID} searchlist={searchlist} setting={setting} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null + {config && config.search && config.search.length ? + <MainSearch BID={BID} config={config} 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 => ( @@ -1145,10 +1016,8 @@ setting={setting} actions={actions} columns={columns} - dict={this.state.dict} MenuID={MenuID} selectedData={selectedData} - ContainerId={this.state.ContainerId} /> </div> <div className="main-table-box"> @@ -1162,12 +1031,10 @@ 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} /> @@ -1186,7 +1053,6 @@ columns={columns} data={this.state.data} loading={this.state.loading} - ContainerId={this.state.ContainerId} /> </Col> ) @@ -1205,6 +1071,37 @@ } })} </Row> : null } + {setting && !config.charts ? <div className="chart-view"> + <div className="commontable-main-action"> + <MainAction + BID={BID} + setting={setting} + actions={actions} + columns={columns} + MenuID={MenuID} + selectedData={selectedData} + /> + </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} + data={this.state.data} + total={this.state.total} + loading={this.state.loading} + statFValue={this.state.statFValue} + refreshdata={this.refreshbytable} + chgSelectData={this.changeSelectedData} + /> + </div> + </div> : null } {setting && config.tabgroups.map(group => ( <Tabs key={group.uuid}> {group.sublist.map(_tab => { @@ -1220,7 +1117,6 @@ SupMenuID={MenuID} MenuID={_tab.linkTab} mainSearch={_tab.searchPass === 'true' ? search : null} - ContainerId={this.state.ContainerId} BID={this.state.BIDs[_tab.supMenu] || ''} BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} /> @@ -1229,25 +1125,12 @@ })} </Tabs>)) } - {menuType !== 'HS' && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} - {menuType !== 'HS' && window.GLOB.systemType !== 'production' ? <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 && setting ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) } } -const mapStateToProps = (state) => { - return { - menuType: state.editLevel, - 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