This commit is contained in:
weipengfei 2024-02-21 18:07:33 +08:00
parent 493ad1d66c
commit d76f29a5a2
8 changed files with 162 additions and 39 deletions

View File

@ -39,4 +39,14 @@ export const getFarmDeviceAlarmCount = (data) => {
// 具体基地设备警告 // 具体基地设备警告
export const getFarmInfo = (data) => { export const getFarmInfo = (data) => {
return axios.get('dataview.farm/farmInfo', { params: data }); return axios.get('dataview.farm/farmInfo', { params: data });
}
// 硬件产品
export const getDeviceDesc = (data) => {
return axios.get('dataview.device/deviceDesc', { params: data });
}
// 智能监测数据
export const getAlarmRangeList = (data) => {
return axios.get('dataview.farm/alarmRangeList', { params: data });
} }

View File

@ -542,10 +542,17 @@ onMounted(() => {
if (route.query.name) { if (route.query.name) {
filterMap() filterMap()
} }
dataValue = props.list; // dataValue = props.list;
dataValue[0] = { // dataValue[0] = {
name: '福集镇养殖基地', // name: '',
value: [105.36, 29.20] // value: [105.36, 29.20]
// }
if(route.query.local){
dataValue[0] = {
name: route.query.farm_name,
value: route.query.local.split(',')
};
console.log(dataValue);
} }
// changeType('luxian'); // changeType('luxian');
mapInfo(); mapInfo();
@ -571,6 +578,7 @@ onMounted(() => {
<div class="map-e"> <div class="map-e">
<div class="echarts" ref="echartsRef"></div> <div class="echarts" ref="echartsRef"></div>
</div> </div>
<div class="map-t">{{ route.query.farm_name }}</div>
</div> </div>
</template> </template>
@ -607,5 +615,13 @@ onMounted(() => {
height: 100%; height: 100%;
} }
} }
.map-t{
position: absolute;
top: 2rem;
left: 2rem;
color: #fff;
font-family: 'ifonts';
font-size: 1.4rem;
}
} }
</style> </style>

View File

@ -1,10 +1,26 @@
<script setup> <script setup>
import { ref, reactive, onMounted } from "vue" import { ref, reactive, onMounted } from "vue"
import { getAlarmRangeList } from "@/api/api.js"
import rightCard from "./rightCard.vue" import rightCard from "./rightCard.vue"
import { useAppStore } from "@/store/app.js";
import { useRoute } from "vue-router";
const appStore = useAppStore();
const route = useRoute();
const dataList = ref([]);
const initAlarmRangeList = ()=>{
getAlarmRangeList({
areaCode: appStore.address.areaCode,
streetCode: appStore.address.streetCode,
id: route.query.id
}).then(res=>{
dataList.value = res.data;
})
}
onMounted(() => { onMounted(() => {
initAlarmRangeList()
}) })
</script> </script>
@ -18,8 +34,9 @@ onMounted(() => {
<div class="c-box"> <div class="c-box">
<rightCard <rightCard
class="box-card" class="box-card"
v-for="(item, index) in 6" v-for="(item, index) in dataList"
:key="index" :key="index"
:info="item"
></rightCard> ></rightCard>
</div> </div>
</div> </div>

View File

@ -2,13 +2,38 @@
import { ref, reactive, onMounted } from "vue" import { ref, reactive, onMounted } from "vue"
import * as echarts from "echarts" import * as echarts from "echarts"
const props = defineProps({
info: {
type: Object,
default: ()=>{}
}
})
function getRecentSevenDays() {
const dates = [];
for (let i = 6; i >= 0; i--) {
const date = new Date();
date.setDate(date.getDate() - i);
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
const formattedDate = month + '-' + day;
dates.push(formattedDate);
}
return dates;
}
const chartsRef = ref(null) const chartsRef = ref(null)
const initMap = () => { const initMap = () => {
const charts = echarts.init(chartsRef.value); const charts = echarts.init(chartsRef.value);
let option = { let option = {
title: { title: {
show: true, show: true,
text: '甲烷', text: props.info.name,
top: "10%", top: "10%",
left: "12%", left: "12%",
textStyle: { textStyle: {
@ -62,7 +87,7 @@ const initMap = () => {
color: '#fff', color: '#fff',
}, },
}, },
data: ['12.01', '12.02', '12.03', '12.04', '12.05', '12.06', '12.07'], data: getRecentSevenDays(),
}, },
], ],
yAxis: [ yAxis: [
@ -91,7 +116,7 @@ const initMap = () => {
], ],
series: [ series: [
{ {
name: '工厂1', name: '线',
type: 'line', type: 'line',
smooth: true, smooth: true,
// showSymbol: false,/ // showSymbol: false,/
@ -124,7 +149,7 @@ const initMap = () => {
shadowBlur: 10, shadowBlur: 10,
}, },
}, },
data: [100, 138, 350, 173, 180, 150, 180], data: props.info.RangeMonitorData,
}, },
], ],
} }
@ -140,8 +165,8 @@ onMounted(() => {
<div class="c-card"> <div class="c-card">
<div class="left"> <div class="left">
<div>监测正常</div> <div>监测正常</div>
<img src="/src/assets/img/icon.png" /> <img :src="info.image||'/src/assets/img/icon.png'" />
<div>甲烷监测设备</div> <div>{{ info.name }}</div>
</div> </div>
<div class="right" ref="chartsRef"></div> <div class="right" ref="chartsRef"></div>
</div> </div>
@ -155,6 +180,7 @@ onMounted(() => {
justify-content: space-evenly; justify-content: space-evenly;
.left { .left {
height: 100%; height: 100%;
width: 6rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;

View File

@ -4,22 +4,25 @@ import leftItme from "./components/left.vue";
import centerItme from "./components/center.vue"; import centerItme from "./components/center.vue";
import bottomItme from "./components/bottom.vue"; import bottomItme from "./components/bottom.vue";
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { ref } from "vue";
const route = useRoute(); const route = useRoute();
const key = ref(Date.now());
</script> </script>
<template> <template>
<div class="center"> <div class="center">
<div class="item item_c"> <div class="item item_c">
<div style="height: 61%; display: flex; justify-content: space-between"> <div style="height: 61%; display: flex; justify-content: space-between">
<leftItme :key="route.query.name" style="width: 35%"></leftItme> <leftItme :key="route.query.name+key" style="width: 35%"></leftItme>
<centerItme :key="route.query.name" style="width: 64%"></centerItme> <centerItme :key="route.query.name+key" style="width: 64%"></centerItme>
</div> </div>
<div style="height: 36%"> <div style="height: 36%">
<bottomItme :key="route.query.name" style="width: 100%"></bottomItme> <bottomItme :key="route.query.name+key" style="width: 100%"></bottomItme>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<rightItme :key="route.query.name" style="height: 98%"></rightItme> <rightItme :key="route.query.name+key" style="height: 98%"></rightItme>
</div> </div>
</div> </div>
</template> </template>

View File

@ -266,7 +266,7 @@ onMounted(() => {
<div class="tab-item"> <div class="tab-item">
<img src="/src/assets/index_img/icon1.png" /> <img src="/src/assets/index_img/icon1.png" />
<div>养殖规模</div> <div>养殖规模</div>
<div class="count">{{ farmInfo.totalScale }}</div> <div class="count">{{ farmInfo.totalScale }}</div>
</div> </div>
</div> </div>
<dv-scroll-board <dv-scroll-board
@ -284,36 +284,44 @@ onMounted(() => {
<div class="left"> <div class="left">
<!-- <img src="/src/assets/index_img/video.png" /> --> <!-- <img src="/src/assets/index_img/video.png" /> -->
<videoFlv <videoFlv
v-if="farmList[0]?.video_url"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
:url="farmList[0].video_url||''" :url="farmList[0].video_url||''"
/> />
<div class="title">{{ farmList[0].farm_name }}</div> <div v-else style="width: 100%; height: 100%; background-color: #0c1122;"></div>
<div class="title">{{ farmList[0]?.farm_name || "" }}</div>
</div> </div>
<div class="right"> <div class="right">
<div class="item"> <div class="item">
<videoFlv <videoFlv
v-if="farmList[1]?.video_url"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
:url="farmList[1].video_url||''" :url="farmList[1].video_url||''"
/> />
<div class="title">{{ farmList[1].farm_name }}</div> <div v-else style="width: 100%; height: 100%; background-color: #0c1122;"></div>
<div class="title">{{ farmList[1]?.farm_name || "" }}</div>
</div> </div>
<div class="item"> <div class="item">
<videoFlv <videoFlv
v-if="farmList[2]?.video_url"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
:url="farmList[2].video_url||''" :url="farmList[2].video_url||''"
/> />
<div class="title">{{ farmList[2].farm_name }}</div> <div v-else style="width: 100%; height: 100%; background-color: #0c1122;"></div>
<div class="title">{{ farmList[2]?.farm_name || "" }}</div>
</div> </div>
<div class="item"> <div class="item">
<videoFlv <videoFlv
v-if="farmList[3]?.video_url"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
:url="farmList[3].video_url||''" :url="farmList[3].video_url||''"
/> />
<div class="title">{{ farmList[3].farm_name }}</div> <div v-else style="width: 100%; height: 100%; background-color: #0c1122;"></div>
<div class="title">{{ farmList[3]?.farm_name || "" }}</div>
</div> </div>
<div class="item"> <div class="item">
<img src="/src/assets/index_img/video.png" /> <!-- <img src="/src/assets/index_img/video.png" /> -->
<!-- <div class="title">泸县原生态养殖基地</div> --> <div style="width: 100%; height: 100%; background-color: #0c1122;"></div>
<div class="btn" @click="show = true">查看全部</div> <div class="btn" @click="show = true">查看全部</div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,9 @@
<script setup> <script setup>
import { ref, reactive, onMounted } from "vue" import { ref, reactive, onMounted } from "vue";
import { getDeviceDesc } from "@/api/api.js";
import { useAppStore } from "@/store/app.js";
const appStore = useAppStore();
const dataList = ref([ const dataList = ref([
{ {
@ -28,8 +32,18 @@ const dataList = ref([
}, },
]) ])
onMounted(() => { const hardwareList = ref([])
const initDeviceDesc = ()=>{
getDeviceDesc({
areaCode: appStore.address.areaCode,
streetCode: appStore.address.streetCode
}).then(res=>{
hardwareList.value = res.data;
})
}
onMounted(() => {
initDeviceDesc();
}) })
</script> </script>
@ -41,13 +55,13 @@ onMounted(() => {
<div class="bg"></div> <div class="bg"></div>
</div> </div>
<div class="c-box"> <div class="c-box">
<div class="c-item" v-for="(item, index) in 6" :key="index"> <div class="c-item" v-for="(item, index) in hardwareList" :key="index">
<div class="name"> <div class="name">
<img src="/src/assets/index_img/icon2.png" /> <img :src="item.icon" />
<div>4G中转站</div> <div>{{item.name}}</div>
</div> </div>
<div class="tip"> <div class="tip">
主要功能详细介绍,主要功能详细介绍,主要功能详细介绍,主要功能详细介绍,主要功能详细介绍,主要功能详细介绍,主要功能详细介绍,主要功能详细介绍, {{ item.desc }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,9 +1,10 @@
<script setup> <script setup>
import { onMounted, reactive, ref, inject, nextTick } from "vue"; import { onMounted, reactive, ref, inject, nextTick, onUpdated } from "vue";
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import ani from "@/components/ani.vue"; import ani from "@/components/ani.vue";
import mitt from "@/utils/mitt"; import mitt from "@/utils/mitt";
import { getfarmCount } from "@/api/api.js";
import luxian from "@/assets/json/luxian.json"; import luxian from "@/assets/json/luxian.json";
import hejiang from "@/assets/json/hejiang.json"; import hejiang from "@/assets/json/hejiang.json";
import xuyong from "@/assets/json/xuyong.json"; import xuyong from "@/assets/json/xuyong.json";
@ -491,13 +492,16 @@ const initMap = () => {
chart.on('click', function (params) { chart.on('click', function (params) {
if (params.seriesType === 'scatter') { if (params.seriesType === 'scatter') {
// //
console.log('点击了', params.data.name); console.log('点击了', params.data);
router.push({ router.push({
path: '/delivery', path: '/delivery',
query: { query: {
areaCode: route.query.areaCode, areaCode: route.query.areaCode,
streetCode: route.query.streetCode, streetCode: route.query.streetCode,
name: route.query.name name: route.query.name,
id: params.data.id,
farm_name: params.data.name,
local: params.data.value.join(',')
} }
}) })
} }
@ -546,17 +550,41 @@ const filterMap = () => {
}) })
} }
const initFarmCount = ()=>{
getfarmCount({
areaCode: appStore.address.areaCode,
streetCode: appStore.address.streetCode
}).then((res)=>{
res.data.farmList.forEach(item=>{
if(item.longitude && item.latitude) dataValue.push({
id: item.id,
name: item.farm_name,
value: [item.longitude, item.latitude]
})
})
nextTick(() => {
mapInfo();
initDataValue();
initMap();
})
})
}
onMounted(() => { onMounted(() => {
if (route.query.name) { if (route.query.name) {
filterMap() filterMap()
} }
dataValue = props.list; // dataValue = props.list;
dataValue[0] = { // dataValue[0] = {
name: '福集镇养殖基地', // name: '',
value: [105.36, 29.20] // value: [105.36, 29.20]
} // }
// changeType('luxian');
initFarmCount()
mapInfo(); mapInfo();
initDataValue(); initDataValue();
initMap(); initMap();
@ -568,6 +596,7 @@ onMounted(() => {
initMap(); initMap();
}) })
}) })
}) })
</script> </script>