[1078] 完善立即拍摄的结果查询和下载
This commit is contained in:
@@ -215,7 +215,7 @@ export function stopPlayback(params) {
|
||||
export function queryConfig(phoneNumber) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/jt1078/config',
|
||||
url: '/api/jt1078/config/get',
|
||||
params: {
|
||||
phoneNumber: phoneNumber
|
||||
}
|
||||
@@ -224,7 +224,7 @@ export function queryConfig(phoneNumber) {
|
||||
export function setConfig(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/api/jt1078/set-config',
|
||||
url: '/api/jt1078/config/set',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="showDialog"
|
||||
:destroy-on-close="true"
|
||||
:append-to-body="true"
|
||||
@close="close()"
|
||||
>
|
||||
<div id="shared" style="height: 45rem; overflow: auto">
|
||||
|
||||
@@ -200,7 +200,6 @@ export default {
|
||||
search: function() {
|
||||
this.mediaDataInfoList = []
|
||||
this.queryLoading = true
|
||||
console.log(this.timeRange)
|
||||
this.$store.dispatch('jtDevice/queryMediaData', {
|
||||
phoneNumber: this.phoneNumber,
|
||||
queryMediaDataCommand: {
|
||||
@@ -226,10 +225,10 @@ export default {
|
||||
this.$refs.position.openDialog(row.positionBaseInfo)
|
||||
},
|
||||
download: function(row) {
|
||||
this.$message.success('已申请截图,完成后自动下载', { closed: true })
|
||||
this.$message.success('下载请求已发送', { closed: true })
|
||||
// 文件下载地址
|
||||
const baseUrl = window.baseUrl ? window.baseUrl : ''
|
||||
const fileUrl = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + `/api/jt1078/media/upload/one?phoneNumber=${this.phoneNumber}&mediaId=${row.id}`
|
||||
const fileUrl = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + `/api/jt1078/media/upload/one/upload?phoneNumber=${this.phoneNumber}&mediaId=${row.id}`
|
||||
let controller = new AbortController()
|
||||
let signal = controller.signal
|
||||
// 设置请求头
|
||||
@@ -247,7 +246,19 @@ export default {
|
||||
// 创建一个虚拟的链接元素,模拟点击下载
|
||||
const link = document.createElement('a')
|
||||
link.href = window.URL.createObjectURL(blob)
|
||||
link.download = `${this.device.phoneNumber}-${row.channelId}-${dayjs().format('YYYYMMDDHHmmss')}.jpg` // 设置下载文件名,替换filename.ext为实际的文件名和扩展名
|
||||
let suffix = 'jpg'
|
||||
switch (row.type){
|
||||
case 0:
|
||||
suffix = 'jpg'
|
||||
break
|
||||
case 1:
|
||||
suffix = 'mp3'
|
||||
break
|
||||
case 2:
|
||||
suffix = 'mp4'
|
||||
break
|
||||
}
|
||||
link.download = `${row.id}.${suffix}` // 设置下载文件名,替换filename.ext为实际的文件名和扩展名
|
||||
document.body.appendChild(link)
|
||||
// 模拟点击
|
||||
link.click()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-dialog
|
||||
v-el-drag-dialog
|
||||
title="立即拍摄"
|
||||
width="60%"
|
||||
width="65%"
|
||||
top="2rem"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="showDialog"
|
||||
@@ -73,8 +73,14 @@
|
||||
<el-checkbox v-model="showImageConfig">高级配置</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-left: 2rem; text-align: right" >
|
||||
<el-button type="primary" :loading="queryLoading" icon="el-icon-search" @click="shooting()" >
|
||||
执行
|
||||
<el-button v-if="!commandType" type="danger" icon="el-icon-video-camera" @click="stopRecord()" >
|
||||
停止录像
|
||||
</el-button>
|
||||
<el-button v-if="!commandType" type="primary" icon="el-icon-video-camera" @click="shooting()" >
|
||||
开始录像
|
||||
</el-button>
|
||||
<el-button v-if="commandType" type="primary" icon="el-icon-camera" @click="shooting()" >
|
||||
拍照
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -186,6 +192,29 @@ export default {
|
||||
message: '消息已经下发'
|
||||
})
|
||||
})
|
||||
},
|
||||
stopRecord: function() {
|
||||
this.$store.dispatch('jtDevice/shooting', {
|
||||
phoneNumber: this.phoneNumber,
|
||||
shootingCommand: {
|
||||
chanelId: this.chanelId,
|
||||
command: 0,
|
||||
time: 0,
|
||||
save: 1,
|
||||
resolvingPower: 0xff,
|
||||
quality: 0,
|
||||
brightness: 0,
|
||||
contrastRatio: 0,
|
||||
saturation: 0,
|
||||
chroma: 0
|
||||
}
|
||||
})
|
||||
.then( data => {
|
||||
this.$message.success({
|
||||
showClose: true,
|
||||
message: '消息已经下发'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user