voyageDetail.vue 26 KB

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