Jelajahi Sumber

更新 船舶安检

王智慧 3 tahun lalu
induk
melakukan
122c5549fd

+ 70 - 43
src/views/shipSecurityManage/checkShip.vue

@@ -42,7 +42,7 @@
       <div class="c6 mr30">请选择适用船舶:</div>
       <el-select
         v-model="ships"
-        value-key="value"
+        value-key="shipname"
         multiple
         placeholder="请选择"
         style="width: 400px"
@@ -50,8 +50,9 @@
         <el-option
           v-for="item in shipSelect"
           :key="item.key"
-          :label="item.value"
+          :label="item.shipname"
           :value="item"
+          @click="shipIndex = ships.length - 1"
         />
       </el-select>
     </div>
@@ -64,48 +65,48 @@
         {{ item.shipname }}
       </el-button>
     </el-button-group>
-    <div v-show="ships[shipIndex]?.shipname">
-      <div class="df aic">
-        <div class="c3 mr20">船名</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.shipname }}</div>
-      </div>
-      <div class="df aic">
-        <div class="c3 mr20">MMSI</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.mmsi }}</div>
-      </div>
-      <div class="df aic">
-        <div class="c3 mr20">IMO</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.imo }}</div>
-      </div>
-      <div class="df aic">
-        <div class="c3 mr20">船长</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.length }}</div>
-        <div class="unit c7">米</div>
-      </div>
-      <div class="df aic">
-        <div class="c3 mr20">船宽</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.breadth }}</div>
-        <div class="unit c7">米</div>
-      </div>
-      <div class="df aic">
-        <div class="c3 mr20">吨位</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.loadTons }}</div>
-        <div class="unit c7">吨</div>
-      </div>
-      <div class="df aic">
-        <div class="c3 mr20">满载吃水</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.draught }}</div>
-        <div class="unit c7">米</div>
+    <div v-show="ships[shipIndex]?.shipname || ships.length == 1">
+      <div class="df aic mb20">
+        <div class="ship-label">船名</div>
+        <div class="ship-text">{{ ships[shipIndex]?.shipname }}</div>
+        <div class="ship-label">MMSI</div>
+        <div class="ship-text">{{ ships[shipIndex]?.mmsi }}</div>
+        <div class="ship-label">IMO</div>
+        <div class="ship-text">{{ ships[shipIndex]?.imo }}</div>
+        <div class="ship-label">船龄</div>
+        <div class="ship-text">
+          {{ ships[shipIndex]?.age }}
+          <span class="unit">年</span>
+        </div>
       </div>
-      <div class="df aic c5">
-        <div class="c3 mr20">船龄</div>
-        <div class="c7 fs14">{{ ships[shipIndex]?.age }}</div>
-        <div class="unit c7">年</div>
+      <div class="df aic mb20">
+        <div class="ship-label">船长</div>
+        <div class="ship-text">
+          {{ ships[shipIndex]?.length }}
+          <span class="unit">米</span>
+        </div>
+        <div class="ship-label">船宽</div>
+        <div class="ship-text">
+          {{ ships[shipIndex]?.breadth }}
+          <span class="unit">米</span>
+        </div>
+        <div class="ship-label">吨位</div>
+        <div class="ship-text">
+          {{ ships[shipIndex]?.loadTons }}
+          <span class="unit">吨</span>
+        </div>
+        <div class="ship-label">满载吃水</div>
+        <div class="ship-text">
+          {{ ships[shipIndex]?.draught }}
+          <span class="unit">米</span>
+        </div>
       </div>
     </div>
     <el-divider />
     <div class="df aic jcfe">
-      <el-button type="primary" @click="addSecurityCheck">发起审核</el-button>
+      <el-button type="primary" :loading="isSubmit" @click="addSecurityCheck">
+        {{ isSubmit ? "正在提交" : "发起审核" }}
+      </el-button>
     </div>
   </el-card>
 </template>
@@ -160,7 +161,7 @@ async function getAddTemplateShipSelect(templateId) {
     shipSelect.value = [];
   }
 }
