| | |
| | | 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' |
| | |
| | | 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 { |
| | |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 标签页控制 |
| | | shortcuts: null, // 快捷键 |
| | | loadinginter: false |
| | | loadinginter: false, |
| | | noParam: false |
| | | } |
| | | |
| | | stepInter = null |
| | |
| | | */ |
| | | 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) |
| | |
| | | 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') || '' |
| | |
| | | } |
| | | 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 |
| | |
| | | } |
| | | }) |
| | | |
| | | 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 = { |
| | |
| | | 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 |
| | | } |
| | | }) |
| | |
| | | |
| | | 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') { |
| | |
| | | } |
| | | } |
| | | } 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 |
| | |
| | | |
| | | 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 |
| | |
| | | delete item.scripts |
| | | item.setting.$name = item.$menuname || '' |
| | | item.setting.execute = item.setting.execute !== 'false' // 默认sql是否执行,转为boolean 统一格式 |
| | | |
| | | |
| | | 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') { // 数据权限 |
| | |
| | | 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 |
| | |
| | | |
| | | 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' |
| | |
| | | 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' |
| | |
| | | } 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)) { |
| | |
| | | } |
| | | 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) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | if (Array.isArray(m)) return m.pop() || '' |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | 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 |
| | | } |
| | | |
| | |
| | | |
| | | 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) |
| | |
| | | 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)) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (inter.setting.interType !== 'system') return inter |
| | | |
| | | inter.setting.uuid = inter.uuid |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | inter.scripts.forEach(script => { |
| | |
| | | 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\'') |
| | |
| | | |
| | | 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 |
| | | }) |
| | |
| | | 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 { |
| | |
| | | } |
| | | |
| | | 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) |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | reloadMenuView = (menuId, clear) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | this.reloadview(clear) |
| | | } |
| | | |
| | | resetActiveMenu = (menuId) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadview = () => { |
| | | reloadview = (clear) => { |
| | | window.GLOB.CacheData.delete(this.props.MenuID) |
| | | |
| | | if (this.state.config) { |
| | |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | config: null, // 页面配置信息,包括组件等 |
| | | loading: false, // 列表数据加载中 |
| | | shortcuts: null |
| | | shortcuts: null, |
| | | noParam: clear === true |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | |
| | | {config.process === 'true' ? <FlowFloat config={config}/> : null} |
| | | <SettingComponent config={config} shortcuts={shortcuts || []}/> |
| | | <TableNodes config={config} /> |
| | | <DeepSeek/> |
| | | </div> |
| | | </div> |
| | | ) |