wasteTransport.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view class="page-box">
  3. <view class="list-box">
  4. <u--form label-width="auto" ref="uForm" :model="form" labelAlign="right">
  5. <!-- <u-subsection :list="list" mode="subsection" :current="curNow" @change="sectionChange"></u-subsection> -->
  6. <u-tabs :list="tablist"
  7. :itemStyle="{
  8. width: '330rpx',
  9. height: '80rpx'
  10. }"
  11. :activeStyle="{
  12. color:'#4573FC'
  13. }"
  14. lineColor="#4573FC"
  15. lineWidth="40"
  16. @click="({index}) => {
  17. curNow = index
  18. anewQueryMyList()
  19. }"
  20. >
  21. </u-tabs>
  22. <u-cell-group customStyle="margin-top: 2px">
  23. <template>
  24. <u-cell title="排班日期" :border="true" :isLink="true"
  25. @click="calendarShow = true">
  26. <view slot="value">
  27. <u-form-item label="" prop="form.startTime">
  28. <template v-if="form.endDate">
  29. {{ form.startTime }} - {{ form.endDate }}</template>
  30. <template v-else></template>
  31. </u-form-item>
  32. </view>
  33. </u-cell>
  34. </template>
  35. <template>
  36. <u-cell title="执行状态" :border="true" :isLink="true"
  37. @click="$refs.workStatusRef.show()">
  38. <view slot="value">
  39. <u-form-item label="" prop="form.endTime">
  40. {{ form.workStatusName }}
  41. </u-form-item>
  42. </view>
  43. </u-cell>
  44. <tq-select ref="workStatusRef"
  45. :columns="workStatusList"
  46. @confirm="(data) => {
  47. form.workStatus = data.value
  48. form.workStatusName = data.label
  49. anewQueryMyList()
  50. }">
  51. </tq-select>
  52. </template>
  53. <template v-if="curNow === 1">
  54. <view class="search-box-item">
  55. <u--input
  56. placeholder="查询"
  57. shape="circle"
  58. prefixIcon="search"
  59. v-model="form.param"></u--input>
  60. <view class="search-box-item vehicle-model" @click="$refs.vehTypeRef.show()">
  61. <view>车型</view>
  62. <u-icon name="arrow-down-fill" color="rgb(60, 156, 255)" size="16"></u-icon>
  63. <tq-select ref="vehTypeRef"
  64. api="dropDown"
  65. workTypeId="1"
  66. @confirm="(data) => {
  67. form.vehType = data.value
  68. form.vehTypeName = data.label
  69. anewQueryMyList()
  70. }"></tq-select>
  71. </view>
  72. </view>
  73. </template>
  74. </u-cell-group>
  75. </u--form>
  76. </view>
  77. <view class="item-list-box">
  78. <view class="info-box" v-for="(item, index) in queryMyListdata" :key="index">
  79. <view class="title">{{item.scheduleDate}}</view>
  80. <view class="sub-title">{{item.deptName}}</view>
  81. <view class="item-list">
  82. <view class="item">
  83. <view class="label">编号</view>
  84. <view class="value">{{item.code}}</view>
  85. </view>
  86. <view class="item">
  87. <view class="label">计划名称</view>
  88. <view class="value">{{item.planName}}</view>
  89. </view>
  90. <view class="item">
  91. <view class="label">作业班次</view>
  92. <view class="value">{{item.classTime}}</view>
  93. </view>
  94. <view class="item">
  95. <view class="label">作业范围</view>
  96. <view class="value">{{item.workRangeName}}</view>
  97. </view>
  98. <view class="item">
  99. <view class="label">车辆类型</view>
  100. <view class="value">{{item.vehTypeName}}</view>
  101. </view>
  102. <view class="item">
  103. <view class="label">车牌号</view>
  104. <view class="value" style="color: #4573FC;">{{item.plate}}</view>
  105. </view>
  106. <view class="hide-warp" v-if="item.openOther">
  107. <view class="item">
  108. <view class="label">姓名/电话</view>
  109. <view class="value" style="color: #4573FC;">{{item.driverName}}/{{ item.driverPhone }}</view>
  110. </view>
  111. <view class="item">
  112. <view class="label">已收取/垃圾箱总数</view>
  113. <view class="value" style="color: #4573FC;">{{ item.wasteAlreadyNum }}/{{ item.wasteTotalNum }}</view>
  114. </view>
  115. <view class="item">
  116. <view class="label">已收取/商户总数</view>
  117. <view class="value">{{ item.merchantAlreadyNum }}/{{ item.merchantTotalNum }}</view>
  118. </view>
  119. <view class="item">
  120. <view class="label">已收取/总收集站点</view>
  121. <view class="value" style="color: #4573FC;">{{ item.collectionAlreadyNum }}/{{ item.collectionTotalNum }}</view>
  122. </view>
  123. <view class="item">
  124. <view class="label">收集完成率</view>
  125. <view class="value" style="color: #4573FC;">{{ item.percentage }}%</view>
  126. </view>
  127. <view class="item">
  128. <view class="label">已完成里程/总里程数</view>
  129. <view class="value" style="color: #4573FC;">{{ item.workMileage }}/{{ item.totalMileage }}</view>
  130. </view>
  131. <view class="item">
  132. <view class="label">里程完成率</view>
  133. <view class="value" style="color: #4573FC;">{{ item.mileageRatio }}%</view>
  134. </view>
  135. <view class="item">
  136. <view class="label">状态</view>
  137. <view class="value">
  138. <!-- 作业状态:0.未开始 1.执行中 2.已结束 -->
  139. <text style="color: #68D100;" v-if="item.workStatus === 2">{{ item.workStatusName }}</text>
  140. <text style="color: #FF8000;" v-if="item.workStatus === 1">{{ item.workStatusName }}</text>
  141. <text style="color: #EB4141;" v-if="item.workStatus === 0">{{ item.workStatusName }}</text>
  142. </view>
  143. </view>
  144. </view>
  145. <view @click="item.openOther = !item.openOther" class="open-warp">
  146. {{ item.openOther?'收起':'展开' }}
  147. </view>
  148. <view class="item">
  149. <view class="value" style="color: #4573FC;">
  150. <view style="color: #4573FC;display: flex;" @click="goWorkDetails(item)">作业界面 <u-icon name="arrow-right-double" color="#4573FC" size="14"></u-icon></view>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- 操作 -->
  155. <view class="item-btn">
  156. <view class="u-button" @click="phoneCall(item)">
  157. <image class="icon" src="@/static/icon/iPhone.png" mode=""></image>
  158. 电话
  159. </view>
  160. <view class="u-button" @click="handleTask(item)" v-if="!intercomState">
  161. <image class="icon" src="@/static/icon/voice.png" mode=""></image>
  162. 对讲
  163. </view>
  164. <view class="u-button intercom" @click="handleTask(item)" v-if="intercomState">
  165. <image class="icon" src="@/static/icon/voice-close.png" mode=""></image>
  166. 挂断
  167. </view>
  168. <view class="u-button">
  169. <image class="icon" src="@/static/icon/video.png" mode=""></image>
  170. 视频
  171. </view>
  172. </view>
  173. </view>
  174. <u-loadmore :status="status" />
  175. </view>
  176. <u-calendar :show="calendarShow" mode="range" :defaultDate="defaultDate" :maxDate="maxDate" minDate="2023-10-01"
  177. monthNum="24"
  178. @confirm="calendarChange" @close="calendarShow = false"></u-calendar>
  179. <intercom ref="intercom" @oNstate="(e)=>intercomState=e"></intercom>
  180. </view>
  181. </template>
  182. <script>
  183. import Intercom from '@/components/Intercom'
  184. import { collectionWorkRecord } from "@/api/system/workPlan";
  185. export default {
  186. components: {
  187. Intercom
  188. },
  189. data() {
  190. return {
  191. intercomState:false,//对接状态
  192. calendarStart: this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'),// 开始时间
  193. calendarEnd: this.dayjs().subtract(0, 'day').format('YYYY-MM-DD'), // 结束时间
  194. defaultDate: [this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'), this.dayjs().subtract(0, 'day').format('YYYY-MM-DD')],
  195. maxDate: this.dayjs().add(365, 'day').format('YYYY-MM-DD'),
  196. calendarShow: false,
  197. curNow: 0,
  198. form: {
  199. startTime: '',//开始时间
  200. endDate: '', //结束时间
  201. workStatus: '',//部门审核状态:1.审核通过、2.审核不通过
  202. workStatusName: '',
  203. vehType: '',
  204. vehTypeName: '',
  205. param: '' //模糊搜索
  206. },
  207. // 作业状态:0.未开始 1.执行中 2.已结束
  208. workStatusList: [
  209. { label: '全部', value: '' },
  210. { label: '未开始', value: 0 },
  211. { label: '执行中', value: 1 },
  212. { label: '已结束', value: 2 },
  213. ],
  214. status: 'nomore', //loading nomore loadmore
  215. list: ['我的记录', '全部记录'],
  216. tablist: [
  217. { name: '我的记录'},
  218. { name: '全部记录'},
  219. ],
  220. bothSidesMap: {
  221. 1: '是',
  222. 0: '否'
  223. },
  224. queryMyListdata: []
  225. }
  226. },
  227. // 触底
  228. onReachBottom() {
  229. console.log('当前条数', this.queryMyListdata.length, '总条数', this.total)
  230. if (this.queryMyListdata.length >= this.total) return;
  231. this.pageIndex++
  232. this.queryMyList();
  233. },
  234. methods: {
  235. goWorkDetails(row) {
  236. const {schId} = row
  237. uni.navigateTo({
  238. url: `/pagesSanitation/workDetails/index?schId=${schId}`
  239. })
  240. },
  241. handleTask(item) {
  242. this.$refs.intercom.toIntercom(item.deviceId);
  243. },
  244. phoneCall({driverPhone}) {
  245. uni.makePhoneCall({
  246. phoneNumber: driverPhone //仅为示例
  247. });
  248. },
  249. calendarChange(e) {
  250. console.info('选择的时间', e)
  251. // 修改日期
  252. this.form.startTime = e[0]; // 开始时间
  253. this.form.endDate = e[e.length - 1]; // 结束时间
  254. this.defaultDate = [e[0], e[e.length - 1]]
  255. this.calendarShow = false;
  256. this.anewQueryMyList();
  257. },
  258. sectionChange(index) {
  259. this.curNow = index;
  260. this.anewQueryMyList()
  261. },
  262. anewQueryMyList() {
  263. this.pageIndex = 1;
  264. this.queryMyListdata = [];
  265. this.queryMyList();
  266. },
  267. async queryMyList() {
  268. this.loading = 'loading'
  269. let { startTime, endDate } = this.form
  270. let obj = {
  271. ...this.form,
  272. startTime: undefined,
  273. page: this.pageIndex,
  274. size: 10,
  275. startDate: startTime ? startTime : '',
  276. endDate: endDate ? endDate : '',
  277. queryType: this.curNow === 0 ? 1 : 0 //查询类型:0.全部记录 1.我的记录 默认为0
  278. }
  279. for (let key in obj) {
  280. if (obj[key] === '') delete obj[key]
  281. }
  282. if(this.curNow===0){
  283. delete obj.param
  284. delete obj.vehType
  285. delete obj.vehTypeName
  286. }
  287. let { data, code } = await collectionWorkRecord(obj)
  288. if (code == "0") {
  289. let list = data.list.map(item=>
  290. {
  291. return {
  292. ...item,
  293. openOther:false
  294. }
  295. }
  296. )
  297. this.queryMyListdata = this.queryMyListdata.concat(list)
  298. this.total = Number(data.total)
  299. this.loading = 'loadmore'
  300. if (this.queryMyListdata.length >= this.total) {
  301. this.status = 'nomore'
  302. }
  303. console.log('数据', this.queryMyListdata)
  304. }
  305. },
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .page-box {
  311. .list-box {
  312. border-radius: 10rpx;
  313. background: #fff;
  314. padding: 20rpx;
  315. position: sticky;
  316. box-sizing: border-box;
  317. // align-items: center;
  318. // display: flex;
  319. top: 0px;
  320. width: 100%;
  321. z-index: 999;
  322. /deep/ {
  323. .u-form-item__body {
  324. padding: 0;
  325. }
  326. }
  327. .search-box-item {
  328. display: flex;
  329. align-items: center;
  330. color: rgb(60, 156, 255);
  331. padding-top: 20rpx;
  332. padding-left: 20rpx;
  333. /deep/ .u-input {
  334. border: 0;
  335. background: #F2F2F2;
  336. }
  337. }
  338. .vehicle-model {
  339. padding: 0 20rpx;
  340. }
  341. }
  342. .item-list-box {
  343. padding: 24rpx;
  344. box-sizing: border-box;
  345. .info-box {
  346. width: 100%;
  347. background: #FFFFFF;
  348. box-shadow: 0rpx 4 8rpx 0rpx rgba(0, 117, 247, 0.16);
  349. border-radius: 20rpx;
  350. margin-bottom: 24rpx;
  351. padding: 32rpx 24rpx;
  352. box-sizing: border-box;
  353. .title {
  354. font-size: 36rpx;
  355. line-height: 52rpx;
  356. font-style: normal;
  357. font-weight: 500;
  358. height: 52rpx;
  359. color: #4573FC;
  360. padding-left: 32rpx;
  361. }
  362. .sub-title {
  363. margin-top: 8rpx;
  364. font-weight: 600;
  365. font-size: 28rpx;
  366. color: #666666;
  367. line-height: 44rpx;
  368. height: 44rpx;
  369. text-align: left;
  370. font-style: normal;
  371. padding-left: 32rpx;
  372. }
  373. .item-list {
  374. width: 100%;
  375. background: #F6FAFF;
  376. border-radius: 10rpx;
  377. margin-top: 20rpx;
  378. padding: 24rpx 32rpx;
  379. box-sizing: border-box;
  380. .item {
  381. display: flex;
  382. justify-content: space-between;
  383. margin-top: 16rpx;
  384. .label {
  385. color: #666666;
  386. font-size: 28rpx;
  387. flex-shrink: 0;
  388. padding-right: 4rpx;
  389. }
  390. .value {
  391. font-size: 28rpx;
  392. color: #333333;
  393. }
  394. }
  395. }
  396. .item-btn {
  397. display: flex;
  398. margin-top: 24rpx;
  399. .u-button {
  400. display: flex;
  401. align-items: center;
  402. justify-content: center;
  403. width: 100%;
  404. height: 68rpx;
  405. background: #4573FC;
  406. border-radius: 34rpx;
  407. color: #fff;
  408. &:not(:last-child) {
  409. margin-right: 20rpx;
  410. }
  411. .icon{
  412. width: 48rpx;
  413. height: 48rpx;
  414. margin-right: 2rpx;
  415. }
  416. }
  417. .intercom{
  418. background: #EB4141;
  419. }
  420. }
  421. }
  422. }
  423. .hide-warp{
  424. width: 100%;
  425. }
  426. .open-warp{
  427. width: 100%;
  428. padding: 20rpx 0 10rpx;
  429. display: flex;
  430. justify-content: flex-end;
  431. color: #4573FC;
  432. font-size: 28rpx;
  433. }
  434. }
  435. </style>