数据接入

This commit is contained in:
szz 2025-06-06 11:44:17 +08:00
parent d76a1d2686
commit 258d599ca8
3 changed files with 111 additions and 36 deletions

View File

@ -47,6 +47,10 @@ export const useEquipmentStore = defineStore(
}
console.log(currentIndex,'currentIndex')
this.deviceStatus[Number(index)].list[index1].defIndex = currentIndex
},
setSslSelect(index, index1) {
this.deviceStatus[Number(index)].list[index1].isSslSelect = !this.deviceStatus[Number(index)].list[index1].isSslSelect
console.log(this.deviceStatus[Number(index)].list[index1].isSslSelect,'isSslSelect')
}
}
}

View File

@ -103,7 +103,8 @@ const options = [
defIndex: 0,
value:'',
unit:'',
xy:'xy'
xy:'xy',
isSsl:false,
},
label: '导体直径'
},
@ -116,7 +117,8 @@ const options = [
defIndex: 0,
value: '',
unit: '',
xy:'xy'
xy:'xy',
isSsl:false,
},
label: '导体直径X'
},
@ -129,7 +131,8 @@ const options = [
defIndex: 0,
value: '',
unit: '',
xy:'xy'
xy:'xy',
isSsl:false,
},
label: '导体直径Y'
},
@ -156,7 +159,8 @@ const options = [
defIndex: 0,
value: '',
unit: '',
xy:'xy'
xy:'xy',
isSsl:false,
},
label: '热外径'
},
@ -169,7 +173,8 @@ const options = [
defIndex: 0,
value: '',
unit: '',
xy:'xy'
xy:'xy',
isSsl:false,
},
label: '热外径X'
},
@ -182,7 +187,8 @@ const options = [
defIndex: 0,
value: '',
unit: '',
xy:'xy'
xy:'xy',
isSsl:false,
},
label: '热外径Y'
},
@ -195,6 +201,7 @@ const options = [
defIndex: 0,
value: '',
unit: '',
isSsl:false,
},
label: '热外径椭圆度'
}
@ -217,18 +224,21 @@ const options = [
defIndex: 0,
value: '',
unit: '',
isSsl:true,
isSslSelect:false,
},
label: '总厚度'
},
{
value: {
title: '总厚度',
title: '总厚度最小厚度',
calculationValue: 'MinALL',
productValue: 'WtALL',
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '总厚度最小厚度'
},
@ -240,7 +250,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '总厚度偏心'
},
@ -252,7 +263,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '总厚度偏心度'
},
@ -264,7 +276,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '总厚度同心度'
}
@ -282,7 +295,9 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:true,
isSslSelect:false,
},
label: '内屏层厚度'
},
@ -294,7 +309,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '内屏层最小厚度'
},
@ -306,7 +322,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '内屏层偏心'
},
@ -318,7 +335,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '内屏层同心度'
},
@ -330,7 +348,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '内屏层偏心度'
}
@ -348,7 +367,9 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:true,
isSslSelect:false,
},
label: '绝缘层厚度'
},
@ -360,7 +381,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '绝缘层最小厚度'
},
@ -372,7 +394,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '绝缘层偏心'
},
@ -384,7 +407,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '绝缘层同心度'
},
@ -396,7 +420,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '绝缘层偏心度'
}
@ -414,7 +439,9 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:true,
isSslSelect:false,
},
label: '外屏层厚度'
},
@ -426,7 +453,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '外屏层最小厚度'
},
@ -438,7 +466,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '外屏层偏心'
},
@ -450,7 +479,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '外屏层同心度'
},
@ -462,7 +492,8 @@ const options = [
lists,
defIndex: 0,
value: '',
unit: ''
unit: '',
isSsl:false,
},
label: '外屏层偏心度'
}

View File

