| | |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(params.param))) |
| | | |
| | | sessionStorage.setItem('dataM', param.dataM || '') |
| | | let urlParam = {...param} |
| | | |
| | | delete urlParam.tempId |
| | | delete urlParam.pageId |
| | | delete urlParam.dataM |
| | | |
| | | Object.keys(urlParam).forEach(key => { |
| | | if (key === key.toLowerCase()) return |
| | | urlParam[key.toLowerCase()] = urlParam[key] |
| | | delete urlParam[key] |
| | | }) |
| | | |
| | | this.setState({ |
| | | BID: param.id || '', |
| | | tempId: param.tempId, |
| | | urlParam: param, |
| | | urlParam: urlParam, |
| | | pageId: param.pageId || '' |
| | | }, () => { |
| | | setTimeout(() => { |
| | |
| | | |
| | | config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type)) |
| | | |
| | | let urlparam = urlParam ? {...urlParam} : {} |
| | | if (config.urlFields && config.urlFields.length) { |
| | | config.urlFields.forEach(field => { |
| | | let key = field.toLowerCase() |
| | | if (urlparam[key] !== undefined) return |
| | | urlparam[key] = '' |
| | | }) |
| | | } |
| | | |
| | | if (window.backend && config.allSqls) { |
| | | let urlparam = urlParam || {} |
| | | let keys = Object.keys(urlparam) |
| | | config.allSqls.forEach(item => { |
| | | item.id = md5(window.GLOB.appkey + item.v_id) |
| | |
| | | |
| | | if (config.urlFields) { |
| | | config.urlFields.forEach(field => { |
| | | let val = `'${urlParam ? (urlParam[field] || '') : ''}'` |
| | | let val = `'${urlparam[field.toLowerCase()]}'` |
| | | regs.push({ |
| | | reg: new RegExp('@' + field + '@', 'ig'), |
| | | value: val |
| | |
| | | params.unshift(_pars) |
| | | } else if (window.backend && config.allSqls && params.length > 0) { |
| | | let data = [] |
| | | let ids = [] |
| | | params = params.filter(item => { |
| | | if (!item.$backend || item.public) return true |
| | | |
| | | ids.push(item.componentId) |
| | | item.data[0].exps.forEach(cell => { |
| | | if (cell.key === 'mk_obj_name') { |
| | | cell.value = 'mk' + item.componentId.slice(-18) |
| | |
| | | $backend: true, |
| | | $type: 's_Get_TableData', |
| | | componentId: '', |
| | | componentIds: ids, |
| | | data |
| | | }) |
| | | } |
| | |
| | | |
| | | if (params.length === 0 && initInters.length === 0) { |
| | | this.setState({loadingview: false, pages: [config.components]}) |
| | | |
| | | this.autoExec() |
| | | } else if (initInters.length > 0) { |
| | | this.loadinit(initInters, params) |
| | | } else { |
| | |
| | | Promise.all(deffers).then(() => { |
| | | if (params.length === 0) { |
| | | this.setState({loadingview: false, pages: [this.state.config.components]}) |
| | | |
| | | this.autoExec() |
| | | } else { |
| | | this.loadmaindata(params) |
| | | } |
| | |
| | | |
| | | let deffers = params.map(item => { |
| | | let componentId = item.componentId |
| | | let ids = item.componentIds |
| | | delete item.componentId |
| | | delete item.componentIds |
| | | delete item.public |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(item).then(res => { |
| | |
| | | }) |
| | | } |
| | | resolve(false) |
| | | } else if (ids) { |
| | | ids.forEach(id => { |
| | | let _id = 'mk' + id.slice(-18) |
| | | |
| | | if (res[_id]) { |
| | | let _data = { $$empty: true } |
| | | if (res[_id][0]) { |
| | | _data = res[_id][0] |
| | | } |
| | | window.GLOB.CacheData.set(id, _data) |
| | | } |
| | | }) |
| | | |
| | | resolve(res) |
| | | } else { |
| | | res.componentId = componentId |
| | | |
| | |
| | | }) |
| | | |
| | | this.setState({loadingview: false, pages, rePos}) |
| | | |
| | | this.autoExec() |
| | | }) |
| | | } |
| | | |
| | | autoExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.autoExec !== 'true') return |
| | | |
| | | setTimeout(() => { |
| | | this.print() |
| | | }, config.autoExecSplit || 500) |
| | | } |
| | | |
| | | reloadTabs = () => { |
| | | if (this.reloading) return |
| | | |