Blame view

HHECS.Web/src/views/logManage/components/deviceLog.vue 8.5 KB
陈嘉新 authored
1
2
<template>
  <div class="interfacel">
陈嘉新 authored
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
    <el-form
      :model="queryConfig"
      :rules="rules"
      ref="queryConfig"
      label-width="100px"
      class="demo-queryConfig"
    >
      <el-row :gutter="10">
        <el-col :span="3">
          <el-form-item label="设备名:" prop="name">
            <el-input v-model="queryConfig.equipmentCode"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="日志分类:" prop="name">
            <el-input v-model="queryConfig.logType"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="消息:" prop="name">
            <el-input v-model="queryConfig.message"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="日志级别:" prop="">
28
            <el-select v-model="queryConfig.bllResultCode" placeholder="请选择">
陈嘉新 authored
29
              <el-option
30
                v-for="item in optionsBllResult"
陈嘉新 authored
31
32
33
34
35
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
陈嘉新 authored
36
37
38
39
          </el-form-item>
        </el-col>
        <el-col :span="3.5">
          <el-form-item label="开始时间:" prop="">
陈嘉新 authored
40
41
42
43
44
            <el-date-picker
              v-model="form.startTime"
              type="datetime"
              placeholder="选择日期时间"
            />
陈嘉新 authored
45
46
47
48
          </el-form-item>
        </el-col>
        <el-col :span="3.5">
          <el-form-item label="结束时间:" prop="">
陈嘉新 authored
49
50
51
52
53
            <el-date-picker
              v-model="form.endTime"
              type="datetime"
              placeholder="选择日期时间"
            />
陈嘉新 authored
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="" prop="">
            <el-button
              icon="el-icon-search"
              class="T1"
              @click="btnAction()"
              type="primary"
              >查询</el-button
            >
            <el-button class="T1" @click="details()">查询情况</el-button>
            <!-- <el-button class="T1" @click="goodsTypeModify()" disabled
              >导出</el-button
            > -->
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
陈嘉新 authored
73
    <div class="table">
陈嘉新 authored
74
75
76
      <el-table
        :data="tableData"
        style="width: 100%"
77
        height="700"
陈嘉新 authored
78
        @selection-change="handleSelectionChange"
陈嘉新 authored
79
80
        :header-cell-style="{ background: '#d9ebfe', color: '#000000' }"
      >
陈嘉新 authored
81
82
83
84
85
        <el-table-column
          type="selection"
          align="center"
          width="55"
        ></el-table-column>
86
        <el-table-column prop="id" label="内置id" width="180">
陈嘉新 authored
87
        </el-table-column>
88
        <el-table-column prop="equipmentCode" label="设备名" width="180">
陈嘉新 authored
89
        </el-table-column>
90
91
92
93
94
95
        <el-table-column prop="logType" label="日志分类"> </el-table-column>
        <el-table-column prop="message" label="消息"> </el-table-column>
        <el-table-column prop="bllResultCode" label="日志级别">
        </el-table-column>
        <el-table-column prop="errorCode" label="报警代码"> </el-table-column>
        <el-table-column prop="created" label="创建时间"> </el-table-column>
陈嘉新 authored
96
97
98
99
100
101
102
103
104
105
106
107
108
      </el-table>
      <div class="pagination-container">
        <el-pagination
          background
          layout="prev, pager, next"
          :current-page="queryConfig.currentPage"
          :page-size="queryConfig.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
        >
        </el-pagination>
      </div>
    </div>
