|
@@ -153,21 +153,19 @@
|
|
</template>
|
|
</template>
|
|
<div class="hc-switch-tab-content" v-loading="viewAttachmentLoading">
|
|
<div class="hc-switch-tab-content" v-loading="viewAttachmentLoading">
|
|
<div class="h-full w-full flex">
|
|
<div class="h-full w-full flex">
|
|
- <div class="pdf-file-list-box">
|
|
|
|
|
|
+ <div class="pdf-file-list-box" v-if="viewAttachmentData.length>0">
|
|
<template v-for="item in viewAttachmentData" >
|
|
<template v-for="item in viewAttachmentData" >
|
|
- <div class="file-item" :class="[item.isCheck ? 'cur' : '']" @click="viewCurFile(item)">{{item.name||''}}</div>
|
|
|
|
|
|
+ <div class="file-item" :class="[item.isCheck ? 'cur' : '']" @click="viewCurFile(item)">{{item.fileName||''}}</div>
|
|
</template>
|
|
</template>
|
|
- <!-- <div class="file-item">文件名称2.pdf</div>
|
|
|
|
- <div class="file-item">文件名称3.pdf</div>
|
|
|
|
- <div class="file-item">文件名称4.pdf</div>
|
|
|
|
- <div class="file-item">文件名称5.pdf</div> -->
|
|
|
|
</div>
|
|
</div>
|
|
- <!-- <iframe width='80%' height='100%' frameborder='1' :src="attachmentPdfUrl" v-if="attachmentPdfUrl"/> -->
|
|
|
|
|
|
+ <div class="pdf-file-list-box" v-else>
|
|
|
|
+ <HcNoData></HcNoData>
|
|
|
|
+ </div>
|
|
|
|
+ <iframe width='80%' height='100%' frameborder='1' :src="attachmentPdfUrl" v-if="attachmentPdfUrl"/>
|
|
<div class="hc-no-table-form" >
|
|
<div class="hc-no-table-form" >
|
|
<div class="table-form-no">
|
|
<div class="table-form-no">
|
|
- <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" v-if="listuploadref==='1'"/>
|
|
|
|
- <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" v-if="listuploadref==='2'"/>
|
|
|
|
- <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" v-if="listuploadref==='3'"/>
|
|
|
|
|
|
+ <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" @delFile="delFileData"/>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -199,6 +197,7 @@ import {getDictionary} from "~api/other";
|
|
import { eVisaTaskCheckApi} from "~api/other"
|
|
import { eVisaTaskCheckApi} from "~api/other"
|
|
import wbsApi from "~api/data-fill/wbs"
|
|
import wbsApi from "~api/data-fill/wbs"
|
|
import { Loading } from "element-plus/es/components/loading/src/service";
|
|
import { Loading } from "element-plus/es/components/loading/src/service";
|
|
|
|
+import notableform from '~src/assets/view/notableform.svg';
|
|
|
|
|
|
//变量
|
|
//变量
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
@@ -641,32 +640,41 @@ const viewAttachmentId = ref('')
|
|
const viewAttachmentData = ref([])
|
|
const viewAttachmentData = ref([])
|
|
const viewAttachmentModalClick = async ({id}) => {
|
|
const viewAttachmentModalClick = async ({id}) => {
|
|
viewAttachmentId.value=id
|
|
viewAttachmentId.value=id
|
|
- viewAttachmentLoading.value = true
|
|
|
|
- const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id})
|
|
|
|
- //处理数据
|
|
|
|
- viewAttachmentLoading.value = false
|
|
|
|
- if (!error && code === 200) {
|
|
|
|
|
|
+ viewAttachmentModal.value = true
|
|
|
|
+ getAttachmentModalClick( viewAttachmentId.value, '1')
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+const getCaption =(obj)=> {
|
|
|
|
+ const index = obj.lastIndexOf("pdf")
|
|
|
|
+
|
|
|
|
+ return index
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获取附件
|
|
|
|
+const getAttachmentModalClick = async (id,type) => {
|
|
|
|
+ viewAttachmentLoading.value = true
|
|
|
|
+ const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id,type:type})
|
|
|
|
+ console.log(data,'data');
|
|
|
|
+ viewAttachmentLoading.value = false
|
|
|
|
+ if (!error && code === 200) {
|
|
viewAttachmentData.value = getArrValue(data)
|
|
viewAttachmentData.value = getArrValue(data)
|
|
- if ( viewAttachmentData.value.length<1) {
|
|
|
|
- window.$message?.warning('该条记录不存在附件')
|
|
|
|
- }else{
|
|
|
|
- viewAttachmentModal.value = true
|
|
|
|
- viewCurFile( viewAttachmentData.value[0])
|
|
|
|
- }
|
|
|
|
|
|
+ curFileData.value=viewAttachmentData.value[0]
|
|
|
|
+ viewCurFile(curFileData.value)
|
|
|
|
|
|
} else {
|
|
} else {
|
|
viewAttachmentData.value = []
|
|
viewAttachmentData.value = []
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
-const refeshAttachmentModalClick = async (id) => {
|
|
|
|
- const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id})
|
|
|
|
|
|
+const refeshAttachmentModalClick = async (id,type) => {
|
|
|
|
+ const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id,type:type})
|
|
//处理数据
|
|
//处理数据
|
|
viewAttachmentLoading.value = false
|
|
viewAttachmentLoading.value = false
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
viewAttachmentData.value = getArrValue(data)
|
|
viewAttachmentData.value = getArrValue(data)
|
|
if ( viewAttachmentData.value.length<1) {
|
|
if ( viewAttachmentData.value.length<1) {
|
|
- window.$message?.warning('该条记录不存在附件')
|
|
|
|
|
|
+ // window.$message?.warning('该条记录不存在附件')
|
|
}else{
|
|
}else{
|
|
viewCurFile( viewAttachmentData.value[0])
|
|
viewCurFile( viewAttachmentData.value[0])
|
|
}
|
|
}
|
|
@@ -679,17 +687,20 @@ const refeshAttachmentModalClick = async (id) => {
|
|
const attachmentPdfUrl = ref('')
|
|
const attachmentPdfUrl = ref('')
|
|
const curFileData =ref ({})
|
|
const curFileData =ref ({})
|
|
//类型tab数据和相关处理
|
|
//类型tab数据和相关处理
|
|
-const tabTypeKey = ref('productionCertificate')
|
|
|
|
|
|
+const tabTypeKey = ref('1')
|
|
const tabTypeTab = ref([
|
|
const tabTypeTab = ref([
|
|
- {key:'productionCertificate', name: '生产合格证'},
|
|
|
|
- {key:'qualityInspectionReport', name: '厂家质检报告'},
|
|
|
|
- {key:'otherAccessories', name: '其他文件'},
|
|
|
|
|
|
+ {key:'1', name: '生产合格证'},
|
|
|
|
+ {key:'2', name: '厂家质检报告'},
|
|
|
|
+ {key:'3', name: '其他文件'},
|
|
]);
|
|
]);
|
|
const tabTypeChange = (item) => {
|
|
const tabTypeChange = (item) => {
|
|
|
|
+ console.log(1111111111);
|
|
tabTypeKey.value = item?.key
|
|
tabTypeKey.value = item?.key
|
|
- viewCurFile(curFileData.value)
|
|
|
|
- fileListData.value=[]
|
|
|
|
- refeshAttachmentModalClick(viewAttachmentId.value)
|
|
|
|
|
|
+ getAttachmentModalClick( viewAttachmentId.value, item?.key)
|
|
|
|
+ fileListData.value =[]
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
|
|
}
|
|
}
|
|
|
|
|
|
//关闭查看附件
|
|
//关闭查看附件
|
|
@@ -713,34 +724,19 @@ const splitFileName=(str)=>{
|
|
}
|
|
}
|
|
//查看当前文件pdf
|
|
//查看当前文件pdf
|
|
const viewCurFile = (item) => {
|
|
const viewCurFile = (item) => {
|
|
- curFileData.value=item
|
|
|
|
- viewAttachmentData.value.forEach((ele)=>{
|
|
|
|
- if (ele.name===item.name) {
|
|
|
|
- ele.isCheck=true
|
|
|
|
- }else{
|
|
|
|
- ele.isCheck=false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- if(tabTypeKey.value=='productionCertificate'&&item.productionCertificate.length>0){
|
|
|
|
|
|
+ console.log(item,'item');
|
|
|
|
+ if(item){
|
|
|
|
+ curFileData.value=item
|
|
let arr=[]
|
|
let arr=[]
|
|
- arr.push({name:splitFileName(item.productionCertificateName),url:item.productionCertificate})
|
|
|
|
|
|
+ arr.push({name:item.fileName,url:item.url})
|
|
fileListData.value =getArrValue(arr)
|
|
fileListData.value =getArrValue(arr)
|
|
- listuploadref.value='1'
|
|
|
|
- }else if(tabTypeKey.value=='qualityInspectionReport'&&item.qualityInspectionReport.length>0){
|
|
|
|
- let arr=[]
|
|
|
|
- arr.push({name:splitFileName(item.qualityInspectionReportName),url:item.qualityInspectionReport})
|
|
|
|
- fileListData.value =getArrValue(arr)
|
|
|
|
- listuploadref.value='2'
|
|
|
|
- }else if(tabTypeKey.value=='otherAccessories'&&item.otherAccessories.length>0){
|
|
|
|
- let arr=[]
|
|
|
|
- arr.push({name:splitFileName(item.otherAccessoriesName),url:item.otherAccessories})
|
|
|
|
- console.log(arr,'arr');
|
|
|
|
- fileListData.value =getArrValue(arr)
|
|
|
|
- listuploadref.value='3'
|
|
|
|
- }else{
|
|
|
|
- attachmentPdfUrl.value=''
|
|
|
|
- }
|
|
|
|
|
|
+ viewAttachmentData.value.forEach((ele)=>{
|
|
|
|
+ ele.isCheck=false
|
|
|
|
+ })
|
|
|
|
+ item.isCheck=true
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//上传进度
|
|
//上传进度
|
|
@@ -748,26 +744,31 @@ const uploadprogress = (res) => {
|
|
console.log('进度');
|
|
console.log('进度');
|
|
}
|
|
}
|
|
|
|
|
|
-const productionCertificatefile=ref('')
|
|
|
|
-const qualityInspectionReportfile=ref('')
|
|
|
|
-const otherAccessoriesfile=ref('')
|
|
|
|
//上传完成
|
|
//上传完成
|
|
const uploadFinished = async(res) => {
|
|
const uploadFinished = async(res) => {
|
|
- if(tabTypeKey.value=='productionCertificate'){
|
|
|
|
- productionCertificatefile.value =res
|
|
|
|
- } else if (tabTypeKey.value=='qualityInspectionReport') {
|
|
|
|
- qualityInspectionReportfile.value=res
|
|
|
|
- }else{
|
|
|
|
- otherAccessoriesfile.value=res
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
const { error, code, data } = await dataApi.updateAncillaryDocument(
|
|
const { error, code, data } = await dataApi.updateAncillaryDocument(
|
|
{
|
|
{
|
|
- id:curFileData.value.id,
|
|
|
|
- productionCertificate:productionCertificatefile.value.link,
|
|
|
|
- qualityInspectionReport:qualityInspectionReportfile.value.link,
|
|
|
|
- otherAccessories:otherAccessoriesfile.value.link
|
|
|
|
|
|
+ selfId:viewAttachmentId.value,
|
|
|
|
+ url:res.link,
|
|
|
|
+ type: tabTypeKey.value,
|
|
|
|
+
|
|
})
|
|
})
|
|
|
|
+ console.log(data,'data');
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+//上传文件delFileData
|
|
|
|
+const delFileData = async(res) => {
|
|
|
|
+ console.log('删除文件',curFileData.value);
|
|
|
|
+ const { error, code, data } = await dataApi.removedocuments(
|
|
|
|
+ {
|
|
|
|
+ id:curFileData.value.id,
|
|
|
|
+ })
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window.$message.success('删除成功')
|
|
|
|
+ refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//样品信息数据
|
|
//样品信息数据
|