后台表格meta

{
        "mkey": "bs-msg-chat",
        "field": "manager",
        "moulesShow": [
          "table",
          "action"
        ],
        "modulesHide": [
          "form"
        ],
        "position": "tab",
        "class": "el-icon-unlock",
        "menuClass": "nav-menu__all",
        "attrs": {
          "label": "消息管理"
        },
        "popup": {
          "component": "bs-table"
        },
        "tab": {
          "component": "bs-table"
        }
      }

后台表单meta

{
  "mkey": "bs-single-article",
  "field": "aboutus",
  "moulesShow": [
    "table",
    "action"
  ],
  "modulesHide": [
    "form"
  ],
  "position": "tab",
  "class": "el-icon-unlock",
  "menuClass": "nav-menu__all",
  "attrs": {
    "label": "关于我们"
  },
  "popup": {
    "component": "bs-form"
  },
  "tab": {
    "component": "bs-form"
  }
}

退出meta


{
        "position": "logout",
        "class": "el-icon-switch-button",
        "attrs": {
          "label": "退出"
        },
        "popup": {
          "component": "el-input"
        },
        "tab": {}
}

退出meta


{
        "position": "logout",
        "class": "el-icon-switch-button",
        "attrs": {
          "label": "不提示加载错误",
          "position":"empty"
        },
        "popup": {
          "component": "el-input"
        },
        "tab": {}
}

linkurl方式,规则详见request-link

1、 method:modal-dialog/replace-state/push-state/open/route/location/replace/bs-dialog

{
        "position": "logout",
        "class": "el-icon-switch-button",
        "url": "component、路由地址",
        "options":{
            "style": "border: none; width: 100%; height: calc(100vh - 5px)",
            "class": "bs-root-dialog-p0",
            "title": "标题",
            "method": "bs-dialog",
            "args": null,
            "params": {},
            "query": {
            "id": "814fc0b8063b4c3794de598d02ea07f2",
            "_k": "monitorInfo"
            }
        },
        "attrs": {
          "label": "退出"
        },
        "popup": {
          "component": "el-input"
        },
        "tab": {}
}

bo-ajax-html 远程html获取 {approot} {cdn}

1、remote-xpath详见query版本
https://www.cnblogs.com/Flylater/p/10438302.html

{
    "mkey": "bo-ajax-html",
    "field": "manager",
    "moulesShow": [
        "table",
        "action"
    ],
    "modulesHide": [
        "form"
    ],
    "position": "tab",
    "class": "el-icon-unlock",
    "menuClass": "nav-menu__all",
    "attrs": {
        "remote-url": "{approot}/page-components/icon-line.html",
        "remote-js": "{approot}/page-components/demo.js",
        "remote-xpath": "",
        "label": "我的收藏",
        "row-primary-key": "label"
    },
    "popup": {
        "component": "bo-ajax-html"
    },
    "tab": {
        "component": "bo-ajax-html"
    }
}

导航链接源码

let $mainNav = {
    handelChangeMenuRight(that, loginAuth, item, openInput = true) {

        // console.log(item);
        if (!item.meta) {
            that.$msgBox.warning("meta未配置。");
            return;
        }
        if (!item.meta.position) {
            that.$msgBox.warning("meta.position请配置logout/tab/popup/blank/self");
            return;
        }
        if (item.meta.position.includes("logout")) {
            if (!loginAuth.getUser().userId) {
                that.$msgBox.warning("未登录,不用退出。");
                return;
            }
            that.$confirm("退出账号吗?", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                })
                .then(() => {
                    loginAuth.logoutAuth();
                    that.$message({
                        type: "success",
                        message: "退出账号成功!",
                    });
                })
                .catch(() => {
                    that.$message({
                        type: "info",
                        message: "已取消退出账号",
                    });
                });
        } else if (item.meta.position === "popup") {
            if (!item.meta.popup ||
                !item.meta.attrs ||
                !item.meta.popup.component
            ) {
                that.$msgBox.warning(
                    "属性未配置(meta.popup||meta.attrs||meta.popup.component)"
                );
                return;
            }
            that.config.popup.title = item.name;
            that.config.popup.name = item.id;
            that.config.popup.drawer = true;


            if (item.meta.direction) {
                that.popup.direction = item.meta.direction;
            } else {
                that.popup.direction = "rtl";
            }
            that.popup.attrs = item.meta.attrs;
            // that.config.popup.title=item.meta.attrs.label;

            that.popup.meta = {
                popupClass: item.meta.popupClass,
                events: item.meta.events,
                primaryId: item.meta.primaryId || [],
                modulesShow: item.meta.modulesShow,
                modulesHide: item.meta.modulesHide,
                menuId: item.meta.menuId,
                mkey: item.meta.mkey,
                field: item.meta.field,
                auth: true,
                component: item.meta.popup.component,
            }; //item.meta.popup;

            if (item.meta.loginFrom && that.popup.meta) {
                that.popup.meta.loginFrom = item.meta.loginFrom;
            }

            //解决左侧加载后栏目消失
            if (openInput) {
                that.$emit("input", that.config);
            }

            that.$emit("on-change-popup", that.popup);
            // label: "用户管理",
            // name: "user",
            // attrs: {
            //   label: "测试"
            // },
            // meta: {
            //   auth: true,
            //   component: "el-button"
            // }
        } else if (item.meta.position === "tab") {
            that.$emit("on-change-tabs", item);
            // that.$emit("input", that.config);
            // that.config.popup.name = item.name;
        } else if (item.meta.position === "blank") {
            if (!item.meta.attrs.href) {
                that.$msgBox.warning("meta.attrs.href未配置为");
                return;
            }
            window.open(item.meta.attrs.href);
        } else if (item.meta.position === "self") {
            if (!item.meta.attrs.href) {
                that.$msgBox.warning("meta.attrs.href未配置为");
                return;
            }
            window.location.href = item.meta.attrs.href;
        } else if (item.meta.position === "link") {
            if (!item.meta.url) {
                that.$msgBox.warning("meta.attrs.url未配置为");
                return;
            }
            //method:modal-dialog/replace-state/push-state/open/route/location/replace/bs-dialog
            that.$link.toLinkUrl(item.meta.options, that, item.meta.options || {})
        }  else {
            that.$msgBox.warning("meta.position未配置为(popup||tab)");
        }
        //点击菜单后操作信息
    }
};
export default $mainNav;
文档更新时间: 2021-10-07 08:07   作者:admin