文件同步状态
This commit is contained in:
parent
c3e17e254e
commit
012acbb587
@ -234,7 +234,7 @@ const SyncFiles = async () => {
|
|||||||
const addMap = {
|
const addMap = {
|
||||||
docx: 'add_docs',
|
docx: 'add_docs',
|
||||||
xlsx: 'add_excel',
|
xlsx: 'add_excel',
|
||||||
pptx: 'add_pppt',
|
pptx: 'add_ppt',
|
||||||
pdf: 'add_pdfs',
|
pdf: 'add_pdfs',
|
||||||
md: 'add_mds',
|
md: 'add_mds',
|
||||||
txt: 'add_texts',
|
txt: 'add_texts',
|
||||||
@ -260,19 +260,19 @@ const SyncFiles = async () => {
|
|||||||
console.error("同 步 错 误 :", error);
|
console.error("同 步 错 误 :", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("fileList.value完成",fileList.value)
|
// console.log("fileList.value完成",fileList.value)
|
||||||
message.success("同步完成! ")
|
message.success("同步完成! ")
|
||||||
emitUpdatePage()
|
emitUpdatePage()
|
||||||
}
|
}
|
||||||
const emitUpdatePage = () => {
|
const emitUpdatePage = () => {
|
||||||
console.log("emitUpdatePage",fileList.value)
|
// console.log("emitUpdatePage",fileList.value)
|
||||||
let result:number[] = [];
|
let result:number[] = [];
|
||||||
for (const pe of fileList.value){
|
for (const pe of fileList.value){
|
||||||
const pa = pe as UploadUserFile & {page?: number};
|
const pa = pe as UploadUserFile & {page?: number};
|
||||||
if (pa.page != null) {
|
if (pa.page != null) {
|
||||||
result.push(pa.page)
|
result.push(pa.page)
|
||||||
}
|
}
|
||||||
console.log(result)
|
// console.log(result)
|
||||||
}
|
}
|
||||||
emit('update:fileStatus', result)
|
emit('update:fileStatus', result)
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
|
|||||||
fileVerify.value = false;
|
fileVerify.value = false;
|
||||||
//判断是不是有相同名字文件
|
//判断是不是有相同名字文件
|
||||||
for (let i = 0; i <fileList.value.length-1; i++){
|
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
|
const fileName = fileList.value[i].name
|
||||||
if (resName===fileName){
|
if (resName===fileName){
|
||||||
fileVerify.value = true
|
fileVerify.value = true
|
||||||
@ -453,6 +453,10 @@ const handleRemove = (file: UploadFile) => {
|
|||||||
//删除文件链接已选择删除的链接索引
|
//删除文件链接已选择删除的链接索引
|
||||||
fileList.value.splice(index, 1)
|
fileList.value.splice(index, 1)
|
||||||
MysqlUrl.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("fileList",fileList.value)
|
||||||
// console.log("MysqlUrl",MysqlUrl.value)
|
// console.log("MysqlUrl",MysqlUrl.value)
|
||||||
emitUpdateModelValue2()
|
emitUpdateModelValue2()
|
||||||
@ -466,7 +470,7 @@ const handleView = (file)=> {
|
|||||||
console.error("文件不可预览");
|
console.error("文件不可预览");
|
||||||
}
|
}
|
||||||
const fileExt = url.substring(url.length-5,url.length).trim().toLowerCase()
|
const fileExt = url.substring(url.length-5,url.length).trim().toLowerCase()
|
||||||
console.log(fileExt)
|
// console.log(fileExt)
|
||||||
if (fileExt==="docx"||fileExt==="xlsx"||fileExt==="pptx"){
|
if (fileExt==="docx"||fileExt==="xlsx"||fileExt==="pptx"){
|
||||||
window.open("https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(url),'_blank')
|
window.open("https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(url),'_blank')
|
||||||
}else if(fileExt===".txt"||fileExt===".pdf"){
|
}else if(fileExt===".txt"||fileExt===".pdf"){
|
||||||
@ -476,7 +480,7 @@ const handleView = (file)=> {
|
|||||||
|
|
||||||
//文件下载时文件名为原来名字
|
//文件下载时文件名为原来名字
|
||||||
const downloadFile = async (file)=> {
|
const downloadFile = async (file)=> {
|
||||||
console.log("file",file)
|
// console.log("file",file)
|
||||||
//使用 fetch API 请求文件并返回 Blob 数据
|
//使用 fetch API 请求文件并返回 Blob 数据
|
||||||
const response = await fetch(file.url);
|
const response = await fetch(file.url);
|
||||||
//获取 response blob 属性
|
//获取 response blob 属性
|
||||||
@ -540,23 +544,8 @@ watch(
|
|||||||
...(val as string[]).map((url) => ({ name: url,url: url}))
|
...(val as string[]).map((url) => ({ name: url,url: url}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log("fileList", fileList.value)
|
// console.log("fileList", fileList.value)
|
||||||
console.log("props.fileStatus", props.fileStatus)
|
|
||||||
// console.log("MysqlUrl", MysqlUrl.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 }
|
{ immediate: true, deep: true }
|
||||||
)
|
)
|
||||||
@ -565,10 +554,8 @@ watch(
|
|||||||
(val:number[]) => {
|
(val:number[]) => {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
lod.value=false;
|
lod.value=false;
|
||||||
console.log("为空", val);
|
return;
|
||||||
return; // 如果 val 为空或者不是数组,直接返回
|
|
||||||
}
|
}
|
||||||
console.log("ileList.value",fileList.value)
|
|
||||||
val.forEach((item, index) => {
|
val.forEach((item, index) => {
|
||||||
fileList.value[index].page = item
|
fileList.value[index].page = item
|
||||||
if (item == 10 ){
|
if (item == 10 ){
|
||||||
@ -577,7 +564,7 @@ watch(
|
|||||||
fileList.value[index].lodTxt = "完成"
|
fileList.value[index].lodTxt = "完成"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("ileList.value",fileList.value)
|
// console.log("fileList int",fileList.value)
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user