修改测试bug,优化页面
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<template>
|
||||
<div class="realtrend" v-loading="loading">
|
||||
<div class="select" v-if="!loading">
|
||||
<div class="mr10">谐波次数</div>
|
||||
<div class="mr10">次数</div>
|
||||
<el-select v-model.trim="selectValue" style="width: 100px" @change="selectChange">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
@@ -292,7 +292,7 @@ const setRealTrendData = (val: any) => {
|
||||
if (selectValue.value != '3') {
|
||||
if (selectValue.value == '2') {
|
||||
if (activeName.value == 2) {
|
||||
if (numberPart % 2 !== 0) {
|
||||
if (numberPart % 2 !== 0 && numberPart < 17) {
|
||||
tableData.value[key] = val[key]
|
||||
}
|
||||
} else {
|
||||
@@ -302,7 +302,7 @@ const setRealTrendData = (val: any) => {
|
||||
}
|
||||
} else {
|
||||
if (activeName.value == 2) {
|
||||
if (numberPart % 2 === 0) {
|
||||
if (numberPart % 2 === 0 && numberPart < 17) {
|
||||
tableData.value[key] = val[key]
|
||||
}
|
||||
} else {
|
||||
@@ -312,7 +312,13 @@ const setRealTrendData = (val: any) => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tableData.value[key] = val[key]
|
||||
if (activeName.value == 2) {
|
||||
if (numberPart < 17) {
|
||||
tableData.value[key] = val[key]
|
||||
}
|
||||
} else {
|
||||
tableData.value[key] = val[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,212 +1,215 @@
|
||||
<!-- 设备文件下载 -->
|
||||
<template>
|
||||
<div :class="downLoading ? 'all_disabled' : ''">
|
||||
<el-dialog v-model.trim="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="progress_left">
|
||||
正在下载:
|
||||
{{
|
||||
// fileData?.prjDataPath
|
||||
// ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
|
||||
// : '/'
|
||||
mqttFileName
|
||||
}}
|
||||
</div>
|
||||
<div class="progress_right">
|
||||
<el-progress :percentage="status" />
|
||||
</div>
|
||||
</div>
|
||||
<el-descriptions title="" style="margin: 10px 0" :column="2" :border="true">
|
||||
<el-descriptions-item label="文件名称">
|
||||
{{
|
||||
fileData?.prjDataPath
|
||||
? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
|
||||
: '/'
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件大小">
|
||||
{{ fileData?.size ? fileData?.size + '字节' : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件时间">
|
||||
{{ fileData?.startTime ? fileData?.startTime : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件校验码">
|
||||
{{ fileData?.fileCheck ? fileData?.fileCheck : '/' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer download_status">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleDownLoad" :disabled="loading" :loading="downLoading">
|
||||
{{ downLoading ? '下载中...' : '下载' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, defineExpose, onUnmounted, defineEmits } from 'vue'
|
||||
import {
|
||||
getFileServiceFileOrDir,
|
||||
downLoadDeviceFile,
|
||||
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 = () => {
|
||||
status.value = 0
|
||||
mqttFileName.value = ''
|
||||
downLoading.value = false
|
||||
dialogVisible.value = false
|
||||
}
|
||||
//文件信息
|
||||
const fileData: any = ref({})
|
||||
//文件名称信息
|
||||
const fileNameInfoMation = ref<any>('')
|
||||
const open = async (row: any, id: any) => {
|
||||
status.value = 0
|
||||
fileData.value = {}
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
const obj = {
|
||||
nDid: id,
|
||||
name: row.prjDataPath,
|
||||
type: row.type
|
||||
}
|
||||
await getFileServiceFileOrDir(obj).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
if (res.data && res.data.length != 0) {
|
||||
fileData.value = res.data[0]
|
||||
fileData.value.nDid = id
|
||||
if (fileData.value && fileData.value.prjDataPath) {
|
||||
fileNameInfoMation.value =
|
||||
fileData.value.prjDataPath.split('/')[fileData.value.prjDataPath.split('/').length - 1]
|
||||
} else {
|
||||
fileNameInfoMation.value = '/'
|
||||
}
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleDownLoad = () => {
|
||||
const obj = {
|
||||
nDid: fileData.value.nDid,
|
||||
name: fileData.value.prjDataPath,
|
||||
size: fileData.value.size,
|
||||
fileCheck: fileData.value.fileCheck
|
||||
}
|
||||
downLoading.value = true
|
||||
downLoadDeviceFile(obj)
|
||||
.then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
// downLoadFile(res.data).then((resp: any) => {
|
||||
// if (resp.type != 'application/json') {
|
||||
// // 'application/vnd.ms-excel'
|
||||
// let blob = new Blob([resp], { type: resp.type })
|
||||
// const url = window.URL.createObjectURL(blob)
|
||||
// const link = document.createElement('a')
|
||||
// link.href = url
|
||||
// link.download = fileData.value?.prjDataPath
|
||||
// ? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
|
||||
// : '/'
|
||||
// document.body.appendChild(link)
|
||||
// downLoading.value = false
|
||||
// link.click()
|
||||
// status.value = 100
|
||||
// ElMessage.success('文件下载成功')
|
||||
// link.remove()
|
||||
// handleClose()
|
||||
// } else {
|
||||
// if (resp.code == 'A0000') {
|
||||
// window.open(res.data, '_blank')
|
||||
// downLoading.value = false
|
||||
// ElMessage.success(resp.message)
|
||||
// handleClose()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e, '0000000')
|
||||
if (e) {
|
||||
downLoading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => { })
|
||||
onUnmounted(() => { })
|
||||
const status = ref(0)
|
||||
const mqttFileName = ref('')
|
||||
const setStatus = (val: any) => {
|
||||
status.value = parseInt(Number((val.nowStep / val.allStep) * 100)) || 0
|
||||
|
||||
mqttFileName.value = val.fileName
|
||||
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') {
|
||||
downLoadFile(ress.data).then((resp: any) => {
|
||||
if (resp.type != 'application/json') {
|
||||
// 'application/vnd.ms-excel'
|
||||
let blob = new Blob([resp], { type: resp.type })
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = fileData.value?.prjDataPath
|
||||
? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
|
||||
: '/'
|
||||
document.body.appendChild(link)
|
||||
downLoading.value = false
|
||||
link.click()
|
||||
status.value = 100
|
||||
ElMessage.success('文件下载成功')
|
||||
link.remove()
|
||||
handleClose()
|
||||
} else {
|
||||
if (resp.code == 'A0000') {
|
||||
window.open(ress.data, '_blank')
|
||||
downLoading.value = false
|
||||
ElMessage.success(resp.message)
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
defineExpose({ open, setStatus })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.download_progress {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.progress_left {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.progress_right {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- 设备文件下载 -->
|
||||
<template>
|
||||
<div :class="downLoading ? 'all_disabled' : ''">
|
||||
<el-dialog v-model.trim="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="progress_left">
|
||||
正在下载:
|
||||
{{
|
||||
// fileData?.prjDataPath
|
||||
// ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
|
||||
// : '/'
|
||||
mqttFileName
|
||||
}}
|
||||
</div>
|
||||
<div class="progress_right">
|
||||
<el-progress :percentage="status" />
|
||||
</div>
|
||||
</div>
|
||||
<el-descriptions title="" style="margin: 10px 0" :column="2" :border="true">
|
||||
<el-descriptions-item label="文件名称">
|
||||
{{
|
||||
fileData?.prjDataPath
|
||||
? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
|
||||
: '/'
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件大小">
|
||||
{{ fileData?.size ? fileData?.size + '字节' : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件时间">
|
||||
{{ fileData?.startTime ? fileData?.startTime : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件校验码">
|
||||
{{ fileData?.fileCheck ? fileData?.fileCheck : '/' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer download_status">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleDownLoad" :disabled="loading" :loading="downLoading">
|
||||
{{ downLoading ? '下载中...' : '下载' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, defineExpose, onUnmounted, defineEmits } from 'vue'
|
||||
import {
|
||||
getFileServiceFileOrDir,
|
||||
downLoadDeviceFile,
|
||||
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'
|
||||
import { log } from 'console'
|
||||
const dialogVisible = ref(false)
|
||||
const loading = ref(false)
|
||||
const adminInfo = useAdminInfo()
|
||||
const downLoading = ref(false)
|
||||
const emit = defineEmits(['downLoadFile'])
|
||||
const handleClose = () => {
|
||||
status.value = 0
|
||||
mqttFileName.value = ''
|
||||
downLoading.value = false
|
||||
dialogVisible.value = false
|
||||
}
|
||||
//文件信息
|
||||
const fileData: any = ref({})
|
||||
//文件名称信息
|
||||
const fileNameInfoMation = ref<any>('')
|
||||
const open = async (row: any, id: any) => {
|
||||
status.value = 0
|
||||
fileData.value = {}
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
const obj = {
|
||||
nDid: id,
|
||||
name: row.prjDataPath,
|
||||
type: row.type
|
||||
}
|
||||
await getFileServiceFileOrDir(obj).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
if (res.data && res.data.length != 0) {
|
||||
fileData.value = res.data[0]
|
||||
fileData.value.nDid = id
|
||||
if (fileData.value && fileData.value.prjDataPath) {
|
||||
fileNameInfoMation.value =
|
||||
fileData.value.prjDataPath.split('/')[fileData.value.prjDataPath.split('/').length - 1]
|
||||
} else {
|
||||
fileNameInfoMation.value = '/'
|
||||
}
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleDownLoad = () => {
|
||||
const obj = {
|
||||
nDid: fileData.value.nDid,
|
||||
name: fileData.value.prjDataPath,
|
||||
size: fileData.value.size,
|
||||
fileCheck: fileData.value.fileCheck
|
||||
}
|
||||
downLoading.value = true
|
||||
downLoadDeviceFile(obj)
|
||||
.then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
// downLoadFile(res.data).then((resp: any) => {
|
||||
// if (resp.type != 'application/json') {
|
||||
// // 'application/vnd.ms-excel'
|
||||
// let blob = new Blob([resp], { type: resp.type })
|
||||
// const url = window.URL.createObjectURL(blob)
|
||||
// const link = document.createElement('a')
|
||||
// link.href = url
|
||||
// link.download = fileData.value?.prjDataPath
|
||||
// ? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
|
||||
// : '/'
|
||||
// document.body.appendChild(link)
|
||||
// downLoading.value = false
|
||||
// link.click()
|
||||
// status.value = 100
|
||||
// ElMessage.success('文件下载成功')
|
||||
// link.remove()
|
||||
// handleClose()
|
||||
// } else {
|
||||
// if (resp.code == 'A0000') {
|
||||
// window.open(res.data, '_blank')
|
||||
// downLoading.value = false
|
||||
// ElMessage.success(resp.message)
|
||||
// handleClose()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e, '0000000')
|
||||
if (e) {
|
||||
downLoading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {})
|
||||
onUnmounted(() => {})
|
||||
const status = ref(0)
|
||||
const mqttFileName = ref('')
|
||||
const setStatus = (val: any) => {
|
||||
status.value = parseInt(Number((val.nowStep / val.allStep) * 100)) || 0
|
||||
|
||||
mqttFileName.value = val.fileName
|
||||
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') {
|
||||
downLoadFile(ress.data).then((resp: any) => {
|
||||
if (resp.type != 'application/json') {
|
||||
// 'application/vnd.ms-excel'
|
||||
let blob = new Blob([resp], { type: resp.type })
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = fileData.value?.prjDataPath
|
||||
? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
|
||||
: '/'
|
||||
document.body.appendChild(link)
|
||||
downLoading.value = false
|
||||
link.click()
|
||||
status.value = 100
|
||||
ElMessage.success('文件下载成功')
|
||||
link.remove()
|
||||
handleClose()
|
||||
} else {
|
||||
if (resp.code == 'A0000') {
|
||||
window.open(ress.data, '_blank')
|
||||
downLoading.value = false
|
||||
ElMessage.success(resp.message)
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
defineExpose({ open, setStatus })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.download_progress {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.progress_left {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.progress_right {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<!-- 对话框为左右布局 -->
|
||||
<el-dialog
|
||||
v-model.trim="dialogVisible"
|
||||
draggable
|
||||
title="添加工程 / 设备"
|
||||
class="cn-operate-dialog"
|
||||
:close-on-click-modal="false"
|
||||
|
||||
@@ -14,6 +14,9 @@ import Disposition from '@/views/govern/device/disposition/index.vue'
|
||||
import OfficialUser from '@/views/govern/device/officialUser/index.vue'
|
||||
import Tourist from '@/views/govern/device/tourist/index.vue'
|
||||
const activeName = ref('1')
|
||||
defineOptions({
|
||||
name: 'permission'
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-tabs--border-card > .el-tabs__content) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div class=" device-manage" :style="{ height: pageHeight.height }" v-loading="loading">
|
||||
<div class="device-manage" :style="{ height: pageHeight.height }" v-loading="loading">
|
||||
<DeviceTree
|
||||
ref="treeRef"
|
||||
:showCheckbox="true"
|
||||
:default-checked-keys="defaultCheckedKeys"
|
||||
@checkChange="checkChange"
|
||||
@@ -25,13 +26,24 @@ import DeviceTree from '@/components/tree/govern/deviceTree.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getVisitorConfig, updateVisitorConfig } from '@/api/cs-device-boot/user'
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
import { ElMessage } from 'element-plus'
|
||||
const pageHeight = mainHeight(60)
|
||||
const loading = ref(true)
|
||||
const defaultCheckedKeys: any = ref([])
|
||||
const tableData = ref([])
|
||||
|
||||
const treeRef = ref(null)
|
||||
const ignoreCheckChange = ref(false)
|
||||
const checkChange = (data: any) => {
|
||||
if (data.data.pName == '便携式设备') {
|
||||
if (ignoreCheckChange.value) {
|
||||
ignoreCheckChange.value = false // 清除标记,不影响后续正常触发
|
||||
return
|
||||
}
|
||||
ignoreCheckChange.value = true
|
||||
ElMessage.warning('便携式设备暂时无法分配给游客!')
|
||||
return treeRef.value?.treRef?.treeRef2?.setCheckedKeys([])
|
||||
}
|
||||
|
||||
if (data.data.level === 2) {
|
||||
if (data.checked) {
|
||||
defaultCheckedKeys.value.push(data.data.id)
|
||||
@@ -57,13 +69,13 @@ const updateVisitorConfigs = () => {
|
||||
})
|
||||
}
|
||||
const getVisitorConfigs = () => {
|
||||
getVisitorConfig().then((res:any) => {
|
||||
getVisitorConfig().then((res: any) => {
|
||||
if (res.code === 'A0000') {
|
||||
tableData.value = res.data
|
||||
loading.value = false
|
||||
if (defaultCheckedKeys.value.length > 0) return
|
||||
defaultCheckedKeys.value = [] // 清空
|
||||
res.data.forEach((item:any) => {
|
||||
res.data.forEach((item: any) => {
|
||||
defaultCheckedKeys.value.push(item.deviceId)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user