index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <div class="energy-warning">
  3. <el-card shadow="never" class="warning-card">
  4. <!-- 顶部统计卡片 -->
  5. <!-- <div class="statistics-cards">
  6. <el-row :gutter="15">
  7. <el-col :span="4">
  8. <div class="stat-card" style="background: #f9f1ff">
  9. <div class="stat-icon blue">
  10. <i class="el-icon-warning-outline"></i>
  11. </div>
  12. <div class="stat-content">
  13. <div class="stat-label">总用能告警次数</div>
  14. <div class="stat-value">{{ statistics.total }}<span class="unit">次</span></div>
  15. <div class="stat-trend up">同比昨日 +2.3% <span class="trend-icon up-icon">↗</span></div>
  16. </div>
  17. </div>
  18. </el-col>
  19. <el-col :span="3">
  20. <div class="stat-card" style="background: #eafdfb">
  21. <div class="stat-content">
  22. <div class="stat-label">告警未解除数量</div>
  23. <div class="stat-value">{{ statistics.unresolved }}<span class="unit">次</span></div>
  24. <div class="stat-trend up">同比昨日 +2.3% <span class="trend-icon up-icon">↗</span></div>
  25. </div>
  26. </div>
  27. </el-col>
  28. <el-col :span="3">
  29. <div class="stat-card" style="background: #f0f5ff">
  30. <div class="stat-content">
  31. <div class="stat-label">告警解除率</div>
  32. <div class="stat-value">{{ statistics.resolutionRate }}<span class="unit">%</span></div>
  33. <div class="stat-trend down">同比昨日 -2.3% <span class="trend-icon down-icon">↘</span></div>
  34. </div>
  35. </div>
  36. </el-col>
  37. <el-col :span="3">
  38. <div class="stat-card" style="background: #f7f1ff">
  39. <div class="stat-content">
  40. <div class="stat-label">本周告警次数</div>
  41. <div class="stat-value">{{ statistics.week }}<span class="unit">次</span></div>
  42. <div class="stat-trend up">同比上周 +2.3% <span class="trend-icon up-icon">↗</span></div>
  43. </div>
  44. </div>
  45. </el-col>
  46. <el-col :span="3">
  47. <div class="stat-card" style="background: #fdf9ea">
  48. <div class="stat-content">
  49. <div class="stat-label">本月告警数量</div>
  50. <div class="stat-value">{{ statistics.month }}<span class="unit">次</span></div>
  51. <div class="stat-trend up">同比上月 +2.3% <span class="trend-icon up-icon">↗</span></div>
  52. </div>
  53. </div>
  54. </el-col>
  55. <el-col :span="3">
  56. <div class="stat-card" style="background: #fbfff0">
  57. <div class="stat-content">
  58. <div class="stat-label">本年告警数量</div>
  59. <div class="stat-value">{{ statistics.year }}<span class="unit">次</span></div>
  60. <div class="stat-trend up">同比去年 +2.3% <span class="trend-icon up-icon">↗</span></div>
  61. </div>
  62. </div>
  63. </el-col>
  64. </el-row>
  65. </div> -->
  66. <!-- 搜索区域 -->
  67. <div class="search-area">
  68. <seek-page
  69. :seekList="seekList"
  70. @search="handleSearch"
  71. @reset="handleReset"
  72. :maxLength="4"
  73. style="flex: 1"
  74. >
  75. </seek-page>
  76. </div>
  77. <!-- 列表视图 -->
  78. <div class="list-view">
  79. <ele-pro-table
  80. :page-size="defPageSize"
  81. ref="table"
  82. row-key="id"
  83. :columns="columns"
  84. :datasource="datasource"
  85. :cache-key="cacheKeyUrl"
  86. autoAmendPage
  87. height="calc(100vh - 350px)"
  88. >
  89. <template v-slot:code="{ row }">
  90. <el-link
  91. type="primary"
  92. :underline="false"
  93. @click="handleProcess(row, 'view')"
  94. >
  95. {{ row.code }}
  96. </el-link>
  97. </template>
  98. <template v-slot:warningLevel="{ row }">
  99. <el-tag
  100. :type="getWarningLevelType(row.warningLevel)"
  101. size="small"
  102. effect="dark"
  103. >
  104. {{ getWarningLevelText(row.warningLevel) }}
  105. </el-tag>
  106. </template>
  107. <template v-slot:action="{ row }">
  108. <!-- <el-link
  109. type="primary"
  110. :underline="false"
  111. @click="handleProcess(row)"
  112. >接收</el-link
  113. > -->
  114. <el-link
  115. type="primary"
  116. :underline="false"
  117. v-if="row.handleStatus != 2"
  118. @click="handleProcess(row, 'edit')"
  119. >处理</el-link
  120. >
  121. <!-- <el-link
  122. type="primary"
  123. :underline="false"
  124. @click="handleTransfer(row)"
  125. style="margin-left: 8px"
  126. >转派</el-link
  127. > -->
  128. </template>
  129. </ele-pro-table>
  130. </div>
  131. <!-- 处理弹窗 -->
  132. <process-dialog ref="processDialogRef" @reload="$refs.table.reload()" />
  133. </el-card>
  134. </div>
  135. </template>
  136. <script>
  137. import dictMixins from '@/mixins/dictMixins';
  138. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  139. import ProcessDialog from './processDialog.vue';
  140. import { alarmlogsheetPage, remove } from '@/api/alarmConfiguration/index.js';
  141. export default {
  142. components: {
  143. ProcessDialog
  144. },
  145. mixins: [dictMixins, tableColumnsMixin],
  146. data() {
  147. return {
  148. // 统计数据
  149. statistics: {
  150. total: 2342,
  151. unresolved: 21,
  152. resolutionRate: 97.5,
  153. week: 32,
  154. month: 127,
  155. year: 1343
  156. },
  157. // 搜索表单
  158. searchForm: {
  159. energyType: '',
  160. keyword: '',
  161. warningLevel: '',
  162. reportTime: ''
  163. },
  164. // 更多查询条件
  165. moreForm: {
  166. user: '',
  167. dept: '',
  168. useDept: '',
  169. manager: '',
  170. device: ''
  171. },
  172. // 是否显示更多选项
  173. showMoreOptions: false,
  174. // 表格列配置
  175. columns: [
  176. {
  177. prop: 'code',
  178. label: '告警编码',
  179. align: 'center',
  180. slot: 'code',
  181. showOverflowTooltip: true,
  182. minWidth: 110
  183. },
  184. {
  185. prop: 'name',
  186. label: '告警名称',
  187. align: 'center',
  188. showOverflowTooltip: true,
  189. minWidth: 110
  190. },
  191. {
  192. prop: 'alarmLevel',
  193. label: '告警级别',
  194. align: 'center',
  195. showOverflowTooltip: true,
  196. minWidth: 110,
  197. formatter: (_row, _column, cellValue) => {
  198. return { 1: '提示', 2: '一般', 3: '严重', 4: '紧急', 5: '致命' }[
  199. cellValue
  200. ];
  201. }
  202. },
  203. {
  204. prop: 'areaName',
  205. label: '用能分区',
  206. align: 'center',
  207. showOverflowTooltip: true,
  208. minWidth: 150
  209. },
  210. {
  211. prop: 'energyClassificationName',
  212. label: '用能分类',
  213. align: 'center',
  214. showOverflowTooltip: true,
  215. minWidth: 150
  216. },
  217. {
  218. prop: 'energyTypeName',
  219. label: '能源名称',
  220. align: 'center',
  221. showOverflowTooltip: true,
  222. minWidth: 150
  223. },
  224. {
  225. prop: 'description',
  226. label: '告警描述',
  227. align: 'center',
  228. showOverflowTooltip: true,
  229. minWidth: 110
  230. },
  231. {
  232. prop: 'createTime',
  233. label: '告警时间',
  234. align: 'center',
  235. showOverflowTooltip: true,
  236. minWidth: 110
  237. },
  238. {
  239. prop: 'handleTime',
  240. label: '处理时间',
  241. align: 'center',
  242. showOverflowTooltip: true,
  243. minWidth: 110
  244. },
  245. {
  246. prop: 'handleUserName',
  247. label: '处理人',
  248. align: 'center',
  249. showOverflowTooltip: true,
  250. minWidth: 110
  251. },
  252. {
  253. prop: 'handleStatus',
  254. label: '状态',
  255. align: 'center',
  256. formatter: (_row, _column, cellValue) => {
  257. return { 0: '未处理', 1: '处理中', 2: '已处理' }[cellValue];
  258. },
  259. showOverflowTooltip: true,
  260. minWidth: 110
  261. },
  262. {
  263. columnKey: 'action',
  264. label: '操作',
  265. width: 150,
  266. align: 'center',
  267. fixed: 'right',
  268. slot: 'action'
  269. }
  270. ],
  271. cacheKeyUrl: 'ems-energy-warning-list'
  272. };
  273. },
  274. computed: {
  275. seekList() {
  276. return [
  277. // {
  278. // label: '用能类型',
  279. // value: 'energyType',
  280. // type: 'select',
  281. // placeholder: '全部',
  282. // planList: [
  283. // { value: '', label: '全部' },
  284. // { value: 'water', label: '水' },
  285. // { value: 'electric', label: '电' },
  286. // { value: 'gas', label: '气' }
  287. // ]
  288. // },
  289. {
  290. label: '关键词',
  291. value: 'keyword',
  292. type: 'input',
  293. width: '280px',
  294. placeholder: '编码、名称'
  295. },
  296. // {
  297. // label: '告警等级',
  298. // value: 'level',
  299. // type: 'select',
  300. // placeholder: '请选择',
  301. // planList: [
  302. // { value: 1, label: '提示' },
  303. // { value: 2, label: '一般' },
  304. // { value: 3, label: '严重' },
  305. // { value: 4, label: '紧急' },
  306. // { value: 5, label: '致命' }
  307. // ]
  308. // }
  309. ];
  310. }
  311. },
  312. methods: {
  313. // 获取告警等级类型
  314. getWarningLevelType(level) {
  315. const typeMap = {
  316. serious: 'danger',
  317. urgent: 'warning',
  318. normal: 'success'
  319. };
  320. return typeMap[level] || 'info';
  321. },
  322. // 获取告警等级文本
  323. getWarningLevelText(level) {
  324. const textMap = {
  325. serious: '严重',
  326. urgent: '紧急',
  327. normal: '一般'
  328. };
  329. return textMap[level] || level;
  330. },
  331. // 更多选项
  332. handleMoreOptions() {
  333. this.showMoreOptions = !this.showMoreOptions;
  334. },
  335. // 搜索
  336. handleSearch(where) {
  337. this.searchForm = { ...where };
  338. this.$refs.table.reload({ page: 1 });
  339. },
  340. // 重置
  341. handleReset() {
  342. this.searchForm = {
  343. energyType: '',
  344. keyword: '',
  345. warningLevel: '',
  346. reportTime: ''
  347. };
  348. this.moreForm = {
  349. user: '',
  350. dept: '',
  351. useDept: '',
  352. manager: '',
  353. device: ''
  354. };
  355. this.$refs.table.reload({ page: 1 });
  356. },
  357. // 表格数据源
  358. datasource({ page, limit, where, order }) {
  359. return alarmlogsheetPage({
  360. pageNum: page,
  361. size: limit,
  362. ...where
  363. });
  364. },
  365. // 处理
  366. handleProcess(row,type) {
  367. this.$refs.processDialogRef.open(row,type);
  368. },
  369. // 转派
  370. handleTransfer(row) {
  371. console.log('转派:', row);
  372. this.$message.info(`转派告警:${row.name}`);
  373. }
  374. }
  375. };
  376. </script>
  377. <style lang="scss" scoped>
  378. .energy-warning {
  379. .warning-card {
  380. height: calc(100vh - 100px);
  381. ::v-deep .el-card__body {
  382. height: 100%;
  383. padding: 15px;
  384. }
  385. }
  386. // 统计卡片
  387. .statistics-cards {
  388. margin-bottom: 20px;
  389. .stat-card {
  390. background: #f8f9fa;
  391. border: 1px solid #ebeef5;
  392. border-radius: 8px;
  393. padding: 15px;
  394. display: flex;
  395. align-items: center;
  396. transition: all 0.3s;
  397. &:hover {
  398. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  399. }
  400. .stat-icon {
  401. width: 48px;
  402. height: 48px;
  403. border-radius: 8px;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. margin-right: 12px;
  408. i {
  409. font-size: 24px;
  410. color: #fff;
  411. }
  412. &.blue {
  413. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  414. }
  415. &.red {
  416. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  417. }
  418. &.green {
  419. background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  420. }
  421. &.purple {
  422. background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  423. }
  424. &.orange {
  425. background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  426. }
  427. &.cyan {
  428. background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
  429. }
  430. }
  431. .stat-content {
  432. flex: 1;
  433. width: 100%;
  434. .stat-label {
  435. font-size: 12px;
  436. color: #909399;
  437. margin-bottom: 4px;
  438. }
  439. .stat-value {
  440. font-size: 24px;
  441. font-weight: 600;
  442. color: #303133;
  443. margin-bottom: 4px;
  444. .unit {
  445. font-size: 12px;
  446. font-weight: normal;
  447. color: #909399;
  448. margin-left: 4px;
  449. }
  450. }
  451. .stat-trend {
  452. font-size: 11px;
  453. &.up {
  454. color: #f56c6c;
  455. }
  456. &.down {
  457. color: #67c23a;
  458. }
  459. .trend-icon {
  460. display: inline-block;
  461. font-weight: bold;
  462. &.up-icon {
  463. color: #f56c6c;
  464. }
  465. &.down-icon {
  466. color: #67c23a;
  467. }
  468. }
  469. }
  470. }
  471. }
  472. }
  473. // 搜索区域
  474. .search-area {
  475. margin-bottom: 15px;
  476. padding-bottom: 15px;
  477. border-bottom: 1px solid #ebeef5;
  478. }
  479. // 工具栏
  480. .toolbar {
  481. margin-bottom: 15px;
  482. }
  483. // 列表视图
  484. .list-view {
  485. margin-bottom: 15px;
  486. ::v-deep .ele-pro-table {
  487. .el-table {
  488. border: 1px solid #ebeef5;
  489. border-radius: 4px;
  490. }
  491. }
  492. }
  493. // 更多查询条件
  494. .more-options-area {
  495. background: #f5f7fa;
  496. border: 1px solid #ebeef5;
  497. border-radius: 4px;
  498. padding: 15px;
  499. .more-options-title {
  500. font-size: 13px;
  501. color: #606266;
  502. margin-bottom: 10px;
  503. }
  504. .more-form {
  505. ::v-deep .el-form-item {
  506. margin-bottom: 10px;
  507. margin-right: 20px;
  508. }
  509. ::v-deep .el-form-item__label {
  510. font-size: 13px;
  511. color: #606266;
  512. }
  513. }
  514. }
  515. }
  516. </style>