文件服务调整
This commit is contained in:
@@ -93,13 +93,13 @@
|
||||
item?.prjDataPath &&
|
||||
item?.prjDataPath.includes(activePath) &&
|
||||
item?.prjDataPath.length > activePath.length
|
||||
? item?.prjDataPath.replace(activePath, ' ')
|
||||
: item?.prjDataPath
|
||||
? item?.prjDataPath.replace(activePath, ' ').replace('/', ' ')
|
||||
: item?.prjDataPath.replace('/', ' ')
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-if="dirList.length == 0 || !dirList[0].type || activePathList.length === 0" />
|
||||
<el-empty v-if="dirList.length === 0" />
|
||||
</div>
|
||||
<popup ref="fileRef"></popup>
|
||||
<el-dialog
|
||||
@@ -131,8 +131,8 @@
|
||||
<script setup lang="ts">
|
||||
import DeviceTree from '@/components/tree/govern/deviceTree.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive, watch, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
getDeviceRootPath,
|
||||
getFileServiceFileOrDir,
|
||||
@@ -157,6 +157,8 @@ import {
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import popup from './popup.vue'
|
||||
import mqtt from 'mqtt'
|
||||
import { passwordConfirm, updatePassword } from '@/api/user-boot/user'
|
||||
defineOptions({
|
||||
name: 'govern/device/fileService'
|
||||
})
|
||||
@@ -179,16 +181,29 @@ const nodeClick = (e: any) => {
|
||||
dirList.value = []
|
||||
activePath.value = ''
|
||||
activePathList.value = []
|
||||
getDeviceRootPath(nDid.value)
|
||||
.then((res: any) => {
|
||||
loading.value = false
|
||||
dirList.value = [res.data]
|
||||
activePath.value = res.data.prjDataPath
|
||||
activePathList.value.map((item: any, index: any) => {
|
||||
if (item.path.indexOf(res.data.prjDataPath) == -1) {
|
||||
activePathList.value.push({ path: activePath.value })
|
||||
}
|
||||
})
|
||||
// getDeviceRootPath(nDid.value)
|
||||
// .then((res: any) => {
|
||||
// loading.value = false
|
||||
// dirList.value = [res.data]
|
||||
// activePath.value = res.data.prjDataPath
|
||||
// activePathList.value.map((item: any, index: any) => {
|
||||
// if (item.path.indexOf(res.data.prjDataPath) == -1) {
|
||||
// activePathList.value.push({ path: activePath.value })
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// .catch(e => {
|
||||
// loading.value = false
|
||||
// })
|
||||
activePath.value = '/'
|
||||
getFileServiceFileOrDir({ nDid: nDid.value, name: activePath.value, type: 'dir' })
|
||||
.then((resp: any) => {
|
||||
if (resp.code == 'A0000') {
|
||||
dirList.value = resp.data
|
||||
currentDirList.value = resp.data
|
||||
activePathList.value = [{ path: activePath.value }]
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
loading.value = false
|
||||
@@ -223,12 +238,28 @@ const handleRefresh = () => {
|
||||
const deviceRestartLoading = ref<boolean>(false)
|
||||
const handleRestartDevice = () => {
|
||||
deviceRestartLoading.value = true
|
||||
reStartDevice({ nDid: nDid.value }).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
deviceRestartLoading.value = false
|
||||
ElMessage.success(res.message)
|
||||
}
|
||||
ElMessageBox.prompt('二次校验密码确认', '装置重启', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
customClass: 'customInput',
|
||||
inputType: 'text'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
console.log(document.querySelector('.custom-message-box'), '77788888', value)
|
||||
passwordConfirm(value).then((resp: any) => {
|
||||
if (resp.code == 'A0000') {
|
||||
reStartDevice({ nDid: nDid.value }).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
deviceRestartLoading.value = false
|
||||
ElMessage({ message: res.message, type: 'success', duration: 5000 })
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
deviceRestartLoading.value = false
|
||||
})
|
||||
}
|
||||
// 进入文件夹
|
||||
const dirList = ref([])
|
||||
@@ -315,6 +346,7 @@ const formRef = ref()
|
||||
const reloadCurrentMenu = (msg: string) => {
|
||||
getFileServiceFileOrDir({ nDid: nDid.value, name: activePath.value, type: 'dir' }).then((resp: any) => {
|
||||
if (resp.code == 'A0000') {
|
||||
loading.value = false
|
||||
dirList.value = resp.data
|
||||
currentDirList.value = resp.data
|
||||
activePathList.value.map((item: any, index: any) => {
|
||||
@@ -322,9 +354,8 @@ const reloadCurrentMenu = (msg: string) => {
|
||||
activePathList.value.splice(index, 1)
|
||||
}
|
||||
})
|
||||
loading.value = false
|
||||
if (!msg) return
|
||||
ElMessage.success(msg)
|
||||
ElMessage({ message: msg, type: 'success', duration: 5000 })
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -343,7 +374,7 @@ const submitDeviceDir = () => {
|
||||
addDeviceDir(obj).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
reloadCurrentMenu(res.message)
|
||||
// ElMessage.success(res.message)
|
||||
// ElMessage({ message: res.message, type: 'success', duration: 5000 })
|
||||
addDeviceDirOpen.value = false
|
||||
}
|
||||
})
|
||||
@@ -356,7 +387,7 @@ const handleDelDirOrFile = (row: any) => {
|
||||
delDeviceDir({ nDid: nDid.value, path: row.prjDataPath }).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
reloadCurrentMenu(res.message)
|
||||
// ElMessage.success(res.message)
|
||||
// ElMessage({ message: res.message, type: 'success', duration: 5000 })
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -403,9 +434,59 @@ watch(
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
const mqttRef = ref()
|
||||
|
||||
const connectMqtt = () => {
|
||||
if (mqttRef.value) {
|
||||
if (mqttRef.value.connected) {
|
||||
return
|
||||
}
|
||||
}
|
||||
const options = {
|
||||
protocolId: 'MQTT',
|
||||
qos: 2,
|
||||
clean: true,
|
||||
connectTimeout: 30 * 1000,
|
||||
clientId: 'mqttjs' + Math.random(),
|
||||
username: 't_user',
|
||||
password: 'njcnpqs'
|
||||
}
|
||||
const url = 'wss://pqmcn.com:8087'
|
||||
|
||||
mqttRef.value = mqtt.connect(url, options)
|
||||
}
|
||||
connectMqtt()
|
||||
mqttRef.value.on('connect', (e: any) => {
|
||||
ElMessage.success('连接mqtt服务器成功!')
|
||||
console.log('mqtt客户端已连接....')
|
||||
mqttRef.value.subscribe('/Web/Progress')
|
||||
})
|
||||
|
||||
mqttRef.value.on('message', (topic: any, message: any) => {
|
||||
// console.log('🚀 ~ mqttRef.value.on ~ message:', JSON.parse(message))
|
||||
console.log('mqtt接收到消息' + message)
|
||||
// "{allStep:\""+times+"\",nowStep:"+i+"}"
|
||||
})
|
||||
|
||||
mqttRef.value.on('error', (error: any) => {
|
||||
console.log('mqtt连接失败...', error)
|
||||
mqttRef.value.end()
|
||||
})
|
||||
|
||||
mqttRef.value.on('close', function () {
|
||||
console.log('mqtt客户端已断开连接.....')
|
||||
})
|
||||
onMounted(() => {})
|
||||
onBeforeUnmount(() => {
|
||||
if (mqttRef.value) {
|
||||
mqttRef.value.end()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -418,6 +499,9 @@ watch(
|
||||
padding: 10px 10px 10px 10px;
|
||||
//margin-left: 10px;
|
||||
border: 1px solid #eee;
|
||||
.el-input__wrapper {
|
||||
-webkit-text-security: disc !important;
|
||||
}
|
||||
.right_nav {
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
@@ -531,4 +615,5 @@ watch(
|
||||
padding: 20px 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user