export.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. <uni-datetime-picker v-model="datetimerange" type="datetimerange" start-placeholder="请选择"
  8. end-placeholder="请选择" start="2000-3-20 12:00:00" end="2021-10-20 20:00:00" rangeSeparator="至" />
  9. </view>
  10. </view>
  11. <block>
  12. <view class="processList">
  13. <view class="cu-list menu-avatar">
  14. <view class="cu-item" v-for="(item,index) in getExportData" :key="index">
  15. <view class="cu-avatar lg">
  16. <image class="image-bg" :src="item.clzt==1?'/static/process-icon.png':'/static/processed-icon.png'"/>
  17. <!-- <image class="image-bg"
  18. :src="item.device_state=='离线'?'/static/device-icon.png':'/static/device-icon.png'" /> -->
  19. </view>
  20. <view class="content">
  21. <view class="pro-title">
  22. <view class="cut" >{{item.owner_name}}</view>
  23. </view>
  24. <view class="pro-des ">
  25. <view class="text-cut">{{item.unitinfo}}</view>
  26. </view>
  27. <view class="pro-date ">{{item.time}}</view>
  28. </view>
  29. <view class="action" style="z-index:99">
  30. <view class="unProcess" v-if="item.clzt==1">未处理</view>
  31. <view class="processed" v-else>已处理</view>
  32. <!-- <view :class="item.device_state=='离线'?'':'processed'">{{item.device_state}}</view> -->
  33. </view>
  34. </view>
  35. <view class=" text-center margin-top" v-if="!this.getExportData.length&&this.dataRes">暂无数据...</view>
  36. </view>
  37. </view>
  38. </block>
  39. <view class="padding-lr padding-bottom-lg" style="position:fixed;bottom:0;width:100%">
  40. <view class="btn-area">
  41. <button class="bg-blue round missReport margin-top" @tap="exportButton()">导 出 </button>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. getExportData: [],
  51. dataRes: 0,
  52. datetimerange: ['', ''],
  53. keyWords:'',
  54. type:0
  55. };
  56. },
  57. onLoad: function(option) {
  58. this.type=option.type
  59. this.getData({
  60. "company_code": uni.getStorageSync('selectedCode'),
  61. "type":this.type,
  62. "start_time": '',
  63. "end_time": '',
  64. })
  65. },
  66. watch: {
  67. datetimerange(newval) {
  68. this.getData({
  69. "company_code": uni.getStorageSync('selectedCode'),
  70. "type":this.type,
  71. "start_time":newval[0],
  72. "end_time": newval[1],
  73. })
  74. }
  75. },
  76. methods: {
  77. async getData(params = {}) {
  78. const res = await this.$myRequest({
  79. url: 'ComprehensiveAlarm/getIntegratedAlarmList', //综合告警列表渲染
  80. data: params,
  81. showLoading: true
  82. })
  83. this.getExportData = res.data.data;
  84. this.dataRes = 1;
  85. },
  86. exportButton() {
  87. alert(this.type)
  88. //#ifdef H5
  89. let exportUrl = this.$BASE_URL+
  90. `ExportModule/getDeviceListExpor/start_time/${this.datetimerange[0]}/end_time/${this.datetimerange[1]}/type/${this.type}/company_code/${uni.getStorageSync('selectedCode')}/`
  91. var ua = window.navigator.userAgent.toLowerCase();
  92. if (ua.match(/MicroMessenger/i) == 'micromessenger') {
  93. uni.showModal({
  94. showCancel: false,
  95. content: '如需下载,请在默认浏览器中操作',
  96. success: function(res) {
  97. window.location.href = exportUrl;
  98. }
  99. });
  100. } else {
  101. window.location.href = exportUrl;
  102. }
  103. //#endif
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. </style>