王智慧 3 лет назад
Родитель
Сommit
671a7530ad
4 измененных файлов с 120 добавлено и 157 удалено
  1. 10 0
      src/apis/fetch.js
  2. 68 95
      src/components/ShipInfo.vue
  3. 20 0
      src/styles/font-size.css
  4. 22 62
      src/views/shipOwnerManage/shipOwnerDetail.vue

+ 10 - 0
src/apis/fetch.js

@@ -73,4 +73,14 @@ export default {
   getCertList(data) {
     return $http("/cert/list", data);
   },
+
+  // 获取初始化数据-新增船舶
+  getAddShipCerts(data) {
+    return $http("/cert/addShip/type", data);
+  },
+
+  // 获取证书及有效期类型-证书列表
+  getCertListType(data) {
+    return $http("/cert/certList/type", data);
+  },
 };

+ 68 - 95
src/components/ShipInfo.vue

@@ -169,43 +169,59 @@
         </div>
         <div class="df aic pl40 pb20">
           <div class="c6 fs16 mr30">{{ item.typeName }}</div>
-          <div v-if="item.type != 0">
+        </div>
+        <div class="ml50 mb20 c7 fs14" v-if="item.type != 0">
+          <div
+            class="df aic mb10"
+            v-for="(item1, index1) in item.certValids"
+            :key="item.id"
+          >
+            <div class="mr10">{{ item1.typeName }}</div>
+            <el-date-picker
+              style="width: 140px; font-size: 13px"
+              v-model="item1.startValidTime"
+              @change="changeDate($event, item, item1)"
+              type="date"
+              placeholder="有效期开始时间"
+              value-format="YYYY/MM/DD"
+              format="YYYY/MM/DD"
+            />
+            <div style="margin: 0 4px">-</div>
             <el-date-picker
-              style="width: 240px"
-              v-model="item.date"
-              @change="changeDate($event, index)"
-              type="daterange"
-              range-separator="至"
-              start-placeholder="有效期开始"
-              end-placeholder="有效期结束"
-              unlink-panels
+              style="width: 140px; font-size: 13px"
+              v-model="item1.endValidTime"
+              @change="changeDate($event, item, item1)"
+              type="date"
+              placeholder="有效期结束时间"
               value-format="YYYY/MM/DD"
               format="YYYY/MM/DD"
             />
           </div>
         </div>
-        <Uploader
-          class="pl40 pb20"
-          :uploaderId="'certsId' + 'country'"
-          :params="
-            shipInfos[currentIndex].code
-              ? {
-                  ...updateParams,
-                  shipCode: shipInfos[currentIndex].code,
-                  type: item.type,
-                }
-              : addParams
-          "
-          :actionUrl="
-            shipInfos[currentIndex].code
-              ? store.state.updateCertsUrl
-              : store.state.addCertsUrl
-          "
-          :disabled="disabled"
-          :fileList="item.certs"
-          @onUploadFileList="uploadSuccess($event, index)"
-          @onRemoveFileList="removeSuccess($event, index)"
-        ></Uploader>
+        <div class="df">
+          <Uploader
+            class="ml50 pb20"
+            :uploaderId="'certsId' + 'country'"
+            :params="
+              shipInfos[currentIndex].code
+                ? {
+                    ...updateParams,
+                    shipCode: shipInfos[currentIndex].code,
+                    type: item.type,
+                  }
+                : addParams
+            "
+            :actionUrl="
+              shipInfos[currentIndex].code
+                ? store.state.updateCertsUrl
+                : store.state.addCertsUrl
+            "
+            :disabled="disabled"
+            :fileList="item.certs"
+            @onUploadFileList="uploadSuccess($event, index)"
+            @onRemoveFileList="removeSuccess($event, index)"
+          ></Uploader>
+        </div>
       </div>
       <div
         v-if="!shipInfos[currentIndex].code"
@@ -241,7 +257,7 @@ const props = defineProps({
     type: Array,
     default: [{}],
   },
-  shipOwnerId: String,
+  shipOwnerId: [String, Number],
 });
 let currentIndex = ref(0);
 const emit = defineEmits(["submit"]);
@@ -290,73 +306,24 @@ async function removeSuccess({ file, fileIndex }, index) {
   }
 }
 
