Просмотр исходного кода

OW 放箱号添加tabs
vuex配置页面组件监听方法 用于销毁页面

Qukatie 1 неделя назад
Родитель
Сommit
945dee14d7

+ 18 - 3
src/App.vue

@@ -1,6 +1,9 @@
 <template>
   <div id="app">
-    <router-view />
+    <!-- <router-view /> -->
+    <keep-alive :include="cachedViews">
+      <router-view></router-view>
+    </keep-alive>
   </div>
 </template>
 
@@ -12,13 +15,25 @@ export default {
   data() {
     return {};
   },
-  watch: {},
+  watch: {
+    cachedViews: {
+      handler(val) {
+        console.log('监听组件暂存',val);
+      },
+      deep: true,
+      immediate: true
+    }
+  },
   mounted() {
     //刷新浏览器清除标签key
     delAllTabsKey("ALL");
   },
   methods: {},
-  computed: {}
+  computed: {
+    ...mapState({
+      cachedViews: state => state.tags.cachedViews
+    })
+  }
 };
 </script>
 <style lang="scss">

+ 6 - 6
src/permission.js

@@ -4,11 +4,11 @@
  */
 import router from './router/router'
 import store from './store'
-import {validatenull} from '@/util/validate'
-import {getToken} from '@/util/auth'
+import { validatenull } from '@/util/validate'
+import { getToken } from '@/util/auth'
 import NProgress from 'nprogress' // progress bar
 import 'nprogress/nprogress.css' // progress bar style
