wasteTransfer.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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. workTypeId="1"
  65. api="dropDown"
  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.runTrips }}(趟)</view>
  114. </view>
  115. <view class="item">
  116. <view class="label">已完成里程</view>
  117. <view class="value" style="color: #4573FC;">{{ item.workMileage }}km</view>
  118. </view>
  119. <view class="item">
  120. <view class="label">状态</view>
  121. <view class="value">
  122. <!-- 作业状态:0.未开始 1.执行中 2.已结束 -->
  123. <text style="color: #68D100;" v-if="item.workStatus === 2">{{ item.workStatusName }}</text>
  124. <text style="color: #FF8000;" v-if="item.workStatus === 1">{{ item.workStatusName }}</text>
  125. <text style="color: #EB4141;" v-if="item.workStatus === 0">{{ item.workStatusName }}</text>
  126. </view>
  127. </view>
  128. </view>
  129. <view @click="item.openOther = !item.openOther" class="open-warp">
  130. {{ item.openOther?'收起':'展开' }}
  131. </view>
  132. <view class="item">
  133. <view class="value" style="color: #4573FC;">
  134. <view style="color: #4573FC;display: flex;" @click="goWorkDetails(item)">作业界面 <u-icon name="arrow-right-double" color="#4573FC" size="14"></u-icon></view>
  135. </view>
  136. </view>
  137. </view>
  138. <!-- 操作 -->
  139. <view class="item-btn">
  140. <view class="u-button" @click="phoneCall(item)">
  141. <image class="icon" src="@/static/icon/iPhone.png" mode=""></image>
  142. 电话
  143. </view>
  144. <view class="u-button" @click="handleTask(item)" v-if="!intercomState">
  145. <image class="icon" src="@/static/icon/voice.png" mode=""></image>
  146. 对讲
  147. </view>
  148. <view class="u-button intercom" @click="handleTask(item)" v-if="intercomState">
  149. <image class="icon" src="@/static/icon/voice-close.png" mode=""></image>
  150. 挂断
  151. </view>
  152. <view class="u-button">
  153. <image class="icon" src="@/static/icon/video.png" mode=""></image>
  154. 视频
  155. </view>
  156. </view>
  157. </view>
  158. <u-loadmore :status="status" />
  159. </view>
  160. <u-calendar :show="calendarShow" mode="range" :defaultDate="defaultDate" :maxDate="maxDate" minDate="2023-10-01"
  161. monthNum="24"
  162. @confirm="calendarChange" @close="calendarShow = false"></u-calendar>
  163. <intercom ref="intercom" @oNstate="(e)=>intercomState=e"></intercom>
  164. </view>
  165. </template>
  166. <script>
  167. import Intercom from '@/components/Intercom'
  168. import { transportWorkRecord } from "@/api/system/workPlan";
  169. export default {
  170. components: {
  171. Intercom
  172. },
  173. data() {
  174. return {
  175. intercomState:false,//对接状态
  176. calendarStart: this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'),// 开始时间
  177. calendarEnd: this.dayjs().subtract(0, 'day').format('YYYY-MM-DD'), // 结束时间
  178. defaultDate: [this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'), this.dayjs().subtract(0, 'day').format('YYYY-MM-DD')],
  179. maxDate: this.dayjs().add(365, 'day').format('YYYY-MM-DD'),
  180. calendarShow: false,
  181. curNow: 0,
  182. form: {
  183. startTime: '',//开始时间
  184. endDate: '', //结束时间
  185. workStatus: '',//部门审核状态:1.审核通过、2.审核不通过
  186. workStatusName: '',
  187. vehType: '',
  188. vehTypeName: '',
  189. param: '' //模糊搜索
  190. },
  191. // 作业状态:0.未开始 1.执行中 2.已结束
  192. workStatusList: [
  193. { label: '全部', value: '' },
  194. { label: '未开始', value: 0 },
  195. { label: '执行中', value: 1 },
  196. { label: '已结束', value: 2 },
  197. ],
  198. status: 'nomore', //loading nomore loadmore
  199. list: ['我的记录', '全部记录'],
  200. tablist: [
  201. { name: '我的记录'},
  202. { name: '全部记录'},
  203. ],
  204. bothSidesMap: {
  205. 1: '是',
  206. 0: '否'
  207. },
  208. queryMyListdata: []
  209. }
  210. },
  211. // 触底
  212. onReachBottom() {
  213. console.log('当前条数', this.queryMyListdata.length, '总条数', this.total)
  214. if (this.queryMyListdata.length >= this.total) return;
  215. this.pageIndex++
  216. this.queryMyList();
  217. },
  218. methods: {
  219. goWorkDetails(row) {
  220. const {schId} = row
  221. uni.navigateTo({
  222. url: `/pagesSanitation/workDetails/index?schId=${schId}`
  223. })
  224. },
  225. handleTask(item) {
  226. this.$refs.intercom.toIntercom(item.deviceId);
  227. },
  228. phoneCall({driverPhone}) {
  229. uni.makePhoneCall({
  230. phoneNumber: driverPhone //仅为示例
  231. });
  232. },
  233. calendarChange(e) {
  234. console.info('选择的时间', e)
  235. // 修改日期
  236. this.form.startTime = e[0]; // 开始时间
  237. this.form.endDate = e[e.length - 1]; // 结束时间
  238. this.defaultDate = [e[0], e[e.length - 1]]
  239. this.calendarShow = false;
  240. this.anewQueryMyList();
  241. },
  242. sectionChange(index) {
  243. this.curNow = index;
  244. this.anewQueryMyList()
  245. },
  246. anewQueryMyList() {
  247. this.pageIndex = 1;
  248. this.queryMyListdata = [];
  249. this.queryMyList();
  250. },
  251. async queryMyList() {
  252. this.loading = 'loading'
  253. let { startTime, endDate } = this.form
  254. let obj = {
  255. ...this.form,
  256. startTime: undefined,
  257. page: this.pageIndex,
  258. size: 10,
  259. startDate: startTime ? startTime : '',
  260. endDate: endDate ? endDate : '',
  261. queryType: this.curNow === 0 ? 1 : 0 //查询类型:0.全部记录 1.我的记录 默认为0
  262. }
  263. for (let key in obj) {
  264. if (obj[key] === '') delete obj[key]
  265. }
  266. if (this.curNow === 0) {
  267. delete obj.param
  268. delete obj.vehType
  269. delete obj.vehTypeName
  270. }
  271. let { data, code } = await transportWorkRecord(obj)
  272. if (code == "0") {
  273. let list = data.list.map(item=>
  274. {
  275. return {
  276. ...item,
  277. openOther:false
  278. }
  279. }
  280. )
  281. this.queryMyListdata = this.queryMyListdata.concat(list)
  282. this.total = Number(data.total)
  283. this.loading = 'loadmore'
  284. if (this.queryMyListdata.length >= this.total) {
  285. this.status = 'nomore'
  286. }
  287. console.log('数据', this.queryMyListdata)
  288. }
  289. },
  290. }
  291. }
  292. </script>
  293. <style lang="scss" scoped>
  294. .page-box {
  295. .list-box {
  296. border-radius: 10rpx;
  297. background: #fff;
  298. padding: 20rpx;
  299. position: sticky;
  300. box-sizing: border-box;
  301. // align-items: center;
  302. // display: flex;
  303. top: 0px;
  304. width: 100%;
  305. z-index: 999;
  306. /deep/ {
  307. .u-form-item__body {
  308. padding: 0;
  309. }
  310. }
  311. .search-box-item {
  312. display: flex;
  313. align-items: center;
  314. color: rgb(60, 156, 255);
  315. padding-top: 20rpx;
  316. padding-left: 20rpx;
  317. /deep/ .u-input {
  318. border: 0;
  319. background: #F2F2F2;
  320. }
  321. }
  322. .vehicle-model {
  323. padding: 0 20rpx;
  324. }
  325. }
  326. .item-list-box {
  327. padding: 24rpx;
  328. box-sizing: border-box;
  329. .info-box {
  330. width: 100%;
  331. background: #FFFFFF;
  332. box-shadow: 0rpx 4 8rpx 0rpx rgba(0, 117, 247, 0.16);
  333. border-radius: 20rpx;
  334. margin-bottom: 24rpx;
  335. padding: 32rpx 24rpx;
  336. box-sizing: border-box;
  337. .title {
  338. font-size: 36rpx;
  339. line-height: 52rpx;
  340. font-style: normal;
  341. font-weight: 500;
  342. height: 52rpx;
  343. color: #4573FC;
  344. padding-left: 32rpx;
  345. }
  346. .sub-title {
  347. margin-top: 8rpx;
  348. font-weight: 600;
  349. font-size: 28rpx;
  350. color: #666666;
  351. line-height: 44rpx;
  352. height: 44rpx;
  353. text-align: left;
  354. font-style: normal;
  355. padding-left: 32rpx;
  356. }
  357. .item-list {
  358. width: 100%;
  359. background: #F6FAFF;
  360. border-radius: 10rpx;
  361. margin-top: 20rpx;
  362. padding: 24rpx 32rpx;
  363. box-sizing: border-box;
  364. .item {
  365. display: flex;
  366. justify-content: space-between;
  367. margin-top: 16rpx;
  368. .label {
  369. color: #666666;
  370. font-size: 28rpx;
  371. flex-shrink: 0;
  372. padding-right: 4rpx;
  373. }
  374. .value {
  375. font-size: 28rpx;
  376. color: #333333;
  377. }
  378. }
  379. }
  380. .item-btn {
  381. display: flex;
  382. margin-top: 24rpx;
  383. .u-button {
  384. display: flex;
  385. align-items: center;
  386. justify-content: center;
  387. width: 100%;
  388. height: 68rpx;
  389. background: #4573FC;
  390. border-radius: 34rpx;
  391. color: #fff;
  392. &:not(:last-child) {
  393. margin-right: 20rpx;
  394. }
  395. .icon{
  396. width: 48rpx;
  397. height: 48rpx;
  398. margin-right: 2rpx;
  399. }
  400. }
  401. .intercom{
  402. background: #EB4141;
  403. }
  404. }
  405. }
  406. }
  407. .hide-warp{
  408. width: 100%;
  409. }
  410. .open-warp{
  411. width: 100%;
  412. padding: 20rpx 0 10rpx;
  413. display: flex;
  414. justify-content: flex-end;
  415. color: #4573FC;
  416. font-size: 28rpx;
  417. }
  418. }
  419. </style>