修改bug

This commit is contained in:
zhujiyan
2024-10-30 15:02:25 +08:00
parent 038b5275ea
commit 45942b3205
15 changed files with 57 additions and 483 deletions

View File

@@ -56,9 +56,6 @@
<div class="upload_progress" v-if="status != 0 && status != 100 && changeType == 'upload'">
正在上传:{{ fileName }}
<el-progress :percentage="status" />
<!-- <el-progress :percentage="30" :indeterminate="true">
<el-button text>上传中...</el-button>
</el-progress> -->
</div>
</div>
<!-- 以列表形式展示 -->
@@ -196,35 +193,20 @@
<script setup lang="ts">
import DeviceTree from '@/components/tree/govern/deviceTree.vue'
import { mainHeight } from '@/utils/layout'
import { ref, reactive, watch, onMounted, onBeforeUnmount, h, inject } from 'vue'
import { ref, watch, onMounted, onBeforeUnmount, h, inject } from 'vue'
import { ElMessage, ElMessageBox, ElInput } from 'element-plus'
import {
getDeviceRootPath,
getFileServiceFileOrDir,
downLoadDeviceFile,
uploadDeviceFile,
reStartDevice,
addDeviceDir,
delDeviceDir
} from '@/api/cs-device-boot/fileService.ts'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import {
CirclePlus,
Delete,
EditPen,
ArrowLeft,
ArrowRight,
Download,
Upload,
View,
Check,
Plus,
Refresh,
Search
} from '@element-plus/icons-vue'
import { Delete, Download, Upload, Plus, Refresh, Search } from '@element-plus/icons-vue'
import popup from './popup.vue'
import mqtt from 'mqtt'
import { passwordConfirm, updatePassword } from '@/api/user-boot/user'
import { passwordConfirm } from '@/api/user-boot/user'
defineOptions({
name: 'govern/device/fileService'
})
@@ -234,8 +216,6 @@ const tableHeight = mainHeight(130)
const loading = ref(false)
//nDid
const nDid = ref<string>('')
// 树节点点击
//当前目录
const activePath = ref<string>('')
//判断是否是根目录
@@ -243,7 +223,6 @@ const isRoot = ref<boolean>(true)
//储存所有点击过的目录
const activePathList: any = ref([])
const nodeClick = (e: any) => {
console.log(e, '------')
if (e && (e.level == 2 || e.type == 'device')) {
loading.value = true
nDid.value = e.ndid
@@ -476,7 +455,6 @@ const submitDeviceDir = () => {
addDeviceDir(obj).then((res: any) => {
if (res.code == 'A0000') {
reloadCurrentMenu(res.message)
// ElMessage({ message: res.message, type: 'success', duration: 5000 })
addDeviceDirOpen.value = false
}
})
@@ -485,13 +463,6 @@ const submitDeviceDir = () => {
}
//删除文件夹或文件
const handleDelDirOrFile = (row: any) => {
// delDeviceDir({ nDid: nDid.value, path: row.prjDataPath }).then((res: any) => {
// if (res.code == 'A0000') {
// reloadCurrentMenu(res.message)
// // ElMessage({ message: res.message, type: 'success', duration: 5000 })
// }
// })
ElMessageBox.prompt('二次校验密码确认', '删除', {
confirmButtonText: '确认',
cancelButtonText: '取消',
@@ -596,12 +567,8 @@ const mqttMessage = ref<any>({})
const status: any = ref()
mqttRef.value.on('message', (topic: any, message: any) => {
// console.log('🚀 ~ mqttRef.value.on ~ message:', JSON.parse(message))
// console.log('mqtt接收到消息', message,topic)
console.log('mqtt接收到消息', JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))))
// "{allStep:\""+times+"\",nowStep:"+i+"}"
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
// eval('(' + str + ')').includes('fileName')
let regex = /fileName:(.*?),allStep/
let regex1 = /allStep:(.*?),nowStep/
let regex2 = /nowStep:(.*?)}/
@@ -610,7 +577,6 @@ mqttRef.value.on('message', (topic: any, message: any) => {
allStep: str.match(regex1)[1],
nowStep: str.match(regex2)[1]
}
console.log(mqttMessage.value, '?????????')
status.value = parseInt(Number((mqttMessage.value.nowStep / mqttMessage.value.allStep) * 100))
fileRef.value.setStatus(mqttMessage.value)
fileName.value = mqttMessage.value.fileName