From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/tabviews/basetable/index.jsx | 1471 ++++++++++++++++------------------------------------------ 1 files changed, 413 insertions(+), 1,058 deletions(-) diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index a20277d..09c2024 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -1,73 +1,49 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { notification, Spin, Tabs, Switch, Row, Col } from 'antd' +import { notification, Spin, Row, Col } 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' -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' // 閫氱敤缁勪欢 -const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) -const MainAction = asyncSpinComponent(() => import('@/tabviews/zshare/actionList')) -const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) +const AntvTabs = asyncComponent(() => import('@/tabviews/custom/components/tabs/antv-tabs')) +const MkBaseTable = asyncComponent(() => import('@/tabviews/custom/components/table/base-table')) const SettingComponent = asyncComponent(() => import('@/tabviews/zshare/settingcomponent')) -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 TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes')) const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) +const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) -const { TabPane } = Tabs - -class NormalTable extends Component { +class BasePage extends Component { static propTpyes = { - param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鎼滅储鏉′欢绛夊弬鏁� + param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟 + Tab: PropTypes.string, // 寮圭獥鏍囩 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 + BID: '', // 椤甸潰璺宠浆鏃舵惡甯D loadingview: true, // 椤甸潰鍔犺浇涓� viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 - config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - shortcuts: null, // 蹇嵎閿� - searchlist: null, // 鎼滅储鏉′欢 - actions: null, // 鎸夐挳闆� - columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: [], // 鍒楄〃鏁版嵁闆� - selectedData: [], // 宸查�夎〃鏍兼暟鎹� - total: 0, // 鎬绘暟 + config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 + mainSearch: null, // 涓绘悳绱� + userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� + data: null, // 鍒楄〃鏁版嵁闆� loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - pageIndex: 1, // 椤电爜 - pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - orderBy: '', // 鎺掑簭 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - BIDs: {}, // 涓婄骇琛╥d - pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - chartId: '', // 灞曞紑鍥捐〃ID - statFields: [], // 鍚堣瀛楁 - statFValue: [], // 鍚堣鍊� - absFields: [], // 缁濆鍊煎瓧娈� - loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 - hasReqFields: false, + visible: false, // 鏍囩椤垫帶鍒� + shortcuts: null, // 蹇嵎閿� autoMatic: null } @@ -75,7 +51,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { param, MenuName, MenuID } = this.props + const { MenuID } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -88,42 +64,52 @@ let shortcuts = [] 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 + config = window.decodeURIComponent(window.atob(result.LongParam)) + config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl) + config = JSON.parse(config) } catch (e) { console.warn('Parse Failure') config = '' } - + + // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� + if (!config) { + this.setState({ + viewlost: true, + loadingview: false + }) + return + } + + // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 + if (!config.enabled) { + this.setState({ + viewlost: true, + loadingview: false, + lostmsg: this.state.dict['main.view.unenabled'] + }) + return + } + + // 妯℃澘閿欒 + if (config.Template !== 'BaseTable') { + if (config.Template === 'CustomPage' || config.Template === 'CommonTable') { + this.props.changeTemp(MenuID, config.Template) + } else { + this.setState({ + viewlost: true, + loadingview: false, + lostmsg: '鑿滃崟淇℃伅閿欒锛屽彲鑳藉師鍥狅細1銆佸綋鍓嶇敤鎴锋棤鏉冮檺锛�2銆佹墦寮�姝よ彍鍗曠殑鎸夐挳闇�瑕佹洿鏂般��' + }) + } + return + } + // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 if (result.LongParamUser && !window.GLOB.mkHS) { try { // 閰嶇疆淇℃伅瑙f瀽 let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) - if (userConfig && !userConfig.version) { - Object.keys(userConfig).forEach(key => { - let component = userConfig[key] - - if (!component.action) return - - Object.keys(component.action).forEach(uuid => { - let item = {uuid: uuid, parentId: key, shortcut: component.action[uuid].shortcut} - let printer = component.action[uuid].printer - - if (item.shortcut) { - item.$shortcut = item.shortcut.join('+') - shortcuts.push(item) - } - if (printer) { - item.printer = printer.defaultPrinter || '' - item.printerList = printer.printerList || '' - window.GLOB.UserCacheMap.set(key + uuid, item) - } - }) - }) - } else if (userConfig) { + if (userConfig) { shortcuts = userConfig.action userConfig.printers.forEach(item => { window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item) @@ -134,308 +120,95 @@ } } - // 椤甸潰閰嶇疆瑙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 = updateCommonTable(config) - // 鏉冮檺杩囨护 - 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 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 + let skip = window.GLOB.mkHS + let param = this.props.param || {} // url鍙傛暟 - let chartId = '' + window.GLOB.CacheData.set(MenuID, param) - 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 userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + + if (sessionStorage.getItem('isEditState') === 'true') { + userName = sessionStorage.getItem('CloudUserName') || '' + fullName = sessionStorage.getItem('CloudFullName') || '' } - config.search = Utils.initSearchVal(config.search) - - // 瀛楁閫忚鍙婂繀濉爣蹇� - 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 - }) - - config.columns = config.columns.map(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0) return col - if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { - col.Hide = 'true' - } - - return col - }) - - // 鏍囪涓婚〉闈紝鐢ㄤ簬鎸夐挳鍥哄畾鍙婅〃鍗曟寕杞借缃� - config.setting.tabType = 'main' - - // 鏁版嵁婧愪俊鎭澶勭悊 - config.setting.laypage = config.setting.laypage !== 'false' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 - config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - 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.scripts && config.setting.scripts.length > 0) { - let _customScript = '' - config.setting.scripts.forEach(item => { - if (item.status === 'false') return - _customScript += ` - ${item.sql} - ` - }) - config.setting.customScript = _customScript - } - - if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ - config.setting.dataresource = '' - } else if (/\s/.test(config.setting.dataresource)) { - config.setting.dataresource = '(' + config.setting.dataresource + ') tb' - } - - 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, '*/') - } else { - 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 => { - let reg = new RegExp('@' + field + '@', 'ig') - let val = `'${_param[field] || ''}'` - config.setting.dataresource = config.setting.dataresource.replace(reg, val) - config.setting.customScript = config.setting.customScript.replace(reg, val) - }) - } - } - - let _arrField = [] // 瀛楁闆� - let _columns = [] // 鏄剧ず鍒� - let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� - let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 - let statFields = [] // 鍚堣瀛楁淇℃伅 - let absFields = [] // 缁濆鍊煎瓧娈� - - let _actions = [] // 宸ュ叿鏍忔寜閽� - let _operations = [] // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級 - - config.action.forEach(item => { - item.logLabel = MenuName + '-' + item.label // 鐢ㄤ簬sPC_TableData_InUpDe璁板綍鎿嶄綔鎸夐挳 - item.$menuId = this.props.MenuID - - if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 鎵撳嵃鏈鸿缃� - let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) - - if (_item) { - item.printer = _item.printer || '' - item.verify.defaultPrinter = _item.printer || '' - if (item.verify.printerTypeList && _item.printerList) { - item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { - cell.printer = _item.printerList[cell.Value] || '' - - return cell - }) - } - } - } - - if (item.position === 'toolbar') { - item.$toolbtn = true - _actions.push(item) - } else if (item.position === 'grid') { - _operations.push(item) - } - }) - - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid - 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 = '' - } - - col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� - if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { - statFields.push(col) - } - if (col.format === 'abs') { - absFields.push(col.field) - } - } - if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 - _hideCol = _hideCol.concat(col.sublist) - } - colMap.set(col.uuid, col) - }) - - // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� - config.columns.forEach((col, index) => { - if (_hideCol.includes(col.uuid)) return - - col.sort = index - - if (col.type === 'colspan') { - if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 - col.type = 'old_colspan' - } - - let _col = fromJS(col).toJS() - let subcols = [] - _col.sublist && _col.sublist.forEach(sub => { - if (colMap.has(sub)) { - subcols.push(colMap.get(sub)) - } - }) - if (subcols.length > 0) { - _col.subcols = subcols - _columns.push(_col) - } - } else { - _columns.push(col) - } - }) + let regs = [ + { reg: /@userName@/ig, value: `'${userName}'` }, + { reg: /@fullName@/ig, value: `'${fullName}'` } + ] - if (config.gridBtn && config.gridBtn.display && _operations.length > 0) { - config.gridBtn.operations = _operations - _columns.push(config.gridBtn) + if (window.GLOB.externalDatabase !== null) { + regs.push({ + reg: /@db@/ig, + value: window.GLOB.externalDatabase + }) + } + if (config.urlFields) { + config.urlFields.forEach(field => { + let val = `'${param[field] || ''}'` + regs.push({ + reg: new RegExp('@' + field + '@', 'ig'), + value: val + }) + }) } - 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 - } + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID) 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'))) { + config.components[0].action.forEach(item => { + if (item.uuid === config.autoMatic.action) { autoMatic = config.autoMatic autoMatic.OpenType = item.execMode || item.OpenType - config.setting.selected = 'false' + config.components[0].wrap.selected = 'false' + config.components[0].MenuID = config.components[0].uuid + config.components[0].autoMatic = true item.autoMatic = true } }) } + + // 鑾峰彇涓绘悳绱㈡潯浠� + let mainSearch = [] + config.components.forEach(component => { + if (component.type === 'tabs') return - if (config.setting.controlField) { - if (config.setting.controlVal) { - config.setting.controlVal = config.setting.controlVal.split(',') - } else { - config.setting.controlVal = [''] - } - } + component.search = component.search.map(item => { + item.oriInitval = item.initval + if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { + item.initval = param.$searchval + } + + return item + }) + + mainSearch = Utils.initMainSearch(component.search) + }) + + let BID = param.$BID || '' + + config.components = this.formatSetting(config.components, mainSearch, regs) this.setState({ - pageSize: config.setting.pageSize || 10, - loadingview: false, - absFields, - autoMatic, - chartId, + BID: BID, + shortcuts: shortcuts.length > 0 ? shortcuts : null, config, - statFields, - shortcuts, - 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 + autoMatic, + mainSearch }, () => { - if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 - this.loadData() + setTimeout(() => { // 寤舵椂鍔犺浇鐘舵�� + this.setState({ + loadingview: false + }) + }, 1000) + + if (!this.props.Tab) { + this.setShortcut() } - this.setShortcut() }) } else { this.setState({ @@ -453,11 +226,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 @@ -472,18 +240,22 @@ } if (!preKey || !keyCode) return - + let _shortcut = `${preKey}+${keyCode}` + + if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') { + window.debugger = false + 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) - - let element = item.parentId && item.parentId !== this.props.MenuID ? document.getElementById(item.parentId) : '' // 鏍囩鍒囨崲 - if (element && element.click) { - element.click() - } - return true } return false @@ -491,593 +263,256 @@ } } - loadData = (id) => { - const { MenuID } = this.props - const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state + filterComponent = (components, roleId, permAction, skip, urlparam, pageId) => { + return components.filter(item => { + item.$pageId = pageId - this.setState({ - selectedData: [] - }) - MKEmitter.emit('changeTableLine', ContainerId, MenuID, '', '') + item.$menuname = (this.props.MenuName || '') + '-' + (item.name || '涓昏〃') - if (hasReqFields) { - let requireFields = search.filter(item => item.required && item.value === '') - - if (requireFields.length > 0) { - this.setState({ - loading: false + if (item.type === 'tabs') { + item.subtabs = item.subtabs.filter(tab => { + if (!skip && !permAction[tab.components[0].uuid] && tab.permission === 'true') { + return false + } else if (tab.hide === 'true') { + return false + } + return true }) - return - } - } - if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { - notification.warning({ - top: 92, - message: '鏈缃寮忕郴缁熷湴鍧�!', - duration: 3 - }) - return - } + if (item.subtabs.length === 0) return false - if (setting.interType === 'custom' && loadCustomApi) { - if (setting.execTime === 'once') { - this.setState({loadCustomApi: false}) + item.subtabs = item.subtabs.map(tab => { + tab.components[0].name = tab.label + if (tab.permission !== 'true') { // 鏉冮檺鏈紑鍚笉鍋氭潈闄愭帶鍒� + skip = true + } + tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId) + return tab + }) + + return true } - this.loadOutResource() - if (setting.execType === 'async') { - this.loadmaindata(id) + // 鎼滅储鏉′欢鍒濆鍖� + if (item.search && item.search.length > 0) { + item.search = Utils.initSearchVal(item.search) } - } else { - this.loadmaindata(id) - } - } - loadOutResource = () => { - const { setting, search, BID } = this.state - - let param = UtilsDM.getPrevQueryParams(setting, search, BID) - - 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() + if (item.setting.supModule) { + let pid = item.setting.supModule.pop() + if (pid && pid !== 'empty') { + item.setting.supModule = pid } 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, BID } = 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, BID) - } 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.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { - 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 - }) - }) - } - - /** - * @description 涓昏〃鏁版嵁鍔犺浇 - */ - 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) - - 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'}}) + item.setting.supModule = '' } } - this.setState({ - data: result.data.map((item, index) => { - if (absFields.length) { - absFields.forEach(field => { - if (!item[field]) return - if (isNaN(Math.abs(item[field]))) return - - item[field] = Math.abs(item[field]) + let statFields = [] + let getCols = (cols) => { + return cols.filter(col => { + if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + return false + } else if (col.Hide === 'true') { + return false + } + + if (col.type === 'number') { + if (col.sum === 'true') { + statFields.push(col) + } + if (typeof(col.decimal) === 'number') { + col.round = Math.pow(10, col.decimal) + if (col.format === 'percent') { + col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 + } + } + } else if (col.type === 'colspan') { + col.subcols = getCols(col.subcols || []) + if (col.subcols.length === 0) { + return false + } + } else if (col.type === 'custom') { + col.elements = col.elements.map(cell => { + if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } + } + return cell }) } - - 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 - } + + if (col.linkmenu && col.linkmenu.length > 0) { + let menu_id = col.linkmenu.pop() + col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + } else { + col.linkThdMenu = '' } - return item - }), - total: result.total, - 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, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇鍗曡鏁版嵁 - */ - async loadmainLinedata (id) { - const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields } = this.state - - this.setState({ - loading: true - }) - - let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, id) - - let result = await Api.genericInterface(param) - if (result.status) { - let data = fromJS(this.state.data).toJS() - let selectedData = fromJS(this.state.selectedData).toJS() - if (result.data && result.data[0]) { - let _data = result.data[0] || {} - - if (absFields.length) { - absFields.forEach(field => { - if (!_data[field]) return - if (isNaN(Math.abs(_data[field]))) return - - _data[field] = Math.abs(_data[field]) - }) - } - _data.$$uuid = _data[setting.primaryKey] || '' - _data.$$BID = BID || '' - - try { - 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 - } - }) - selectedData = selectedData.map(item => { - if (_data.$$uuid === item.$$uuid) { - return _data - } - return item - }) - } catch (e) { - console.warn('鏁版嵁鏌ヨ閿欒') - } - } - - this.setState({ - data, - selectedData, - loading: false - }) - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇鍚堣瀛楁鍊� - */ - 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 - - let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID) - - Api.genericInterface(param).then(res => { - if (res.status) { - let _data = res.data[0] - let values = [] - - if (_data) { - statFields.forEach(item => { - if (_data[item.field] || _data[item.field] === 0) { - let val = +_data[item.field] - if (isNaN(val)) { - val = 0 - } - val = val.toFixed(item.decimal) - values.push({label: item.label, value: val}) - } - }) - } - this.setState({ - statFValue: values - }) - } else { - this.setState({ - statFValue: [] - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 + return true }) } - }) - } + + item.cols = getCols(item.cols) + item.statFields = Array.from(new Set(statFields)) - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - const { setting } = this.state + // 鏉冮檺杩囨护 + if (item.action && item.action.length > 0) { + item.action = item.action.filter(cell => { + if (cell.hidden === 'true') return false - if (setting.onload === 'false') { - this.setState({ - pageIndex: 1, - search: searches, - setting: {...setting, onload: 'true'} - }, () => { - this.loadData() - }) - } else { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - pageIndex: 1, - search: searches - }, () => { - this.loadData() - }) - } - } + cell.logLabel = item.$menuname + '-' + cell.label + cell.ContainerId = this.state.ContainerId + cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' + cell.$menuId = item.uuid + cell.$MenuID = this.props.MenuID + cell.$view = 'popview' + cell.$toolbtn = true - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - if (!sorter) { - this.setState({ - pageIndex: pagination.pageIndex - }, () => { - this.loadData() - }) - return - } + if (cell.syncComponentId === item.setting.supModule) { + cell.syncComponentId = '' + } - if (sorter.order) { - let _chg = { - ascend: 'asc', - descend: 'desc' + if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� + cell = this.getPrinter(cell, item.uuid) + } + + return skip || permAction[cell.uuid] + }) } - sorter.order = _chg[sorter.order] - } - this.setState({ - pageIndex: pagination.current, - pageSize: pagination.pageSize, - orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' - }, () => { - this.loadData() - }) - } + item.cols = item.cols.filter(col => { + if (col.type !== 'action') return true + col.elements = col.elements.filter(cell => { + if (cell.hidden === 'true') return false + + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' + cell.ContainerId = this.state.ContainerId + cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' + cell.$menuId = item.uuid + cell.$MenuID = this.props.MenuID + cell.$view = 'popview' - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = (btn, id = '') => { - if (!btn || btn.resetPageIndex !== 'false') { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - pageIndex: 1 - }, () => { - this.loadData(id) + if (cell.syncComponentId === item.setting.supModule) { + cell.syncComponentId = '' + } + + if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� + cell = this.getPrinter(cell, item.uuid) + } + + return skip || permAction[cell.uuid] + }) + return col.elements.length !== 0 }) - } else { - MKEmitter.emit('resetTable', this.props.MenuID, 'false') // 鍒楄〃閲嶇疆 - this.loadData(id) + + return true + }) + } + + getPrinter = (item, parentId) => { + let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid) + + if (_item) { + item.printer = _item.printer || '' + item.verify.defaultPrinter = _item.printer || '' + if (item.verify.printerTypeList && _item.printerList) { + item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { + cell.printer = _item.printerList[cell.Value] || '' + + return cell + }) + } } + + return item } - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - 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 - }, () => { - this.loadconfig() - }) - } + // 鏍煎紡鍖栭粯璁よ缃� + formatSetting = (components, regs) => { + let delay = 20 + return components.map(component => { + if (component.type === 'tabs') { + component.subtabs = component.subtabs.map(tab => { + tab.components = this.formatSetting(tab.components, regs) + return tab + }) + return component + } - /** - * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� - */ - queryModuleParam = (menuId, callback) => { - const { MenuName, MenuID } = this.props - const { arr_field, orderBy, search, setting} = this.state + component.setting.useMSearch = component.setting.useMSearch === 'true' - if (MenuID !== menuId) return + if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 + component.setting.sync = 'false' + component.setting.laypage = component.setting.laypage === 'true' + return component + } - callback({ - arr_field: arr_field, - orderBy: orderBy || setting.order, - search: search, - menuName: MenuName - }) - } + let _customScript = '' + component.scripts && component.scripts.forEach(script => { + if (script.status !== 'false') { + _customScript += ` + ${script.sql} + ` + } + }) + delete component.scripts + component.setting.$name = component.$menuname || '' + component.setting.execute = component.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 + component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 - /** - * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� - */ - changeSelectedData = (selectedData) => { - this.setState({selectedData}) - } + if (!component.setting.execute) { + component.setting.dataresource = '' + } + if (/\s/.test(component.setting.dataresource)) { + component.setting.dataresource = '(' + component.setting.dataresource + ') tb' + } - /** - * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 - */ - pickupChange = () => { - const { pickup } = this.state - this.setState({ - pickup: !pickup + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'') + component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') + _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'') + _customScript = _customScript.replace(/@\$/ig, '*/') + } else { + component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + } + + regs.forEach(cell => { + component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) + _customScript = _customScript.replace(cell.reg, cell.value) + }) + + component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + + component.setting.delay = delay + delay += 20 + + return component }) } - /** - * @description 鍥捐〃瑙嗗浘鍒囨崲 - */ - changeChart = (uuid) => { - this.setState({chartId: uuid}) - } - - reloadData = (menuId, id, btn) => { + reloadMenuView = (menuId) => { const { MenuID } = this.props if (MenuID !== menuId) return - if (id === 'formtab') { // 琛ㄥ崟鏍囩椤靛埛鏂� - this.reloadtable(btn) - return - } - - if (!id) { - this.reloadtable() - } else { - this.loadmainLinedata(id) - } - } - - reloadMenuView = (menuId, position) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - if (position === 'table') { - this.reloadtable() - } else { - this.reloadview() - } + this.reloadview() } resetActiveMenu = (menuId) => { - const { MenuID } = this.props + const { MenuID, Tab } = this.props - if (MenuID !== menuId) return + if (MenuID !== menuId || Tab) return 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, id, lines) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - if (position === 'line' && lines && lines.length === 1) { - this.loadmainLinedata(lines[0].$$uuid) - } else { - this.reloadtable(btn, id) - } } UNSAFE_componentWillMount () { @@ -1090,12 +525,9 @@ } 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) - MKEmitter.addListener('queryModuleParam', this.queryModuleParam) - MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -1105,171 +537,94 @@ this.setState = () => { return } - 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) - MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) - MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + window.GLOB.CacheData.delete(this.props.MenuID) + if (this.state.config) { + this.deleteCache(this.state.config.components) + } + } + + debugChange = () => { + this.setState({visible: !this.state.visible}) + } + + deleteCache = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + this.deleteCache(tab.components) + }) + } else { + window.GLOB.CacheData.delete(item.uuid) + } + }) + } + + reloadview = () => { + window.GLOB.CacheData.delete(this.props.MenuID) + if (this.state.config) { + this.deleteCache(this.state.config.components) + } + + this.setState({ + BID: '', // 椤甸潰璺宠浆鏃舵惡甯D + loadingview: true, // 椤甸潰鍔犺浇涓� + viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 + config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 + loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� + shortcuts: null, + data: '' + }, () => { + this.loadconfig() + }) + } + + resetSearch = (search) => { + this.setState({mainSearch: null}, () => { + this.setState({mainSearch: search}) + }) + } + + getComponents = () => { + const { config, data, mainSearch } = this.state + + if (!config || !config.components) return + + return config.components.map(item => { + if (item.type === 'tabs') { + return ( + <Col span={item.width} key={item.uuid}> + <AntvTabs config={item} mainSearch={mainSearch} /> + </Col> + ) + } else { + return ( + <Col span={item.width} key={item.uuid}> + <MkBaseTable config={item} data={data}/> + </Col> + ) + } + }) } render() { - const { MenuID } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state + const { loadingview, viewlost, config, loading, 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} setting={setting} refreshdata={this.refreshbysearch}/> : null - } - {setting && config.charts ? <Row className="chart-view" gutter={16}> - {/* 瑙嗗浘缁� */} - {!config.expand ? <Tabs activeKey={chartId} onChange={this.changeChart}> - {config.charts.map(item => ( - <TabPane tab={<MkIcon type={item.icon} />} key={item.uuid}></TabPane> - ))} - </Tabs> : null} - {config.charts.map(item => { - if (!config.expand && chartId !== item.uuid) return null - - if (item.chartType === 'table') { - return ( - <Col span={item.width || 24} key={item.uuid}> - {config.charts.length > 1 && item.title ? <p className="chart-table chart-title">{item.title}</p> : null} - <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> - </Col> - ) - } else if (item.chartType === 'card') { - return ( - <Col className="card-view" span={item.width} key={item.uuid}> - <CardComponent - BID={BID} - plot={item} - MenuID={MenuID} - config={config} - tableId={MenuID} - columns={columns} - data={this.state.data} - loading={this.state.loading} - ContainerId={this.state.ContainerId} - /> - </Col> - ) - } else { - return ( - <Col span={item.width} key={item.uuid}> - <ChartComponent - BID={BID} - plot={item} - config={config} - data={this.state.data} - loading={this.state.loading} - /> - </Col> - ) - } - })} - </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 ? <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} - ContainerId={this.state.ContainerId} - BID={this.state.BIDs[_tab.supMenu] || ''} - BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} - /> - </TabPane> - ) - })} - </Tabs>)) - } - {!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} + <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> + {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null} + <Row className="component-wrap">{this.getComponents()}</Row> + {config && window.GLOB.breakpoint ? <DebugTable /> : null} + {!window.GLOB.mkHS && config && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config.components[0]} /> : null} + {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} + {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) } } -export default NormalTable \ No newline at end of file +export default BasePage \ No newline at end of file -- Gitblit v1.8.0