voyageDetail.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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 df aic jcsb">
  287. <div>卸货记录</div>
  288. <el-button
  289. @click="exportDischargeExcel"
  290. style="width: 220px; margin-right: 20px"
  291. type="primary"
  292. :loading="isDischargeLoadingExcel"
  293. >下载卸货信息</el-button
  294. >
  295. </div>
  296. <div class="line-container-p24">
  297. <el-card
  298. style="
  299. width: 800px;
  300. margin-left: 40px;
  301. margin-top: 50px;
  302. margin-bottom: 40px;
  303. "
  304. >
  305. <el-table :data="dischargeList" stripe>
  306. <el-table-column
  307. type="index"
  308. label="序号"
  309. min-width="80"
  310. align="center"
  311. ></el-table-column>
  312. <el-table-column
  313. prop="dischargeTons"
  314. label="卸货吨位"
  315. min-width="100"
  316. align="center"
  317. ></el-table-column>
  318. <el-table-column
  319. prop="dischargeTime"
  320. label="卸货时间"
  321. min-width="120"
  322. align="center"
  323. ></el-table-column>
  324. <el-table-column label="磅单" min-width="150" align="center">
  325. <template v-slot="scope">
  326. <el-image
  327. v-if="scope.row.viewUrl"
  328. style="width: 50px; height: 50px"
  329. :src="scope.row.viewUrl"
  330. fit="contain"
  331. :preview-src-list="previewPoundList"
  332. ></el-image>
  333. </template>
  334. </el-table-column>
  335. </el-table>
  336. <el-dialog v-model="dialogVisible" title="图片预览" width="30%">
  337. <el-image
  338. :src="dialogImageUrl"
  339. style="height: 100%; width: 100%"
  340. ></el-image>
  341. </el-dialog>
  342. <div style="width: 100%; text-align: right; margin-top: 43px">
  343. <el-pagination
  344. background
  345. layout="prev, pager, next"
  346. :total="total"
  347. @current-change="pageChange"
  348. ></el-pagination>
  349. </div>
  350. </el-card>
  351. </div>
  352. <div class="container-title">保险单列表</div>
  353. <div class="line-container-p24" style="padding-left: 60px">
  354. <el-image
  355. style="width: 200px; height: 200px; margin-right: 20px"
  356. :src="item.viewUrl"
  357. v-for="item in policyList"
  358. :key="item"
  359. @click="openMediaModal(item.viewUrl, 1, '保险单查看')"
  360. ></el-image>
  361. </div>
  362. <div class="container-title">运单列表</div>
  363. <div class="line-container-p24" style="padding-left: 60px">
  364. <el-image
  365. style="width: 200px; height: 200px; margin-right: 20px"
  366. :src="item.viewUrl"
  367. v-for="item in voyageBill"
  368. :key="item"
  369. @click="openMediaModal(item.viewUrl, 1, '运单查看')"
  370. ></el-image>
  371. </div>
  372. <div class="container-title">航次图片</div>
  373. <div class="line-container-p24">
  374. <div v-if="medias.length" class="medias-content df ffw">
  375. <div class="pic-container">
  376. <div v-for="(item, index) in medias" :key="item" class="pic-main">
  377. <div
  378. :class="[
  379. 'box',
  380. index % 2 == 0 ? '' : 'bottom-box',
  381. item.status == 1 ? 'now-box' : '',
  382. ]"
  383. >
  384. <div class="card-note">
  385. {{ item.shipName }} 拍摄于
  386. <br />
  387. {{ item.createTime }}
  388. </div>
  389. <div class="medias-box" style="position: relative">
  390. <el-image
  391. v-if="item.mediaType == 1"
  392. style="width: 100%; height: 100%"
  393. fit="contain"
  394. :src="item.downloadUrl"
  395. :preview-src-list="modalPreview"
  396. @click="openMediaModal(item.downloadUrl, 1, '图片审核')"
  397. ></el-image>
  398. <video
  399. style="width: 100%; height: 100%"
  400. v-else
  401. :src="item.downloadUrl"
  402. ></video>
  403. <img
  404. @click="openMediaModal(item.downloadUrl, 2, '视频审核')"
  405. v-if="item.mediaType == 2"
  406. src="../../assets/icon-player.png"
  407. style="
  408. object-fit: contain;
  409. width: 40px;
  410. height: 40px;
  411. position: absolute;
  412. top: calc(50% - 20px);
  413. left: calc(50% - 20px);
  414. background: #fff;
  415. border-radius: 50%;
  416. "
  417. alt=""
  418. />
  419. </div>
  420. </div>
  421. <div
  422. :class="[
  423. 's-line',
  424. index % 2 == 0 ? '' : 'top210px',
  425. item.status == 1 ? 'now-s-line' : '',
  426. ]"
  427. ></div>
  428. <div :class="['point', item.status == 1 ? '' : 'now-point']"></div>
  429. <div
  430. :class="['l-line', item.status == 1 ? 'now-l-line' : '']"
  431. v-if="index + 1 != medias.length"
  432. ></div>
  433. </div>
  434. </div>
  435. </div>
  436. <el-dialog v-model="mediaModal" :title="modalTitle" width="20%">
  437. <el-image
  438. v-if="modalType == 1"
  439. style="width: 100%; height: 100%"
  440. fit="contain"
  441. :src="currentUrl"
  442. :preview-src-list="modalPreview"
  443. ></el-image>
  444. <video
  445. v-else
  446. autoplay
  447. controls
  448. style="width: 100%; height: 100%"
  449. :src="currentUrl"
  450. ></video>
  451. </el-dialog>
  452. </div>
  453. </template>
  454. <script>
  455. import { onMounted, reactive, ref, toRefs } from "vue";
  456. import api from "../../apis/fetch";
  457. import { useRoute } from "vue-router";
  458. import _ from "lodash";
  459. import router from "../../router";
  460. import store from "../../store";
  461. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  462. import downloadBlobFile from "../../utils/downloadBlobFile";
  463. import url from "../../apis/config";
  464. export default {
  465. setup() {
  466. const route = useRoute();
  467. let map = ref();
  468. let voyage = ref({});
  469. let medias = ref([]);
  470. let coordinates = ref();
  471. let previewSrcList = ref([]);
  472. let policyList = ref([]);
  473. let previewPoundList = ref([]);
  474. async function getVoyageDetail(type) {
  475. let res = await api.getVoyageDetail({
  476. type: localStorage.userType,
  477. voyageId: route.query.id,
  478. });
  479. if (res.data.status == 0) {
  480. if (type) {
  481. ElNotification({
  482. type: "success",
  483. title: res.data.msg,
  484. });
  485. }
  486. coordinates.value = res.data.result.coordinates;
  487. voyage.value = res.data.result.voyage;
  488. medias.value = res.data.result.medias;
  489. for (let i of res.data.result.policys || []) {
  490. policyList.value.push({
  491. ...i,
  492. url: i.viewUrl,
  493. });
  494. }
  495. for (let i of res.data.result.waybills) {
  496. voyageBill.value.push({
  497. ...i,
  498. url: i.viewUrl,
  499. });
  500. }
  501. for (let i of medias.value) {
  502. previewSrcList.value.push(i.downloadUrl);
  503. }
  504. initMap();
  505. } else {
  506. console.log(res);
  507. ElNotification({
  508. type: "error",
  509. title: res.data.msg,
  510. });
  511. }
  512. }
  513. let total = ref(0);
  514. function pageChange(e) {
  515. dischargeCurrentPage.value = e;
  516. getDischargeList();
  517. }
  518. async function addDischarge() {
  519. if (!formInline.value.dischargeTime || !formInline.value.dischargeTons)
  520. return;
  521. let res = await api.addDischarge({
  522. ...formInline.value,
  523. voyageId: route.query.id,
  524. });
  525. if (res.data.status == 0) {
  526. getDischargeList(1);
  527. formInline.value = {};
  528. } else {
  529. console.log(res);
  530. }
  531. }
  532. async function deleteDischarge(id, index) {
  533. let res = await api.deleteDischarge({
  534. id,
  535. });
  536. if (res.data.status == 0) {
  537. dischargeList.value.splice(index, 1);
  538. ElNotification({
  539. type: "success",
  540. title: res.data.msg,
  541. });
  542. } else {
  543. console.log(res);
  544. ElNotification({
  545. type: "error",
  546. title: res.data.msg,
  547. });
  548. }
  549. }
  550. async function exportExcel() {}
  551. let dischargeCurrentPage = ref(1);
  552. let dischargeList = ref();
  553. let formInline = ref({});
  554. async function getDischargeList(type) {
  555. let res = await api.getDischargeList({
  556. voyageId: route.query.id,
  557. currentPage: dischargeCurrentPage.value,
  558. size: 10,
  559. });
  560. if (res.data.status == 0) {
  561. dischargeList.value = res.data.result;
  562. for (let i of dischargeList.value) {
  563. if (i.viewUrl) {
  564. previewPoundList.value.push(i.viewUrl);
  565. }
  566. }
  567. total.value = res.data.total;
  568. } else {
  569. console.log(res);
  570. }
  571. }
  572. let updateForm = ref({});
  573. let updateDischargeDialog = ref(false);
  574. let currentUpdateIndex = ref(-1);
  575. async function updateDischarge() {
  576. let res = await api.updateDischarge({
  577. ...updateForm.value,
  578. });
  579. if (res.data.status == 0) {
  580. dischargeList.value[currentUpdateIndex.value] = res.data.result;
  581. cancelUpdateDischarge();
  582. ElNotification({
  583. type: "success",
  584. title: res.data.msg,
  585. });
  586. } else {
  587. console.log(res);
  588. ElNotification({
  589. type: "error",
  590. title: res.data.msg,
  591. });
  592. }
  593. }
  594. function showUpdateDischarge(item, index) {
  595. updateDischargeDialog.value = true;
  596. updateForm.value = {
  597. ...item,
  598. };
  599. delete updateForm.value.createTime;
  600. delete updateForm.value.voyageId;
  601. currentUpdateIndex.value = index;
  602. }
  603. function cancelUpdateDischarge() {
  604. updateDischargeDialog.value = false;
  605. updateForm.value = {};
  606. currentUpdateIndex.value = -1;
  607. }
  608. function initMap() {
  609. map.value = new AMap.Map("map-container", {
  610. zoom: 11, //级别
  611. center: [120.563757, 31.891174], //中心点坐标
  612. mapStyle: "amap://styles/f48d96805f5fa7f5aada657c5ee37017",
  613. });
  614. let toolBar = new AMap.ToolBar({
  615. position: {
  616. top: "40px",
  617. right: "40px",
  618. },
  619. });
  620. let hawkEye = new AMap.HawkEye({
  621. opened: false,
  622. });
  623. map.value.addControl(toolBar);
  624. map.value.addControl(hawkEye);
  625. return;
  626. let markers = [];
  627. for (let i of medias.value) {
  628. let content = `<div style='width:160px'>
  629. ${
  630. i.audit == -1
  631. ? `<img id='img${i.id}' style='width:160px;height:160px;object-fit:contain;' src='${i.viewUrl}'/>`
  632. : ``
  633. }
  634. <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'/
  635. </div>`;
  636. let marker = new AMap.Marker({
  637. content,
  638. position: new AMap.LngLat(i.longitude, i.latitude),
  639. offset: new AMap.Pixel(-75, i.audit == 1 ? -195 : -30),
  640. });
  641. if (i.audit == 1) {
  642. marker.on("click", () => {
  643. openMediaModal(i.viewUrl, 1, "航次图片", i);
  644. });
  645. }
  646. markers.push(marker);
  647. }
  648. let overlayGroups = new AMap.OverlayGroup(markers);
  649. map.value.on("complete", function () {
  650. let t = setTimeout(() => {
  651. map.value.add(overlayGroups);
  652. map.value.setFitView(markers, true, [200, 50, 0, 0], 18);
  653. clearTimeout(t);
  654. }, 2000);
  655. });
  656. }
  657. function setShipMarker(longitude = 121.524761, latitude = 31.228721) {
  658. map.value.setCenter([longitude, latitude]);
  659. var marker = new AMap.Marker({
  660. position: new AMap.LngLat(longitude, latitude),
  661. offset: new AMap.Pixel(-20, -20),
  662. size: new AMap.Size(80, 80),
  663. icon: "https://hhd-pat-1255802371.cos.ap-shanghai.myqcloud.com/frontend/ship-red-icon.png", // 添加 Icon 图标 URL
  664. title: "",
  665. });
  666. map.value.add(marker);
  667. }
  668. let disabledStatus = ref(true);
  669. let updateCache = {};
  670. function changeVoyageInfo() {
  671. updateCache = _.cloneDeep(voyage.value);
  672. disabledStatus.value = false;
  673. }
  674. function cancelVoyageChange() {
  675. voyage.value = updateCache;
  676. disabledStatus.value = true;
  677. }
  678. async function submitVoyageChange() {
  679. let {
  680. id,
  681. transStatus,
  682. loadStartTime,
  683. loadEndTime,
  684. dischargeStartTime,
  685. dischargeEndTime,
  686. actualDischargeTons,
  687. remark,
  688. } = voyage.value;
  689. let res = await api.updateVoyage({
  690. id,
  691. transStatus,
  692. loadStartTime,
  693. loadEndTime,
  694. dischargeStartTime,
  695. dischargeEndTime,
  696. actualDischargeTons,
  697. remark,
  698. });
  699. if (res.data.status == 0) {
  700. ElNotification({
  701. type: "success",
  702. title: res.data.msg,
  703. });
  704. disabledStatus.value = true;
  705. } else {
  706. ElNotification({
  707. type: "error",
  708. title: res.data.msg,
  709. });
  710. console.log(res);
  711. }
  712. }
  713. let options = ref([
  714. { value: 0, label: "请选择" },
  715. {
  716. value: 1,
  717. label: "航行",
  718. },
  719. {
  720. value: 2,
  721. label: "停泊",
  722. },
  723. {
  724. value: 3,
  725. label: "装货",
  726. },
  727. {
  728. value: 4,
  729. label: "运输中",
  730. },
  731. {
  732. value: 5,
  733. label: "卸货",
  734. },
  735. ]);
  736. async function finishVoyage() {
  737. if (!voyage.value.dischargeEndTime) return;
  738. let res = await api.finishVoyage({
  739. voyageId: route.query.id,
  740. });
  741. if (res.data.status == 0) {
  742. voyage.value.voyageStatus = 2;
  743. ElNotification({
  744. type: "success",
  745. title: res.data.msg,
  746. });
  747. } else {
  748. ElNotification({
  749. type: "error",
  750. title: res.data.msg,
  751. });
  752. console.log(res);
  753. }
  754. }
  755. let currentUrl = ref("");
  756. let mediaModal = ref(false);
  757. let modalType = ref(1);
  758. let modalTitle = ref();
  759. let modalPreview = ref([]);
  760. function openMediaModal(url, type, title) {
  761. console.log(url, type, title);
  762. modalPreview.value = [url];
  763. modalTitle.value = title;
  764. modalType.value = type;
  765. currentUrl.value = url;
  766. mediaModal.value = true;
  767. }
  768. async function auditMedia(mediaId, a, index, mediaType) {
  769. console.log(mediaId, a, index, mediaType);
  770. let res = await api.auditMedia({
  771. mediaId,
  772. audit: a,
  773. });
  774. if (res.data.status == 0) {
  775. medias.value[index].audit = a;
  776. ElNotification({
  777. type: "success",
  778. title: res.data.msg,
  779. });
  780. } else {
  781. console.log(res);
  782. }
  783. }
  784. let dialogImageUrl = ref();
  785. let dialogVisible = ref(false);
  786. function handlePictureCardPreview(file) {
  787. dialogVisible.value = true;
  788. dialogImageUrl.value = file.url;
  789. }
  790. async function handleRemoveBill(file, list) {
  791. let cache = _.cloneDeep(voyageBill.value);
  792. console.log(cache);
  793. ElMessageBox.confirm("确认删除运单?", "Warning", {
  794. confirmButtonText: "删除",
  795. cancelButtonText: "取消",
  796. type: "warning",
  797. })
  798. .then(async () => {
  799. let { id } = file;
  800. let res = await api.deleteWaybill({
  801. id,
  802. });
  803. if (res.data.status == 0) {
  804. ElMessage({
  805. message: "删除成功!",
  806. type: "success",
  807. });
  808. voyageBill.value = list;
  809. }
  810. })
  811. .catch(() => {
  812. voyageBill.value = cache;
  813. ElMessage({
  814. type: "info",
  815. message: "取消删除",
  816. });
  817. });
  818. }
  819. let voyageBill = ref([]);
  820. function billUploadSuccess(response, file, list) {
  821. list[list.length - 1] = {
  822. ...response.result,
  823. url: response.result.viewUrl,
  824. };
  825. console.log(list);
  826. voyageBill.value = list;
  827. }
  828. let billParams = ref({
  829. voyageId: route.query.id,
  830. });
  831. async function calExpectedArrivalTime() {
  832. let res = await api.calExpectedArrivalTime({
  833. voyageId: route.query.id,
  834. setSailTime: voyage.value.setSailTime,
  835. });
  836. if (res.data.status == 0) {
  837. voyage.value.expectedArrivalTime = res.data.result;
  838. }
  839. }
  840. let isLoadingExcel = ref(false);
  841. async function downloadExcel() {
  842. isLoadingExcel.value = true;
  843. let res = await downloadBlobFile(
  844. `${url.baseurl}/voyage/exportExcel`,
  845. { voyageId: route.query.id },
  846. "船舶跟踪表",
  847. "post"
  848. );
  849. if (res) {
  850. isLoadingExcel.value = false;
  851. }
  852. }
  853. let isDischargeLoadingExcel = ref(false);
  854. async function exportDischargeExcel() {
  855. isDischargeLoadingExcel.value = true;
  856. let res = await downloadBlobFile(
  857. `${url.baseurl}/voyage/exportDischargeExcel`,
  858. { voyageId: route.query.id },
  859. "卸货记录表",
  860. "post"
  861. );
  862. if (res) {
  863. isDischargeLoadingExcel.value = false;
  864. }
  865. }
  866. onMounted(() => {
  867. getVoyageDetail(1);
  868. getDischargeList(1);
  869. });
  870. return {
  871. downloadExcel,
  872. isLoadingExcel,
  873. options,
  874. voyage,
  875. coordinates,
  876. medias,
  877. disabledStatus,
  878. changeVoyageInfo,
  879. cancelVoyageChange,
  880. submitVoyageChange,
  881. finishVoyage,
  882. openMediaModal,
  883. previewSrcList,
  884. router,
  885. auditMedia,
  886. modalType,
  887. modalTitle,
  888. currentUrl,
  889. mediaModal,
  890. modalPreview,
  891. addDischarge,
  892. deleteDischarge,
  893. exportExcel,
  894. dischargeCurrentPage,
  895. dischargeList,
  896. getDischargeList,
  897. updateDischarge,
  898. total,
  899. pageChange,
  900. formInline,
  901. updateDischargeDialog,
  902. showUpdateDischarge,
  903. cancelUpdateDischarge,
  904. updateForm,
  905. dialogImageUrl,
  906. dialogVisible,
  907. handlePictureCardPreview,
  908. handleRemoveBill,
  909. voyageBill,
  910. billUploadSuccess,
  911. billParams,
  912. calExpectedArrivalTime,
  913. policyList,
  914. previewPoundList,
  915. isDischargeLoadingExcel,
  916. exportDischargeExcel,
  917. };
  918. },
  919. };
  920. </script>
  921. <style scoped>
  922. .map-container {
  923. width: 100%;
  924. height: 500px;
  925. }
  926. .card-note {
  927. height: 30px;
  928. font-size: 12px;
  929. font-family: PingFangSC-Regular, PingFang SC;
  930. font-weight: 400;
  931. color: #777777;
  932. }
  933. .medias-box {
  934. width: 200px;
  935. height: 200px;
  936. margin-top: 20px;
  937. }
  938. .checkbox-group {
  939. width: 200px;
  940. height: 50px;
  941. margin-top: 20px;
  942. }
  943. .medias-content {
  944. width: 100%;
  945. height: 600px;
  946. background: #f7f7f7;
  947. border-radius: 2px;
  948. }
  949. .pic-container {
  950. width: 100%;
  951. height: 100%;
  952. box-sizing: border-box;
  953. display: flex;
  954. padding: 30px;
  955. overflow-x: scroll;
  956. overflow-y: hidden;
  957. white-space: nowrap;
  958. }
  959. .pic-main {
  960. position: relative;
  961. width: 120px;
  962. }
  963. .box {
  964. position: absolute;
  965. height: 240px;
  966. width: var(--box-width);
  967. border: 5px solid #dddddd;
  968. transition: all 0.5s;
  969. background: #fff;
  970. z-index: 10;
  971. }
  972. .point {
  973. position: relative;
  974. left: 93px;
  975. top: 258px;
  976. width: 16px;
  977. height: 16px;
  978. background-image: url(../../assets/blue-circle.png);
  979. }
  980. .s-line {
  981. position: absolute;
  982. left: 100px;
  983. top: 242px;
  984. height: 20px;
  985. border-left: 2px dashed;
  986. box-sizing: border-box;
  987. border-color: #ddd;
  988. }
  989. .l-line {
  990. position: relative;
  991. bottom: 30px;
  992. left: 111px;
  993. top: 249px;
  994. height: 3px;
  995. width: 100px;
  996. background-color: #dddddd;
  997. }
  998. .bottom-box {
  999. top: 290px;
  1000. }
  1001. .top210px {
  1002. top: 270px;
  1003. }
  1004. .box:hover {
  1005. transform: scale(1.2);
  1006. }
  1007. .medias-box {
  1008. width: 80px;
  1009. height: 80px;
  1010. margin-top: 10px;
  1011. }
  1012. .card-note {
  1013. height: 30px;
  1014. font-size: 12px;
  1015. font-family: PingFangSC-Regular, PingFang SC;
  1016. font-weight: 400;
  1017. color: #777777;
  1018. padding: 10px 20px;
  1019. }
  1020. .medias-box {
  1021. width: 100%;
  1022. height: 100px;
  1023. margin-top: 20px;
  1024. }
  1025. .checkbox-group {
  1026. width: 180px;
  1027. height: 50px;
  1028. margin-top: 20px;
  1029. }
  1030. .el-checkbox {
  1031. margin: 0;
  1032. }
  1033. .now-box {
  1034. border: 5px solid #0094fe;
  1035. }
  1036. .now-l-line {
  1037. background-color: #0094fe;
  1038. }
  1039. .now-s-line {
  1040. border-color: #97caf6;
  1041. }
  1042. .now-point {
  1043. filter: grayscale(1);
  1044. }
  1045. .info-line-text-table {
  1046. width: 180px !important;
  1047. }
  1048. .upload-plus-icon {
  1049. height: 15%;
  1050. color: rgb(139, 147, 156);
  1051. line-height: 100px;
  1052. font-size: 40px;
  1053. font-weight: 200;
  1054. }
  1055. .upload-text {
  1056. height: 25%;
  1057. color: rgb(139, 147, 156);
  1058. }
  1059. </style>