-async function changeDate(e, index) {
+async function changeDate(e, item, item1) {
   if (props.shipInfos[currentIndex.value].code) {
-    let res = await api.updateShipCertValid({
+    let { data } = await api.updateShipCertValid({
       shipCode: props.shipInfos[currentIndex.value].code,
-      type: props.shipInfos[currentIndex.value].shipCerts[index].type,
-      startValidTime: e[0],
-      endValidTime: e[1],
+      type: item.type,
+      validType: item1.type,
+      startValidTime: item1.startValidTime,
+      endValidTime: item1.endValidTime,
     });
-  } else {
-    props.shipInfos[currentIndex.value].shipCerts[index].startValidTime = e[0];
-    props.shipInfos[currentIndex.value].shipCerts[index].endValidTime = e[1];
+    if (data.status == 0) {
+      ElMessage({
+        message: "更新成功!",
+        type: "success",
+      });
+    }
   }
 }
-let initShipInfo = {
-  shipId: 0,
-  disabled: false,
-  shipCerts: [
-    {
-      typeName: "船舶主要项目页",
-      type: 0,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "船舶国籍证书",
-      type: 1,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "内河船舶适航证书",
-      type: 2,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "船舶营运证书",
-      type: 3,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "内河船舶最低安全配员证书",
-      type: 4,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "船舶保险",
-      type: 5,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-  ],
-};
+
 function getShipCerts() {
   return shipCerts.value;
 }
@@ -414,9 +381,15 @@ function deleteShip(index) {
     .catch(() => {});
 }
 let cacheIndex = -1;
-function addShip(item) {
+async function addShip(item) {
   cacheIndex = _.cloneDeep(currentIndex.value);
   shipInfoDisabled.value = false;
+  let { data } = await api.getAddShipCerts({});
+  let initShipInfo = {
+    shipId: 0,
+    disabled: false,
+    shipCerts: data.result,
+  };
   if (
     props.shipInfos.length &&
     props.shipInfos[props.shipInfos.length - 1].code

+ 20 - 0
src/styles/font-size.css

@@ -1,3 +1,23 @@
+.fs10 {
+  font-size: 10px !important;
+}
+
+.fs12 {
+  font-size: 12px !important;
+}
+
+.fs14 {
+  font-size: 14px !important;
+}
+
+.fs16 {
+  font-size: 16px !important;
+}
+
+.fs18 {
+  font-size: 18px !important;
+}
+
 .fs20 {
   font-size: 20px !important;
 }

+ 22 - 62
src/views/shipOwnerManage/shipOwnerDetail.vue

@@ -36,7 +36,10 @@
     </div>
     <div class="line">
       <div class="info-line">
-        <div class="info-line-title">船东姓名</div>
+        <div class="info-line-title">
+          <span class="red">*</span>
+          船东姓名
+        </div>
         <el-input
           class="info-line-text"
           v-model="shipOwnerDetail.userName"
@@ -44,7 +47,10 @@
         ></el-input>
       </div>
       <div class="info-line">
-        <div class="info-line-title">船东手机号</div>
+        <div class="info-line-title">
+          <span class="red">*</span>
+          船东手机号
+        </div>
         <el-input
           class="info-line-text"
           v-model="shipOwnerDetail.userPhone"
@@ -189,60 +195,7 @@ function checkShipOwner() {
   }
   return true;
 }
-let initShipInfo = {
-  shipId: 0,
-  disabled: false,
-  shipCerts: [
-    {
-      typeName: "船舶主要项目页",
-      type: 0,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "船舶国籍证书",
-      type: 1,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "内河船舶适航证书",
-      type: 2,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "船舶营运证书",
-      type: 3,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "内河船舶最低安全配员证书",
-      type: 4,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-    {
-      typeName: "船舶保险",
-      type: 5,
-      date: "",
-      startValidTime: "",
-      endtValidTime: "",
-      certs: [],
-    },
-  ],
-};
+
 let shipInfoRef = ref(null);
 let isAddShipOwnerLoading = ref(false);
 async function addShipOwner() {
@@ -257,8 +210,8 @@ async function addShipOwner() {
       cancelButtonText: "否",
       type: "success",
     })
-      .then(() => {
-        data.result.shipInfo = [initShipInfo];
+      .then(async () => {
+        data.result.shipInfo = [];
         shipOwnerDetail.value = data.result;
         shipOwnerId.value = shipOwnerDetail.value.id;
         unchangeableShipOwner.value = true;
@@ -299,18 +252,25 @@ async function getShipOwnerDetail(shipOwnerId) {
   for (let i of shipOwnerDetail.value.shipInfo) {
     i.disabled = true;
     for (let j of i.shipCerts) {
-      j.date = [j.startValidTime, j.endValidTime];
       for (let k of j.certs) {
         k.url = k.viewUrl;
       }
     }
   }
 }
-function addShip() {
-  shipOwnerDetail.value.shipInfo = [initShipInfo];
+async function addShip() {
+  let { data } = await api.getAddShipCerts({});
+
+  shipOwnerDetail.value.shipInfo = [
+    {
+      shipId: 0,
+      disabled: false,
+      shipCerts: data.result,
+    },
+  ];
   setTimeout(() => {
     shipInfoRef.value.changeDisable(false);
-  }, 100);
+  }, 200);
 }
 
 let isUpdate = ref(false);