2025-03-31 18:24:37 +08:00
|
|
|
<template>
|
|
|
|
<div class="deviceStatistics card">
|
|
|
|
<div class="card-head">
|
2025-04-08 18:31:37 +08:00
|
|
|
<div class="title">告警列表</div>
|
2025-03-31 18:24:37 +08:00
|
|
|
<div class="condition">
|
2025-04-08 18:31:37 +08:00
|
|
|
<el-input style="width: 240px" v-model="search" placeholder="搜索设备IMEI号" :suffix-icon="Search" @input="handleInput" />
|
2025-03-31 18:24:37 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-04-10 13:33:38 +08:00
|
|
|
<TableCustom :columns="columns" :tableData="tableData" :paging="page" :changePage="changePage">
|
2025-03-31 18:24:37 +08:00
|
|
|
<template #location="{ rows }">
|
2025-04-11 18:46:52 +08:00
|
|
|
<el-button type="success" link :icon="View" v-if="rows.warnType == 0 || rows.warnType == 1" @click="toIncidentDispose(rows.id)"> 查看 </el-button>
|
2025-03-31 18:24:37 +08:00
|
|
|
</template>
|
2025-04-28 17:18:11 +08:00
|
|
|
<template #warnType="{ rows }">
|
|
|
|
{{ warnTypeEnum[rows.warnType] }}
|
|
|
|
</template>
|
2025-04-08 18:31:37 +08:00
|
|
|
<template #status="{ rows }">
|
|
|
|
<el-tag :type="rows.status == 1 ? 'success' : 'danger'">
|
|
|
|
{{ statusEnum[rows.status] }}
|
2025-03-31 18:24:37 +08:00
|
|
|
</el-tag>
|
|
|
|
</template>
|
|
|
|
</TableCustom>
|
|
|
|
</div>
|
|
|
|
</template>
|
2025-04-08 18:31:37 +08:00
|
|
|
<script setup lang="ts">
|
2025-04-10 13:33:38 +08:00
|
|
|
import { PropType, ref } from "vue";
|
2025-03-31 18:24:37 +08:00
|
|
|
import { Search, View } from "@element-plus/icons-vue";
|
2025-04-10 13:33:38 +08:00
|
|
|
import TableCustom from "@/components/table-custom.vue";
|
2025-04-08 18:31:37 +08:00
|
|
|
import { debounce } from "@/utils";
|
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
import { TWarnRecord } from "@/api/index.d";
|
|
|
|
|
2025-04-10 13:33:38 +08:00
|
|
|
interface TPaging {
|
|
|
|
page: number;
|
|
|
|
size: number;
|
|
|
|
total: number;
|
2025-04-12 18:35:54 +08:00
|
|
|
deviceId?: number | string;
|
2025-04-10 13:33:38 +08:00
|
|
|
}
|
|
|
|
|
2025-04-08 18:31:37 +08:00
|
|
|
const router = useRouter();
|
|
|
|
enum statusEnum {
|
|
|
|
"待处理",
|
|
|
|
"已处理",
|
|
|
|
}
|
2025-04-28 17:18:11 +08:00
|
|
|
enum warnTypeEnum {
|
|
|
|
"SOS告警",
|
|
|
|
"围栏告警",
|
|
|
|
"破坏告警",
|
|
|
|
"低电告警",
|
|
|
|
"心率告警",
|
|
|
|
"血氧告警",
|
|
|
|
"体温告警",
|
|
|
|
}
|
2025-04-08 18:31:37 +08:00
|
|
|
const search = ref("");
|
|
|
|
|
|
|
|
const { tableData, page, getData, changePage } = defineProps({
|
2025-03-31 18:24:37 +08:00
|
|
|
tableData: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
page: {
|
2025-04-10 13:33:38 +08:00
|
|
|
type: Object as PropType<TPaging>,
|
|
|
|
default: () => ({
|
|
|
|
page: 1,
|
|
|
|
size: 10,
|
|
|
|
total: 0,
|
|
|
|
}),
|
2025-03-31 18:24:37 +08:00
|
|
|
},
|
|
|
|
getData: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
changePage: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
// 表格相关
|
|
|
|
let columns = [
|
|
|
|
{ type: "index", label: "序号", width: 55, align: "center" },
|
2025-04-08 18:31:37 +08:00
|
|
|
{ prop: "deviceId", label: "IMEI号" },
|
2025-04-28 17:18:11 +08:00
|
|
|
{ prop: "warnType", label: "事件类型" },
|
2025-04-08 18:31:37 +08:00
|
|
|
{ prop: "createTime", label: "时间" },
|
2025-03-31 18:24:37 +08:00
|
|
|
{ prop: "location", label: "地理位置" },
|
2025-04-08 18:31:37 +08:00
|
|
|
{ prop: "status", label: "处理状态" },
|
2025-03-31 18:24:37 +08:00
|
|
|
];
|
2025-04-08 18:31:37 +08:00
|
|
|
const handleInput = debounce((e) => {
|
|
|
|
page.deviceId = e;
|
|
|
|
getData();
|
|
|
|
}, 500);
|
|
|
|
|
2025-04-11 18:46:52 +08:00
|
|
|
const toIncidentDispose = (id: string) => {
|
2025-04-08 18:31:37 +08:00
|
|
|
router.push({
|
|
|
|
path: "/incidentDispose",
|
2025-04-11 18:46:52 +08:00
|
|
|
query: { id },
|
2025-04-08 18:31:37 +08:00
|
|
|
});
|
|
|
|
};
|
2025-03-31 18:24:37 +08:00
|
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
|
|
.card {
|
|
|
|
height: 100%;
|
|
|
|
background: #ffffff;
|
|
|
|
padding: 16px 10px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: hidden;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2025-04-01 13:52:57 +08:00
|
|
|
border-radius: 5px;
|
|
|
|
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
|
2025-04-01 18:07:18 +08:00
|
|
|
margin-bottom: 20px;
|
2025-03-31 18:24:37 +08:00
|
|
|
.card-head {
|
|
|
|
color: #061451;
|
2025-04-08 18:31:37 +08:00
|
|
|
font-size: 18px;
|
2025-03-31 18:24:37 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
2025-04-01 13:52:57 +08:00
|
|
|
transform: translateX(-10px);
|
2025-03-31 18:24:37 +08:00
|
|
|
.title {
|
|
|
|
&::before {
|
|
|
|
display: inline-block;
|
|
|
|
margin-right: 10px;
|
|
|
|
content: "";
|
|
|
|
width: 2px;
|
|
|
|
height: 14px;
|
|
|
|
border-radius: 20px;
|
|
|
|
background: #061451;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.condition {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
margin-left: 20px;
|
|
|
|
.condition-time {
|
|
|
|
border: 1px solid #dcdfe6;
|
|
|
|
overflow: hidden;
|
|
|
|
margin-left: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|