Browse Source

bug 修复

lilei 4 năm trước cách đây
mục cha
commit
33ab67388a

+ 1 - 0
src/components/GlobalHeader/GlobalHeader.vue

@@ -74,6 +74,7 @@ export default {
   },
   mounted () {
     document.addEventListener('scroll', this.handleScroll, { passive: true })
+    console.log(this.multiTab)
   },
   methods: {
     handleScroll () {

+ 27 - 19
src/components/MultiTab/MultiTab.vue

@@ -6,6 +6,7 @@ export default {
   data () {
     return {
       fullPathList: [],
+      tabsList: [],
       pages: [],
       activeKey: '',
       newTabIndex: 0
@@ -35,7 +36,7 @@ export default {
     })
 
     this.pages.push(this.$route)
-    this.fullPathList.push(this.$route.fullPath)
+    this.tabsList.push(this.$route.name)
     this.selectedLastPath()
   },
   methods: {
@@ -43,30 +44,30 @@ export default {
       this[action](targetKey)
     },
     remove (targetKey) {
-      this.pages = this.pages.filter(page => page.fullPath !== targetKey)
-      this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
+      this.pages = this.pages.filter(page => page.name !== targetKey)
+      this.tabsList = this.tabsList.filter(name => name !== targetKey)
       // 判断当前标签是否关闭,若关闭则跳转到最后一个还存在的标签页
-      if (!this.fullPathList.includes(this.activeKey)) {
+      if (!this.tabsList.includes(this.activeKey)) {
         this.selectedLastPath()
       }
     },
     selectedLastPath () {
-      this.activeKey = this.fullPathList[this.fullPathList.length - 1]
+      this.activeKey = this.tabsList[this.tabsList.length - 1]
     },
 
     // content menu
     closeThat (e) {
       // 判断是否为最后一个标签页,如果是最后一个,则无法被关闭
-      if (this.fullPathList.length > 1) {
+      if (this.tabsList.length > 1) {
         this.remove(e)
       } else {
         this.$message.info('这是最后一个标签了, 无法被关闭')
       }
     },
     closeLeft (e) {
-      const currentIndex = this.fullPathList.indexOf(e)
+      const currentIndex = this.tabsList.indexOf(e)
       if (currentIndex > 0) {
-        this.fullPathList.forEach((item, index) => {
+        this.tabsList.forEach((item, index) => {
           if (index < currentIndex) {
             this.remove(item)
           }
@@ -76,9 +77,9 @@ export default {
       }
     },
     closeRight (e) {
-      const currentIndex = this.fullPathList.indexOf(e)
-      if (currentIndex < (this.fullPathList.length - 1)) {
-        this.fullPathList.forEach((item, index) => {
+      const currentIndex = this.tabsList.indexOf(e)
+      if (currentIndex < (this.tabsList.length - 1)) {
+        this.tabsList.forEach((item, index) => {
           if (index > currentIndex) {
             this.remove(item)
           }
@@ -88,8 +89,8 @@ export default {
       }
     },
     closeAll (e) {
-      const currentIndex = this.fullPathList.indexOf(e)
-      this.fullPathList.forEach((item, index) => {
+      const currentIndex = this.tabsList.indexOf(e)
+      this.tabsList.forEach((item, index) => {
         if (index !== currentIndex) {
           this.remove(item)
         }
@@ -121,14 +122,21 @@ export default {
   },
   watch: {
     '$route': function (newVal) {
-      this.activeKey = newVal.fullPath
-      if (this.fullPathList.indexOf(newVal.fullPath) < 0) {
-        this.fullPathList.push(newVal.fullPath)
+      this.activeKey = newVal.name
+      const index = this.tabsList.indexOf(newVal.name)
+      // 不存在
+      if (index < 0) {
+        this.tabsList.push(newVal.name)
         this.pages.push(newVal)
+      } else {
+        // 已存在
+        this.pages.splice(index, 1, newVal)
       }
     },
     activeKey: function (newPathKey) {
-      this.$router.push({ path: newPathKey })
+      const row = this.pages.find(item => item.name == newPathKey)
+      console.log(row.fullPath)
+      this.$router.push({ path: row.fullPath })
     }
   },
   render () {
@@ -137,10 +145,10 @@ export default {
       return (
         <a-tab-pane
           style={{ height: 0 }}
-          key={page.fullPath} closable={pages.length > 1}
+          key={page.name} closable={pages.length > 1}
         >
           <span slot="tab">
-            {this.renderTabPane(page.meta.customTitle || page.meta.title, page.fullPath)}
+            {this.renderTabPane(page.meta.customTitle || page.meta.title, page.name)}
           </span>
         </a-tab-pane>)
     })

+ 1 - 1
src/components/PageHeader/PageHeader.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="page-header">
     <div class="page-header-index-wide">
-      <s-breadcrumb />
+      <!-- <s-breadcrumb /> -->
       <div class="detail">
         <div class="main" v-if="!$route.meta.hiddenHeaderContent">
           <!-- <div class="row">

+ 24 - 4
src/components/Table/index.js

@@ -19,6 +19,10 @@ export default {
       type: [String, Function],
       default: 'key'
     },
+    rowClassName: {
+      type: [String, Function],
+      default: ''
+    },
     data: {
       type: Function,
       required: true
@@ -74,6 +78,19 @@ export default {
     pageURI: {
       type: Boolean,
       default: false
+    },
+    /** 是否首次加载数据 */
+    defaultLoadData: {
+      type: Boolean,
+      default: true
+    },
+    tableId: {
+      type: String,
+      default: ''
+    },
+    index: {
+      type: [String,Number],
+      default: ''
     }
   }),
   watch: {
@@ -112,7 +129,9 @@ export default {
     }) || false
     console.log('this.localPagination', this.localPagination)
     this.needTotalList = this.initTotalList(this.columns)
-    this.loadData()
+    if(this.defaultLoadData){
+      this.loadData()
+    }
   },
   methods: {
     /**
@@ -138,7 +157,9 @@ export default {
         pageNo: (pagination && pagination.current) ||
           this.showPagination && this.localPagination.current || this.pageNum,
         pageSize: (pagination && pagination.pageSize) ||
-          this.showPagination && this.localPagination.pageSize || this.pageSize
+          this.showPagination && this.localPagination.pageSize || this.pageSize,
+        tableId: this.tableId,
+        index: this.index
       },
       (sorter && sorter.field && {
         sortField: sorter.field
@@ -175,12 +196,11 @@ export default {
           // 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
           try {
             if ((['auto', true].includes(this.showPagination) && r.count <= (r.pageNo * this.localPagination.pageSize))) {
-              this.localPagination.hideOnSinglePage = true
+              // this.localPagination.hideOnSinglePage = true
             }
           } catch (e) {
             this.localPagination = false
           }
-          console.log('loadData -> this.localPagination', this.localPagination)
           this.localDataSource = list // 返回结果中的数组数据
           this.localLoading = false
         })

+ 7 - 3
src/layouts/BasicLayout.vue

@@ -39,7 +39,7 @@
         @toggle="toggle"
       />
       <!-- layout content -->
-      <a-layout-content :style="{ height: '100%', margin: '24px 24px 0', paddingTop: fixedHeader ? '105px' : '0' }">
+      <a-layout-content :style="{ height: '100%', margin: '24px 24px 0', paddingTop: multiTab&&fixedHeader ? '105px' : (!multiTab&&fixedHeader?'65px':'0') }">
         <transition name="page-transition">
           <route-view/>
         </transition>
@@ -47,7 +47,7 @@
 
       <!-- layout footer -->
       <a-layout-footer>
-        <global-footer />
+        <!-- <global-footer /> -->
       </a-layout-footer>
 
       <!-- Setting Drawer (show in development mode) -->
@@ -90,7 +90,9 @@ export default {
   computed: {
     ...mapState({
       // 动态主路由
-      mainMenu: state => state.permission.routers
+      mainMenu: state => state.permission.routers,
+      multiTab: state => state.app.multiTab,
+      fixedHeader: state => state.app.fixedHeader
     }),
     contentPaddingLeft () {
       if (!this.fixSidebar || this.isMobile()) {
@@ -116,6 +118,8 @@ export default {
       this.menus = [noqx.find(item => item.path === '/home')]
     }
     this.collapsed = !this.sidebarOpened
+    this.$store.dispatch('ToggleMultiTab', true)
+	  this.$store.dispatch('ToggleColor', '#1890FF')
   },
   mounted () {
     const userAgent = navigator.userAgent

+ 3 - 2
src/layouts/PageView.vue

@@ -1,7 +1,8 @@
 <template>
   <div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null">
     <!-- pageHeader , route meta :true on hide -->
-    <page-header v-if="!$route.meta.hiddenHeaderContent" :title="pageTitle" :logo="logo" :avatar="avatar">
+    <!-- <page-header v-if="!$route.meta.hiddenHeaderContent" :title="pageTitle" :logo="logo" :avatar="avatar"> -->
+    <page-header v-if="false" :title="pageTitle" :logo="logo" :avatar="avatar">
       <slot slot="action" name="action"></slot>
       <slot slot="content" name="headerContent"></slot>
       <div slot="content" v-if="!this.$slots.headerContent && description">
@@ -124,7 +125,7 @@ export default {
 
 <style lang="less" scoped>
   .content {
-    margin: 24px 24px 0;
+    margin: 12px 12px 0;
     .link {
       margin-top: 16px;
       &:not(:empty) {

+ 1 - 1
src/utils/request.js

@@ -48,7 +48,7 @@ service.interceptors.request.use(config => {
 service.interceptors.response.use((response) => {
   // console.log(response, 'response.data.status')
   const et = sessionStorage.getItem('errorTips')
-  if (response.data.status == '1001' && !et) {
+  if ((response.data.status == '1001' || response.data.status == '1099') && !et) {
     sessionStorage.setItem('errorTips', 1)
     modal.destroyAll()
     modal.error({