Преглед изворни кода

新增 查看PDF类型文件

wzg пре 1 година
родитељ
комит
50b34491b9
1 измењених фајлова са 58 додато и 1 уклоњено
  1. 58 1
      src/views/voyage/voyageDetail.vue

+ 58 - 1
src/views/voyage/voyageDetail.vue

@@ -1268,7 +1268,35 @@
     <div class="line" v-auth="'POLICY'">
     <div class="line" v-auth="'POLICY'">
       <div class="info-line">
       <div class="info-line">
         <div class="info-line-title">保险单</div>
         <div class="info-line-title">保险单</div>
+        <div class="file-box df aic">
+          <div class="file-container" v-for="(item, index) in policyFileList">
+            <img
+              v-if="item.suffix === 'jpg'"
+              style="width: 145px; height: 100px; object-fit: contain"
+              :src="item.viewUrl"
+              alt=""
+            />
+
+            <el-button
+              style="margin: 0 auto"
+              v-if="item.suffix === 'pdf'"
+              type="text"
+              size="small"
+              @click="handlePdf(item)"
+            >
+              查看PDF
+            </el-button>
+          </div>
+          <el-dialog fullscreen v-model="pdfVisible" title="查看PDF">
+            <iframe
+              style="width: 100%; height: 85vw; overflow: hidden; border: none"
+              :src="pdfUrl"
+              frameborder="0"
+            ></iframe>
+          </el-dialog>
+        </div>
         <el-upload
         <el-upload
+          class="mb10 ml20"
           drag
           drag
           multiple
           multiple
           :action="store.state.wayBillUrl"
           :action="store.state.wayBillUrl"
@@ -1277,7 +1305,6 @@
           :on-remove="handleRemovePolicy"
           :on-remove="handleRemovePolicy"
           :data="policyParams"
           :data="policyParams"
           :on-success="policyUploadSuccess"
           :on-success="policyUploadSuccess"
-          :file-list="policyFileList"
           :disabled="isAuthDisabled('POLICYADD')"
           :disabled="isAuthDisabled('POLICYADD')"
         >
         >
           <div class="upload-plus-icon">+</div>
           <div class="upload-plus-icon">+</div>
@@ -1980,6 +2007,9 @@ async function getVoyageDetail(isInit) {
     type: localStorage.userType,
     type: localStorage.userType,
     voyageId: route.query.id,
     voyageId: route.query.id,
   });
   });
+  // let res = {
+  //   data,
+  // };
   loading.close();
   loading.close();
   if (res.data.status == 0) {
   if (res.data.status == 0) {
     ElNotification({
     ElNotification({
@@ -2015,6 +2045,10 @@ async function getVoyageDetail(isInit) {
       policyFileList.value.push({
       policyFileList.value.push({
         ...i,
         ...i,
         url: i.viewUrl,
         url: i.viewUrl,
+        suffix:
+          i.fileKey.split(".").pop() === "jpeg"
+            ? "jpg"
+            : i.fileKey.split(".").pop(),
       });
       });
     }
     }
     for (let i of res.data.result.waybills) {
     for (let i of res.data.result.waybills) {
@@ -3269,6 +3303,12 @@ function dischargeExcelSuccess(e) {
 function beforeDischargeExcel() {
 function beforeDischargeExcel() {
   isUpLoading.value = true;
   isUpLoading.value = true;
 }
 }
+const pdfUrl = ref("");
+const pdfVisible = ref(false);
+function handlePdf(item) {
+  pdfVisible.value = true;
+  pdfUrl.value = item.viewUrl;
+}
 
 
 onMounted(() => {
 onMounted(() => {
   getVoyageDetail(true);
   getVoyageDetail(true);
@@ -3481,4 +3521,21 @@ onMounted(() => {
   background-color: #0094feb6; /* 设置滚动条的颜色 */
   background-color: #0094feb6; /* 设置滚动条的颜色 */
   border-radius: 10px;
   border-radius: 10px;
 }
 }
+
+.file-container {
+  width: 145px;
+  height: 145px;
+  margin-right: 10px;
+  display: flex;
+  align-items: center;
+  border: 1px solid #ccc;
+  border-radius: 8px;
+  flex-shrink: 0;
+  overflow: hidden;
+}
+
+.file-box {
+  width: calc(100vw - 700px);
+  overflow-y: auto;
+}
 </style>
 </style>