修改mqtt文件下载问题

This commit is contained in:
GGJ
2024-11-08 14:02:27 +08:00
parent 058fc4b2bf
commit c56c301365
6 changed files with 68 additions and 99 deletions

View File

@@ -3,16 +3,14 @@
<div :class="downLoading ? 'all_disabled' : ''">
<el-dialog v-model="dialogVisible" title="文件信息" width="50%" @closed="handleClose">
<div v-loading="loading">
<div
class="download_progress"
v-if="mqttFileName.includes(fileNameInfoMation) && status != 0 && status != 100"
>
<div class="download_progress"
v-if="mqttFileName.includes(fileNameInfoMation) && status != 0 && status != 100">
<div class="progress_left">
正在下载
{{
// fileData?.prjDataPath
// ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
// : '/'
// ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
// : '/'
mqttFileName
}}
</div>
@@ -59,9 +57,11 @@ import {
downLoadDeviceFilePath
} from '@/api/cs-device-boot/fileService.ts'
import { ElMessage } from 'element-plus'
import { useAdminInfo } from '@/stores/adminInfo'
import { downLoadFile } from '@/api/cs-system-boot/manage.ts'
const dialogVisible = ref(false)
const loading = ref(false)
const adminInfo = useAdminInfo()
const downLoading = ref(false)
const emit = defineEmits(['downLoadFile'])
const handleClose = () => {
@@ -146,14 +146,16 @@ const handleDownLoad = () => {
}
})
}
onMounted(() => {})
onUnmounted(() => {})
onMounted(() => { })
onUnmounted(() => { })
const status = ref(0)
const mqttFileName = ref('')
const setStatus = (val: any) => {
status.value = parseInt(Number((val.nowStep / val.allStep) * 100))
status.value = parseInt(Number((val.nowStep / val.allStep) * 100)) || 0
mqttFileName.value = val.fileName
downLoading.value=true
if (adminInfo.userIndex != val.userId) return
downLoading.value = true
if (status.value == 100) {
downLoadDeviceFilePath({ nDid: fileData.value.nDid, name: fileData.value.prjDataPath }).then((ress: any) => {
if (ress.code == 'A0000') {
@@ -196,9 +198,11 @@ defineExpose({ open, setStatus })
margin: 10px 0;
align-items: center;
justify-content: space-between;
.progress_left {
width: auto;
}
.progress_right {
flex: 1;
padding-left: 10px;