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

View File

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

View File

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

View File

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

View File

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

View File

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