alert.vue 4.5 KB

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