From f0bf8c399c354c22227f8f1a76ed806098db59c0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 21 五月 2024 16:51:02 +0800 Subject: [PATCH] 2024-05-21 --- src/tabviews/custom/index.jsx | 151 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 103 insertions(+), 48 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 983d3c3..b56749d 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,6 +42,7 @@ 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')) @@ -75,7 +77,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { MenuID, MenuName } = this.props + const { MenuID, MenuName, param } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -181,8 +183,8 @@ 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) }) } @@ -203,9 +205,18 @@ let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID let balMap = 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') || '' @@ -223,7 +234,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 @@ -250,10 +261,10 @@ let initInters = [] config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters, config.MenuName) - 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.process === 'true') + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, urlparam, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true') let params = [] - let BID = param.$BID || '' + let BID = urlparam.$BID || '' let inherit = {} if (config.cacheUseful === 'true') { // 缂撳瓨缁ф壙 @@ -265,18 +276,6 @@ // 瀛楁閫忚 config.components.forEach(component => { if (component.type !== 'search') return - - if (param.$searchkey) { - component.search = component.search.map(item => { - if (['text', 'select', 'link', 'checkcard'].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) @@ -461,12 +460,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 @@ -479,12 +473,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 = '' @@ -565,8 +554,14 @@ item.type = 'card' } - 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') { @@ -574,13 +569,33 @@ } 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) + } + } } let pass = skip @@ -602,7 +617,7 @@ cell = this.getPrinter(cell, item.uuid) } - return pass || permAction[cell.uuid] + return pass || permAction[cell.uuid] || cell.permission === 'false' }) } @@ -617,7 +632,10 @@ col.type = 'custom' } - if (col.type === 'number') { + 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') { @@ -644,7 +662,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) } @@ -672,6 +690,13 @@ } item.cols = getCols(item.cols) + + 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 + '-鎻愪氦' @@ -707,7 +732,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') { @@ -749,7 +774,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') { @@ -773,7 +798,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 === 'form') { item.subcards = item.subcards.map(group => { @@ -945,7 +970,7 @@ 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') { @@ -953,8 +978,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) @@ -980,6 +1014,17 @@ 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)) { @@ -1071,8 +1116,14 @@ 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 + } else { + 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 + } } } @@ -1613,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 ( @@ -1671,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}> -- Gitblit v1.8.0