08335 / hivui-platform-template
hivui平台项目模板
Newer
Older
hivui-platform-template / project / hivuiBirt / components / Birt / WorkBook / mixins / pages.js

import { $CONST } from "@birt/funclib/ConstUtil";

export default {
    data() {
        return {
        };
    },
    computed: {
        // 请求token凭证
        token() {
            if (!this.conf.token) {
                console.error("未取到token值,请检查是否登录成功.");
            }
            return this.conf.token;
        },
        // 注入动态加载报表模型方法
        birtModelMethod() {
            return this.conf.birtModelMethod;
        }
    },
    methods: {
        isRenderPages() {
            return [$CONST.PAGES, $CONST.PRINTVIEW, $CONST.DETAIL].indexOf(this.renderType) !== -1;
        },
        // 判断页面是否只读
        isPageReadOnly() {
            let birtPage = this.birtPage();
            if (birtPage) {
                return birtPage.freadonly;
            }
            return false;
        },
        // 返回顶级页面容器对象
        birtPage() {
            let parent = this.$parent;
            while (parent) {
                if (parent.$options.name === 'birt-page') {
                    return parent;
                } else if (parent.conf && (parent.conf.controlName == "BirtWorkBook")) {
                    if (parent.birtPage) {
                        return parent.birtPage();
                    } else if (parent.getWorkBook) {
                        let wb = parent.getWorkBook();
                        return wb && wb.birtPage();
                    }
                } else {
                    parent = parent.$parent;
                }
            }
        }
    }
}