xiaodai2022 2 anni fa
parent
commit
69d875d2ea
31 ha cambiato i file con 422 aggiunte e 224 eliminazioni
  1. 2 2
      src/apis/aoldAxios.js
  2. 12 13
      src/apis/aoldService/user/index.js
  3. 0 4
      src/apis/axios.js
  4. 12 13
      src/apis/caixiaoService/user/index.js
  5. 32 36
      src/apis/testAxios.js
  6. 5 4
      src/apis/url-config.js
  7. 81 0
      src/apis/user/aoldAxios.js
  8. 28 21
      src/apis/user/index.js
  9. 5 2
      src/config/env.development.js
  10. 2 2
      src/layout/components/AppMain.vue
  11. 84 27
      src/layout/components/Navbar.vue
  12. 1 1
      src/layout/index.vue
  13. 41 29
      src/router/index.js
  14. 1 1
      src/settings.js
  15. 64 33
      src/store/modules/user.js
  16. 21 6
      src/utils/auth.js
  17. 1 1
      src/views/aold/purchase/orderRecord/components/InvoiceReview.vue
  18. 1 1
      src/views/aold/purchase/orderRecord/components/addEdit1.vue
  19. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit2.vue
  20. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit21.vue
  21. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit22.vue
  22. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit23.vue
  23. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit3.vue
  24. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit4.vue
  25. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit5.vue
  26. 3 3
      src/views/aold/purchase/orderRecord/components/addEdit6.vue
  27. 1 1
      src/views/aold/purchase/orderRecord/components/proofreading.vue
  28. 1 1
      src/views/aold/purchase/orderRecord/index.vue
  29. 1 1
      src/views/aold/system/menuOperator/addEdit.vue
  30. 1 1
      src/views/aold/system/menuOperator/index.vue
  31. 1 0
      src/views/login/index.vue

+ 2 - 2
src/apis/aoldAxios.js

