Browse Source

Merge branch 'feature/Feature-sales' into develop

莫绍宝 3 năm trước cách đây
mục cha
commit
4670ab304a

+ 9 - 20
src/layout/components/Sidebar/SidebarItem.vue

@@ -1,23 +1,8 @@
 <template>
   <div v-if="!item.hidden">
     <!-- <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren) && !item.alwaysShow"> -->
-    <template 
-      v-if="hasOneShowingChild(item.children,item) && 
-        (
-          !onlyOneChild.children ||
-          onlyOneChild.noShowingChildren || 
-          (
-            onlyOneChild.children && 
-            onlyOneChild.children.length < 1 && 
-            (
-              onlyOneChild.name == 'issue_index' || 
-              onlyOneChild.name == 'notice_index' || 
-              onlyOneChild.name == 'dashboard'
-            )
-          )
-        ) && 
-        !item.alwaysShow">
-      <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
+    <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren || (onlyOneChild.children && onlyOneChild.children.length < 1 && (onlyOneChild.name == 'issue_index' || onlyOneChild.name == 'notice_index' || onlyOneChild.name == 'dashboard'))) && !item.alwaysShow">
+      <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path ,onlyOneChild)">
         <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
           <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
         </el-menu-item>
@@ -28,6 +13,7 @@
       <template slot="title">
         <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
       </template>
+
       <sidebar-item
         v-for="child in item.children"
         :key="child.path"
@@ -36,6 +22,7 @@
         :base-path="resolvePath(child.path)"
         class="nest-menu"
       />
+
     </el-submenu>
   </div>
 </template>
@@ -79,12 +66,12 @@ export default {
           return false
         } else {
           // Temp set(will be used if only has one showing child)
-          
+
           // 删除空的children
           if(item.children.length < 1) {
             // delete item['children']
           }
-          
+
           this.onlyOneChild = item
 
           // console.log(item);
@@ -102,16 +89,18 @@ export default {
         this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
         return true
       }
-
       return false
     },
     resolvePath(routePath) {
+
       if (isExternal(routePath)) {
         return routePath
       }
       if (isExternal(this.basePath)) {
         return this.basePath
       }
+
+
       return path.resolve(this.basePath, routePath)
     }
   }

+ 2 - 2
src/layout/components/Sidebar/index.vue

