deviceError.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <van-nav-bar
  3. title="设备异常"
  4. left-arrow
  5. @click-left="onClickLeft"
  6. safe-area-inset-top
  7. />
  8. <div class="page_check">
  9. <div class="search_pannel">
  10. <div class="pannel_left">
  11. <van-image
  12. :src="require('@/assets/position.svg')"
  13. width="16"
  14. height="16"
  15. fit="contain"
  16. />
  17. <span>{{ name }}</span>
  18. <van-image
  19. :src="require('@/assets/arrow-right.svg')"
  20. width="24"
  21. height="24"
  22. fit="contain"
  23. />
  24. </div>
  25. <div class="pannel_right" @click="toPath">
  26. <van-image
  27. :src="require('@/assets/search.svg')"
  28. width="16"
  29. height="16"
  30. fit="contain"
  31. />
  32. </div>
  33. </div>
  34. <div class="drop_down">
  35. <van-dropdown-menu active-color="#1989fa">
  36. <van-dropdown-item
  37. v-model="checkType"
  38. @change="handelChange('checkType', checkType)"
  39. :title="checkTypeTitle"
  40. :options="checkTypeList"
  41. />
  42. <van-dropdown-item
  43. v-model="checkPerson"
  44. @change="handelChange('checkPerson', checkPerson)"
  45. :title="checkPersonTitle"
  46. :options="checkPersonList"
  47. />
  48. </van-dropdown-menu>
  49. </div>
  50. <div class="list_total">
  51. <span>共有</span>
  52. <v-count-up
  53. :end-val="total"
  54. class="count_up"
  55. options="{ separator: ',' }"
  56. />
  57. <span>条记录</span>
  58. </div>
  59. <div class="check_info">
  60. <div class="info_list">
  61. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  62. <van-list
  63. v-model:loading="loading"
  64. :finished="finished"
  65. :error="error"
  66. error-text="请求失败,点击重新加载"
  67. finished-text="没有更多了"
  68. @load="onLoad"
  69. >
  70. <div v-for="item in list" :key="item.id" class="list_item">
  71. <span class="header">{{ item.name }}</span>
  72. <span>空间信息:{{ item.position }}</span>
  73. <span>设备编号:{{ item.deviceNo }}</span>
  74. <span style="color: #fa5555">告警原因:{{ item.reason }}</span>
  75. <span>告警内容:{{ item.content }}</span>
  76. </div>
  77. </van-list>
  78. </van-pull-refresh>
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import { isEmpty } from "@/utils/index.js";
  85. import VCountUp from "./CountUp";
  86. export default {
  87. components: {
  88. "v-count-up": VCountUp,
  89. },
  90. data() {
  91. return {
  92. loading: false,
  93. name: "电商园四期-B座",
  94. checkType: "",
  95. checkPerson: "",
  96. checkTypeTitle: "巡检类型",
  97. checkPersonTitle: "巡检人员",
  98. checkTypeList: [
  99. { text: "安保", value: 1 },
  100. { text: "保洁", value: 2 },
  101. ],
  102. checkPersonList: [
  103. { text: "张三", value: 1 },
  104. { text: "李四", value: 2 },
  105. ],
  106. total: 3,
  107. list: [
  108. {
  109. name: "B座13楼女卫生间电表",
  110. position: "电商园四期-B座-13层",
  111. deviceNo: "A32445",
  112. reason: "温度≥ 40℃",
  113. content: "实时温度 52℃",
  114. },
  115. ],
  116. loading: false,
  117. refreshing: false,
  118. finished: false,
  119. };
  120. },
  121. methods: {
  122. reduceType_filter(val) {
  123. if (isEmpty(val)) {
  124. return {};
  125. }
  126. if (val == 1) {
  127. return { label: "预存", color: "#30D3A2" };
  128. }
  129. if (val == 2) {
  130. return { label: "补助", color: "#09C700" };
  131. }
  132. if (val == 3) {
  133. return { label: "退费", color: "#FA5555" };
  134. }
  135. if (val == 4) {
  136. return { label: "核缴(水)", color: "#FF9C27" };
  137. }
  138. if (val == 4) {
  139. return { label: "核缴(电)", color: "#FF9C27" };
  140. }
  141. if (val == 4) {
  142. return { label: "核缴(物业)", color: "#FF9C27" };
  143. }
  144. },
  145. onLoad() {
  146. setTimeout(() => {
  147. if (this.refreshing) {
  148. this.list = [];
  149. this.refreshing = false;
  150. }
  151. for (let i = 0; i < 10; i++) {
  152. this.list.push(this.list.length + 1);
  153. }
  154. this.loading = false;
  155. if (this.list.length >= 40) {
  156. this.finished = true;
  157. }
  158. }, 1000);
  159. },
  160. onRefresh() {
  161. // 清空列表数据
  162. this.finished = false;
  163. // 重新加载数据
  164. // 将 loading 设置为 true,表示处于加载状态
  165. this.loading = true;
  166. this.onLoad();
  167. },
  168. // change事件可以拿到的是value
  169. handelChange(type, val) {
  170. console.log(type, val);
  171. if (type == "checkType") {
  172. // 这里打印出来的值就是我们想要的text
  173. this.checkTypeTitle = this.checkTypeList.filter(
  174. (item) => item.value === val
  175. )[0].text;
  176. }
  177. if (type == "checkPerson") {
  178. // 这里打印出来的值就是我们想要的text
  179. this.checkPersonTitle = this.checkPersonList.filter(
  180. (item) => item.value === val
  181. )[0].text;
  182. }
  183. },
  184. onClickLeft() {},
  185. },
  186. };
  187. </script>
  188. <style lang="scss" scoped>
  189. .page_check {
  190. height: 100%;
  191. .search_pannel {
  192. padding: 10px 16px;
  193. background: #5c8fff;
  194. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
  195. display: flex;
  196. align-items: center;
  197. .pannel_left {
  198. display: flex;
  199. align-items: center;
  200. span {
  201. height: 24px;
  202. font-size: 16px;
  203. font-weight: 400;
  204. color: #ffffff;
  205. line-height: 24px;
  206. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
  207. text-indent: 4px;
  208. }
  209. }
  210. .pannel_left,
  211. .pannel_right {
  212. flex: 1;
  213. }
  214. .pannel_right {
  215. text-align: right;
  216. }
  217. }
  218. .drop_down {
  219. /deep/ {
  220. --van-gray-4: #999999;
  221. --van-dropdown-menu-title-text-color: #0c1935;
  222. }
  223. }
  224. .list_total {
  225. padding: 0 16px;
  226. margin: 8px 0;
  227. display: flex;
  228. text-align: left;
  229. span {
  230. height: 16px;
  231. font-size: 12px;
  232. font-weight: 400;
  233. color: #999999;
  234. line-height: 16px;
  235. }
  236. .count_up {
  237. font-size: 16px;
  238. font-weight: 500;
  239. color: #fa5555;
  240. margin: 0 2px;
  241. }
  242. }
  243. .check_info {
  244. padding: 0 16px;
  245. height: calc(
  246. 100% - var(--van-nav-bar-height) - var(--van-dropdown-menu-height) - 76px
  247. );
  248. .info_list {
  249. height: 100%;
  250. overflow-y: auto;
  251. .list_item {
  252. background: #ffffff;
  253. box-shadow: 0px 0px 10px 0px rgba(153, 153, 153, 0.15);
  254. border-radius: 4px;
  255. margin-bottom: 12px;
  256. padding: 12px 16px;
  257. display: flex;
  258. flex-direction: column;
  259. align-items: flex-start;
  260. position: relative;
  261. &:nth-last-child(1) {
  262. margin-bottom: 0;
  263. }
  264. .header {
  265. height: 22px;
  266. font-size: 16px;
  267. font-weight: 600;
  268. color: #313836;
  269. line-height: 22px;
  270. margin-bottom: 8px;
  271. }
  272. span {
  273. height: 18px;
  274. font-size: 14px;
  275. font-weight: 400;
  276. color: #999999;
  277. line-height: 18px;
  278. margin-bottom: 4px;
  279. &:nth-last-child(1) {
  280. margin-bottom: 0;
  281. }
  282. }
  283. .reduce_type {
  284. position: absolute;
  285. top: 0;
  286. right: 0;
  287. width: 48px;
  288. height: 24px;
  289. border-radius: 0px 4px 0px 10px;
  290. span {
  291. height: 16px;
  292. font-size: 12px;
  293. font-weight: 400;
  294. color: #ffffff;
  295. line-height: 16px;
  296. }
  297. }
  298. }
  299. }
  300. }
  301. }
  302. </style>