voyageDetail.vue 29 KB

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