Event_alarm.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div>
  3. <section class="mainbox">
  4. <div id="Event_content">
  5. <div class="back_all Cont_One">
  6. <div class="Ctn_Time">
  7. <span>选择时间范围 :</span>
  8. <el-date-picker
  9. v-model="defaultTime"
  10. type="datetimerange"
  11. start-placeholder="开始日期"
  12. end-placeholder="结束日期"
  13. range-separator="~"
  14. :disabledDate="disabledDate"
  15. >
  16. </el-date-picker>
  17. </div>
  18. <div class="Ctn_Time">
  19. <span>状态 :</span>
  20. <el-select
  21. id="state_select"
  22. popper-class="state_select"
  23. @change="state_select"
  24. v-model="value"
  25. placeholder="请选择"
  26. >
  27. <el-option
  28. v-for="(item, index) in options"
  29. :key="index"
  30. :label="item.label"
  31. :value="item.value"
  32. >
  33. </el-option>
  34. </el-select>
  35. </div>
  36. <div class="Ctn_Time">
  37. <el-button type="primary" class="Ctn_btn" @click="Api_all"
  38. >查询</el-button
  39. >
  40. </div>
  41. </div>
  42. <div class="back_all Cont_Two">
  43. <div class="title">事件告警统计</div>
  44. <div class="back_img"></div>
  45. <div>
  46. <Eventalarm></Eventalarm>
  47. </div>
  48. </div>
  49. <div class="back_all Cont_Three">
  50. <div class="title">事件告警列表</div>
  51. <div class="back_img"></div>
  52. <div class="three_ctn">
  53. <div class="cont_1">
  54. 总告警: <span>{{ count }}</span> 条
  55. </div>
  56. <div class="cont_2">
  57. 未处理告警数: <span>{{ unCount }}</span> 条
  58. </div>
  59. <el-button type="primary" class="Ctn_btn" @click="export_api"
  60. >导出</el-button
  61. >
  62. </div>
  63. <div class="table">
  64. <el-table
  65. v-loading="table_loading"
  66. empty-text=" "
  67. element-loading-text="拼命加载中"
  68. cell-class-name="Cont_Three_table"
  69. ref="multipleTable"
  70. :data="tableData"
  71. tooltip-effect="dark"
  72. max-height="345"
  73. @selection-change="handleSelectionChange"
  74. @row-dblclick="dblclick"
  75. >
  76. <el-table-column type="selection"> </el-table-column>
  77. <el-table-column
  78. v-for="table in $store.state.trendIco_table"
  79. :key="table"
  80. :prop="table.porp"
  81. :label="table.label"
  82. show-overflow-tooltip
  83. >
  84. </el-table-column>
  85. <template #empty v-if="table_loading == false">
  86. <div class="zwsj">
  87. <img src="./../../assets/images/No_data.png" alt="" />
  88. <p>暂无数据</p>
  89. </div>
  90. </template>
  91. </el-table>
  92. <div class="event_block">
  93. <el-pagination
  94. popper-class="event_page"
  95. @size-change="handleSizeChange"
  96. @current-change="handleCurrentChange"
  97. :current-page="currentPage"
  98. :page-sizes="[10, 20, 30, 40]"
  99. :page-size="pageSize"
  100. layout="total, sizes, prev, pager, next, jumper"
  101. :total="total"
  102. >
  103. </el-pagination>
  104. </div>
  105. <el-dialog
  106. title="告警处置"
  107. v-model="dialogFormVisible"
  108. custom-class="From_table"
  109. >
  110. <!-- {label:'处理人',porp:'handler'},
  111. {label:'处理人时间',porp:'handlingTime'}, -->
  112. <el-form :model="form">
  113. <el-form-item label="发生时间: ">
  114. <el-input
  115. v-model="form.soeTime"
  116. autocomplete="off"
  117. :disabled="true"
  118. ></el-input>
  119. </el-form-item>
  120. <el-form-item label="告警描述: ">
  121. <el-input
  122. v-model="form.measName"
  123. autocomplete="off"
  124. :disabled="true"
  125. ></el-input>
  126. </el-form-item>
  127. <el-form-item label="设备: ">
  128. <el-input
  129. v-model="form.deviceCode"
  130. autocomplete="off"
  131. :disabled="true"
  132. ></el-input>
  133. </el-form-item>
  134. <el-form-item label="告警类型: ">
  135. <el-input
  136. v-model="form.alarmName"
  137. autocomplete="off"
  138. :disabled="true"
  139. ></el-input>
  140. </el-form-item>
  141. <el-form-item label="状态: ">
  142. <el-select
  143. v-model="form.handlingStatus"
  144. placeholder="请选择"
  145. popper-class="state_select"
  146. >
  147. <el-option label="已处理" :value="1"></el-option>
  148. <el-option label="未处理" :value="0"></el-option>
  149. </el-select>
  150. </el-form-item>
  151. <el-form-item label="描述: ">
  152. <el-input
  153. type="textarea"
  154. v-model="form.describe"
  155. autocomplete="off"
  156. maxlength="30"
  157. show-word-limit
  158. ></el-input>
  159. </el-form-item>
  160. </el-form>
  161. <template #footer>
  162. <span class="dialog-footer">
  163. <el-button type="primary" @click="dialogFormVisible = false"
  164. >确 定</el-button
  165. >
  166. <el-button @click="dialogFormVisible = false"
  167. >取 消</el-button
  168. >
  169. </span>
  170. </template>
  171. </el-dialog>
  172. </div>
  173. </div>
  174. </div>
  175. </section>
  176. </div>
  177. </template>
  178. <script>
  179. import Eventalarm from "../site_ehcarts/Event_alarm.vue";
  180. import api from "@/api/site/Event_alarm";
  181. import { ElMessage } from "element-plus";
  182. export default {
  183. data() {
  184. return {
  185. options: [], //状态下拉列表值存储
  186. value: 0, //状态下拉列表默认值
  187. defaultTime: [
  188. new Date(
  189. this.$store.state.Time_All[0],
  190. this.$store.state.Time_All[1],
  191. 1,
  192. 0,
  193. 0,
  194. 0
  195. ),
  196. new Date(),
  197. ], //时间选择器v-model
  198. disabledDate(date) {
  199. return date.getTime() > new Date(); //公共时间选择器 控制当前时间之后的时间无法选择
  200. },
  201. table_loading: false, //事件告警列表->Loading 加载
  202. count: 0, //事件告警列表->总告警->api请求返回值存储
  203. unCount: 0, //事件告警列表->未处理告警数->api请求返回值存储
  204. tableData: [], //事件告警列表->表格api请求返回值存储
  205. multipleSelection: [], //事件告警列表->多选按钮事件处理
  206. dialogFormVisible: false, //事件告警列表->双击form表单隐藏显示控制
  207. form: {
  208. soeTime: "",
  209. measName: "",
  210. deviceCode: "",
  211. alarmName: "",
  212. handlingStatus: 0,
  213. handler: "",
  214. handlingTime: "",
  215. describe: "",
  216. }, //事件告警列表->form表单值绑定
  217. currentPage: 1, //事件告警列表->分页当前页数默认值
  218. pageSize: 10, //事件告警列表->每页几条
  219. total: 0, //事件告警列表->总条数
  220. };
  221. },
  222. name: "event_alarm",
  223. components: { Eventalarm },
  224. mounted() {
  225. this.trendIco_api();
  226. this.count_api();
  227. },
  228. methods: {
  229. /**
  230. * @form表单提交
  231. */
  232. dblclick(row, column, event) {
  233. column || event;
  234. this.dialogFormVisible = true;
  235. this.form.soeTime = row.soeTime;
  236. this.form.measName = row.measName;
  237. this.form.deviceCode = row.deviceCode;
  238. this.form.alarmName = row.alarmName;
  239. row.handlingStatus === "已处理"
  240. ? (this.form.handlingStatus = 1)
  241. : (this.form.handlingStatus = 0);
  242. this.form.handler = row.handler;
  243. this.form.handlingTime = row.handlingTime;
  244. },
  245. /**
  246. * @状态下拉框
  247. */
  248. state_select(val) {
  249. this.$store.state.trendIco_state = val;
  250. this.count_api();
  251. },
  252. /**
  253. * @查询按钮api请求
  254. */
  255. Api_all() {
  256. this.trendIco_api();
  257. this.count_api();
  258. },
  259. /**
  260. * @事件告警统计api请求
  261. */
  262. trendIco_api() {
  263. var _this = this;
  264. this.options = [];
  265. this.$store.commit("TimeAll_function", this.defaultTime);
  266. var time = this.$store.state.Time_Data;
  267. api
  268. .trendIco({
  269. siteId: _this.$store.state.siteId,
  270. startTime: time[0],
  271. endTime: time[1],
  272. queryType: _this.se_content,
  273. })
  274. .then((requset) => {
  275. if (requset.status === "SUCCESS") {
  276. _this.$store.state.trendIco_state = _this.value;
  277. _this.$store.state.trendIco = requset.data;
  278. requset.data.map((val, ind) => {
  279. _this.options.push({ label: val.name, value: ind });
  280. return;
  281. });
  282. } else {
  283. ElMessage.error(requset.msg);
  284. }
  285. });
  286. },
  287. /**
  288. * @事件告警列表api请求
  289. */
  290. count_api() {
  291. var _this = this;
  292. this.table_loading = true;
  293. this.$store.commit("TimeAll_function", this.defaultTime);
  294. var time = this.$store.state.Time_Data;
  295. api
  296. .count({
  297. startTime: time[0],
  298. endTime: time[1],
  299. siteId: _this.$store.state.siteId,
  300. })
  301. .then((requset) => {
  302. if (requset.status === "SUCCESS") {
  303. _this.count = requset.data.count;
  304. _this.unCount = requset.data.unCount;
  305. } else {
  306. ElMessage.error(requset.msg);
  307. }
  308. });
  309. api
  310. .page({
  311. siteId: _this.$store.state.siteId,
  312. startTime: time[0],
  313. endTime: time[1],
  314. status: _this.value == 0 ? null : _this.value,
  315. current: _this.currentPage,
  316. size: _this.pageSize,
  317. })
  318. .then((requset) => {
  319. if (requset.status === "SUCCESS") {
  320. _this.table_loading = false;
  321. // console.log(requset);
  322. _this.tableData = requset.data.records;
  323. _this.total = requset.data.total;
  324. _this.tableData.map((val) => {
  325. val.handlingStatus == 1
  326. ? (val.handlingStatus = "已处理")
  327. : (val.handlingStatus = "未处理");
  328. });
  329. // console.log(requset);
  330. } else {
  331. ElMessage.error(requset.msg);
  332. }
  333. });
  334. },
  335. /**
  336. * @事件告警列表导出xlsx
  337. */
  338. export_api() {
  339. var _this = this;
  340. this.$store.commit("TimeAll_function", this.defaultTime);
  341. var time = _this.$store.state.Time_Data;
  342. api
  343. .export({
  344. siteId: _this.$store.state.siteId,
  345. startTime: time[0],
  346. endTime: time[1],
  347. status: _this.value,
  348. })
  349. .then((requset) => {
  350. if (requset.status === "SUCCESS") {
  351. window.location.href =
  352. window.PLATFROM_CONFIG.fileUrl + requset.data;
  353. } else {
  354. ElMessage.error(requset.msg);
  355. }
  356. });
  357. },
  358. /**
  359. * @多选按钮事件处理
  360. */
  361. handleSelectionChange(val) {
  362. this.multipleSelection = val;
  363. },
  364. handleSizeChange(val) {
  365. this.pageSize = val;
  366. this.count_api();
  367. // console.log(`每页 ${val} 条`);
  368. },
  369. handleCurrentChange(val) {
  370. this.currentPage = val;
  371. this.count_api();
  372. // console.log(`当前页: ${val}`);
  373. },
  374. },
  375. };
  376. </script>
  377. <style>
  378. /**
  379. * @分页css样式
  380. */
  381. .event_block {
  382. margin-top: -10px;
  383. text-align: center;
  384. }
  385. .event_block .el-pagination__sizes .el-input__inner {
  386. margin-top: 0;
  387. width: 110px !important;
  388. border-radius: 3px !important;
  389. border: 1px solid rgba(3, 107, 119, 1) !important;
  390. color: #fff;
  391. }
  392. .event_block button {
  393. background-color: transparent !important;
  394. color: #fff !important;
  395. }
  396. .event_block .btn-prev {
  397. margin-right: 10px;
  398. }
  399. .event_block .el-pagination button:hover {
  400. color: rgba(3, 107, 119, 1) !important;
  401. }
  402. .event_block .el-pagination__total {
  403. color: #fff;
  404. }
  405. .event_block .el-pagination__jump .el-input__inner {
  406. margin-top: 0;
  407. width: 45px !important;
  408. color: #fff;
  409. }
  410. .event_block .el-pagination .el-pager li {
  411. width: 27px;
  412. height: 27px;
  413. min-width: 27px;
  414. line-height: 27px;
  415. background: #1c363f;
  416. color: #fff;
  417. border: 1px solid rgba(3, 107, 119, 1) !important;
  418. border-radius: 8px;
  419. margin-right: 10px;
  420. }
  421. .event_block .el-pagination .el-pager li.active {
  422. background: #016f6d;
  423. }
  424. .event_block .el-pagination .el-pagination__jump {
  425. color: #fff;
  426. }
  427. </style>
  428. <style>
  429. /**
  430. * @表单提交css样式
  431. */
  432. .From_table {
  433. width: 409px !important;
  434. height: 516px;
  435. background: transparent;
  436. background: url("~@/assets/images/back_from.png") no-repeat;
  437. background-size: cover;
  438. }
  439. .From_table .el-dialog__title {
  440. color: #00f4fd;
  441. font-size: 16px;
  442. font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular;
  443. font-weight: bold;
  444. line-height: 10px;
  445. }
  446. .From_table .el-dialog__headerbtn {
  447. background: url("~@/assets/images/close.png") no-repeat;
  448. background-size: cover;
  449. width: 16px;
  450. height: 16px;
  451. }
  452. .From_table .el-dialog__headerbtn .el-dialog__close {
  453. color: transparent;
  454. }
  455. .From_table .el-form-item__label {
  456. width: 80px;
  457. color: #00f4fd;
  458. }
  459. .From_table .el-form-item {
  460. margin-bottom: 10px;
  461. }
  462. .From_table .el-input__inner {
  463. width: 285px !important;
  464. color: #fff;
  465. }
  466. .From_table .el-input--suffix .el-input__inner {
  467. border-radius: 3px !important;
  468. border: 1px solid rgba(3, 107, 119, 1) !important;
  469. color: #fff;
  470. margin-top: 0px;
  471. }
  472. .From_table .el-scrollbar {
  473. width: 100%;
  474. }
  475. .From_table .el-textarea__inner {
  476. border: 1px solid rgba(3, 107, 119, 1);
  477. background-color: transparent;
  478. height: 103px !important;
  479. width: 98.5%;
  480. color: #fff;
  481. }
  482. .From_table .el-textarea .el-input__count {
  483. background-color: transparent;
  484. }
  485. .From_table .el-dialog__footer {
  486. text-align: center;
  487. }
  488. .From_table .el-dialog__footer .el-button:nth-child(1) {
  489. margin-right: 100px;
  490. }
  491. .From_table .el-button {
  492. min-height: 30px;
  493. padding: 10px 20px;
  494. }
  495. .From_table .el-dialog__body {
  496. padding: 15px 20px;
  497. }
  498. </style>
  499. <style>
  500. /**
  501. * 表格样式
  502. */
  503. .Cont_Three .table {
  504. margin: 0 15px;
  505. min-height: 345px;
  506. height: 100%;
  507. max-height: 85%;
  508. }
  509. .Cont_Three .table .el-table {
  510. background-color: rgba(0, 66, 78, 0) !important;
  511. max-height: 100% !important;
  512. height: 89%;
  513. overflow: auto;
  514. }
  515. .Cont_Three .table .el-table th {
  516. background-color: rgba(0, 66, 78, 0.5) !important;
  517. }
  518. .Cont_Three .table .el-table tr {
  519. background-color: rgba(0, 66, 78, 0) !important;
  520. }
  521. .Cont_Three .table .cell {
  522. color: #fff;
  523. }
  524. .Cont_Three .el-checkbox .el-checkbox__input .el-checkbox__inner {
  525. background-color: transparent;
  526. border: 1px solid rgba(1, 111, 109, 1);
  527. }
  528. .Cont_Three .el-checkbox__input.is-checked .el-checkbox__inner,
  529. .el-checkbox__input.is-indeterminate .el-checkbox__inner {
  530. background-color: rgba(1, 111, 109, 1) !important;
  531. }
  532. .Cont_Three .el-checkbox__inner::after {
  533. border: 1px solid rgba(0, 244, 253, 1);
  534. border-left: 0;
  535. border-top: 0;
  536. }
  537. .Cont_Three .el-table td,
  538. .el-table th.is-leaf {
  539. border-bottom: 1px solid rgba(1, 111, 109, 0.5);
  540. }
  541. .Cont_Three .el-table--border::after,
  542. .el-table--group::after,
  543. .el-table::before {
  544. background-color: transparent;
  545. }
  546. /*鼠标移入某行时的背景色*/
  547. .Cont_Three .el-table__body tr:hover > td {
  548. background-color: rgb(3, 61, 72, 1) !important;
  549. }
  550. .Cont_Three .el-table td,
  551. .el-table th {
  552. padding: 5px 0;
  553. }
  554. .Cont_Three .el-table__empty-block {
  555. padding-top: 80px;
  556. }
  557. </style>
  558. <style lang="less">
  559. /**
  560. * @下拉框样式
  561. */
  562. #state_select {
  563. width: 194px !important;
  564. border-radius: 3px !important;
  565. border: 1px solid rgba(3, 107, 119, 1) !important;
  566. color: #fff !important;
  567. }
  568. #Event_content .el-input__suffix {
  569. top: 0 !important;
  570. line-height: 30px !important;
  571. }
  572. #Event_content .el-input--suffix .el-select__caret {
  573. color: #01ccd7 !important;
  574. font-size: 15px !important;
  575. width: 16px !important;
  576. line-height: 30px !important;
  577. }
  578. .state_select {
  579. border: 1px solid rgba(0, 107, 119, 1) !important;
  580. > div {
  581. border: transparent !important;
  582. }
  583. }
  584. .state_select .el-scrollbar {
  585. width: 100%;
  586. }
  587. .state_select .el-popper__arrow::before {
  588. border: 1px transparent solid !important;
  589. background: rgba(0, 107, 119, 1) !important;
  590. }
  591. </style>
  592. <style scoped lang="less">
  593. #Event_content {
  594. width: 98%;
  595. height: 100%;
  596. margin: 0 auto;
  597. .Cont_One {
  598. min-height: 60px;
  599. margin-bottom: 10px;
  600. display: flex;
  601. .Ctn_Time {
  602. margin-left: 10px;
  603. margin-right: 40px;
  604. line-height: 60px;
  605. span {
  606. margin-right: 10px;
  607. }
  608. }
  609. }
  610. .Cont_Two {
  611. min-height: 35%;
  612. max-height: 35%;
  613. margin-bottom: 10px;
  614. }
  615. .Cont_Three {
  616. height: 54%;
  617. min-height: 54%;
  618. max-height: 55%;
  619. .three_ctn {
  620. min-height: 30px;
  621. display: flex;
  622. float: right;
  623. margin-top: 5px;
  624. margin-right: 15px;
  625. margin-bottom: 10px;
  626. }
  627. .three_ctn > div {
  628. display: block;
  629. line-height: 30px;
  630. font-size: 0.18rem;
  631. font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular;
  632. }
  633. .three_ctn div:nth-child(2) {
  634. margin-right: 1.8rem;
  635. }
  636. .three_ctn div:nth-child(1) {
  637. margin-right: 40px;
  638. }
  639. .three_ctn > div span {
  640. color: red;
  641. }
  642. }
  643. .title {
  644. font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular;
  645. font-weight: bold;
  646. padding-left: 10px;
  647. padding-top: 10px;
  648. font-size: 16px;
  649. }
  650. .back_img {
  651. width: 100%;
  652. height: 19px;
  653. background: url("~@/assets/images/title.png") no-repeat;
  654. background-size: cover;
  655. margin-top: -5px;
  656. }
  657. .Ctn_btn {
  658. height: 30px;
  659. min-height: 30px;
  660. line-height: 3px;
  661. }
  662. }
  663. #Event_content .back_all {
  664. background-color: rgba(0, 244, 253, 0.1);
  665. border: 1px solid rgba(0, 244, 253, 0.1);
  666. }
  667. </style>
  668. <style>
  669. /*
  670. 公共时间选择器css样式
  671. */
  672. #Event_content .el-input__inner {
  673. width: 414px;
  674. height: 30px !important;
  675. line-height: 30px !important;
  676. background-color: transparent;
  677. border: 1px solid rgba(3, 107, 119, 1);
  678. }
  679. #Event_content .el-range-input {
  680. background-color: transparent;
  681. color: #fff;
  682. }
  683. #Event_content .el-range-separator {
  684. line-height: 20px;
  685. color: #fff;
  686. }
  687. </style>