index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="pageContainer">
  3. <view class="search">
  4. <u-cell title="报警时间" :value="calendarStart + ' 至 ' + calendarEnd" style="height: 86rpx"
  5. @click="$refs.calendarRef.show()">
  6. </u-cell>
  7. <tq-calendar ref="calendarRef" type="daterange" @confirm="(e) => {
  8. calendarStart = e[0]
  9. calendarEnd = e[1]
  10. handleTableList()
  11. }">
  12. </tq-calendar>
  13. <u-cell title="车辆" :border="true" :isLink="true" @click="$refs.carChooseRef.show()">
  14. <view slot="value">
  15. <!-- <u-form-item label="" prop="vehicleId"> -->
  16. {{ plate }}
  17. <!-- </u-form-item> -->
  18. </view>
  19. <u-icon v-if="plate == ''" slot="right-icon" size="16" name="arrow-right"></u-icon>
  20. <view v-else slot="right-icon" @click.stop="resetData" style="margin-left: 20rpx;">
  21. <u-icon size="16" name="close-circle"></u-icon>
  22. </view>
  23. </u-cell>
  24. <tq-car-user ref="carChooseRef" :isGetIcon="true" @confirm="(data) => {
  25. vehicleId = data.id
  26. plate = data.label
  27. handleTableList()
  28. }">
  29. </tq-car-user>
  30. </view>
  31. <view class="body">
  32. <view class="list" v-for="item in tableList" :key="item.id">
  33. <view style="
  34. display: flex;
  35. margin-bottom: 20rpx;
  36. margin-top: 20rpx;">
  37. <view class="head" style="font-size: 26rpx">
  38. <text style="font-weight: bold;">车辆:{{ item.plate }}</text>
  39. </view>
  40. <view class="head" style="margin-left: 73rpx">
  41. <text style="font-weight: bold;">
  42. <text>{{ item.deptName }}</text>
  43. </text>
  44. </view>
  45. </view>
  46. <view style="
  47. margin-bottom: 20rpx;
  48. display: flex;
  49. ">
  50. <view class="head" style="font-size: 26rpx">
  51. <text>司机:
  52. <text>
  53. {{ item.driverName }}
  54. </text>
  55. </text>
  56. </view>
  57. <view class="head" style="margin-left: 26rpx">
  58. <text>{{ item.driverPhone }}</text>
  59. </view>
  60. </view>
  61. <view>
  62. <view class="head" style="font-size: 26rpx;margin-bottom: 20rpx;">
  63. <text style="font-size: 30rpx; ">报警开始时间:{{ item.startTime }}</text>
  64. </view>
  65. <view class="head" style="font-size: 26rpx;margin-bottom: 20rpx;">
  66. <text style="font-size: 30rpx;">报警结束时间:{{ item.startTime }}</text>
  67. </view>
  68. </view>
  69. <view style="margin-bottom: 20rpx;">
  70. <view class="head" style="font-size: 26rpx">
  71. <view style="width: 20%;align-items: flex-start;">
  72. 报警位置:
  73. </view>
  74. <text style="font-size: 30rpx;flex: 1;">{{ item.location }}</text>
  75. </view>
  76. </view>
  77. <view style="height: 90rpx;">
  78. <u-button type="primary" @click="seeAlarmDetails(item)">查看详情</u-button>
  79. </view>
  80. </view>
  81. <view class="nodata-warp" v-if="!tableList.length">
  82. <image :src="$getImages('/assetsMobile/images/no-data.png')" class="nodata-image"></image>
  83. </view>
  84. <u-loadmore :status="loadStatus" height="30"/>
  85. </view>
  86. <u-calendar :show="calendarShow" mode="range" :defaultDate="defaultDate" :maxDate="maxDate" minDate="2023-10-01"
  87. monthNum="24" @confirm="calendarChange" @close="onClose"></u-calendar>
  88. </view>
  89. </template>
  90. <script>
  91. import { getBlindSpotList } from "@/api/alarm/blindSpot.js"
  92. export default {
  93. components: {
  94. },
  95. props: {},
  96. data() {
  97. return {
  98. vehicleId: '',
  99. plate: '',
  100. tableList: [],
  101. calendarShow: false, // 日历
  102. calendarStart: this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'),// 开始时间
  103. calendarEnd: this.dayjs().subtract(0, 'day').format('YYYY-MM-DD'), // 结束时间
  104. defaultDate: [this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'), this.dayjs().subtract(0, 'day').format('YYYY-MM-DD')],
  105. page: 1,
  106. size: 10,
  107. total: 0,
  108. maxDate: this.dayjs().subtract(0, 'day').format('YYYY-MM-DD'),
  109. loadStatus: 'nomore', //loading nomore loadmore
  110. };
  111. },
  112. mounted() {
  113. this.handleTableList();
  114. },
  115. onReachBottom() {
  116. // 滚动到底部
  117. if (this.page * this.size < this.total) {
  118. this.page += 1;
  119. this.handleTableList();
  120. }
  121. },
  122. methods: {
  123. checkTime() {
  124. this.calendarShow = true
  125. },
  126. resetData() {
  127. this.vehicleId = ''
  128. this.plate = ''
  129. this.page = 1;
  130. this.tableList = [];
  131. this.handleTableList();
  132. },
  133. handleDataDetection(data) {
  134. // 数据检测
  135. return data == null || data == undefined ? "" : data;
  136. },
  137. async handleTableList() {
  138. // 获取列表
  139. // this.tableList = [];
  140. this.loadStatus = 'loading'
  141. let obj = {
  142. startTime: this.calendarStart == "" || this.calendarStart == null ?
  143. undefined : this.calendarStart + ' 00:00:00',
  144. endTime: this.calendarEnd == "" || this.calendarEnd == null ?
  145. undefined : this.calendarEnd + ' 23:59:59',
  146. plate: this.plate ? this.plate : undefined,
  147. vehicleId: this.vehicleId ? this.vehicleId : undefined,
  148. driverAdvanceType: 'BSD',
  149. page: this.page,
  150. size: 10
  151. };
  152. let res = await getBlindSpotList(obj);
  153. if (res.code == "0" && res.data.list) {
  154. res.data.list.map((e) => {
  155. this.tableList.push({
  156. ...e,
  157. });
  158. })
  159. // this.tableList = res.data.list
  160. this.total = res.data.total;
  161. if (this.page * 10 >= this.total) {
  162. this.loadStatus = 'nomore'
  163. }
  164. } else {
  165. this.loadStatus = 'nomore'
  166. }
  167. },
  168. calendarChange(e) {
  169. this.page = 1;
  170. this.tableList = [];
  171. // 修改日期
  172. this.calendarStart = e[0]; // 开始时间
  173. this.calendarEnd = e[1]; // 结束时间
  174. this.calendarShow = false;
  175. this.handleTableList();
  176. },
  177. onClose() {
  178. this.calendarShow = false;
  179. this.handleTableList();
  180. },
  181. seeAlarmDetails(item) {
  182. // 报警详情
  183. uni.navigateTo({
  184. url: `/alarm/blindSpot/detail?fid=${item.fileuuid}`
  185. })
  186. },
  187. },
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .pageContainer {
  192. overflow: unset;
  193. // background-color: #fff;
  194. }
  195. .search {
  196. position: relative;
  197. padding: 0 0rpx;
  198. width: 100%;
  199. height: 166rpx;
  200. // display: flex;
  201. // align-items: center;
  202. background-color: #fff;
  203. }
  204. .head {
  205. height: 100%;
  206. font-size: 28rpx;
  207. display: flex;
  208. align-items: center;
  209. justify-content: flex-start;
  210. color: #333333;
  211. }
  212. .content {
  213. height: 100%;
  214. font-size: 28rpx;
  215. display: flex;
  216. align-items: center;
  217. justify-content: flex-start;
  218. color: #333333;
  219. }
  220. .body {
  221. margin-top: 20rpx;
  222. position: relative;
  223. padding: 10rpx;
  224. width: 100%;
  225. height: calc(100% - 172rpx);
  226. }
  227. .body .total {
  228. width: 100%;
  229. height: 65rpx;
  230. line-height: 65rpx;
  231. font-size: 26rpx;
  232. color: #999999;
  233. }
  234. .list {
  235. background-color: #fff;
  236. width: calc(100% - 90rpx);
  237. position: relative;
  238. display: flex;
  239. flex-direction: column;
  240. padding: 32rpx;
  241. background-color: white;
  242. border-radius: 20rpx;
  243. margin-bottom: 30rpx;
  244. }
  245. .nodata-warp{
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. padding: 100rpx 0;
  250. .nodata-image{
  251. width: 218rpx;
  252. height: 150rpx;
  253. }
  254. }
  255. </style>