dialog.dealAlarm.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="rule-type">
  3. <DialogCom
  4. title="告警处置"
  5. :visible.sync="isShow"
  6. @close="onHide"
  7. width="800px"
  8. >
  9. <div class="page-body">
  10. <el-descriptions class="margin-top" :column="2" size="medium" border :label-style="labelStyle">
  11. <el-descriptions-item labelClassName="gx_info_label" label="机构名称">
  12. {{alarmData.orgName}}
  13. </el-descriptions-item>
  14. <el-descriptions-item labelClassName="gx_info_label" label="告警分类" >
  15. {{dataTypeText()}}
  16. </el-descriptions-item>
  17. <el-descriptions-item labelClassName="gx_info_label" label="告警类型" >
  18. {{alarmData.sourceTypeDes}}
  19. </el-descriptions-item>
  20. <el-descriptions-item labelClassName="gx_info_label" label="告警开始时间" >
  21. {{alarmData.time}}
  22. </el-descriptions-item>
  23. <el-descriptions-item labelClassName="gx_info_label" label="告警结束时间" >
  24. {{alarmData.endTime}}
  25. </el-descriptions-item>
  26. <el-descriptions-item labelClassName="gx_info_label" label="告警值" >
  27. {{valueText()}}
  28. </el-descriptions-item>
  29. <el-descriptions-item labelClassName="gx_info_label" label="告警内容" >
  30. {{alarmData.content}}
  31. </el-descriptions-item>
  32. </el-descriptions>
  33. <el-form
  34. :model="formData"
  35. :rules="formDataRules"
  36. size="small"
  37. ref="form"
  38. label-position="right"
  39. label-width="150px"
  40. label-prefix=":"
  41. >
  42. <!-- <el-form-item label="所属机构" prop="orgId">
  43. {{formData.orgName}}
  44. </el-form-item> -->
  45. <el-form-item label="处置类型" prop="doType">
  46. <el-select
  47. label="处置类型"
  48. v-model="formData.doType"
  49. placeholder="请选择告警处置类型"
  50. clearable
  51. style="width: 100%;"
  52. >
  53. <el-option
  54. v-for="dict in dict.type.alarm_deal_type"
  55. :key="dict.value"
  56. :label="dict.label"
  57. :value="parseInt(dict.value)"
  58. ></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item prop="doContent" label="处置内容:">
  62. <el-input
  63. v-model="formData.doContent"
  64. :maxlength="50"
  65. name="doContent"
  66. placeholder="请输入处置内容"
  67. clearable
  68. />
  69. </el-form-item>
  70. </el-form>
  71. </div>
  72. <div slot="footer" class="dialog-footer">
  73. <el-button type="primary" @click="onSubmit">确定</el-button>
  74. <el-button @click="isShow = false">取消</el-button>
  75. </div>
  76. </DialogCom>
  77. </div>
  78. </template>
  79. <script>
  80. import { mapState, mapMutations, mapGetters } from "vuex";
  81. import {detail,dealAlarm} from "@/api/iot/alarmRule";
  82. import { listIdName } from "@/api/system/device";
  83. export default {
  84. dicts: ["alarm_deal_type"],
  85. data() {
  86. return {
  87. id: null,
  88. isShow: false,
  89. alarmData:null,
  90. formData: this.reset(),
  91. formDataRules: {
  92. doType: [{ required: true, message: "请选择处置类型" }],
  93. doContent: [{ required: true, message: "请输入处置内容" }],
  94. },
  95. labelStyle: {
  96. color: "#000",
  97. "text-align": "center",
  98. height: "40px",
  99. "min-width": "150px",
  100. "word-break": "keep-all",
  101. },
  102. };
  103. },
  104. props: {},
  105. watch: {
  106. // "formData.orgId":{
  107. // handler(v){
  108. // console.info("formData.orgId",v)
  109. // }
  110. // }
  111. },
  112. computed: {
  113. ...mapGetters(["orgId"]),
  114. },
  115. methods: {
  116. ...mapMutations([]),
  117. reset() {
  118. return {
  119. id: null,
  120. doType:null,
  121. doContent:null,
  122. };
  123. },
  124. async refresh(id, other) {
  125. this.alarmData = id ? (await detail(id)).data : this.reset(other);
  126. this.formData.id=id;
  127. },
  128. async show(id, other = {}) {
  129. this.id = id;
  130. await this.refresh(id, other);
  131. this.isShow = true;
  132. },
  133. valueText() {
  134. if (!this.alarmData || this.alarmData.valueText == null) {
  135. return ''
  136. }
  137. if(this.alarmData.alarmValue && (this.alarmData.alarmValue.includes("°C") || this.alarmData.alarmValue.includes("%RH") ))
  138. {
  139. return this.alarmData.alarmValue;
  140. }
  141. else{
  142. return this.alarmData.valueText
  143. }
  144. },
  145. dataTypeText() {
  146. if (!this.alarmData || this.alarmData.dataType == null) {
  147. return ''
  148. }
  149. if (this.alarmData.dataType == '0') {
  150. return '动环类告警'
  151. } else if (this.alarmData.dataType == '1') {
  152. return '视频类告警'
  153. } else {
  154. return '未知'
  155. }
  156. },
  157. // 事件
  158. onHide() {
  159. this.$refs.form.resetFields();
  160. this.formData = this.reset();
  161. },
  162. onSubmit() {
  163. this.$refs.form.validate(async (isValidate) => {
  164. if (!isValidate) return;
  165. await dealAlarm(this.formData);
  166. this.$emit("success");
  167. this.isShow = false;
  168. });
  169. },
  170. },
  171. created() {},
  172. mounted() {},
  173. components: { },
  174. };
  175. </script>
  176. <style lang="scss" scoped>
  177. .brand_info {
  178. .el-form {
  179. width: 600px;
  180. padding-top: 40px;
  181. }
  182. }
  183. </style>