voyageDetail.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  1. <template>
  2. <div class="line-container-p24">
  3. <i class="el-icon-arrow-left"></i>
  4. <div
  5. class="dib go-back ml8 pointer"
  6. @click="router.replace('/voyage/voyageList')"
  7. >
  8. 返回航次列表
  9. </div>
  10. </div>
  11. <div class="container-title df aic jcsb">
  12. <div>船舶信息</div>
  13. <el-button
  14. style="width: 220px; margin-right: 20px"
  15. type="primary"
  16. @click="downloadExcel"
  17. :loading="isLoadingExcel"
  18. >
  19. 下载船舶跟踪表
  20. </el-button>
  21. </div>
  22. <div class="line-container-p24">
  23. <div class="line">
  24. <div class="info-line">
  25. <div class="info-line-title">航次名称</div>
  26. <el-input
  27. class="info-line-text"
  28. v-model="voyage.voyageName"
  29. disabled
  30. ></el-input>
  31. </div>
  32. <div class="info-line">
  33. <div class="info-line-title">货主</div>
  34. <el-input
  35. class="info-line-text"
  36. v-model="voyage.cargoOwnerName"
  37. disabled
  38. ></el-input>
  39. </div>
  40. </div>
  41. <!-- <div class="line">
  42. <div class="info-line">
  43. <div class="info-line-title">船东</div>
  44. <el-input
  45. class="info-line-text"
  46. v-model="voyage.shipOwnerName"
  47. disabled
  48. ></el-input>
  49. </div>
  50. <div class="info-line">
  51. <div class="info-line-title">船东手机号</div>
  52. <el-input
  53. class="info-line-text"
  54. v-model="voyage.shipOwnerPhone"
  55. disabled
  56. ></el-input>
  57. </div>
  58. </div> -->
  59. <div class="line">
  60. <div class="info-line">
  61. <div class="info-line-title">船舶</div>
  62. <el-input
  63. class="info-line-text"
  64. v-model="voyage.shipName"
  65. disabled
  66. ></el-input>
  67. </div>
  68. <div class="info-line">
  69. <div class="info-line-title">MMSI</div>
  70. <el-input
  71. class="info-line-text"
  72. v-model="voyage.shipMmsi"
  73. disabled
  74. ></el-input>
  75. </div>
  76. </div>
  77. <div id="map-container" class="map-container"></div>
  78. <div class="line" style="margin-top: 30px">
  79. <div class="info-line">
  80. <div class="info-line-title">开始时间</div>
  81. <el-input
  82. class="info-line-text"
  83. v-model="voyage.startTime"
  84. disabled
  85. ></el-input>
  86. </div>
  87. <div class="info-line">
  88. <div class="info-line-title">结束时间</div>
  89. <el-input
  90. class="info-line-text"
  91. v-model="voyage.endTime"
  92. disabled
  93. ></el-input>
  94. </div>
  95. </div>
  96. <div class="line">
  97. <div class="info-line">
  98. <div class="info-line-title">装货港</div>
  99. <el-input
  100. class="info-line-text"
  101. v-model="voyage.loadPort"
  102. disabled
  103. ></el-input>
  104. </div>
  105. <div class="info-line">
  106. <div class="info-line-title">卸货港</div>
  107. <el-input
  108. class="info-line-text"
  109. v-model="voyage.dischargeProt"
  110. disabled
  111. ></el-input>
  112. </div>
  113. </div>
  114. <div class="line">
  115. <div class="info-line">
  116. <div class="info-line-title">货种</div>
  117. <el-input
  118. class="info-line-text"
  119. v-model="voyage.cargo"
  120. disabled
  121. ></el-input>
  122. </div>
  123. <div class="info-line">
  124. <div class="info-line-title">吨位</div>
  125. <el-input
  126. class="info-line-text"
  127. v-model="voyage.tons"
  128. disabled
  129. ></el-input>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="container-title">航次信息</div>
  134. <div class="line-container-p24">
  135. <div class="line">
  136. <div class="info-line">
  137. <div class="info-line-title">到达装货港时间</div>
  138. <el-date-picker
  139. class="info-line-text"
  140. v-model="voyage.arrivalLoadPortTime"
  141. type="datetime"
  142. format="YYYY/MM/DD HH:mm:ss"
  143. value-format="YYYY/MM/DD HH:mm:ss"
  144. placeholder="到达装货港时间"
  145. :disabled="disabledStatus"
  146. ></el-date-picker>
  147. </div>
  148. <div class="info-line">
  149. <div class="info-line-title">实装吨位</div>
  150. <el-input
  151. class="info-line-text"
  152. v-model="voyage.actualDischargeTons"
  153. :disabled="disabledStatus"
  154. placeholder="实装吨位"
  155. ></el-input>
  156. </div>
  157. </div>
  158. <div class="line">
  159. <div class="info-line">
  160. <div class="info-line-title">装货开始时间</div>
  161. <el-date-picker
  162. class="info-line-text"
  163. v-model="voyage.loadStartTime"
  164. type="datetime"
  165. format="YYYY/MM/DD HH:mm:ss"
  166. value-format="YYYY/MM/DD HH:mm:ss"
  167. placeholder="装货开始时间"
  168. :disabled="disabledStatus"
  169. ></el-date-picker>
  170. </div>
  171. <div class="info-line">
  172. <div class="info-line-title">装货结束时间</div>
  173. <el-date-picker
  174. class="info-line-text"
  175. v-model="voyage.loadEndTime"
  176. type="datetime"
  177. format="YYYY/MM/DD HH:mm:ss"
  178. value-format="YYYY/MM/DD HH:mm:ss"
  179. placeholder="装货开始时间"
  180. :disabled="disabledStatus"
  181. ></el-date-picker>
  182. </div>
  183. </div>
  184. <div class="line">
  185. <div class="info-line">
  186. <div class="info-line-title">开航时间</div>
  187. <el-date-picker
  188. class="info-line-text"
  189. v-model="voyage.setSailTime"
  190. type="datetime"
  191. format="YYYY/MM/DD HH:mm:ss"
  192. value-format="YYYY/MM/DD HH:mm:ss"
  193. placeholder="开航时间"
  194. :disabled="disabledStatus"
  195. ></el-date-picker>
  196. </div>
  197. <div class="info-line">
  198. <div class="info-line-title">预计到港时间</div>
  199. <el-date-picker
  200. class="info-line-text"
  201. v-model="voyage.expectedArrivalTime"
  202. type="datetime"
  203. format="YYYY/MM/DD"
  204. value-format="YYYY/MM/DD HH:mm:ss"
  205. placeholder="预计到港时间"
  206. :disabled="disabledStatus"
  207. ></el-date-picker>
  208. </div>
  209. </div>
  210. <div class="line">
  211. <div class="info-line">
  212. <div class="info-line-title">实际到港时间</div>
  213. <el-date-picker
  214. class="info-line-text"
  215. v-model="voyage.actualArrivalTime"
  216. type="datetime"
  217. format="YYYY/MM/DD HH:mm:ss"
  218. value-format="YYYY/MM/DD HH:mm:ss"
  219. placeholder="实际到港时间"
  220. :disabled="disabledStatus"
  221. ></el-date-picker>
  222. </div>
  223. <!-- <div class="info-line">
  224. <div class="info-line-title">抵达目的地港时间</div>
  225. <el-date-picker
  226. class="info-line-text"
  227. v-model="voyage.arrivalPortTime"
  228. type="datetime"
  229. format="YYYY/MM/DD HH:mm:ss"
  230. value-format="YYYY/MM/DD HH:mm:ss"
  231. placeholder="抵达目的地港时间"
  232. :disabled="disabledStatus"
  233. ></el-date-picker>
  234. </div> -->
  235. </div>
  236. <div class="line">
  237. <div class="info-line">
  238. <div class="info-line-title">卸货开始时间</div>
  239. <el-date-picker
  240. class="info-line-text"
  241. v-model="voyage.dischargeStartTime"
  242. type="datetime"
  243. format="YYYY/MM/DD HH:mm:ss"
  244. value-format="YYYY/MM/DD HH:mm:ss"
  245. placeholder="卸货开始时间"
  246. :disabled="disabledStatus"
  247. ></el-date-picker>
  248. </div>
  249. <div class="info-line">
  250. <div class="info-line-title">卸货结束时间</div>
  251. <el-date-picker
  252. class="info-line-text"
  253. v-model="voyage.dischargeEndTime"
  254. type="datetime"
  255. format="YYYY/MM/DD HH:mm:ss"
  256. value-format="YYYY/MM/DD HH:mm:ss"
  257. placeholder="卸货结束时间"
  258. :disabled="disabledStatus"
  259. ></el-date-picker>
  260. </div>
  261. </div>
  262. <div class="line">
  263. <div class="info-line">
  264. <div class="info-line-title">实际卸货吨位</div>
  265. <el-input
  266. class="info-line-text"
  267. placeholder="实际卸货吨位"
  268. v-model="voyage.actualDischargeTons"
  269. :disabled="disabledStatus"
  270. ></el-input>
  271. </div>
  272. </div>
  273. <div class="line">
  274. <div class="info-line">
  275. <div class="info-line-title">备注</div>
  276. <el-input
  277. class="info-line-textarea"
  278. v-model="voyage.remark"
  279. autosize
  280. type="textarea"
  281. :disabled="disabledStatus"
  282. ></el-input>
  283. </div>
  284. </div>
  285. </div>
  286. <div class="container-title">卸货记录</div>
  287. <div class="line-container-p24">
  288. <el-card
  289. style="
  290. width: 800px;
  291. margin-left: 40px;
  292. margin-top: 50px;
  293. margin-bottom: 40px;
  294. "
  295. >
  296. <el-table :data="dischargeList" stripe>
  297. <el-table-column
  298. type="index"
  299. label="序号"
  300. min-width="80"
  301. align="center"
  302. ></el-table-column>
  303. <el-table-column
  304. prop="dischargeTons"
  305. label="卸货吨位"
  306. min-width="100"
  307. align="center"
  308. ></el-table-column>
  309. <el-table-column
  310. prop="dischargeTime"
  311. label="卸货时间"
  312. min-width="120"
  313. align="center"
  314. ></el-table-column>
  315. <el-table-column label="磅单" min-width="150" align="center">
  316. <template v-slot="scope">
  317. <el-image
  318. v-if="scope.row.viewUrl"
  319. style="width: 50px; height: 50px"
  320. :src="scope.row.viewUrl"
  321. fit="contain"
  322. :preview-src-list="previewPoundList"
  323. ></el-image>
  324. </template>
  325. </el-table-column>
  326. </el-table>
  327. <el-dialog v-model="dialogVisible" title="图片预览" width="30%">
  328. <el-image
  329. :src="dialogImageUrl"
  330. style="height: 100%; width: 100%"
  331. ></el-image>
  332. </el-dialog>
  333. <div style="width: 100%; text-align: right; margin-top: 43px">
  334. <el-pagination
  335. background
  336. layout="prev, pager, next"
  337. :total="total"
  338. @current-change="pageChange"
  339. ></el-pagination>
  340. </div>
  341. </el-card>
  342. </div>
  343. <div class="container-title">保险单列表</div>
  344. <div class="line-container-p24" style="padding-left: 60px">
  345. <el-image
  346. style="width: 200px; height: 200px; margin-right: 20px"
  347. :src="item.viewUrl"
  348. v-for="item in policyList"
  349. :key="item"
  350. @click="openMediaModal(item.viewUrl, 1, '保险单查看')"
  351. ></el-image>
  352. </div>
  353. <div class="container-title">运单列表</div>
  354. <div class="line-container-p24" style="padding-left: 60px">
  355. <el-image
  356. style="width: 200px; height: 200px; margin-right: 20px"
  357. :src="item.viewUrl"
  358. v-for="item in voyageBill"
  359. :key="item"
  360. @click="openMediaModal(item.viewUrl, 1, '运单查看')"
  361. ></el-image>
  362. </div>
  363. <div class="container-title">航次图片</div>
  364. <div class="line-container-p24">
  365. <div v-if="medias.length" class="medias-content df ffw">
  366. <div class="pic-container">
  367. <div v-for="(item, index) in medias" :key="item" class="pic-main">
  368. <div
  369. :class="[
  370. 'box',
  371. index % 2 == 0 ? '' : 'bottom-box',
  372. item.status == 1 ? 'now-box' : '',
  373. ]"
  374. >
  375. <div class="card-note">
  376. {{ item.shipName }} 拍摄于
  377. <br />
  378. {{ item.createTime }}
  379. </div>
  380. <div class="medias-box" style="position: relative">
  381. <el-image
  382. v-if="item.mediaType == 1"
  383. style="width: 100%; height: 100%"
  384. fit="contain"
  385. :src="item.downloadUrl"
  386. :preview-src-list="modalPreview"
  387. @click="openMediaModal(item.downloadUrl, 1, '图片审核')"
  388. ></el-image>
  389. <video
  390. style="width: 100%; height: 100%"
  391. v-else
  392. :src="item.downloadUrl"
  393. ></video>
  394. <img
  395. @click="openMediaModal(item.downloadUrl, 2, '视频审核')"
  396. v-if="item.mediaType == 2"
  397. src="../../assets/icon-player.png"
  398. style="
  399. object-fit: contain;
  400. width: 40px;
  401. height: 40px;
  402. position: absolute;
  403. top: calc(50% - 20px);
  404. left: calc(50% - 20px);
  405. background: #fff;
  406. border-radius: 50%;
  407. "
  408. alt=""
  409. />
  410. </div>
  411. </div>
  412. <div
  413. :class="[
  414. 's-line',
  415. index % 2 == 0 ? '' : 'top210px',
  416. item.status == 1 ? 'now-s-line' : '',
  417. ]"
  418. ></div>
  419. <div :class="['point', item.status == 1 ? '' : 'now-point']"></div>
  420. <div
  421. :class="['l-line', item.status == 1 ? 'now-l-line' : '']"
  422. v-if="index + 1 != medias.length"
  423. ></div>
  424. </div>
  425. </div>
  426. </div>
  427. <el-dialog v-model="mediaModal" :title="modalTitle" width="20%">
  428. <el-image
  429. v-if="modalType == 1"
  430. style="width: 100%; height: 100%"
  431. fit="contain"
  432. :src="currentUrl"
  433. :preview-src-list="modalPreview"
  434. ></el-image>
  435. <video
  436. v-else
  437. autoplay
  438. controls
  439. style="width: 100%; height: 100%"
  440. :src="currentUrl"
  441. ></video>
  442. </el-dialog>
  443. </div>
  444. </template>
  445. <script>
  446. import { onMounted, reactive, ref, toRefs } from "vue";
  447. import api from "../../apis/fetch";
  448. import { useRoute } from "vue-router";
  449. import _ from "lodash";
  450. import router from "../../router";
  451. import store from "../../store";
  452. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  453. import downloadBlobFile from "../../utils/downloadBlobFile";
  454. export default {
  455. setup() {
  456. const route = useRoute();
  457. let map = ref();
  458. let voyage = ref({});
  459. let medias = ref([]);
  460. let coordinates = ref();
  461. let previewSrcList = ref([]);
  462. let policyList = ref([]);
  463. let previewPoundList = ref([]);
  464. async function getVoyageDetail(type) {
  465. let res = await api.getVoyageDetail({
  466. type: localStorage.userType,
  467. voyageId: route.query.id,
  468. });
  469. if (res.data.status == 0) {
  470. if (type) {
  471. ElNotification({
  472. type: "success",
  473. title: res.data.msg,
  474. });
  475. }
  476. coordinates.value = res.data.result.coordinates;
  477. voyage.value = res.data.result.voyage;
  478. medias.value = res.data.result.medias;
  479. for (let i of res.data.result.policys || []) {
  480. policyList.value.push({
  481. ...i,
  482. url: i.viewUrl,
  483. });
  484. }
  485. for (let i of res.data.result.waybills) {
  486. voyageBill.value.push({
  487. ...i,
  488. url: i.viewUrl,
  489. });
  490. }
  491. for (let i of medias.value) {
  492. previewSrcList.value.push(i.downloadUrl);
  493. }
  494. initMap();
  495. } else {
  496. console.log(res);
  497. ElNotification({
  498. type: "error",
  499. title: res.data.msg,
  500. });
  501. }
  502. }
  503. let total = ref(0);
  504. function pageChange(e) {
  505. dischargeCurrentPage.value = e;
  506. getDischargeList();
  507. }
  508. async function addDischarge() {
  509. if (!formInline.value.dischargeTime || !formInline.value.dischargeTons)
  510. return;
  511. let res = await api.addDischarge({
  512. ...formInline.value,
  513. voyageId: route.query.id,
  514. });
  515. if (res.data.status == 0) {
  516. getDischargeList(1);
  517. formInline.value = {};
  518. } else {
  519. console.log(res);
  520. }
  521. }
  522. async function deleteDischarge(id, index) {
  523. let res = await api.deleteDischarge({
  524. id,
  525. });
  526. if (res.data.status == 0) {
  527. dischargeList.value.splice(index, 1);
  528. ElNotification({
  529. type: "success",
  530. title: res.data.msg,
  531. });
  532. } else {
  533. console.log(res);
  534. ElNotification({
  535. type: "error",
  536. title: res.data.msg,
  537. });
  538. }
  539. }
  540. async function exportExcel() {}
  541. let dischargeCurrentPage = ref(1);
  542. let dischargeList = ref();
  543. let formInline = ref({});
  544. async function getDischargeList(type) {
  545. let res = await api.getDischargeList({
  546. voyageId: route.query.id,
  547. currentPage: dischargeCurrentPage.value,
  548. size: 10,
  549. });
  550. if (res.data.status == 0) {
  551. dischargeList.value = res.data.result;
  552. for (let i of dischargeList.value) {
  553. if (i.viewUrl) {
  554. previewPoundList.value.push(i.viewUrl);
  555. }
  556. }
  557. total.value = res.data.total;
  558. } else {
  559. console.log(res);
  560. }
  561. }
  562. let updateForm = ref({});
  563. let updateDischargeDialog = ref(false);
  564. let currentUpdateIndex = ref(-1);
  565. async function updateDischarge() {
  566. let res = await api.updateDischarge({
  567. ...updateForm.value,
  568. });
  569. if (res.data.status == 0) {
  570. dischargeList.value[currentUpdateIndex.value] = res.data.result;
  571. cancelUpdateDischarge();
  572. ElNotification({
  573. type: "success",
  574. title: res.data.msg,
  575. });
  576. } else {
  577. console.log(res);
  578. ElNotification({
  579. type: "error",
  580. title: res.data.msg,
  581. });
  582. }
  583. }
  584. function showUpdateDischarge(item, index) {
  585. updateDischargeDialog.value = true;
  586. updateForm.value = {
  587. ...item,
  588. };
  589. delete updateForm.value.createTime;
  590. delete updateForm.value.voyageId;
  591. currentUpdateIndex.value = index;
  592. }
  593. function cancelUpdateDischarge() {
  594. updateDischargeDialog.value = false;
  595. updateForm.value = {};
  596. currentUpdateIndex.value = -1;
  597. }
  598. function initMap() {
  599. map.value = new AMap.Map("map-container", {
  600. zoom: 11, //级别
  601. center: [120.563757, 31.891174], //中心点坐标
  602. mapStyle: "amap://styles/f48d96805f5fa7f5aada657c5ee37017",
  603. });
  604. let toolBar = new AMap.ToolBar({
  605. position: {
  606. top: "40px",
  607. right: "40px",
  608. },
  609. });
  610. let hawkEye = new AMap.HawkEye({
  611. opened: false,
  612. });
  613. map.value.addControl(toolBar);
  614. map.value.addControl(hawkEye);
  615. return;
  616. let markers = [];
  617. for (let i of medias.value) {
  618. let content = `<div style='width:160px'>
  619. ${
  620. i.audit == -1
  621. ? `<img id='img${i.id}' style='width:160px;height:160px;object-fit:contain;' src='${i.viewUrl}'/>`
  622. : ``
  623. }
  624. <img src='https://hhd-pat-1255802371.cos.ap-shanghai.myqcloud.com/frontend/ship-red-icon.png' style='display:block;width:20px;height:20px;margin:6px auto'/
  625. </div>`;
  626. let marker = new AMap.Marker({
  627. content,
  628. position: new AMap.LngLat(i.longitude, i.latitude),
  629. offset: new AMap.Pixel(-75, i.audit == 1 ? -195 : -30),
  630. });
  631. if (i.audit == 1) {
  632. marker.on("click", () => {
  633. openMediaModal(i.viewUrl, 1, "航次图片", i);
  634. });
  635. }
  636. markers.push(marker);
  637. }
  638. let overlayGroups = new AMap.OverlayGroup(markers);
  639. map.value.on("complete", function () {
  640. let t = setTimeout(() => {
  641. map.value.add(overlayGroups);
  642. map.value.setFitView(markers, true, [200, 50, 0, 0], 18);
  643. clearTimeout(t);
  644. }, 2000);
  645. });
  646. }
  647. function setShipMarker(longitude = 121.524761, latitude = 31.228721) {
  648. map.value.setCenter([longitude, latitude]);
  649. var marker = new AMap.Marker({
  650. position: new AMap.LngLat(longitude, latitude),
  651. offset: new AMap.Pixel(-20, -20),
  652. size: new AMap.Size(80, 80),
  653. icon: "https://hhd-pat-1255802371.cos.ap-shanghai.myqcloud.com/frontend/ship-red-icon.png", // 添加 Icon 图标 URL
  654. title: "",
  655. });
  656. map.value.add(marker);
  657. }
  658. let disabledStatus = ref(true);
  659. let updateCache = {};
  660. function changeVoyageInfo() {
  661. updateCache = _.cloneDeep(voyage.value);
  662. disabledStatus.value = false;
  663. }
  664. function cancelVoyageChange() {
  665. voyage.value = updateCache;
  666. disabledStatus.value = true;
  667. }
  668. async function submitVoyageChange() {
  669. let {
  670. id,
  671. transStatus,
  672. loadStartTime,
  673. loadEndTime,
  674. dischargeStartTime,
  675. dischargeEndTime,
  676. actualDischargeTons,
  677. remark,
  678. } = voyage.value;
  679. let res = await api.updateVoyage({
  680. id,
  681. transStatus,
  682. loadStartTime,
  683. loadEndTime,
  684. dischargeStartTime,
  685. dischargeEndTime,
  686. actualDischargeTons,
  687. remark,
  688. });
  689. if (res.data.status == 0) {
  690. ElNotification({
  691. type: "success",
  692. title: res.data.msg,
  693. });
  694. disabledStatus.value = true;
  695. } else {
  696. ElNotification({
  697. type: "error",
  698. title: res.data.msg,
  699. });
  700. console.log(res);
  701. }
  702. }
  703. let options = ref([
  704. { value: 0, label: "请选择" },
  705. {
  706. value: 1,
  707. label: "航行",
  708. },
  709. {
  710. value: 2,
  711. label: "停泊",
  712. },
  713. {
  714. value: 3,
  715. label: "装货",
  716. },
  717. {
  718. value: 4,
  719. label: "运输中",
  720. },
  721. {
  722. value: 5,
  723. label: "卸货",
  724. },
  725. ]);
  726. async function finishVoyage() {
  727. if (!voyage.value.dischargeEndTime) return;
  728. let res = await api.finishVoyage({
  729. voyageId: route.query.id,
  730. });
  731. if (res.data.status == 0) {
  732. voyage.value.voyageStatus = 2;
  733. ElNotification({
  734. type: "success",
  735. title: res.data.msg,
  736. });
  737. } else {
  738. ElNotification({
  739. type: "error",
  740. title: res.data.msg,
  741. });
  742. console.log(res);
  743. }
  744. }
  745. let currentUrl = ref("");
  746. let mediaModal = ref(false);
  747. let modalType = ref(1);
  748. let modalTitle = ref();
  749. let modalPreview = ref([]);
  750. function openMediaModal(url, type, title) {
  751. console.log(url, type, title);
  752. modalPreview.value = [url];
  753. modalTitle.value = title;
  754. modalType.value = type;
  755. currentUrl.value = url;
  756. mediaModal.value = true;
  757. }
  758. async function auditMedia(mediaId, a, index, mediaType) {
  759. console.log(mediaId, a, index, mediaType);
  760. let res = await api.auditMedia({
  761. mediaId,
  762. audit: a,
  763. });
  764. if (res.data.status == 0) {
  765. medias.value[index].audit = a;
  766. ElNotification({
  767. type: "success",
  768. title: res.data.msg,
  769. });
  770. } else {
  771. console.log(res);
  772. }
  773. }
  774. let dialogImageUrl = ref();
  775. let dialogVisible = ref(false);
  776. function handlePictureCardPreview(file) {
  777. dialogVisible.value = true;
  778. dialogImageUrl.value = file.url;
  779. }
  780. async function handleRemoveBill(file, list) {
  781. let cache = _.cloneDeep(voyageBill.value);
  782. console.log(cache);
  783. ElMessageBox.confirm("确认删除运单?", "Warning", {
  784. confirmButtonText: "删除",
  785. cancelButtonText: "取消",
  786. type: "warning",
  787. })
  788. .then(async () => {
  789. let { id } = file;
  790. let res = await api.deleteWaybill({
  791. id,
  792. });
  793. if (res.data.status == 0) {
  794. ElMessage({
  795. message: "删除成功!",
  796. type: "success",
  797. });
  798. voyageBill.value = list;
  799. }
  800. })
  801. .catch(() => {
  802. voyageBill.value = cache;
  803. ElMessage({
  804. type: "info",
  805. message: "取消删除",
  806. });
  807. });
  808. }
  809. let voyageBill = ref([]);
  810. function billUploadSuccess(response, file, list) {
  811. list[list.length - 1] = {
  812. ...response.result,
  813. url: response.result.viewUrl,
  814. };
  815. console.log(list);
  816. voyageBill.value = list;
  817. }
  818. let billParams = ref({
  819. voyageId: route.query.id,
  820. });
  821. async function calExpectedArrivalTime() {
  822. let res = await api.calExpectedArrivalTime({
  823. voyageId: route.query.id,
  824. setSailTime: voyage.value.setSailTime,
  825. });
  826. if (res.data.status == 0) {
  827. voyage.value.expectedArrivalTime = res.data.result;
  828. }
  829. }
  830. let isLoadingExcel = ref(false);
  831. async function downloadExcel() {
  832. isLoadingExcel.value = true;
  833. let res = await downloadBlobFile(
  834. "https://interface.huihenduo.com.cn/hhd-pat/voyage/exportExcel",
  835. { voyageId: route.query.id },
  836. "船舶跟踪表",
  837. "post"
  838. );
  839. if (res) {
  840. isLoadingExcel.value = false;
  841. }
  842. }
  843. onMounted(() => {
  844. getVoyageDetail(1);
  845. getDischargeList(1);
  846. });
  847. return {
  848. downloadExcel,
  849. isLoadingExcel,
  850. options,
  851. voyage,
  852. coordinates,
  853. medias,
  854. disabledStatus,
  855. changeVoyageInfo,
  856. cancelVoyageChange,
  857. submitVoyageChange,
  858. finishVoyage,
  859. openMediaModal,
  860. previewSrcList,
  861. router,
  862. auditMedia,
  863. modalType,
  864. modalTitle,
  865. currentUrl,
  866. mediaModal,
  867. modalPreview,
  868. addDischarge,
  869. deleteDischarge,
  870. exportExcel,
  871. dischargeCurrentPage,
  872. dischargeList,
  873. getDischargeList,
  874. updateDischarge,
  875. total,
  876. pageChange,
  877. formInline,
  878. updateDischargeDialog,
  879. showUpdateDischarge,
  880. cancelUpdateDischarge,
  881. updateForm,
  882. dialogImageUrl,
  883. dialogVisible,
  884. handlePictureCardPreview,
  885. handleRemoveBill,
  886. voyageBill,
  887. billUploadSuccess,
  888. billParams,
  889. calExpectedArrivalTime,
  890. policyList,
  891. previewPoundList,
  892. };
  893. },
  894. };
  895. </script>
  896. <style scoped>
  897. .map-container {
  898. width: 100%;
  899. height: 500px;
  900. }
  901. .card-note {
  902. height: 30px;
  903. font-size: 12px;
  904. font-family: PingFangSC-Regular, PingFang SC;
  905. font-weight: 400;
  906. color: #777777;
  907. }
  908. .medias-box {
  909. width: 200px;
  910. height: 200px;
  911. margin-top: 20px;
  912. }
  913. .checkbox-group {
  914. width: 200px;
  915. height: 50px;
  916. margin-top: 20px;
  917. }
  918. .medias-content {
  919. width: 100%;
  920. height: 600px;
  921. background: #f7f7f7;
  922. border-radius: 2px;
  923. }
  924. .pic-container {
  925. width: 100%;
  926. height: 100%;
  927. box-sizing: border-box;
  928. display: flex;
  929. padding: 30px;
  930. overflow-x: scroll;
  931. overflow-y: hidden;
  932. white-space: nowrap;
  933. }
  934. .pic-main {
  935. position: relative;
  936. width: 120px;
  937. }
  938. .box {
  939. position: absolute;
  940. height: 240px;
  941. width: var(--box-width);
  942. border: 5px solid #dddddd;
  943. transition: all 0.5s;
  944. background: #fff;
  945. z-index: 10;
  946. }
  947. .point {
  948. position: relative;
  949. left: 93px;
  950. top: 258px;
  951. width: 16px;
  952. height: 16px;
  953. background-image: url(../../assets/blue-circle.png);
  954. }
  955. .s-line {
  956. position: absolute;
  957. left: 100px;
  958. top: 242px;
  959. height: 20px;
  960. border-left: 2px dashed;
  961. box-sizing: border-box;
  962. border-color: #ddd;
  963. }
  964. .l-line {
  965. position: relative;
  966. bottom: 30px;
  967. left: 111px;
  968. top: 249px;
  969. height: 3px;
  970. width: 100px;
  971. background-color: #dddddd;
  972. }
  973. .bottom-box {
  974. top: 290px;
  975. }
  976. .top210px {
  977. top: 270px;
  978. }
  979. .box:hover {
  980. transform: scale(1.2);
  981. }
  982. .medias-box {
  983. width: 80px;
  984. height: 80px;
  985. margin-top: 10px;
  986. }
  987. .card-note {
  988. height: 30px;
  989. font-size: 12px;
  990. font-family: PingFangSC-Regular, PingFang SC;
  991. font-weight: 400;
  992. color: #777777;
  993. padding: 10px 20px;
  994. }
  995. .medias-box {
  996. width: 100%;
  997. height: 100px;
  998. margin-top: 20px;
  999. }
  1000. .checkbox-group {
  1001. width: 180px;
  1002. height: 50px;
  1003. margin-top: 20px;
  1004. }
  1005. .el-checkbox {
  1006. margin: 0;
  1007. }
  1008. .now-box {
  1009. border: 5px solid #0094fe;
  1010. }
  1011. .now-l-line {
  1012. background-color: #0094fe;
  1013. }
  1014. .now-s-line {
  1015. border-color: #97caf6;
  1016. }
  1017. .now-point {
  1018. filter: grayscale(1);
  1019. }
  1020. .info-line-text-table {
  1021. width: 180px !important;
  1022. }
  1023. .upload-plus-icon {
  1024. height: 15%;
  1025. color: rgb(139, 147, 156);
  1026. line-height: 100px;
  1027. font-size: 40px;
  1028. font-weight: 200;
  1029. }
  1030. .upload-text {
  1031. height: 25%;
  1032. color: rgb(139, 147, 156);
  1033. }
  1034. </style>