|
|
@@ -10,7 +10,8 @@ |
|
|
|
:legend="legend" |
|
|
|
:series="series" |
|
|
|
:xAxis="xAxis" |
|
|
|
class="fto-chart" |
|
|
|
in="ChipInvest" |
|
|
|
class="chip-invest-chart" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
@@ -44,8 +45,8 @@ export default { |
|
|
|
const year = new Date().getFullYear(); |
|
|
|
const month = new Date().getMonth() + 1; |
|
|
|
return [ |
|
|
|
{ label: `${year}年${month}月`, color: "#12f7f1" }, |
|
|
|
{ label: `${year - 1}年${month}月`, color: "#58adfa" }, |
|
|
|
{ label: `${year - 1}年${month}月`, color: "#12f7f1" }, |
|
|
|
{ label: `${year}年${month}月`, color: "#58adfa" }, |
|
|
|
]; |
|
|
|
} |
|
|
|
case "年": { |
|
|
@@ -63,59 +64,43 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
series() { |
|
|
|
const template = |
|
|
|
this.period == "日" || this.period == "周" |
|
|
|
? [ |
|
|
|
{ |
|
|
|
name: "样例数据--2023年", |
|
|
|
data: Array.from({ length: 7 }, () => |
|
|
|
Math.floor(Math.random() * 1000) |
|
|
|
), |
|
|
|
}, |
|
|
|
] |
|
|
|
: [ |
|
|
|
{ |
|
|
|
name: "样例数据--2023年", |
|
|
|
data: Array.from({ length: 7 }, () => |
|
|
|
Math.floor(Math.random() * 1000) |
|
|
|
), |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "样例数据--2024年", |
|
|
|
data: Array.from({ length: 7 }, () => |
|
|
|
Math.floor(Math.random() * 1000) |
|
|
|
), |
|
|
|
}, |
|
|
|
]; |
|
|
|
const ftoInvest = this.$store.getters.home.ftoInvest; |
|
|
|
if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) { |
|
|
|
return [ |
|
|
|
{ |
|
|
|
name: "样例数据--2023年", |
|
|
|
data: Array.from({ length: 7 }, () => |
|
|
|
Math.floor(Math.random() * 1000) |
|
|
|
), |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "样例数据--2024年", |
|
|
|
data: Array.from({ length: 7 }, () => |
|
|
|
Math.floor(Math.random() * 1000) |
|
|
|
), |
|
|
|
}, |
|
|
|
]; |
|
|
|
const { chipInvest } = this.$store.getters.copilot.yield; |
|
|
|
let dataList = null; |
|
|
|
switch (this.period) { |
|
|
|
case "日": |
|
|
|
case "周": |
|
|
|
dataList = chipInvest?.current; |
|
|
|
break; |
|
|
|
default: |
|
|
|
dataList = []; |
|
|
|
dataList[0] = chipInvest?.pervious; |
|
|
|
dataList[1] = chipInvest?.current; |
|
|
|
} |
|
|
|
return getTemplate(this.period, dataList); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
return [ |
|
|
|
function getTemplate(period, dataList) { |
|
|
|
const year = new Date().getFullYear(); |
|
|
|
const month = new Date().getMonth() + 1; |
|
|
|
return period == "日" || period == "周" |
|
|
|
? [ |
|
|
|
{ |
|
|
|
name: period == "日" ? "昨日" : "本周", |
|
|
|
data: dataList ?? [], |
|
|
|
}, |
|
|
|
] |
|
|
|
: [ |
|
|
|
{ |
|
|
|
name: `${new Date().getFullYear() - 1}年`, |
|
|
|
data: ftoInvest.previous, |
|
|
|
name: period == "年" ? `${year - 1}年` : `${year - 1}年${month}月`, |
|
|
|
data: dataList ? dataList[0] : [], |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: `${new Date().getFullYear()}年`, |
|
|
|
data: ftoInvest.current, |
|
|
|
name: period == "年" ? `${year}年` : `${year}年${month}月`, |
|
|
|
data: dataList ? dataList[1] : [], |
|
|
|
// : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)), |
|
|
|
}, |
|
|
|
]; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
} |
|
|
|
</script> |