Merge pull request 'dengjie' (#104) from dengjie into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/104
This commit is contained in:
odjbin
2023-12-13 05:16:06 +00:00
7 changed files with 103 additions and 147 deletions

View File

@@ -3,98 +3,78 @@
<div class="fan-speed"> <div class="fan-speed">
<img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/> <img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/>
<div class="fan-info"> <div class="fan-info">
<div class="input-fan"><span>风速</span><span>进风13m/s</span></div> <div class="input-fan"><span>风速</span><span>进风{{ windSpeed }}m/s</span></div>
<div class="output-fan"><span>出风13m/s</span></div> <div class="output-fan"><span>出风{{windSpeed}}m/s</span></div>
</div> </div>
</div> </div>
<item-info <item-info
:wp="info" v-for="item in airList"
icon="o2-icon.png" :wp="item"
name="氧气" :icon="item.icon"
unit="%" :name="item.name"
/> :unit="item.unit"
<item-info
:wp="info1"
icon="tempture-icon.png"
name="温度"
unit=".c"
/>
<item-info
:wp="info2"
icon="water-icon.png"
name="湿度"
unit="%"
/>
<item-info
:wp="info3"
icon="dust-icon.png"
name="粉尘"
unit="mg/m3"
/> />
</div> </div>
</template> </template>
<script setup> <script setup>
import {ref, reactive} from "vue";
import ItemInfo from "./childComps/ItemInfo.vue"; import ItemInfo from "./childComps/ItemInfo.vue";
const props = defineProps({ const props = defineProps({
list: Array, list: Array,
airData: Array airData: Array
}); });
let info = reactive({ const windSpeed=ref('')
// windPId: 0, //编号 const airList = ref([])
// max: 120, //最大值 watch(() => props.list, (now) => {
// value: 70, //测量值 airList.value.forEach(item=>{
// point: 60, //阈值 now.forEach(newItem=>{
}); if(item.equipmentId === newItem.equipmentId){
let info1 = reactive({}); item.value = newItem.value
let info2 = reactive({}); }
let info3 = reactive({}); })
})
}, {deep: true});
watch(() => props.airData, (now) => { watch(() => props.airData, (now) => {
getAirInfo(now.sensorList) getAirInfo(now.sensorList)
}, {deep: true}); }, {deep: true});
watch(() => props.list, (now, old) => { const changeData = (item) => {
console.log('传感器 ', now, old) return {
now.map(item=>{
getInfo(item)
})
}, {deep: true});
const changeData=(item,flag)=>{
return{
equipmentId: item.equipmentId, equipmentId: item.equipmentId,
icon: changeIcon(item.equipmentType),
name: item.equipmentName.slice(0, 2),
max: 120, max: 120,
value: flag?flag.value:item.value, value: item.value,
point: item.valueThreshold, point: item.valueThreshold,
unit:item.unit unit: item.unit
} }
} }
const getInfo=(item)=>{ const changeIcon = (type) => {
if(item.equipmentId==info.equipmentId){ switch (type) {
// info.value=item.value case "dust":
changeData(item,info1) return 'dust-icon.png';
console.log('info',info) case "oxygen":
}else if(item.equipmentId==info1.equipmentId){ return 'o2-icon.png';
changeData(item,info1) case "temperature":
}else if(item.equipmentId==info2.equipmentId){ return 'tempture-icon.png';
changeData(item,info2) case "humidness":
}else if(item.equipmentId==info3.equipmentId){ return 'water-icon.png';
changeData(item,info3)
} }
} }
const getAirInfo = (now) => { const getAirInfo = (now) => {
let windPressureObj = {}
let windPressureArr = []
now.map(item => { now.map(item => {
if (item.equipmentType === "dust") {//粉尘 if (item.equipmentType === "dust" || item.equipmentType === "oxygen" || item.equipmentType === "temperature" || item.equipmentType === "humidness") {
info3 = changeData(item) windPressureObj = changeData(item)
} else if (item.equipmentType === "oxygen") {//氧气 windPressureArr.push(windPressureObj)
info = changeData(item) }else if(item.equipmentType === "windDirection"){
} else if (item.equipmentType === "temperature") {//温度 windSpeed.value = item.value
info1 = changeData(item)
} else if (item.equipmentType === "humidness") {//湿度
info2 = changeData(item)
} }
}) })
windPressureArr.push(windPressureArr.shift())
airList.value = windPressureArr
} }
</script> </script>

View File

