Commit 90fd5fb8 authored by xinzhedeai's avatar xinzhedeai

add:报警处理功能

parent 772d65f8
...@@ -39,44 +39,7 @@ export function update(data) { ...@@ -39,44 +39,7 @@ export function update(data) {
// 删除报警设置 // 删除报警设置
export function deleteAlarm(id) { export function deleteAlarm(id) {
return request({ return request({
url: '/sos/alarm/deleteAlarm'+id, url: '/sos/alarm/deleteAlarm/'+id,
method: 'delete' method: 'delete'
}) })
} }
// 添加聚集远程报警设置
export function addJujiSetting(id) {
return request({
url: '/sos/alarm/addRemoteGatherAlarmSetting',
method: 'post'
})
}
// 更新聚集远程报警设置
export function updateJujiSetting(id) {
return request({
url: '/sos/alarm/updateRemoteGatherAlarmSetting',
method: 'put'
})
}
// 删除聚集远程报警设置
export function deleteJujiSetting(id) {
return request({
url: '/sos/alarm/deleteRemoteGatherAlarmSetting',
method: 'delete'
})
}
// 查询聚集报警设置列表
export function getRemoteGatherAlarmSettingList(query) {
return request({
url: '/sos/alarm/getRemoteGatherAlarmSettingList',
method: 'get',
params: query
})
}
...@@ -65,24 +65,32 @@ ...@@ -65,24 +65,32 @@
<el-table-column label="SOS报警时间" align="center" prop="alarmTime" /> <el-table-column label="SOS报警时间" align="center" prop="alarmTime" />
<el-table-column label="报警地点经纬度" align="center"> <el-table-column label="报警地点经纬度" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.coordinates }}</div> <div>{{ scope.row.longitude }}</div>
<div>{{ scope.row.coordinates }}</div> <div>{{ scope.row.latitude }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="报警状态" align="center"> <el-table-column label="报警状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if="scope.row.alarmStatus !== 0" v-if="!scope.row.alarmStatus"
type="primary" type="primary"
size="mini" size="mini"
@click="handleDispose(scope.row)" @click="handleDispose(scope.row)"
> >
处置 处置
</el-button> </el-button>
<span v-if="scope.row.alarmStatus == 1">已处置</span> <span v-if="scope.row.alarmStatus">已处置</span>
</template>
</el-table-column>
<el-table-column label="解除原因" align="center" prop="relieveReason">
<template slot-scope="scope">
<span>{{
scope.row.otherReason
? scope.row.otherReason
: scope.row.relieveReason
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="解除原因" align="center" prop="relieveReason" />
<el-table-column label="解除人" align="center" prop="relieveBy" /> <el-table-column label="解除人" align="center" prop="relieveBy" />
<el-table-column label="解除时间" align="center" prop="relieveTime" /> <el-table-column label="解除时间" align="center" prop="relieveTime" />
</el-table> </el-table>
...@@ -101,8 +109,13 @@ ...@@ -101,8 +109,13 @@
:visible.sync="disposeDialogVisible" :visible.sync="disposeDialogVisible"
width="500px" width="500px"
> >
<el-form :model="disposeForm" ref="disposeFormRef" label-width="120px"> <el-form
<el-form-item label="选择解除报警原因" prop="reason" required> :model="disposeForm"
ref="disposeFormRef"
label-width="150px"
:rules="rules"
>
<el-form-item label="选择解除报警原因" prop="reason">
<div <div
v-for="item in reasonOptions" v-for="item in reasonOptions"
:key="item.dictValue" :key="item.dictValue"
...@@ -144,11 +157,6 @@ ...@@ -144,11 +157,6 @@
import { listInfo, update } from "@/api/jinrun/alarm"; import { listInfo, update } from "@/api/jinrun/alarm";
import { getDict } from "@/api/jinrun/common"; import { getDict } from "@/api/jinrun/common";
// 假设解除原因的字典类型为 'alarm_dispose_reason'
const ALARM_DISPOSE_REASON_DICT_TYPE = "alarm_dispose_reason";
// 假设其他原因的值为 'other'
const OTHER_REASON_VALUE = "other";
export default { export default {
name: "Info", name: "Info",
data() { data() {
...@@ -196,18 +204,96 @@ export default { ...@@ -196,18 +204,96 @@ export default {
form: { form: {
personType: "", personType: "",
}, },
// 校验规则
rules: {
reason: [
{
required: true,
message: "请选择解除报警原因",
trigger: "change",
},
],
otherReason: [
{
required: true,
message: "请输入其他解除原因",
trigger: "blur",
},
{
min: 1,
max: 200,
message: "其他原因长度应在 1 到 200 个字符之间",
trigger: "blur",
},
],
},
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getReasonOptions(); this.getReasonOptions();
this.getPersonTypeOptions();
}, },
methods: { methods: {
/** 获取人员类型下拉列表数据 */
getPersonTypeOptions() {
// 调用数据字典接口
getDict({ dictType: "person_type" })
.then((response) => {
this.personTypeOptions = response.records || [];
})
.catch((error) => {
this.$modal.msgError("获取人员类型数据失败");
console.error("获取人员类型数据失败:", error);
});
},
/** 提交解除报警 */
submitDispose() {
// 表单验证
this.$refs.disposeFormRef.validate((valid) => {
if (valid) {
// 构建提交参数
const submitData = {
// personId: this.disposeForm.personId,
alarmStatus: 1, // 设置为已处置状态
id: this.disposeForm.id,
relieveReason: this.disposeForm.reason,
};
if (this.disposeForm.reason === 0) {
submitData.otherReasons = this.disposeForm.otherReason;
}
// 调用后端接口
update(submitData)
.then((response) => {
if (response.code === 200) {
// 成功处理
this.$modal.msgSuccess("解除报警成功");
// 关闭弹窗
this.disposeDialogVisible = false;
// 刷新数据列表
this.getList();
} else {
// 处理失败
this.$modal.msgError(response.msg || "解除报警失败");
}
})
.catch((error) => {
// 处理网络错误等异常情况
console.error("解除报警失败:", error);
this.$modal.msgError("服务器错误,请稍后重试");
});
} else {
// 表单验证失败
return false;
}
});
},
/** 获取解除原因选项 */ /** 获取解除原因选项 */
getReasonOptions() { getReasonOptions() {
// 调用数据字典接口获取解除原因 // 调用数据字典接口获取解除原因
getDict({ dictType: ALARM_DISPOSE_REASON_DICT_TYPE }) getDict({ dictType: "relieve_reason" })
.then((response) => { .then((response) => {
this.reasonOptions = response.records || []; this.reasonOptions = response.records || [];
}) })
...@@ -229,8 +315,7 @@ export default { ...@@ -229,8 +315,7 @@ export default {
handleDispose(row) { handleDispose(row) {
// 重置表单 // 重置表单
this.disposeForm = { this.disposeForm = {
realName: row.realName, id: row.id,
personId: row.personId,
reason: "", reason: "",
otherReason: "", otherReason: "",
}; };
...@@ -242,7 +327,7 @@ export default { ...@@ -242,7 +327,7 @@ export default {
/** 处理原因选择变化 */ /** 处理原因选择变化 */
handleReasonChange(reason) { handleReasonChange(reason) {
// 当选择其他时显示文本框 // 当选择其他时显示文本框
this.showOtherReason = reason === OTHER_REASON_VALUE; this.showOtherReason = reason == 0;
// 如果不是其他,清空其他原因 // 如果不是其他,清空其他原因
if (!this.showOtherReason) { if (!this.showOtherReason) {
this.disposeForm.otherReason = ""; this.disposeForm.otherReason = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment