This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-04-26 15:44:04 +08:00
parent e8cc80495f
commit 517874ffc2
5 changed files with 53 additions and 57 deletions

View File

@ -5,7 +5,8 @@ ENV = 'development'
VUE_APP_TITLE = 芋道管理系统 VUE_APP_TITLE = 芋道管理系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.1.61:48080' # VUE_APP_BASE_API = 'http://192.168.1.61:48080'
VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -103,9 +103,12 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse) {
ftoInvest.current[fId] = factory.chipInput; ftoInvest.current[fId] = factory.chipInput;
ftoInvest.previous[fId] = factory.previousYearChipInput; ftoInvest.previous[fId] = factory.previousYearChipInput;
// 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出 // 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出
// 因为后端写的垃圾数据,所以这里要做一下判断
if (!([0, 1, 2].includes(factory.glassType))) continue;
const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType]; const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType];
_t.current[fId] = factory.outputNumber; _t.current[fId] = factory.outputNumber;
_t.previous[fId] = factory.previousYearOutputNumber; _t.previous[fId] = factory.previousYearOutputNumber;
// debugger;
} }
return { return {

View File

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

View File

@ -10,6 +10,7 @@
:legend="legend" :legend="legend"
:series="series" :series="series"
:xAxis="xAxis" :xAxis="xAxis"
in="ftoInvest"
class="fto-chart" class="fto-chart"
/> />
</template> </template>
@ -88,7 +89,7 @@ function getTemplate(period, dataList) {
return period == "日" || period == "周" return period == "日" || period == "周"
? [ ? [
{ {
name: period == "日" ? "昨" : "本周", name: period == "日" ? "昨" : "本周",
data: dataList ?? [], data: dataList ?? [],
}, },
] ]

View File

@ -52,6 +52,10 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
in: {
type: String,
default: ""
}
}, },
data() { data() {
return { return {
@ -190,6 +194,8 @@ export default {
this.initOptions(this.actualOptions); this.initOptions(this.actualOptions);
}, },
series(val) { series(val) {
debugger;
console.log(`[BarChartBase] [${this.in}] should update component`, val);
if (!val) { if (!val) {
this.initOptions(this.options); this.initOptions(this.options);
return; return;
@ -198,7 +204,7 @@ export default {
actualOptions.series[0].data = val[0].data; actualOptions.series[0].data = val[0].data;
actualOptions.series[0].name = val[0].name; actualOptions.series[0].name = val[0].name;
actualOptions.series[1].data = val?.[1]?.data || []; actualOptions.series[1].data = val?.[1]?.data || [];
actualOptions.series[1].name = val?.[1]?.name || ''; actualOptions.series[1].name = val?.[1]?.name || "";
this.actualOptions = actualOptions; this.actualOptions = actualOptions;
this.initOptions(actualOptions); this.initOptions(actualOptions);
}, },