zhangqiOMG 3 anni fa
parent
commit
78a7895e7b

+ 0 - 1
src/SDrpManagement/agentOrder/modules/add.vue

@@ -176,7 +176,6 @@ export default {
         this.pageData()
         this.specordermx()
       }
-     
     },
     submitForm() {
       this.$refs['form'].validate(async valid => {

+ 38 - 11
src/components/normal-basic-layout/details/index.vue

@@ -20,10 +20,10 @@
           </div>
           <el-button v-if="tool.checkAuth($route.name,'delete') && delApiId" :type="checkDisabled()?'':'primary'" class="inline-16" size="mini" :disabled="checkDisabled()" @click="deleteData">删 除</el-button>
          
-          <!-- <div v-if="!pageChange">
-            <el-button :disabled="rowindex === 1" size="mini" icon="el-icon-arrow-left" @click="previous()"></el-button>
-            <el-button :disabled="rowindex === total" size="mini" @click="next()"><i class="el-icon-arrow-right"></i></el-button>
-          </div> -->
+          <div v-if="!pageChange">
+            <el-button size="mini" icon="el-icon-arrow-left" @click="previous()"></el-button>
+            <el-button size="mini" @click="next()"><i class="el-icon-arrow-right"></i></el-button>
+          </div>
         </div>
       </div>
       <div>
@@ -104,6 +104,7 @@ export default {
       refreshPage:true,
       reportCenterLsit:[],
       systemappid:JSON.parse(sessionStorage.getItem('activeApp')).systemappid,
+      idx:0
     }
   },
   computed:{
@@ -134,7 +135,8 @@ export default {
       
     },
     ...mapGetters({
-      activeApp:"activeApp"
+      activeApp:"activeApp",
+      listData:'listData'
     })
   },
   components:{
@@ -155,7 +157,7 @@ export default {
       this.param.content.pageNumber = pageNumber
       const res = await this.$api.requested(this.param)
       this.total = res.total
-      this.$emit('pageChange',res.data[0][this.idname],res.data[0].rowindex)
+      // this.$emit('pageChange',res.data[0][this.idname],res.data[0].rowindex)
       this.$refs['tag']?this.$refs['tag'].queryTag():''
       this.refresh()
     },
@@ -169,7 +171,6 @@ export default {
       })
       
       this.reportCenterLsit = res.data
-      console.log(res,'报表数据');
     },
     async printBtn (data,data2) {
       let res = await this.$api.requested({
@@ -185,13 +186,38 @@ export default {
       })
     },
     next () {
-      this.rowindex += 1
-      this.queryData(this.rowindex)
+      let nowId = this.$route.query.id
+      let changeId = ''
+      if ((this.idx + 1) == this.listData.length) return this.$message({
+        message:"已经是当前页最后一条了!",
+        type:'warning'
+      })
+      this.listData.forEach((e,index)=>{
+        if (e[this.idname] == nowId) {
+          changeId = this.listData[index + 1][this.idname]
+          this.idx = index + 1
+        }
+      })
       
+      this.$emit('pageChange',changeId,this.idx)
+      this.refresh()
     },
     previous () {
-      this.rowindex -= 1
-      this.queryData(this.rowindex)
+      let nowId = this.$route.query.id
+      let changeId = ''
+      if ((this.idx - 1) < 0) return this.$message({
+        message:"当前是第一条",
+        type:'warning'
+      })
+      this.listData.forEach((e,index)=>{
+        if (e[this.idname] == nowId) {
+          changeId = this.listData[index - 1][this.idname]
+          this.idx = index - 1
+        }
+      })
+      
+      this.$emit('pageChange',changeId,this.idx)
+      this.refresh()
     },
     onSuccess () {
       this.$emit('onEditSuccess')
@@ -259,6 +285,7 @@ export default {
     }
   },
   mounted () {
+    this.idx = this.$route.query.rowindex
   },
   created () {
     this.$emit('detailCreate',this.param)

+ 1 - 1
src/components/normal-basic-layout/drawerDetail/index.vue

@@ -23,7 +23,7 @@ export default {
       } else {
         key = this.idName
       }
-      let query = {id:this.data[key],rowindex:this.data.rowindex}
+      let query = {id:this.data[key],rowindex:this.data.rowindex - 1}
       this.$router.push({path:this.detailPath.path,query:Object.assign({},query,this.detailPath.param)})
       this.$store.dispatch('changeDetailDrawer',true)
     }

+ 3 - 0
src/components/normal-basic-layout/index.vue

@@ -156,6 +156,9 @@ export default {
       this.currentPage = res.pageNumber
       /* 请求的数据暴露出去 二次处理 */
       this.$emit('listData',this.list)
+
+      // 保存一下列表数据用于翻页
+      this.$store.dispatch('saveListData',this.list)
     },
     selectChange () {
       this.param.content.pageNumber = 1

+ 12 - 3
src/store/index.js

@@ -27,7 +27,8 @@ export default new Vuex.Store({
     closeDrawerTemp:false,
     DrawerShow:false,
     historyRouter:null,
-    pageCache:[]
+    pageCache:[],
+    listData:[]
   },
   getters: {
     siteinfo:state => state.siteinfo,
@@ -48,7 +49,8 @@ export default new Vuex.Store({
     sys_modules:state => state.sys_modules,
     historyRouter:state => state.historyRouter,
     isRouterAlive:state => state.isRouterAlive,
-    pageCache: status => status.pageCache
+    pageCache: state => state.pageCache,
+    listData:state => state.listData,
     
   },
   mutations: {
@@ -119,6 +121,9 @@ export default new Vuex.Store({
     setPageCache(state,res) {
       state.pageCache = res
     },
+    saveListData (state,data) {
+      state.listData = data
+    }
   },
   actions: {
     // 系统选项分类查询
@@ -290,7 +295,11 @@ export default new Vuex.Store({
 
     clearSearchValue ({commit},data) {
       commit('clearSearchValue')
-    }
+    },
+
+    saveListData ({commit},data) {
+      commit('saveListData',data)
+    },
 
   },
   modules: {