/** * 报表页面容器,页面类型上下文 */ import { $CONST } from "@birt/funclib/ConstUtil"; export default { data() { return { policys: [] }; }, computed: { // 功能或流程模型路径 modelPath() { // return this.birtModel.modelPath || this.$route.path; return this.birtModel.modelPath || ''; } }, methods: { // 页面初始化加载流程、功能上下文 _initPage() { let mPath = this.modelPath; let mFilePaths = this._getModelFilePaths(); if (this.isFlow()) { this._initFlowContext(); this._requestFlowDatasetPolicy(mPath, mFilePaths); } }, // 获取 birtModel报表模型下,所有数据集模型路径集合 _getModelFilePaths() { let mfs = []; let sheets = this.birtModel.children || []; sheets.forEach(sht => { let dataSets = sht.dataSets || []; dataSets.forEach(ds => { mfs.push(ds.modelFilePath); }) }) return mfs; }, // 设置页面参数 _setParam(param) { this.param = param; }, // 设置数据集策略 setPolicys(policys) { if (policys) { policys.forEach(plc => { let modelFile = plc.modelFile; let dsInsc = this._getStore(modelFile); if (dsInsc) { dsInsc.setPolicy(plc); } }) } }, // 获取数据集策略 getPolicys() { return policys; }, // 设置保存成功后页面上下文 setSaveResponse(response) { let outP = response[$CONST.OUTPARAMETER] || {}; let ftaskguid = outP[$CONST.FTASKGUID]; let forderguid = outP[$CONST.FORDERGUID]; if (ftaskguid && forderguid) { this.setTaskGuid(ftaskguid); this.setOrderGuid(forderguid); } }, // 根据地地下推打开目标功能 openByPath(path, query, { title, target } = {}) { query = query || {}; let queryT = {} Object.assign(queryT, query || {}); if (title) queryT.__title = title; if (target) { target = target === '_blank' ? (new Date()).valueOf() : target queryT.__target = target; } // this.$router.push({ // path, // query: queryT // }) }, } }