index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <scroll-view class="scroll-height" :scroll-y="true" :data-theme="'theme-' + proxy.$settingStore.themeColor.name">
  3. <view class="alarmDetails-container">
  4. <view class="flex bg-white p15 mb15">
  5. <image style="width: 40px; height: 40px; margin: auto 15px auto 0" :src="dataArray.typeImg ? dataArray.typeImg : '/static/images/404.png'" mode="aspectFill"></image>
  6. <view style="margin: auto auto auto 0">
  7. <view style="font-size: 15px"> {{ dataArray.deviceName }} </view>
  8. </view>
  9. <view style="margin: auto 0 auto 0">
  10. <view style="font-size: 15px" :style="`color:${dataArray.handleStatus == 1 ? '#16bf00' : 'red'}`">
  11. {{ dataArray.handleStatus == 1 ? "已处理" : dataArray.handleStatus == 0 ? "未处理" : "" }}
  12. </view>
  13. </view>
  14. </view>
  15. <view class="bg-white p15 mb15">
  16. <uni-section class="block mb10" title="基本信息" type="line"></uni-section>
  17. <view class="tableType3 padding-0">
  18. <u-row v-for="da in dataList" :key="da">
  19. <u-col span="4">
  20. <view style="text-align: right; padding: 0px 5px 0px 5px">{{ da.title }}</view>
  21. </u-col>
  22. <u-col span="8">
  23. <view style="text-align: left; padding: 0px 5px 0px 5px">{{ da.value }}</view>
  24. </u-col>
  25. </u-row>
  26. </view>
  27. </view>
  28. <view class="bg-white p15 mb15">
  29. <uni-section class="block mb10" title="处理内容" type="line"></uni-section>
  30. <view>
  31. <u-radio-group v-model="handleRange" placement="row" v-if="dataArray.handleStatus != 1">
  32. <u-radio
  33. v-for="han in handleRangeList"
  34. :key="han"
  35. :activeColor="proxy.$settingStore.themeColor.color"
  36. :label="han.label"
  37. :name="han.value"
  38. style="margin: 0 15px 15px 0"
  39. :labelSize="13"
  40. :iconSize="10"
  41. ></u-radio>
  42. </u-radio-group>
  43. <u--textarea v-model="handleContent" placeholder="备注信息,最多可输入50个字" :count="true" maxlength="50" style="margin: 0 0 15px 0" :disabled="dataArray.handleStatus == 1"></u--textarea>
  44. </view>
  45. <view class="flex" v-if="dataArray.handleStatus != 1">
  46. <u-button
  47. type="primary"
  48. text="误报"
  49. shape="circle"
  50. :customStyle="{
  51. width: '80px',
  52. height: '30px',
  53. marginRight: '15px',
  54. }"
  55. @click="handleSubmit(1)"
  56. ></u-button>
  57. <u-button
  58. type="primary"
  59. text="非误报"
  60. shape="circle"
  61. :customStyle="{
  62. width: '80px',
  63. height: '30px',
  64. marginLeft: '15px',
  65. }"
  66. @click="handleSubmit(0)"
  67. ></u-button>
  68. </view>
  69. </view>
  70. </view>
  71. </scroll-view>
  72. </template>
  73. <script setup>
  74. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  75. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  76. import { publicStores, useStores } from "@/store/modules/index";
  77. import { baseAlarmList, baseAlarm } from "@/api/business/fireIot/alarmManage.js";
  78. const { proxy } = getCurrentInstance();
  79. const dataArray = ref({});
  80. const dataList = ref([
  81. {
  82. title: "设备名称",
  83. value: "",
  84. },
  85. {
  86. title: "设备地址",
  87. value: "",
  88. },
  89. {
  90. title: "告警等级",
  91. value: "",
  92. },
  93. {
  94. title: "告警信息",
  95. value: "",
  96. },
  97. {
  98. title: "告警时间",
  99. value: "",
  100. },
  101. ]);
  102. const deviceName = ref("");
  103. const alarmTime = ref("");
  104. const pageSize = ref(20);
  105. const current = ref(1);
  106. const total = ref(0);
  107. const handleContent = ref("");
  108. const handleRange = ref(1);
  109. const handleRangeList = ref([
  110. {
  111. label: "单个处理",
  112. value: 1,
  113. },
  114. {
  115. label: "批量处理",
  116. value: 0,
  117. },
  118. ]);
  119. /**
  120. * @页面初始化
  121. */
  122. function init() {
  123. selectListApi();
  124. }
  125. /**
  126. * @列表查询
  127. * @api接口查询
  128. */
  129. function selectListApi() {
  130. baseAlarmList({
  131. deviceName: deviceName.value,
  132. startTime: alarmTime.value,
  133. endTime: alarmTime.value,
  134. current: current.value,
  135. size: pageSize.value,
  136. }).then((requset) => {
  137. if (requset.status === "SUCCESS") {
  138. dataArray.value = requset.data.records[0];
  139. dataList.value[0].value = requset.data.records[0].deviceName;
  140. dataList.value[1].value = requset.data.records[0].alarmAddress;
  141. dataList.value[2].value = requset.data.records[0].alarmGrade + "级";
  142. dataList.value[3].value = requset.data.records[0].alarmContent;
  143. dataList.value[4].value = requset.data.records[0].alarmTime;
  144. total.value = requset.data.total;
  145. }
  146. });
  147. }
  148. /**
  149. * @提交
  150. */
  151. function handleSubmit(alarmFalse) {
  152. baseAlarm({
  153. id: dataArray.value.id,
  154. deviceId: dataArray.value.deviceId,
  155. alarmType: dataArray.value.alarmType,
  156. handleContent: handleContent.value,
  157. alarmFalse: alarmFalse,
  158. handleRange: handleRange.value,
  159. }).then((requset) => {
  160. if (requset.status === "SUCCESS") {
  161. proxy.$tab.navigateTo(`/pages/common/success/index?codeName=提交成功`);
  162. }
  163. });
  164. }
  165. onReady(() => {});
  166. onShow(() => {
  167. //调用系统主题颜色
  168. proxy.$settingStore.systemThemeColor([1]);
  169. });
  170. onLoad((options) => {
  171. if ("deviceName" in options) {
  172. deviceName.value = options.deviceName;
  173. }
  174. if ("alarmTime" in options) {
  175. alarmTime.value = options.alarmTime;
  176. }
  177. init();
  178. });
  179. </script>
  180. <style lang="scss" scoped>
  181. :deep(.u-textarea__field) {
  182. font-size: 13px;
  183. }
  184. </style>