Преглед изворни кода

fix 中心列表查询 回填

Michael Wang пре 6 година
родитељ
комит
51a4cc7083
2 измењених фајлова са 64 додато и 2 уклоњено
  1. 63 1
      src/modules/basic/view/campus.vue
  2. 1 1
      src/modules/basic/view/course.vue

+ 63 - 1
src/modules/basic/view/campus.vue

@@ -306,6 +306,7 @@
         </el-table>
         <div class="page pull-right">
           <el-pagination
+            v-if="paginationShow"
             @current-change="handleCurrentChange"
             :current-page="currentPage"
             :page-size="pageSize"
@@ -445,6 +446,20 @@ export default {
           this.tableData = response.data.list;
           this.total = response.data.total;
           this.loading = false;
+
+          this.$router.push({
+            path: "/basic/campus",
+            query: {
+              parentId: this.formSearch.parentId,
+              code: this.formSearch.code,
+              name: this.formSearch.name,
+              currentPage: this.currentPage,
+              pageSize: this.pageSize
+            }
+          });
+          this.$nextTick(function() {
+            this.paginationShow = true;
+          });
         })
         .finally(() => (this.fileLoading = false));
     },
@@ -674,13 +689,60 @@ export default {
 
       this.$httpWithMsg.get(CORE_API + "/org/getRootOrgList").then(response => {
         this.rootOrgList = response.data;
-        this.formSearch.parentId = this.user.rootOrgId;
+        if (this.formSearch.parentId === null)
+          this.formSearch.parentId = this.user.rootOrgId;
         this.searchForm();
       });
     }
   },
+  // beforeRouteEnter(to, from, next) {
+  //   next(vm => {
+  //     console.log("beforeRouteEnter: formSearch", vm.formSearch);
+  //     vm.formSearch.parentId = to.$route.query.parentId || "";
+  //     vm.formSearch.code = to.$route.query.code || "";
+  //     vm.formSearch.name = to.$route.query.name || "";
+  //     vm.currentPage = parseInt(to.$route.query.currentPage) || vm.currentPage;
+  //     vm.pageSize = parseInt(to.$route.query.pageSize) || vm.pageSize;
+  //   });
+  // },
+  // beforeRouteLeave(to, from, next) {
+  //   // this.$router.push(to);
+  //   // next();
+  //   // this.$route.query = {
+  //   //   parentId: this.formSearch.parentId,
+  //   //   code: this.formSearch.code,
+  //   //   name: this.formSearch.name,
+  //   //   currentPage: this.currentPage,
+  //   //   pageSize: this.pageSize
+  //   // };
+  //   // next();
+  //   this.$router.push({
+  //     path: "/basic/campus",
+  //     query: {
+  //       parentId: this.formSearch.parentId,
+  //       code: this.formSearch.code,
+  //       name: this.formSearch.name,
+  //       currentPage: this.currentPage,
+  //       pageSize: this.pageSize
+  //     }
+  //   });
+  //   setTimeout(() => {
+  //     console.log("settimeout next");
+  //     next();
+  //   }, 500);
+  // },
   //初始化查询
   created() {
+    this.formSearch.parentId = parseInt(this.$route.query.parentId);
+    if (isNaN(this.formSearch.parentId)) {
+      this.formSearch.parentId = null;
+    }
+    this.formSearch.code = this.$route.query.code || "";
+    this.formSearch.name = this.$route.query.name || "";
+    this.currentPage =
+      parseInt(this.$route.query.currentPage) || this.currentPage;
+    this.pageSize = parseInt(this.$route.query.pageSize) || this.pageSize;
+
     this.init();
     this.uploadHeaders = {
       key: this.user.key,

+ 1 - 1
src/modules/basic/view/course.vue

@@ -116,7 +116,7 @@
         </el-button>
         <el-button
           size="small"
-          type="warning"
+          type="danger"
           @click="disableByIds"
           :disabled="noBatchSelected"
           icon="el-icon-close"