dialog.dealAlarm.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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" :contentStyle="content_style">
  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. };
  96. },
  97. props: {},
  98. watch: {
  99. // "formData.orgId":{
  100. // handler(v){
  101. // console.info("formData.orgId",v)
  102. // }
  103. // }
  104. },
  105. computed: {
  106. ...mapGetters(["orgId"]),
  107. },
  108. methods: {
  109. ...mapMutations([]),
  110. reset() {
  111. return {
  112. id: null,
  113. doType:null,
  114. doContent:null,
  115. };
  116. },
  117. async refresh(id, other) {
  118. this.alarmData = id ? (await detail(id)).data : this.reset(other);
  119. this.formData.id=id;
  120. },
  121. async show(id, other = {}) {
  122. this.id = id;
  123. await this.refresh(id, other);
  124. this.isShow = true;
  125. },
  126. valueText() {
  127. if (!this.alarmData || this.alarmData.valueText == null) {
  128. return ''
  129. }
  130. return `${this.alarmData.valueText}${this.alarmData.alarmValue ? this.alarmData.alarmValue : ''}`
  131. },
  132. dataTypeText() {
  133. if (!this.alarmData || this.alarmData.dataType == null) {
  134. return ''
  135. }
  136. if (this.alarmData.dataType == '0') {
  137. return '动环类告警'
  138. } else if (this.alarmData.dataType == '1') {
  139. return '视频类告警'
  140. } else {
  141. return '未知'
  142. }
  143. },
  144. // 事件
  145. onHide() {
  146. this.$refs.form.resetFields();
  147. this.formData = this.reset();
  148. },
  149. onSubmit() {
  150. this.$refs.form.validate(async (isValidate) => {
  151. if (!isValidate) return;
  152. await dealAlarm(this.formData);
  153. this.$emit("success");
  154. this.isShow = false;
  155. });
  156. },
  157. },
  158. created() {},
  159. mounted() {},
  160. components: { },
  161. };
  162. </script>
  163. <style lang="scss" scoped>
  164. .brand_info {
  165. .el-form {
  166. width: 600px;
  167. padding-top: 40px;
  168. }
  169. }
  170. </style>