This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-04-28 16:55:21 +08:00
parent 253f182370
commit aa2ac270fc
4 changed files with 27 additions and 10 deletions

View File

@ -18,6 +18,7 @@ const state = {
efficiency: {}, efficiency: {},
}, },
home: { home: {
/** 主页状态 */
ftoInvest: null, ftoInvest: null,
chipInvest: null, chipInvest: null,
chipOutput: null, chipOutput: null,
@ -88,8 +89,8 @@ export default {
actions, actions,
}; };
// utils function
function splitCurrentAndPrevious(factoryListResponse, targetListResponse) { function splitCurrentAndPrevious(factoryListResponse, targetListResponse) {
// 初始数据
const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init(); const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init();
if (factoryListResponse) { if (factoryListResponse) {
for (const factory of factoryListResponse) { for (const factory of factoryListResponse) {
@ -148,6 +149,10 @@ function getFactoryTargetValue(targetList, factoryId) {
}; };
} }
/**
*
* @returns 初始化状态值
*/
function init() { function init() {
const t_ = { const t_ = {
current: Array(7).fill(0), current: Array(7).fill(0),
@ -168,11 +173,11 @@ function init() {
const bipvOutput = deepClone(chipOutput); const bipvOutput = deepClone(chipOutput);
return { return {
chipInvest, chipInvest, // 芯片投入
ftoInvest, ftoInvest, // FTO投入
chipOutput, chipOutput, // 芯片产出
stdOutput, stdOutput, // 标准组件产出
bipvOutput, bipvOutput, // BIPV产出
}; };
} }
@ -248,6 +253,12 @@ async function doFetch(copilot_module = "yield", fetch_target, params) {
return null; return null;
} }
/**
*
* @param {*} period 日周月年1,2,3,4
* @param {*} target 是否获取目标数据
* @returns
*/
function getCopilotYield(period, target = false) { function getCopilotYield(period, target = false) {
return getCopilotData("yield", period, target); return getCopilotData("yield", period, target);
} }

View File

@ -98,6 +98,7 @@ export default {
_cities[idx].value = v ?? 0; _cities[idx].value = v ?? 0;
} }
); );
//
_cities.splice(4, 1); _cities.splice(4, 1);
return _cities; return _cities;
}, },

View File

@ -8,7 +8,7 @@
<template> <template>
<div class="double-ring-chart"> <div class="double-ring-chart">
<div ref="chart" class="double-ring-chart__container"></div> <div ref="chart" class="double-ring-chart__container"></div>
<!-- :style="{ height: vHeight + 'vh' }" --> <!-- style="{ height: vHeight + 'vh' }" -->
<div class="double-ring-chart__legend"> <div class="double-ring-chart__legend">
<div v-for="item in legendItems" :key="item.label" class="legend-item"> <div v-for="item in legendItems" :key="item.label" class="legend-item">
<span class="legend-item__label">{{ item.label }}</span> <span class="legend-item__label">{{ item.label }}</span>
@ -75,6 +75,7 @@ export default {
getter.current[this.factoryId], getter.current[this.factoryId],
]; ];
} }
// [100, 200, 200]
return [ return [
getter.previous[this.factoryId], getter.previous[this.factoryId],
getter.current[this.factoryId], getter.current[this.factoryId],

View File

@ -12,7 +12,7 @@
<h2>{{ info.companyName }}</h2> <h2>{{ info.companyName }}</h2>
<ul> <ul>
<li v-for="item in info.items" :key="item.label"> <li v-for="item in info.items" :key="item.label">
{{ item.label }} {{ item.value | currency }} {{ item.label }} {{ item.value | numberFilter }}
</li> </li>
</ul> </ul>
</div> </div>
@ -35,8 +35,12 @@ export default {
}, },
}, },
filters: { filters: {
currency(value) { numberFilter(value) {
return value.toLocaleString(); if (value != null && !isNaN(parseInt(value))) {
return parseInt(value).toLocaleString();
} else {
return '-';
}
}, },
}, },
data() { data() {