瀏覽代碼

科室质控页面跳转质控详情页面数据刷新问题

liyanyan 1 月之前
父節點
當前提交
4827ae2b16
共有 2 個文件被更改,包括 13 次插入4 次删除
  1. 3 2
      src/views/recordsRoom/qc/components/TableBox.vue
  2. 10 2
      src/views/recordsRoom/qc/index.vue

+ 3 - 2
src/views/recordsRoom/qc/components/TableBox.vue

@@ -135,8 +135,9 @@ export default {
     },
     toPage(row) {
       const { ZYH } = row;
-      localStorage.setItem('getData', ZYH);
-      this.$router.push({ path: '/qc/caseViews' });
+      this.$router.push({ path: '/qc/caseViews', query: {
+        ZYH
+      }});
     },
 
     /**

+ 10 - 2
src/views/recordsRoom/qc/index.vue

@@ -14,6 +14,7 @@ import SearchBoxVue from '@/views/recordsRoom/qc/components/SearchBox.vue'
 import TableBoxVue from '@/views/recordsRoom/qc/components/TableBox.vue'
 import pagination from '@/components/Pagination/index2.vue'
 import { getBlZkList, getQualityControlStatus } from '@/api/qc'
+let current = ''
 
 export default {
   components: {
@@ -31,7 +32,8 @@ export default {
         total: 0,
         currentPage: 1,
         pageSize: 10
-      }
+      },
+      current: ''
     }
   },
   created() {
@@ -40,8 +42,14 @@ export default {
   activated() {
     this.getList()
   },
+  beforeRouteEnter(to, from, next) {
+    current = from.query.ZYH || ''
+    // console.log('>>>>>>>>>111', a, b)
+    next()
+  },
   methods: {
     getList() {
+      console.log(1111111111111111, this.$route)
       this.loading = true
       getBlZkList({
         ...this.$refs.SearchBoxRef.formData,
@@ -52,7 +60,7 @@ export default {
         this.tableData = res.data.list
          // 切换选中状态
         Array.isArray(this.tableData) && this.tableData.map(item => {
-          item.selected = (item.ZYH == localStorage.getItem('getData')) ? !item.selected : false
+          item.selected = item.ZYH == current ? !item.selected : false
         })
       }).catch(error => {
         console.log(error)