index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <template>
  2. <view class="container">
  3. <uni-navbar title="运输记录"></uni-navbar>
  4. <view class="box commonMt" style="overflow: hidden;">
  5. <view class="topMap">
  6. <mapPreview :pathDataId='pathData' :startPoint='form.startPoint' :endPoint='form.endPoint'
  7. v-show="isMap" :mtRoutePointList='form.mtRoutePointList'></mapPreview>
  8. </view>
  9. <view class="box3">
  10. <view class="commonMb commonMt">
  11. <view class="addLineSuccess-big-box commonBj">
  12. <view class="addLineSuccess-big-box-top">
  13. <image style="width: 45rpx;height: 45rpx; margin-left: 30rpx;"
  14. src="../../static/images/transport/dingwei.png" mode="widthFix">
  15. </image>
  16. <text class="listTitle">记录信息</text>
  17. </view>
  18. <view class="addLineSuccess-big-box-bottom">
  19. <view class="addLineSuccess-big-box-bottom-item">
  20. <view class="flexAlignCenter">
  21. <view class="greenCircle">
  22. </view>
  23. <text class="itemText">运&nbsp;&nbsp;&nbsp;输&nbsp;&nbsp;名&nbsp;&nbsp;&nbsp;称:</text>
  24. </view>
  25. <view class="flexAlignCenter">
  26. <text class="infoText">{{form.transportName}}</text>
  27. </view>
  28. </view>
  29. <!-- <view class="map">
  30. <mapImg :pathData='pathData' :startPoint='form.startPoint' :endPoint='form.endPoint'
  31. :mtRoutePointList='form.mtRoutePointList'>
  32. </mapImg>
  33. </view> -->
  34. <view class="addLineSuccess-big-box-bottom-item ">
  35. <view class="flexAlignCenter">
  36. <view class="greenCircle">
  37. </view>
  38. <text class="itemText">运输开始时间:</text>
  39. </view>
  40. <view class="flexAlignCenter">
  41. <text class="infoText">{{form.startTime}}</text>
  42. </view>
  43. </view>
  44. <!-- <view class="border-style"></view> -->
  45. <view class="addLineSuccess-big-box-bottom-item ">
  46. <view class="flexAlignCenter">
  47. <view class="greenCircle">
  48. </view>
  49. <text class="itemText">运输结束时间:</text>
  50. </view>
  51. <view class="flexAlignCenter">
  52. <text class="infoText">{{form.endTime}}</text>
  53. </view>
  54. </view>
  55. <!-- <view class="border-style"></view> -->
  56. <view class="addLineSuccess-big-box-bottom-item">
  57. <view class="flexAlignCenter">
  58. <view class="greenCircle">
  59. </view>
  60. <text
  61. class="itemText">车&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;牌&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:</text>
  62. </view>
  63. <view class="flexAlignCenter">
  64. <text class="infoText">{{form.carNumber}}</text>
  65. </view>
  66. </view>
  67. <view class="addLineSuccess-big-box-bottom-item">
  68. <view class="flexAlignCenter">
  69. <view class="greenCircle">
  70. </view>
  71. <text class="itemText">车&nbsp;&nbsp;&nbsp;辆&nbsp;&nbsp;司&nbsp;&nbsp;&nbsp;机:</text>
  72. </view>
  73. <view class="flexAlignCenter">
  74. <text class="infoText">{{form.driverName}}</text>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 车辆状态 -->
  80. <view class="addLineSuccess-big-box mt33 commonBj">
  81. <view class="addLineSuccess-big-box-top">
  82. <image style="width: 45rpx;height: 45rpx; margin-left: 30rpx;"
  83. src="../../static/images/car/yunshu.png" mode="widthFix">
  84. </image>
  85. <text class="listTitle">车辆状态</text>
  86. </view>
  87. <view class="addLineSuccess-big-box-bottom">
  88. <view class="addLineSuccess-big-box-bottom-item block">
  89. <view class="flexAlignCenter">
  90. <view class="greenCircle">
  91. </view>
  92. <text class="itemText">开始车辆状态:</text>
  93. </view>
  94. <view class="space-between state-icon-right mt30">
  95. <view class="state-box-size border radius15">
  96. <!-- <video controls object-fit="fill" @play="playvideo" @fullscreenchange="fullscreenchange"
  97. class="state-box-size border radius15" id="truckVideo" ref="truckVideo"
  98. src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/360e4b20-4f4b-11eb-8a36-ebb87efcf8c0.mp4"></video> -->
  99. <xfx-image-upload :remove="false" :add="false" v-model="startStateVideo"
  100. mediaType="video"></xfx-image-upload>
  101. </view>
  102. <u--image class=" border radius15" radius="15rpx" :key="index"
  103. v-for="(item,index) in startImgList" :showLoading="true" :src="item"
  104. width="180rpx" height="180rpx" @tap="previewStartImg(index)">
  105. </u--image>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="addLineSuccess-big-box mt33 commonBj">
  111. <view class="addLineSuccess-big-box-top">
  112. <image style="width: 45rpx;height: 45rpx; margin-left: 30rpx;"
  113. src="../../static/images/car/yunshu.png" mode="widthFix">
  114. </image>
  115. <text class="listTitle">上传车辆结束运输状态</text>
  116. </view>
  117. <view class="addLineSuccess-big-box-bottom">
  118. <view class="topBox">
  119. <text style="margin-left: 41rpx;">异常情况</text>
  120. <view style="margin-right: 41rpx;" class="rightIcon">
  121. </view>
  122. </view>
  123. <view class="bottomBox">
  124. 车辆因长时间停滞未结束最终运输,定位系
  125. 统已自动执行结束运输
  126. </view>
  127. <view class="textBox" style="margin-bottom: 10rpx;">
  128. <u--form :model="form2" ref="uForm" :rules="rules" labelWidth="0">
  129. <u-form-item class="block-box1" prop="truckState">
  130. <view class="textBox">
  131. <view class="redCircle"></view>
  132. <text class="itemText">车辆状态(<text
  133. class="redText">拍摄结束运输时,车辆外观图片+视频</text>)</text>
  134. </view>
  135. <view class="textBox mt29 flex-start">
  136. <xfx-image-upload uploadType="1" :max="2" :chooseNum="2" v-model="imgList"
  137. @uploadSuccess="UploadSuccessStateImg" @uploadFail="errorTruckImg"
  138. @imgDelete="delTruckImg" mediaType="image" :action="urlConfig">
  139. </xfx-image-upload>
  140. <xfx-image-upload class="ml29" uploadType="2" :max="1" :chooseNum="1"
  141. v-model="carVideo" @uploadSuccess="UploadSuccessVideo"
  142. @uploadFail="errorTruckVideo" @imgDelete="delVideo" mediaType="video"
  143. :action="urlConfig">
  144. </xfx-image-upload>
  145. </view>
  146. </u-form-item>
  147. </u--form>
  148. </view>
  149. </view>
  150. </view>
  151. <u-button @click="confirm" class="custom-style mt33 commonMb" shape="circle"
  152. color="linear-gradient(to top, #FF2D04, #FFA53E)">关闭运输</u-button>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. </template>
  158. <script>
  159. import {
  160. recordDetail
  161. } from "@/api/company/record.js"
  162. import {
  163. pointData
  164. } from "@/api/company/path.js"
  165. import {
  166. errorState
  167. } from "@/api/city/record.js"
  168. import {
  169. editProcess
  170. } from "../../api/company/transport.js"
  171. import config from '@/config.js'
  172. export default {
  173. data() {
  174. return {
  175. // 结束状态的视频
  176. endStateVideo: [],
  177. // 开始状态的视频
  178. startStateVideo: [],
  179. form: {
  180. startPoint: '',
  181. endPoint: '',
  182. mtRoutePointList: []
  183. },
  184. isMap: true,
  185. endImgList: [],
  186. startImgList: [],
  187. startSrcVideo: '',
  188. endSrcVideo: '',
  189. pathData: '',
  190. isInterruptContentObj: {},
  191. isInterruptContent: null,
  192. carVideo: [],
  193. imgList: [],
  194. imgListData: [],
  195. carVideoData: [],
  196. // 图片上传地址
  197. urlConfig: config.baseUrl + '/file/upload',
  198. form2: {
  199. truckState: null,
  200. id: null,
  201. },
  202. rules: {
  203. truckState: [{
  204. validator: (rule, value, callback) => {
  205. return this.carVideo.length === 1 && this.imgList.length === 2
  206. },
  207. message: '请上传二张照片与一段视频'
  208. }, ],
  209. },
  210. }
  211. },
  212. methods: {
  213. // 车辆状态图片上传成功
  214. UploadSuccessStateImg(res) {
  215. var _res = JSON.parse(res.data);
  216. if (_res.code == 200) {
  217. // let obj = {}
  218. // obj.name = this.imgListName
  219. // obj.url = _res.data.url
  220. this.imgListData.push(_res.data);
  221. this.imgList.push(_res.data.url)
  222. }
  223. },
  224. // 车辆状态图片删除
  225. delTruckImg(del, tempFilePaths) {
  226. let obj = {}
  227. if (del.tempFilePaths.length !== 0) {
  228. obj.name = del.tempFilePaths[0].slice(50)
  229. obj.url = del.tempFilePaths[0]
  230. }
  231. this.imgList = del.tempFilePaths;
  232. this.imgListData = this.imgListData.filter(item => {
  233. return item.url === obj.url
  234. })
  235. },
  236. // 车辆图片上传失败的回调
  237. errorTruckImg(res) {},
  238. // 车辆视频上传成功Vedio
  239. UploadSuccessVideo(res, o) {
  240. var _res = JSON.parse(res.data);
  241. if (_res.code == 200) {
  242. this.carVideoData.push(_res.data);
  243. this.srcVideo = _res.data.url;
  244. // this.select();
  245. this.carVideo = [{
  246. cover: o,
  247. url: this.srcVideo
  248. }]
  249. }
  250. },
  251. // 车辆视频删除回调
  252. delVideo(del, tempFilePaths) {
  253. this.carVideo = []
  254. this.carVideoData = []
  255. },
  256. // 视频上传失败的回调
  257. errorTruckVideo(res) {},
  258. editProcess(data) {
  259. console.log(data, 'data');
  260. editProcess(data).then(res => {
  261. console.log(res, 'res');
  262. this.$tab.navigateBack()
  263. // this.$tab.redirectTo('/pages/driverFinishTransport/index')
  264. })
  265. },
  266. confirm() {
  267. this.$refs.uForm.validate().then(res => {
  268. console.log('我通过了', this.form);
  269. // console.log('imgListData', this.imgListData);
  270. // console.log('carVideoData', this.carVideoData);
  271. this.editProcess({
  272. id: this.form2.id,
  273. endVideo: this.carVideoData,
  274. endImg: this.imgListData
  275. })
  276. })
  277. },
  278. select() {
  279. uni.requireNativePlugin('TX-VideoTool').getVideoThumbnailImage({
  280. "videoPath": this.startSrcVideo,
  281. "saveImagePath": plus.io.convertLocalFileSystemURL(
  282. "_doc/TXVideoTool/"),
  283. "saveImageName": "testLocal" + new Date().getTime() + ".png",
  284. "second": 0
  285. }, result => {
  286. this.startStateVideo = [{
  287. cover: result.imagePath,
  288. url: this.startSrcVideo
  289. }]
  290. });
  291. },
  292. // 开始状态图片预览
  293. previewStartImg(current) {
  294. // const urls = this.startImgList.map(item => {
  295. // return item
  296. // })
  297. const urls = []
  298. urls.push(this.startImgList[current])
  299. console.log(urls);
  300. uni.previewImage({
  301. urls
  302. })
  303. },
  304. // 结束图片状态预览
  305. previewEndImg(current) {
  306. // const urls = this.endImgList.map(item => {
  307. // return item
  308. // })
  309. const urls = []
  310. urls.push(this.endImgList[current])
  311. console.log('urls', urls);
  312. uni.previewImage({
  313. urls
  314. })
  315. },
  316. // 字典翻译
  317. translate(obj) {
  318. for (let key in obj) {
  319. console.log(key);
  320. if (this.form.isInterrupt == key) {
  321. this.isInterruptContent = this.isInterruptContentObj[key]
  322. console.log(this.isInterruptContent);
  323. }
  324. }
  325. },
  326. // 获得车辆异常状态字典
  327. async getErrorState() {
  328. const res = await errorState()
  329. console.log('车辆状态', res);
  330. let obj = {}
  331. res.data.forEach((item, index) => {
  332. obj[index + 1] = item.dictLabel
  333. })
  334. console.log('obj', obj);
  335. this.isInterruptContentObj = obj
  336. this.translate(obj)
  337. },
  338. // 获取详情
  339. async getRecordDetail(id) {
  340. this.isMap = false;
  341. const res = await recordDetail(id)
  342. console.log(res);
  343. this.pathData = res.data.id;
  344. this.form = res.data;
  345. this.isMap = true;
  346. this.form.startTime = this.form.startTime.replace(/-/g, '/')
  347. this.form.endTime = this.form.endTime.replace(/-/g, '/')
  348. res.data.startImg.forEach(item => {
  349. this.startImgList.push(item.url)
  350. })
  351. this.startSrcVideo = this.form.startVideo[0].url
  352. this.startStateVideo = [{
  353. url: this.startSrcVideo
  354. }]
  355. this.select();
  356. // pointData(res.data.id).then(resData => {
  357. // console.log('详情', res);
  358. // if (resData.data.runPoints && resData.data.runPoints.length > 0) {
  359. // this.pathData = resData.data.runPoints
  360. // }
  361. // })
  362. }
  363. },
  364. // watch: {
  365. // form: {
  366. // handler(newVal) {
  367. // this.getErrorState()
  368. // },
  369. // deep: true
  370. // },
  371. // },
  372. onLoad(option) {
  373. // console.log(option);
  374. if (option.id) {
  375. this.form2.id = option.id;
  376. this.getRecordDetail(option.id)
  377. }
  378. }
  379. }
  380. </script>
  381. <style lang="scss" scoped>
  382. .add-button {
  383. height: 85rpx;
  384. // background: linear-gradient(0deg, #FFD334 0%, #F59A02 100%);
  385. // box-shadow: 0rpx 2rpx 13rpx 0rpx rgba(27, 43, 95, 0.25);
  386. // border-radius: 28rpx;
  387. font-size: 30rpx;
  388. font-weight: bold;
  389. color: #FFFFFF;
  390. border: 0;
  391. margin-top: 27rpx;
  392. }
  393. .fontGreen {
  394. color: #007C3C !important;
  395. }
  396. .bg-color-green {
  397. background: #36C372 !important;
  398. }
  399. .fontColor {
  400. color: #FC5536 !important;
  401. }
  402. .fontWeight {
  403. font-weight: bold !important;
  404. }
  405. .bg-color-red {
  406. background: #FB5637 !important;
  407. }
  408. .block {
  409. display: block !important;
  410. }
  411. .radius15 {
  412. border-radius: 15rpx;
  413. }
  414. .border {
  415. border: 1rpx solid #495B93;
  416. }
  417. .state-box-size {
  418. width: 180rpx;
  419. height: 180rpx;
  420. }
  421. .mt30 {
  422. margin-top: 30rpx;
  423. }
  424. .space-between {
  425. justify-content: space-between;
  426. }
  427. .mt33 {
  428. margin-top: 33rpx;
  429. }
  430. .addLineSuccess-big-box {
  431. .addLineSuccess-big-box-top {
  432. height: 69rpx;
  433. background: #7FB5FF;
  434. border-radius: 28rpx 28rpx 0rpx 0rpx;
  435. display: flex;
  436. align-items: center;
  437. font-size: 26rpx;
  438. font-weight: bold;
  439. color: #FFFFFF;
  440. }
  441. .addLineSuccess-big-box-bottom {
  442. padding: 0rpx 39rpx;
  443. .addLineSuccess-big-box-bottom-item {
  444. display: flex;
  445. margin: 36rpx auto;
  446. .state-icon-left {
  447. display: flex;
  448. align-items: center;
  449. .green-circle {
  450. width: 15rpx;
  451. height: 15rpx;
  452. background: #36C372;
  453. border-radius: 50%;
  454. margin-right: 16rpx;
  455. }
  456. uni-text {
  457. font-size: 26rpx;
  458. font-weight: bold;
  459. color: #495B93;
  460. }
  461. }
  462. .state-icon-right {
  463. display: flex;
  464. align-items: center;
  465. uni-text {
  466. font-size: 26rpx;
  467. font-weight: 400;
  468. color: #333333;
  469. margin-left: 14rpx;
  470. }
  471. }
  472. }
  473. .map {
  474. height: 339rpx;
  475. background: #FFFFFF;
  476. border: 2rpx solid #495B93;
  477. border-radius: 15rpx;
  478. margin: 25rpx auto 40rpx;
  479. }
  480. // .border-style {
  481. // border-top: 1rpx dashed #F98803;
  482. // margin: 0 auto;
  483. // }
  484. }
  485. }
  486. /deep/.xfx-image-upload-Item {
  487. margin-right: 0;
  488. margin-bottom: 0;
  489. width: 180rpx;
  490. height: 180rpx;
  491. }
  492. .topBox {
  493. // width: 599rpx;
  494. height: 78rpx;
  495. background: linear-gradient(0deg, #FF2D04 0%, #FF7D1D 100%);
  496. border-radius: 28rpx 28rpx 0px 0px;
  497. margin-top: 33rpx;
  498. display: flex;
  499. justify-content: space-between;
  500. align-items: center;
  501. font-size: 28rpx;
  502. font-weight: bold;
  503. color: #FFFFFF;
  504. }
  505. .rightIcon {
  506. height: 48rpx;
  507. width: 48rpx;
  508. // border: #F59A02 solid 1px;
  509. background: url('../../static/images/transport/3.png') no-repeat;
  510. background-size: 100% 100%;
  511. }
  512. .bottomBox {
  513. // width: 517rpx;
  514. background: rgba(255, 255, 255, 0.4);
  515. border: 2rpx solid #FB5637;
  516. border-radius: 0px 0px 28rpx 28rpx;
  517. padding: 36rpx 41rpx;
  518. text-align: center;
  519. font-size: 28rpx;
  520. font-weight: bold;
  521. color: #FB5637;
  522. }
  523. // 车辆状态上传图片
  524. .flex-start {
  525. justify-content: start;
  526. /deep/.xfx-image-upload-list {
  527. // border: 2rpx solid #495B93;
  528. // border-radius: 15rpx;
  529. // // width: 160rpx;
  530. // height: 160rpx;
  531. .xfx-image-upload-Item {
  532. width: 180rpx;
  533. height: 180rpx;
  534. margin-right: 0;
  535. margin-bottom: 0;
  536. border: 2rpx solid #495B93;
  537. border-radius: 15rpx;
  538. // background-color: rgba(255, 255, 255, 0.1);
  539. &:not(:first-child) {
  540. margin-left: 20rpx;
  541. }
  542. &:nth-child(1) {
  543. background-color: rgba(255, 255, 255, 0.1);
  544. }
  545. }
  546. .xfx-image-upload-Item-add {
  547. padding-top: 36rpx;
  548. .text-upload {
  549. margin-top: 0;
  550. }
  551. }
  552. }
  553. }
  554. .textBox {
  555. display: flex;
  556. align-items: center;
  557. // margin-left: 10px;
  558. width: 100%;
  559. }
  560. .mt29 {
  561. margin-top: 29rpx;
  562. }
  563. .ml29 {
  564. margin-left: 20rpx;
  565. }
  566. /deep/ .block-box1 .u-form-item__body__right__content__slot {
  567. display: block;
  568. }
  569. /deep/ .block-box1 .u-form-item__body {
  570. display: block;
  571. .u-form-item__body__right {
  572. // margin-top: 29rpx;
  573. .u-form-item__body__right__content__slot {
  574. align-items: start;
  575. .u-upload {
  576. display: block;
  577. flex: 0;
  578. // margin-right: 8rpx;
  579. .u-upload__wrap {
  580. flex-direction: row;
  581. flex-wrap: nowrap;
  582. justify-content: space-between;
  583. // width: 400rpx;
  584. .u-upload__wrap__preview {
  585. border-radius: 15rpx;
  586. overflow: visible;
  587. margin: 0 52rpx 0 0;
  588. &:nth-child(2) {
  589. margin-right: 26rpx !important;
  590. }
  591. .u-upload__wrap__preview__image {
  592. // border-radius: 15rpx !important;
  593. width: 167rpx !important;
  594. height: 167rpx !important;
  595. // border: 2rpx solid #495B93;
  596. }
  597. }
  598. .u-upload__button {
  599. background: rgba(255, 255, 255, 0.1);
  600. border: 1px solid #495B93;
  601. border-radius: 15px;
  602. }
  603. }
  604. }
  605. }
  606. }
  607. }
  608. </style>