فهرست منبع

材料进场附件预览

duy 2 سال پیش
والد
کامیت
072e9b2fe4
1فایلهای تغییر یافته به همراه14 افزوده شده و 2 حذف شده
  1. 14 2
      src/views/tentative/material/approach.vue

+ 14 - 2
src/views/tentative/material/approach.vue

@@ -182,11 +182,13 @@
             <div class="hc-switch-tab-content">
                 <div class="h-full w-full">
                     <div v-if="tableRowData[tabTypeKey]">
-                        <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="tableRowData[tabTypeKey]" style="height:500px;width:90%" />
-                        <el-button type="primary" hc-btn :loading="importModalLoading" @click="deleteFile" style="margin-bottom: 30px;margin-left:5px">
+                        <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="tableRowData[tabTypeKey]" style="height:500px;width:90%" v-if="tableRowData[tabTypeKey]&&ispdf!==-1"/>
+                        <el-link type="primary" :href="tableRowData[tabTypeKey]" v-else>{{tableRowData[tabTypeKey]}}</el-link>
+                        <el-button type="primary" size="small" hc-btn  @click="deleteFile" style="float:right">
                             <HcIcon name="delete-bin-2"/>
                             <span>删除</span>
                         </el-button>
+                   
                     </div>
                     
                     <div class="hc-no-table-form" v-else>
@@ -626,6 +628,7 @@ const viewAttachmentModalClick = (row) => {
 //类型tab数据和相关处理
 const tabTypeKey = ref('productionCertificate')
 const tabTypeKeyType=ref(1)
+const ispdf=ref(true)
 const tabTypeTab = ref([
     {key:'productionCertificate',  name: '生产合格证',type:1},
     {key:'qualityInspectionReport', name: '厂家质检报告',type:2},
@@ -634,6 +637,8 @@ const tabTypeTab = ref([
 const tabTypeChange = (item) => {
     tabTypeKey.value = item?.key
     tabTypeKeyType.value=item?.type
+    const row = tableRowData.value, key = tabTypeKey.value
+    ispdf.value=getCaption( row[key])
 }
 
 //上传进度
@@ -649,6 +654,7 @@ const tableRowPdfFinished = async (data1) => {
     const row = tableRowData.value, key = tabTypeKey.value
     row[key] = data1?.link
     console.log(row,'row');
+    ispdf.value=getCaption( row[key])
     // //保存请求
     // const { error, code } = await approachApi.submitForm({
     //     ...row,
@@ -677,6 +683,12 @@ const tableRowPdfFinished = async (data1) => {
         await getTableData()
     }
 }
+const getCaption =(obj)=> {
+    const index = obj.lastIndexOf("pdf")
+   
+    return index
+}
+
 //删除上传附件
 const deleteFile=()=>{
     console.log('删除');