张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<template>
  <div class="main">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">设备名称:</span>
        <el-input v-model="deviceName" clearable placeholder="请输入设备名称"></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">采集时间:</span>
        <el-date-picker
          v-model="timeData"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd">
        </el-date-picker>
      </div>
      <div class="header_item">
        <el-button v-if="showButton('search')" icon="el-icon-search" @click="searchSanatoriumList(true)">查询</el-button>
        <el-button v-if="showButton('export')" icon="el-icon-download" >导出Excel</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="sanatoriumList"
        height="100%">
        <el-table-column label="序号" width="60" align="center">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="deviceName" label="设备名称" align="center"></el-table-column>
        <el-table-column prop="temp" label="温度" align="center"></el-table-column>
        <el-table-column prop="pipeNum" label="湿度" align="center"></el-table-column>
        <el-table-column prop="createTime" label="采集时间" align="center"></el-table-column>、
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>
 
<script>
import { buttonPinia } from '../../pinia';
  export default {
    data() {
      return {
        deviceName: '',
        timeData: '',
        loading: false,
        total: 0,
        pageNum: 1,
        pageSize: 10,
        sanatoriumList: [],
      }
    },
    mounted() {
 
    },
    methods: {
      // 查询静养区监测信息
      searchSanatoriumList(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        this.loading = true;
        this.sanatoriumList = [];
        this.$api.DuctpiecePLM.searchSanatoriumList({
          pageNum: this.pageNum,
          pageSize: this.pageSize
        }).then((res) => {
          if(res.success) {
            this.total = res.data.total;
            this.sanatoriumList = res.data.list;
          }
          this.loading = false;
        }).catch(() => {
          this.loading = false;
        })
      },
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchSanatoriumList();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchSanatoriumList();
      },
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },
    },
  }
</script>
 
<style lang="scss" scoped>
@import "../../style/layout-main.scss";
</style>