Bladeren bron

新增 海事公告

王智慧 2 jaren geleden
bovenliggende
commit
194529941a
2 gewijzigde bestanden met toevoegingen van 165 en 8 verwijderingen
  1. 4 0
      src/apis/fetch.js
  2. 161 8
      src/views/marineManage/marineNotice.vue

+ 4 - 0
src/apis/fetch.js

@@ -156,4 +156,8 @@ export default {
   auditAbnormalShip(data) {
     return $http("/ship/audit/abnormal", data);
   },
+  // 获取海事公告列表
+  getShippingNoticeList(data) {
+    return $http("/maritime/notice/getFileList", data);
+  },
 };

+ 161 - 8
src/views/marineManage/marineNotice.vue

@@ -1,7 +1,61 @@
 <template>
-  <el-empty :image-size="300" description=" " />
-  <div style="text-align: center; font-size: 40px; color: #666">
-    海事公告正在建设中
+  <div class="full-container-p24">
+    <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="fileName"
+          label="文件名"
+          min-width="700"
+          align="center"
+        >
+          <template v-slot="scope">
+            <el-button
+              link
+              type="primary"
+              @click="openFile(scope.row.downloadUrl)"
+            >
+              {{ scope.row.fileName }}
+            </el-button>
+          </template>
+        </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>
+      <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
+      class="iframe-box"
+      v-if="pdfModal"
+      @click="(pdfUrl = ''), (pdfModal = false)"
+    >
+      <iframe
+        :src="pdfUrl"
+        style="width: 1000px; height: 80vh"
+        frameborder="0"
+      ></iframe>
+    </div>
   </div>
 </template>
 <script setup>
@@ -11,12 +65,111 @@ 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";
+import axios from "axios";
 
-const route = useRoute();
-onMounted(() => {});
+let currentPage = ref(1);
+let term = ref("");
+let tableData = ref([]);
+let total = ref(0);
+async function getShippingNoticeList(page) {
+  currentPage.value = page || currentPage.value;
+  let res = await api.getShippingNoticeList({
+    currentPage: currentPage.value,
+    size: 10,
+    term: term.value,
+  });
+  if (res.data.status == 0) {
+    tableData.value = res.data.result;
+    total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
+  }
+}
+
+function pageChange(e) {
+  currentPage.value = e;
+  getShippingNoticeList();
+}
+
+function openFile(baseURL) {
+  axios({
+    baseURL,
+    withCredentials: true,
+    timeout: 36000,
+    responseType: "blob",
+  }).then((res) => {
+    const blob = new window.Blob([res.data], {
+      type: "application/pdf",
+    });
+    const href = URL.createObjectURL(blob);
+    pdfUrl.value = href;
+    pdfModal.value = true;
+  });
+}
+
+let pdfModal = ref(false);
+let pdfUrl = ref("");
+
+onMounted(() => {
+  getShippingNoticeList();
+});
 </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 scoped></style>
+.iframe-box {
+  width: 100vw;
+  height: 100vh;
+  position: fixed;
+  z-index: 10;
+  top: 0;
+  left: 0;
+  background: rgba(0, 0, 0, 0.5);
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+</style>