微调
This commit is contained in:
@@ -4,10 +4,10 @@ import { ElLoading, ElMessage, ElNotification, type LoadingOptions } from 'eleme
|
|||||||
import { refreshToken } from '@/api/user-boot/user'
|
import { refreshToken } from '@/api/user-boot/user'
|
||||||
import router from '@/router/index'
|
import router from '@/router/index'
|
||||||
import { useAdminInfo } from '@/stores/adminInfo'
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
import { set } from 'lodash'
|
|
||||||
|
|
||||||
window.requests = []
|
window.requests = []
|
||||||
window.tokenRefreshing = false
|
window.tokenRefreshing = false
|
||||||
|
let loginExpireTimer:any=null
|
||||||
const pendingMap = new Map()
|
const pendingMap = new Map()
|
||||||
const loadingInstance: LoadingInstance = {
|
const loadingInstance: LoadingInstance = {
|
||||||
target: null,
|
target: null,
|
||||||
@@ -143,14 +143,29 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (response.data.code == 'A0024') {
|
} else if (response.data.code == 'A0024') {
|
||||||
// 登录失效
|
// // 登录失效
|
||||||
ElMessage({
|
// 清除上一次的定时器
|
||||||
|
if (loginExpireTimer) {
|
||||||
|
clearTimeout(loginExpireTimer)
|
||||||
|
}
|
||||||
|
loginExpireTimer = setTimeout(() => {
|
||||||
|
ElNotification({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: response.data.message
|
message: response.data.message
|
||||||
})
|
})
|
||||||
adminInfo.removeToken()
|
adminInfo.removeToken()
|
||||||
router.push({ name: 'login' })
|
router.push({ name: 'login' })
|
||||||
|
loginExpireTimer = null // 执行后清空定时器
|
||||||
|
}, 100) // 可根据实际情况调整延迟时间
|
||||||
return Promise.reject(response.data)
|
return Promise.reject(response.data)
|
||||||
|
// // 登录失效
|
||||||
|
// ElMessage({
|
||||||
|
// type: 'error',
|
||||||
|
// message: response.data.message
|
||||||
|
// })
|
||||||
|
// adminInfo.removeToken()
|
||||||
|
// router.push({ name: 'login' })
|
||||||
|
// return Promise.reject(response.data)
|
||||||
} else {
|
} else {
|
||||||
if (options.showCodeMessage) {
|
if (options.showCodeMessage) {
|
||||||
if (response.config.url == '/access-boot/device/wlRegister') {
|
if (response.config.url == '/access-boot/device/wlRegister') {
|
||||||
|
|||||||
@@ -173,6 +173,17 @@ const connectMqtt = () => {
|
|||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
getMakeUpDataList(route.value)
|
getMakeUpDataList(route.value)
|
||||||
}
|
}
|
||||||
|
function parseStringToObject(str:string) {
|
||||||
|
const content = str.replace(/^{|}$/g, '')
|
||||||
|
const pairs = content.split(',')
|
||||||
|
const result:any = {}
|
||||||
|
pairs.forEach(pair => {
|
||||||
|
const [key, value] = pair.split(':')
|
||||||
|
// 尝试将数字转换为Number类型
|
||||||
|
result[key.trim()] = isNaN(Number(value)) ? value.trim() : Number(value)
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
connectMqtt()
|
connectMqtt()
|
||||||
mqttRef.value.on('connect', () => {
|
mqttRef.value.on('connect', () => {
|
||||||
// ElMessage.success('连接mqtt服务器成功!')
|
// ElMessage.success('连接mqtt服务器成功!')
|
||||||
@@ -188,10 +199,7 @@ mqttRef.value.on('message', (topic: any, message: any) => {
|
|||||||
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
|
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
|
||||||
let regex1 = /allStep:(.*?),nowStep/
|
let regex1 = /allStep:(.*?),nowStep/
|
||||||
let regex2 = /nowStep:(.*?)}/
|
let regex2 = /nowStep:(.*?)}/
|
||||||
mqttMessage.value = {
|
mqttMessage.value = parseStringToObject(str)
|
||||||
allStep: str.match(regex1)[1],
|
|
||||||
nowStep: str.match(regex2)[1]
|
|
||||||
}
|
|
||||||
// console.log(mqttMessage.value)
|
// console.log(mqttMessage.value)
|
||||||
let checkedList = tableRef.value.getCheckboxRecords().map((item: any) => {
|
let checkedList = tableRef.value.getCheckboxRecords().map((item: any) => {
|
||||||
return item.name
|
return item.name
|
||||||
|
|||||||
@@ -8,8 +8,12 @@
|
|||||||
<div class="right_nav">
|
<div class="right_nav">
|
||||||
<div class="menu" v-if="activePathList.length != 0">
|
<div class="menu" v-if="activePathList.length != 0">
|
||||||
<el-breadcrumb separator="/">
|
<el-breadcrumb separator="/">
|
||||||
<el-breadcrumb-item v-for="(item, index) in activePathList" style="cursor: pointer" :key="index"
|
<el-breadcrumb-item
|
||||||
@click="handleIntoByPath(item)">
|
v-for="(item, index) in activePathList"
|
||||||
|
style="cursor: pointer"
|
||||||
|
:key="index"
|
||||||
|
@click="handleIntoByPath(item)"
|
||||||
|
>
|
||||||
<span>{{ outPutPath(item, index) }}</span>
|
<span>{{ outPutPath(item, index) }}</span>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
@@ -20,14 +24,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="filter" v-if="activePathList.length != 0">
|
<div class="filter" v-if="activePathList.length != 0">
|
||||||
<el-input maxlength="32" show-word-limit style="width: 200px; height: 32px" placeholder="请输入文件或文件夹名称"
|
<el-input
|
||||||
clearable v-model.trim="filterText" type="text"></el-input>
|
maxlength="32"
|
||||||
|
show-word-limit
|
||||||
|
style="width: 200px; height: 32px"
|
||||||
|
placeholder="请输入文件或文件夹名称"
|
||||||
|
clearable
|
||||||
|
v-model.trim="filterText"
|
||||||
|
type="text"
|
||||||
|
></el-input>
|
||||||
<el-button type="primary" @click="handleSearch" :icon="Search">搜索</el-button>
|
<el-button type="primary" @click="handleSearch" :icon="Search">搜索</el-button>
|
||||||
<!-- <el-button @click="handleRefresh" :icon="Refresh">重置</el-button> -->
|
<!-- <el-button @click="handleRefresh" :icon="Refresh">重置</el-button> -->
|
||||||
<el-upload v-if="activePath != '/'" action="" :auto-upload="false" :show-file-list="false" :on-change="(file: any, fileList: any) => {
|
<el-upload
|
||||||
|
v-if="activePath != '/'"
|
||||||
|
action=""
|
||||||
|
:auto-upload="false"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-change="(file: any, fileList: any) => {
|
||||||
handleUpload(file, fileList, activePath)
|
handleUpload(file, fileList, activePath)
|
||||||
}
|
}
|
||||||
">
|
"
|
||||||
|
>
|
||||||
<el-button>
|
<el-button>
|
||||||
文件上传
|
文件上传
|
||||||
<el-icon class="el-icon--right">
|
<el-icon class="el-icon--right">
|
||||||
@@ -45,14 +62,24 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 以列表形式展示 -->
|
<!-- 以列表形式展示 -->
|
||||||
<div :style="tableHeight">
|
<div :style="tableHeight">
|
||||||
<vxe-table style="margin-top: 10px" border auto-resize height="auto" :data="dirList"
|
<vxe-table
|
||||||
v-bind="defaultAttribute">
|
style="margin-top: 10px"
|
||||||
|
border
|
||||||
|
auto-resize
|
||||||
|
height="auto"
|
||||||
|
:data="dirList"
|
||||||
|
v-bind="defaultAttribute"
|
||||||
|
>
|
||||||
<vxe-column type="seq" title="序号" width="80"></vxe-column>
|
<vxe-column type="seq" title="序号" width="80"></vxe-column>
|
||||||
<vxe-column field="prjDataPath" align="center" title="名称" #default="{ row }">
|
<vxe-column field="prjDataPath" align="center" title="名称" #default="{ row }">
|
||||||
<span style="cursor: pointer; color: #551a8b" :style="{
|
<span
|
||||||
|
style="cursor: pointer; color: #551a8b"
|
||||||
|
:style="{
|
||||||
'text-decoration': row.type == 'dir' ? 'underline' : 'none',
|
'text-decoration': row.type == 'dir' ? 'underline' : 'none',
|
||||||
color: row.type == 'dir' ? '#551a8b' : '#000'
|
color: row.type == 'dir' ? '#551a8b' : '#000'
|
||||||
}" @click="handleIntoDir(row)">
|
}"
|
||||||
|
@click="handleIntoDir(row)"
|
||||||
|
>
|
||||||
{{
|
{{
|
||||||
row &&
|
row &&
|
||||||
row?.prjDataPath &&
|
row?.prjDataPath &&
|
||||||
@@ -83,8 +110,13 @@
|
|||||||
<vxe-column title="操作" width="200px">
|
<vxe-column title="操作" width="200px">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button link size="small" type="danger" @click="handleDelDirOrFile(row)">删除</el-button>
|
<el-button link size="small" type="danger" @click="handleDelDirOrFile(row)">删除</el-button>
|
||||||
<el-button v-if="row.type == 'file'" link size="small" type="primary"
|
<el-button
|
||||||
@click="handleDownLoad(row)">
|
v-if="row.type == 'file'"
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
@click="handleDownLoad(row)"
|
||||||
|
>
|
||||||
下载
|
下载
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -95,8 +127,13 @@
|
|||||||
<div class="list" v-if="dirList.length != 0 && !loading" style="display: none">
|
<div class="list" v-if="dirList.length != 0 && !loading" style="display: none">
|
||||||
<div class="list_item" v-for="(item, index) in dirList" :key="index">
|
<div class="list_item" v-for="(item, index) in dirList" :key="index">
|
||||||
<div class="item_download">
|
<div class="item_download">
|
||||||
<el-button v-if="activePath && activePath != '/'" type="danger" size="small"
|
<el-button
|
||||||
@click="handleDelDirOrFile(item)" circle>
|
v-if="activePath && activePath != '/'"
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="handleDelDirOrFile(item)"
|
||||||
|
circle
|
||||||
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete />
|
<Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@@ -108,8 +145,12 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<img v-if="item?.type == 'dir'" @click="handleIntoDir(item)" src="@/assets/img/wenjianjia.svg" />
|
<img v-if="item?.type == 'dir'" @click="handleIntoDir(item)" src="@/assets/img/wenjianjia.svg" />
|
||||||
<img class="img_file" @click="handleIntoDir(item)" v-if="item?.type == 'file'"
|
<img
|
||||||
src="@/assets/img/wenjian.svg" />
|
class="img_file"
|
||||||
|
@click="handleIntoDir(item)"
|
||||||
|
v-if="item?.type == 'file'"
|
||||||
|
src="@/assets/img/wenjian.svg"
|
||||||
|
/>
|
||||||
<!-- <span v-if="!item.type">暂无数据</span> -->
|
<!-- <span v-if="!item.type">暂无数据</span> -->
|
||||||
<p>
|
<p>
|
||||||
{{
|
{{
|
||||||
@@ -126,9 +167,18 @@
|
|||||||
<!-- <el-empty v-if="dirList.length === 0" /> -->
|
<!-- <el-empty v-if="dirList.length === 0" /> -->
|
||||||
</div>
|
</div>
|
||||||
<popup ref="fileRef"></popup>
|
<popup ref="fileRef"></popup>
|
||||||
<el-dialog v-model.trim="addDeviceDirOpen" :destroy-on-close="true" title="新建文件夹目录" width="500" @closed="close">
|
<el-dialog
|
||||||
<el-form ref="formRef" :model="form"
|
v-model.trim="addDeviceDirOpen"
|
||||||
:rules="{ path: [{ required: true, message: '请输入文件夹名称', trigger: 'blur' }] }">
|
:destroy-on-close="true"
|
||||||
|
title="新建文件夹目录"
|
||||||
|
width="500"
|
||||||
|
@closed="close"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="{ path: [{ required: true, message: '请输入文件夹名称', trigger: 'blur' }] }"
|
||||||
|
>
|
||||||
<el-form-item label="文件夹名称" prop="path">
|
<el-form-item label="文件夹名称" prop="path">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.path" placeholder="请输入文件夹名称" />
|
<el-input maxlength="32" show-word-limit v-model.trim="form.path" placeholder="请输入文件夹名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -251,18 +301,16 @@ const handleRestartDevice = () => {
|
|||||||
customClass: 'customInput',
|
customClass: 'customInput',
|
||||||
inputType: 'text',
|
inputType: 'text',
|
||||||
beforeClose: (action, instance, done) => {
|
beforeClose: (action, instance, done) => {
|
||||||
|
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
if (instance.inputValue == null) {
|
if (instance.inputValue == null) {
|
||||||
return ElMessage.warning('请输入密码')
|
return ElMessage.warning('请输入密码')
|
||||||
} else if (instance.inputValue?.length > 32) {
|
} else if (instance.inputValue?.length > 32) {
|
||||||
return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length)
|
return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length)
|
||||||
} else {
|
} else {
|
||||||
done();
|
done()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
done();
|
done()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -439,18 +487,16 @@ const handleDelDirOrFile = (row: any) => {
|
|||||||
customClass: 'customInput',
|
customClass: 'customInput',
|
||||||
inputType: 'text',
|
inputType: 'text',
|
||||||
beforeClose: (action, instance, done) => {
|
beforeClose: (action, instance, done) => {
|
||||||
|
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
if (instance.inputValue == null) {
|
if (instance.inputValue == null) {
|
||||||
return ElMessage.warning('请输入密码')
|
return ElMessage.warning('请输入密码')
|
||||||
} else if (instance.inputValue?.length > 32) {
|
} else if (instance.inputValue?.length > 32) {
|
||||||
return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length)
|
return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length)
|
||||||
} else {
|
} else {
|
||||||
done();
|
done()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
done();
|
done()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
@@ -480,7 +526,7 @@ const changeType = ref<any>('')
|
|||||||
//下载文件
|
//下载文件
|
||||||
const fileRef = ref()
|
const fileRef = ref()
|
||||||
const handleDownLoad = async (row: any) => {
|
const handleDownLoad = async (row: any) => {
|
||||||
; (await nDid.value) && fileRef.value && fileRef.value.open(row, nDid.value)
|
;(await nDid.value) && fileRef.value && fileRef.value.open(row, nDid.value)
|
||||||
// fileName.value = row?.prjDataPath.split('/')[row?.prjDataPath.split('/').length - 1]
|
// fileName.value = row?.prjDataPath.split('/')[row?.prjDataPath.split('/').length - 1]
|
||||||
// localStorage.setItem('fileName', fileName.value)
|
// localStorage.setItem('fileName', fileName.value)
|
||||||
changeType.value = 'download'
|
changeType.value = 'download'
|
||||||
@@ -550,23 +596,29 @@ mqttRef.value.on('connect', (e: any) => {
|
|||||||
})
|
})
|
||||||
const mqttMessage = ref<any>({})
|
const mqttMessage = ref<any>({})
|
||||||
const status: any = ref()
|
const status: any = ref()
|
||||||
|
function parseStringToObject(str:string) {
|
||||||
|
const content = str.replace(/^{|}$/g, '')
|
||||||
|
const pairs = content.split(',')
|
||||||
|
const result:any = {}
|
||||||
|
pairs.forEach(pair => {
|
||||||
|
const [key, value] = pair.split(':')
|
||||||
|
// 尝试将数字转换为Number类型
|
||||||
|
result[key.trim()] = isNaN(Number(value)) ? value.trim() : Number(value)
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
mqttRef.value.on('message', (topic: any, message: any) => {
|
mqttRef.value.on('message', (topic: any, message: any) => {
|
||||||
// console.log('mqtt接收到消息', JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))))
|
// console.log('mqtt接收到消息', JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))))
|
||||||
|
|
||||||
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
|
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
|
||||||
|
|
||||||
|
|
||||||
let regex = /fileName:(.*?),allStep/
|
let regex = /fileName:(.*?),allStep/
|
||||||
let regex1 = /allStep:(.*?),nowStep/
|
let regex1 = /allStep:(.*?),nowStep/
|
||||||
let regex2 = /nowStep:(.*?),userId/
|
let regex2 = /nowStep:(.*?),userId/
|
||||||
let regex3 = /userId:(.*?)}/
|
let regex3 = /userId:(.*?)}/
|
||||||
|
|
||||||
mqttMessage.value = {
|
mqttMessage.value = parseStringToObject(str)
|
||||||
fileName: str.match(regex)[1],
|
|
||||||
allStep: str.match(regex1)[1],
|
|
||||||
nowStep: str.match(regex2)[1],
|
|
||||||
userId: str.match(regex3)[1]
|
|
||||||
}
|
|
||||||
// console.log("🚀 ~ str.match(regex3)[1]:", str.match(regex3)[1])
|
// console.log("🚀 ~ str.match(regex3)[1]:", str.match(regex3)[1])
|
||||||
status.value = parseInt(Number((mqttMessage.value.nowStep / mqttMessage.value.allStep) * 100))
|
status.value = parseInt(Number((mqttMessage.value.nowStep / mqttMessage.value.allStep) * 100))
|
||||||
fileRef.value.setStatus(mqttMessage.value)
|
fileRef.value.setStatus(mqttMessage.value)
|
||||||
@@ -591,7 +643,6 @@ onMounted(() => {
|
|||||||
changeType.value = localStorage.getItem('changeType') ? localStorage.getItem('changeType') : ''
|
changeType.value = localStorage.getItem('changeType') ? localStorage.getItem('changeType') : ''
|
||||||
})
|
})
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
console.log(6666);
|
|
||||||
if (mqttRef.value) {
|
if (mqttRef.value) {
|
||||||
mqttRef.value.end()
|
mqttRef.value.end()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,13 +107,9 @@ const editd = (e: any) => {
|
|||||||
}
|
}
|
||||||
// 设计
|
// 设计
|
||||||
const Aclick = (e: any) => {
|
const Aclick = (e: any) => {
|
||||||
window.open(window.location.origin + `/zutai/?id=${e.id}&&name=decodeURI(${e.name})&&flag=false`)
|
window.open(window.location.origin + `/zutai/?id=${e.id}&&name=${e.name}&&preview=false`)
|
||||||
// const link = document.createElement("a"); //创建下载a标签
|
// window.open('http://192.168.1.128:4001' + `/zutai/?id=${e.id}&&name=${e.name}&&preview=false`)
|
||||||
// link.target = `_blank`;
|
|
||||||
// link.href = `http://192.168.1.128:3001/zutai/?id=${e.id}&&name=decodeURI(${e.name})&&flag=false`;
|
|
||||||
// link.style.display = "none"; //默认隐藏元素
|
|
||||||
// document.body.appendChild(link); // body中添加元素
|
|
||||||
// link.click(); // 执行点击事件
|
|
||||||
}
|
}
|
||||||
const shejid = (e: any) => { }
|
const shejid = (e: any) => { }
|
||||||
// 删除
|
// 删除
|
||||||
@@ -148,13 +144,9 @@ const deleted = (e: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const imgData = (e: any) => {
|
const imgData = (e: any) => {
|
||||||
window.open(window.location.origin + `/zutai/?id=${e.id}&&name=decodeURI(${e.name})&&flag=true`)
|
window.open(window.location.origin + `/zutai/?id=${e.id}&&name=${e.name}&&preview=true#/preview`)
|
||||||
// const link = document.createElement("a"); //创建下载a标签
|
// window.open('http://192.168.1.128:4001' + `/zutai/?id=${e.id}&&name=${e.name}&&preview=true#/preview`)
|
||||||
// link.target = `_blank`;
|
|
||||||
// link.href = `http://192.168.1.128:3001/zutai/#/?id=${e.id}&&name=decodeURI(${e.name})&&flag=true`;
|
|
||||||
// link.style.display = "none"; //默认隐藏元素
|
|
||||||
// document.body.appendChild(link); // body中添加元素
|
|
||||||
// link.click(); // 执行点击事件
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onTableSizeChange = (val: number) => {
|
const onTableSizeChange = (val: number) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user