文件同步状态

This commit is contained in:
XaoLi717 2024-10-08 18:54:58 +08:00
parent c3e17e254e
commit 012acbb587

View File

@ -234,7 +234,7 @@ const SyncFiles = async () => {
const addMap = {
docx: 'add_docs',
xlsx: 'add_excel',
pptx: 'add_pppt',
pptx: 'add_ppt',
pdf: 'add_pdfs',
md: 'add_mds',
txt: 'add_texts',
@ -260,19 +260,19 @@ const SyncFiles = async () => {
console.error("同 步 错 误 :", error);
}
}
console.log("fileList.value完成",fileList.value)
// console.log("fileList.value",fileList.value)
message.success("同步完成! ")
emitUpdatePage()
}
const emitUpdatePage = () => {
console.log("emitUpdatePage",fileList.value)
// console.log("emitUpdatePage",fileList.value)
let result:number[] = [];
for (const pe of fileList.value){
const pa = pe as UploadUserFile & {page?: number};
if (pa.page != null) {
result.push(pa.page)
}
console.log(result)
// console.log(result)
}
emit('update:fileStatus', result)
}
@ -403,7 +403,7 @@ const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
fileVerify.value = false;
//
for (let i = 0; i <fileList.value.length-1; i++){
console.log("list",fileList.value[i].name)
// console.log("list",fileList.value[i].name)
const fileName = fileList.value[i].name
if (resName===fileName){
fileVerify.value = true
@ -453,6 +453,10 @@ const handleRemove = (file: UploadFile) => {
//
fileList.value.splice(index, 1)
MysqlUrl.value.splice(index,1)
const updatedFileStatus = [...props.fileStatus];
updatedFileStatus.splice(index, 1);
emit('update:fileStatus', updatedFileStatus);
// console.log("updatedFileStatus",updatedFileStatus)
// console.log("fileList",fileList.value)
// console.log("MysqlUrl",MysqlUrl.value)
emitUpdateModelValue2()
@ -466,7 +470,7 @@ const handleView = (file)=> {
console.error("文件不可预览");
}
const fileExt = url.substring(url.length-5,url.length).trim().toLowerCase()
console.log(fileExt)
// console.log(fileExt)
if (fileExt==="docx"||fileExt==="xlsx"||fileExt==="pptx"){
window.open("https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(url),'_blank')
}else if(fileExt===".txt"||fileExt===".pdf"){
@ -476,7 +480,7 @@ const handleView = (file)=> {
//
const downloadFile = async (file)=> {
console.log("file",file)
// console.log("file",file)
//使 fetch API Blob
const response = await fetch(file.url);
// response blob
@ -540,23 +544,8 @@ watch(
...(val as string[]).map((url) => ({ name: url,url: url}))
);
}
console.log("fileList", fileList.value)
console.log("props.fileStatus", props.fileStatus)
// console.log("fileList", fileList.value)
// console.log("MysqlUrl", MysqlUrl.value)
if (!props.fileStatus) {
lod.value=false;
console.log("为空", val);
return; // val
}
// props.fileStatus.forEach((item, index) => {
// fileList.value[index].page = item
// if (item == 10 ){
// fileList.value[index].lodTxt = ""
// }else{
// fileList.value[index].lodTxt = ""
// }
// });
},
{ immediate: true, deep: true }
)
@ -565,10 +554,8 @@ watch(
(val:number[]) => {
if (!val) {
lod.value=false;
console.log("为空", val);
return; // val
return;
}
console.log("ileList.value",fileList.value)
val.forEach((item, index) => {
fileList.value[index].page = item
if (item == 10 ){
@ -577,7 +564,7 @@ watch(
fileList.value[index].lodTxt = "完成"
}
});
console.log("ileList.value",fileList.value)
// console.log("fileList int",fileList.value)
},
{ immediate: true, deep: true }
)