@@ -2,7 +2,6 @@
<div id="item-info"> <div id="item-info">
<div class="label"> <div class="label">
<div :style="{ backgroundImage: 'url(' +getImageUrl(windIcon)+')' }" class="wind-icon"></div> <div :style="{ backgroundImage: 'url(' +getImageUrl(windIcon)+')' }" class="wind-icon"></div>
<!-- <img :src="params.icon" alt="" />-->
<span>{{ params.name }}</span> <span>{{ params.name }}</span>
</div> </div>
<div class="container" ref="length"> <div class="container" ref="length">
@@ -16,8 +15,6 @@
</template> </template>
<script setup> <script setup>
import {onMounted, watch, defineProps, computed} from "vue";
const params = defineProps({ const params = defineProps({
wp: Object, wp: Object,
icon: String, icon: String,
@@ -34,21 +31,19 @@ const windIcon = reactive(params.icon);
const length = ref(null); const length = ref(null);
const value = ref(null); const value = ref(null);
const point = ref(null); const point = ref(null);
// onMounted(handleOnMounted); onMounted(handleOnMounted);
//
// function handleOnMounted() {
// // const = length.value.offsetWidth);
// setValue();
// }
watch(() => params.wp.value, (val) => { function handleOnMounted() {
console.log('xin----', val) setValue();
setValue(value); }
}, {deep: true});
watch(() => params.wp.value, () => {
setValue();
});
const getImageUrl = (name) => { const getImageUrl = (name) => {
return new URL(`../../../../assets/images/airInfo/${name}`, import.meta.url).href return new URL(`../../../../assets/images/airInfo/${name}`, import.meta.url).href
} }
const setValue = (val) => { const setValue = () => {
let width = (params.wp.value * length.value.offsetWidth) / params.wp.max; let width = (params.wp.value * length.value.offsetWidth) / params.wp.max;
value.value.style.width = `${width}px`; value.value.style.width = `${width}px`;
let flag = (params.wp.point * length.value.offsetWidth) / params.wp.max; let flag = (params.wp.point * length.value.offsetWidth) / params.wp.max;
@@ -65,7 +60,7 @@ let isWaring = computed(() => {
return params.wp.value >= params.wp.point; return params.wp.value >= params.wp.point;
}); });
const valueAndUnit = computed(() => params.wp.value + params.unit + ""); const valueAndUnit = computed(() => params.wp.value + " "+ params.unit );
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -2,70 +2,52 @@
<div id="bad-gas-info"> <div id="bad-gas-info">
<div class="title">有害气体</div> <div class="title">有害气体</div>
<div class="info-list"> <div class="info-list">
<gas-info-item :gasInfo="gasInfo" /> <gas-info-item v-for="item in badGasList" :gasInfo="item" />
<gas-info-item :gasInfo="gasInfo2" />
<gas-info-item :gasInfo="gasInfo3" />
<gas-info-item :gasInfo="gasInfo4" />
<gas-info-item :gasInfo="gasInfo5" />
<gas-info-item :gasInfo="gasInfo6" />
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { reactive } from "vue";
import GasInfoItem from "./childComps/GasInfoItem.vue"; import GasInfoItem from "./childComps/GasInfoItem.vue";
const gasInfo = reactive({
name: "一氧化硫", //气体名称
max: 100, //最大值
value: 60, //传感器值
point: 50, //阈值
});
const gasInfo2 = reactive({
name: "一氧化氮", //气体名称
max: 100, //最大值
value: 40, //传感器值
point: 10, //阈值
});
const gasInfo3 = reactive({
name: "一氧化碳", //气体名称
max: 100, //最大值
value: 15, //传感器值
point: 70, //阈值
});
const gasInfo4 = reactive({
name: "二氧化碳", //气体名称
max: 100, //最大值
value: 25, //传感器值
point: 40, //阈值
});
const gasInfo5 = reactive({
name: "硫化氢", //气体名称
max: 100, //最大值
value: 30, //传感器值
point: 20, //阈值
});
const gasInfo6 = reactive({
name: "二氧化硫", //气体名称
max: 100, //最大值
value: 20, //传感器值
point: 20, //阈值
});
const props = defineProps({ const props = defineProps({
list: Array list: Array,
badGasData:Array
}); });
const badGasList=ref([])
watch(() => props.list, (now, old) => { watch(() => props.list, (now, old) => {
console.log('传感器 ', now, old) badGasList.value.forEach(item=>{
// wpList.value=now now.forEach(newItem=>{
if(item.equipmentId === newItem.equipmentId){
item.value = newItem.value
}
})
})
}, {deep: true}); }, {deep: true});
// setInterval(() => {
// gasInfo.value = parseInt(Math.random() * 10) * 10; watch(() => props.badGasData, (now) => {
// gasInfo2.value = parseInt(Math.random() * 10) * 10; getBadGasInfo(now.sensorList)
// gasInfo3.value = parseInt(Math.random() * 10) * 10; }, {deep: true});
// gasInfo4.value = parseInt(Math.random() * 10) * 10; const getBadGasInfo = (now) => {
// gasInfo6.value = parseInt(Math.random() * 10) * 10; let windPressureObj = {}
// gasInfo5.value = parseInt(Math.random() * 10) * 10; let windPressureArr = []
// }, 2000); now.map(item => {
if (item.equipmentType === "carbonDioxide" || item.equipmentType === "carbonMonoxide" || item.equipmentType === "hydrogenSulfide" || item.equipmentType === "sulfurDioxide"|| item.equipmentType === "sulfurMonoxide"|| item.equipmentType === "nitrogenDioxide") {
windPressureObj = changeData(item)
windPressureArr.push(windPressureObj)
}
})
badGasList.value = windPressureArr
}
const changeData = (item) => {
return {
equipmentId: item.equipmentId,
name: item.equipmentName.slice(0, item.equipmentName.length-2),
max: 120,
value: item.value,
point: item.valueThreshold,
unit: item.unit
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -3,7 +3,6 @@
<div class="point" ref="point"> <div class="point" ref="point">
<div class="info" ref="container"></div> <div class="info" ref="container"></div>
</div> </div>
<div class="name">{{ gasInfo.name }}</div> <div class="name">{{ gasInfo.name }}</div>
</div> </div>
</template> </template>

View File

@@ -15,22 +15,26 @@ const props = defineProps({
winData: Array winData: Array
}); });
const wpList = ref([]); const wpList = ref([]);
watch(() => props.list, (now, old) => { watch(() => props.list, (now) => {
now.map(item=>{ wpList.value.forEach(item=>{
item.unit='Pa' now.forEach(newItem=>{
if(item.equipmentId === newItem.equipmentId){
item.value = newItem.value
}
})
}) })
wpList.value = now
}, {deep: true}); }, {deep: true});
watch(() => props.winData, (now) => { watch(() => props.winData, (now) => {
getScreenInfo(now) getScreenInfo(now.windPressureSensorList)
}, {deep: true}); }, {deep: true});
const getScreenInfo = (now) => { const getScreenInfo = (now) => {
let windPressureObj = {} let windPressureObj = {}
let windPressureArr = [] let windPressureArr = []
now.windPressureSensorList.map(item => { now.map(item => {
windPressureObj = { windPressureObj = {
equipmentId:item.equipmentId,
max: 120, max: 120,
value: item.value, value: item.value,
point: item.valueThreshold, point: item.valueThreshold,

View File

@@ -15,8 +15,6 @@
</template> </template>
<script setup> <script setup>
import {reactive, onMounted, watch, defineProps, computed} from "vue";
const params = defineProps({ const params = defineProps({
wp: Object, wp: Object,
index: Number, index: Number,
@@ -27,18 +25,16 @@ const params = defineProps({
// value: 40, //测量值 // value: 40, //测量值
// point: 60, //阈值 // point: 60, //阈值
// }; // };
// const wp = reactive(info);
const length = ref(null); const length = ref(null);
const value = ref(null); const value = ref(null);
const point = ref(null); const point = ref(null);
onMounted(handleOnMounted); onMounted(handleOnMounted);
function handleOnMounted() { function handleOnMounted() {
// const = length.value.offsetWidth);
setValue(); setValue();
} }
watch(() => params.wp.value, (value) => { watch(() => params.wp.value, () => {
setValue(); setValue();
}); });

View File

@@ -37,9 +37,9 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
> >
<wind-pressure-list v-if="showFan" :list="socketData.windPressure" :winData="largeScreenData"/> <wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData"/>
<air-info v-if="showFan" :list="socketData.sensor" :airData="largeScreenData"/> <air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData"/>
<bad-gas-info v-if="showFan" :list="socketData.sensor"/> <bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData"/>
</el-drawer> </el-drawer>
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div> <div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
<div v-else class="shrink-right" @click="closeRight"></div> <div v-else class="shrink-right" @click="closeRight"></div>