diff --git a/src/views/govern/device/planData/index.vue b/src/views/govern/device/planData/index.vue
index 2166cad..ca1730e 100644
--- a/src/views/govern/device/planData/index.vue
+++ b/src/views/govern/device/planData/index.vue
@@ -6,7 +6,6 @@
新增方案
- 数据导出
{{ deviceData.itemName }}
@@ -21,9 +20,13 @@
-
-
+
+
@@ -90,6 +93,116 @@
+
@@ -97,66 +210,7 @@
-
-
-
- 历史趋势
-
@@ -243,46 +297,54 @@ const schemeTreeRef = ref()
const historyDevId: any = ref('')
const chartTitle: any = ref('')
//点击测试项切换树节点
-const handleClickTabs = async () => {
+const handleClickTabs = () => {
searchForm.value.index = [indexOptions.value[0].id]
historyDevId.value = activeName.value
schemeTreeRef.value.setCheckedNode(activeName.value)
setTimeout(() => {
init(true)
- }, 100);
+ }, 100)
}
const nodeClick = async (e: anyObj) => {
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
+ let id = e.pid ? e.pid : e.id
//查询测试项信息
await getTestRecordInfo(id)
- .then(async (res) => {
+ .then(async res => {
deviceData.value = res.data
+ console.log(deviceData.value, '.......')
if (res.data.records.length == 1) {
activeName.value = res.data.records[0].id
} else {
- res.data.records.map((item: any) => {
+ res.data.records.map((item: any, index: any) => {
//多层
if (item.id == e.id) {
activeName.value = item.id
return
+ } else {
+ activeName.value = res.data.records[0].id
+ return
}
})
}
+ console.log(activeName.value, '7777777777777')
searchForm.value.index = [indexOptions.value[0].id]
schemeTreeRef.value.getPlanData(deviceData.value)
await setTimeout(() => {
loading.value = true
- init(true)
- }, 100);
+ if (e.pid) {
+ init(true)
+ } else {
+ init(false)
+ }
+ }, 100)
loading.value = false
})
@@ -395,14 +457,14 @@ const init = (flag: boolean) => {
let unitList: any = []
let groupedData = chartsList.reduce((acc, item) => {
- let key = item.anotherName;
+ let key = item.anotherName
if (!acc[key]) {
- acc[key] = [];
+ acc[key] = []
}
- acc[key].push(item);
- return acc;
+ acc[key].push(item)
+ return acc
}, {})
- let result = Object.values(groupedData);
+ let result = Object.values(groupedData)
if (chartsList.length > 0) {
unitList = result.map((item: any) => {
return item[0].unit
@@ -411,7 +473,6 @@ const init = (flag: boolean) => {
echartsData.value = {
legend: {
-
itemWidth: 20,
itemHeight: 10,
itemGap: 15,
@@ -439,13 +500,15 @@ const init = (flag: boolean) => {
backgroundColor: 'rgba(0,0,0,0.35)',
borderWidth: 0,
formatter(params) {
- const xname = params[0].value[0];
- let str = `${xname}
`;
+ const xname = params[0].value[0]
+ let str = `${xname}
`
params.forEach((el, index) => {
- str += `${el.marker}${el.seriesName.split('(')[0]}:${el.value[1] ? (el.value[1] + ' ' + el.value[2]) : '-'}
`;
- });
- return str;
- },
+ str += `${el.marker}${el.seriesName.split('(')[0]}:${
+ el.value[1] ? el.value[1] + ' ' + el.value[2] : '-'
+ }
`
+ })
+ return str
+ }
},
color: ['#FFCC00', '#009900', '#CC0000', ...color],
xAxis: {
@@ -458,14 +521,10 @@ const init = (flag: boolean) => {
}
}
},
- yAxis: [{
-
- }],
+ yAxis: [{}],
options: {
- series: [
-
- ]
+ series: []
}
}
if (chartsList.length > 0) {
@@ -473,7 +532,7 @@ const init = (flag: boolean) => {
unitList.forEach((item: any, index: any) => {
let right = {
position: 'right',
- offset: (index - 1) * 80,
+ offset: (index - 1) * 80
}
echartsData.value.yAxis.push({
name: item,
@@ -481,8 +540,7 @@ const init = (flag: boolean) => {
splitNumber: 5,
minInterval: 1,
splitLine: {
- show: false,
-
+ show: false
},
...(index > 0 ? right : null)
})
@@ -491,26 +549,26 @@ const init = (flag: boolean) => {
result.forEach((item: any, index: any) => {
let yMethodList: any = []
- let ABCList = Object.values(item.reduce((acc, item) => {
- let key = item.phase;
- if (!acc[key]) {
- acc[key] = [];
- }
- acc[key].push(item);
- return acc;
- }, {}));
- ABCList.forEach((kk: any,) => {
+ let ABCList = Object.values(
+ item.reduce((acc, item) => {
+ let key = item.phase
+ if (!acc[key]) {
+ acc[key] = []
+ }
+ acc[key].push(item)
+ return acc
+ }, {})
+ )
+ ABCList.forEach((kk: any) => {
let seriesList: any = []
kk.forEach((cc: any) => {
if (cc.statisticalData) {
yMethodList.push(cc.statisticalData?.toFixed(2) - 0)
-
}
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit])
})
-
echartsData.value.options.series.push({
name: kk[0].phase + '相' + item[0].anotherName,
type: 'line',
@@ -518,29 +576,24 @@ const init = (flag: boolean) => {
symbol: 'none',
data: seriesList,
yAxisIndex: index
-
})
-
-
})
let [min, max] = yMethod(yMethodList)
echartsData.value.yAxis[index].min = min
echartsData.value.yAxis[index].max = max
-
-
-
})
}
// console.log("🚀 ~ .1111 ~ echartsData.value :", echartsData.value)
-
-
loading.value = false
}
})
.catch(error => {
loading.value = false
})
+ } else {
+ loading.value = false
+ echartsData.value = {}
}
}
}
@@ -715,7 +768,6 @@ const selectChange = (e: boolean) => {
EcharHeight.value = mainHeight(310)
}
}
-
}
const handleChange = () => {
if (activeColName.value == '0') {
@@ -724,7 +776,6 @@ const handleChange = () => {
} else {
EcharHeight.value = mainHeight(510)
}
-
} else {
if (flag.value) {
EcharHeight.value = mainHeight(365)
@@ -732,7 +783,6 @@ const handleChange = () => {
EcharHeight.value = mainHeight(310)
}
}
-
}
const tableHeaderRef = ref()
const searchFormIndex = ref()
@@ -768,6 +818,9 @@ onMounted(() => {