Forráskód Böngészése

feat(cert): 添加证书更新功能并优化证书列表展示

- 在证书列表中添加更新按钮,支持船员和船舶证书的更新操作
- 新增 getCertProcessDetail 接口用于获取证书流程详情
- 修复船东认证时 shipOwnerId 参数获取错误
- 优化证书列表展示,根据不同证书类型显示相应操作按钮
- 添加数据加载时的 loading 效果
wzg 6 hónapja
szülő
commit
237216128e

+ 4 - 0
src/apis/fetch.js

@@ -468,4 +468,8 @@ export default {
   authShip(data) {
     return $http("/ship/hhd/auth", data);
   },
+
+  getCertProcessDetail(data) {
+    return $http("/cert/process/detail", data);
+  },
 };

+ 1 - 1
src/views/shipOwnerManage/shipOwnerDetail.vue

@@ -1514,7 +1514,7 @@ async function shipDetail(shipCode) {
 async function authShipOwner() {
   if (!(await confirm("确定认证船员吗?"))) return;
   let { data } = await api.authShipOwner({
-    shipOwnerId: router.query.shipOwnerId,
+    shipOwnerId: route.query.shipOwnerId,
   });
   if (data.status == 0) {
     ElMessage({

+ 44 - 17
src/views/workStation/certsManage.vue

@@ -119,24 +119,32 @@
               {{ subTimeStr(scope.row.endValidTime) }}
             </template>
           </el-table-column>
-          <el-table-column align="center" label="详情" min-width="120">
+          <el-table-column align="center" label="操作" width="160">
             <template #default="scope">
-              <el-button
-                v-if="certType == 6"
-                type="primary"
-                text
-                @click="goToShipOwnerDetail(scope.row.id)"
-              >
-                详情
-              </el-button>
-              <el-button
-                v-else
-                type="primary"
-                text
-                @click="goToShipDetail(scope.row.shipCode)"
-              >
-                详情
-              </el-button>
+              <div v-if="certType == 6">
+                <el-button
+                  type="primary"
+                  text
+                  @click="goToShipOwnerDetail(scope.row.id)"
+                >
+                  详情
+                </el-button>
+                <el-button type="primary" text @click="handleEdit(scope.row)">
+                  更新
+                </el-button>
+              </div>
+              <div v-else>
+                <el-button
+                  type="primary"
+                  text
+                  @click="goToShipDetail(scope.row.shipCode)"
+                >
+                  详情
+                </el-button>
+                <el-button type="primary" text @click="handleEdit(scope.row)">
+                  更新
+                </el-button>
+              </div>
             </template>
           </el-table-column>
         </el-table>
@@ -195,6 +203,11 @@ const nextMonthStr = ref(getMonthName(1));
 const nextNextMonthStr = ref(getMonthName(2));
 const nextNextNextMonthStr = ref(getMonthName(3));
 async function getCertList() {
+  const loading = ElLoading.service({
+    lock: true,
+    text: "正在获取数据...",
+    background: "rgba(0, 0, 0, 0.7)",
+  });
   let { data } = await api.getCertList({
     type: type.value,
     certType: certType.value,
@@ -202,6 +215,7 @@ async function getCertList() {
     currentPage: currentPage.value,
     size: 10,
   });
+  loading.close();
   if (data.status == 0) {
     total.value = data.total;
     tableData.value = data.result;
@@ -250,6 +264,19 @@ function changeSelect(e) {
   validType.value = e;
   getCertList();
 }
+
+async function handleEdit(row) {
+  const postData = {
+    certType: certType.value,
+  };
+  if (certType.value == 6) {
+    postData["shipOwnerId"] = row.id;
+  } else {
+    postData["certValidityPeriodId"] = row.id;
+  }
+  let { data } = await api.getCertProcessDetail(postData);
+  console.log(data);
+}
 onMounted(() => {
   getCertList();
   getCertListType();