diff --git a/src/components/content/airInfo/AirInfo.vue b/src/components/content/airInfo/AirInfo.vue index 25090bb..15abe69 100644 --- a/src/components/content/airInfo/AirInfo.vue +++ b/src/components/content/airInfo/AirInfo.vue @@ -106,6 +106,9 @@ watch(() => props.airData, (now) => { } else { getAirInfo(now.sensorList) } + }else { + airList.value = [] + windSpeed.value = 0 } }, {deep: true}); const getChartInfo = (equipmentId) => { diff --git a/src/components/content/usedEle/UsedEle.vue b/src/components/content/usedEle/UsedEle.vue index cf09b65..00de321 100644 --- a/src/components/content/usedEle/UsedEle.vue +++ b/src/components/content/usedEle/UsedEle.vue @@ -63,7 +63,6 @@ const props = defineProps({ let myEcharts = reactive({}); const isVisited = ref(false); const showLoading = ref(false) -const eleData = ref([]) const electricityConsumptionMonthly = ref(0) const monthlySavings = ref(4000) const length = ref(null); @@ -79,18 +78,15 @@ watch(() => props.eleData, (now) => { setValueA() }, {deep: true}); watch(() => props.list, (now) => { - eleData.value.forEach(item => { - now.forEach(newItem => { - if (item.equipmentId === newItem.equipmentId) { - if (newItem.electricityConsumptionDay) { - electricityConsumptionMonthly.value = newItem.electricityConsumptionMonthly - // item.electricityConsumptionDay = newItem.electricityConsumptionDay - // item.electricityConsumptionMonthly = newItem.electricityConsumptionMonthly - // item.electricityConsumptionTotal = newItem.electricityConsumptionTotal - } - } - }) - }) + // props.eleData.forEach(item => { + // now.forEach(newItem => { + // if (item.equipmentId === newItem.equipmentId) { + // if (newItem.electricityConsumptionDay) { + // electricityConsumptionMonthly.value = newItem.electricityConsumptionMonthly + // } + // } + // }) + // }) setValueA() }, {deep: true}); onMounted(() => { @@ -108,25 +104,13 @@ const setValueB = () => { valueB.value.style.height = `${width}px`; } const getBasicData = (data) => { - let tranObj = {} - let tranArr = [] - data?.map(item => { - electricityConsumptionMonthly.value = item.electricityConsumptionMonthly, - tranObj = { - equipmentId: item.equipmentId, - // equipmentName: item.equipmentName, - // electricityConsumptionDay: item.electricityConsumptionDay, - // electricityConsumptionMonthly: item.electricityConsumptionMonthly, - // electricityConsumptionTotal: item.electricityConsumptionTotal, - } - tranArr.push(tranObj) - }) - eleData.value = tranArr + if(data!==null){ + electricityConsumptionMonthly.value = data[0].electricityConsumptionMonthly + } } const handleOpenChart = () => { console.log('用电量弹窗') isVisited.value = true - // showLoading.value=true nextTick(() => { initChart() }) diff --git a/src/views/tunnel-manage/index.vue b/src/views/tunnel-manage/index.vue index 5dc6556..cd1d35d 100644 --- a/src/views/tunnel-manage/index.vue +++ b/src/views/tunnel-manage/index.vue @@ -5,11 +5,11 @@
返回 - - - +
+ {{ siteName }} +
-
+
添加
@@ -31,7 +31,7 @@
-
+
@@ -57,7 +57,7 @@
-
+
添加隧道
@@ -121,75 +121,9 @@ const formRules = ref({ serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}] }) const showFirst = ref(true) +const showOperation = ref(true) const formInstance = ref() -const tunnelList = ref([ - { - tunnelName: '一号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '二号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - }, - { - tunnelName: '三号隧道', - num: 1, - constructionLength: 500, - implementationLength: 10 - } -]) +const tunnelList = ref([]) const iconsList = ref([ { icon: 'sd_icon_fj.png', @@ -244,7 +178,7 @@ const title = ref('新增隧道') const isVisited = ref(false); const tunnelIds = ref([]) const tunnelNameList = ref([]) -const siteName = ref('') +const siteName = ref(localStorage.getItem('site')) const form = ref({ tunnelName: '', serialNumber: '', @@ -258,10 +192,8 @@ const pageInfo = reactive({ pageSize: 12 }); const total = ref(10); -onMounted(() => { - // getSiteDetail(siteId).then((res) => { - // siteName.value = res.data.siteName - // }); +onMounted(()=>{ + showOperation.value = localStorage.getItem('roleKey') !== 'tunnel_admin'; }) const handleGoSiteOrIndex = () => { if (type === 's') { @@ -322,6 +254,10 @@ const handleSubmit = (instance) => { ElMessage.warning('请先完善信息再新增') } // }) +} +//预览隧道 +const handlePreview=()=>{ + } const handleGoToEditTunnel = (tunnelId) => { isEdit.value = true diff --git a/src/views/tunnel/index.vue b/src/views/tunnel/index.vue index c02826e..b2e6465 100644 --- a/src/views/tunnel/index.vue +++ b/src/views/tunnel/index.vue @@ -162,15 +162,11 @@ const getUser = () => { getUserInfo().then(res => { currentUser.value = res.data.user.userName currentUserId.value = res.data.user.userId + localStorage.setItem('roleKey', res.data.user.roles[0].roleKey) localStorage.setItem('userId', currentUserId.value) }) } -const getDefaultSite = (siteId) => { - // console.log('siteList.value',siteList.value) - // getSiteDetail(siteId).then((res) => { - // console.log('res',res) - // }); -} + const getOtherInfo = () => { getLargeScreenInfo().then((res) => { if (res?.code === 1000) { @@ -198,19 +194,17 @@ const getScreenInfo = (id) => { tunnelId.value = id getLargeScreen(id).then((res) => { if (res?.code === 1000) { - console.log('res',res.data) - if(res.data.frequencyChangerList.length!==0){ + if(res.data.frequencyChangerList!==null&&res.data.frequencyChangerList.length!==0){ showFanLoading.value=0 }else { showFanLoading.value=1 } - if(res.data.windPressureSensorList.length!==0){ + if(res.data.windPressureSensorList!==null&&res.data.windPressureSensorList.length!==0){ showWindLoading.value=0 }else { showWindLoading.value=1 } - - if(res.data.sensorList.length!==0){ + if(res.data.sensorList!==null&&res.data.sensorList.length!==0){ res.data.sensorList.forEach((item,index)=>{ if ( item.equipmentType === "carbonDioxide" || @@ -229,6 +223,7 @@ const getScreenInfo = (id) => { showBadLoading.value=1 } largeScreenData.value = res.data; + console.log('largeScreenData.value',largeScreenData.value) } else { ElMessage.warning(res.msg) } @@ -243,18 +238,21 @@ const getScreenInfo = (id) => { const getTunnel = (id) => { getTunnelBySiteId(id).then((res) => { if (res?.code === 1000) { - tunnelList.value = res.data getScreenInfo(res.data[0]?.value) } }); } const changeTunnel = (e) => { + console.log('tunnelList.value',e,tunnelList.value) let newObj = {} tunnelList.value.forEach((item, index) => { if (index === e) { newObj = item } }) + showBadLoading.value=0 + showWindLoading.value=0 + showFanLoading.value=0 getScreenInfo(newObj.value) nextTick(() => { showFan.value = true; @@ -347,28 +345,7 @@ const initWebSocket = () => { socket.send(JSON.stringify(send)); }, 30000); }; -const closeSocket = () => { - socket.close(); -}; initWebSocket(); - - -// watch( -// () => tunnelId.value, -// (now) => { -// tunnelId.value = now -// }, -// { deep: true } -// ) - -// const getTunnelPreview = () => { -// getTunnelDetail(tunnelId).then((res) => { -// if (res?.code === 1000) { -// form.value = res.data; -// } -// }); -// }; -// getTunnelPreview();