machineWorkRecord.vue 17 KB

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