index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view>
  3. <roll-load @lower="lower"
  4. :total="queryConditions.total"
  5. :size="queryConditions.limit"
  6. :topBt='top' ref="roll-load" styles="height:100vh" key="checkRord">
  7. <template v-slot:cont>
  8. <block></block>
  9. <!-- :key='item.alertId' -->
  10. <uni-list>
  11. <uni-list-item class="list-item"
  12. v-for="(item,index) in dataList"
  13. :key='index'
  14. :title="item.alertTitle"
  15. :note="item.alertTime"
  16. @click="inspection(item)" clickable showArrow>
  17. <!-- 自定义 body -->
  18. <view slot="body" class="uni-padding-wrap uni-common-mt">
  19. <text class="slot-box slot-text">{{item.riskPointTitle}}</text>
  20. <view>当前处理人员:{{item.taskInsAccountName}}</view>
  21. <view>发生时间:{{item.alertTime}}</view>
  22. <view>描述:{{item.alertDesc}}</view>
  23. </view>
  24. <view slot="footer" class="unilist_footer_tag">
  25. <template>
  26. <uni-tag :text="item.status|filterStatus"
  27. :type="item.status|filterButtonType"
  28. size="small" inverted />
  29. </template>
  30. </view>
  31. </uni-list-item>
  32. </uni-list>
  33. </template>
  34. </roll-load>
  35. </view>
  36. </template>
  37. <script>
  38. import RollLoad from '@/components/RollLoad/index.vue';
  39. import { deepClone } from '@/libs';
  40. import { alertStatus } from '@/libs/enum';
  41. import { getAlertByPage } from '@/api/warning';
  42. export default {
  43. components: {
  44. RollLoad
  45. },
  46. filters:{
  47. filterStatus(value){
  48. return alertStatus(value);
  49. },
  50. filterButtonType(value){
  51. let type=['default','warning','success','error'];
  52. let color="default";
  53. if(value >= 0){
  54. color=type[value]
  55. }
  56. return color;
  57. }
  58. },
  59. data() {
  60. return {
  61. scrollTop: 0,
  62. old: {
  63. scrollTop: 0
  64. },
  65. top: {
  66. show: true,
  67. style: "top:95%"
  68. },
  69. pageNumber: 1,
  70. items: [],
  71. dataList: [],
  72. queryConditions: {
  73. page: 1,
  74. limit: 10,
  75. total: 0,
  76. keywords: ''
  77. }
  78. }
  79. },
  80. onShow() {
  81. this.getList();
  82. console.log("wraning----onShow")
  83. },
  84. methods: {
  85. lower: function(e) {
  86. if (e.status) {
  87. this.queryConditions.page = e.pageNumber
  88. this.getList(this.queryConditions);
  89. }
  90. },
  91. scroll: function(e) {
  92. this.old.scrollTop = e.detail.scrollTop
  93. },
  94. goTop: function(e) {
  95. this.scrollTop = this.old.scrollTop
  96. this.$nextTick(() => {
  97. this.scrollTop = 0
  98. });
  99. uni.showToast({
  100. icon: "none",
  101. title: "已经到顶了!"
  102. })
  103. },
  104. getList() {
  105. getAlertByPage(this.queryConditions).then((res) => {
  106. try{
  107. let items =[...this.dataList];
  108. let dataList=items.concat(res.data);
  109. this.dataList=dataList;
  110. this.$set(this.queryConditions, 'total', res.total)
  111. }catch(err){
  112. console.log(JSON.stringify(err))
  113. }
  114. })
  115. },
  116. inspection(item){
  117. uni.setStorageSync('warnInfo',item);
  118. uni.navigateTo({
  119. url:'/views/warning/detail/detail'
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .slot-image {
  127. height: 35upx;
  128. }
  129. .list-item{
  130. position: relative;
  131. .unilist_footer_tag {
  132. position: absolute;
  133. right: 20upx;
  134. top: 50%;
  135. transform: translateY(-50%);
  136. }
  137. }
  138. </style>