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