@ -63,27 +63,37 @@
<div class="card-list">
<div class="eccentricity-card" v-for="(item, index) in cardList.list" :key="index">
<div class="card-header">
<span class="title">{{item.title}}</span>
<div class="title">
<img src="@/assets/images/red.png" v-if="item.isSsl && !item.isSslSelect"
@click="handleSslSelect(index)"/>
<img src="@/assets/images/blue.png" v-if="item.isSsl && item.isSslSelect "
@click="handleSslSelect(index)"/>
<div>{{ item.title }}</div>
</div>
<el-icon class="close-icon" @click="deleteCard(index)"><Close /></el-icon>
</div>
<div class="card-content">
<div class="card-text">
<div>
<div class="difference" v-show="item.ssl">
<div class="difference" v-show="item.ssl && item.isSsl">
<span class="plus">收缩率</span>
<span class="label">{{ item.ssl }}%</span>
</div>
<div class="difference" v-show="!item.isgc">
<div class="difference" v-show="item.isgc">
<span class="plus">{{ item.isaddorsub }}</span>
<span class="label">公差</span>
</div>
</div>
<div class="value" :class="{'value1': !item.isgc}">
<div class="value" :class="{'value1': item.isgc}" v-if="!item.isSslSelect">
{{ item.value }}
</div>
<div class="value" :class="{'value1': item.isgc}" v-else>
{{ (item.value - (item.value * (item.ssl/100))).toFixed(2) }}
</div>
</div>
<div class="tolerance-section" v-if="item.lists">
@ -392,11 +402,26 @@ const cardClick = (e) => {
}
const handleDataConfirm = (dataType) => {
console.log('选择的数据项:', dataType)
let isExist = false
chartDataList.value.forEach(item => {
item.list.forEach(listItem => {
if (listItem.title === dataType.title) {
isExist = true
}
})
})
if (isExist) {
ElMessage.warning('该数据项已存在')
return
}
useEquipment.setDeviceData(activeIndex.value, dataType)
console.log(chartDataList.value, '数据')
changeMode()
//
}
//
const handleSslSelect = (index1) => {
useEquipment.setSslSelect(activeIndex.value, index1)
}
// mqtt
const mqttConnect = () => {
console.log(clientId.value)
@ -678,6 +703,7 @@ const initSubscribe = async () => {
}
})
changeMode()
})
// deviceData.value = message
@ -780,12 +806,16 @@ onMounted(async() => {
const changeMode = () => {
chartDataList.value.forEach(item => {
item.list.forEach(listItem => {
console.log(listItem, 'listItem')
console.log(listItem.productValue, 'listItem.productValue')
let values = listItem.productValue
listItem.lists.forEach(listItem1 => {
listItem1.value = productInfo.value[values][listItem1.label]
listItem.lists = listItem.lists.map(listItem1 => {
listItem[listItem1.label] = productInfo.value[values][listItem1.label]
console.log(values, listItem[listItem1.label], productInfo.value[values][listItem1.label])
return {
name: listItem1.name,
unit: listItem1.unit,
label: listItem1.label,
value: productInfo.value[values][listItem1.label]
}
})
listItem.lists.push({
name: '公差',
@ -805,8 +835,9 @@ const changeMode = () => {
listItem.lists = listItem.lists.filter(item1 => {
return item1.value !== undefined && item1.label !== 'fgc' && item1.label !== 'zgc'
})
listItem.isgc = listItem.value > (Number(listItem.zgc) + Number(listItem.bcz)) || listItem.value < Number(listItem.fgc) + Number(listItem.bcz)
listItem.isgc = listItem.value > (Number(listItem.zgc) + Number(listItem.bcz)) || Number(listItem.bcz) - Number(listItem.fgc) > listItem.value
listItem.isaddorsub = listItem.value > Number(listItem.zgc) + Number(listItem.bcz) ? '+' : '-'
console.log(listItem, 'listItem.bcz')
})
})
}
@ -933,6 +964,15 @@ watch(() => productInfo.value, (newVal) => {
font-size: 14px;
color: #333;
font-weight: 600;
display: flex;
align-items: center;
cursor: pointer;
img {
margin-right: 10px;
width: 20px;
height: 20px;
}
}
.close-icon {