index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view>
  3. <cu-custom id="custom"
  4. bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
  5. :isBack="true">
  6. <block slot="backText">返回</block>
  7. <block slot="content">
  8. 告警中心
  9. </block>
  10. </cu-custom>
  11. <u-tabs :list="list1" :activeStyle="{ fontWeight: 'bold' }" @change="tabChange">
  12. <!-- <navigator url="#" slot="right" class="right" @tap="openSearch">
  13. <view :style="{ color: showSearch ? '#007aff' : '#fff' }" class="iconfont icon-a-sousuolansousuo" />
  14. </navigator> -->
  15. </u-tabs>
  16. <u-transition :show="showSearch" mode="fade-down">
  17. <My_search ref="Search" :focus="focus" @onFilter="onFilter" :dateRange="true" @startSearch="startSearch" />
  18. </u-transition>
  19. <view style="height: 5px;" v-if="!focus" />
  20. <My_listbox ref="List" @getlist="getlist" :empty='empty'>
  21. <List :list="list" />
  22. </My_listbox>
  23. </view>
  24. </template>
  25. <script>
  26. import List from "./modules/list.vue"
  27. export default {
  28. name: "alerts",
  29. components: { List },
  30. data() {
  31. return {
  32. showSearch: true,
  33. empty: true,
  34. list1: [{
  35. name: '待处理',
  36. badge: {
  37. value: 0,
  38. }
  39. }, {
  40. name: '已处理',
  41. badge: {
  42. value: 0,
  43. }
  44. }],
  45. content: {
  46. pageNumber: 1,
  47. pageTotal: 1,
  48. pageSize: 20,
  49. isWeChat: true,
  50. where: {
  51. condition: "",
  52. buildtype: "",
  53. level: "",
  54. status: "待处理",
  55. begindate: "",
  56. enddate: ""
  57. }
  58. },
  59. focus: false,
  60. list: []
  61. }
  62. },
  63. onLoad(options) {
  64. if (options.date) {
  65. this.$refs.Search.viewDateCycle(1)
  66. } else {
  67. this.getlist(true);
  68. }
  69. setTimeout(() => {
  70. this.$refs.List.setHeight();
  71. }, 350)
  72. },
  73. methods: {
  74. getlist(init) {
  75. let content = this.content;
  76. if (init) {
  77. content.pageNumber = 1;
  78. content.pageTotal = 1;
  79. }
  80. if (content.pageNumber > content.pageTotal) return;
  81. this.$Http.basic({
  82. "id": 20230816095802,
  83. content
  84. }).then(res => {
  85. console.log("告警列表", res)
  86. if (this.cutoff(res.msg)) return;
  87. this.$refs.List.RefreshToComplete();
  88. this.$refs.List.setHeight();
  89. this.$refs.Search.onFinish();
  90. this.empty = !res.data.length;
  91. content.pageNumber = res.pageNumber + 1;
  92. content.pageTotal = res.pageTotal;
  93. console.log("content", content)
  94. try {
  95. switch (content.where.status) {
  96. case "待处理":
  97. this.list1[0].badge.value = res.total;
  98. this.list1[1].badge.value = "";
  99. break;
  100. case "已处理":
  101. this.list1[0].badge.value = "";
  102. this.list1[1].badge.value = res.total;
  103. break;
  104. }
  105. } catch (error) {
  106. }
  107. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
  108. this.content = content;
  109. })
  110. },
  111. openSearch() {
  112. this.showSearch = !this.showSearch;
  113. setTimeout(() => {
  114. this.$refs.List.setHeight();
  115. this.focus = this.showSearch;
  116. }, 350)
  117. },
  118. tabChange(e) {
  119. this.content.where.status = e.name;
  120. this.getlist(true)
  121. },
  122. startSearch(condition) {
  123. if (condition == this.content.where.condition) return;
  124. this.content.where.condition = condition;
  125. this.getlist(true)
  126. },
  127. onFilter(e) {
  128. this.content.where = Object.assign(this.content.where, e);
  129. console.log("123123312", this.content.where)
  130. this.getlist(true);
  131. },
  132. },
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. /deep/.u-tabs {
  137. height: 44px;
  138. // background: #052E5D;
  139. .u-tabs__wrapper__nav {
  140. height: 44px;
  141. .u-tabs__wrapper__nav__item {
  142. height: 44px !important;
  143. .u-tabs__wrapper__nav__item__text {
  144. color: #fff !important;
  145. }
  146. }
  147. }
  148. }
  149. .right {
  150. height: 44px;
  151. line-height: 44px;
  152. width: 44px;
  153. text-align: center;
  154. .iconfont {
  155. font-size: 16px;
  156. }
  157. }
  158. </style>