陈嘉新 authored
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
    <el-dialog title="系统日志详情" :visible.sync="dialogFormVisible">
      <div class="container" v-for="(item, index) in detailsData" :key="index">
        <div class="box">
          <div class="inner-left">内部id:</div>
          <div class="inner-right">{{ item.id }}</div>
        </div>
        <div class="box">
          <div class="inner-left">日志级别:</div>
          <div class="inner-right">{{ item.bllResultCode }}</div>
        </div>
        <div class="box">
          <div class="inner-left">设备编码:</div>
          <div class="inner-right">{{ item.equipmentCode }}</div>
        </div>
        <div class="box">
          <div class="inner-left">日志分类:</div>
          <div class="inner-right">{{ item.logType }}</div>
        </div>
        <div class="box">
          <div class="inner-left">开始时间:</div>
          <div class="inner-right">{{ item.created }}</div>
        </div>
        <div class="box">
          <div class="inner-left">结束时间:</div>
          <div class="inner-right">{{ item.update }}</div>
        </div>
        <div class="box">
          <div class="inner-left">报警代码:</div>
          <div class="inner-right">{{ item.errorCode }}</div>
        </div>
        <div class="box1">
          <div class="inner-left">消息:</div>
          <div class="inner-right">
            <el-input
              type="textarea"
              :autosize="{ minRows: 2, maxRows: 4 }"
              placeholder="请输入消息"
              v-model="item.message"
            />
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
陈嘉新 authored
155
156
157
  </div>
</template>
<script>
158
159
160
import {
  GetDictWithDetailsLangs,
  GetEquipmentExecutedLog,
陈嘉新 authored
161
  GetEquipmentExecutedLogById,
162
} from "@/api/logManage/index";
陈嘉新 authored
163
164
165
export default {
  data() {
    return {
166
      tableData: [],
陈嘉新 authored
167
168
169
      queryConfig: {
        currentPage: 1,
        pageSize: 20,
170
171
172
173
        equipmentCode: "",
        logType: "",
        message: "",
        bllResultCode: "",
陈嘉新 authored
174
175
176
177
178
179
180
181
      },
      total: 0,
      form: {
        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"),
      },
182
183
184
185
186
187
      optionsBllResult: [
        {
          value: "",
          label: "全部",
        },
      ],
陈嘉新 authored
188
189
190
      dialogFormVisible: false,
      multipleSelection: [],
      detailsData: [],
陈嘉新 authored
191
192
    };
  },
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
  created() {
    this.getFlag("LogLevelFlag");
    this.getTableList();
  },
  methods: {
    btnAction() {
      this.getTableList();
    },
    getFlag(data) {
      let params = { Code: data };
      GetDictWithDetailsLangs(params).then((response) => {
        response.data.dictDetails.forEach((x) => {
          this.optionsBllResult.push({ value: x.code, label: x.name });
        });
      });
    },
    getTableList() {
      const params = {
        pageNumber: this.queryConfig.currentPage,
        perPageCount: this.queryConfig.pageSize,
        queryConfig: {
          equipmentCode: this.queryConfig.equipmentCode,
          logType: this.queryConfig.logType,
          message: this.queryConfig.message,
          bllResultCode: this.queryConfig.bllResultCode,
          begin: this.form.startTime,
          end: this.form.endTime,
        },
      };
      this.listLoading = true;
      GetEquipmentExecutedLog(params).then((response) => {
        this.total = response.data.totalCount;
        this.tableData = response.data.data;
        this.listLoading = false;
      });
    },
    //   详情
    details() {
      if (this.multipleSelection.length == 0) {
        this.$alert("请选择一条数据!", "标题名称", {
          confirmButtonText: "确定",
        });
      } else {
陈嘉新 authored
236
237
238
239
240
241
242
        this.detailsData = [];
        let params = {
          id: this.multipleSelection[0].id,
        };
        GetEquipmentExecutedLogById(params).then((response) => {
          this.detailsData.push(response.data);
        });
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
        this.dialogFormVisible = true;
      }
    },
    //获取表格行数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //分页
    handleCurrentChange(page) {
      this.queryConfig.currentPage = page;
      this.getTableList();
    },
    validateNumber() {
      const regex = /^[0-9]*$/;
      this.numberError = regex.test(this.number) ? "" : "只能输入数字";
    },
  },
陈嘉新 authored
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
};
</script>
<style scoped lang="scss">
.interfacel {
  width: 100%;
}
.el-row {
  margin-bottom: 5px;
}
.interfacel-content {
  display: flex;
  border-radius: 4px;
  min-height: 46px;
  margin-bottom: 10px;
  align-items: center;
}
.table {
  border: 1px solid #e5e9f2;
}
.T1 {
  border: 1px solid #b3d8ff;
}
.pagination-container {
  text-align: center; /* 使分页组件靠右 */
  margin-top: 20px; /* 添加顶部间距 */
}
</style>