Blame view

HHECS.Web/src/views/deviceManage/deviceStateManage.vue 7.57 KB
陈嘉新 authored
1
<template>
陈嘉新 authored
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
  <div class="app-container">
    <el-form
      :model="queryConfig"
      ref="queryConfig"
      label-width="110px"
      style="margin-top: 15px"
      class="demo-queryConfig"
    >
      <el-row :gutter="10">
        <el-col :span="4">
          <el-form-item label="设备编码:" prop="">
            <el-input
              v-model="queryConfig.equipmentCode"
              placeholder="请选择设备编码"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="设备名称:" prop="">
            <el-input
              v-model="queryConfig.equipmentName"
              placeholder="请选择设备名称"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="设备状态:" prop="">
            <el-select
              v-model="queryConfig.equipmentStatus"
              placeholder="请选择设备类型"
            >
              <el-option
陈嘉新 authored
34
                v-for="item in deviceType"
陈嘉新 authored
35
36
37
38
39
40
41
42
43
44
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="记录状态:" prop="">
            <el-select
陈嘉新 authored
45
              v-model="queryConfig.recordStatus"
陈嘉新 authored
46
47
48
              placeholder="请选择设备类型"
            >
              <el-option
陈嘉新 authored
49
                v-for="item in recordStatus"
陈嘉新 authored
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
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="开始时间">
            <el-date-picker
              v-model="queryConfig.startTime"
              type="datetime"
              placeholder="选择日期时间"
              style="width: 99%"
            />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="结束时间">
            <el-date-picker
              v-model="queryConfig.endTime"
              type="datetime"
              placeholder="选择日期时间"
              style="width: 99%"
            />
          </el-form-item>
        </el-col>
        <el-col :span="23" class="button-col">
          <el-form-item label="" prop="">
            <el-button
              icon="el-icon-search"
              class="T1"
              @click="btnAction()"
              type="primary"
              size="small"
              >查询</el-button
            >
            <el-button class="T1" @click="goodsTypeModify()" disabled
              >导出</el-button
            >
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="table">
      <el-table
        :data="tableData"
        border
        stripe
        :height="TableHeight"
        @selection-change="handleSelectionChange"
        :header-cell-style="{ color: '#000000' }"
      >
        <el-table-column prop="id" label="id" width="80"> </el-table-column>
        <el-table-column prop="equipmentCode" label="设备编码">
        </el-table-column>
        <el-table-column prop="equipmentName" label="设备名称">
        </el-table-column>
        <el-table-column prop="equipmentStatus" label="设备状态">
        </el-table-column>
        <el-table-column prop="isEnd" label="是否结束"> </el-table-column>
        <el-table-column prop="duration" label="持续时间"> </el-table-column>
陈嘉新 authored
112
        <el-table-column prop="startTime" label="开始时间"> </el-table-column>
陈嘉新 authored
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
        <el-table-column prop="endTime" label="结束时间"> </el-table-column>
      </el-table>
      <div class="pagination-container">
        <el-pagination
          style="margin-top: 15px"
          align="center"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="queryConfig.currentPage"
          :page-sizes="[20, 50, 100]"
          :page-size="queryConfig.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        />
      </div>
    </div>
  </div>
陈嘉新 authored
130
</template>
陈嘉新 authored
131
<script>
陈嘉新 authored
132
133
134
135
import {
  GetDictWithDetailsLangs,
  GetEquipmentStatusRecordDtosByPage,
} from "@/api/deviceManage/deviceStateManage";
陈嘉新 authored
136
137
138
139
140
141
142
143
144
145
146
147
148
export default {
  data() {
    return {
      activeName: "alarmMessage",
      tableData: [],
      tableDataTwo: [],
      //查询条件
      queryConfig: {
        currentPage: 1,
        pageSize: 20,
        equipmentCode: "",
        equipmentName: "",
        equipmentStatus: "",
陈嘉新 authored
149
        recordStatus: "",
陈嘉新 authored
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
        startTime: this.$moment()
          .subtract(3, "days")
          .format("YYYY-MM-DD 00:00:00"),
        endTime: this.$moment().add(1, "days").format("YYYY-MM-DD 23:59:59"),
      },
      //新增修改条件
      elAddDialog: {
        code: "",
        name: "",
        equipmentTypeId: 0,
        connectName: "",
        ip: "",
        destinationArea: "",
        description: "",
        disable: false,
陈嘉新 authored
165
        recordType: "",
陈嘉新 authored
166
167
      },
      total: 0,
陈嘉新 authored
168
169
      deviceType: [],
      recordStatus: [],
陈嘉新 authored
170
171
172
173
      multipleSelection: [],
    };
  },
  created() {
陈嘉新 authored
174
175
    this.dictionary("EquipmentStatuses");
    this.dictionary("RecordStatuses");
陈嘉新 authored
176
177
178
179
180
181
182
183
184
185
186
    this.getTableList();
  },
  computed: {
    TableHeight() {
      return `calc(100vh - 350px )`;
    },
  },
  methods: {
    btnAction() {
      this.getTableList();
    },
陈嘉新 authored
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    dictionary(data) {
      let params = { Code: data };
      GetDictWithDetailsLangs(params).then((response) => {
        response.data.dictDetails.forEach((x) => {
          if (data == "EquipmentStatuses") {
            this.deviceType.push({ value: x.value, label: x.name });
            if (this.deviceType.length > 0) {
              this.queryConfig.equipmentStatus = this.deviceType[0].value;
            }
          } else if (data == "RecordStatuses") {
            this.recordStatus.push({ value: x.value, label: x.name });
            if (this.recordStatus.length > 0) {
              this.queryConfig.recordStatus = this.recordStatus[0].value;
            }
          }
        });
      });
    },
陈嘉新 authored
205
206
207
208
209
    //表格数据
    getTableList() {
      const params = {
        pageNumber: this.queryConfig.currentPage,
        perPageCount: this.queryConfig.pageSize,
陈嘉新 authored
210
        queryConfig: this.queryConfig,
陈嘉新 authored
211
212
      };
      this.listLoading = true;
陈嘉新 authored
213
      GetEquipmentStatusRecordDtosByPage(params).then((response) => {
陈嘉新 authored
214
        this.total = response.data.totalCount;
陈嘉新 authored
215
216
217
218
219
220
221
        response.data.data.forEach((x) => {
          if (x.isEnd == true) {
            x.isEnd = "是";
          } else {
            x.isEnd = "否";
          }
        });
陈嘉新 authored
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
        this.tableData = response.data.data;
        this.listLoading = false;
      });
    },
    //获取表格行数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //分页
    handleSizeChange(val) {
      this.queryConfig.pageSize = val;
      this.queryConfig.currentPage = 1;
      this.getTableList();
    },
    handleCurrentChange(val) {
      this.queryConfig.currentPage = val;
      this.getTableList();
    },
  },
};
</script>
<style>
.el-row {
  margin-bottom: 5px;
}
.table {
  border: 1px solid #e5e9f2;
}
.T1 {
  border: 1px solid #b3d8ff;
}
.pagination-container {
  text-align: center; /* 使分页组件靠右 */
  margin-top: 20px; /* 添加顶部间距 */
}
.button-col {
  display: flex;
  justify-content: flex-end; /* 按钮靠右对齐 */
}
.custom-input .el-input__inner {
  background-color: #ffeb3b; /* 设置输入框背景颜色为黄色 */
}
</style>