alert.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="work-container">
  3. <view style="margin-top: 10px">
  4. <uni-card v-for="item in alertList" :title="item.deviceName" :extra="item.createTime">
  5. <view style="position: relative">
  6. <view>报警名称:{{item.alertName}}</view>
  7. <view>报警级别:{{alertLevel[item.alertLevel-1]}}</view>
  8. <view v-if="item.status == 3">状态:已处理</view>
  9. <view v-if="item.status != 3">状态:未处理</view>
  10. <view v-if="item.status == 3" style="width: 50px;position: absolute;right:-10px;bottom:0px"><u-button @click="watchResult(item)" type="primary" :plain="true" size="mini" text="查看结果"></u-button>
  11. </view>
  12. <view v-if="item.status != 3" style="width: 50px;position: absolute;right:-10px;bottom:0px"><u-button @click="handle(item)" type="error" :plain="true" size="mini" text="处理"></u-button>
  13. </view>
  14. </view>
  15. </uni-card>
  16. <uni-load-more @clickLoadMore="getMore" :contentText="contenText" :status="loadStatus"></uni-load-more>
  17. <uni-popup ref="popup" type="dialog">
  18. <uni-popup-dialog title="输入处理结果" :value="chooseItem.remark" placeholder="请输入处理结果" mode="input" message="成功消息" :duration="2000" :before-close="true" @close="close" @confirm="confirm"></uni-popup-dialog>
  19. </uni-popup>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {getAlertList,handleAlert} from '@/api/device/device';
  25. import UText from "../../uni_modules/uview-ui/components/u-text/u-text";
  26. export default {
  27. components: {UText},
  28. data() {
  29. return {
  30. show:true,
  31. alertList:[],
  32. search:{
  33. deptName:""
  34. },
  35. alertLevel:['提醒通知','轻微问题','严重警告'],
  36. pageNum:1,
  37. pageSize:10,
  38. chooseItem: {},
  39. contenText:{contentdown: "点击加载更多",contentrefresh: "正在加载...",contentnomore: "没有更多数据了"},
  40. loadStatus:"more"
  41. }
  42. },
  43. onLoad(){
  44. this.getAlertList();
  45. },
  46. methods: {
  47. getMore(){
  48. this.pageNum ++;
  49. this.getAlertList();
  50. },
  51. open(item) {
  52. this.chooseItem = item;
  53. this.$refs.popup.open()
  54. },
  55. close() {
  56. this.chooseItem = {};
  57. this.$refs.popup.close()
  58. },
  59. confirm(text){
  60. if(!text){
  61. uni.showToast({
  62. icon:"error",
  63. title:"请输入内容"
  64. })
  65. return;
  66. }
  67. let item = this.chooseItem;
  68. item.remark = text;
  69. this.close();
  70. handleAlert(item).then(res=>{
  71. if(res.code == 200){
  72. item.status = 3;
  73. }
  74. })
  75. },
  76. searchDept(){
  77. this.getDeptList();
  78. },
  79. watchResult(item){
  80. this.open(item);
  81. },
  82. handle(item){
  83. this.open(item);
  84. },
  85. getAlertList(){
  86. this.loadStatus = "loading"
  87. getAlertList(this.pageNum,this.pageSize).then(res=>{
  88. if(res.total == this.alertList.length){
  89. uni.showToast({
  90. icon:"none",
  91. title:"没有更多了"
  92. })
  93. this.loadStatus = "noMore"
  94. return;
  95. }
  96. this.loadStatus = "more"
  97. this.alertList = this.alertList.concat(res.rows);
  98. });
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss">
  104. /* #ifndef APP-NVUE */
  105. .u-collapse-content{
  106. display: flex;
  107. flex-direction: column;
  108. }
  109. page {
  110. display: flex;
  111. flex-direction: column;
  112. box-sizing: border-box;
  113. background-color: #fff;
  114. min-height: 100%;
  115. height: auto;
  116. }
  117. view {
  118. font-size: 14px;
  119. line-height: inherit;
  120. }
  121. /* #endif */
  122. .text {
  123. text-align: center;
  124. font-size: 26rpx;
  125. margin-top: 10rpx;
  126. }
  127. .grid-item-box {
  128. flex: 1;
  129. /* #ifndef APP-NVUE */
  130. display: flex;
  131. /* #endif */
  132. flex-direction: column;
  133. align-items: center;
  134. justify-content: center;
  135. padding: 15px 0;
  136. }
  137. .uni-margin-wrap {
  138. width: 690rpx;
  139. width: 100%;
  140. ;
  141. }
  142. .swiper {
  143. height: 300rpx;
  144. }
  145. .swiper-box {
  146. height: 150px;
  147. }
  148. .swiper-item {
  149. /* #ifndef APP-NVUE */
  150. display: flex;
  151. /* #endif */
  152. flex-direction: column;
  153. justify-content: center;
  154. align-items: center;
  155. color: #fff;
  156. height: 300rpx;
  157. line-height: 300rpx;
  158. }
  159. @media screen and (min-width: 500px) {
  160. .uni-swiper-dot-box {
  161. width: 400px;
  162. /* #ifndef APP-NVUE */
  163. margin: 0 auto;
  164. /* #endif */
  165. margin-top: 8px;
  166. }
  167. .image {
  168. width: 100%;
  169. }
  170. }
  171. </style>