|
@@ -166,12 +166,12 @@
|
|
|
style="display:flex;justify-content: space-between;margin-top:15px"
|
|
|
>
|
|
|
<span>{{ cameraDownload.data.name }}</span>
|
|
|
- <span>{{ cameraDownload.data.value }}</span>
|
|
|
+ <span>{{ cameraDownload.data.percent }}%</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
<el-slider
|
|
|
:disabled="true"
|
|
|
- v-model="cameraDownload.data.value"
|
|
|
+ v-model="cameraDownload.data.percent"
|
|
|
:show-tooltip="false"
|
|
|
>
|
|
|
</el-slider>
|
|
@@ -209,6 +209,7 @@ import {
|
|
|
getCameraOptions,
|
|
|
checkHasDownload,
|
|
|
getDownloadProcess,
|
|
|
+ downloadScene,
|
|
|
} from "@/request/config";
|
|
|
import axios from "axios";
|
|
|
|
|
@@ -278,22 +279,33 @@ export default {
|
|
|
methods: {
|
|
|
download(item) {
|
|
|
//查询下载进度 0未创建 1打包中 2等待下载
|
|
|
+ let statelist = {
|
|
|
+ 0:0,
|
|
|
+ 1:1,
|
|
|
+ 2:0,
|
|
|
+ 3:2,
|
|
|
+ }
|
|
|
axios
|
|
|
.get(checkHasDownload + item.num, { sceneNum: item.num, isTiles: true })
|
|
|
.then((res) => {
|
|
|
console.log("type---> res :", res.data);
|
|
|
this.cameraDownload.data = {
|
|
|
- type: res.data.downloadUrl ? 2 : 0,
|
|
|
+ type: statelist[res.data.downloadStatus],
|
|
|
+ downloadStatus:res.data.downloadStatus,
|
|
|
sceneNum: item.num,
|
|
|
value: res.data.count,
|
|
|
name: item.sceneName + ".zip",
|
|
|
url: res.data.downloadUrl,
|
|
|
+ percent:0,
|
|
|
};
|
|
|
- if(res.data.count == 0){
|
|
|
+ if(res.data.count == 0 && (res.data.downloadStatus == 0 || res.data.downloadStatus == 2)){
|
|
|
return this.$message.error("暂无剩余下载次数!", "提示");
|
|
|
}else{
|
|
|
this.cameraDownload.show = true;
|
|
|
}
|
|
|
+ if(res.data.downloadStatus == 1){//下载中
|
|
|
+ this.downloadItemCompany()
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
editModel(item) {
|
|
@@ -316,7 +328,7 @@ export default {
|
|
|
//查询下载进度 0未创建 1打包中 2等待下载
|
|
|
//查询进度
|
|
|
let that = this
|
|
|
- const { type, sceneNum, url } = this.cameraDownload.data;
|
|
|
+ const { sceneNum, url,downloadStatus } = this.cameraDownload.data;
|
|
|
let download = (downloadUrl) =>{
|
|
|
let iframe = document.createElement('iframe')
|
|
|
iframe.style.display = 'none'
|
|
@@ -324,17 +336,25 @@ export default {
|
|
|
document.body.appendChild(iframe);
|
|
|
that.cameraDownload.show = false;
|
|
|
}
|
|
|
- if(type == 2){
|
|
|
+ console.log('downloadStatus',downloadStatus)
|
|
|
+ if(downloadStatus == 3){
|
|
|
return download(url)
|
|
|
+ }else if(downloadStatus == 0 || downloadStatus == 2 ){
|
|
|
+ axios.get(downloadScene+sceneNum).then((resdata) => {
|
|
|
+ if(resdata.data.downloadStatus !== 1){
|
|
|
+ clearTimeout(this.timer)
|
|
|
+ that.cameraDownload.show = false;
|
|
|
+ return this.$message.error("暂无剩余下载次数!", "提示");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- let cameraDownloaddata = this.cameraDownload.data;
|
|
|
let fn = () => {
|
|
|
that.timer = setTimeout(() => {
|
|
|
- callback(cameraDownloaddata);
|
|
|
+ callback();
|
|
|
}, 1000);
|
|
|
// downIngs[this.scene.num] = this.timer;
|
|
|
};
|
|
|
- let callback = (item) => {
|
|
|
+ let callback = () => {
|
|
|
axios.get(getDownloadProcess, {
|
|
|
params:{
|
|
|
sceneNum: sceneNum,
|
|
@@ -342,17 +362,13 @@ export default {
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
const { percent,url } = res.data
|
|
|
- that.cameraDownload.data = {
|
|
|
- ...cameraDownloaddata,
|
|
|
- type:1,
|
|
|
- value:percent
|
|
|
- }
|
|
|
+ that.cameraDownload.data.type = 1
|
|
|
+ that.cameraDownload.data.percent = parseInt(percent)
|
|
|
if(!url){
|
|
|
fn()
|
|
|
}else{ //拿到下载链接
|
|
|
url&&download(url)
|
|
|
}
|
|
|
- console.log("type---> res :",item, res.data);
|
|
|
});
|
|
|
}
|
|
|
fn()
|