@@ -38,12 +38,12 @@ export default {
     activeMenu() {
       const route = this.$route
       console.log(route);
-      const { meta, path } = route
+      const { meta, path ,fullUrl} = route
       // if set path, the sidebar will highlight the path you set
       if (meta.activeMenu) {
         return meta.activeMenu
       }
-      return path
+      return fullUrl
     },
     showLogo() {
       return this.$store.state.settings.sidebarLogo

+ 42 - 21
src/permission.js

@@ -45,7 +45,9 @@ router.beforeEach(async (to, from, next) => {
 
           // 设置路由
           var newRoutes = [];
+
           for (var route of store.getters.menus) {
+
             const item = buildRootRoute(route);
             newRoutes.push(item);
           }
@@ -111,25 +113,26 @@ router.afterEach(() => {
 });
 
 // 遍历后台传来的路由字符串,转换为组件对象
-function filterAsyncRouter(asyncRouterMap) {
-  const accessedRouters = asyncRouterMap.filter((route) => {
-    console.log(route);
-    if (route.component) {
-      if (route.component === "Layout") {
-        route.component = Layout;
-      } else {
-        route.component = _import(route.component); // 导入组件
-      }
-    }
-    if (route.children && route.children.length) {
-      route.children = filterAsyncRouter(route.children);
-    }
-    return true;
-  });
-  return accessedRouters;
-}
+// function filterAsyncRouter(asyncRouterMap) {
+//   const accessedRouters = asyncRouterMap.filter((route) => {
+//     console.log(route);
+//     if (route.component) {
+//       if (route.component === "Layout") {
+//         route.component = Layout;
+//       } else {
+//         route.component = _import(route.component); // 导入组件
+//       }
+//     }
+//     if (route.children && route.children.length) {
+//       route.children = filterAsyncRouter(route.children);
+//     }
+//     return true;
+//   });
+//   return accessedRouters;
+// }
 
 function buildRootRoute(route) {
+  // console.log(route,1111);
   const { url, icon, moduleName, moduleId, code, type } = route;
   var item = {};
   item.path = url;
@@ -183,7 +186,9 @@ function buildRootRoute(route) {
     code == "notice" ||
     code == "index"
   ) {
+
     for (var child of route.children) {
+
       item.children.push(buildRoute(child, url));
     }
   }
@@ -191,7 +196,8 @@ function buildRootRoute(route) {
 }
 
 function buildRoute(route, p_url) {
-  const { url, moduleName, icon, moduleId, code, type, hidden } = route;
+  // console.log(route,2222);
+  const { url, moduleName, icon, moduleId, code, type, hidden,fullUrl } = route;
   var item = {};
   if (url.substr(0, 1) == "/") {
     item.path = url.substr(1);
@@ -204,7 +210,14 @@ function buildRoute(route, p_url) {
       item.component = (resolve) =>
         require(["@/views" + `${url}/index`], resolve);
     } else {
-      item.component = _import(`${p_url}${url}`);
+
+      if (fullUrl) {
+        item.component = _import(`${fullUrl}`);
+      }else{
+        item.component = _import(`${p_url}${url}`);
+
+      }
+
     }
   } catch (e) {
     console.log(e);
@@ -232,15 +245,23 @@ function buildRoute(route, p_url) {
 }
 
 function buildThirdRoute(route, p_url) {
-  const { url, moduleName, icon, moduleId, code, hidden, type } = route;
+
+  const { url, moduleName, icon, moduleId, code, hidden, type ,fullUrl } = route;
+  // console.log(fullUrl,'7878');
   var item = {};
   if (url.substr(0, 1) == "/") {
+    // console.log(url.substr(1),p_url,url);
     item.path = url.substr(1);
   } else {
     tem.path = url;
   }
   try {
-    item.component = _import(`${p_url}${url}`);
+    if (fullUrl) {
+      item.component = _import(`${fullUrl}`);
+    }else{
+      item.component = _import(`${p_url}${url}`);
+    }
+
   } catch (e) {
     console.log(e);
   }

+ 17 - 11
src/views/supply/policy/components/retail_form2.vue

@@ -354,7 +354,7 @@
               @click="(dialogVisible = true), (cid = scope.row.id)"
               >修改</el-button
             > -->
-            <el-button type="text" @click="deleteItem(scope.$index)"
+            <el-button type="text" @click="deleteItem(scope.$index,scope.row.id)"
               >删除</el-button
             >
           </template>
@@ -1092,10 +1092,7 @@ export default {
       }).then((res) => {
         for (let i = 0; i < res.data.records.length; i++) {
           res.data.records[i].qty = 1;
-
-
             for (let j = 0; j < this.newDataList.length; j++) {
-
                 if (this.newDataList[j].id == res.data.records[i].id) {
                      res.data.records[i].disabled = false;
                 }
@@ -1110,7 +1107,10 @@ export default {
 
     handleShow() {
       this.isShowDialog = true;
-      this.getPolicyList();
+      if (!this.goodsList.length) {
+          this.getPolicyList();
+      }
+
     },
     // 获取钱包列表
     getWalletList() {
@@ -1284,13 +1284,20 @@ export default {
       this.radio = "";
       this.dataList = [];
       this.popDataArr = [];
-      this.screenForm.policyId = "";
-      this.screenForm.saleTypeCode = "";
+      // this.screenForm.policyId = "";
+      // this.screenForm.saleTypeCode = "";
     },
     // 删除产品
-    deleteItem(index) {
+    deleteItem(index,id) {
       this.goodsList.splice(index, 1);
-      console.log(this.multipleData);
+      // this.dataList
+      if (this.newDataList.length) {
+         this.newDataList.splice(index, 1);
+      }
+      if (!this.goodsList.length) {
+          this.disabled = false
+      }
+
       // this.popDataArr.splice(index,1)
     },
     // 修改返利钱包
@@ -1350,8 +1357,7 @@ export default {
           //   ].dictValue;
           let params = {
             theTime: this.mainForm.date,
-            mainId: this.mainForm.type,
-            mainName: "",
+
             remark: this.mainForm.remark,
             type: 2, // 1:普通零售单,2:政策零售单
             retailOrderItemList: this.goodsList,