From 2bccb9ec7bdefe23292a22bc153463cfa1479a49 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 六月 2024 16:25:42 +0800 Subject: [PATCH] 2024-06-21 --- src/tabviews/custom/index.jsx | 659 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 429 insertions(+), 230 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 195ad72..ce3f77e 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { notification, Spin, Row, Col, Modal } from 'antd' +import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -41,9 +42,11 @@ const AntvX6 = asyncComponent(() => import('./components/chart/antv-X6')) const Voucher = asyncComponent(() => import('./components/module/voucher')) const Account = asyncComponent(() => import('./components/module/account')) +const Invoice = asyncComponent(() => import('./components/module/invoice')) const Iframe = asyncComponent(() => import('./components/iframe')) const Calendar = asyncComponent(() => import('./components/calendar')) const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) +const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat')) const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes')) const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces')) @@ -62,7 +65,6 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 - userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� shortcuts: null, // 蹇嵎閿� @@ -75,7 +77,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { MenuID, MenuName } = this.props + const { MenuID, MenuName, param } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -133,13 +135,56 @@ return } + if (config.process === 'true') { + let unset = true + if (result.works_flow_code && result.works_long_param) { + try { // 娴佺▼淇℃伅瑙f瀽 + let flowConfig = JSON.parse(window.decodeURIComponent(window.atob(result.works_long_param))) + flowConfig.flow_code = result.works_flow_code + flowConfig.flow_name = result.works_flow_name + config.flow_code = result.works_flow_code + config.flow_name = result.works_flow_name + unset = false + + window.GLOB.UserCacheMap.set('flow' + MenuID, flowConfig) + } catch (e) { + unset = true + console.warn('Parse Failure') + } + } + + if (unset) { + config.interfaces = [] + this.setState({ + config: config, + viewlost: true, + loadingview: false, + lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭璁剧疆宸ヤ綔娴侊紝璇疯仈绯荤鐞嗗憳銆�' + }) + return + } + } else if (result.works_flow_code) { + Api.getSystemConfig({ + func: 's_works_flow_param_sso_menu_upt_v6', + upt_type: 'del', + works_flow_code: '', + works_flow_name: '', + long_param: '', + flow_id: '', + menuid: config.MenuID, + menuname: config.MenuName, + username: sessionStorage.getItem('User_Name') || '', + fullName: sessionStorage.getItem('Full_Name') || '' + }) + } + // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 - if (result.LongParamUser && !window.GLOB.mkHS) { + if (result.LongParamUser) { try { // 閰嶇疆淇℃伅瑙f瀽 let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) if (userConfig) { - shortcuts = userConfig.action - userConfig.printers.forEach(item => { + shortcuts = userConfig.action || [] + userConfig.printers && userConfig.printers.forEach(item => { window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item) }) } @@ -159,10 +204,20 @@ // 鏉冮檺杩囨护 let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID let balMap = new Map() + let tbMap = new Map() let skip = config.permission === 'false' || window.GLOB.mkHS - let param = this.props.param || {} // url鍙傛暟 + let urlparam = {} // url鍙傛暟 + if (param) { + Object.keys(param).forEach(key => { + if (/^\$/.test(key)) { + urlparam[key] = param[key] + } else { + urlparam[key.toLowerCase()] = param[key] + } + }) + } - window.GLOB.CacheData.set(MenuID, param) + window.GLOB.CacheData.set(MenuID, urlparam) let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' @@ -180,7 +235,7 @@ } if (config.urlFields) { config.urlFields.forEach(field => { - let val = `'${param[field] || ''}'` + let val = `'${urlparam[field.toLowerCase()] || ''}'` regs.push({ reg: new RegExp('@' + field + '@', 'ig'), value: val @@ -188,16 +243,29 @@ }) } + if (config.flow_code) { + regs.push({ reg: /@works_flow_code@/ig, value: `'${config.flow_code}'` }) + } + config.$cache = config.cacheLocal === 'true' config.$time = config.localCacheTime || 0 + if (window.GLOB.systemType !== 'production' && result.modifydate) { + let s = (new Date().getTime() - new Date(result.modifydate).getTime()) / (1000 * 60 * 60) + if (!isNaN(s) && s < 2) { + config.$cache = false + config.$time = 0 + config.cacheUseful = 'false' + } + } + let initInters = [] - config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters) - config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID) + config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters, config.MenuName) + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, tbMap, skip, urlparam, MenuID, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true', regs) let params = [] - let BID = param.$BID || '' + let BID = urlparam.$BID || '' let inherit = {} if (config.cacheUseful === 'true') { // 缂撳瓨缁ф壙 @@ -210,18 +278,6 @@ config.components.forEach(component => { if (component.type !== 'search') return - if (param.$searchkey) { - component.search = component.search.map(item => { - if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { - item.initval = param.$searchval - } - - return item - }) - - component.$searches = Utils.initMainSearch(component.search) - } - window.GLOB.SearchBox.set(MenuID, component.$searches) if (component.$s_req) { @@ -229,11 +285,7 @@ } }) - config.components = this.formatSetting(config.components, params, inherit, regs, balMap) - - if ([...balMap.keys()].length > 0) { - config.components = this.filterBalcony(config.components, balMap) - } + config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap) if (initInters.length > 0) { this.stepInter = { @@ -325,14 +377,32 @@ } } - filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) => { + filterComponent = (components, roleId, permAction, balMap, tbMap, skip, urlparam, pageId, cache, time, MenuName, searchId, syncId, process, regs) => { return components.filter(item => { item.$pageId = pageId - item.$cache = cache - item.$time = time item.$searchId = searchId item.$syncId = syncId + if (process) { + item.$process = process + item.$flowId = 'flow' + this.props.MenuID + } + + if (cache) { + item.$cache = cache + item.$time = time + + if (item.wrap && item.wrap.cacheLocal === 'false') { + item.$cache = false + } else if (item.plot && item.plot.cacheLocal === 'false') { + item.$cache = false + } + + if (!item.$cache && item.setting && item.setting.sync === 'true') { + item.setting.sync = 'false' + } + } + if (item.style && item.style.boxShadow) { delete item.style.hShadow delete item.style.vShadow @@ -377,6 +447,8 @@ } } + tab.$menuname = (MenuName || '') + '-' + (tab.label || '') + return true }) @@ -385,12 +457,7 @@ if (item.setting.supModule === 'preview') { item.setting.supModule = '' - let val = '' - Object.keys(urlparam).forEach(key => { - if (key.toLowerCase() === item.setting.controlField) { - val = urlparam[key] - } - }) + let val = urlparam[item.setting.controlField] || '' item.subtabs = item.subtabs.filter(tab => { if (tab.$pass) return true @@ -403,12 +470,7 @@ if (item.setting.selectField) { item.setting.selectField = item.setting.selectField.toLowerCase() - let val = '' - Object.keys(urlparam).forEach(key => { - if (key.toLowerCase() === item.setting.selectField) { - val = urlparam[key] - } - }) + let val = urlparam[item.setting.selectField] || '' let activeKey = '' @@ -432,7 +494,7 @@ _searchId = tab.uuid } - tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid) + tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, tbMap, skip, urlparam, pageId, cache, time, MenuName, _searchId, tab.uuid, process, regs) if (_searchId === tab.uuid) { tab.components.forEach(cell => { @@ -456,7 +518,7 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) + item.components = this.filterComponent(item.components, roleId, permAction, balMap, tbMap, skip, urlparam, pageId, cache, time, MenuName, searchId, syncId, process, regs) return true } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { @@ -473,36 +535,53 @@ ) { return false } - - if (item.wrap.datatype === 'public') { - let inter = interfaces.filter(int => item.wrap.publicId === int.uuid)[0] - if (!inter) { - item.wrap.datatype = 'static' - } else { - item.setting = inter.setting - } - } } if (item.subtype === 'tablecard') { // 鍏煎 item.type = 'card' } - // 鎼滅储鏉′欢鍒濆鍖� - if (item.search) { - Utils.initSearchVal(item) - - item.$searches = Utils.initMainSearch(item.search) - } - - if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢 - item.setting.supModule = item.supNodes[0].componentId + if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗°�乼able澶氫笂绾х粍浠� + item.supNodes = item.supNodes.map(node => node.componentId) + if (item.supNodes[0]) { + item.setting.supModule = item.supNodes[0] + } else { + item.supNodes = null + item.setting.supModule = '' + } } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { let pid = item.setting.supModule.pop() if (pid && pid !== 'empty') { item.setting.supModule = pid } else { item.setting.supModule = '' + } + } else if (item.type === 'search') { + if (item.wrap.supModule) { + item.wrap.supModule = item.wrap.supModule.pop() + } + } + + // 鎼滅储鏉′欢鍒濆鍖� + if (item.search) { + Utils.initSearchVal(item) + + if (urlparam.$searchkey) { + item.search.forEach(cell => { + if (urlparam.$searchkey === cell.field.toLowerCase() && ['text', 'select', 'link', 'checkcard'].includes(cell.type)) { + cell.initval = urlparam.$searchval + } + }) + } + + item.$searches = Utils.initMainSearch(item.search) + + if (item.type === 'search' && item.wrap.supModule) { + if (!item.checkBid) { + item.wrap.supModule = '' + } else { + window.GLOB.SearchBox.set(item.$searchId + 'checkBid', true) + } } } @@ -525,12 +604,11 @@ cell = this.getPrinter(cell, item.uuid) } - return pass || permAction[cell.uuid] + return pass || permAction[cell.uuid] || cell.permission === 'false' }) } if (item.type === 'table') { - let statFields = [] let getCols = (cols) => { return cols.filter(col => { if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { @@ -541,10 +619,10 @@ col.type = 'custom' } - if (col.type === 'number') { - if (col.sum === 'true' && !statFields.includes(col.field)) { - statFields.push(col) - } + if (col.type === 'index') { + col.field = '$Index' + col.type = 'text' + } else if (col.type === 'number') { if (typeof(col.decimal) === 'number') { col.round = Math.pow(10, col.decimal) if (col.format === 'percent') { @@ -571,7 +649,7 @@ cell = this.getPrinter(cell, item.uuid) } - return pass || permAction[cell.uuid] + return pass || permAction[cell.uuid] || cell.permission === 'false' } else { cell = this.resetElement(cell) } @@ -585,9 +663,13 @@ 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] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' + } + + if (col.marks && col.marks.length === 0) { + col.marks = null } return true @@ -595,7 +677,13 @@ } item.cols = getCols(item.cols) - item.statFields = statFields + + if (item.hasExtend) { + item.setting.hasExtend = true + item.setting.tableMode = 'compatible' + item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss') + item.colsCtrls = null + } if (item.subtype === 'editable') { item.submit.logLabel = item.$menuname + '-鎻愪氦' @@ -631,7 +719,7 @@ cell = this.resetElement(cell) } - return cell.eleType !== 'button' || pass || permAction[cell.uuid] + return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false' }) if (card.setting.click === 'menus') { @@ -673,7 +761,7 @@ cell = this.resetElement(cell) } - return cell.eleType !== 'button' || pass || permAction[cell.uuid] + return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false' }) }) } else if (item.type === 'balcony') { @@ -683,6 +771,9 @@ } else if (item.wrap.linkType === 'sup') { item.wrap.supModule = item.wrap.supModule.pop() item.setting.supModule = item.wrap.supModule + } + if (item.wrap.datatype === 'public') { + balMap.set(item.wrap.publicId + 'public', true) } item.elements = item.elements.filter(cell => { if (cell.eleType === 'button') { @@ -697,34 +788,25 @@ cell = this.resetElement(cell) } - return cell.eleType !== 'button' || pass || permAction[cell.uuid] + return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false' }) } else if (item.type === 'form') { + if (item.wrap.datatype === 'public') { + balMap.set(item.wrap.publicId + 'public', true) + } item.subcards = item.subcards.map(group => { group.subButton.uuid = group.uuid - group.subButton.$menuId = group.uuid - group.subButton.$MenuID = this.props.MenuID - // group.subButton.$forbid = true // 涓嶅0鏄庢暟鎹簮鍙橀噺 group.subButton.OpenType = 'formSubmit' group.subButton.execError = 'never' - group.subButton.logLabel = item.$menuname + '-' + group.subButton.label - if (!group.subButton.Ot) { group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' } - if (item.$cache && item.$time) { + group.subButton = this.resetButton(item, group.subButton) + + if (item.$cache && item.$time) { // 琛ㄥ崟缂撳瓨 group.$cache = item.$cache group.$time = item.$time - } - - group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' - - if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { - group.subButton.syncComponentId = '' - if (group.subButton.execSuccess === 'grid') { - group.subButton.execSuccess = 'mainline' - } } group.fields = group.fields.map(cell => { @@ -754,43 +836,91 @@ item.wrap.supModule = '' } } + + // 鏁寸悊鏁版嵁婧� + if (item.setting && item.format && (!item.wrap || !['public', 'static'].includes(item.wrap.datatype))) { + item.setting.arr_field = item.columns ? item.columns.map(col => col.field).join(',') : '' + item.setting.useMSearch = item.setting.useMSearch === 'true' + item.setting.laypage = item.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 + + if (item.wrap && item.wrap.goback === 'true') { + item.setting.sync = 'false' + } + + if (item.format === 'object') { + item.setting.laypage = false + item.setting.$top = true + } + + if (item.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 + item.setting.sync = 'false' + item.setting.dataresource = '' + } else { + let _customScript = '' + let _tailScript = '' + item.scripts && item.scripts.forEach(script => { + if (script.status === 'false') return + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } + }) + delete item.scripts + item.setting.$name = item.$menuname || '' + item.setting.execute = item.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 + + if (!item.setting.execute) { + item.setting.dataresource = '' + } + if (/\s/.test(item.setting.dataresource)) { + item.setting.dataresource = '(' + item.setting.dataresource + ') tb' + } - return true - }) - } + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + item.setting.dataresource = item.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + } else { + item.setting.dataresource = item.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + } - filterBalcony = (components, balMap) => { - return components.filter(item => { - if (item.type === 'tabs') { - item.subtabs = item.subtabs.map(tab => { - tab.components = this.filterBalcony(tab.components, balMap) - return tab - }) - } else if (item.type === 'group') { - item.components = this.filterBalcony(item.components, balMap) - } + regs.forEach(cell => { + item.setting.dataresource = item.setting.dataresource.replace(cell.reg, cell.value) + _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) + }) - if (item.type === 'balcony' && item.wrap.linkType === 'sync') { - let conf = balMap.get(item.wrap.syncModuleId) + item.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + item.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (!conf || conf === true) { - return false - } - - item.syncConfig = { - uuid: conf.uuid, - wrap: conf.wrap, - setting: conf.setting, - columns: conf.columns - } + item.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript) - if (item.wrap.checkAll === 'show') { - if (conf.subtype === 'datacard' && conf.wrap.cardType !== 'checkbox') { - item.wrap.checkAll = 'hidden' - } else if (conf.subtype === 'normaltable' && conf.wrap.tableType !== 'checkbox') { - item.wrap.checkAll = 'hidden' + if (!item.setting.execute || item.setting.custompage) { + item.forbidLine = true + } + + if (item.setting.sync === 'true') { + // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ + if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true') { + + } else { + item.setting.sync = 'false' + } } } + } + + if (item.type === 'card' && item.subtype === 'datacard') { + tbMap.set(item.uuid, item) + } else if (item.type === 'table' && item.subtype !== 'editable') { + tbMap.set(item.uuid, item) } return true @@ -806,6 +936,11 @@ cell.$MenuID = this.props.MenuID cell.$view = 'popview' + if (item.$process) { + cell.$process = true + cell.$flowId = 'flow' + this.props.MenuID + } + if (cell.btnstyle) { // 鍏煎 cell.style = cell.style || {} cell.style = {...cell.style, ...cell.btnstyle} @@ -820,27 +955,59 @@ } if (cell.OpenType === 'excelOut') { // 瀵煎嚭 - cell.$menuName = item.name - - if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) { - cell.errorType = 'error1' - } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') { - if (item.setting.interType !== 'system') { - cell.errorType = 'error2' - } else if (item.type === 'balcony' || item.subtype === 'propcard') { - cell.errorType = 'error2' - } - } + cell.$menuName = item.$menuname } else if (cell.OpenType === 'pop' && item.$cache && item.$time && cell.modal) { cell.modal.$cache = item.$cache cell.modal.$time = item.$time cell.modal.uuid = cell.uuid + 'pop' } + if (cell.verify) { + if (cell.verify.invalid === 'true') { + if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { + cell.verify.invalid = 'false' + } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { + cell.verify.invalid = 'false' + } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { + cell.verify.invalid = 'false' + } else if (cell.sqlType === 'insert') { + cell.verify.invalid = 'false' + } else if (cell.Ot === 'notRequired') { + cell.verify.invalid = 'false' + } + } + + if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { + cell.returnValue = 'true' + } + + if (cell.verify.preHandle === 'true') { + let script = cell.verify.pre_func + if (!/#position-/.test(script) || /#position-init/.test(script)) { + try { + // eslint-disable-next-line + let func = new Function('btn', 'position', 'systemType', script) + func(cell, 'init', window.GLOB.systemType) + } catch (e) { + console.warn(e) + } + } + if (/#position-inner/.test(script)) { + cell.$innerScript = script + } + if (/#position-outer/.test(script)) { + cell.$outerScript = script + } + if (/#position-callback/.test(script)) { + cell.$callbackScript = script + } + } + } + if (cell.syncComponentId) { if (cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' - if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { + if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) { cell.execSuccess = 'mainline' } } else if (cell.syncComponentId === 'multiComponent') { @@ -848,8 +1015,17 @@ return m.syncComId.pop() || '' }) - if (item.setting.supModule && ids.includes(item.setting.supModule)) { - if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { + if (item.supNodes) { + item.supNodes.forEach(node => { + if (!ids.includes(node)) return + + if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) { + cell.execSuccess = 'mainline' + } + ids = ids.filter(id => id !== node) + }) + } else if (item.setting.supModule && ids.includes(item.setting.supModule)) { + if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) { cell.execSuccess = 'mainline' } ids = ids.filter(id => id !== item.setting.supModule) @@ -868,6 +1044,26 @@ resetElement = (cell) => { cell.style = cell.style || {} + + if (cell.style.display === 'inline-block') { + cell.style.verticalAlign = 'top' + } + + if (cell.marks && cell.marks.length === 0) { + cell.marks = null + } + if (cell.anchors && cell.anchors.length === 0) { + cell.anchors = null + } + + if (cell.linkmenu && cell.linkmenu.length > 0) { + let menu_id = cell.linkmenu.pop() + cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' + if (!cell.linkThdMenu) { + cell.link = '' + } + } + if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { cell.innerHeight = 'auto' @@ -906,6 +1102,8 @@ getPrinter = (item, parentId) => { let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid) + item.verify.logLabel = item.logLabel + if (_item) { item.printer = _item.printer || '' item.verify.defaultPrinter = _item.printer || '' @@ -922,23 +1120,64 @@ } // 鏍煎紡鍖栭粯璁よ缃� - formatSetting = (components, params, inherit, regs, balMap) => { + formatSetting = (components, params, inherit, interfaces, balMap, tbMap) => { let delay = 20 return components.map(component => { if (component.type === 'tabs') { component.subtabs = component.subtabs.map(tab => { - tab.components = this.formatSetting(tab.components, null, inherit, regs, balMap) + tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap) tab = {...tab, ...inherit} return tab }) return component } else if (component.type === 'group') { - component.components = this.formatSetting(component.components, params, null, regs, balMap) + component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap) return component - } else if (component.wrap && component.wrap.datatype === 'public') { - component.setting.useMSearch = false - component.setting.sync = 'false' + } + if (component.type === 'balcony') { + if (component.wrap.linkType === 'sync') { + let conf = tbMap.get(component.wrap.syncModuleId) + + if (conf) { + component.syncConfig = { + uuid: conf.uuid, + wrap: conf.wrap, + setting: conf.setting, + columns: conf.columns + } + + if (component.wrap.checkAll === 'show') { + if (conf.subtype === 'datacard' && conf.wrap.cardType !== 'checkbox') { + component.wrap.checkAll = 'hidden' + } else if (conf.subtype === 'normaltable' && conf.wrap.tableType !== 'checkbox') { + component.wrap.checkAll = 'hidden' + } + } + } + } + } else if (balMap.has(component.uuid)) { + component.setting.$hasSyncModule = true + } + if (balMap.has(component.uuid + 'public')) { + component.$hasTopModule = true + } + + if (component.wrap && component.wrap.datatype === 'public') { + if (tbMap.has(component.wrap.publicId)) { + let tb = tbMap.get(component.wrap.publicId) + component.setting = {...tb.setting} + component.$searchId = tb.$searchId + component.wrap.publicId = component.wrap.publicId + 'tb' + } else { + let inter = interfaces.filter(int => component.wrap.publicId === int.uuid)[0] + if (!inter) { + component.wrap.datatype = 'static' + } else { + component.setting = {...inter.setting} + component.$searchId = inter.$searchId + } + } return component } else if (component.wrap && component.wrap.datatype === 'static') { component.format = '' @@ -951,81 +1190,21 @@ return component } - component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' - component.setting.useMSearch = component.setting.useMSearch === 'true' if (component.setting.useMSearch) { if (!window.GLOB.SearchBox.has(component.$searchId)) { component.setting.useMSearch = false - } else if (window.GLOB.SearchBox.has(component.$searchId + 'required')) { - component.$s_req = true - } - } - - if (component.wrap && component.wrap.goback === 'true') { - component.setting.sync = 'false' - } - - if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 - component.setting.sync = 'false' - component.setting.laypage = component.setting.laypage === 'true' - return component - } - - let _customScript = '' - let _tailScript = '' - component.scripts && component.scripts.forEach(script => { - if (script.status === 'false') return - if (script.position !== 'back') { - _customScript += ` - ${script.sql} - ` } else { - _tailScript += ` - ${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 缁熶竴鏍煎紡 - - if (!component.setting.execute) { - component.setting.dataresource = '' - } - if (/\s/.test(component.setting.dataresource)) { - component.setting.dataresource = '(' + component.setting.dataresource + ') tb' - } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - _tailScript = _tailScript.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) - _tailScript = _tailScript.replace(cell.reg, cell.value) - }) - - component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 - component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - - component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) - - if (component.setting.sync === 'true') { - // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ - if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') { - - } else { - component.setting.sync = 'false' + if (window.GLOB.SearchBox.has(component.$searchId + 'required')) { + component.$s_req = true + } + if (window.GLOB.SearchBox.has(component.$searchId + 'checkBid')) { + component.checkBid = true + component.setting.checkBid = true + } } } + + if (component.setting.interType !== 'system') return component // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О if (component.setting.sync === 'true') { @@ -1056,17 +1235,12 @@ component.setting.delay = delay delay += 20 - if (balMap.has(component.uuid)) { - component.setting.$hasSyncModule = true - balMap.set(component.uuid, component) - } - return component }) } // 鏍煎紡鍖栭粯璁よ缃� - formatInterSetting = (inters, regs, MenuID, initInters) => { + formatInterSetting = (inters, regs, MenuID, initInters, MenuName) => { if (!inters) return [] let initlimit = false @@ -1085,6 +1259,7 @@ return interfaces.map(inter => { inter.MenuID = MenuID inter.setting.delay = delay + inter.$searchId = MenuID delay += 15 if (inter.setting.supModule) { @@ -1095,11 +1270,14 @@ inter.setting.supModule = '' } } - + if (initlimit && inter.setting.loadlevel !== 'init') { inter.setting.onload = 'false' } + inter.setting.laypage = false + inter.setting.$top = true + inter.setting.useMSearch = inter.setting.useMSearch === 'true' inter.setting.arr_field = inter.columns.map(col => col.field).join(',') if (inter.setting.interType !== 'system') return inter @@ -1120,9 +1298,8 @@ }) delete inter.scripts - inter.setting.$name = '鍏叡鏁版嵁婧�-' + inter.setting.name + inter.setting.$name = (MenuName || '') + '-鍏叡鏁版嵁婧�-' + inter.setting.name inter.setting.execute = inter.setting.execute !== 'false' - inter.setting.laypage = true if (!inter.setting.execute) { inter.setting.dataresource = '' @@ -1150,7 +1327,7 @@ inter.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 inter.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - inter.setting.custompage = /@pageSize@|@orderBy@/i.test(inter.setting.dataresource + inter.setting.customScript) + inter.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(inter.setting.dataresource + inter.setting.customScript) return inter }) @@ -1214,6 +1391,10 @@ MKEmitter.emit('transferSyncData', MenuID) if (!result.message) return + + if (/灏嗘埅鏂瓧绗︿覆鎴栦簩杩涘埗鏁版嵁/ig.test(result.message)) { + result.message = result.message + '璇锋鏌ュ瓧娈甸泦' + } if (result.ErrCode === 'N') { Modal.error({ title: result.message, @@ -1483,9 +1664,7 @@ ) } else if (item.type === 'group' && item.subtype === 'normalgroup') { return ( - <Col span={item.width} style={style} key={item.uuid}> - <NormalGroup config={item}/> - </Col> + <NormalGroup config={item} style={style} key={item.uuid}/> ) } else if (item.type === 'editor') { return ( @@ -1541,6 +1720,12 @@ <Account config={item}/> </Col> ) + } else if (item.type === 'module' && item.subtype === 'invoice') { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <Invoice config={item}/> + </Col> + ) } else if (item.type === 'iframe') { return ( <Col span={item.width} style={style} key={item.uuid}> @@ -1556,15 +1741,29 @@ render() { const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state + if (!config || viewlost) { + return ( + <div className="custom-page-wrap"> + {loadingview ? <Spin className="view-spin" size="large" /> : null} + {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + <div className="user-tools"> + {config && config.process === 'true' ? <FlowFloat init={true} config={config}/> : null} + </div> + </div> + ) + } + return ( - <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''} ${config && config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}> - {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} - <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row> - {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} - {config && window.GLOB.breakpoint ? <DebugTable /> : null} - {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} - {!window.GLOB.mkHS && config ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} - {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + <div className={`custom-page-wrap ${config.minWidth ? 'mk-scroll' : ''} ${loading ? 'loading' : ''} ${config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config.style}> + {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null} + <Row id={'menu' + config.uuid} style={{minWidth: config.minWidth || 'unset'}} className="component-wrap">{this.getComponents()}</Row> + {config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} + {window.GLOB.breakpoint ? <DebugTable /> : null} + <div className="user-tools"> + {config.process === 'true' ? <FlowFloat config={config}/> : null} + <SettingComponent config={config} shortcuts={shortcuts || []}/> + <TableNodes config={config} /> + </div> </div> ) } -- Gitblit v1.8.0