bugfixed:添加高频选项

This commit is contained in:
geting 2025-01-17 09:52:57 +08:00
parent 91fbce7d98
commit 80952ac7f4
2 changed files with 53 additions and 22 deletions

View File

@ -1,11 +1,20 @@
<template> <template>
<div class="measurement"> <div class="measurement">
<div class="transferHeader"> <div class="transferHeader">
<span class="transferTitle">可添加的测点</span> <div class="pointDialogColTitleInput">
<el-radio-group v-model="radioActiveName" @change="typeChange"> <span class="transferTitle">可添加的测点</span>
<el-radio :value="138">模拟量</el-radio> <el-input v-model="inputValue" clearable @keyup.enter="typeChange"></el-input>
<el-radio :value="199">计算量</el-radio> <el-button type="primary" @click="typeChange">查询</el-button>
</el-radio-group> </div>
<div class="radios">
<span style="margin-right: 10px">是否高频数据</span>
<el-switch style="margin-right: 24px" v-model="highSpeed" @change="typeChange" />
<el-radio-group v-model="radioActiveName" @change="typeChange">
<el-radio :value="138">模拟量</el-radio>
<el-radio :value="199">计算量</el-radio>
</el-radio-group>
</div>
</div> </div>
<div class="main"> <div class="main">
<el-table :columns="tableColumn" :data="tableData" max-height="420"> <el-table :columns="tableColumn" :data="tableData" max-height="420">
@ -70,6 +79,8 @@ const props = defineProps({
}) })
const radioActiveName = ref(138) const radioActiveName = ref(138)
const inputValue = ref('')
const highSpeed = ref(false)
const typeChange = () => { const typeChange = () => {
pageSetting.current == 1 ? getCompleteData() : (pageSetting.current = 1) pageSetting.current == 1 ? getCompleteData() : (pageSetting.current = 1)
} }
@ -120,6 +131,8 @@ const getAttributeList = () => {
pageNum: pageSetting.current, pageNum: pageSetting.current,
pageSize: pageSetting.pageSize, pageSize: pageSetting.pageSize,
attributeType: radioActiveName.value, attributeType: radioActiveName.value,
highSpeed: highSpeed.value ? 1 : 0,
attributeName: inputValue.value,
} }
return new Promise((resolve) => { return new Promise((resolve) => {
getModelAttributeListReq(requestData) getModelAttributeListReq(requestData)
@ -163,8 +176,10 @@ watch(
() => props.show, () => props.show,
(newVal) => { (newVal) => {
if (newVal) { if (newVal) {
pageSetting.current == 1 ? getCompleteData() : (pageSetting.current = 1)
selectedIndex.value = props.irn selectedIndex.value = props.irn
inputValue.value = ''
highSpeed.value = false
pageSetting.current == 1 ? getCompleteData() : (pageSetting.current = 1)
} }
}, },
{ {
@ -187,6 +202,18 @@ watch(
background: #f7f9fc; background: #f7f9fc;
border-bottom: 1px solid #e1edf6; border-bottom: 1px solid #e1edf6;
border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0;
.pointDialogColTitleInput {
.el-input {
width: 180px;
}
.el-button {
margin-left: 10px;
}
}
.radios {
display: flex;
align-items: center;
}
} }
.main { .main {
padding: 10px; padding: 10px;

View File

@ -494,6 +494,8 @@ const intervalChange = (val: any) => {
const tableDataLeftRef = ref() const tableDataLeftRef = ref()
const openMeasure = () => { const openMeasure = () => {
showMeasure.value = true showMeasure.value = true
highSpeed.value = false
inputValue.value = ''
pageSetting.current = 1 pageSetting.current = 1
getCompleteData() getCompleteData()
selectedLeft.value = JSON.parse(JSON.stringify(submitParams.selectedLeft)) selectedLeft.value = JSON.parse(JSON.stringify(submitParams.selectedLeft))
@ -629,8 +631,12 @@ const handleRes = (res: any, selectAllDevices: any) => {
lowSpeedExoprtData.value.push(dataItem.join(',')) lowSpeedExoprtData.value.push(dataItem.join(','))
}) })
} }
highcsvContent.value = highSpeedExoprtHeader.value + '\n' + highSpeedExoprtData.value.join('\n') highcsvContent.value = highSpeedExoprtData.value.length
lowcsvContent.value = lowSpeedExoprtHeader.value + '\n' + lowSpeedExoprtData.value.join('\n') ? highSpeedExoprtHeader.value + '\n' + highSpeedExoprtData.value.join('\n')
: []
lowcsvContent.value = lowSpeedExoprtData.value.length
? lowSpeedExoprtHeader.value + '\n' + lowSpeedExoprtData.value.join('\n')
: []
if (!yData.length) { if (!yData.length) {
ElMessage.info(`${deviceName + attName}数据为空`) ElMessage.info(`${deviceName + attName}数据为空`)
return return
@ -695,20 +701,18 @@ const statAnalysisExport = () => {
tables.forEach((table) => { tables.forEach((table) => {
const csvContent = table.data const csvContent = table.data
if (csvContent.length) {
// Blob const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }) const link = document.createElement('a')
if (link.download !== undefined) {
// const url = URL.createObjectURL(blob)
const link = document.createElement('a') link.setAttribute('href', url)
if (link.download !== undefined) { link.setAttribute('download', table.filename)
const url = URL.createObjectURL(blob) link.style.visibility = 'hidden'
link.setAttribute('href', url) document.body.appendChild(link)
link.setAttribute('download', table.filename) link.click()
link.style.visibility = 'hidden' document.body.removeChild(link)
document.body.appendChild(link) }
link.click()
document.body.removeChild(link)
} }
}) })
} }