文件同步状态
This commit is contained in:
parent
012acbb587
commit
b341149f51
@ -173,6 +173,7 @@ const upload = async (myFile:any) => {
|
||||
}
|
||||
};
|
||||
const lod = ref(true)
|
||||
const upDing = ref(false)
|
||||
//根据不同值拿到不同字体颜色
|
||||
const getColor = (per:number) => {
|
||||
const colorObj = colors.find(c => per == c.percentage);
|
||||
@ -187,12 +188,16 @@ const getPage = async (fileName:string) => {
|
||||
}
|
||||
//实现文件上传
|
||||
const SyncFiles = async () => {
|
||||
if (upDing.value){
|
||||
message.error("文件正在同步中!")
|
||||
}
|
||||
lod.value=true
|
||||
// console.log("fileList.value",fileList.value)
|
||||
//判断是上传列表是否为空
|
||||
if (fileList.value.length==0){
|
||||
message.error("同步文件为空! ")
|
||||
}
|
||||
upDing.value=true
|
||||
for (const Name of fileList.value) {
|
||||
const fName = Name as UploadUserFile & {page?: number,lodTxt?: String};
|
||||
fName.lodTxt="10%"
|
||||
@ -246,13 +251,14 @@ const SyncFiles = async () => {
|
||||
const add = addMap[fileExt] || ''; // 默认值为空字符串对应路径获取对应接口
|
||||
fName.page = 90;
|
||||
fName.lodTxt="90%"
|
||||
// console.log(`http://192.168.1.15:8000/${add}?path=${filePath}`)
|
||||
const response = await axios.post(`http://192.168.1.15:8000/${add}?path=${filePath}`);
|
||||
upDing.value=false
|
||||
console.log("response",response)
|
||||
await delay(100);
|
||||
fName.page = 100;
|
||||
fName.lodTxt="完成"
|
||||
} catch (error) {
|
||||
upDing.value=false
|
||||
await delay(200);
|
||||
fName.page = 10;
|
||||
message.error("同步错误!")
|
||||
@ -260,12 +266,10 @@ const SyncFiles = async () => {
|
||||
console.error("同 步 错 误 :", error);
|
||||
}
|
||||
}
|
||||
// console.log("fileList.value完成",fileList.value)
|
||||
message.success("同步完成! ")
|
||||
emitUpdatePage()
|
||||
}
|
||||
const emitUpdatePage = () => {
|
||||
// console.log("emitUpdatePage",fileList.value)
|
||||
let result:number[] = [];
|
||||
for (const pe of fileList.value){
|
||||
const pa = pe as UploadUserFile & {page?: number};
|
||||
|
Loading…
Reference in New Issue
Block a user