From a1e9b18a4dbfd21e1bf4d5cb60974ac2f0115efd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 30 五月 2025 15:18:44 +0800 Subject: [PATCH] 2025-05-30 --- src/tabviews/custom/index.jsx | 170 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 135 insertions(+), 35 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index b3f0872..36e091f 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -3,6 +3,7 @@ import { is, fromJS } from 'immutable' import { notification, Spin, Row, Col, Modal } from 'antd' import moment from 'moment' +import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -48,6 +49,7 @@ const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat')) const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes')) +const DeepSeek = asyncComponent(() => import('@/tabviews/zshare/deepseek')) const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces')) class CustomPage extends Component { @@ -68,7 +70,8 @@ loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� shortcuts: null, // 蹇嵎閿� - loadinginter: false + loadinginter: false, + noParam: false } stepInter = null @@ -78,10 +81,15 @@ */ async loadconfig () { const { MenuID, MenuName, param } = this.props + const { noParam } = this.state let _param = { func: 'sPC_Get_LongParam', MenuID: MenuID + } + + if (window.GLOB.mkHS) { + _param.lang = 'zh-CN' } let result = await Api.getCacheConfig(_param) @@ -208,16 +216,44 @@ let skip = config.permission === 'false' || window.GLOB.mkHS let urlparam = {} // url鍙傛暟 if (param) { - Object.keys(param).forEach(key => { - if (/^\$/.test(key)) { - urlparam[key] = param[key] - } else { - urlparam[key.toLowerCase()] = param[key] - } + if (!noParam) { + Object.keys(param).forEach(key => { + if (/^\$/.test(key)) { + urlparam[key] = param[key] + } else { + urlparam[key.toLowerCase()] = param[key] + } + }) + } else { + urlparam.$BID = param.$BID + } + } + + if (config.urlFields && config.urlFields.length) { + config.urlFields.forEach(field => { + let key = field.toLowerCase() + if (urlparam[key] !== undefined) return + + urlparam[key] = '' }) } window.GLOB.CacheData.set(MenuID, urlparam) + + if (window.backend && config.allSqls) { + let keys = Object.keys(urlparam) + config.allSqls.forEach(item => { + item.id = md5(window.GLOB.appkey + item.v_id) + if (['datasource', 'interface', 'excelOut'].includes(item.type)) { + item.urlkeys = keys + item.urlparam = urlparam + if (config.flow_code) { + item.works_flow_code = config.flow_code + } + } + window.GLOB.CacheData.set('sql_' + item.uuid, item) + }) + } let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' @@ -235,7 +271,7 @@ } if (config.urlFields) { config.urlFields.forEach(field => { - let val = `'${urlparam[field.toLowerCase()] || ''}'` + let val = `'${urlparam[field.toLowerCase()]}'` regs.push({ reg: new RegExp('@' + field + '@', 'ig'), value: val @@ -285,7 +321,7 @@ } }) - config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap) + config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap, BID) if (initInters.length > 0) { this.stepInter = { @@ -567,8 +603,9 @@ Utils.initSearchVal(item) if (urlparam.$searchkey) { + let reg = new RegExp('(^|,)' + urlparam.$searchkey + '($|,)', 'ig') item.search.forEach(cell => { - if (urlparam.$searchkey === cell.field.toLowerCase() && ['text', 'select', 'link', 'checkcard'].includes(cell.type)) { + if (reg.test(cell.field) && ['text', 'select', 'link', 'checkcard'].includes(cell.type)) { cell.initval = urlparam.$searchval } }) @@ -680,9 +717,16 @@ if (item.hasExtend) { item.setting.hasExtend = true + item.setting.sync = 'false' item.setting.tableMode = 'compatible' item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss') item.colsCtrls = null + } + + if (item.wrap.tree === 'true') { + item.setting.sync = 'false' + item.$cache = false + item.setting.$tree = true } if (item.subtype === 'editable') { @@ -698,6 +742,9 @@ } } } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { + if (item.wrap.datatype === 'public') { + balMap.set(item.wrap.publicId + 'public', true) + } item.subcards && item.subcards.forEach(card => { if (card.style.boxShadow) { delete card.style.hShadow @@ -804,6 +851,13 @@ group.subButton = this.resetButton(item, group.subButton) + if (group.subButton.linkmenu) { + if (Array.isArray(group.subButton.linkmenu) && group.subButton.linkmenu.length > 0) { + group.subButton.openmenu = group.subButton.linkmenu + } + delete group.subButton.linkmenu + } + if (item.$cache && item.$time) { // 琛ㄥ崟缂撳瓨 group.$cache = item.$cache group.$time = item.$time @@ -873,12 +927,9 @@ 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' } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 @@ -900,7 +951,17 @@ item.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 item.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - item.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript) + item.setting.custompage = false + + if (/order\s+by\s+sort_id\s*$/i.test(item.setting.dataresource)) { + item.setting.custompage = true + } else if (item.setting.$tree || /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript)) { + item.setting.custompage = true + } + + if (/\s/.test(item.setting.dataresource)) { + item.setting.dataresource = '(' + item.setting.dataresource + ') tb' + } if (!item.setting.execute || item.setting.custompage) { item.forbidLine = true @@ -908,7 +969,7 @@ if (item.setting.sync === 'true') { // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ - if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true') { + if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && !_tailScript) { } else { item.setting.sync = 'false' @@ -961,12 +1022,13 @@ cell.modal.$cache = item.$cache cell.modal.$time = item.$time } - cell.modal.uuid = cell.uuid + 'pop' + cell.modal.uuid = cell.uuid + '_pop' } if (cell.verify) { + let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') if (cell.verify.invalid === 'true') { - if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { + if (isStatic) { cell.verify.invalid = 'false' } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { cell.verify.invalid = 'false' @@ -977,6 +1039,9 @@ } else if (cell.Ot === 'notRequired') { cell.verify.invalid = 'false' } + } + if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) { + cell.verify.uniques = [] } if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { @@ -996,12 +1061,20 @@ } if (/#position-inner/.test(script)) { cell.$innerScript = script + + if (window.backend && window.GLOB.CacheData.has('sql_' + cell.uuid) && !/\$backend/.test(script)) { + window.GLOB.CacheData.delete('sql_' + cell.uuid) + } } if (/#position-outer/.test(script)) { cell.$outerScript = script } if (/#position-callback/.test(script)) { cell.$callbackScript = script + + if (window.backend && window.GLOB.CacheData.has('sql_back_' + cell.uuid) && !/\$backend/.test(script)) { + window.GLOB.CacheData.delete('sql_back_' + cell.uuid) + } } } } @@ -1014,6 +1087,7 @@ } } else if (cell.syncComponentId === 'multiComponent') { let ids = cell.syncComponents.map(m => { + if (Array.isArray(m)) return m.pop() || '' return m.syncComId.pop() || '' }) @@ -1122,18 +1196,18 @@ } // 鏍煎紡鍖栭粯璁よ缃� - formatSetting = (components, params, inherit, interfaces, balMap, tbMap) => { + formatSetting = (components, params, inherit, interfaces, balMap, tbMap, BID) => { 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, interfaces, balMap, tbMap) + tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap, BID) tab = {...tab, ...inherit} return tab }) return component } else if (component.type === 'group') { - component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap) + component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap, BID) return component } @@ -1208,6 +1282,8 @@ if (component.setting.interType !== 'system') return component + component.setting.uuid = component.uuid + // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О if (component.setting.sync === 'true') { component.dataName = 'mk' + component.uuid.slice(-18) @@ -1229,12 +1305,22 @@ component.setting.sync = 'false' component.setting.onload = 'false' } else { - params.push(getStructDefaultParam(component, searchlist, params.length === 0)) + let backend = false + if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + component.uuid)) { + backend = true + } else if (window.backend && params[0] && params[0].exps) { + backend = true + } + if (backend && !window.GLOB.CacheData.has('sql_' + component.uuid)) { + component.setting.sync = 'false' + } else { + params.push(getStructDefaultParam(component, searchlist, params.length === 0, BID)) + } } } } - component.setting.delay = delay + component.setting.delay = delay + (component.setting.delay || 0) delay += 20 return component @@ -1260,7 +1346,7 @@ let delay = 15 return interfaces.map(inter => { inter.MenuID = MenuID - inter.setting.delay = delay + inter.setting.delay = delay + (inter.setting.delay || 0) inter.$searchId = MenuID delay += 15 @@ -1284,6 +1370,8 @@ if (inter.setting.interType !== 'system') return inter + inter.setting.uuid = inter.uuid + let _customScript = '' let _tailScript = '' inter.scripts.forEach(script => { @@ -1306,9 +1394,6 @@ if (!inter.setting.execute) { inter.setting.dataresource = '' } - if (/\s/.test(inter.setting.dataresource)) { - inter.setting.dataresource = '(' + inter.setting.dataresource + ') tb' - } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 inter.setting.dataresource = inter.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') @@ -1328,8 +1413,17 @@ inter.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 inter.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� + inter.setting.custompage = false - inter.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(inter.setting.dataresource + inter.setting.customScript) + if (/order\s+by\s+sort_id\s*$/i.test(inter.setting.dataresource)) { + inter.setting.custompage = true + } else if (/@pageSize@|@orderBy@|@mk_total/i.test(inter.setting.dataresource + inter.setting.customScript)) { + inter.setting.custompage = true + } + + if (/\s/.test(inter.setting.dataresource)) { + inter.setting.dataresource = '(' + inter.setting.dataresource + ') tb' + } return inter }) @@ -1345,7 +1439,11 @@ this.setState({loading: true, loadingview: false}) if (config.$cache && config.$time) { - Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => { + let uuid = params[0].uuid || '' + if (params[0].id) { + uuid = window.GLOB.CacheData.get('first_' + params[0].id) || '' + } + Api.getLCacheConfig(uuid, config.$time, BID).then(res => { if (!res.valid) { this.getMainData(param, params, config.MenuID) } else { @@ -1381,11 +1479,11 @@ } params.forEach((item) => { - let _data = result[item.name] || '' + let _data = result[item.dataName] || '' if (_data && !Array.isArray(_data)) { _data = [_data] } - window.GLOB.SyncData.set(item.name, _data) + window.GLOB.SyncData.set(item.dataName, _data) }) MKEmitter.emit('transferSyncData', MenuID) @@ -1412,12 +1510,12 @@ }) } - reloadMenuView = (menuId) => { + reloadMenuView = (menuId, clear) => { const { MenuID } = this.props if (MenuID !== menuId) return - this.reloadview() + this.reloadview(clear) } resetActiveMenu = (menuId) => { @@ -1512,7 +1610,7 @@ }) } - reloadview = () => { + reloadview = (clear) => { window.GLOB.CacheData.delete(this.props.MenuID) if (this.state.config) { @@ -1530,7 +1628,8 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - shortcuts: null + shortcuts: null, + noParam: clear === true }, () => { this.loadconfig() }) @@ -1765,6 +1864,7 @@ {config.process === 'true' ? <FlowFloat config={config}/> : null} <SettingComponent config={config} shortcuts={shortcuts || []}/> <TableNodes config={config} /> + <DeepSeek/> </div> </div> ) -- Gitblit v1.8.0