图形分析、资源监控、交换机收益

This commit is contained in:
康冉冉
2025-09-03 18:34:47 +08:00
parent 7467bf2f5a
commit 90171cd617
20 changed files with 415 additions and 184 deletions
+20 -8
View File
@@ -30,6 +30,17 @@
}
}
},
watch: {
barData: {
handler(val) {
this.$nextTick(() => {
this.getList(this.title, this.barData);
});
},
deep: true,
immediate: true
}
},
data() {
return {
barDataList: '',
@@ -74,7 +85,7 @@
xAxis: [
{
type: dataXY && dataXY.yAxis ? 'value' :'category',
data: dataXY && dataXY.yAxis ? [] : dataXY.lineData,
data: dataXY && dataXY.yAxis ? [] : dataXY.lineXData,
// 去掉x轴线
axisLine: { show: false },
// 去掉x轴刻度线
@@ -102,7 +113,7 @@
axisLabel: {
show: true
},
data: dataXY && dataXY.yAxis ? dataXY.lineData : [],
data: dataXY && dataXY.yAxis ? dataXY.lineXData : [],
}
],
series: [
@@ -124,12 +135,13 @@
// })
},
dataChangeValue(val, days) {
// console.log(props.chartData(val));
// this.getList(this.title, {data: this.barData.data, lineData: days, yAxis: this.barData && this.barData.yAxis});
let newbarData = {...this.barData};
newbarData['lineData'] = days && days.length > 0 ? days: this.barData.lineXData;
this.getList(this.title, newbarData);
dataChangeValue(val, days, timeArr) {
if (timeArr) {
this.chartData(timeArr);
}
// let newbarData = {...this.barData};
// newbarData['lineXData'] = days && days.length > 0 ? days: this.barData.lineXData;
// this.getList(this.title, newbarData);
}
}
}
+26 -46
View File
@@ -17,16 +17,15 @@
<li :class="{ 'activesbgs' : isActive == 'MONTH' }" @click="toggle('MONTH')">前一个月</li>
</template>
<template v-else>
<li :class="{ 'activesbgs' : isActive == 'THREEMONTH' }" @click="toggle('THREEMONTH')">前三个月</li>
<li :class="{ 'activesbgs' : isActive == 'HALFYEAR' }" @click="toggle('HALFYEAR')">前半年</li>
<li :class="{ 'activesbgs' : isActive == 'YEAR' }" @click="toggle('YEAR')">前一年</li>
<li :class="{ 'activesbgs' : isActive == 'THREEMONTH' }" @click="toggle('THREEMONTH', 3)">前三个月</li>
<li :class="{ 'activesbgs' : isActive == 'HALFYEAR' }" @click="toggle('HALFYEAR', 6)">前半年</li>
<li :class="{ 'activesbgs' : isActive == 'YEAR' }" @click="toggle('YEAR', 12)">前一年</li>
</template>
</ul>
</div>
</template>
<script setup>
import {onMounted} from "vue";
export default {
name: 'dateTimeSelect',
props: {
@@ -43,28 +42,29 @@
},
// DOM 挂载完成后
mounted() {
this.isActive = this.dateShowType && this.dateShowType === 'day' ? 'MONTH' : 'YEAR';
// 可以访问 DOM 元素
setTimeout(() => {
// this.getLastDays(6);
// this.getDaysOfPreviousMonth();
this.$emit("dataChange", this.isActive, []);
}, 500);
// setTimeout(() => {
// // this.getLastDays(6);
// // this.getDaysOfPreviousMonth();
// this.$emit("dataChange", this.isActive, []);
// }, 500);
},
methods: {
toggle(val, num) {
this.isActive = val;
if (val && val === 'MONTH') {
this.getDaysOfPreviousMonth();
} else if (val && val === 'THREEMONTH') {
this.getLastThreeMonths();
} else if (val && val === 'HALFYEAR') {
this.getLastSixMonths();
} else if (val && (val === 'THREEMONTH' || val === 'HALFYEAR' || val === 'YEAR')) {
this.getLastMonths(num);
} else {
this.getLastDays(num - 1);
}
},
// 时间选择器
dateChange() {
this.getDaysOfPreviousMonth(this.dateRange[0], this.dateRange[1]);
this.$emit("dataChange", this.isActive, [], this.dateRange);
// this.getDaysOfPreviousMonth(this.dateRange[0], this.dateRange[1]);
},
// 获取当前日期前7天的所有日期(格式:YYYY-MM-DD)
getLastDays(num) {
@@ -82,7 +82,9 @@
dayList.push(`${year}-${month}-${day}`);
}
this.$emit("dataChange", this.isActive, dayList);
let timeArr = [dayList[0], dayList[dayList.length - 1]];
this.$emit("dataChange", this.isActive, [], timeArr);
// this.$emit("dataChange", this.isActive, dayList);
},
// 获取前一个月的所有日期
getDaysOfPreviousMonth(star, end) {
@@ -109,16 +111,18 @@
currentDay = new Date(currentDay); // 避免引用同一对象
currentDay.setDate(currentDay.getDate() + 1);
}
this.$emit("dataChange", this.isActive, oneMonthDays);
let timeArr = [oneMonthDays[0], oneMonthDays[oneMonthDays.length - 1]];
this.$emit("dataChange", this.isActive, [], timeArr);
// this.$emit("dataChange", this.isActive, oneMonthDays);
},
// 获取前三个月的月
getLastThreeMonths() {
getLastMonths(num) {
const threeMonths = [];
const today = new Date(); // 当前日期
const currentYear = today.getFullYear();
const currentMonth = today.getMonth(); // 月份从0开始(0=1月,11=12月)
// 循环获取前3个月(i=0: 前1个月,i=1: 前2个月,i=2: 前3个月)
for (let i = 1; i <= 3; i++) {
for (let i = 1; i <= num; i++) {
// 计算目标月份(当前月 - i
let targetMonth = currentMonth - i;
let targetYear = currentYear;
@@ -129,35 +133,11 @@
}
// 格式化月份为两位数(如5月→'05'
const monthStr = String(targetMonth + 1).padStart(2, '0'); // 加1是因为月份从0开始
threeMonths.push(`${targetYear}-${monthStr}`);
threeMonths.unshift(`${targetYear}-${monthStr}`);
}
console.log('threeMonths===',threeMonths);
this.$emit("dataChange", this.isActive, threeMonths);
},
// 前半年
getLastSixMonths() {
const result = [];
const today = new Date(); // 当前日期
const currentYear = today.getFullYear();
const currentMonth = today.getMonth(); // 月份从0开始(0=1月,11=12月)
// 循环获取前6个月(i=1: 前1个月,i=6: 前6个月)
for (let i = 1; i <= 6; i++) {
let targetMonth = currentMonth - i;
let targetYear = currentYear;
// 处理月份跨年份(如1月-1=12月,年份减1)
if (targetMonth < 0) {
targetMonth += 12;
targetYear -= 1;
}
// 格式化月份为两位数(如5月→'05'
const monthStr = String(targetMonth + 1).padStart(2, '0'); // 加1转为实际月份(1-12
result.push(`${targetYear}-${monthStr}`);
}
return result;
let timeArr = [threeMonths[0], threeMonths[threeMonths.length - 1]];
this.$emit("dataChange", this.isActive, [], timeArr);
// this.$emit("dataChange", this.isActive, threeMonths);
},
}
}
+19 -4
View File
@@ -30,6 +30,17 @@
}
}
},
watch: {
lineData: {
handler(val) {
this.$nextTick(() => {
this.getList(this.title, this.lineData);
});
},
deep: true,
immediate: true
}
},
data() {
return {
lineDataList: '',
@@ -41,7 +52,7 @@
},
mounted() {
if (this.lineData && this.lineData.hiddenTime) {
this.getList(this.title, {data: this.lineData.data, lineXData: this.lineData.lineXData});
this.getList(this.title, this.lineData);
}
},
methods: {
@@ -103,9 +114,13 @@
// lineDataListIntance.resize()
// })
},
dataChangeValue(val, days) {
let lineDataList = days && days.length > 0 ? days: this.lineData.lineXData;
this.getList(this.title, {data: this.lineData.data, lineXData: lineDataList});
dataChangeValue(val, days, timeArr) {
// 调用父级页面传过来的事件,在父级中处理该方法的逻辑--
if (timeArr) {
this.chartData(timeArr);
}
// let lineDataList = days && days.length > 0 ? days: this.lineData.lineXData;
// this.getList(this.title, {data: this.lineData.data, lineXData: lineDataList});
}
}
}
+3
View File
@@ -190,6 +190,9 @@
item.controls[val]['eventName'] = item.controls[val] && item.controls[val]['eventName'] || null;
if (item.controls[val] && item.controls[val]['rules']) {
this.rules[val] = item.controls[val]['rules'];
} else if (item.controls[val] && item.controls[val].required) {
let msgType = item.controls[val].type === 'input' ? '请输入' : '请选择';
this.rules[val] = [{required: true,message: `${msgType}${item.controls[val].label}`}];
}
});
});