|  |  |  | 
|---|
|  |  |  | <el-progress :percentage="percentage"></el-progress> | 
|---|
|  |  |  | </el-col> | 
|---|
|  |  |  | <el-col :span="6" > | 
|---|
|  |  |  | <!--       <el-dropdown size="mini" title="播放倍速" style="margin-left: 1px;" @command="gbScale">--> | 
|---|
|  |  |  | <!--         <el-button-group>--> | 
|---|
|  |  |  | <!--           <el-button size="mini" style="width: 100%">--> | 
|---|
|  |  |  | <!--             {{scale}}倍速 <i class="el-icon-arrow-down el-icon--right"></i>--> | 
|---|
|  |  |  | <!--           </el-button>--> | 
|---|
|  |  |  | <!--         </el-button-group>--> | 
|---|
|  |  |  | <!--        <el-dropdown-menu  slot="dropdown">--> | 
|---|
|  |  |  | <!--          <el-dropdown-item command="1">1倍速</el-dropdown-item>--> | 
|---|
|  |  |  | <!--          <el-dropdown-item command="2">2倍速</el-dropdown-item>--> | 
|---|
|  |  |  | <!--          <el-dropdown-item command="4">4倍速</el-dropdown-item>--> | 
|---|
|  |  |  | <!--        </el-dropdown-menu>--> | 
|---|
|  |  |  | <!--      </el-dropdown>--> | 
|---|
|  |  |  | <el-button icon="el-icon-download" v-if="percentage < 100" size="mini" title="点击下载可将以缓存部分下载到本地" @click="download()">停止缓存并下载</el-button> | 
|---|
|  |  |  | </el-col> | 
|---|
|  |  |  | </el-row> | 
|---|
|  |  |  | 
|---|
|  |  |  | taskId: null, | 
|---|
|  |  |  | getProgressRun: false, | 
|---|
|  |  |  | getProgressForFileRun: false, | 
|---|
|  |  |  | timer: null | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.percentage = 0.0; | 
|---|
|  |  |  | this.getProgressTimer() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getProgressTimer(){ | 
|---|
|  |  |  | getProgressTimer: function (){ | 
|---|
|  |  |  | if (!this.getProgressRun) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: `/api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}` | 
|---|
|  |  |  | }).then((res)=> { | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | console.log(res.data.progress) | 
|---|
|  |  |  | this.streamInfo = res.data; | 
|---|
|  |  |  | if (parseFloat(res.data.progress) == 1) { | 
|---|
|  |  |  | this.percentage = 100; | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | if (res.data.code === 0) { | 
|---|
|  |  |  | this.streamInfo = res.data.data; | 
|---|
|  |  |  | if (parseFloat(res.data.progress) == 1) { | 
|---|
|  |  |  | this.percentage = 100; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | this.percentage = (parseFloat(res.data.data.progress)*100).toFixed(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (callback)callback(); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | this.percentage = (res.data.progress*100).toFixed(1); | 
|---|
|  |  |  | this.$message({ | 
|---|
|  |  |  | showClose: true, | 
|---|
|  |  |  | message: res.data.msg, | 
|---|
|  |  |  | type: "error", | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | this.close(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (callback)callback(); | 
|---|
|  |  |  | }).catch((e) =>{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }).catch((e) =>{ | 
|---|
|  |  |  | console.log(e) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | close: function (){ | 
|---|
|  |  |  | if (this.streamInfo.progress < 100) { | 
|---|
|  |  |  | if (this.streamInfo.progress < 1) { | 
|---|
|  |  |  | this.stopDownloadRecord(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (this.timer !== null) { | 
|---|
|  |  |  | window.clearTimeout(this.timer); | 
|---|
|  |  |  | this.timer = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.showDialog=false; | 
|---|
|  |  |  | this.getProgressRun = false; | 
|---|
|  |  |  | 
|---|
|  |  |  | endTime: null, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }).then((res) =>{ | 
|---|
|  |  |  | if (res.data.code === 0 && res.data.msg === "success") { | 
|---|
|  |  |  | if (res.data.code === 0 ) { | 
|---|
|  |  |  | // 查询进度 | 
|---|
|  |  |  | this.title = "录像文件处理中..." | 
|---|
|  |  |  | this.taskId = res.data.data; | 
|---|
|  |  |  | 
|---|
|  |  |  | isEnd: true, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | if (res.data.code == 0) { | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | if (res.data.code === 0) { | 
|---|
|  |  |  | if (res.data.data.length === 0){ | 
|---|
|  |  |  | this.percentage = 0 | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.percentage = parseFloat(res.data.data.percentage)*100 | 
|---|
|  |  |  | if (res.data.data[0].percentage === '1') { | 
|---|
|  |  |  | this.getProgressForFileRun = false; | 
|---|