|
@@ -0,0 +1,209 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
+ <el-form-item label="设备名" prop="deviceName">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.deviceId"
|
|
|
+ placeholder="设备名"
|
|
|
+ clearable
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in deviceList"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.abbreviation"
|
|
|
+ :value="dict.deviceId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="日志类型" prop="status">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.status"
|
|
|
+ placeholder="日志类型"
|
|
|
+ clearable
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in deviceLogType"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="创建时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ style="width: 240px"
|
|
|
+ value-format="yyyy-MM-dd "
|
|
|
+ type="daterange"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ >导出
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+ <div>
|
|
|
+ <el-table v-loading="deviceLogList" :data="logList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="日志编号" prop="deviceLogId" :show-overflow-tooltip="true" align="center"/>
|
|
|
+ <el-table-column label="设备编号" prop="deviceId" align="center"/>
|
|
|
+ <el-table-column label="设备名称" prop="deviceName" :show-overflow-tooltip="true" align="center"/>
|
|
|
+ <el-table-column label="类型" prop="status" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-if="scope.row.status==1 ">信息</el-tag>
|
|
|
+ <el-tag v-else type="danger">报警</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="创建时间" prop="createTime" :show-overflow-tooltip="true" align="center"/>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-view"
|
|
|
+ @click="handleView(scope.row)"
|
|
|
+ v-hasPermi="['monitor:job:query']"
|
|
|
+ >详细
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <el-dialog title="日志详细" :visible.sync="open" width="700px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" label-width="100px" size="mini">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="日志序号:">{{ form.deviceLogId }}</el-form-item>
|
|
|
+ <el-form-item label="设备编号:">{{ form.deviceId }}</el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="设备名称:">{{ form.deviceName }}</el-form-item>
|
|
|
+ <el-form-item label="时间:">{{ form.createTime }}</el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="日志类型:">
|
|
|
+ <div v-if="form.status == 1">信息</div>
|
|
|
+ <div v-else-if="form.status == 2">报警</div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="日志内容:">{{ form.content }}</el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="open = false">关 闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+
|
|
|
+import {getDeviceList, getDeviceLog} from "../../../api/trace/device";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "log",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ total: 0,
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ logList: [],
|
|
|
+ deviceLogList: true,
|
|
|
+ dateRange: [],
|
|
|
+ showSearch: true,
|
|
|
+ deviceLogType: [
|
|
|
+ {value: 1, label: '信息'},
|
|
|
+ {value: 2, label: '报警'}
|
|
|
+ ],
|
|
|
+ deviceList: [],
|
|
|
+ form: {},
|
|
|
+ open: false,
|
|
|
+ ids:[],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList() {
|
|
|
+ this.deviceLogList = true;
|
|
|
+ let dateRange = Array.isArray(this.dateRange) ? this.dateRange : [];
|
|
|
+ if (dateRange.length>0){
|
|
|
+ this.queryParams.beginTime = dateRange[0]
|
|
|
+ this.queryParams.endTime = dateRange[1]
|
|
|
+ }
|
|
|
+ getDeviceLog(this.queryParams).then(response => {
|
|
|
+ this.logList = response.rows
|
|
|
+ this.total = response.total
|
|
|
+ this.deviceLogList = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ if (this.ids.length > 0) {
|
|
|
+ this.download('device/log/exportByIds', {
|
|
|
+ ids: this.ids.join(",")
|
|
|
+ }, `设备日志_${new Date().getTime()}.xlsx`)
|
|
|
+ } else {
|
|
|
+ this.download('/device/log/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `设备日志_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ resetQuery() {
|
|
|
+ this.queryParams = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }
|
|
|
+ this.dateRange = [];
|
|
|
+ },
|
|
|
+ handleView(row) {
|
|
|
+ this.open = true;
|
|
|
+ this.form = row;
|
|
|
+ },
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.deviceLogId)
|
|
|
+ this.single = selection.length != 1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getList()
|
|
|
+ getDeviceList().then(response => {
|
|
|
+ this.deviceList = response.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style scoped lang="scss">
|
|
|
+
|
|
|
+</style>
|