@@ -18,10 +18,11 @@ export default async (
   onUploadProgress
 ) => {
   type = type.toLowerCase()
+
   const obj = {
     method: type,
     baseURL: '',
-    url: urlConfig.testURL + url,
+    url: urlConfig.aoldBaseURL + url,
     data,
     params,
     // // `onUploadProgress` 允许为上传处理进度事件
@@ -84,7 +85,6 @@ export default async (
   return new Promise((resolve, reject) => {
     axios(obj)
       .then(response => {
-        // console.log(response)
         resolve(response.data)
       })
       .catch(res => {

+ 12 - 13
src/apis/aoldService/user/index.js

@@ -1,22 +1,21 @@
-import http from '@/apis/aoldAxios'
+import http from "@/apis/aoldAxios";
 
 export default {
   // 获取验证码
-  verfiy: (data, params) => http(`Api/verify_code`, data, 'post', params),
+  verfiy: (data, params) => http(`Api/verify_code`, data, "post", params),
   // 密码重置
-  resetpwd: (data, params) => http(`Api/passmobile`, data, 'post', params),
+  resetpwd: (data, params) => http(`Api/passmobile`, data, "post", params),
   // 手机号更换
-  resetmobile: (data, params) =>
-    http(`Api/resetmobile`, data, 'post', params),
+  resetmobile: (data, params) => http(`Api/resetmobile`, data, "post", params),
   // 密码修改
-  setpwd: (data, params) => http(`Api/passsave`, data, 'post', params),
+  setpwd: (data, params) => http(`Api/passsave`, data, "post", params),
   // 获取导航列表
-  list: (data, params) => http(`admin/menu`, data, 'post', params),
+  list: (data, params) => http(`admin/menu`, data, "post", params),
   // 获取个人信息
-  detail: (data, params) => http(`Admin/userinfo`, data, 'post', params),
+  detail: (data, params) => http(`Admin/userinfo`, data, "post", params),
   // 获取最新版本号
-  version: (data, params) => http(`Admin/lastversion`, data, 'post', params),
-   // 个人信息完善
-   prefect: (data, params) => http(`Api/prefect`, data, 'post', params),
-  
-}
+  version: (data, params) => http(`Admin/lastversion`, data, "post", params),
+  // 个人信息完善
+  prefect: (data, params) => http(`Api/prefect`, data, "post", params),
+
+};

+ 0 - 4
src/apis/axios.js

@@ -1,6 +1,3 @@
-// import axios from 'axios'
-import Router from '@/router/index'
-// import store from '@/store'
 import urlConfig from '@/apis/url-config'
 import {
   getToken, removeMenu,
@@ -87,7 +84,6 @@ export default async (
   return new Promise((resolve, reject) => {
     axios(obj)
       .then(response => {
-        // console.log(response)
         resolve(response.data)
       })
       .catch(res => {

+ 12 - 13
src/apis/caixiaoService/user/index.js

@@ -1,22 +1,21 @@
-import http from '@/apis/axios'
+import http from "@/apis/axios";
 
 export default {
   // 获取验证码
-  verfiy: (data, params) => http(`Api/verify_code`, data, 'post', params),
+  verfiy: (data, params) => http(`Api/verify_code`, data, "post", params),
   // 密码重置
-  resetpwd: (data, params) => http(`Api/passmobile`, data, 'post', params),
+  resetpwd: (data, params) => http(`Api/passmobile`, data, "post", params),
   // 手机号更换
-  resetmobile: (data, params) =>
-    http(`Api/resetmobile`, data, 'post', params),
+  resetmobile: (data, params) => http(`Api/resetmobile`, data, "post", params),
   // 密码修改
-  setpwd: (data, params) => http(`Api/passsave`, data, 'post', params),
+  setpwd: (data, params) => http(`Api/passsave`, data, "post", params),
   // 获取导航列表
-  list: (data, params) => http(`admin/menu`, data, 'post', params),
+  list: (data, params) => http(`admin/menu`, data, "post", params),
   // 获取个人信息
-  detail: (data, params) => http(`Admin/userinfo`, data, 'post', params),
+  detail: (data, params) => http(`Admin/userinfo`, data, "post", params),
   // 获取最新版本号
-  version: (data, params) => http(`Admin/lastversion`, data, 'post', params),
-   // 个人信息完善
-   prefect: (data, params) => http(`Api/prefect`, data, 'post', params),
-  
-}
+  version: (data, params) => http(`Admin/lastversion`, data, "post", params),
+  // 个人信息完善
+  prefect: (data, params) => http(`Api/prefect`, data, "post", params),
+
+};

+ 32 - 36
src/apis/testAxios.js

@@ -1,26 +1,23 @@
-import urlConfig from '@/apis/url-config'
-import {
-  getToken, removeMenu,
-  removeBtn, removeToken
-} from '@/utils/auth'
+import urlConfig from "@/apis/url-config";
+import { getToken, removeMenu, removeBtn, removeToken } from "@/utils/auth";
 const header = {
   // "X-Requested-With": "XMLHttpRequest",
   // "X-Frame-Options": "DENY", // 告诉浏览器不要(DENY)把这个网页放在iFrame内,通常的目的就是要帮助用户对抗点击劫持。
   // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
-}
-window.ajaxTimeout = 20000
+};
+window.ajaxTimeout = 20000;
 export default async (
-  url = '',
+  url = "",
   data = {},
-  type = 'GET',
+  type = "GET",
   params = {},
   headers = header,
   onUploadProgress
 ) => {
-  type = type.toLowerCase()
+  type = type.toLowerCase();
   const obj = {
     method: type,
-    baseURL: '',
+    baseURL: "",
     url: urlConfig.testURL + url,
     data,
     params,
@@ -39,10 +36,10 @@ export default async (
     processData: true, // 告诉axios不要去处理发送的数据(重要参数)
     timeout: window.ajaxTimeout,
     headers,
-    onUploadProgress
-  }
-  if (onUploadProgress && typeof onUploadProgress === 'function') {
-    obj.onUploadProgress = onUploadProgress
+    onUploadProgress,
+  };
+  if (onUploadProgress && typeof onUploadProgress === "function") {
+    obj.onUploadProgress = onUploadProgress;
   }
   // return await axios(obj)
   //   .then(response => {
@@ -53,46 +50,45 @@ export default async (
   //   });
   // 请求拦截器
   axios.interceptors.request.use(
-    config => {
+    (config) => {
       if (!config.data.token) {
-        config.data.token = getToken()
+        config.data.token = getToken();
       }
-      return config
+      return config;
     },
-    error => {
+    (error) => {
       // 错误抛到业务代码
-      return Promise.reject(new Error('服务器异常,请联系管理员!'))
+      return Promise.reject(new Error("服务器异常,请联系管理员!"));
     }
-  )
+  );
   // 添加响应拦截器
   axios.interceptors.response.use(
-    async response => {
+    async (response) => {
       if (response.status === 200) {
-        const code = response.data.code
+        const code = response.data.code;
         if (code >= 100 && code <= 104) {
-          removeToken()
-          removeMenu()
-          removeBtn()
+          removeToken();
+          removeMenu();
+          removeBtn();
         }
       }
-      return response
+      return response;
     },
-    error => {
-      return Promise.reject(error.response.data)
+    (error) => {
+      return Promise.reject(error.response.data);
     }
-  )
+  );
   return new Promise((resolve, reject) => {
     axios(obj)
-      .then(response => {
-        // console.log(response)
-        resolve(response.data)
+      .then((response) => {
+        resolve(response.data);
       })
-      .catch(res => {
+      .catch((res) => {
         if (res.response && res.response.data) {
           reject(res.response.data);
         } else {
           reject(res);
         }
       });
-  })
-}
+  });
+};

+ 5 - 4
src/apis/url-config.js

@@ -1,13 +1,14 @@
 import { api, ding } from "@/config";
+const { baseApi, testApi, aoldBaseApi } = api;
 export default {
   //后端接口url
-  baseURL: api.baseApi,
-  testURL: api.testApi,
-  aoldBaseURL: api.aoldBaseApi,
+  baseURL: baseApi,
+  testURL: testApi,
+  aoldBaseURL: aoldBaseApi,
   //企业id
   corpId: ding.CorpId,
   //应用凭证
   agentId: ding.AgentId,
- 
+
   // tableURL: api.tableApi,
 };

+ 81 - 0
src/apis/user/aoldAxios.js

@@ -0,0 +1,81 @@
+// import axios from 'axios'
+// import Router from '@/router/index'
+// import store from '@/store'
+import urlConfig from '@/apis/url-config'
+import {
+  getToken, removeMenu,
+  removeBtn, removeToken
+} from '@/utils/auth'
+const header = {
+  // "X-Requested-With": "XMLHttpRequest",
+  // "X-Frame-Options": "DENY", // 告诉浏览器不要(DENY)把这个网页放在iFrame内,通常的目的就是要帮助用户对抗点击劫持。
+  // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
+}
+window.ajaxTimeout = 20000
+export default async (
+  url = '',
+  data = {},
+  type = 'GET',
+  params = {},
+  headers = header,
+  onUploadProgress
+) => {
+  type = url.method.toLowerCase()
+  const obj = {
+    method: type,
+    baseURL: '',
+    url: urlConfig.aoldBaseURL + url.url,
+    data: url.data,
+    params,
+    // // `onUploadProgress` 允许为上传处理进度事件
+    // onUploadProgress: function(progressEvent) {
+    //   // 对原生进度事件的处理
+    // },
+    // // `onDownloadProgress` 允许为下载处理进度事件
+    // onDownloadProgress: function(progressEvent) {
+    //   // 对原生进度事件的处理
+    // },
+    // `cancelToken` 指定用于取消请求的 cancel token
+    // (查看后面的 Cancellation 这节了解更多)
+    // cancelToken: new CancelToken(function (cancel) {
+    // }),
+    processData: true, // 告诉axios不要去处理发送的数据(重要参数)
+    timeout: window.ajaxTimeout,
+    headers,
+    onUploadProgress
+  }
+  if (onUploadProgress && typeof onUploadProgress === 'function') {
+    obj.onUploadProgress = onUploadProgress
+  }
+  // 请求拦截器
+  axios.interceptors.request.use(
+    config => {
+      if (!config.data.token) {
+        config.data.token = getToken()
+      }
+      return config
+    },
+    error => {
+      // 错误抛到业务代码
+      return Promise.reject(new Error('服务器异常,请联系管理员!'))
+    }
+  )
+  // 添加响应拦截器
+  axios.interceptors.response.use(
+    async response => {
+      return response
+    },
+    error => {
+      return Promise.reject(error.response.data)
+    }
+  )
+  return new Promise((resolve, reject) => {
+    axios(obj)
+      .then(response => {
+        resolve(response.data)
+      })
+      .catch(res => {
+        reject(res)
+      })
+  })
+}

+ 28 - 21
src/apis/user/index.js

@@ -1,38 +1,45 @@
-import http from '@/apis/user/axios'
+import http from "@/apis/user/axios";
+import aoldHttp from "@/apis/user/aoldAxios";
 // import http from "@/apis/axios";
 // 登录
 export function login(data) {
   return http({
     url: `Api/login`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 // 获取个人信息
 export function userinfo(data) {
   return http({
     url: `Api/userinfo`,
-    method: 'post',
-    data
-  })
-}
-// 获取导航列表
-export function menuList(data) {
-  console.log(data)
-  return http({
-    url: `Admin/menu`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
+
 // 钉钉获取用户信息
 export function dingdingdetail(data) {
   return http({
     url: `Api/dintalk`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 
-
-
+// 获取菜单列表
+export function caixiaoMenuList(data) {
+  return http({
+    url: `Admin/menu`,
+    method: "post",
+    data,
+  });
+}
+// 获取菜单列表
+export function aoldMenuList(data) {
+  return aoldHttp({
+    url: `Admin/menu`,
+    method: "post",
+    data,
+  });
+}

+ 5 - 2
src/config/env.development.js

@@ -3,9 +3,12 @@ module.exports = {
   title: '采销平台结算系统',
   baseUrl: 'http://localhost:8080',
   api: {
-    baseApi: "http://caixiao.sitw.wanyuhengtong.com/",//采销结算无测试接口域名
+    // baseApi: "http://caixiao.sitw.wanyuhengtong.com/",//采销结算无测试接口域名
+    // testApi: "http://inv.test241.wanyuhengtong.com/",
+    // aoldBaseApi: "http://cxinv.test241.wanyuhengtong.com/",
+    baseApi: "http://caixiao.sitw.wanyuhengtong.com/",
     testApi: "http://inv.test241.wanyuhengtong.com/",
-    aoldBaseApi: "http://cxinv.test241.wanyuhengtong.com/",
+    aoldBaseApi: "http://inv.sitw.wanyuhengtong.com/",
   },
   fileURL: `https://api2.edusit.zretchome.com`,
   appId: 'wx5ac3a2c2d72b6f26',

+ 2 - 2
src/layout/components/AppMain.vue

@@ -34,7 +34,7 @@ export default {
 }
 
 .fixed-header + .app-main {
-  padding: 110px 0 0 0;
+  padding: 52px 0 0 0;
 }
 
 .hasTagsView {
@@ -44,7 +44,7 @@ export default {
   }
 
   .fixed-header + .app-main {
-    padding: 84px 0 0 0;
+    padding: 52px 0 0 0;
   }
 }
 </style>

+ 84 - 27
src/layout/components/Navbar.vue

@@ -9,9 +9,8 @@
 
     <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
 
-    <div class="right-menu">
+    <div class="right-menu fr">
       <template v-if="device !== 'mobile'">
-
         <i
           v-if="isShow"
           class="el-icon-message-solid right-menu-item hover-effect shake"
@@ -25,10 +24,7 @@
         </el-tooltip> -->
       </template>
 
-      <el-dropdown
-        class="avatar-container right-menu-item hover-effect"
-        trigger="click"
-      >
+      <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
         <div class="avatar-wrapper">
           <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" />
           <i class="el-icon-caret-bottom" />
@@ -49,6 +45,22 @@
         </el-dropdown-menu>
       </el-dropdown>
     </div>
+    <el-select
+      class="fr right-menu-item"
+      v-model:value="companyNo"
+      :size="'mini'"
+      style="width: 200px; margin: 12px 16px 0 0"
+      @change="business_companyNo_change"
+      placeholder="系统名称"
+    >
+      <el-option
+        v-for="(item, index) in companyList"
+        :key="item.value + index"
+        :label="item.label"
+        :value="item.value"
+      >
+      </el-option>
+    </el-select>
 
     <el-dialog
       title="系统公告"
@@ -92,9 +104,7 @@
                 >
                 <el-col :span="activeMsg.sys_type === 'VER' ? 12 : 24">
                   <el-form-item
-                    :label="
-                      activeMsg.sys_type === 'VER' ? '更新时间:' : '预计时间:'
-                    "
+                    :label="activeMsg.sys_type === 'VER' ? '更新时间:' : '预计时间:'"
                   >
                     <p style="margin: 0">
                       {{ activeMsg.addtime }}
@@ -103,21 +113,13 @@
                 >
                 <el-col :span="24"
                   ><el-form-item label="更新内容:">
-                    <p
-                      style="margin: 0"
-                      v-html="activeMsg.system"
-                    ></p></el-form-item
+                    <p style="margin: 0" v-html="activeMsg.system"></p></el-form-item
                 ></el-col>
                 <el-col :span="24" style="text-align: right">
-                  <el-checkbox
-                    v-model="checked"
-                    class="fl"
-                    style="padding-top: 5px"
+                  <el-checkbox v-model="checked" class="fl" style="padding-top: 5px"
                     >我已知晓,后续不再提示!</el-checkbox
                   >
-                  <el-button @click="submit" type="primary" plain
-                    >关闭
-                  </el-button>
+                  <el-button @click="submit" type="primary" plain>关闭 </el-button>
                 </el-col>
               </el-row>
             </el-form>
@@ -136,7 +138,7 @@ import Screenfull from "@/components/Screenfull";
 import SizeSelect from "@/components/SizeSelect";
 import asyncRequest from "@/apis/caixiaoService/system/updates";
 import resToken from "@/mixins/resToken";
-import { getNotice, setNotice } from "@/utils/auth";
+import { getNotice, setNotice, get_business_companyNo } from "@/utils/auth";
 
 export default {
   components: {
@@ -151,6 +153,17 @@ export default {
   mixins: [resToken],
   data() {
     return {
+      companyNo: "",
+      companyList: [
+        {
+          value: "1",
+          label: "采销平台结算",
+        },
+        {
+          value: "2",
+          label: "516结算",
+        },
+      ],
       showModel: false,
       loading: false,
       isShow: true,
@@ -167,9 +180,56 @@ export default {
     };
   },
   mounted() {
+    this.companyNo = get_business_companyNo() || "";
     this.openNotice(1);
   },
+
   methods: {
+    business_companyNo_change(e) {
+      this.$store.dispatch("user/change_company", e).then((res) => {
+        this.getMenu();
+      });
+    },
+    getMenu() {
+      this.$store
+        .dispatch("user/getMenuList", this)
+        .then((res) => {
+          console.log(res);
+          const path = this.$route.path;
+          console.log(path);
+          let index = -1;
+          let path2 = "";
+          // /aold
+          // /caixiao
+          // aoldInvoiceSales/clients
+
+          if (path === "/loadingPage" || path === "/" || path === "/login") {
+            window.vm.$router.replace("/welcome");
+            return;
+          }
+          if (this.companyNo === "1") {
+            this.routerReplace("/aold", "/caixiao");
+            return;
+          }
+          if (this.companyNo === "2") {
+            this.routerReplace("/caixiao", "/aold");
+            return;
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    routerReplace(str1, str2) {
+      const path = this.$route.path;
+      let index = -1;
+      let path2 = "";
+      index = path.search(str1);
+      if (index !== -1) {
+        path2 = path.replace(str1, str2);
+        window.vm.$router.replace(path2);
+      }
+    },
     async openNotice(type) {
       if (getNotice() && getNotice().length > 0) {
         this.lastNotice = JSON.parse(getNotice());
@@ -234,11 +294,7 @@ export default {
         //   nowtime < this.endTime,
         //   !this.checked
         // );
-        if (
-          nowtime > this.statsTime &&
-          nowtime < this.endTime &&
-          !this.checked
-        ) {
+        if (nowtime > this.statsTime && nowtime < this.endTime && !this.checked) {
           this.showModel = true;
         } else {
           this.showModel = false;
@@ -320,7 +376,8 @@ export default {
 
   .breadcrumb-container {
     float: left;
-    min-width: calc(1200px - 200px - 150px);
+    width: 350px;
+    // min-width: calc(1200px - 200px - 150px);
   }
 
   .errLog-container {

+ 1 - 1
src/layout/index.vue

@@ -9,7 +9,7 @@
     <div :class="{ hasTagsView: needTagsView }" class="main-container">
       <div :class="{ 'fixed-header': fixedHeader }">
         <navbar />
-        <tags-view v-if="needTagsView" />
+        <!-- <tags-view v-if="needTagsView" /> -->
       </div>
       <app-main />
       <!-- <right-panel v-if="showSettings">

+ 41 - 29
src/router/index.js

@@ -1,42 +1,54 @@
 const Router = VueRouter;
+import Layout from "@/layout";
 const routes = [
-    //默认跳转到登录页
-    {
-        path: "/",
-        redirect: "/loadingPage"
-    },
-      //loading
-      {
-        path: '/loadingPage',
-        component: () => import('@/views/loadingPage/index'),
-        hidden: true
-    },
-    //登录页
-    {
-        path: '/login',
-        component: () => import('@/views/login/index'),
-        hidden: true
-    },
-    //忘记密码
-    {
-        path: '/forget-password',
-        component: () => import('@/views/login/forget-password'),
-        hidden: true,
-        noCache: true
-    },
+  //默认跳转到登录页
+  {
+    path: "/",
+    redirect: "/loadingPage",
+  },
+  //loading
+  {
+    path: "/loadingPage",
+    component: () => import("@/views/loadingPage/index"),
+    hidden: true,
+  },
+  //登录页
+  {
+    path: "/login",
+    component: () => import("@/views/login/index"),
+    hidden: true,
+  },
+  //忘记密码
+  {
+    path: "/forget-password",
+    component: () => import("@/views/login/forget-password"),
+    hidden: true,
+    noCache: true,
+  },
+
+  {
+    path: "/404",
+    component: () => import("@/views/error-page/404"),
+    hidden: false,
+    noCache: true,
+  },
+  {
+    path: "*",
+    redirect: "/404",
+  },
 ];
 console.log(process.env.BASE_URL);
 const router = new Router({
-    mode: "hash",
-    base: process.env.BASE_URL,
-    scrollBehavior: () => ({ y: 0 }),
-    routes
+  mode: "hash",
+  base: process.env.BASE_URL,
+  scrollBehavior: () => ({ y: 0 }),
+  routes,
 });
 
 // 重写路由的push方法,主要是为了解决同一个路由路径重复点击报错
 const routerPush = Router.prototype.push;
 Router.prototype.push = function push(location) {
-    return routerPush.call(this, location).catch(error => error);
+  return routerPush.call(this, location).catch((error) => error);
 };
 Vue.use(Router);
 export default router;

+ 1 - 1
src/settings.js

@@ -10,7 +10,7 @@ module.exports = {
    * @type {boolean} true | false
    * @description Whether need tagsView
    */
-  tagsView: true,
+  tagsView: false,
 
   /**
    * @type {boolean} true | false

+ 64 - 33
src/store/modules/user.js

@@ -1,4 +1,11 @@
-import { login, logout, userinfo, menuList, dingdingdetail } from "@/apis/user";
+import {
+  login,
+  logout,
+  userinfo,
+  dingdingdetail,
+  aoldMenuList,
+  caixiaoMenuList,
+} from "@/apis/user";
 import {
   getToken,
   setToken,
@@ -12,6 +19,9 @@ import {
   getBtn,
   setBtn,
   removeBtn,
+  get_business_companyNo,
+  set_business_companyNo,
+  remove_business_companyNo,
 } from "@/utils/auth";
 
 const state = {
@@ -23,14 +33,25 @@ const state = {
   roles: ["admin"],
   btnList: getBtn(),
   navList: getMenu(),
+  business_companyNo: get_business_companyNo() || "",
 };
 
 const mutations = {
   SET_TOKEN: (state, token) => {
     state.token = token;
+    if (token === "") {
+      removeToken();
+    } else {
+      setToken(token);
+    }
   },
   SET_USER_ID: (state, userid) => {
     state.userid = userid;
+    if (userid === "") {
+      removeUserId();
+    } else {
+      setUserId(userid);
+    }
   },
   SET_MENU: (state, menu) => {
     state.menu = menu;
@@ -64,9 +85,23 @@ const mutations = {
     state.btnList = val;
     setBtn(val);
   },
+  business_companyNo(state, val) {
+    state.business_companyNo = val;
+    if (val === "") {
+      remove_business_companyNo();
+    } else {
+      set_business_companyNo(val);
+    }
+  },
 };
 
 const actions = {
+  change_company({ commit }, supplierNo) {
+    return new Promise((resolve, reject) => {
+      commit("business_companyNo", supplierNo);
+      resolve("ok");
+    });
+  },
   // user login
   login({ commit }, userInfo) {
     const { username, password } = userInfo;
@@ -77,11 +112,9 @@ const actions = {
           if (code === 0) {
             const { token, userinfo } = data;
             const { id } = userinfo;
-            console.log(id);
             commit("SET_TOKEN", token);
             commit("SET_USER_ID", id);
-            setUserId(id);
-            setToken(token);
+            commit("business_companyNo", "1");
           }
           resolve(response);
         })
@@ -97,13 +130,10 @@ const actions = {
         .then((response) => {
           const { code, data } = response;
           if (code === 0) {
-            // alert(JSON.stringify(data))
             const { token, id } = data;
-            // const { id } = userinfo;
             commit("SET_TOKEN", token);
-            setToken(token);
             commit("SET_USER_ID", id);
-            setUserId(id);
+            commit("business_companyNo", "1");
             resolve("success");
           } else {
             resolve("error");
@@ -119,17 +149,28 @@ const actions = {
       if (!getToken()) {
         resolve("noToken");
       } else {
-        let res = await menuList({});
-        if (res.code === 0) {
-          let list = res.data;
+        let res = {};
+        const { business_companyNo } = state;
+        if (business_companyNo === "1") {
+          res = await caixiaoMenuList({});
+        } else if (business_companyNo === "2") {
+          res = await aoldMenuList({});
+        } else {
+          res = { code: 0, data: [], massage: "" };
+        }
+
+        const { code, data } = res;
+        if (code === 0) {
+          let list = data;
           list = list.filter((item) => item.child && item.child.length > 0);
           let arrag = [];
           let btnList = [];
-          console.log(list);
           list.forEach((v1) => {
             let pItem = {
               name: v1.menu_route,
-              path: `/${v1.menu_route}`,
+              path: `/${business_companyNo === "1" ? "caixiao" : "aold"}${
+                v1.menu_route
+              }`,
               meta: {
                 title: v1.menu_name,
                 icon: v1.menu_img,
@@ -155,17 +196,14 @@ const actions = {
             });
             arrag.push(pItem);
           });
-          console.log(arrag);
-
           // 生成页面权限
           commit("navListFn", arrag);
           // 生成按钮权限
           commit("btnListFn", btnList);
           // 生成路由
           initRouter(arrag, that);
-          // state.commit("loginInfoCommit", res.data);
           resolve("success");
-        } else if (res.code === 101 || res.code === 102) {
+        } else if (code === 101 || code === 102) {
           resolve("noToken");
         } else {
           resolve(res);
@@ -180,11 +218,9 @@ const actions = {
       commit("SET_TOKEN", "");
       commit("SET_USER_ID", "");
       commit("SET_ROLES", []);
-      removeToken();
-      removeUserId();
       commit("SET_MENU", "");
       commit("SET_HAS", "");
-
+      commit("business_companyNo", "");
       removeMenu();
       removeBtn();
       // reset visited views and cached views
@@ -200,7 +236,7 @@ const actions = {
       commit("SET_TOKEN", "");
       commit("SET_USER_ID", "");
       commit("SET_ROLES", []);
-      removeToken();
+
       removeUserId();
       resolve();
     });
@@ -259,30 +295,25 @@ function initRouter(arr) {
       ],
     },
   ];
-
+  const { business_companyNo } = state;
   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/caixiao/${v2.url}.vue`], resolve);
+        v2.component = (resolve) =>
+          require([
+            `@/views/${business_companyNo === "1" ? "caixiao" : "aold"}/${
+              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);
 }
 

+ 21 - 6
src/utils/auth.js

@@ -1,14 +1,15 @@
 import Cookies from "js-cookie";
+const key = "Purchase-Console-";
 
-const TokenKey = "Purchase-Console-Token";
-const MenuKey = "Purchase-Console-Menu";
-const BtnKey = "Purchase-Console-MenuBtn";
-const NoticeKey = "Purchase-Console-Notice";
-const UserIdKey = "Purchase-Console-UserId";
+const TokenKey = `${key}oken`;
+const MenuKey = `${key}Menu`;
+const BtnKey = `${key}MenuBtn`;
+const NoticeKey = `${key}Notice`;
+const UserIdKey = `${key}UserId`;
+const businessCompanyNoKey = `${key}businessCompanyNo`;
 export function getToken() {
   return Cookies.get(TokenKey);
 }
-
 export function setToken(token) {
   return Cookies.set(TokenKey, token);
 }
@@ -68,3 +69,17 @@ export function setNotice(has) {
 export function removeNotice() {
   return Cookies.remove(NoticeKey);
 }
+
+
+export function get_business_companyNo() {
+  return Cookies.get(businessCompanyNoKey);
+}
+
+export function set_business_companyNo(has) {
+  return Cookies.set(businessCompanyNoKey, has);
+}
+
+export function remove_business_companyNo() {
+  return Cookies.remove(businessCompanyNoKey);
+}
+

+ 1 - 1
src/views/aold/purchase/orderRecord/components/InvoiceReview.vue

@@ -349,7 +349,7 @@
 </template>
 <script>
 import asyncRequest from "@/apis/aoldService/purchase/orderRecord";
-import InvoiceHead from "@/views/purchase/orderRecord/components/InvoiceHead";
+import InvoiceHead from "@/views/aold/purchase/orderRecord/components/InvoiceHead";
 import resToken from "@/mixins/resToken";
 export default {
   name: "orderRecord",

+ 1 - 1
src/views/aold/purchase/orderRecord/components/addEdit1.vue

@@ -38,7 +38,7 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
 export default {
   name: "orderRecord",
   props: [

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit2.vue

@@ -45,9 +45,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import examView from "@/views/purchase/orderRecord/components/examView";
-import stepBar from "@/views/purchase/orderRecord/components/stepBar";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import examView from "@/views/aold/purchase/orderRecord/components/examView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/stepBar";
 export default {
   name: "orderRecord",
   props: ["showModel", "id", "isDetail", "dstatus", "payNo","companyNo"],

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit21.vue

@@ -46,9 +46,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import examView from "@/views/purchase/orderRecord/components/payExamView";
-import stepBar from "@/views/purchase/orderRecord/components/payStepBar";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import examView from "@/views/aold/purchase/orderRecord/components/payExamView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/payStepBar";
 export default {
   name: "orderRecord",
   props: ["showModel", "id", "isDetail", "dstatus", "payNo","companyNo"],

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit22.vue

@@ -46,9 +46,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import examView from "@/views/purchase/orderRecord/components/payExamView";
-import stepBar from "@/views/purchase/orderRecord/components/payStepBar";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import examView from "@/views/aold/purchase/orderRecord/components/payExamView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/payStepBar";
 export default {
   name: "orderRecord",
   props: ["showModel", "id", "isDetail", "dstatus", "payNo","companyNo"],

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit23.vue

@@ -45,9 +45,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import stepBar from "@/views/purchase/orderRecord/components/payStepBar";
-import receipt from "@/views/purchase/orderRecord/components/receipt";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/payStepBar";
+import receipt from "@/views/aold/purchase/orderRecord/components/receipt";
 
 export default {
   name: "orderRecord",

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit3.vue

@@ -43,9 +43,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import feedbackView from "@/views/purchase/orderRecord/components/feedbackView";
-import stepBar from "@/views/purchase/orderRecord/components/stepBar";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import feedbackView from "@/views/aold/purchase/orderRecord/components/feedbackView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/stepBar";
 
 export default {
   name: "orderRecord",

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit4.vue

@@ -44,9 +44,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import InvoiceUpload from "@/views/purchase/orderRecord/components/InvoiceUpload";
-import stepBar from "@/views/purchase/orderRecord/components/stepBar";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import InvoiceUpload from "@/views/aold/purchase/orderRecord/components/InvoiceUpload";
+import stepBar from "@/views/aold/purchase/orderRecord/components/stepBar";
 export default {
   name: "orderRecord",
   props: ["showModel", "id", "isDetail", "dstatus", "payNo","companyNo"],

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit5.vue

@@ -46,9 +46,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import stepBar from "@/views/purchase/orderRecord/components/stepBar";
-import proofreading from "@/views/purchase/orderRecord/components/proofreading";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/stepBar";
+import proofreading from "@/views/aold/purchase/orderRecord/components/proofreading";
 
 export default {
   name: "orderRecord",

+ 3 - 3
src/views/aold/purchase/orderRecord/components/addEdit6.vue

@@ -46,9 +46,9 @@
   </el-dialog>
 </template>
 <script>
-import addView from "@/views/purchase/orderRecord/components/addView";
-import stepBar from "@/views/purchase/orderRecord/components/stepBar";
-import InvoiceReview from "@/views/purchase/orderRecord/components/InvoiceReview";
+import addView from "@/views/aold/purchase/orderRecord/components/addView";
+import stepBar from "@/views/aold/purchase/orderRecord/components/stepBar";
+import InvoiceReview from "@/views/aold/purchase/orderRecord/components/InvoiceReview";
 
 export default {
   name: "orderRecord",

+ 1 - 1
src/views/aold/purchase/orderRecord/components/proofreading.vue

@@ -193,7 +193,7 @@
 </template>
 <script>
 import asyncRequest from "@/apis/aoldService/purchase/orderRecord";
-import InvoiceHead from "@/views/purchase/orderRecord/components/InvoiceHead";
+import InvoiceHead from "@/views/aold/purchase/orderRecord/components/InvoiceHead";
 import resToken from "@/mixins/resToken";
 export default {
   name: "orderRecord",

+ 1 - 1
src/views/aold/purchase/orderRecord/index.vue

@@ -560,7 +560,7 @@ import addEdit6 from "./components/addEdit6"; //人工审核发票
 import addEdit21 from "./components/addEdit21"; //付款业务审核
 import addEdit22 from "./components/addEdit22"; //付款财务审核
 import addEdit23 from "./components/addEdit23"; //付款回执
-import AddEdit4 from "@/views/InvoiceSales/invoiceApply/addEdit4.vue";
+import AddEdit4 from "@/views/aold/InvoiceSales/invoiceApply/addEdit4.vue";
 export default {
   name: "orderRecord",
   mixins: [mixinPage, resToken],

+ 1 - 1
src/views/aold/system/menuOperator/addEdit.vue

@@ -140,7 +140,7 @@
 <script>
 import asyncRequest from "@/apis/aoldService/system/menu";
 import btnList from "@/assets/js/btnList";
-import iconDialog from "@/views/system/menuOperator/iconDialog";
+import iconDialog from "@/views/aold/system/menuOperator/iconDialog";
 import resToken from "@/mixins/resToken";
 export default {
   components: {

+ 1 - 1
src/views/aold/system/menuOperator/index.vue

@@ -64,7 +64,7 @@
 <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import asyncRequest from "@/apis/aoldService/system/menu";
-import addEdit from "@/views/system/menuOperator/addEdit";
+import addEdit from "@/views/aold/system/menuOperator/addEdit";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
 export default {

+ 1 - 0
src/views/login/index.vue

@@ -236,6 +236,7 @@ export default {
           this.$store
             .dispatch("user/login", this.loginForm)
             .then((res) => {
+              console.log(res);
               if (res.code === 0) {
                 // this.$router.push({
                 //   path: this.redirect || "/",