| | |
| | | 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' |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { Tab } = this.props |
| | | const { Tab, param } = this.props |
| | | |
| | | let config = Tab.config || '' |
| | | |
| | |
| | | config = JSON.stringify(config) |
| | | config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl) |
| | | config = JSON.parse(config) |
| | | config.MenuName = Tab.logLabel || Tab.label || '' |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | |
| | | // 权限过滤 |
| | | let roleId = sessionStorage.getItem('role_id') || '' // 角色ID |
| | | let balMap = new Map() |
| | | let param = this.props.param || {} // url参数 |
| | | let tbMap = new Map() |
| | | 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(Tab.uuid, param) |
| | | window.GLOB.CacheData.set(Tab.uuid, urlparam) |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | |
| | | |
| | | if (Tab.$process && window.GLOB.UserCacheMap.has(Tab.$flowId)) { |
| | | let flow = window.GLOB.UserCacheMap.get(Tab.$flowId) |
| | | regs.push({ reg: /@works_flow_code@/ig, value: flow.flow_code || '' }) |
| | | regs.push({ reg: /@works_flow_code@/ig, value: `'${flow.flow_code || ''}'` }) |
| | | } |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid) |
| | | config.components = this.filterComponent(config.components, roleId, balMap, tbMap, urlparam, Tab, Tab.uuid, Tab.uuid, regs) |
| | | |
| | | // 获取主搜索条件 |
| | | 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(Tab.uuid, component.$searches) |
| | | |
| | |
| | | }) |
| | | |
| | | let params = [] |
| | | let BID = param.$BID || '' |
| | | let BID = urlparam.$BID || '' |
| | | |
| | | config.components = this.formatSetting(config.components, params, regs, balMap) |
| | | |
| | | if ([...balMap.keys()].length > 0) { |
| | | config.components = this.filterBalcony(config.components, balMap) |
| | | } |
| | | config.components = this.formatSetting(config.components, params, balMap, tbMap, BID) |
| | | |
| | | this.setState({ |
| | | BID: BID, |
| | |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab, searchId, syncId) => { |
| | | filterComponent = (components, roleId, balMap, tbMap, urlparam, Tab, searchId, syncId, regs) => { |
| | | return components.filter(item => { |
| | | item.$pageId = Tab.uuid |
| | | item.$searchId = searchId |
| | |
| | | delete item.style.shadowColor |
| | | } |
| | | |
| | | item.$menuname = (Tab.label || '') + '-' + (item.name || '') |
| | | item.$menuname = (Tab.logLabel || Tab.label || '') + '-' + (item.name || '') |
| | | |
| | | if (item.type === 'tabs') { |
| | | if ( |
| | |
| | | } |
| | | } |
| | | |
| | | tab.$menuname = (Tab.logLabel || Tab.label || '') + '-' + (tab.label || '') |
| | | |
| | | return true |
| | | }) |
| | | |
| | |
| | | |
| | | 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 |
| | |
| | | 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 = '' |
| | | |
| | |
| | | _searchId = tab.uuid |
| | | } |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, _searchId, tab.uuid) |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, tbMap, urlparam, Tab, _searchId, tab.uuid, regs) |
| | | |
| | | if (_searchId === tab.uuid) { |
| | | tab.components.forEach(cell => { |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, searchId, syncId) |
| | | item.components = this.filterComponent(item.components, roleId, balMap, tbMap, urlparam, Tab, searchId, syncId, regs) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 搜索条件初始化 |
| | | 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') { // 数据卡、table多上级组件 |
| | | 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') { |
| | |
| | | } else { |
| | | item.setting.supModule = '' |
| | | } |
| | | } |
| | | |
| | | // 搜索条件初始化 |
| | | if (item.search) { |
| | | Utils.initSearchVal(item) |
| | | |
| | | item.$searches = Utils.initMainSearch(item.search) |
| | | } |
| | | |
| | | // 权限过滤 |
| | |
| | | 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') { |
| | |
| | | col.linkThdMenu = '' |
| | | } |
| | | |
| | | if (col.marks && col.marks.length === 0) { |
| | | col.marks = null |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | |
| | | 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') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | |
| | | } |
| | | } |
| | | } 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 |
| | |
| | | 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') { |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | |
| | | return true |
| | | }) |
| | | } 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 = Tab.$MenuID |
| | | group.subButton.OpenType = 'formSubmit' |
| | | group.subButton.execError = 'never' |
| | | group.subButton.logLabel = item.$menuname + '-' + group.subButton.label |
| | | group.subButton.$tabId = Tab.uuid |
| | | |
| | | if (!group.subButton.Ot) { |
| | | group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' |
| | | } |
| | | |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' |
| | | group.subButton = this.resetButton(item, group.subButton, Tab) |
| | | |
| | | if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { |
| | | group.subButton.syncComponentId = '' |
| | | if (group.subButton.execSuccess === 'grid') { |
| | | group.subButton.execSuccess = 'mainline' |
| | | 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 |
| | | } |
| | | |
| | | group.fields = group.fields.map(cell => { |
| | |
| | | return group |
| | | }) |
| | | } |
| | | |
| | | // 整理数据源 |
| | | 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' // 是否分页,转为boolean 统一格式 |
| | | |
| | | 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是否执行,转为boolean 统一格式 |
| | | |
| | | if (!item.setting.execute) { |
| | | item.setting.dataresource = '' |
| | | } |
| | | |
| | | 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 // 后置自定义脚本 |
| | | item.setting.custompage = false |
| | | |
| | | if (!conf || conf === true) { |
| | | return false |
| | | } |
| | | |
| | | item.syncConfig = { |
| | | uuid: conf.uuid, |
| | | wrap: conf.wrap, |
| | | setting: conf.setting, |
| | | columns: conf.columns |
| | | } |
| | | 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 (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 (/\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' && !_tailScript) { |
| | | |
| | | } 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 |
| | |
| | | } |
| | | |
| | | if (cell.OpenType === 'excelOut') { // 导出 |
| | | cell.$menuName = item.name |
| | | cell.$menuName = item.$menuname |
| | | } else if (cell.OpenType === 'pop' && cell.modal) { |
| | | cell.modal.uuid = cell.uuid + '_pop' |
| | | } |
| | | |
| | | 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' |
| | | if (cell.verify) { |
| | | let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') |
| | | if (cell.verify.invalid === 'true') { |
| | | if (isStatic) { |
| | | 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.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) { |
| | | cell.verify.uniques = [] |
| | | } |
| | | |
| | | 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 (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) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | if (Array.isArray(m)) return m.pop() || '' |
| | | 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) |
| | |
| | | |
| | | 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)) { |
| | |
| | | return cell |
| | | } |
| | | |
| | | 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 |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, regs, balMap) => { |
| | | formatSetting = (components, params, 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, regs, balMap) |
| | | tab.components = this.formatSetting(tab.components, null, balMap, tbMap, BID) |
| | | return tab |
| | | }) |
| | | return component |
| | | } else if (component.type === 'group') { |
| | | component.components = this.formatSetting(component.components, params, regs, balMap) |
| | | component.components = this.formatSetting(component.components, params, balMap, tbMap, BID) |
| | | 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 { |
| | | component.wrap.datatype = 'static' |
| | | component.setting = component.setting || {} |
| | | component.setting.useMSearch = false |
| | | component.setting.sync = 'false' |
| | | } |
| | | return component |
| | | } else if (component.wrap && component.wrap.datatype === 'static') { |
| | | component.format = '' |
| | | component.setting = component.setting || {} |
| | | component.setting.useMSearch = false |
| | | component.setting.useMSearch = component.wrap.useMSearch === 'true' |
| | | component.setting.sync = 'false' |
| | | |
| | | return component |
| | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | if (component.setting.interType !== 'system') { // 不使用系统函数时 |
| | | component.setting.sync = 'false' |
| | | component.setting.laypage = component.setting.laypage === 'true' |
| | | return component |
| | | } |
| | | if (component.setting.interType !== 'system') 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是否执行,转为boolean 统一格式 |
| | | component.setting.laypage = component.setting.laypage === 'true' // 是否分页,转为boolean 统一格式 |
| | | |
| | | 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.execute || component.setting.custompage) { |
| | | component.forbidLine = true |
| | | } |
| | | |
| | | if (component.setting.sync === 'true') { |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') { |
| | | |
| | | } else { |
| | | component.setting.sync = 'false' |
| | | } |
| | | } |
| | | |
| | | 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)) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | component.setting.delay = delay |
| | | component.setting.delay = delay + (component.setting.delay || 0) |
| | | delay += 20 |
| | | |
| | | if (balMap.has(component.uuid)) { |
| | | component.setting.$hasSyncModule = true |
| | | balMap.set(component.uuid, component) |
| | | } |
| | | |
| | | return component |
| | | }) |
| | |
| | | } |
| | | |
| | | 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', Tab.uuid) |
| | |
| | | MKEmitter.emit('transferSyncData', Tab.uuid) |
| | | |
| | | if (!result.message) return |
| | | |
| | | if (/将截断字符串或二进制数据/ig.test(result.message)) { |
| | | result.message = result.message + '请检查字段集' |
| | | } |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | ) |
| | | } 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 ( |