| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- <template>
- <div>
- <div class="title">
- <el-select
- v-model="Singlevalue"
- collapse-tags
- placeholder="选择电站"
- popper-class="custom-header"
- :max-collapse-tags="1"
- style="width: 300px"
- size="large"
- @change="postemsDevice"
- >
- <el-option v-for="item in cities" :key="item.id" :label="item.stationName" :value="item.id" />
- </el-select>
- <div class="title_"></div>
- <el-select
- v-model="emsDeviceId"
- collapse-tags
- placeholder="选择设备编号"
- popper-class="custom-header"
- :max-collapse-tags="1"
- style="width: 240px"
- size="large"
- @change="getstationrealtime"
- >
- <el-option v-for="(item, index) in emsDevice" :key="index" :label="item.emsDeviceId" :value="item.id" />
- </el-select>
- </div>
- <div class="faultalarm">
- <el-card>
- <template #header>
- <div class="card-header">
- <div>告警图表</div>
- </div>
- </template>
- <div class="chart">
- <div ref="todaysalarm" class="todaysalarm"></div>
- <div ref="alarmlevel" class="alarmlevel"></div>
- <div ref="equipmenttype" class="equipmenttype"></div>
- </div>
- <div class="Alarmlist">
- <div class="Alarmlist_Alarm">告警列表</div>
- <div class="screen">
- <div class="screen_1">
- <div>设备类型:</div>
- <el-select v-model="quipment" placeholder="请选择设备类型" size="large" style="width: 240px">
- <el-option v-for="item in quipmentlist" :key="item.daviceClass" :label="item.name" :value="item.daviceClass" />
- </el-select>
- </div>
- <div class="screen_1">
- <div>告警等级:</div>
- <el-select v-model="alarm" placeholder="请选择告警等级" size="large" style="width: 240px">
- <el-option v-for="item in alarmlist" :key="item.code" :label="item.name" :value="item.code" />
- </el-select>
- </div>
- <div class="screen_1">
- <div>状态:</div>
- <el-select v-model="alarmstatus" placeholder="请选择状态" size="large" style="width: 240px">
- <el-option v-for="item in alarmstatuslist" :key="item.todayId" :label="item.name" :value="item.todayId" />
- </el-select>
- </div>
- <div class="screen_1">
- <div>处理建议:</div>
- <el-select v-model="proposal" placeholder="请选择处理建议" size="large" style="width: 240px">
- <el-option v-for="item in proposallist" :key="item.dictCode" :label="item.dictName" :value="item.dictCode" />
- </el-select>
- </div>
- </div>
- <div class="screentime">
- <div class="screen_1">
- <div>起止时间:</div>
- <el-date-picker
- size="large"
- v-model="timevalue"
- type="daterange"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- :default-value="timevalue"
- :disabled-date="pickerOptions"
- value-format="YYYY-MM-DD hh:mm:ss"
- />
- </div>
-
- <div class="screen_1">
- <el-button type="primary" size="large" @click="getpostpageInfo">查询</el-button>
- <el-button size="large" @click="onreset">重置</el-button>
- </div>
- </div>
- <div class="eltable">
- <el-table :data="tableData.records" style="width: 100%" border>
- <el-table-column prop="deviceName" label="设备名称" width="180" />
- <el-table-column prop="alarmname" label="告警等级" width="180" />
- <el-table-column prop="title" label="告警标题" />
- <el-table-column prop="kehu" label="客户告警" />
- <el-table-column prop="handlingdictName" label="处理建议" />
- <el-table-column prop="startDate" label="告警开始时间" />
- <el-table-column prop="endDate" label="告警结束时间" />
- <el-table-column prop="todayname" label="状态" />
- </el-table>
- </div>
- </div>
- </el-card>
- </div>
- </div>
- </template>
- <!-- -->
- <script setup lang="ts">
- import { onMounted, Ref, ref } from "vue";
- import {
- stationstationName,
- postemsSystemsingleStation,
- todayAlarm,
- postalarmLevel,
- postdeviceClass,
- posthandlingSugg,
- postpageInfo
- } from "@/api/home/Multisite";
- import * as echarts from "echarts";
- import { Station } from "@/api/interface";
-
- const currentDate = ref();
- const Singlevalue = ref("");
- const cities: Ref<Station.todo[]> = ref([]);
- const emsDevice: Ref<any[]> = ref([]);
- const emsDeviceId = ref("");
- const poststationstationName = async () => {
- const { data } = await stationstationName({});
- Singlevalue.value = data[0].id;
- cities.value = data;
- postemsDevice(Singlevalue.value);
- };
- const postemsDevice = async (value: any) => {
- emsDevice.value = [];
- const { data } = await postemsSystemsingleStation({}, value);
- emsDeviceId.value = data[0].id;
- emsDevice.value = data;
- getstationrealtime();
- };
- const getstationrealtime = async () => {
- gettodayAlarm();
- getalarmLevel();
- getpostdeviceClass();
- getpostpageInfo();
- };
- // 告警列表筛选
- const quipmentlist = ref();
- const alarmlist = ref();
- const alarmstatuslist = ref();
- const proposallist = ref();
- // 告警图表
-
- const todaysalarm = ref();
- const alarmlevel = ref();
- const equipmenttype = ref();
- // 今日告警
- const gettodayAlarm = async () => {
- const { data } = await todayAlarm({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
- let list = data.map(function (item) {
- return {
- value: item.cnt, // 将 cnt 键修改为 value
- name: item.name,
- todayId: item.todayId
- };
- });
- alarmstatuslist.value = list;
- setTimeout(function () {
- baropPiechart(list);
- }, 500);
- };
- const baropPiechart = (list: string | any[]) => {
- let piechart = echarts.init(todaysalarm.value);
- window.addEventListener(
- "resize",
- () => {
- piechart.resize();
- },
- false
- );
- let option1 = {
- tooltip: {
- trigger: "item"
- },
- title: [
- {
- text: "今日告警",
- right: "55px", // 设置标题水平居中
- top: "40px", // 设置标题距离容器顶部的距离
- textStyle: {
- fontSize: 14,
- fontWeight: "bold"
- }
- }
- ],
- legend: {
- show: true,
- orient: "vertical",
- right: "0%",
- bottom: "40%",
- icon: "circle",
- textStyle: {
- fontSize: 14,
- rich: {
- a: {
- fontSize: 14
- }
- }
- },
- formatter: function (name: string) {
- for (let index = 0; index < list.length; index++) {
- if (name == list[index].name) {
- return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
- }
- }
- }
- },
- series: [
- {
- type: "pie",
- radius: ["40%", "70%"],
- center: ["30%", "50%"],
- avoidLabelOverlap: false,
- label: {
- fontSize: 0,
- show: false
- },
-
- emphasis: {
- label: {
- show: true,
- fontSize: 0,
- fontWeight: "bold"
- }
- },
- labelLine: {
- show: false
- },
- data: list
- }
- ]
- };
-
- piechart.setOption(option1);
- };
- // 告警等级
- const getalarmLevel = async () => {
- const { data } = await postalarmLevel({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
- let list = data.map(function (item) {
- return {
- value: item.cnt, // 将 cnt 键修改为 value
- name: item.name,
- code: item.code
- };
- });
- alarmlist.value = list;
- setTimeout(function () {
- gradechart(list);
- }, 500);
- };
- // 告警等级
-
- const gradechart = (list: string | any[]) => {
- let grade = echarts.init(alarmlevel.value);
- window.addEventListener(
- "resize",
- () => {
- grade.resize();
- },
- false
- );
- let option1 = {
- tooltip: {
- trigger: "item"
- },
- title: [
- {
- text: "告警等级",
- right: "55px", // 设置标题水平居中
- top: "40px", // 设置标题距离容器顶部的距离
- textStyle: {
- fontSize: 14,
- fontWeight: "bold"
- }
- }
- ],
- legend: {
- show: true,
- orient: "vertical",
- right: "0%",
- bottom: "20%",
- icon: "circle",
- textStyle: {
- fontSize: 14,
- rich: {
- a: {
- fontSize: 14
- }
- }
- },
- formatter: function (name: string) {
- for (let index = 0; index < list.length; index++) {
- if (name == list[index].name) {
- return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
- }
- }
- }
- },
- series: [
- {
- type: "pie",
- radius: ["40%", "70%"],
- center: ["30%", "50%"],
- avoidLabelOverlap: false,
- label: {
- fontSize: 0,
- show: false
- },
-
- emphasis: {
- label: {
- show: true,
- fontSize: 0,
- fontWeight: "bold"
- }
- },
- labelLine: {
- show: false
- },
- data: list
- }
- ]
- };
-
- grade.setOption(option1);
- };
- // 设备类型
- const getpostdeviceClass = async () => {
- const { data } = await postdeviceClass({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
- let list = data.map(function (item) {
- return {
- value: item.cnt, // 将 cnt 键修改为 value
- name: item.name,
- daviceClass: item.daviceClass
- };
- });
-
- quipmentlist.value = list;
- setTimeout(function () {
- equipmentchart(list);
- }, 500);
- };
- // 设备类型
- const equipmentchart = (list: string | any[]) => {
- let equipment = echarts.init(equipmenttype.value);
- window.addEventListener(
- "resize",
- () => {
- equipment.resize();
- },
- false
- );
- let option1 = {
- tooltip: {
- trigger: "item"
- },
- title: [
- {
- text: "设备类型",
- left: "320px", // 设置标题水平居中
- top: "40px", // 设置标题距离容器顶部的距离
- textStyle: {
- fontSize: 14,
- fontWeight: "bold"
- }
- }
- ],
- legend: [
- {
- show: true,
- right: "0%",
- bottom: "40%",
- icon: "circle",
- orient: "vertical",
- textStyle: {
- fontSize: 14,
- rich: {
- a: {
- fontSize: 14
- }
- }
- },
- data: [
- {
- value: 0, // 将 cnt 键修改为 value
- code: 1,
- name: "PCS"
- },
- {
- value: 0, // 将 cnt 键修改为 value
- code: 2,
- name: "BMS"
- }
- ],
- formatter: function (name: string) {
- if (name == "PCS" || name == "BMS") {
- for (let index = 0; index < list.length; index++) {
- if (name == list[index].name) {
- return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
- }
- }
- }
- }
- },
- {
- show: true,
- right: "24%",
- bottom: "40%",
- icon: "circle",
- orient: "vertical",
- textStyle: {
- fontSize: 14,
- rich: {
- a: {
- fontSize: 14
- }
- }
- },
- formatter: function (name: string) {
- if (name == "电表" || name == "空调") {
- for (let index = 0; index < list.length; index++) {
- if (name == list[index].name) {
- return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
- }
- }
- }
- },
- data: [
- {
- value: 0, // 将 cnt 键修改为 value
- code: 2,
- name: "电表"
- },
- {
- value: 0, // 将 cnt 键修改为 value
- code: 2,
- name: "空调"
- }
- ]
- }
- ],
- series: [
- {
- type: "pie",
- radius: ["40%", "70%"],
- center: ["30%", "50%"],
- avoidLabelOverlap: false,
- label: {
- fontSize: 0,
- show: false
- },
-
- emphasis: {
- label: {
- show: true,
- fontSize: 0,
- fontWeight: "bold"
- }
- },
- labelLine: {
- show: false
- },
- data: list
- }
- ]
- };
-
- equipment.setOption(option1);
- };
- const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
- return time.getTime(new Date()) > Date.now();
- };
-
- const quipment = ref();
- const alarm = ref("");
- const proposal = ref("");
- const alarmstatus = ref("");
- const timevalue: Ref<any> = ref([]);
-
- // 处理建议
-
- const getposthandlingSugg = async () => {
- const { data } = await posthandlingSugg({});
- proposallist.value = data;
- };
- // 数据列表
- const tableData = ref();
- // 查询
- const getpostpageInfo = async () => {
- let obj = {
- stationId: Singlevalue.value,
- emsId: emsDeviceId.value,
- pn: 1,
- ps: 100,
- alarmId: alarm.value,
- handlingId: proposal.value,
- todayId: alarmstatus.value,
- startDate: timevalue.value[0],
- endDate: timevalue.value[1],
- devicesId: quipment.value
- };
- const { data } = await postpageInfo(obj);
- tableData.value = data;
- };
- // 重置
- const onreset = async () => {
- quipment.value = "";
- alarm.value = "";
- alarmstatus.value = "";
- proposal.value = "";
- timevalue.value[0] = "";
- timevalue.value[1] = "";
- getpostpageInfo();
- };
- onMounted(() => {
- const current = localStorage.getItem("currentDate");
- if (current) {
- currentDate.value = current;
- }
-
- poststationstationName();
- getposthandlingSugg();
- });
- </script>
- <style scoped lang="scss">
- @import "./index.scss";
- </style>
|