储能智慧云平台web端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <div>
  3. <div class="title">
  4. <el-select
  5. v-model="Singlevalue"
  6. collapse-tags
  7. placeholder="选择电站"
  8. popper-class="custom-header"
  9. :max-collapse-tags="1"
  10. style="width: 300px"
  11. size="large"
  12. @change="postemsDevice"
  13. >
  14. <el-option v-for="item in cities" :key="item.id" :label="item.stationName" :value="item.id" />
  15. </el-select>
  16. <div class="title_"></div>
  17. <el-select
  18. v-model="emsDeviceId"
  19. collapse-tags
  20. placeholder="选择设备编号"
  21. popper-class="custom-header"
  22. :max-collapse-tags="1"
  23. style="width: 240px"
  24. size="large"
  25. @change="getstationrealtime"
  26. >
  27. <el-option v-for="(item, index) in emsDevice" :key="index" :label="item.emsDeviceId" :value="item.id" />
  28. </el-select>
  29. </div>
  30. <div class="faultalarm">
  31. <el-card>
  32. <template #header>
  33. <div class="card-header">
  34. <div>告警图表</div>
  35. </div>
  36. </template>
  37. <div class="chart">
  38. <div ref="todaysalarm" class="todaysalarm"></div>
  39. <div ref="alarmlevel" class="alarmlevel"></div>
  40. <div ref="equipmenttype" class="equipmenttype"></div>
  41. </div>
  42. <div class="Alarmlist">
  43. <div class="Alarmlist_Alarm">告警列表</div>
  44. <div class="screen">
  45. <div class="screen_1">
  46. <div>设备类型:</div>
  47. <el-select v-model="quipment" placeholder="请选择设备类型" size="large" style="width: 240px">
  48. <el-option v-for="item in quipmentlist" :key="item.daviceClass" :label="item.name" :value="item.daviceClass" />
  49. </el-select>
  50. </div>
  51. <div class="screen_1">
  52. <div>告警等级:</div>
  53. <el-select v-model="alarm" placeholder="请选择告警等级" size="large" style="width: 240px">
  54. <el-option v-for="item in alarmlist" :key="item.code" :label="item.name" :value="item.code" />
  55. </el-select>
  56. </div>
  57. <div class="screen_1">
  58. <div>状态:</div>
  59. <el-select v-model="alarmstatus" placeholder="请选择状态" size="large" style="width: 240px">
  60. <el-option v-for="item in alarmstatuslist" :key="item.todayId" :label="item.name" :value="item.todayId" />
  61. </el-select>
  62. </div>
  63. <div class="screen_1">
  64. <div>处理建议:</div>
  65. <el-select v-model="proposal" placeholder="请选择处理建议" size="large" style="width: 240px">
  66. <el-option v-for="item in proposallist" :key="item.dictCode" :label="item.dictName" :value="item.dictCode" />
  67. </el-select>
  68. </div>
  69. </div>
  70. <div class="screentime">
  71. <div class="screen_1">
  72. <div>起止时间:</div>
  73. <el-date-picker
  74. size="large"
  75. v-model="timevalue"
  76. type="daterange"
  77. start-placeholder="开始时间"
  78. end-placeholder="结束时间"
  79. :default-value="timevalue"
  80. :disabled-date="pickerOptions"
  81. value-format="YYYY-MM-DD hh:mm:ss"
  82. />
  83. </div>
  84. <div class="screen_1">
  85. <el-button type="primary" size="large" @click="getpostpageInfo">查询</el-button>
  86. <el-button size="large" @click="onreset">重置</el-button>
  87. </div>
  88. </div>
  89. <div class="eltable">
  90. <el-table :data="tableData.records" style="width: 100%" border>
  91. <el-table-column prop="deviceName" label="设备名称" width="180" />
  92. <el-table-column prop="alarmname" label="告警等级" width="180" />
  93. <el-table-column prop="title" label="告警标题" />
  94. <el-table-column prop="kehu" label="客户告警" />
  95. <el-table-column prop="handlingdictName" label="处理建议" />
  96. <el-table-column prop="startDate" label="告警开始时间" />
  97. <el-table-column prop="endDate" label="告警结束时间" />
  98. <el-table-column prop="todayname" label="状态" />
  99. </el-table>
  100. </div>
  101. </div>
  102. </el-card>
  103. </div>
  104. </div>
  105. </template>
  106. <!-- -->
  107. <script setup lang="ts">
  108. import { onMounted, Ref, ref } from "vue";
  109. import {
  110. stationstationName,
  111. postemsSystemsingleStation,
  112. todayAlarm,
  113. postalarmLevel,
  114. postdeviceClass,
  115. posthandlingSugg,
  116. postpageInfo
  117. } from "@/api/home/Multisite";
  118. import * as echarts from "echarts";
  119. import { Station } from "@/api/interface";
  120. const currentDate = ref();
  121. const Singlevalue = ref("");
  122. const cities: Ref<Station.todo[]> = ref([]);
  123. const emsDevice: Ref<any[]> = ref([]);
  124. const emsDeviceId = ref("");
  125. const poststationstationName = async () => {
  126. const { data } = await stationstationName({});
  127. Singlevalue.value = data[0].id;
  128. cities.value = data;
  129. postemsDevice(Singlevalue.value);
  130. };
  131. const postemsDevice = async (value: any) => {
  132. emsDevice.value = [];
  133. const { data } = await postemsSystemsingleStation({}, value);
  134. emsDeviceId.value = data[0].id;
  135. emsDevice.value = data;
  136. getstationrealtime();
  137. };
  138. const getstationrealtime = async () => {
  139. gettodayAlarm();
  140. getalarmLevel();
  141. getpostdeviceClass();
  142. getpostpageInfo();
  143. };
  144. // 告警列表筛选
  145. const quipmentlist = ref();
  146. const alarmlist = ref();
  147. const alarmstatuslist = ref();
  148. const proposallist = ref();
  149. // 告警图表
  150. const todaysalarm = ref();
  151. const alarmlevel = ref();
  152. const equipmenttype = ref();
  153. // 今日告警
  154. const gettodayAlarm = async () => {
  155. const { data } = await todayAlarm({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
  156. let list = data.map(function (item) {
  157. return {
  158. value: item.cnt, // 将 cnt 键修改为 value
  159. name: item.name,
  160. todayId: item.todayId
  161. };
  162. });
  163. alarmstatuslist.value = list;
  164. setTimeout(function () {
  165. baropPiechart(list);
  166. }, 500);
  167. };
  168. const baropPiechart = (list: string | any[]) => {
  169. let piechart = echarts.init(todaysalarm.value);
  170. window.addEventListener(
  171. "resize",
  172. () => {
  173. piechart.resize();
  174. },
  175. false
  176. );
  177. let option1 = {
  178. tooltip: {
  179. trigger: "item"
  180. },
  181. title: [
  182. {
  183. text: "今日告警",
  184. right: "55px", // 设置标题水平居中
  185. top: "40px", // 设置标题距离容器顶部的距离
  186. textStyle: {
  187. fontSize: 14,
  188. fontWeight: "bold"
  189. }
  190. }
  191. ],
  192. legend: {
  193. show: true,
  194. orient: "vertical",
  195. right: "0%",
  196. bottom: "40%",
  197. icon: "circle",
  198. textStyle: {
  199. fontSize: 14,
  200. rich: {
  201. a: {
  202. fontSize: 14
  203. }
  204. }
  205. },
  206. formatter: function (name: string) {
  207. for (let index = 0; index < list.length; index++) {
  208. if (name == list[index].name) {
  209. return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
  210. }
  211. }
  212. }
  213. },
  214. series: [
  215. {
  216. type: "pie",
  217. radius: ["40%", "70%"],
  218. center: ["30%", "50%"],
  219. avoidLabelOverlap: false,
  220. label: {
  221. fontSize: 0,
  222. show: false
  223. },
  224. emphasis: {
  225. label: {
  226. show: true,
  227. fontSize: 0,
  228. fontWeight: "bold"
  229. }
  230. },
  231. labelLine: {
  232. show: false
  233. },
  234. data: list
  235. }
  236. ]
  237. };
  238. piechart.setOption(option1);
  239. };
  240. // 告警等级
  241. const getalarmLevel = async () => {
  242. const { data } = await postalarmLevel({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
  243. let list = data.map(function (item) {
  244. return {
  245. value: item.cnt, // 将 cnt 键修改为 value
  246. name: item.name,
  247. code: item.code
  248. };
  249. });
  250. alarmlist.value = list;
  251. setTimeout(function () {
  252. gradechart(list);
  253. }, 500);
  254. };
  255. // 告警等级
  256. const gradechart = (list: string | any[]) => {
  257. let grade = echarts.init(alarmlevel.value);
  258. window.addEventListener(
  259. "resize",
  260. () => {
  261. grade.resize();
  262. },
  263. false
  264. );
  265. let option1 = {
  266. tooltip: {
  267. trigger: "item"
  268. },
  269. title: [
  270. {
  271. text: "告警等级",
  272. right: "55px", // 设置标题水平居中
  273. top: "40px", // 设置标题距离容器顶部的距离
  274. textStyle: {
  275. fontSize: 14,
  276. fontWeight: "bold"
  277. }
  278. }
  279. ],
  280. legend: {
  281. show: true,
  282. orient: "vertical",
  283. right: "0%",
  284. bottom: "20%",
  285. icon: "circle",
  286. textStyle: {
  287. fontSize: 14,
  288. rich: {
  289. a: {
  290. fontSize: 14
  291. }
  292. }
  293. },
  294. formatter: function (name: string) {
  295. for (let index = 0; index < list.length; index++) {
  296. if (name == list[index].name) {
  297. return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
  298. }
  299. }
  300. }
  301. },
  302. series: [
  303. {
  304. type: "pie",
  305. radius: ["40%", "70%"],
  306. center: ["30%", "50%"],
  307. avoidLabelOverlap: false,
  308. label: {
  309. fontSize: 0,
  310. show: false
  311. },
  312. emphasis: {
  313. label: {
  314. show: true,
  315. fontSize: 0,
  316. fontWeight: "bold"
  317. }
  318. },
  319. labelLine: {
  320. show: false
  321. },
  322. data: list
  323. }
  324. ]
  325. };
  326. grade.setOption(option1);
  327. };
  328. // 设备类型
  329. const getpostdeviceClass = async () => {
  330. const { data } = await postdeviceClass({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
  331. let list = data.map(function (item) {
  332. return {
  333. value: item.cnt, // 将 cnt 键修改为 value
  334. name: item.name,
  335. daviceClass: item.daviceClass
  336. };
  337. });
  338. quipmentlist.value = list;
  339. setTimeout(function () {
  340. equipmentchart(list);
  341. }, 500);
  342. };
  343. // 设备类型
  344. const equipmentchart = (list: string | any[]) => {
  345. let equipment = echarts.init(equipmenttype.value);
  346. window.addEventListener(
  347. "resize",
  348. () => {
  349. equipment.resize();
  350. },
  351. false
  352. );
  353. let option1 = {
  354. tooltip: {
  355. trigger: "item"
  356. },
  357. title: [
  358. {
  359. text: "设备类型",
  360. left: "320px", // 设置标题水平居中
  361. top: "40px", // 设置标题距离容器顶部的距离
  362. textStyle: {
  363. fontSize: 14,
  364. fontWeight: "bold"
  365. }
  366. }
  367. ],
  368. legend: [
  369. {
  370. show: true,
  371. right: "0%",
  372. bottom: "40%",
  373. icon: "circle",
  374. orient: "vertical",
  375. textStyle: {
  376. fontSize: 14,
  377. rich: {
  378. a: {
  379. fontSize: 14
  380. }
  381. }
  382. },
  383. data: [
  384. {
  385. value: 0, // 将 cnt 键修改为 value
  386. code: 1,
  387. name: "PCS"
  388. },
  389. {
  390. value: 0, // 将 cnt 键修改为 value
  391. code: 2,
  392. name: "BMS"
  393. }
  394. ],
  395. formatter: function (name: string) {
  396. if (name == "PCS" || name == "BMS") {
  397. for (let index = 0; index < list.length; index++) {
  398. if (name == list[index].name) {
  399. return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
  400. }
  401. }
  402. }
  403. }
  404. },
  405. {
  406. show: true,
  407. right: "24%",
  408. bottom: "40%",
  409. icon: "circle",
  410. orient: "vertical",
  411. textStyle: {
  412. fontSize: 14,
  413. rich: {
  414. a: {
  415. fontSize: 14
  416. }
  417. }
  418. },
  419. formatter: function (name: string) {
  420. if (name == "电表" || name == "空调") {
  421. for (let index = 0; index < list.length; index++) {
  422. if (name == list[index].name) {
  423. return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
  424. }
  425. }
  426. }
  427. },
  428. data: [
  429. {
  430. value: 0, // 将 cnt 键修改为 value
  431. code: 2,
  432. name: "电表"
  433. },
  434. {
  435. value: 0, // 将 cnt 键修改为 value
  436. code: 2,
  437. name: "空调"
  438. }
  439. ]
  440. }
  441. ],
  442. series: [
  443. {
  444. type: "pie",
  445. radius: ["40%", "70%"],
  446. center: ["30%", "50%"],
  447. avoidLabelOverlap: false,
  448. label: {
  449. fontSize: 0,
  450. show: false
  451. },
  452. emphasis: {
  453. label: {
  454. show: true,
  455. fontSize: 0,
  456. fontWeight: "bold"
  457. }
  458. },
  459. labelLine: {
  460. show: false
  461. },
  462. data: list
  463. }
  464. ]
  465. };
  466. equipment.setOption(option1);
  467. };
  468. const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
  469. return time.getTime(new Date()) > Date.now();
  470. };
  471. const quipment = ref();
  472. const alarm = ref("");
  473. const proposal = ref("");
  474. const alarmstatus = ref("");
  475. const timevalue: Ref<any> = ref([]);
  476. // 处理建议
  477. const getposthandlingSugg = async () => {
  478. const { data } = await posthandlingSugg({});
  479. proposallist.value = data;
  480. };
  481. // 数据列表
  482. const tableData = ref();
  483. // 查询
  484. const getpostpageInfo = async () => {
  485. let obj = {
  486. stationId: Singlevalue.value,
  487. emsId: emsDeviceId.value,
  488. pn: 1,
  489. ps: 100,
  490. alarmId: alarm.value,
  491. handlingId: proposal.value,
  492. todayId: alarmstatus.value,
  493. startDate: timevalue.value[0],
  494. endDate: timevalue.value[1],
  495. devicesId: quipment.value
  496. };
  497. const { data } = await postpageInfo(obj);
  498. tableData.value = data;
  499. };
  500. // 重置
  501. const onreset = async () => {
  502. quipment.value = "";
  503. alarm.value = "";
  504. alarmstatus.value = "";
  505. proposal.value = "";
  506. timevalue.value[0] = "";
  507. timevalue.value[1] = "";
  508. getpostpageInfo();
  509. };
  510. onMounted(() => {
  511. const current = localStorage.getItem("currentDate");
  512. if (current) {
  513. currentDate.value = current;
  514. }
  515. poststationstationName();
  516. getposthandlingSugg();
  517. });
  518. </script>
  519. <style scoped lang="scss">
  520. @import "./index.scss";
  521. </style>