guhongwei 4 rokov pred
rodič
commit
61793b2e21
1 zmenil súbory, kde vykonal 61 pridanie a 10 odobranie
  1. 61 10
      src/views/hall/productList/expertList.vue

+ 61 - 10
src/views/hall/productList/expertList.vue

@@ -18,7 +18,7 @@
               </el-col>
               <el-col :span="24" class="maintitle"><el-col :span="2" class="title">全部</el-col></el-col>
               <el-col :span="24">
-                <el-col :span="24" v-for="(item, index) in tableData" :key="index" class="list">
+                <el-col :span="24" v-for="(item, index) in list" :key="index" class="list">
                   <el-col :span="24"
                     ><el-col :span="22">{{ item.name }}</el-col
                     ><el-col :span="2" style="text-align: right;">
@@ -27,8 +27,15 @@
                   </el-col>
                 </el-col>
               </el-col>
-              <el-col :span="24">
-                <page v-bind="$attrs" position="center" :limit="limit" :total="total" @query="search"></page>
+              <el-col :span="24" class="page">
+                <el-pagination
+                  @current-change="handleCurrentChange"
+                  :current-page="currentPage"
+                  layout="total, prev, pager, next, jumper"
+                  :total="total"
+                  :page-size="pageSize"
+                >
+                </el-pagination>
               </el-col>
             </el-col>
           </div>
@@ -47,7 +54,7 @@ const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
 export default {
   name: 'dockDetail',
   props: {},
-  components: { page },
+  components: {},
   data: () => ({
     beijingPic: require('@a/live/top_3.png'),
     display: '1',
@@ -55,13 +62,20 @@ export default {
     scope: '123',
     resume: '123',
     dialogVisible: false,
-    tableData: [],
+
     dialogTableVisible: false,
     room: {},
     limit: 10,
-    total: 0,
+
     dock_id: '',
     dockInfo: {},
+    tableData: [],
+    total: 0,
+    // 分页
+    currentPage: 1,
+    pageSize: 10,
+    origin: [],
+    list: [],
   }),
   created() {
     this.$set(this, `dock_id`, this.$route.query.dockid);
@@ -73,12 +87,35 @@ export default {
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let res = await this.dockFetch(this.dock_id);
       this.$set(this, `dockInfo`, res.data);
-      res = await this.expertQuery({ skip, limit, ...info });
-      if (this.$checkRes(res)) {
-        this.$set(this, `tableData`, res.data);
-        this.$set(this, `total`, res.total);
+      let exportdata = await this.expertQuery({ skip, ...info });
+      if (this.$checkRes(exportdata)) {
+        if (this.dockInfo.room_id == '1001') {
+          let newRes = exportdata.data.filter(
+            i =>
+              i.company == '中科院长春分院' ||
+              i.company == '中国科学院东北地理与农业生态研究所' ||
+              i.company == '中国科学院长春应用化学研究所' ||
+              i.company == '中科院长春光学精密机械与物理研究所'
+          );
+          if (newRes) {
+            this.$set(this, `tableData`, newRes);
+            this.$set(this, `total`, newRes.length);
+          }
+        } else if (this.dockInfo.room_id == '1002') {
+          let newRes = exportdata.data.filter(f => f.company.includes('吉林大学'));
+          if (newRes) {
+            this.$set(this, `tableData`, newRes);
+            this.$set(this, `total`, newRes.length);
+          }
+        }
       }
     },
+    searchList(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
+    },
+    handleCurrentChange(currentPage) {
+      this.searchList(currentPage);
+    },
     back() {
       this.$router.push({ path: '/hall/direct', query: { id: this.dockid } });
     },
@@ -86,6 +123,16 @@ export default {
       this.$router.push({ path: '/live/hall/dock/zhanjiaduijie', query: { id: item.id, dockid: this.dockid } });
     },
   },
+  watch: {
+    tableData: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.searchList();
+      },
+    },
+  },
   computed: {
     ...mapState(['user']),
     dockid() {
@@ -208,4 +255,8 @@ p {
     background: #f2f2f2;
   }
 }
+.page {
+  text-align: center;
+  padding: 15px 0;
+}
 </style>