dialog.info.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div class="alarm-info">
  3. <DialogCom title="告警详情" :visible.sync="isShow" width="1200px" >
  4. <div class="page-body">
  5. <el-descriptions class="margin-top" :column="2" size="medium" border :label-style="labelStyle" :contentStyle="content_style">
  6. <el-descriptions-item labelClassName="gx_info_label" label="机构名称">
  7. {{formData.orgName}}
  8. </el-descriptions-item>
  9. <el-descriptions-item labelClassName="gx_info_label" label="告警分类" >
  10. {{dataTypeText()}}
  11. </el-descriptions-item>
  12. <el-descriptions-item labelClassName="gx_info_label" label="告警类型" >
  13. {{formData.sourceTypeDes}}
  14. </el-descriptions-item>
  15. <el-descriptions-item labelClassName="gx_info_label" label="告警开始时间" >
  16. {{formData.time}}
  17. </el-descriptions-item>
  18. <el-descriptions-item labelClassName="gx_info_label" label="告警结束时间" >
  19. {{formData.endTime}}
  20. </el-descriptions-item>
  21. <el-descriptions-item labelClassName="gx_info_label" label="告警值" >
  22. {{valueText()}}
  23. </el-descriptions-item>
  24. <el-descriptions-item labelClassName="gx_info_label" label="告警内容" >
  25. {{formData.content}}
  26. </el-descriptions-item>
  27. <el-descriptions-item labelClassName="gx_info_label" label="处置时间" >
  28. {{formData.doTime}}
  29. </el-descriptions-item>
  30. <el-descriptions-item labelClassName="gx_info_label" label="处置人" >
  31. {{formData.doByUser}}
  32. </el-descriptions-item>
  33. <el-descriptions-item labelClassName="gx_info_label" label="处置类型" >
  34. {{ getLabel(dict.type.alarm_deal_type, formData.doType, "")}}
  35. </el-descriptions-item>
  36. <el-descriptions-item span="2" labelClassName="gx_info_label" label="处置内容" >
  37. {{formData.doContent}}
  38. </el-descriptions-item>
  39. </el-descriptions>
  40. </div>
  41. <div slot="footer" class="dialog-footer">
  42. <el-button @click="onHide">关闭</el-button>
  43. </div>
  44. </DialogCom>
  45. </div>
  46. </template>
  47. <script>
  48. import { mapState, mapMutations } from "vuex";
  49. import {detail} from "@/api/iot/alarmRule";
  50. import { getLabel } from "@/views/commonOption.js";
  51. export default {
  52. components: {},
  53. dicts: ["alarm_deal_type"],
  54. data() {
  55. const params = this.$route.params;
  56. return {
  57. id: params ? params.id : null,
  58. isShow: false,
  59. formData: this.reset(),
  60. formFileListDefualtValue: [],
  61. labelStyle: {
  62. 'color': '#000',
  63. 'text-align': 'center',
  64. 'height': '40px',
  65. 'min-width': '150px',
  66. 'word-break': 'keep-all'
  67. },
  68. content_style: {
  69. 'text-align': 'left',
  70. 'min-width': '300px',
  71. 'word-break': 'break-all'
  72. },
  73. };
  74. },
  75. props: {},
  76. watch: {},
  77. computed: {
  78. ...mapState(["loginUser"]),
  79. },
  80. methods: {
  81. ...mapMutations([]),
  82. getLabel,
  83. reset(other = {}) {
  84. return {
  85. ...other,
  86. };
  87. },
  88. async refresh(id, other) {
  89. if (!id) {
  90. this.reset(other);
  91. } else {
  92. detail(id).then(response => {
  93. this.formData = response.data;
  94. this.loading = false;
  95. })
  96. }
  97. },
  98. async show(id, other = {}) {
  99. this.id = id;
  100. await this.refresh(id, other);
  101. this.isShow = true;
  102. },
  103. valueText() {
  104. if (!this.formData || this.formData.valueText == null) {
  105. return ''
  106. }
  107. if(this.formData.alarmValue && (this.formData.alarmValue.includes("°C") || this.formData.alarmValue.includes("%RH") ))
  108. {
  109. return this.formData.alarmValue;
  110. }
  111. else{
  112. return this.formData.valueText
  113. }
  114. return `${this.formData.valueText}${this.formData.alarmValue ? this.formData.alarmValue : ''}`
  115. },
  116. dataTypeText() {
  117. if (!this.formData || this.formData.dataType == null) {
  118. return ''
  119. }
  120. if (this.formData.dataType == '0') {
  121. return '动环类告警'
  122. } else if (this.formData.dataType == '1') {
  123. return '视频类告警'
  124. } else {
  125. return '未知'
  126. }
  127. },
  128. // 事件
  129. onHide() {
  130. this.isShow = false;
  131. },
  132. },
  133. mounted() {
  134. },
  135. };
  136. </script>