调整台账录入页面
This commit is contained in:
@@ -141,7 +141,7 @@
|
||||
v-show="
|
||||
dataSet.includes('_items') ||
|
||||
dataSet.indexOf('_history') != -1 ||
|
||||
dataSet.indexOf('_moduleData') != -1||
|
||||
dataSet.indexOf('_moduleData') != -1 ||
|
||||
dataSet.indexOf('_devRunTrend') != -1
|
||||
"
|
||||
>
|
||||
@@ -166,7 +166,11 @@
|
||||
</el-select> -->
|
||||
<el-radio-group
|
||||
v-model.trim="formInline.dataLevel"
|
||||
v-if="!dataSet.includes('_devRunTrend') &&!dataSet.includes('_moduleData') && TrendList?.lineType == 1"
|
||||
v-if="
|
||||
!dataSet.includes('_devRunTrend') &&
|
||||
!dataSet.includes('_moduleData') &&
|
||||
TrendList?.lineType == 1
|
||||
"
|
||||
:disabled="TrendList?.lineType != 1"
|
||||
@change="handleClick"
|
||||
>
|
||||
@@ -227,7 +231,7 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="tableLoading"
|
||||
v-if="realTimeFlag"
|
||||
v-if="showButton"
|
||||
:icon="DataLine"
|
||||
@click="handleTrend"
|
||||
>
|
||||
@@ -235,13 +239,22 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="realTimeFlag"
|
||||
v-if="showButton"
|
||||
:icon="TrendCharts"
|
||||
@click="handleHarmonicSpectrum"
|
||||
:disabled="tableLoading"
|
||||
>
|
||||
实时趋势
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="showButton"
|
||||
:icon="Download"
|
||||
@click="downloadTxt"
|
||||
:disabled="tableLoading"
|
||||
>
|
||||
下载数据
|
||||
</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div
|
||||
@@ -580,7 +593,7 @@ import { useRouter } from 'vue-router'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import {
|
||||
Histogram,
|
||||
Download,
|
||||
TrendCharts,
|
||||
DataLine,
|
||||
DataAnalysis,
|
||||
@@ -592,6 +605,7 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
import analysisList from './analysisList/index.vue'
|
||||
import mqtt from 'mqtt'
|
||||
import { json } from 'node:stream/consumers'
|
||||
defineOptions({
|
||||
name: 'govern/device/control'
|
||||
})
|
||||
@@ -671,6 +685,7 @@ const volConTypeList = dictData.getBasicData('Dev_Connect')
|
||||
// }
|
||||
//谐波频谱
|
||||
const realTrendRef = ref()
|
||||
const txtContent = ref('')
|
||||
const operatingTrendRef = ref()
|
||||
const changeTrendType = (val: any) => {
|
||||
trendDataTime.value = ''
|
||||
@@ -681,7 +696,7 @@ const changeTrendType = (val: any) => {
|
||||
const activeTrendName: any = ref(0)
|
||||
const trendTimer: any = ref()
|
||||
const trendDataTime: any = ref()
|
||||
|
||||
const showButton = ref(false)
|
||||
//谐波频谱方法
|
||||
const handleTrend = async () => {
|
||||
realTimeFlag.value = false
|
||||
@@ -755,7 +770,7 @@ const handleHarmonicSpectrum = async () => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage.success('设备应答成功')
|
||||
// mqttMessage.value = {}
|
||||
|
||||
showButton.value = true
|
||||
realDataTimer.value = window.setInterval(() => {
|
||||
if (!dataSet.value.includes('_realtimedata')) return
|
||||
|
||||
@@ -784,6 +799,7 @@ const handleReturn = async () => {
|
||||
await getBasicRealData(lineId.value).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage.success('设备应答成功')
|
||||
showButton.value = true
|
||||
// mqttMessage.value = {}
|
||||
realDataTimer.value = window.setInterval(() => {
|
||||
if (!dataSet.value.includes('_realtimedata')) return
|
||||
@@ -1000,7 +1016,7 @@ const getRealDataMqttMsg = async () => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage.success('设备应答成功')
|
||||
mqttMessage.value = {}
|
||||
|
||||
showButton.value = true
|
||||
realDataTimer.value = window.setInterval(async () => {
|
||||
if (!dataSet.value.includes('_realtimedata')) return
|
||||
await getBasicRealData(lineId.value).then((res: any) => {
|
||||
@@ -1129,6 +1145,7 @@ const getRealDataMqttMsg = async () => {
|
||||
}
|
||||
if (obj.hasOwnProperty('pA') && obj.hasOwnProperty('pB')) {
|
||||
mqttMessage.value = obj
|
||||
txtContent.value = JSON.stringify(obj)
|
||||
|
||||
//更新实时数据主页面值
|
||||
realTimeFlag.value &&
|
||||
@@ -1178,6 +1195,7 @@ const realDataTimer: any = ref()
|
||||
const mqttMessage = ref<any>({})
|
||||
const handleClick = async (tab?: any) => {
|
||||
tableLoading.value = true
|
||||
showButton.value = false
|
||||
if (realDataTimer.value) {
|
||||
window.clearInterval(realDataTimer.value)
|
||||
}
|
||||
@@ -1346,11 +1364,8 @@ const handleClick = async (tab?: any) => {
|
||||
await setTimeout(() => {
|
||||
getRawData(obj)
|
||||
.then((res: any) => {
|
||||
|
||||
tableLoading.value = false
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
operatingTrendRef.value?.setData(res.data)
|
||||
}, 500)
|
||||
setTimeout(() => {
|
||||
@@ -1484,6 +1499,21 @@ const queryList: any = ref([])
|
||||
const echoName = (value: any, arr: any[]) => {
|
||||
return value ? arr.find(item => item.value == value)?.label : '/'
|
||||
}
|
||||
// 下载txt
|
||||
const downloadTxt = () => {
|
||||
const content = txtContent.value // 文件内容
|
||||
const blob = new Blob([content], { type: 'text/plain' }) // 创建 Blob 对象
|
||||
const url = URL.createObjectURL(blob) // 生成下载链接
|
||||
|
||||
// 创建 <a> 标签并触发下载
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '实时数据.txt' // 文件名
|
||||
link.click()
|
||||
|
||||
// 释放 URL 对象
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
Reference in New Issue
Block a user