-NProgress.configure({showSpinner: false});
+NProgress.configure({ showSpinner: false });
 const lockPage = store.getters.website.lockPage; //锁屏页
 router.beforeEach((to, from, next) => {
   const meta = to.meta || {};
@@ -16,14 +16,14 @@ router.beforeEach((to, from, next) => {
   store.commit('SET_IS_MENU', isMenu === undefined);
   if (getToken()) {
     if (store.getters.isLock && to.path !== lockPage) { //如果系统激活锁屏,全部跳转到锁屏页
-      next({path: lockPage})
+      next({ path: lockPage })
     } else if (to.path === '/login') { //如果登录成功访问登录页跳转到主页
-      next({path: '/'})
+      next({ path: '/' })
     } else {
       //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
       if (store.getters.token.length === 0) {
         store.dispatch('FedLogOut').then(() => {
-          next({path: '/login'})
+          next({ path: '/login' })
         })
       } else {
         const value = to.query.src || to.fullPath;

+ 1 - 0
src/store/getters.js

@@ -1,5 +1,6 @@
 const getters = {
   tag: state => state.tags.tag,
+  cachedViews:state => state.tags.cachedViews,
   language: state => state.common.language,
   website: state => state.common.website,
   userInfo: state => state.user.userInfo,

+ 7 - 15
src/store/modules/tags.js

@@ -47,18 +47,7 @@ const navs = {
   },
   actions: {},
   mutations: {
-    DEL_CACHED_VIEW: (state, action) => {
-      const index = state.cachedViews.indexOf(action.label)
-      if (index > -1) state.cachedViews.splice(index, 1)
-    },
-    DEL_ALL_CACHED_VIEWS: (state) => {
-      state.cachedViews = [] // 清空所有缓存
-    },
     ADD_TAG: (state, action) => {
-      if (!state.cachedViews.includes(action.label) && action.meta.keepAlive) {
-        state.cachedViews.push(action.label)
-      }
-      console.log(state.cachedViews)
       state.tag = action;
       setStore({
         name: 'tag',
@@ -71,10 +60,11 @@ const navs = {
         name: 'tagList',
         content: state.tagList
       })
+      if (action.label != '首页' && !state.cachedViews.includes(action.label) && action.meta.keepAlive) {
+        state.cachedViews.push(action.label)
+      }
     },
     DEL_TAG: (state, action) => {
-      const index = state.cachedViews.indexOf(action.label)
-      if (index > -1) state.cachedViews.splice(index, 1)
       state.tagList = state.tagList.filter(item => {
         return !diff(item, action);
       })
@@ -84,18 +74,19 @@ const navs = {
         content: state.tagList
       })
       delTabsKey(state.tag.label)
+      state.cachedViews = state.cachedViews.filter(n => n !== action.label)
     },
     DEL_ALL_TAG: (state) => {
-      state.cachedViews = []
       state.tagList = [state.tagWel];
       setStore({
         name: 'tagList',
         content: state.tagList
       })
       delAllTabsKey('ALL')
+      state.cachedViews = []
     },
     DEL_TAG_OTHER: (state) => {
-      state.cachedViews = state.cachedViews.filter(item => item === state.tag.label)
+
       state.tagList = state.tagList.filter(item => {
         if (item.value === state.tag.value) {
           return true;
@@ -109,6 +100,7 @@ const navs = {
         content: state.tagList
       })
       delAllTabsKey(state.tag.label)
+      state.cachedViews = state.cachedViews.filter(item => item === state.tag.label)
     },
     SET_TAG_LIST(state, tagList) {
       state.tagList = tagList;

+ 1 - 1
src/views/boxManagement/containerNumber/detailsPage.vue

@@ -506,7 +506,7 @@ import { getToken } from "@/util/auth";
 import _ from "lodash";
 import { Header } from "element-ui";
 export default {
-  name: "detailsPage",
+  name:'放箱号',
   data() {
     return {
       saberUserInfo: JSON.parse(localStorage.getItem("saber-userInfo")).content, // 当前登录人个人信息

+ 13 - 11
src/views/boxManagement/containerNumber/index.vue

@@ -23,6 +23,12 @@
         @on-load="onLoad"
       >
         <template slot="menuLeft">
+          <el-tabs v-model="query.whetherDisplay" type="card" @tab-click="handleClick">
+            <el-tab-pane label="全部" name="0"></el-tab-pane>
+            <el-tab-pane label="可用" name="1"></el-tab-pane>
+            <el-tab-pane label="不可用" name="2"></el-tab-pane>
+            <el-tab-pane label="失效" name="3"></el-tab-pane>
+          </el-tabs>
           <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">新 增 </el-button>
           <!-- <el-button type="warning" size="small" @click="outExport">导 出
                     </el-button> -->
@@ -43,9 +49,6 @@
         <template slot="containerNumber" slot-scope="{ row }">
           <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.containerNumber }}</span>
         </template>
-        <template slot="whetherDisplaySearch" slot-scope="{ row }">
-          <el-checkbox v-model="query.whetherDisplay" true-label="1" false-label="0"></el-checkbox>
-        </template>
       </avue-crud>
     </basic-container>
     <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
@@ -59,12 +62,13 @@ import detailsPage from "./detailsPage";
 import { getToken } from "@/util/auth";
 import _ from "lodash";
 export default {
+  name:'放箱号',
   data() {
     return {
       isShow: true,
       form: {},
       query: {
-        whetherDisplay:'0'
+        whetherDisplay: "0"
       },
       loading: false,
       page: {
@@ -80,7 +84,7 @@ export default {
         menuWidth: 140,
         tip: false,
         searchShow: true,
-        searchMenuSpan: 24,
+        searchMenuSpan: 6,
         border: true,
         index: true,
         addBtn: false,
@@ -473,12 +477,6 @@ export default {
             width: 100,
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd HH:mm:ss"
-          },
-          {
-            label: "可用为0",
-            prop: "whetherDisplay",
-            search: true,
-            hide: true
           }
         ]
       },
@@ -561,6 +559,10 @@ export default {
     refreshChange() {
       this.onLoad(this.page, this.query);
     },
+    handleClick() {
+      this.page.currentPage = 1;
+      this.onLoad(this.page, this.query);
+    },
     onLoad(page, params = {}) {
       let obj = {};
       obj = {

+ 1 - 0
src/views/iosBasicData/SeafreightExportF/bills/billsDetails.vue

@@ -655,6 +655,7 @@ import billLading from "./assembly/billLading.vue";
 import customsInformation from "./assembly/customsInformation.vue";
 import _ from "lodash";
 export default {
+  name: "海运出口(F)",
   components: {
     checkSchedule,
     SearchQuery,

+ 1 - 0
src/views/iosBasicData/SeafreightExportF/bills/index.vue

@@ -497,6 +497,7 @@ import { getDeptTree } from "@/api/system/dept";
 import { getToken } from "@/util/auth";
 import { getListTemplate, getListTemplatelist } from "@/api/iosBasicData/losbfeestemplate";
 export default {
+  name:'海运出口(F)',
   components: {
     TreeSelect,
     SearchQuery,

+ 11 - 11
src/views/iosBasicData/financeProfit/index.vue

@@ -820,17 +820,17 @@ export default {
           prop: "oceanFreightProfit",
           minWidth: 90
         },
-        {
-          id: 15,
-          label: "单票利润",
-          prop: "amountProfitLoc"
-        },
-        {
-          id: 16,
-          label: "实际单票利润",
-          prop: "realAmountProfitLoc",
-          minWidth: 100
-        }
+        // {
+        //   id: 15,
+        //   label: "单票利润",
+        //   prop: "amountProfitLoc"
+        // },
+        // {
+        //   id: 16,
+        //   label: "实际单票利润",
+        //   prop: "realAmountProfitLoc",
+        //   minWidth: 100
+        // }
       ],
       saberUserInfo: {}
     };

+ 12 - 11
src/views/ow/owTask/index.vue

@@ -23,6 +23,12 @@
         @on-load="onLoad"
       >
         <template slot="menuLeft">
+          <el-tabs v-model="query.whetherDisplay" type="card" @tab-click="handleClick">
+            <el-tab-pane label="全部" name="0"></el-tab-pane>
+            <el-tab-pane label="已提箱" name="1"></el-tab-pane>
+            <el-tab-pane label="未提箱" name="2"></el-tab-pane>
+            <el-tab-pane label="失效" name="3"></el-tab-pane>
+          </el-tabs>
           <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">创建单据 </el-button>
           <el-button type="success" size="small" :disabled="selectionList.length != 1" @click="copyButton">复制单据 </el-button>
           <el-button type="warning" size="small" disabled @click="outExport">导 出 </el-button>
@@ -42,9 +48,6 @@
         <template slot="containerNumber" slot-scope="{ row }">
           <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.containerNumber }}</span>
         </template>
-            <template slot="whetherDisplaySearch" slot-scope="{ row }">
-          <el-checkbox v-model="query.whetherDisplay" true-label="1" false-label="0"></el-checkbox>
-        </template>
       </avue-crud>
     </basic-container>
     <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
@@ -64,7 +67,7 @@ export default {
       form: {},
       query: {
         type: "OW-N",
-        whetherDisplay:'0'
+        whetherDisplay: '0'
       },
       loading: false,
       page: {
@@ -80,7 +83,7 @@ export default {
         menuWidth: 140,
         tip: false,
         searchShow: true,
-        searchMenuSpan: 12,
+        searchMenuSpan: 18,
         border: true,
         index: true,
         addBtn: false,
@@ -567,12 +570,6 @@ export default {
             width: 100,
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd HH:mm:ss"
-          },
-          {
-            label: "未提箱为0",
-            prop: "whetherDisplay",
-            search: true,
-            hide: true
           }
         ]
       },
@@ -658,6 +655,10 @@ export default {
     refreshChange() {
       this.onLoad(this.page, this.query);
     },
+    handleClick() {
+      this.page.currentPage = 1;
+      this.onLoad(this.page, this.query);
+    },
     onLoad(page, params = {}) {
       let obj = {};
       obj = {