export.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="processWrapper exportBody ">
  3. <view style="height:98rpx"></view>
  4. <view class="ding">
  5. <!-- <calendar></calendar> -->
  6. <view class="example-body">
  7. <!-- <view class="example-body">
  8. <uni-datetime-picker v-model="range" type="daterange" rangeSeparator="至" />
  9. </view> -->
  10. <uni-datetime-picker v-model="datetimerange" type="daterange" start-placeholder="请选择开始时间"
  11. end-placeholder="请选择结束时间" start="2000-3-20 12:00:00" end="2025-10-20 20:00:00" rangeSeparator="至" />
  12. </view>
  13. </view>
  14. <block>
  15. <view class="processList">
  16. <view class="cu-list menu-avatar">
  17. <view class="cu-item" v-for="(item,index) in getExportData" :key="index">
  18. <view class="cu-avatar lg">
  19. <image class="image-bg" :src="item.clzt==0?'/static/process-icon.png':'/static/processed-icon.png'"/>
  20. <!-- <image class="image-bg"
  21. :src="item.device_state=='离线'?'/static/device-icon.png':'/static/device-icon.png'" /> -->
  22. </view>
  23. <view class="content">
  24. <view class="pro-title">
  25. <view class="cut" >{{item.owner_name}}</view>
  26. </view>
  27. <view class="pro-des ">
  28. <view class="text-cut">{{item.unitinfo}}</view>
  29. </view>
  30. <view class="pro-date ">{{item.time}}</view>
  31. </view>
  32. <view class="action" style="z-index:99">
  33. <view class="unProcess" v-if="item.clzt==0">未处理</view>
  34. <view class="processed" v-else>已处理</view>
  35. <!-- <view :class="item.device_state=='离线'?'':'processed'">{{item.device_state}}</view> -->
  36. </view>
  37. </view>
  38. <view class=" text-center margin-top" v-if="!this.getExportData.length&&this.dataRes">暂无数据...</view>
  39. <view v-show="isLoadMore&&page>1">
  40. <uni-load-more :status="loadStatus"></uni-load-more>
  41. </view>
  42. </view>
  43. </view>
  44. </block>
  45. <view v-if="this.getExportData.length>0" class="padding-lr padding-bottom-lg bg-white" style="position:fixed;bottom:0;width:100%">
  46. <view class="btn-area">
  47. <button class="bg-blue round missReport margin-top" @tap="exportButton()">导 出 </button>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. getExportData: [],
  57. dataRes: 0,
  58. datetimerange: ['', ''],
  59. keyWords:'',
  60. type:0,
  61. start_time:'',
  62. end_time:'',
  63. page: 1,
  64. pageSize: 10,
  65. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  66. isLoadMore: false, //是否加载中
  67. };
  68. },
  69. onLoad: function(option) {
  70. this.type=option.type
  71. this.getData({
  72. "company_code": uni.getStorageSync('selectedCode'),
  73. "type":this.type,
  74. "start_time": this.start_time,
  75. "end_time": this.end_time,
  76. "page": this.page,
  77. "pageSize": this.pageSize,
  78. })
  79. },
  80. watch: {
  81. datetimerange(newval) {
  82. this.start_time=newval[0];
  83. this.end_time=newval[1]
  84. this.getExportData = [],
  85. this.page = 1,
  86. this.getData({
  87. "company_code": uni.getStorageSync('selectedCode'),
  88. "type":this.type,
  89. "start_time":newval[0],
  90. "end_time": newval[1],
  91. "page": this.page,
  92. "pageSize": this.pageSize,
  93. })
  94. }
  95. },
  96. onReachBottom() { //上拉触底函数
  97. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  98. this.isLoadMore = true
  99. this.page += 1
  100. this.getData({
  101. "company_code": uni.getStorageSync('selectedCode'),
  102. "type":this.type,
  103. "start_time": this.start_time,
  104. "end_time": this.end_time,
  105. "page": this.page,
  106. "pageSize": this.pageSize,
  107. })
  108. }
  109. // alert(this.page)
  110. },
  111. methods: {
  112. async getData(params = {}) {
  113. this.dataRes = 0;
  114. const res = await this.$myRequest({
  115. url: 'ComprehensiveAlarm/getIntegratedAlarmList', //综合告警列表渲染
  116. data: params,
  117. showLoading: true
  118. })
  119. this.dataRes = 1;
  120. if (res.data.data.length>0) {
  121. this.getExportData = this.getExportData.concat(res.data.data)
  122. if (res.data.data.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
  123. this.isLoadMore = true
  124. this.loadStatus = 'nomore'
  125. } else {
  126. this.isLoadMore = false
  127. }
  128. } else {
  129. this.isLoadMore = true
  130. this.loadStatus = 'nomore'
  131. }
  132. },
  133. exportButton() {
  134. //#ifdef H5
  135. var start_time =this.datetimerange[0]?`start_time/${this.datetimerange[0]}/`:'';
  136. var end_time =this.datetimerange[1]?`end_time/${this.datetimerange[1]}/`:'';
  137. let exportUrl = this.$BASE_URL+
  138. `ExportModule/getIntegratedAlarmListExpor/${start_time}${end_time}type/${this.type}/company_code/${uni.getStorageSync('selectedCode')}/`
  139. // alert(exportUrl)
  140. var ua = window.navigator.userAgent.toLowerCase();
  141. if (ua.match(/MicroMessenger/i) == 'micromessenger') {
  142. uni.showModal({
  143. showCancel: false,
  144. content: '如需下载,请在默认浏览器中操作',
  145. success: function(res) {
  146. window.location.href = exportUrl;
  147. }
  148. });
  149. } else {
  150. window.location.href = exportUrl;
  151. }
  152. //#endif
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. </style>