|
@@ -268,3 +268,159 @@ async function getRoleProcess(roleid) {
|
|
|
list.map((si) => {
|
|
|
si.action = [];
|
|
|
if (si.child && si.child.length > 0) {
|
|
|
+ si.child.map((sii) => {
|
|
|
+ si.action.push(sii.order_process + "");
|
|
|
+ return sii;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return si;
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ pcode: code,
|
|
|
+ pdata: list,
|
|
|
+ pmsg: meaasge,
|
|
|
+ };
|
|
|
+}
|
|
|
+async function getRoleMenuList() {
|
|
|
+ const { code, data, meaasge } = await menuList({});
|
|
|
+ let arrag = [];
|
|
|
+ let btnList = [];
|
|
|
+ let list = [];
|
|
|
+ let isok = false;
|
|
|
+ if (code === 0) {
|
|
|
+ list = data ?? [];
|
|
|
+ list = list.filter((item) => item.child && item.child.length > 0);
|
|
|
+ list.forEach((v1) => {
|
|
|
+ const { menu_route, child } = v1;
|
|
|
+ if (menu_route === "bigScreen" && child.length) {
|
|
|
+ isok = true;
|
|
|
+ }
|
|
|
+ let pItem = {
|
|
|
+ name: v1.menu_route,
|
|
|
+ path: `/${v1.menu_route}`,
|
|
|
+ meta: {
|
|
|
+ title: v1.menu_name,
|
|
|
+ icon: v1.menu_img,
|
|
|
+ },
|
|
|
+ children: [],
|
|
|
+ };
|
|
|
+ v1.child.forEach((v2) => {
|
|
|
+ let item = {
|
|
|
+ path: v2.menu_route,
|
|
|
+ name: v2.menu_route,
|
|
|
+ hidden: parseInt(v2.is_display + "") === 0,
|
|
|
+ meta: {
|
|
|
+ title: v2.menu_name,
|
|
|
+ icon: v2.menu_img,
|
|
|
+ },
|
|
|
+ url: v2.menu_url,
|
|
|
+ };
|
|
|
+ let model = {
|
|
|
+ menu_route: v2.menu_route,
|
|
|
+ action: v2.action,
|
|
|
+ };
|
|
|
+ btnList.push(model);
|
|
|
+ pItem.children.push(item);
|
|
|
+ });
|
|
|
+ arrag.push(pItem);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ mcode: code,
|
|
|
+ mdata: {
|
|
|
+ isok,
|
|
|
+ arrag,
|
|
|
+ btnList,
|
|
|
+ },
|
|
|
+ mmsg: meaasge,
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+function initRouter(arr) {
|
|
|
+ const IndexRoute = [
|
|
|
+ // 个人信息
|
|
|
+ {
|
|
|
+ path: "/person",
|
|
|
+ component: () => import("@/layout/index"),
|
|
|
+ redirect: "/person/my-message",
|
|
|
+ hidden: true,
|
|
|
+ alwaysShow: true,
|
|
|
+ meta: {
|
|
|
+ title: "个人中心",
|
|
|
+ icon: "user",
|
|
|
+ },
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ path: "my-message",
|
|
|
+ component: () => import("@/views/person-infor/my-message"),
|
|
|
+ name: "MyMessage",
|
|
|
+ alwaysShow: true,
|
|
|
+ meta: { title: "我的信息", noCache: true, breadcrumb: true },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: "change-phone",
|
|
|
+ component: () => import("@/views/person-infor/change-phone"),
|
|
|
+ name: "ChangePhone",
|
|
|
+ alwaysShow: true,
|
|
|
+ meta: { title: "更换手机号", noCache: true, breadcrumb: true },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: "change-password",
|
|
|
+ component: () => import("@/views/person-infor/change-password"),
|
|
|
+ name: "ChangePassword",
|
|
|
+ alwaysShow: true,
|
|
|
+ meta: { title: "修改密码", noCache: true, breadcrumb: true },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ //欢迎页
|
|
|
+ {
|
|
|
+ path: "/welcome",
|
|
|
+ component: () => import("@/layout/index"),
|
|
|
+ redirect: "/welcome/dashboard",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ path: "dashboard",
|
|
|
+ component: () => import("@/views/dashboard/index"),
|
|
|
+ name: "Dashboard",
|
|
|
+ meta: { title: "首页", icon: "dashboard", affix: true },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ arr.map((v1) => {
|
|
|
+ v1.component = (resolve) => require([`@/layout/index.vue`], resolve);
|
|
|
+ if (v1.children && v1.children.length > 0) {
|
|
|
+ v1.redirect = `/${v1.name}/${v1.children[0].name}`;
|
|
|
+ v1.children.map((v2) => {
|
|
|
+ v2.component = (resolve) => require([`@/views/${v2.url}.vue`], resolve);
|
|
|
+ return v2;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return v1;
|
|
|
+ });
|
|
|
+ IndexRoute.push(...arr);
|
|
|
+ IndexRoute.push({
|
|
|
+ path: "404",
|
|
|
+ component: () => import("@/views/error-page/404"),
|
|
|
+ hidden: false,
|
|
|
+ noCache: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ IndexRoute.push({
|
|
|
+ path: "*",
|
|
|
+ redirect: "/404",
|
|
|
+ });
|
|
|
+ window.vm.$router.addRoutes(IndexRoute);
|
|
|
+}
|
|
|
+
|
|
|
+initalUserInfo();
|
|
|
+
|
|
|
+export default {
|
|
|
+ namespaced: true,
|
|
|
+ state,
|
|
|
+ mutations,
|
|
|
+ actions,
|
|
|
+};
|