diff --git a/src/views/visualization/MapModal.vue b/src/views/visualization/MapModal.vue index 401289cd..3d4d599c 100644 --- a/src/views/visualization/MapModal.vue +++ b/src/views/visualization/MapModal.vue @@ -53,7 +53,7 @@ :index="index" /> -
+
-
+
-
+
-
+
({}), }) const cropsList = ref([]) + const deviceList = ref([]) + + 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, diff --git a/src/views/visualization/components/DXJG.vue b/src/views/visualization/components/DXJG.vue index 974a4548..109b5266 100644 --- a/src/views/visualization/components/DXJG.vue +++ b/src/views/visualization/components/DXJG.vue @@ -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() }) }) diff --git a/src/views/visualization/components/DXLX.vue b/src/views/visualization/components/DXLX.vue index 18e2c678..ae444af1 100644 --- a/src/views/visualization/components/DXLX.vue +++ b/src/views/visualization/components/DXLX.vue @@ -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() }) }) diff --git a/src/views/visualization/components/Head.vue b/src/views/visualization/components/Head.vue index e4e4f2d5..b24e1f6a 100644 --- a/src/views/visualization/components/Head.vue +++ b/src/views/visualization/components/Head.vue @@ -95,7 +95,7 @@ } function DisabledDate(e: Dayjs) { - return currentYear <= e.year() + return currentYear < e.year() } function onChange(e) { diff --git a/src/views/visualization/components/SBYXZT.vue b/src/views/visualization/components/SBYXZT.vue index ae55edae..46794aca 100644 --- a/src/views/visualization/components/SBYXZT.vue +++ b/src/views/visualization/components/SBYXZT.vue @@ -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) diff --git a/src/views/visualization/index.vue b/src/views/visualization/index.vue index 75bd181b..a8367b26 100644 --- a/src/views/visualization/index.vue +++ b/src/views/visualization/index.vue @@ -1,6 +1,6 @@