Kaynağa Gözat

页签缓存

lilei 3 yıl önce
ebeveyn
işleme
e07464bf21

+ 10 - 2
src/components/MultiTab/MultiTab.vue

@@ -12,6 +12,7 @@ export default {
       newTabIndex: 0
     }
   },
+  inject: ['reloadView'],
   created () {
     // bind event
     events.$on('open', val => {
@@ -56,6 +57,9 @@ export default {
     },
 
     // content menu
+    refashThat (e) {
+      this.reloadView()
+    },
     closeThat (e) {
       // 判断是否为最后一个标签页,如果是最后一个,则无法被关闭
       if (this.tabsList.length > 1) {
@@ -102,7 +106,7 @@ export default {
     renderTabPaneMenu (e) {
       return (
         <a-menu {...{ on: { click: ({ key, item, domEvent }) => { this.closeMenuClick(key, e) } } }}>
-          <a-menu-item key="closeThat">关闭当前标签</a-menu-item>
+          {this.activeKey == e ? (<a-menu-item key="refashThat">刷新页面</a-menu-item>) : ''}
           <a-menu-item key="closeRight">关闭右侧</a-menu-item>
           <a-menu-item key="closeLeft">关闭左侧</a-menu-item>
           <a-menu-item key="closeAll">关闭全部</a-menu-item>
@@ -150,7 +154,7 @@ export default {
     }
   },
   render () {
-    const { onEdit, $data: { pages } } = this
+    const { onEdit, refashThat, $data: { pages } } = this
     const panes = pages.map(page => {
       return (
         <a-tab-pane
@@ -159,6 +163,10 @@ export default {
         >
           <span slot="tab">
             {this.renderTabPane(page.meta.customTitle || page.meta.title, page.name)}
+            {this.activeKey == page.name ? (<a-icon
+              {...{ on: { click: refashThat } }}
+              style={{ marginLeft: '8px', fontSize: '12px' }}
+              type="reload" />) : ''}
           </span>
         </a-tab-pane>)
     })

+ 3 - 3
src/components/custom.less

@@ -88,11 +88,11 @@ body{
 // 页签样式
 .multi-tab-con{
   .ant-tabs-nav-container{
-    height: 25px!important;
+    height: 30px!important;
     .ant-tabs-tab{
       padding: 0 8px!important;
-      height: 24px!important;
-      line-height: 24px!important;
+      height: 30px!important;
+      line-height: 30px!important;
     }
   }
 }

+ 58 - 58
src/config/router.config.js

@@ -63,7 +63,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/salesQuery',
             redirect: '/salesManagement/salesQuery/list',
             name: 'salesQuery',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '销售单查询',
               icon: 'monitor',
@@ -132,7 +132,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/examineVerify',
             redirect: '/salesManagement/examineVerify/list',
             name: 'examineVerify',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '备货审核',
               icon: 'audit',
@@ -157,7 +157,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/outboundOrder',
             redirect: '/salesManagement/outboundOrder/list',
             name: 'outboundOrder',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '出库',
               icon: 'export',
@@ -182,7 +182,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/pushOrderManagement',
             redirect: '/salesManagement/pushOrderManagement/list',
             name: 'pushOrderManagement',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '下推订单列表',
               icon: 'vertical-align-bottom',
@@ -218,7 +218,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/salesReturn',
             redirect: '/salesManagement/salesReturn/list',
             name: 'salesReturn',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '销售退货列表',
               icon: 'fund',
@@ -287,7 +287,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/backorder',
             redirect: '/salesManagement/backorder/list',
             name: 'backorder',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '销售缺货列表',
               icon: 'exception',
@@ -312,7 +312,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/shortageStatisticsC',
             redirect: '/salesManagement/shortageStatisticsC/list',
             name: 'shortageStatisticsC',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '缺货统计(按客户)',
               icon: 'file-done',
@@ -337,7 +337,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/shortageStatisticsP',
             redirect: '/salesManagement/shortageStatisticsP/list',
             name: 'shortageStatisticsP',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '缺货统计(按产品)',
               icon: 'file-protect',
@@ -362,7 +362,7 @@ export const asyncRouterMap = [
             path: '/salesManagement/priceInquiry',
             redirect: '/salesManagement/priceInquiry/list',
             name: 'priceInquiry',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '价格查询',
               icon: 'file-protect',
@@ -400,7 +400,7 @@ export const asyncRouterMap = [
             path: '/purchasingManagement/bulkWarehousingOrder',
             redirect: '/purchasingManagement/bulkWarehousingOrder/list',
             name: 'bulkWarehousingOrder',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '散件入库',
               icon: 'gold',
@@ -459,7 +459,7 @@ export const asyncRouterMap = [
           //   path: '/financialManagement/inventoryReview',
           //   redirect: '/financialManagement/inventoryReview/list',
           //   name: 'inventoryReview',
-          //   component: RouteView,
+          //   component: BlankLayout,
           //   meta: {
           //     title: '盘点审核',
           //     icon: 'laptop'
@@ -495,7 +495,7 @@ export const asyncRouterMap = [
             path: '/financialManagement/warehousingConfirmation',
             redirect: '/financialManagement/warehousingConfirmation/list',
             name: 'warehousingConfirmation',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '入库确认',
               icon: 'vertical-align-bottom',
@@ -520,7 +520,7 @@ export const asyncRouterMap = [
             path: '/financialManagement/returnConfirmation',
             redirect: '/financialManagement/returnConfirmation/list',
             name: 'returnConfirmation',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '退货确认',
               icon: 'vertical-align-top',
@@ -545,7 +545,7 @@ export const asyncRouterMap = [
             path: '/financialManagement/financialCollection',
             redirect: '/financialManagement/financialCollection/list',
             name: 'financialCollection',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '财务收款',
               icon: 'pay-circle',
@@ -583,7 +583,7 @@ export const asyncRouterMap = [
             path: '/inventoryManagement/inventoryQuery',
             redirect: '/inventoryManagement/inventoryQuery/list',
             name: 'inventoryQuery',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '库存查询',
               icon: 'monitor',
@@ -629,7 +629,7 @@ export const asyncRouterMap = [
             path: '/inventoryManagement/intelligentReplenishment',
             redirect: '/inventoryManagement/intelligentReplenishment/list',
             name: 'intelligentReplenishment',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '智能补货',
               icon: 'monitor',
@@ -715,7 +715,7 @@ export const asyncRouterMap = [
           //   path: '/inventoryManagement/inventoryChecking',
           //   redirect: '/inventoryManagement/inventoryChecking/list',
           //   name: 'inventoryChecking',
-          //   component: RouteView,
+          //   component: BlankLayout,
           //   meta: {
           //     title: '库存盘点',
           //     icon: 'reconciliation'
@@ -819,7 +819,7 @@ export const asyncRouterMap = [
             path: '/allocationManagement/transferOut',
             redirect: '/allocationManagement/transferOut/list',
             name: 'transferOut',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '调拨列表',
               icon: 'pull-request',
@@ -890,7 +890,7 @@ export const asyncRouterMap = [
             path: '/reportData/salesDetails',
             redirect: '/reportData/salesDetails/list',
             name: 'salesDetails',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '销售明细(开单统计)',
               icon: 'profile',
@@ -915,7 +915,7 @@ export const asyncRouterMap = [
             path: '/reportData/allocationOrderTotal',
             redirect: '/reportData/allocationOrderTotal/list',
             name: 'allocationOrderTotal',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '调拨开单统计',
               icon: 'profile',
@@ -940,7 +940,7 @@ export const asyncRouterMap = [
             path: '/reportData/allocationDetails',
             redirect: '/reportData/allocationDetails/list',
             name: 'allocationDetails',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '调拨明细',
               icon: 'profile',
@@ -965,7 +965,7 @@ export const asyncRouterMap = [
             path: '/reportData/salesReturnsReport',
             redirect: '/reportData/salesReturnsReport/list',
             name: 'salesReturnsReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '销售退货单报表',
               icon: 'profile',
@@ -990,7 +990,7 @@ export const asyncRouterMap = [
             path: '/reportData/salesReturnDetailReport',
             redirect: '/reportData/salesReturnDetailReport/list',
             name: 'salesReturnDetailReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '销售退货明细报表',
               icon: 'profile',
@@ -1014,7 +1014,7 @@ export const asyncRouterMap = [
             path: '/reportData/salesSlipReport',
             redirect: '/reportData/salesSlipReport/list',
             name: 'salesSlipReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '开单销售单报表',
               icon: 'profile',
@@ -1038,7 +1038,7 @@ export const asyncRouterMap = [
             path: '/reportData/returnSlipReport',
             redirect: '/reportData/returnSlipReport/list',
             name: 'returnSlipReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '开单退货单报表',
               icon: 'profile',
@@ -1062,7 +1062,7 @@ export const asyncRouterMap = [
             path: '/reportData/salesAmountReport',
             redirect: '/reportData/salesAmountReport/list',
             name: 'salesAmountReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '开单销售报表',
               icon: 'profile',
@@ -1086,7 +1086,7 @@ export const asyncRouterMap = [
             path: '/reportData/actualSalesReport',
             redirect: '/reportData/actualSalesReport/list',
             name: 'actualSalesReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '实售销售报表',
               icon: 'profile',
@@ -1111,7 +1111,7 @@ export const asyncRouterMap = [
             path: '/reportData/billingReturnReport',
             redirect: '/reportData/billingReturnReport/list',
             name: 'billingReturnReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '开单退货报表',
               icon: 'profile',
@@ -1136,7 +1136,7 @@ export const asyncRouterMap = [
             path: '/reportData/salesReturnReport',
             redirect: '/reportData/salesReturnReport/list',
             name: 'salesReturnReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '实售退货报表',
               icon: 'profile',
@@ -1161,7 +1161,7 @@ export const asyncRouterMap = [
             path: '/reportData/hPriceDifferenceDetailReport',
             redirect: '/reportData/hPriceDifferenceDetailReport/list',
             name: 'hPriceDifferenceDetailReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '总部差价明细报表',
               icon: 'profile',
@@ -1186,7 +1186,7 @@ export const asyncRouterMap = [
             path: '/reportData/priceDifferenceDetailReport',
             redirect: '/reportData/priceDifferenceDetailReport/list',
             name: 'priceDifferenceDetailReport',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '差价明细报表',
               icon: 'profile',
@@ -1211,7 +1211,7 @@ export const asyncRouterMap = [
             path: '/reportData/provinceTypeSalesDetails',
             redirect: '/reportData/provinceTypeSalesDetails/list',
             name: 'provinceTypeSalesDetails',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '全国各省品类实际销售明细',
               icon: 'profile',
@@ -1236,7 +1236,7 @@ export const asyncRouterMap = [
             path: '/reportData/districtTypeSalesDetails',
             redirect: '/reportData/districtTypeSalesDetails/list',
             name: 'districtTypeSalesDetails',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '全国各区品类实际销售明细',
               icon: 'profile',
@@ -1261,7 +1261,7 @@ export const asyncRouterMap = [
             path: '/reportData/regionalPromotionCostStatistics',
             redirect: '/reportData/regionalPromotionCostStatistics/list',
             name: 'regionalPromotionCostStatistics',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '区域促销费用统计',
               icon: 'profile',
@@ -1286,7 +1286,7 @@ export const asyncRouterMap = [
             path: '/reportData/nationalCustomerCostStatistics',
             redirect: '/reportData/nationalCustomerCostStatistics/list',
             name: 'nationalCustomerCostStatistics',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '全国客户费用统计',
               icon: 'profile',
@@ -1324,7 +1324,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productInfo',
             redirect: '/productManagement/productInfo/list',
             name: 'productInfo',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品列表',
               icon: 'gold',
@@ -1371,7 +1371,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productPricing',
             redirect: '/productManagement/productPricing/list',
             name: 'productPricing',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品定价',
               icon: 'transaction',
@@ -1396,7 +1396,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productLaunchAudit',
             redirect: '/productManagement/productLaunchAudit/list',
             name: 'productLaunchAudit',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品上线审核',
               icon: 'rise',
@@ -1421,7 +1421,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productOfflineAudit',
             redirect: '/productManagement/productOfflineAudit/list',
             name: 'productOfflineAudit',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品下线审核',
               icon: 'fall',
@@ -1446,7 +1446,7 @@ export const asyncRouterMap = [
             path: '/productManagement/priceChangeRecord',
             redirect: '/productManagement/priceChangeRecord/list',
             name: 'priceChangeRecord',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '价格变更记录',
               icon: 'profile',
@@ -1471,7 +1471,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productUniversal',
             redirect: '/productManagement/productUniversal/list',
             name: 'productUniversal',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '通用产品管理',
               icon: 'deployment-unit',
@@ -1496,7 +1496,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productLevel',
             redirect: '/productManagement/productLevel/list',
             name: 'productLevel',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品级别管理',
               icon: 'fund',
@@ -1521,7 +1521,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productBrand',
             redirect: '/productManagement/productBrand/list',
             name: 'productBrand',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品品牌管理',
               icon: 'file-ppt',
@@ -1546,7 +1546,7 @@ export const asyncRouterMap = [
             path: '/productManagement/productCategory',
             redirect: '/productManagement/productCategory/list',
             name: 'productCategory',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '产品分类管理',
               icon: 'radar-chart',
@@ -1572,7 +1572,7 @@ export const asyncRouterMap = [
           //   path: '/productManagement/purchaseBaseLimit',
           //   redirect: '/productManagement/purchaseBaseLimit/list',
           //   name: 'purchaseBaseLimit',
-          //   component: RouteView,
+          //   component: BlankLayout,
           //   meta: {
           //     title: '产品采购基数限制',
           //     icon: 'sliders'
@@ -1610,7 +1610,7 @@ export const asyncRouterMap = [
             path: '/dealerManagement/merchantInfoManagement',
             redirect: '/dealerManagement/merchantInfoManagement/list',
             name: 'merchantInfoManagement',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '经销商资料管理',
               icon: 'file-text',
@@ -1668,7 +1668,7 @@ export const asyncRouterMap = [
             path: '/dealerManagement/dealerAccountManagement',
             redirect: '/dealerManagement/dealerAccountManagement/list',
             name: 'dealerAccountManagement',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '经销商账号管理',
               icon: 'team',
@@ -1693,7 +1693,7 @@ export const asyncRouterMap = [
             path: '/dealerManagement/dealerRelationshipBinding',
             redirect: '/dealerManagement/dealerRelationshipBinding/list',
             name: 'dealerRelationshipBinding',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '经销商关系绑定',
               icon: 'share-alt',
@@ -1718,7 +1718,7 @@ export const asyncRouterMap = [
             path: '/dealerManagement/rebateSettings',
             redirect: '/dealerManagement/rebateSettings/list',
             name: 'rebateSettings',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '差价归属设置',
               icon: 'stock',
@@ -1743,7 +1743,7 @@ export const asyncRouterMap = [
             path: '/dealerManagement/marketingDivisionSet',
             redirect: '/dealerManagement/marketingDivisionSet/list',
             name: 'marketingDivisionSet',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '营销分区设置',
               icon: 'setting',
@@ -1781,7 +1781,7 @@ export const asyncRouterMap = [
             path: '/supplierManagement/supplierInfo',
             redirect: '/supplierManagement/supplierInfo/list',
             name: 'supplierInfo',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '供应商列表',
               icon: 'team',
@@ -1839,7 +1839,7 @@ export const asyncRouterMap = [
             path: '/supplierManagement/associatedProductDetails',
             redirect: '/supplierManagement/associatedProductDetails/list',
             name: 'associatedProductDetails',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '关联产品明细表',
               icon: 'build',
@@ -1877,7 +1877,7 @@ export const asyncRouterMap = [
             path: '/promotionRulesManagement/promotionRules',
             redirect: '/promotionRulesManagement/promotionRules/list',
             name: 'promotionRules',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '促销规则管理',
               icon: 'thunderbolt',
@@ -1924,7 +1924,7 @@ export const asyncRouterMap = [
             path: '/promotionRulesManagement/orderStatistics',
             redirect: '/promotionRulesManagement/orderStatistics/list',
             name: 'orderStatistics',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '促销订单统计',
               icon: 'contacts',
@@ -1949,7 +1949,7 @@ export const asyncRouterMap = [
             path: '/promotionRulesManagement/productStatistics',
             redirect: '/promotionRulesManagement/productStatistics/list',
             name: 'productStatistics',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '促销产品统计',
               icon: 'file-ppt',
@@ -1987,7 +1987,7 @@ export const asyncRouterMap = [
             path: '/basicData/warehouse',
             redirect: '/basicData/warehouse/list',
             name: 'warehouse',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '仓库管理',
               icon: 'deployment-unit',
@@ -2023,7 +2023,7 @@ export const asyncRouterMap = [
             path: '/basicData/transferTypeManagement',
             redirect: '/basicData/transferTypeManagement/list',
             name: 'transferTypeManagement',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '调拨类型管理',
               icon: 'interaction',
@@ -2136,7 +2136,7 @@ export const asyncRouterMap = [
             path: '/setting/noticeManagement',
             redirect: '/setting/noticeManagement/list',
             name: 'noticeManagement',
-            component: RouteView,
+            component: BlankLayout,
             meta: {
               title: '公告管理',
               icon: 'sketch',

+ 15 - 3
src/layouts/BasicLayout.vue

@@ -39,9 +39,9 @@
         @toggle="toggle"
       />
       <!-- layout content -->
-      <a-layout-content :style="{ height: '100%', margin: '24px 20px 0', paddingTop: multiTab&&fixedHeader ? '66px' : (!multiTab&&fixedHeader?'45px':'0') }">
+      <a-layout-content :style="{ height: '100%', margin: '31px 20px 0', paddingTop: multiTab&&fixedHeader ? '66px' : (!multiTab&&fixedHeader?'45px':'0') }">
         <transition name="page-transition">
-          <route-view/>
+          <route-view v-if="isRouterAlive"/>
         </transition>
       </a-layout-content>
 
@@ -73,6 +73,11 @@ import { asyncRouterMap } from '@/config/router.config'
 export default {
   name: 'BasicLayout',
   mixins: [mixin, mixinDevice],
+  provide () {
+    return {
+      reloadView: this.reloadView
+    }
+  },
   components: {
     RouteView,
     SideMenu,
@@ -84,7 +89,8 @@ export default {
     return {
       production: config.production,
       collapsed: false,
-      menus: []
+      menus: [],
+      isRouterAlive: true
     }
   },
   computed: {
@@ -152,6 +158,12 @@ export default {
     },
     drawerClose () {
       this.collapsed = false
+    },
+    reloadView () {
+      this.isRouterAlive = false
+      this.$nextTick(() => {
+        this.isRouterAlive = true
+      })
     }
   }
 }

+ 4 - 4
src/layouts/RouteView.vue

@@ -11,10 +11,10 @@ export default {
     return {}
   },
   render () {
-    const { $route: { meta }, $store: { getters } } = this
+    const { $route: { meta, name }, $store: { getters } } = this
     const inKeep = (
       <keep-alive>
-        <router-view key={ this.$route.fullPath }/>
+        <router-view key={ name }/>
       </keep-alive>
     )
     const notKeep = (
@@ -26,8 +26,8 @@ export default {
     // if (!getters.multiTab && !meta.keepAlive) {
     //   return notKeep
     // }
-    // return this.keepAlive || getters.multiTab || meta.keepAlive ? inKeep : notKeep
-    return meta.keepAlive ? inKeep : notKeep
+    return this.keepAlive || getters.multiTab || meta.keepAlive ? inKeep : notKeep
+    // return meta.keepAlive ? inKeep : notKeep
   }
 }
 </script>