修改分布图侧栏传感器 设备数量累加问题
This commit is contained in:
parent
c138049f54
commit
da0a2425f9
@ -11,115 +11,117 @@ export const useFactoryStore = defineStore(Names.Factory, () => {
|
|||||||
//要更新的传感器数据
|
//要更新的传感器数据
|
||||||
const updateSensorData= ref<any>({})
|
const updateSensorData= ref<any>({})
|
||||||
//传感器数量列表
|
//传感器数量列表
|
||||||
const iconList = ref([
|
const temp_iconList = [
|
||||||
{
|
{
|
||||||
id: 1,
|
|
||||||
name: "icon-icon-temperature",
|
|
||||||
i18n:'messages.humitureSensor',
|
|
||||||
value: "温湿度传感器",
|
|
||||||
iconType:"温湿度",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "icon-shengyin",
|
|
||||||
i18n:'messages.noiseSensor',
|
|
||||||
value: "噪音传感器",
|
|
||||||
iconType:"噪音",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "icon-dianliu",
|
|
||||||
i18n:'messages.powerSensor',
|
|
||||||
value: "电力传感器",
|
|
||||||
iconType:"电力",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: "icon-weibiaoti1",
|
|
||||||
i18n:'messages.sparkSensor',
|
|
||||||
value: "火花传感器",
|
|
||||||
iconType:"火花",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: "icon-fenchen",
|
|
||||||
i18n:'messages.dustSensor',
|
|
||||||
value: "粉尘传感器",
|
|
||||||
iconType:"粉尘",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
name: "icon-app_icons--",
|
|
||||||
i18n:'messages.TVOC_CH2OSensor',
|
|
||||||
value: "TVOC/甲醛传感器",
|
|
||||||
iconType:"TVOC/甲醛",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 7,
|
|
||||||
name: "icon-yanwubaojingqi",
|
|
||||||
i18n:'messages.smokeSensor',
|
|
||||||
value: "烟雾传感器",
|
|
||||||
iconType:"烟雾",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 8,
|
|
||||||
name: "icon-ranqi",
|
|
||||||
i18n:'messages.gasSensor',
|
|
||||||
value: "燃气传感器",
|
|
||||||
iconType:"燃气",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 9,
|
|
||||||
name: "icon-shuiya",
|
|
||||||
i18n:'messages.waterPressureSensor',
|
|
||||||
value: "水压传感器",
|
|
||||||
iconType:"水压",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},{
|
|
||||||
id: 10,
|
|
||||||
name: "icon-qiya",
|
|
||||||
i18n:'messages.gasPressureSensor',
|
|
||||||
value: "气压传感器",
|
|
||||||
iconType:"气压",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 11,
|
|
||||||
name: "icon-beikongshuiwupingtaimenhu-tubiao_zhinengwangguan",
|
|
||||||
i18n:'messages.gateway',
|
|
||||||
value: "网关",
|
|
||||||
iconType:"网关",
|
|
||||||
counts: 0,
|
|
||||||
allnum: 0,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
//设备数量列表
|
|
||||||
const devList = ref([ {
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "icon-shebeiditu",
|
name: "icon-icon-temperature",
|
||||||
i18n:'messages.Dev',
|
i18n:'messages.humitureSensor',
|
||||||
value: "设备",
|
value: "温湿度传感器",
|
||||||
|
iconType:"温湿度",
|
||||||
counts: 0,
|
counts: 0,
|
||||||
allnum: 0,
|
allnum: 0,
|
||||||
},])
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: "icon-shengyin",
|
||||||
|
i18n:'messages.noiseSensor',
|
||||||
|
value: "噪音传感器",
|
||||||
|
iconType:"噪音",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: "icon-dianliu",
|
||||||
|
i18n:'messages.powerSensor',
|
||||||
|
value: "电力传感器",
|
||||||
|
iconType:"电力",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: "icon-weibiaoti1",
|
||||||
|
i18n:'messages.sparkSensor',
|
||||||
|
value: "火花传感器",
|
||||||
|
iconType:"火花",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: "icon-fenchen",
|
||||||
|
i18n:'messages.dustSensor',
|
||||||
|
value: "粉尘传感器",
|
||||||
|
iconType:"粉尘",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
name: "icon-app_icons--",
|
||||||
|
i18n:'messages.TVOC_CH2OSensor',
|
||||||
|
value: "TVOC/甲醛传感器",
|
||||||
|
iconType:"TVOC/甲醛",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
name: "icon-yanwubaojingqi",
|
||||||
|
i18n:'messages.smokeSensor',
|
||||||
|
value: "烟雾传感器",
|
||||||
|
iconType:"烟雾",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
name: "icon-ranqi",
|
||||||
|
i18n:'messages.gasSensor',
|
||||||
|
value: "燃气传感器",
|
||||||
|
iconType:"燃气",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 9,
|
||||||
|
name: "icon-shuiya",
|
||||||
|
i18n:'messages.waterPressureSensor',
|
||||||
|
value: "水压传感器",
|
||||||
|
iconType:"水压",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},{
|
||||||
|
id: 10,
|
||||||
|
name: "icon-qiya",
|
||||||
|
i18n:'messages.gasPressureSensor',
|
||||||
|
value: "气压传感器",
|
||||||
|
iconType:"气压",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 11,
|
||||||
|
name: "icon-beikongshuiwupingtaimenhu-tubiao_zhinengwangguan",
|
||||||
|
i18n:'messages.gateway',
|
||||||
|
value: "网关",
|
||||||
|
iconType:"网关",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const temp_devList = [ {
|
||||||
|
id: 1,
|
||||||
|
name: "icon-shebeiditu",
|
||||||
|
i18n:'messages.Dev',
|
||||||
|
value: "设备",
|
||||||
|
counts: 0,
|
||||||
|
allnum: 0,
|
||||||
|
},]
|
||||||
|
const iconList = ref(JSON.parse(JSON.stringify(temp_iconList)))
|
||||||
|
//设备数量列表
|
||||||
|
const devList = ref(JSON.parse(JSON.stringify(temp_devList)))
|
||||||
|
|
||||||
//更新传感器数据方法
|
//更新传感器数据方法
|
||||||
const updateSensorList= (data:any) => {
|
const updateSensorList= (data:any) => {
|
||||||
@ -139,6 +141,9 @@ export const useFactoryStore = defineStore(Names.Factory, () => {
|
|||||||
|
|
||||||
const setDataList = (sensor:any) => {
|
const setDataList = (sensor:any) => {
|
||||||
const data:any[] = []
|
const data:any[] = []
|
||||||
|
sensorList.value = []
|
||||||
|
iconList.value = JSON.parse(JSON.stringify(temp_iconList))
|
||||||
|
|
||||||
for(let i in sensor) {
|
for(let i in sensor) {
|
||||||
let iconListKey = iconList.value.findIndex(item=>item.iconType == i)
|
let iconListKey = iconList.value.findIndex(item=>item.iconType == i)
|
||||||
let items = sensor[i].map((item:any)=>{
|
let items = sensor[i].map((item:any)=>{
|
||||||
@ -177,6 +182,8 @@ export const useFactoryStore = defineStore(Names.Factory, () => {
|
|||||||
sensorList.value = newData;
|
sensorList.value = newData;
|
||||||
}
|
}
|
||||||
const setdevList = (data:any) => {
|
const setdevList = (data:any) => {
|
||||||
|
devList.value = JSON.parse(JSON.stringify(temp_devList))
|
||||||
|
devdataList.value = []
|
||||||
for(let i in data) {
|
for(let i in data) {
|
||||||
data[i].forEach(element => {
|
data[i].forEach(element => {
|
||||||
element.icon = '设备'
|
element.icon = '设备'
|
||||||
|
Loading…
Reference in New Issue
Block a user