邓洁: 修改细节

This commit is contained in:
邓洁
2024-01-03 16:41:44 +08:00
parent 317ceacf23
commit 89c137c7b4
4 changed files with 40 additions and 140 deletions

View File

@@ -106,6 +106,9 @@ watch(() => props.airData, (now) => {
} else { } else {
getAirInfo(now.sensorList) getAirInfo(now.sensorList)
} }
}else {
airList.value = []
windSpeed.value = 0
} }
}, {deep: true}); }, {deep: true});
const getChartInfo = (equipmentId) => { const getChartInfo = (equipmentId) => {

View File

@@ -63,7 +63,6 @@ const props = defineProps({
let myEcharts = reactive({}); let myEcharts = reactive({});
const isVisited = ref(false); const isVisited = ref(false);
const showLoading = ref(false) const showLoading = ref(false)
const eleData = ref([])
const electricityConsumptionMonthly = ref(0) const electricityConsumptionMonthly = ref(0)
const monthlySavings = ref(4000) const monthlySavings = ref(4000)
const length = ref(null); const length = ref(null);
@@ -79,18 +78,15 @@ watch(() => props.eleData, (now) => {
setValueA() setValueA()
}, {deep: true}); }, {deep: true});
watch(() => props.list, (now) => { watch(() => props.list, (now) => {
eleData.value.forEach(item => { // props.eleData.forEach(item => {
now.forEach(newItem => { // now.forEach(newItem => {
if (item.equipmentId === newItem.equipmentId) { // if (item.equipmentId === newItem.equipmentId) {
if (newItem.electricityConsumptionDay) { // if (newItem.electricityConsumptionDay) {
electricityConsumptionMonthly.value = newItem.electricityConsumptionMonthly // electricityConsumptionMonthly.value = newItem.electricityConsumptionMonthly
// item.electricityConsumptionDay = newItem.electricityConsumptionDay // }
// item.electricityConsumptionMonthly = newItem.electricityConsumptionMonthly // }
// item.electricityConsumptionTotal = newItem.electricityConsumptionTotal // })
} // })
}
})
})
setValueA() setValueA()
}, {deep: true}); }, {deep: true});
onMounted(() => { onMounted(() => {
@@ -108,25 +104,13 @@ const setValueB = () => {
valueB.value.style.height = `${width}px`; valueB.value.style.height = `${width}px`;
} }
const getBasicData = (data) => { const getBasicData = (data) => {
let tranObj = {} if(data!==null){
let tranArr = [] electricityConsumptionMonthly.value = data[0].electricityConsumptionMonthly
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
} }
const handleOpenChart = () => { const handleOpenChart = () => {
console.log('用电量弹窗') console.log('用电量弹窗')
isVisited.value = true isVisited.value = true
// showLoading.value=true
nextTick(() => { nextTick(() => {
initChart() initChart()
}) })

View File

@@ -5,11 +5,11 @@
<div class="back-icon"></div> <div class="back-icon"></div>
<span>返回</span> <span>返回</span>
</div> </div>
<!-- <div class="site-name">--> <div class="site-name">
<!-- {{ siteName }}--> {{ siteName }}
<!-- </div>--> </div>
<div class="tunnel-title"></div> <div class="tunnel-title"></div>
<div class="all-del-btn"> <div class="all-del-btn" v-if="showOperation">
<div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon" @click="handleAdd"> <div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon" @click="handleAdd">
添加 添加
</div> </div>
@@ -31,7 +31,7 @@
</div> </div>
<div class="box-center"> <div class="box-center">
<div> <div>
<div class="left-img"></div> <div class="left-img" @click="handlePreview"></div>
<div> <div>
<div class="edit-btn" @click.stop="handleGoToEditTunnel(item.tunnelId)"> <div class="edit-btn" @click.stop="handleGoToEditTunnel(item.tunnelId)">
<div class="edit-icon"></div> <div class="edit-icon"></div>
@@ -57,7 +57,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="site-box add-box" @click="handleAdd"> <div class="site-box add-box" @click="handleAdd" v-if="showOperation">
<div class="add-icon"></div> <div class="add-icon"></div>
<div style="cursor: pointer">添加隧道</div> <div style="cursor: pointer">添加隧道</div>
</div> </div>
@@ -121,75 +121,9 @@ const formRules = ref({
serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}] serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}]
}) })
const showFirst = ref(true) const showFirst = ref(true)
const showOperation = ref(true)
const formInstance = ref() const formInstance = ref()
const tunnelList = 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 iconsList = ref([ const iconsList = ref([
{ {
icon: 'sd_icon_fj.png', icon: 'sd_icon_fj.png',
@@ -244,7 +178,7 @@ const title = ref('新增隧道')
const isVisited = ref(false); const isVisited = ref(false);
const tunnelIds = ref([]) const tunnelIds = ref([])
const tunnelNameList = ref([]) const tunnelNameList = ref([])
const siteName = ref('') const siteName = ref(localStorage.getItem('site'))
const form = ref({ const form = ref({
tunnelName: '', tunnelName: '',
serialNumber: '', serialNumber: '',
@@ -258,10 +192,8 @@ const pageInfo = reactive({
pageSize: 12 pageSize: 12
}); });
const total = ref(10); const total = ref(10);
onMounted(() => { onMounted(()=>{
// getSiteDetail(siteId).then((res) => { showOperation.value = localStorage.getItem('roleKey') !== 'tunnel_admin';
// siteName.value = res.data.siteName
// });
}) })
const handleGoSiteOrIndex = () => { const handleGoSiteOrIndex = () => {
if (type === 's') { if (type === 's') {
@@ -322,6 +254,10 @@ const handleSubmit = (instance) => {
ElMessage.warning('请先完善信息再新增') ElMessage.warning('请先完善信息再新增')
} }
// }) // })
}
//预览隧道
const handlePreview=()=>{
} }
const handleGoToEditTunnel = (tunnelId) => { const handleGoToEditTunnel = (tunnelId) => {
isEdit.value = true isEdit.value = true

View File

@@ -162,15 +162,11 @@ const getUser = () => {
getUserInfo().then(res => { getUserInfo().then(res => {
currentUser.value = res.data.user.userName currentUser.value = res.data.user.userName
currentUserId.value = res.data.user.userId currentUserId.value = res.data.user.userId
localStorage.setItem('roleKey', res.data.user.roles[0].roleKey)
localStorage.setItem('userId', currentUserId.value) localStorage.setItem('userId', currentUserId.value)
}) })
} }
const getDefaultSite = (siteId) => {
// console.log('siteList.value',siteList.value)
// getSiteDetail(siteId).then((res) => {
// console.log('res',res)
// });
}
const getOtherInfo = () => { const getOtherInfo = () => {
getLargeScreenInfo().then((res) => { getLargeScreenInfo().then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
@@ -198,19 +194,17 @@ const getScreenInfo = (id) => {
tunnelId.value = id tunnelId.value = id
getLargeScreen(id).then((res) => { getLargeScreen(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
console.log('res',res.data) if(res.data.frequencyChangerList!==null&&res.data.frequencyChangerList.length!==0){
if(res.data.frequencyChangerList.length!==0){
showFanLoading.value=0 showFanLoading.value=0
}else { }else {
showFanLoading.value=1 showFanLoading.value=1
} }
if(res.data.windPressureSensorList.length!==0){ if(res.data.windPressureSensorList!==null&&res.data.windPressureSensorList.length!==0){
showWindLoading.value=0 showWindLoading.value=0
}else { }else {
showWindLoading.value=1 showWindLoading.value=1
} }
if(res.data.sensorList!==null&&res.data.sensorList.length!==0){
if(res.data.sensorList.length!==0){
res.data.sensorList.forEach((item,index)=>{ res.data.sensorList.forEach((item,index)=>{
if ( if (
item.equipmentType === "carbonDioxide" || item.equipmentType === "carbonDioxide" ||
@@ -229,6 +223,7 @@ const getScreenInfo = (id) => {
showBadLoading.value=1 showBadLoading.value=1
} }
largeScreenData.value = res.data; largeScreenData.value = res.data;
console.log('largeScreenData.value',largeScreenData.value)
} else { } else {
ElMessage.warning(res.msg) ElMessage.warning(res.msg)
} }
@@ -243,18 +238,21 @@ const getScreenInfo = (id) => {
const getTunnel = (id) => { const getTunnel = (id) => {
getTunnelBySiteId(id).then((res) => { getTunnelBySiteId(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
tunnelList.value = res.data
getScreenInfo(res.data[0]?.value) getScreenInfo(res.data[0]?.value)
} }
}); });
} }
const changeTunnel = (e) => { const changeTunnel = (e) => {
console.log('tunnelList.value',e,tunnelList.value)
let newObj = {} let newObj = {}
tunnelList.value.forEach((item, index) => { tunnelList.value.forEach((item, index) => {
if (index === e) { if (index === e) {
newObj = item newObj = item
} }
}) })
showBadLoading.value=0
showWindLoading.value=0
showFanLoading.value=0
getScreenInfo(newObj.value) getScreenInfo(newObj.value)
nextTick(() => { nextTick(() => {
showFan.value = true; showFan.value = true;
@@ -347,28 +345,7 @@ const initWebSocket = () => {
socket.send(JSON.stringify(send)); socket.send(JSON.stringify(send));
}, 30000); }, 30000);
}; };
const closeSocket = () => {
socket.close();
};
initWebSocket(); 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();
</script> </script>
<style lang="scss"> <style lang="scss">
.el-drawer__header { .el-drawer__header {