Forráskód Böngészése

返回带筛选条件

zhouna 5 éve
szülő
commit
01f732bbd2

+ 1 - 1
src/components/qualityControl/AddQualityControlTemp.vue

@@ -1,6 +1,6 @@
 <template>
     <div @click="closeSearch">
-       <crumbs :title="title" linkTo="QualityControlTemp">
+       <crumbs :title="title" :param="$route.params" linkTo="QualityControlTemp">
         </crumbs>
         <div class="contentWrapper">
             <div class="content">

+ 30 - 12
src/components/qualityControl/BaseFieldList.vue

@@ -17,9 +17,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button size="mini" @click="filterDatas">确认</el-button>
-                    <router-link to="/admin/LT-ZKYMSJWH-TJZDYSWH" style="margin:0 10px">
-                        <el-button size="mini" type="warning">添加字段映射</el-button>
-                    </router-link>
+                    <el-button size="mini" type="warning" @click="addBaseField">添加字段映射</el-button>
                 </el-form-item>
             </el-form>
         </crumbs>
@@ -109,12 +107,12 @@
     data: function () {
       return {
         list: [],
-        cacheData: {},
         tagType:[1],
         currentPage: 1,
         pageSize: 10,
         total: 0,
         fieldTypes:[],
+        searched:false,
         hisTypes:[],
         filter: {
           hospitalId:'',
@@ -125,7 +123,25 @@
     },
     created() {
       this.getAllTypes();
-      this.getDataList();
+      const _this=this;
+      setTimeout(function() {
+        _this.getDataList();
+      },100);
+    },
+    watch:{
+      'filter':{
+        handler:function(){
+          this.searched = false;
+        },
+        deep:true
+      }
+    },
+    beforeRouteEnter(to, from, next){
+      next(vm => {
+        //const pm = to.param;
+        Object.assign(vm,to.params);
+        vm.inCurrentPage=to.params.currentPage;
+      })
     },
     methods: {
       moduleFormatter(item){
@@ -154,6 +170,13 @@
           }
         });
       },
+      addBaseField(){
+        const pam = this.searched ? {
+          currentPage: this.currentPage,
+          filter: this.filter
+        } : {currentPage: this.currentPage};
+        this.$router.push({name: 'FieldMatch', params: pam});
+      },
       toEditField(row,type){
         api.getFieldDetail({id:row.id}).then((res)=>{
           const {code,data,msg} = res.data;
@@ -188,11 +211,11 @@
       },
       getDataList() {
         const param = this.getFilterItems();
+        this.searched = true;
         api.getFieldList(param).then((res) => {
           if (res.data.code == '0') {
             const data = res.data.data;
             this.list = data.records;
-            this.cacheData[param.current] = data.records;
             this.total = data.total;
           }
         }).catch((error) => {
@@ -201,7 +224,6 @@
       },
       getFilterItems() {
         const param = Object.assign({
-          tagTypeList:this.tagType,
           current: this.currentPage,
           size: this.pageSize
         },this.filter);
@@ -212,11 +234,7 @@
       },
       currentChange(next) {
         this.currentPage = next;
-        if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
-          this.list = this.cacheData[next];
-        } else {
-          this.getDataList();
-        }
+        this.getDataList();
       },
       warning(msg,type){
         this.$message({

+ 30 - 12
src/components/qualityControl/CombineFeildList.vue

@@ -17,9 +17,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button size="mini" @click="filterDatas">确认</el-button>
-                    <router-link to="/admin/LT-ZKYMSJWH-TJZHDYWH" style="margin:0 10px">
-                        <el-button size="mini" type="warning">添加组合字段</el-button>
-                    </router-link>
+                    <el-button size="mini" type="warning"  @click="addCombineField">添加组合字段</el-button>
                 </el-form-item>
             </el-form>
         </crumbs>
@@ -89,7 +87,7 @@
     data: function () {
       return {
         list: [],
-        cacheData: {},
+        searched:false,
         tagType:[4],
         currentPage: 1,
         pageSize: 10,
@@ -105,7 +103,25 @@
     },
     created() {
       this.getAllTypes();
-      this.getDataList();
+      const _this=this;
+      setTimeout(function() {
+        _this.getDataList();
+      },100);
+    },
+    watch:{
+      'filter':{
+        handler:function(){
+          this.searched = false;
+        },
+        deep:true
+      }
+    },
+    beforeRouteEnter(to, from, next){
+      next(vm => {
+        //const pm = to.param;
+        Object.assign(vm,to.params);
+        vm.inCurrentPage=to.params.currentPage;
+      })
     },
     methods: {
       moduleFormatter(item){
@@ -134,6 +150,13 @@
           }
         });
       },
+      addCombineField(){
+        const pam = this.searched ? {
+          currentPage: this.currentPage,
+          filter: this.filter
+        } : {currentPage: this.currentPage};
+        this.$router.push({name: 'AddCombineFeild', params: pam});
+      },
       toEditField(row,type){
         api.getFieldDetail({id:row.id}).then((res)=>{
           const {code,data,msg} = res.data;
@@ -168,11 +191,11 @@
       },
       getDataList() {
         const param = this.getFilterItems();
+        this.searched = true;
         api.getFieldList(param).then((res) => {
           if (res.data.code == '0') {
             const data = res.data.data;
             this.list = data.records;
-            this.cacheData[param.current] = data.records;
             this.total = data.total;
           }
         }).catch((error) => {
@@ -181,7 +204,6 @@
       },
       getFilterItems() {
         const param =  Object.assign({
-          tagTypeList:this.tagType,
           current: this.currentPage,
           size: this.pageSize
         },this.filter);
@@ -192,11 +214,7 @@
       },
       currentChange(next) {
         this.currentPage = next;
-        if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
-          this.list = this.cacheData[next];
-        } else {
-          this.getDataList();
-        }
+        this.getDataList();
       },
       warning(msg,type){
         this.$message({