-
+let isSubmit = ref(false);
 async function addSecurityCheck() {
   if (!templateId.value) {
     ElMessage({
@@ -178,17 +179,29 @@ async function addSecurityCheck() {
   }
   let shipCodes = [];
   for (let i of ships.value) {
-    shipCodes.push(i.key);
+    shipCodes.push(i.code);
   }
   let postData = {
     templateId: templateId.value,
     shipCodes,
   };
-  console.log(postData);
-  return;
+  isSubmit.value = true;
   let { data } = await api.addSecurityCheck(postData);
+  isSubmit.value = false;
   if (data.status == 0) {
+    ElNotification({
+      title: "成功",
+      message: data.msg,
+      type: "success",
+      duration: 1500,
+    });
     router.replace("/shipSecurityManage/checkShipList");
+  } else {
+    ElNotification({
+      message: data.msg,
+      type: "error",
+      duration: 2500,
+    });
   }
 }
 onMounted(() => {
@@ -204,4 +217,18 @@ onMounted(() => {
 .item-text {
   width: 100px;
 }
+
+.ship-label {
+  width: 60px;
+  color: #666;
+  font-size: 14px;
+  text-align: right;
+  margin-right: 10px;
+}
+
+.ship-text {
+  width: 140px;
+  color: #333;
+  font-size: 14px;
+}
 </style>

+ 9 - 1
src/views/shipSecurityManage/checkShipExamine.vue

@@ -16,7 +16,15 @@ import _ from "lodash";
 import { subTimeStr } from "../../utils/utils";
 
 const route = useRoute();
-onMounted(() => {});
+async function getSecurityCheckDetail(shipSecurityCheckId) {
+  let { data } = await api.getSecurityCheckDetail({
+    shipSecurityCheckId,
+  });
+  console.log(data);
+}
+onMounted(() => {
+  getSecurityCheckDetail(route.query.id);
+});
 </script>
 
 <style scoped></style>

+ 252 - 8
src/views/shipSecurityManage/checkShipExamineList.vue

@@ -1,7 +1,155 @@
 <template>
-  <el-empty :image-size="300" description=" " />
-  <div style="text-align: center; font-size: 40px; color: #666">
-    船舶安检正在建设中
+  <div class="full-container-p24">
+    <div class="df jcsb">
+      <div class="df aic">
+        <el-button-group class="mr30">
+          <el-button
+            @click="(type = 1), getSecurityCheckShipList(1)"
+            :type="type == 1 ? 'primary' : ''"
+          >
+            待审核船舶
+          </el-button>
+          <el-button
+            @click="(type = 2), getSecurityCheckShipList(1)"
+            :type="type == 2 ? 'primary' : ''"
+          >
+            未审核船舶
+          </el-button>
+        </el-button-group>
+        <el-input
+          placeholder="请输入安检名称"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          clearable
+          class="mr10"
+          style="width: 200px"
+        ></el-input>
+        <el-button type="primary" @click="getSecurityCheckShipList(1)">
+          查询
+        </el-button>
+      </div>
+      <el-button type="primary" @click="goToAdd">发起船舶安检</el-button>
+    </div>
+    <div style="margin-top: 24px">
+      <el-table border :data="tableData" stripe style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="80"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="shipname"
+          label="船舶名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="securityCheckName"
+          label="安检名称"
+          min-width="120"
+          align="center"
+          v-if="type == 1"
+        ></el-table-column>
+        <el-table-column
+          prop="createTime"
+          label="发起安检日期"
+          min-width="120"
+          align="center"
+          v-if="type == 1"
+        >
+          <template v-slot="scope">
+            {{ subTimeStr(scope.row.createTime) }}
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="shipOwnerName"
+          label="船东名称"
+          min-width="120"
+          align="center"
+          v-if="type == 1"
+        ></el-table-column>
+        <el-table-column
+          prop="shipOwnerPhone"
+          label="船东手机号"
+          min-width="120"
+          align="center"
+          v-if="type == 1"
+        ></el-table-column>
+        <el-table-column
+          prop="mmsi"
+          label="MMSI"
+          min-width="120"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="shipname"
+          label="IMO"
+          min-width="120"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="length"
+          label="船长"
+          min-width="80"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="breadth"
+          label="船宽"
+          min-width="80"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="tonnage"
+          label="船舶总吨"
+          min-width="100"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="loadTons"
+          label="载重吨位"
+          min-width="100"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="draught"
+          label="吃水"
+          min-width="80"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column
+          prop="age"
+          label="船龄"
+          min-width="80"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column label="操作" min-width="120" align="center">
+          <template v-slot="scope">
+            <el-button type="primary" link @click="goTo(scope.row)">
+              {{ type == 1 ? "详情" : "发起审核" }}
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="df aic jcfe mt40 mr20">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :current-page="currentPage"
+          :total="total"
+          @current-change="pageChange"
+        ></el-pagination>
+      </div>
+    </div>
   </div>
 </template>
 <script setup>
@@ -11,12 +159,108 @@ import store from "../../store";
 import router from "../../router";
 import md5 from "md5";
 import api from "../../apis/fetch";
-import { useRoute } from "vue-router";
-import _ from "lodash";
 import { subTimeStr } from "../../utils/utils";
 
-const route = useRoute();
-onMounted(() => {});
+function goToAdd() {
+  router.push("/shipSecurityManage/checkShip");
+}
+let currentPage = ref(1);
+let term = ref("");
+let tableData = ref([]);
+let total = ref(0);
+let type = ref(1);
+async function getSecurityCheckShipList(page) {
+  currentPage.value = page || currentPage.value;
+  let res = await api.getSecurityCheckShipList({
+    currentPage: currentPage.value,
+    size: 10,
+    term: term.value,
+    type: type.value,
+  });
+  if (res.data.status == 0) {
+    tableData.value = res.data.result;
+    total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
+  }
+}
+
+async function getSecurityTemplateDetail(id) {
+  router.push({
+    path: "/shipSecurityManage/shipCheckTemplateDetail",
+    query: {
+      id,
+    },
+  });
+}
+
+function goTo(item) {
+  router.push({
+    path:
+      type.value == 1
+        ? "/shipSecurityManage/checkShipExamine"
+        : "/shipSecurityManage/checkSingleShip",
+    query:
+      type.value == 1
+        ? {
+            id: item.id,
+          }
+        : {
+            code: item.code,
+          },
+  });
+}
+
+function pageChange(e) {
+  currentPage.value = e;
+  getSecurityCheckShipList();
+}
+onMounted(() => {
+  getSecurityCheckShipList();
+});
 </script>
+<style scoped>
+.seach-btn {
+  display: inline-block;
+  width: 60px;
+  height: 38px;
+  background: #0094fe;
+  border-radius: 2px;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  text-align: center;
+  line-height: 38px;
+  margin-left: 10px;
+  cursor: pointer;
+}
+
+.cargo-owner-add {
+  width: 80px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
+
+:deep().el-dialog {
+  width: 560px;
+  padding: 20px 50px;
+  border-radius: 6px;
+}
 
-<style scoped></style>
+:deep() .el-dialog__title {
+  font-size: 18px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+}
+</style>

+ 48 - 0
src/views/shipSecurityManage/checkSingleShip.vue

@@ -0,0 +1,48 @@
+<template>
+  <el-card class="pl30 pt20 mt30" style="width: 1000px">
+    <div class="df aic mb20">
+      <div class="c6 mr30">请选择安检模板:</div>
+      <el-select
+        v-model="templateId"
+        @change="getSecurityTemplateDetail"
+        placeholder="请选择"
+      >
+        <el-option
+          v-for="item in templateSelect"
+          :key="item.key"
+          :label="item.value"
+          :value="item.key"
+        />
+      </el-select>
+    </div>
+  </el-card>
+</template>
+<script setup>
+import { ref, h, reactive, toRefs, onMounted } from "vue";
+import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
+import store from "../../store";
+import router from "../../router";
+import md5 from "md5";
+import api from "../../apis/fetch";
+import { useRoute } from "vue-router";
+import _ from "lodash";
+import { subTimeStr } from "../../utils/utils";
+
+const route = useRoute();
+let templateSelect = ref([]);
+async function getAddTemplateSelect(shipCode) {
+  let { data } = await api.getAddTemplateSelect({
+    shipCode,
+  });
+  if (data.status == 0) {
+    templateSelect.value = data.result;
+  } else {
+    templateSelect.value = [];
+  }
+}
+onMounted(() => {
+  getAddTemplateSelect(route.query.code);
+});
+</script>
+
+<style scoped></style>

+ 0 - 22
src/views/shipSecurityManage/shipCheckHistory.vue

@@ -1,22 +0,0 @@
-<template>
-  <el-empty :image-size="300" description=" " />
-  <div style="text-align: center; font-size: 40px; color: #666">
-    船舶安检正在建设中
-  </div>
-</template>
-<script setup>
-import { ref, h, reactive, toRefs, onMounted } from "vue";
-import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
-import store from "../../store";
-import router from "../../router";
-import md5 from "md5";
-import api from "../../apis/fetch";
-import { useRoute } from "vue-router";
-import _ from "lodash";
-import { subTimeStr } from "../../utils/utils";
-
-const route = useRoute();
-onMounted(() => {});
-</script>
-
-<style scoped></style>

+ 179 - 0
src/views/shipSecurityManage/shipCheckHistoryList.vue

@@ -0,0 +1,179 @@
+<template>
+  <div class="full-container-p24">
+    <div class="df jcsb">
+      <div class="df aic">
+        <el-input
+          placeholder="请输入安检名称"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          clearable
+          class="mr10"
+          style="width: 200px"
+        ></el-input>
+        <el-button type="primary" @click="getSecurityCheckShipList(1)">
+          查询
+        </el-button>
+      </div>
+    </div>
+    <div style="margin-top: 24px">
+      <el-table border :data="tableData" stripe style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="80"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="shipname"
+          label="船舶名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="securityCheckName"
+          label="安检名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="createTime"
+          label="发起安检日期"
+          min-width="120"
+          align="center"
+        >
+          <template v-slot="scope">
+            {{ subTimeStr(scope.row.createTime) }}
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="shipOwnerName"
+          label="船东名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="shipOwnerPhone"
+          label="船东手机号"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="age"
+          label="船龄"
+          min-width="80"
+          align="center"
+          v-if="type == 2"
+        ></el-table-column>
+        <el-table-column label="操作" min-width="120" align="center">
+          <template v-slot="scope">
+            <el-button type="primary" link>详情</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="df aic jcfe mt40 mr20">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :current-page="currentPage"
+          :total="total"
+          @current-change="pageChange"
+        ></el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+<script setup>
+import { ref, h, reactive, toRefs, onMounted } from "vue";
+import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
+import store from "../../store";
+import router from "../../router";
+import md5 from "md5";
+import api from "../../apis/fetch";
+import { subTimeStr } from "../../utils/utils";
+
+function goToAdd() {
+  router.push("/shipSecurityManage/checkShip");
+}
+let currentPage = ref(1);
+let term = ref("");
+let tableData = ref([]);
+let total = ref(0);
+let type = ref(3);
+async function getSecurityCheckShipList(page) {
+  currentPage.value = page || currentPage.value;
+  let res = await api.getSecurityCheckShipList({
+    currentPage: currentPage.value,
+    size: 10,
+    term: term.value,
+    type: type.value,
+  });
+  if (res.data.status == 0) {
+    tableData.value = res.data.result;
+    total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
+  }
+}
+
+async function getSecurityTemplateDetail(id) {
+  router.push({
+    path: "/shipSecurityManage/shipCheckTemplateDetail",
+    query: {
+      id,
+    },
+  });
+}
+
+function pageChange(e) {
+  currentPage.value = e;
+  getSecurityCheckShipList();
+}
+onMounted(() => {
+  getSecurityCheckShipList();
+});
+</script>
+<style scoped>
+.seach-btn {
+  display: inline-block;
+  width: 60px;
+  height: 38px;
+  background: #0094fe;
+  border-radius: 2px;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  text-align: center;
+  line-height: 38px;
+  margin-left: 10px;
+  cursor: pointer;
+}
+
+.cargo-owner-add {
+  width: 80px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
+
+:deep().el-dialog {
+  width: 560px;
+  padding: 20px 50px;
+  border-radius: 6px;
+}
+
+:deep() .el-dialog__title {
+  font-size: 18px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+}
+</style>