export.vue 3.2 KB

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