|
|
@@ -1,28 +1,40 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div class="container-title">船舶信息</div>
|
|
|
- <div class="pl50 pt30 bgf">
|
|
|
+ <div
|
|
|
+ class="pl50 pt30 bgf df jcsb pr20"
|
|
|
+ v-if="route.name == 'shipOwnerDetail'"
|
|
|
+ >
|
|
|
<el-button-group class="mr20">
|
|
|
<el-button
|
|
|
v-for="(item, index) in shipInfos"
|
|
|
:key="item.code"
|
|
|
@click="currentIndex = index"
|
|
|
+ v-show="item.code"
|
|
|
:type="index == currentIndex ? 'primary' : ''"
|
|
|
>
|
|
|
{{ item.shipname || "新增船舶" }}
|
|
|
</el-button>
|
|
|
</el-button-group>
|
|
|
- <el-button @click="deleteShip(currentIndex)" type="primary" class="mr20">
|
|
|
- 删除当前船舶
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- v-if="shipInfos.length == 0 || shipInfos[currentIndex].code"
|
|
|
- @click="addShip()"
|
|
|
- type="primary"
|
|
|
- >
|
|
|
- 新增船舶
|
|
|
- </el-button>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ v-if="shipInfos[currentIndex].code"
|
|
|
+ @click="deleteShip(currentIndex)"
|
|
|
+ type="primary"
|
|
|
+ class="mr20"
|
|
|
+ >
|
|
|
+ 删除当前船舶
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="shipInfos.length == 0 || shipInfos[currentIndex].code"
|
|
|
+ @click="addShip()"
|
|
|
+ type="primary"
|
|
|
+ >
|
|
|
+ 新增船舶
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
<div class="line-container-p24">
|
|
|
<div class="line">
|
|
|
<div class="info-line">
|
|
|
@@ -30,7 +42,7 @@
|
|
|
<el-input
|
|
|
class="info-line-text"
|
|
|
v-model="shipInfos[currentIndex].shipname"
|
|
|
- :disabled="unchangeableShip"
|
|
|
+ :disabled="shipInfos[currentIndex].disabled"
|
|
|
></el-input>
|
|
|
<view class="unit"></view>
|
|
|
</div>
|
|
|
@@ -39,7 +51,11 @@
|
|
|
<el-input
|
|
|
class="info-line-text"
|
|
|
v-model="shipInfos[currentIndex].mmsi"
|
|
|
- :disabled="unchangeableShip || !!shipInfos[currentIndex].shipId"
|
|
|
+ :disabled="
|
|
|
+ shipInfos[currentIndex].disabled ||
|
|
|
+ !!shipInfos[currentIndex].code ||
|
|
|
+ !!shipInfos[currentIndex].shipId
|
|
|
+ "
|
|
|
@blur="searchShip($event, currentIndex)"
|
|
|
></el-input>
|
|
|
</div>
|
|
|
@@ -50,7 +66,7 @@
|
|
|
<el-input
|
|
|
class="info-line-text"
|
|
|
v-model="shipInfos[currentIndex].length"
|
|
|
- :disabled="unchangeableShip"
|
|
|
+ :disabled="shipInfos[currentIndex].disabled"
|
|
|
></el-input>
|
|
|
<view class="unit">米</view>
|
|
|
</div>
|
|
|
@@ -59,7 +75,7 @@
|
|
|
<el-input
|
|
|
class="info-line-text"
|
|
|
v-model="shipInfos[currentIndex].breadth"
|
|
|
- :disabled="unchangeableShip"
|
|
|
+ :disabled="shipInfos[currentIndex].disabled"
|
|
|
></el-input>
|
|
|
<view class="unit">米</view>
|
|
|
</div>
|
|
|
@@ -70,7 +86,7 @@
|
|
|
<el-input
|
|
|
class="info-line-text"
|
|
|
v-model="shipInfos[currentIndex].loadTons"
|
|
|
- :disabled="unchangeableShip"
|
|
|
+ :disabled="shipInfos[currentIndex].disabled"
|
|
|
></el-input>
|
|
|
<view class="unit">吨</view>
|
|
|
</div>
|
|
|
@@ -79,13 +95,13 @@
|
|
|
<el-input
|
|
|
class="info-line-text"
|
|
|
v-model="shipInfos[currentIndex].age"
|
|
|
- :disabled="unchangeableShip"
|
|
|
+ :disabled="shipInfos[currentIndex].disabled"
|
|
|
></el-input>
|
|
|
<view class="unit">年</view>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div>
|
|
|
+ <div style="max-width: 1200px">
|
|
|
<div class="container-title">船舶证书</div>
|
|
|
<div
|
|
|
v-for="(item, index) in shipInfos[currentIndex].shipCerts"
|
|
|
@@ -140,8 +156,12 @@
|
|
|
@onRemoveFileList="removeCert($event, index)"
|
|
|
></Uploader>
|
|
|
</div>
|
|
|
- <div class="p30 mb30 df jcfe" style="background: #fff">
|
|
|
- <el-button @click="submit" type="primary">确定</el-button>
|
|
|
+ <div
|
|
|
+ v-if="!shipInfos[currentIndex].code"
|
|
|
+ class="p30 mb30 df jcfe"
|
|
|
+ style="background: #fff"
|
|
|
+ >
|
|
|
+ <el-button @click="submit" type="primary">添加船舶</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -152,7 +172,9 @@ import { ElMessage } from "element-plus";
|
|
|
import api from "../apis/fetch";
|
|
|
import _ from "lodash";
|
|
|
import store from "../store";
|
|
|
-
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+import router from "../router";
|
|
|
+const route = useRoute();
|
|
|
const props = defineProps({
|
|
|
certsId: {
|
|
|
type: String,
|
|
|
@@ -227,12 +249,53 @@ async function changeDate(e, index) {
|
|
|
}
|
|
|
let initShipInfo = {
|
|
|
shipId: 0,
|
|
|
- shipCerts: [],
|
|
|
+ disabled: false,
|
|
|
+ shipCerts: [
|
|
|
+ {
|
|
|
+ title: "船舶国籍证书",
|
|
|
+ type: 1,
|
|
|
+ date: "",
|
|
|
+ startValidTime: "",
|
|
|
+ endtValidTime: "",
|
|
|
+ certs: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "内河船舶适航证书",
|
|
|
+ type: 2,
|
|
|
+ date: "",
|
|
|
+ startValidTime: "",
|
|
|
+ endtValidTime: "",
|
|
|
+ certs: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "船舶年审合格证书",
|
|
|
+ type: 3,
|
|
|
+ date: "",
|
|
|
+ startValidTime: "",
|
|
|
+ endtValidTime: "",
|
|
|
+ certs: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "内河船舶最低安全配员证书",
|
|
|
+ type: 4,
|
|
|
+ date: "",
|
|
|
+ startValidTime: "",
|
|
|
+ endtValidTime: "",
|
|
|
+ certs: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "船舶保险",
|
|
|
+ type: 5,
|
|
|
+ date: "",
|
|
|
+ startValidTime: "",
|
|
|
+ endtValidTime: "",
|
|
|
+ certs: [],
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
function getShipCerts() {
|
|
|
return shipCerts.value;
|
|
|
}
|
|
|
-let unchangeableShip = ref(false);
|
|
|
|
|
|
async function searchShip(e) {
|
|
|
if (e.target.value.length != 9) return;
|
|
|
@@ -250,6 +313,7 @@ async function searchShip(e) {
|
|
|
j.url = j.viewUrl;
|
|
|
}
|
|
|
}
|
|
|
+ data.result.disabled = false;
|
|
|
props.shipInfos[currentIndex.value] = data.result;
|
|
|
}
|
|
|
}
|
|
|
@@ -257,8 +321,14 @@ function deleteShip(item) {
|
|
|
console.log(item);
|
|
|
}
|
|
|
function addShip(item) {
|
|
|
- props.shipInfos.push(initShipInfo);
|
|
|
-
|
|
|
+ if (
|
|
|
+ props.shipInfos.length &&
|
|
|
+ props.shipInfos[props.shipInfos.length - 1].code
|
|
|
+ ) {
|
|
|
+ props.shipInfos.push(initShipInfo);
|
|
|
+ } else {
|
|
|
+ props.shipInfos[props.shipInfos.length - 1] = initShipInfo;
|
|
|
+ }
|
|
|
currentIndex.value = props.shipInfos.length - 1;
|
|
|
}
|
|
|
|
|
|
@@ -268,6 +338,7 @@ async function submit() {
|
|
|
...props.shipInfos[currentIndex.value],
|
|
|
shipOwnerId: props.shipOwnerId,
|
|
|
});
|
|
|
+ router.replace("/shipOwnerManage/shipOwnerList");
|
|
|
}
|
|
|
|
|
|
defineExpose({
|