基地监控

new-map
ihzero 2022-12-15 10:33:05 +08:00
parent d237bde3b4
commit 4705f47087
2 changed files with 41 additions and 14 deletions

View File

@ -53,7 +53,7 @@
:index="index" :index="index"
/> />
</div> </div>
<div class="write-normal inline-block m-5px" v-if="isJK"> <div class="write-normal inline-block m-5px" v-if="isSB">
<SBYXZT <SBYXZT
v-bind="getBindValue" v-bind="getBindValue"
headHeight="34.5px" headHeight="34.5px"
@ -85,6 +85,14 @@
v-bind="getBindValue" v-bind="getBindValue"
/> />
</div> </div>
<div class="write-normal inline-block m-5px" v-if="isJK">
<JK
headHeight="34.5px"
:width="`${boxWidth}px`"
:height="`${boxHeight}px`"
v-bind="getBindValue"
/>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -99,6 +107,7 @@
import QXSZ from './components/QXSZ.vue' import QXSZ from './components/QXSZ.vue'
import SZJCSJ from './components/SZJCSJ.vue' import SZJCSJ from './components/SZJCSJ.vue'
import TRJCSJ from './components/TRJCSJ.vue' import TRJCSJ from './components/TRJCSJ.vue'
import JK from './components/JK.vue'
import BasicChart from './components/BasicChart.vue' import BasicChart from './components/BasicChart.vue'
import { useVisualizationStore } from '/@/store/modules/visualization' import { useVisualizationStore } from '/@/store/modules/visualization'
import { getAgriculturalBasicDetails } from '/@/api/sys/other' import { getAgriculturalBasicDetails } from '/@/api/sys/other'
@ -111,6 +120,7 @@
QXSZ, QXSZ,
SZJCSJ, SZJCSJ,
TRJCSJ, TRJCSJ,
JK,
BasicChart, BasicChart,
}, },
props: { props: {
@ -136,10 +146,13 @@
const cropsList = ref<any[]>([]) const cropsList = ref<any[]>([])
const deviceList = ref<any[]>([]) const deviceList = ref<any[]>([])
const isJK = computed(() => deviceList.value.findIndex((e) => e.type == '监控设备') >= 0) const isJK = computed(
() => deviceList.value.findIndex((e) => e.type == '监控设备' && e.is_recommend == 1) >= 0,
)
const isTR = computed(() => deviceList.value.findIndex((e) => e.type == '土壤设备') >= 0) const isTR = computed(() => deviceList.value.findIndex((e) => e.type == '土壤设备') >= 0)
const isQX = computed(() => deviceList.value.findIndex((e) => e.type == '气象设备') >= 0) const isQX = computed(() => deviceList.value.findIndex((e) => e.type == '气象设备') >= 0)
const isSZ = computed(() => deviceList.value.findIndex((e) => e.type == '水质设备') >= 0) const isSZ = computed(() => deviceList.value.findIndex((e) => e.type == '水质设备') >= 0)
const isSB = computed(() => deviceList.value.length)
const modelWidth = computed( const modelWidth = computed(
() => (boxWidth + 10) * Math.ceil((cropsList.value.length + 4) / 2) + 60, () => (boxWidth + 10) * Math.ceil((cropsList.value.length + 4) / 2) + 60,
@ -149,6 +162,8 @@
const resData = await getAgriculturalBasicDetails(props.baseId) const resData = await getAgriculturalBasicDetails(props.baseId)
cropsList.value = resData.crops cropsList.value = resData.crops
deviceList.value = resData.devices deviceList.value = resData.devices
console.log(resData.devices)
Data.data = resData Data.data = resData
} }
const year = computed(() => visualizationStore.getYear) const year = computed(() => visualizationStore.getYear)
@ -184,6 +199,7 @@
isTR, isTR,
isQX, isQX,
isSZ, isSZ,
isSB,
getContainer, getContainer,
cropsList, cropsList,
deviceList, deviceList,

View File

@ -1,7 +1,7 @@
<template> <template>
<Box title="监控"> <Box title="监控">
<div class="h-full flex flex-col"> <div class="h-full flex flex-col">
<div class="py-10px relative"> <div class="py-10px relative" v-if="!isBase">
<div <div
class="text-center bg-clip-text text-transparent bg-gradient-to-t from-[#76E9F0] to-[#A7E6EE] text-14px font-bold" class="text-center bg-clip-text text-transparent bg-gradient-to-t from-[#76E9F0] to-[#A7E6EE] text-14px font-bold"
> >
@ -31,16 +31,18 @@
</Dropdown> </Dropdown>
</div> </div>
</div> </div>
<div class="flex-1 px-11px flex flex-col"> <div class="flex-1 px-11px flex flex-col py-10px box-content" :class="{ 'pt-0': !isBase }">
<div class="flex-1"> <div class="flex-1">
<VideoFlv <div class="bg-light-600 h-full" :class="{ 'h-140px': isBase }">
class="cursor-pointer" <VideoFlv
v-if="currentVido" class="cursor-pointer"
:url="currentVido.url" v-if="currentVido"
:name="currentVido.base_name" :url="currentVido.url"
/> :name="currentVido.base_name"
/>
</div>
</div> </div>
<div class="grid grid-cols-3 gap-x-6px my-10px"> <div class="grid grid-cols-3 gap-x-6px pt-10px">
<div class="h-66px" v-for="item in list" :key="item.id"> <div class="h-66px" v-for="item in list" :key="item.id">
<VideoFlv <VideoFlv
class="cursor-pointer" class="cursor-pointer"
@ -82,7 +84,10 @@
MenuItem: Menu.Item, MenuItem: Menu.Item,
VideoFlv, VideoFlv,
}, },
setup() { props: ['baseId'],
setup(props) {
console.log('===JK')
console.log(props.baseId)
const Data = reactive({ const Data = reactive({
tabList: ref<any>([]), tabList: ref<any>([]),
currentTab: ref<number | string>(''), currentTab: ref<number | string>(''),
@ -115,7 +120,7 @@
async function getData() { async function getData() {
const { ip, port } = await getffmpegip() const { ip, port } = await getffmpegip()
const resData = await getDevices({ const resData = await getDevices({
base: Data.currentTab, base_id: props.baseId ?? Data.currentTab,
type: 1, type: 1,
status: 1, status: 1,
is_recommend: 1, is_recommend: 1,
@ -140,12 +145,18 @@
if (currentVido.value.url == e.url) return if (currentVido.value.url == e.url) return
currentVido.value = e currentVido.value = e
} }
const isBase = computed(() => !!props.baseId)
onBeforeMount(() => { onBeforeMount(() => {
getTabs() if (isBase.value) {
getData()
} else {
getTabs()
}
}) })
return { return {
isBase,
onChangeVideo, onChangeVideo,
currentVido, currentVido,
...toRefs(Data), ...toRefs(Data),