gangkou/ruoyi-ui/src/views/alarmMonitor/bound/index.vue

325 lines
12 KiB
Vue
Raw Normal View History

2024-09-03 22:09:21 +08:00
<template>
<div class="app-container">
<el-form :inline="true" :model="queryParams" ref="form">
<el-form-item label="选择部门" prop="deptId">
<dept-tree @deptChange="handleDeptChange" style="width: 150px" />
</el-form-item>
<el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="queryParams.name"></el-input>
</el-form-item>
<!-- <el-form-item label="设备编号" prop="sn">
2024-09-03 22:09:21 +08:00
<el-input v-model="queryParams.sn"></el-input>
</el-form-item> -->
2024-10-13 22:55:40 +08:00
<el-form-item label="处理状态">
<el-select v-model="queryParams.status" placeholder="请选择处理状态" style="width: 150px;">
<el-option label="正在处理" value="1"></el-option>
<el-option label="处理完成" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="处理人用户名" prop="dealUser">
<el-input v-model="queryParams.dealUser"></el-input>
</el-form-item>
<el-form-item>
<span>日期</span>
2024-10-13 22:55:40 +08:00
<el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
<el-form-item>
2024-10-13 22:55:40 +08:00
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dataList" height="700px">
2024-10-13 22:55:40 +08:00
<el-table-column prop="deptName" label="安装企业" header-align="center" align="center" />
<el-table-column prop="name" label="设备名称" header-align="center" align="center" />
<el-table-column prop="sn" label="设备编号" header-align="center" align="center" />
<el-table-column prop="reportTime" label="上报时间" header-align="center" align="center" />
<!-- <el-table-column prop="wd" label="设备温度" header-align="center" align="center"/>
2024-09-03 22:09:21 +08:00
<el-table-column prop="yl" label="设备压力" header-align="center" align="center"/> -->
<!-- <el-table-column prop="zl" label="传感器类型" header-align="center" align="center" /> -->
<!-- <el-table-column prop="lc" label="量程" header-align="center" align="center" /> -->
2024-10-13 22:55:40 +08:00
<el-table-column prop="ds" label="传感器读数" header-align="center" align="center">
<template slot-scope="scope">
<span style="color: red">
{{ scope.row.ds }}
</span>
<span style="color: #000">
{{ scope.row.dw }}
</span>
</template>
</el-table-column>
2024-10-13 22:55:40 +08:00
<el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808">
{{ scope.row.zt }}
</span>
<span v-if="scope.row.zt == '二级报警'" style="color: #e23434">
{{ scope.row.zt }}
</span>
</template>
</el-table-column>
2024-10-13 22:55:40 +08:00
<el-table-column prop="isDeal" label="处理状态" header-align="center" align="center">
<template slot-scope="scope">
2024-10-13 22:55:40 +08:00
<span @click="openDetailWindows(scope.row)" v-if="scope.row.status == 1"
style="color: orange;text-decoration: underline;cursor: pointer; "> 正在处理 </span>
<span @click="openDetailWindows(scope.row)" v-else-if="scope.row.status == 2"
style="color: green;text-decoration: underline;cursor: pointer;"> 处理完成 </span>
<span v-else style="color: red"> 未处理 </span>
</template>
</el-table-column>
2024-10-13 22:55:40 +08:00
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
2024-10-13 22:55:40 +08:00
<el-button size="mini" type="text" icon="el-icon-thumb" @click="handleUpdate(scope.row)">下发通知</el-button>
<!--v-if="userName == scope.row.dealUser" -->
2024-10-13 22:55:40 +08:00
<el-button size="mini" type="text" icon="el-icon-dish-1" @click="handleAlarm(scope.row)">处理报警</el-button>
<el-button size="mini" type="text" icon="el-icon-location-information"
@click="handleShowMap(scope.row)">查看位置</el-button>
</template>
</el-table-column>
</el-table>
<!-- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
2024-11-15 08:56:07 +08:00
@pagination="getList" /> -->
2024-10-13 22:55:40 +08:00
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="queryParams.pageNum" :page-sizes="[10, 20, 30, 50]" :page-size="queryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
<!--发送通知-->
2024-10-13 22:55:40 +08:00
<send-msg :deviceInfo="deviceInfo" v-if="isOpenMsg" :isOpenMsg="isOpenMsg" @closeMsg="closeMsg"></send-msg>
<!--处理报警-->
2024-10-13 22:55:40 +08:00
<deal-alarm :deviceInfo="deviceInfo" v-if="isOpenAlarm" :isOpenAlarm="isOpenAlarm"
@closeAlarm="closeAlarm"></deal-alarm>
<el-dialog :title="mapDialogTitle" :visible.sync="mapDialogVisible" width="30%">
<div>
2024-10-13 22:55:40 +08:00
<baidu-map :center="position" :zoom="16" :scroll-wheel-zoom="true" style="width: auto; height: 40vh"
:map-type="currentMapType">
<bm-map-type :map-types="['BMAP_NORMAL_MAP', 'BMAP_HYBRID_MAP']" anchor="BMAP_ANCHOR_TOP_LEFT"></bm-map-type>
<bm-marker :position="position"></bm-marker>
</baidu-map>
</div>
</el-dialog>
2024-10-13 22:55:40 +08:00
<!--处理详情-->
<el-dialog title="处理详情" :visible.sync="isOpenDetail" width="50%">
<div>
<el-form :model="detailParams" label-width="130px">
<!-- 处理状态 -->
<el-form-item>
<h3>处理状态</h3>
<p>{{ detailParams.status === '1' ? '正在处理' : '处理完成' }}</p>
</el-form-item>
<!-- 报警信息 -->
<el-form-item>
<h3>报警信息</h3>
<p>报警上报时间: <strong>{{ detailParams.reportTime }}</strong></p>
<p>报警值: <strong>{{ detailParams.ds }}</strong></p>
</el-form-item>
<!-- 处理过程 -->
<el-form-item>
<h3>处理过程</h3>
<p>处理时间: <strong>{{ detailParams.dealTime }}</strong></p>
</el-form-item>
<!-- 如果状态为 1 (正在处理) 展示处理人备注 -->
<el-form-item v-if="detailParams.status === '1'">
<h3>处理信息</h3>
<p>处理人: <strong>{{ detailParams.dealUser }}</strong></p>
<p>备注: <strong>{{ detailParams.remark }}</strong></p>
</el-form-item>
<el-form-item v-if="detailParams.fileUrl != null">
<h3>相关图片</h3>
<image-preview :src="detailParams.fileUrl" :width="50" :height="50" />
</el-form-item>
<!-- 如果状态为 2 (处理完成) 展示报警原因处理人处理方式 -->
<el-form-item v-if="detailParams.status === '2'">
<h3>处理结果</h3>
<p>报警原因: <strong>{{ detailParams.reason }}</strong></p>
<p>处理人: <strong>{{ detailParams.dealUser }}</strong></p>
<p>处理方式: <strong>{{ detailParams.dealWay }}</strong></p>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
2024-10-13 22:55:40 +08:00
import { listAlarm } from "@/api/demostrate/monitor";
import sendMsg from "@/views/demostrate/alarm/sendMsg";
import dealAlarm from "@/views/demostrate/alarm/dealAlarm";
import DeptTree from "@/components/DeptTree/index.vue";
import { BmlHeatmap } from "vue-baidu-map"; //引人
export default {
name: "alarm",
components: { sendMsg, dealAlarm, DeptTree, BmlHeatmap },
dicts: [],
data() {
return {
2024-10-13 22:55:40 +08:00
detailParams: {},
isOpenDetail: false,
loading: false,
deviceInfo: {},
isOpenMsg: false,
isOpenAlarm: false,
isExamSelect: [
{
value: "1",
label: "是",
disabled: true,
2024-09-03 22:09:21 +08:00
},
{
value: "0",
label: "否",
},
],
dateList: [],
dataList: [],
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
sn: null,
name: null,
dealUser: null,
isDeal: null,
startTime: null,
endTime: null,
factoryId: null,
deptId: null,
2024-10-13 22:55:40 +08:00
status: null
},
userName: "",
currentMapType: "BMAP_HYBRID_MAP",
mapDialogVisible: false,
position: { lng: 116.404, lat: 39.915 }, // 默认值,例如北京的中心点
};
},
created() {
// this.userName = store.getters.user.userName;
},
mounted() {
this.init();
},
methods: {
2024-10-13 22:55:40 +08:00
openDetailWindows(row) {
this.detailParams = row
this.isOpenDetail = true
},
async init() {
2024-09-05 12:01:00 +08:00
this.emitChange();
this.getList();
2024-09-05 12:01:00 +08:00
},
/**获取企业下拉框 */
handleDeptChange(value) {
this.queryParams.deptId = value.deptId;
this.emitChange();
},
emitChange() {
this.$nextTick(() => {
this.$emit("queryChange", {
deptId: this.queryParams.deptId,
});
});
},
getList() {
if (this.dateList && this.dateList.length > 0) {
this.queryParams.startTime = this.dateList[0];
this.queryParams.endTime = this.dateList[1];
} else {
this.queryParams.startTime = null;
this.queryParams.endTime = null;
}
this.loading = true;
listAlarm(this.queryParams).then((response) => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//发送通知
handleUpdate(row) {
this.deviceInfo = row;
this.isOpenMsg = true;
},
//处理报警
handleAlarm(row) {
this.deviceInfo = row;
this.isOpenAlarm = true;
},
closeMsg() {
this.isOpenMsg = false;
this.handleQuery();
},
closeAlarm() {
this.isOpenAlarm = false;
this.handleQuery();
},
resetQuery() {
this.queryParams.pageNum = 1;
this.queryParams.sn = null;
this.queryParams.name = null;
this.queryParams.isDeal = null;
this.queryParams.dealUser = null;
this.queryParams.startTime = null;
this.queryParams.endTime = null;
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
handleSizeChange(val) {
this.queryParams.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.queryParams.pageNum = val;
this.getList();
},
handleShowMap(row) {
this.position = {
lng: parseFloat(row.longitude),
lat: parseFloat(row.latitude),
};
this.mapDialogTitle = `读数:${row.ds}|低报值:${row.dbz}|高报值:${row.gbz}`;
this.mapDialogVisible = true;
},
},
};
</script>
<style lang="scss" scoped>
.app-container {
::v-deep .el-dialog {
.el-dialog__body {
padding: 0;
2024-09-03 22:09:21 +08:00
}
}
}
2024-10-13 22:55:40 +08:00
h3 {
margin-bottom: 5px; /* 标题与内容之间的间距 */
color: #409EFF; /* 标题颜色 */
}
p {
margin: 0; /* 去掉段落的默认边距 */
padding: 5px 0; /* 给段落增加上下内边距 */
}
2024-10-13 22:55:40 +08:00
strong {
color: #333; /* 强调文本颜色 */
}
</style>