new-map
ihzero 2022-11-12 14:08:12 +08:00
parent 2bd2836f07
commit 2648aadd04
6 changed files with 107 additions and 50 deletions

View File

@ -53,7 +53,7 @@
:index="index"
/>
</div>
<div class="write-normal inline-block m-5px">
<div class="write-normal inline-block m-5px" v-if="isJK">
<SBYXZT
v-bind="getBindValue"
headHeight="34.5px"
@ -61,7 +61,7 @@
:height="`${boxHeight}px`"
/>
</div>
<div class="write-normal inline-block m-5px">
<div class="write-normal inline-block m-5px" v-if="isQX">
<QXSZ
headHeight="34.5px"
:width="`${boxWidth}px`"
@ -69,7 +69,7 @@
v-bind="getBindValue"
/>
</div>
<div class="write-normal inline-block m-5px">
<div class="write-normal inline-block m-5px" v-if="isSZ">
<SZJCSJ
headHeight="34.5px"
:width="`${boxWidth}px`"
@ -77,7 +77,7 @@
v-bind="getBindValue"
/>
</div>
<div class="write-normal inline-block m-5px">
<div class="write-normal inline-block m-5px" v-if="isTR">
<TRJCSJ
headHeight="34.5px"
:width="`${boxWidth}px`"
@ -134,6 +134,12 @@
data: ref<any>({}),
})
const cropsList = ref<any[]>([])
const deviceList = ref<any[]>([])
const isJK = 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 isSZ = computed(() => deviceList.value.findIndex((e) => e.type == '水质设备') >= 0)
const modelWidth = computed(
() => (boxWidth + 10) * Math.ceil((cropsList.value.length + 4) / 2) + 60,
@ -142,6 +148,7 @@
async function getData() {
const resData = await getAgriculturalBasicDetails(props.baseId)
cropsList.value = resData.crops
deviceList.value = resData.devices
Data.data = resData
}
const year = computed(() => visualizationStore.getYear)
@ -171,8 +178,13 @@
)
return {
isJK,
isTR,
isQX,
isSZ,
getContainer,
cropsList,
deviceList,
getBindValue,
...toRefs(Data),
boxWidth,

View File

@ -150,15 +150,31 @@
chartAmi()
}
let timer: any = null
function chartAmi() {
let index = 0
let index = 1
const timerNumber = 3000
timer && clearInterval(timer)
let sleep = 1
let type = 'showTip'
let legendIndex = legendData.length
timer = setInterval(() => {
if (legendData.length == 0) return
const currentIndex = index % 4
const legendIndex = index % legendData.length
const sleep = index % (legendData.length * 2)
if (legendIndex == 0 && sleep != 0) {
const currentIndex = (index - 1) % 4
sleep = index % (4 * 2)
getInstance()?.dispatchAction({
type: type,
seriesIndex: 0,
dataIndex: currentIndex,
})
// console.log('currentIndex', currentIndex)
// console.log('legendIndex', legendIndex)
// console.log('sleep', sleep)
// console.log('index', index)
if (type == 'hideTip' && currentIndex == 0) {
legendData.forEach((_, index) => {
getInstance()?.dispatchAction({
type: 'legendUnSelect',
@ -166,20 +182,21 @@
})
})
}
if (type == 'hideTip') {
getInstance()?.dispatchAction({
type: 'legendSelect',
name: legendData[legendIndex - 1],
})
if (legendIndex == 0) getData()
legendIndex--
}
getInstance()?.dispatchAction({
type: 'legendSelect',
name: legendData[legendIndex],
})
// getInstance()?.dispatchAction({
// type: 'showTip',
// seriesIndex: 0,
// dataIndex: currentIndex,
// })
if (sleep == 0) {
type = 'hideTip'
}
index++
}, 3000)
}, timerNumber)
}
async function getData() {
@ -193,7 +210,7 @@
getData()
rootEmitter.on('interval:auto', () => {
getData()
// getData()
})
})

View File

@ -131,15 +131,37 @@
let timer: any = null
function chartAmi() {
let index = 0
const timerNumber = 3000
let sleep = 1
timer && clearInterval(timer)
timer = setInterval(() => {
console.log(legendData)
if (legendData.length == 0) return
const currentIndex = index % 4
const legendIndex = index % legendData.length
const sleep = index % (legendData.length * 2)
if (legendIndex == 0 && sleep != 0) {
sleep = index % (4 * 2)
getInstance()?.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex,
})
if (sleep == 7) {
chartLineAmi()
}
index++
}, timerNumber)
}
function chartLineAmi() {
const timerNumber = 3000
timer && clearInterval(timer)
let legendIndex = legendData.length
let sleep = 6000 / 3000
timer = setInterval(() => {
getInstance()?.dispatchAction({
type: 'hideTip',
})
if (legendIndex == legendData.length) {
legendData.forEach((_, index) => {
getInstance()?.dispatchAction({
type: 'legendUnSelect',
@ -147,26 +169,25 @@
})
})
}
getInstance()?.dispatchAction({
type: 'legendSelect',
name: legendData[legendIndex],
})
// getInstance()?.dispatchAction({
// type: 'showTip',
// seriesIndex: 0,
// dataIndex: currentIndex,
// })
index++
}, 3000)
if (legendIndex >= 0) {
getInstance()?.dispatchAction({
type: 'legendSelect',
name: legendData[legendIndex - 1],
})
}
if (legendIndex <= 0) {
if (sleep <= 0) getData()
sleep--
}
legendIndex--
}, timerNumber)
}
onBeforeMount(() => {
getData()
rootEmitter.on('interval:auto', () => {
getData()
// getData()
})
})

View File

@ -95,7 +95,7 @@
}
function DisabledDate(e: Dayjs) {
return currentYear <= e.year()
return currentYear < e.year()
}
function onChange(e) {

View File

@ -137,19 +137,26 @@
}
async function getTabs() {
const resData = await getAgriculturalBasic({
let resData = await getAgriculturalBasic({
parent_id: visualizationStore.getAddresId,
type: 1,
})
Data.tabList = resData
if (!isBase.value) {
Data.tabList = [{ id: -99, name: '全部' }].concat(resData)
} else {
Data.tabList = resData
}
let defaultId = ''
if (resData.length) defaultId = resData[0].id
if (resData.length) defaultId = Data.tabList[0].id
onMenuClick({ key: defaultId })
}
async function getData() {
const resData = await getDevicesNum({
base_id: props.baseId ?? Data.currentTab,
base_id: props.baseId ?? (Data.currentTab == -99 ? null : Data.currentTab),
})
Object.keys(resData).map((e, index) => {
Data.list[index].value = resData[e].slice(1)

View File

@ -1,6 +1,6 @@
<template>
<!-- <ScaleScreen :boxStyle="{ background: '#020603' }" :width="3120" :height="760" :autoScale="false"> -->
<div class="overflow-y-scroll">
<ScaleScreen :boxStyle="{ background: '#020603' }" :width="3120" :height="760" :autoScale="true">
<!-- <div class="overflow-y-scroll"> -->
<div class="flex flex-col h-full bg-img relative w-3120px h-760px">
<canvas
class="absolute left-0 top-0 w-full h-full overflow-hidden"
@ -51,8 +51,8 @@
:baseId="baseId"
:baseData="baseData"
/>
</div>
<!-- </ScaleScreen> -->
<!-- </div> -->
</ScaleScreen>
</template>
<script lang="ts">