|
@@ -198,11 +198,8 @@ const dataCard = ref([])
|
|
|
|
|
|
const dataTopup = ref([])
|
|
const dataTopup = ref([])
|
|
// 使用量
|
|
// 使用量
|
|
-
|
|
|
|
const dataAmount = ref([])
|
|
const dataAmount = ref([])
|
|
-
|
|
|
|
// 操作记录
|
|
// 操作记录
|
|
-
|
|
|
|
const dataOperation = ref([])
|
|
const dataOperation = ref([])
|
|
const open = (data) => {
|
|
const open = (data) => {
|
|
if (!data) {
|
|
if (!data) {
|
|
@@ -230,54 +227,25 @@ const open = (data) => {
|
|
|
|
|
|
// 使用量
|
|
// 使用量
|
|
const intData = async () => {
|
|
const intData = async () => {
|
|
- // 获取今天的日期
|
|
|
|
- const today = new Date();
|
|
|
|
- const toDay = today.toISOString().split('T')[0];
|
|
|
|
|
|
+ // 获取当前年份
|
|
|
|
+ const currentYear = new Date().getFullYear();
|
|
|
|
|
|
- // 获取三个月前的日期
|
|
|
|
- const pastDate = new Date(today);
|
|
|
|
- pastDate.setMonth(today.getMonth() - 3); // 减去三个月
|
|
|
|
- const formattedDate = pastDate.toISOString().split('T')[0];
|
|
|
|
|
|
+ // 获取今年的第一天(2025-01-01)
|
|
|
|
+ const startDate = `${currentYear}-01-01`;
|
|
|
|
|
|
- // 获取 CDR 数据
|
|
|
|
|
|
+ // 获取今年的最后一天(2025-12-31)
|
|
|
|
+ const endDateTime = `${currentYear}-12-31`;
|
|
|
|
+
|
|
|
|
+ // 调用你的 getDataCDR 方法
|
|
let res = await getDataCDR({
|
|
let res = await getDataCDR({
|
|
iccid: Card_info.value.iccid,
|
|
iccid: Card_info.value.iccid,
|
|
source: Card_info.value.source,
|
|
source: Card_info.value.source,
|
|
- startDate: formattedDate,
|
|
|
|
- endDate: toDay
|
|
|
|
|
|
+ startDate: startDate, // 今年的第一天
|
|
|
|
+ endDate: endDateTime // 今天的日期
|
|
});
|
|
});
|
|
|
|
|
|
- dataAmount.value = res.data
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 定义季度时间段
|
|
|
|
- const time = ['1-3', '4-6', '7-9', '9-12'];
|
|
|
|
-
|
|
|
|
- // 获取当前年份
|
|
|
|
- const year = today.getFullYear();
|
|
|
|
- for (let val of time) {
|
|
|
|
- // 拆分每个时间段,获取开始月和结束月
|
|
|
|
- const [startMonth, endMonth] = val.split('-');
|
|
|
|
- const startDate = `${year}-${startMonth}-01`; // 格式化开始日期
|
|
|
|
- const endDate = `${year}-${endMonth}-01`; // 格式化结束日期
|
|
|
|
-
|
|
|
|
- // 获取每个时间段的数据
|
|
|
|
- let res = await getDataCDR({
|
|
|
|
- iccid: Card_info.value.iccid,
|
|
|
|
- source: Card_info.value.source,
|
|
|
|
- startDate: startDate,
|
|
|
|
- endDate: endDate
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // 将当前时间段的数据中的 'usage' 字段合并到 series[0].data 数组中
|
|
|
|
- const usageData = res.data.length === 0
|
|
|
|
- ? []
|
|
|
|
- : res.data.map(val => val.usage !== undefined && val.usage !== null ? val.usage : 0);
|
|
|
|
- if (usageData.length !== 0) {
|
|
|
|
- option.value.series[0].data.push(...usageData);
|
|
|
|
- }
|
|
|
|
- initChart()
|
|
|
|
- }
|
|
|
|
|
|
+ option.value.series[0].data = res.data.yAxis
|
|
|
|
+ initChart()
|
|
}
|
|
}
|
|
|
|
|
|
// SIM卡操作
|
|
// SIM卡操作
|