Explorar o código

添加修改后翻页不重置

asd123a20 %!s(int64=2) %!d(string=hai) anos
pai
achega
812dff045e

+ 9 - 2
admin-code/src/views/Home.vue

@@ -43,6 +43,7 @@ export default {
   },
   data() {
     return {
+      page: 0,
       type: null,
       title: '',
       visibleSync: false,
@@ -96,6 +97,7 @@ export default {
     },
     // 查询
     async filterQuery({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
+      this.page = paging.page;
       if (this.type == null) {
         this.$message.error('请先选择类别');
         return;
@@ -155,8 +157,13 @@ export default {
           res = await this.codeCreate(e);
           msg = '字典添加成功';
         }
-        this.filterQuery();
-        this.$refs.filterList.resetPage(-1);
+        if (e._id) {
+          this.$refs.filterList.handleCurrentChange(this.page + 1);
+        } else {
+          this.$refs.filterList.resetPage(-1);
+        }
+        // this.filterQuery();
+        // this.$refs.filterList.resetPage(-1);
       } else {
         // 字典类别
         if (e._id) {

+ 8 - 4
admin-content/src/views/home.vue

@@ -179,7 +179,6 @@ export default {
       const authorList = localStorage.getItem('author');
       let list = authorList.split(',');
       list = list.map(e => ({ name: e }));
-      console.log(list);
       cb(list);
     },
     // 选择建议
@@ -238,13 +237,18 @@ export default {
         res = await this.contentsCreate(e);
         msg = '文章添加成功';
       }
+      if (e._id) {
+        // paging.page = this.page + 1;
+        this.$refs.filterList.handleCurrentChange(this.page + 1);
+      } else {
+        this.$refs.filterList.resetPage(-1);
+      }
       const author = localStorage.getItem('author');
       if (!this.handleAuthor) localStorage.setItem('author', `${author}, ${e.author}`);
       this.$resChange(res, msg);
-      const filter = { bind: this.types };
-      this.filterQuery({ filter });
+      // const filter = { bind: this.types };
+      // this.filterQuery({ filter, paging });
       this.visibleSync = false;
-      this.$refs.filterList.resetPage(-1);
       this.fileList = [];
       this.handleAuthor = false;
     },

+ 2 - 2
admin-frame/vue.config.js

@@ -34,8 +34,8 @@ module.exports = {
     port: 3000,
     proxy: {
       '/api/': {
-        // target: 'http://skl.cc-lotus.info'
-        target: 'http://127.0.0.1:18090'
+        target: 'http://skl.cc-lotus.info'
+        // target: 'http://127.0.0.1:18090'
       },
       '/upload/': {
         // target: 'http://127.0.0.1:9002'

+ 9 - 2
admin-img-news/src/views/home.vue

@@ -64,6 +64,7 @@ export default {
   },
   data() {
     return {
+      page: 0,
       myHeaders: { Authorization: token },
       title: '',
       visibleSync: false,
@@ -162,6 +163,7 @@ export default {
     },
     // 查询
     async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
+      this.page = paging.page;
       if (this.type == null) {
         this.$message.error('请先选择类型');
         return;
@@ -214,8 +216,13 @@ export default {
           res = await this.imgNewsCreate(e);
           msg = '内容添加成功';
         }
-        this.filterQuery();
-        this.$refs.filterList.resetPage(-1);
+        if (e._id) {
+          this.$refs.filterList.handleCurrentChange(this.page + 1);
+        } else {
+          this.$refs.filterList.resetPage(-1);
+        }
+        // this.filterQuery();
+        // this.$refs.filterList.resetPage(-1);
       } else {
         // 新闻类别
         if (e._id) {

+ 10 - 3
admin-menu/src/views/home.vue

@@ -52,6 +52,7 @@ export default {
   },
   data() {
     return {
+      page: 0,
       types: null,
       title: '',
       visibleSync: false,
@@ -125,6 +126,7 @@ export default {
     },
     // 查询
     async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
+      this.page = paging.page;
       if (this.types) filter.parentCode = this.types;
       await this.menusQuery({ filter, paging });
     },
@@ -144,12 +146,17 @@ export default {
         res = await this.menusCreate(e);
         msg = '菜单添加成功';
       }
-      const filter = { parentCode: this.types };
-      await this.filterQuery({ filter });
+      if (e._id) {
+        this.$refs.filterList.handleCurrentChange(this.page + 1);
+      } else {
+        this.$refs.filterList.resetPage(-1);
+      }
+      // const filter = { parentCode: this.types };
+      // await this.filterQuery({ filter });
       await this.menusQueryAll();
       this.$resChange(res, msg);
       this.visibleSync = false;
-      this.$refs.filterList.resetPage(-1);
+      // this.$refs.filterList.resetPage(-1);
     },
     async treeClick({ data, node }) {
       this.types = data.code;

+ 9 - 2
admin-page/src/views/home.vue

@@ -35,6 +35,7 @@ export default {
   },
   data() {
     return {
+      page: 0,
       title: '',
       visibleSync: false,
       filed: [
@@ -107,6 +108,7 @@ export default {
     },
     // 查询
     async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
+      this.page = paging.page;
       await this.pagesQuery({ filter, paging });
     },
     // 表单保存
@@ -125,10 +127,15 @@ export default {
         res = await this.pagesCreate(e);
         msg = '单页修改成功';
       }
+      if (e._id) {
+        this.$refs.filterList.handleCurrentChange(this.page + 1);
+      } else {
+        this.$refs.filterList.resetPage(-1);
+      }
       this.$resChange(res, msg);
-      this.filterQuery();
+      // this.filterQuery();
       this.visibleSync = false;
-      this.$refs.filterList.resetPage(-1);
+      // this.$refs.filterList.resetPage(-1);
     },
     // 富文本改变
     editChage (e) {