From 9ec4a8676cf038835430abe8439200a9765cd747 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Mon, 21 Oct 2024 09:09:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/echarts/color.ts | 14 ++------------ src/utils/echartMethod.ts | 11 +++-------- src/utils/tableStore.ts | 2 ++ src/views/govern/analyze/DVR/index.vue | 1 + src/views/govern/device/control/detail.vue | 11 ++++++++--- .../device/planData/components/schemeTree.vue | 15 ++++++++------- src/views/govern/device/planData/index.vue | 14 +++++++++----- 7 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/components/echarts/color.ts b/src/components/echarts/color.ts index 00fb0e2..a3d2211 100644 --- a/src/components/echarts/color.ts +++ b/src/components/echarts/color.ts @@ -1,14 +1,4 @@ -export let color = [ - '#07CCCA', - '#00BFF5', - '#FFBF00', - '#77DA63', - '#D5FF6B', - '#Ff6600', - '#FF9100', - '#5B6E96', - '#66FFCC', - '#B3B3B3' -] +export let color = [ '#07CCCA','#00BFF5', '#FFBF00', '#77DA63', '#D5FF6B', '#Ff6600', '#FF9100', '#5B6E96', '#66FFCC', '#B3B3B3'] export const gradeColor3 = ['#339966', '#FFCC33', '#CC0000'] export const gradeColor5 = ['#00CC00', '#99CC99', '#FF9900','#996600','#CC0000'] + diff --git a/src/utils/echartMethod.ts b/src/utils/echartMethod.ts index b1e01a1..710ee6f 100644 --- a/src/utils/echartMethod.ts +++ b/src/utils/echartMethod.ts @@ -1,20 +1,16 @@ -import { install$2 } from 'echarts/types/dist/shared' - export const yMethod = (arr: any) => { - let interval = 0 let maxValue = 0 let minValue = 0 let max = 0 let min = 0 maxValue = Math.max(...arr) minValue = Math.min(...arr) - - if (maxValue > 1000) { + if (maxValue > 1000 ||minValue < -1000) { max = Math.ceil(maxValue / 100) * 100 if (minValue == 0) { min = 0 } else { - min = (Math.floor(minValue / 100) - 1) * 100 + min = (Math.floor(minValue / 100) ) * 100 } } else { max = Math.ceil(maxValue / 10) * 10 @@ -26,6 +22,5 @@ export const yMethod = (arr: any) => { } else if (max == 0 && minValue > -1 && minValue < 0) { min = -1 } - - return [min, max, interval] + return [min, max] } diff --git a/src/utils/tableStore.ts b/src/utils/tableStore.ts index 31100ae..e3fc295 100644 --- a/src/utils/tableStore.ts +++ b/src/utils/tableStore.ts @@ -95,6 +95,8 @@ export default class TableStore { } this.table.loadCallback && this.table.loadCallback() this.table.loading = false + }).catch(() => { + this.table.loading = false }) } diff --git a/src/views/govern/analyze/DVR/index.vue b/src/views/govern/analyze/DVR/index.vue index 16c6ded..d045665 100644 --- a/src/views/govern/analyze/DVR/index.vue +++ b/src/views/govern/analyze/DVR/index.vue @@ -141,6 +141,7 @@ const tableStore = new TableStore({ tableStore.table.params.type = 0 provide('tableStore', tableStore) const nodeClick = async (e: anyObj) => { + console.log("🚀 ~ nodeClick ~ e:", e) if (e.level == 2) { loading.value = false tableStore.table.params.deviceId = e.id diff --git a/src/views/govern/device/control/detail.vue b/src/views/govern/device/control/detail.vue index b57785e..813c4e9 100644 --- a/src/views/govern/device/control/detail.vue +++ b/src/views/govern/device/control/detail.vue @@ -5,7 +5,7 @@ @@ -121,7 +121,9 @@ const init = () => { }) let [min, max] = yMethod(arr.map((item: any) => item.statisticalData.toFixed(2))) echartsData.value = { + options: { + grid: { top: '50px', left: '10px', @@ -157,6 +159,9 @@ const init = () => { } }) }, + title: { + text: props.detail.name?.split('(')[0], + }, tooltip: { axisPointer: { type: 'cross', @@ -189,7 +194,7 @@ const init = () => { min: min, max: max, // interval:interval, - + // min: 134, // max: 500, // min: Math.ceil( @@ -219,7 +224,7 @@ const init = () => { // return a - b // })[0] // )) / 5, - + }, diff --git a/src/views/govern/device/planData/components/schemeTree.vue b/src/views/govern/device/planData/components/schemeTree.vue index cb61af6..8e8dab4 100644 --- a/src/views/govern/device/planData/components/schemeTree.vue +++ b/src/views/govern/device/planData/components/schemeTree.vue @@ -27,7 +27,7 @@ {{ node.label }}
- + @@ -142,10 +142,11 @@ const treeData = ref({}) const getTreeList = () => { getSchemeTree().then(res => { let arr: any[] = [] + res.data.forEach((item: any) => { item.icon = 'el-icon-Menu' item.color = config.getColorVal('elementUiPrimary') - item.children.forEach((item2: any) => { + item?.children.forEach((item2: any) => { item2.icon = 'el-icon-Document' item2.color = config.getColorVal('elementUiPrimary') arr.push(item2) @@ -156,7 +157,7 @@ const getTreeList = () => { if (arr.length) { treRef.value.setCurrentKey(id.value || arr[0].id) - let list= id.value ? arr.find((item: any) => item.id == id.value) : arr[0] + let list = id.value ? arr.find((item: any) => item.id == id.value) : arr[0] // 注册父组件事件 emit('init', { level: 2, @@ -188,7 +189,7 @@ const getPlanData = (row: any) => { const add = (node: any, data: any) => { planId.value = data.id //添加测试项 - if (data.children) { + if (data?.children) { dialogRef.value.detailsType("tree") handleOpen(2, planId.value) } @@ -199,7 +200,7 @@ const edit = async (node: Node, data: any) => { await getTestRecordInfo(planId.value) .then(res => { //修改方案 - if (data.children) { + if (data?.children) { dialogRef.value.detailsType("") dialogRef.value.details(res.data) handleOpen(1, planId.value) @@ -241,14 +242,14 @@ const del = (node: Node, data: any) => { //取消删除 const cancelDel = () => { } const clickNode = (e: anyObj) => { - e.children ? (planId.value = e.id) : (planId.value = e.pid) + e?.children ? (planId.value = e.id) : (planId.value = e.pid) id.value = e.id emit('nodeChange', e) } const setCheckedNode = (e: anyObj) => { console.log("🚀 ~ setCheckedNode ~ e:", e) - id.value=e + id.value = e treRef.value.setCurrentKey(e) } watch( diff --git a/src/views/govern/device/planData/index.vue b/src/views/govern/device/planData/index.vue index f62cb9d..2166cad 100644 --- a/src/views/govern/device/planData/index.vue +++ b/src/views/govern/device/planData/index.vue @@ -248,15 +248,18 @@ const handleClickTabs = async () => { historyDevId.value = activeName.value schemeTreeRef.value.setCheckedNode(activeName.value) setTimeout(() => { - init(true) + init(true) }, 100); } const nodeClick = async (e: anyObj) => { - console.log("🚀 ~ nodeClick ~ e:", e) - loading.value = true + if (e == undefined) { + return + } + console.log(123); + deviceData.value = [] - historyDevId.value = e.children && e.children.length != 0 ? e.children[0].id : e.id - let id = e.pid ? e.pid : e.id + historyDevId.value = e?.children && e?.children.length != 0 ? e?.children[0].id : e?.id + let id = e?.pid ? e?.pid : e?.id //查询测试项信息 await getTestRecordInfo(id) @@ -277,6 +280,7 @@ const nodeClick = async (e: anyObj) => { schemeTreeRef.value.getPlanData(deviceData.value) await setTimeout(() => { + loading.value = true init(true) }, 100);