update 标准组件产出 环形图
This commit is contained in:
@@ -68,9 +68,15 @@ const actions = {
|
||||
energy: null,
|
||||
efficiency: null,
|
||||
}[source];
|
||||
// 获取产量数据
|
||||
let { data: factoryList, type } = await fetcher(period);
|
||||
|
||||
const payload = splitCurrentAndPrevious(factoryList);
|
||||
let targetList = null;
|
||||
if (source === "yield") {
|
||||
// 获取目标数据
|
||||
let { data } = await fetcher(period, true);
|
||||
targetList = data;
|
||||
}
|
||||
const payload = splitCurrentAndPrevious(factoryList, targetList);
|
||||
commit("SET_COPILOT_INFO", { type, payload });
|
||||
},
|
||||
};
|
||||
@@ -104,7 +110,7 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse) {
|
||||
ftoInvest.previous[fId] = factory.previousYearChipInput;
|
||||
// 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出
|
||||
// 因为后端写的垃圾数据,所以这里要做一下判断
|
||||
if (!([0, 1, 2].includes(factory.glassType))) continue;
|
||||
if (![0, 1, 2].includes(factory.glassType)) continue;
|
||||
const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType];
|
||||
_t.current[fId] = factory.outputNumber;
|
||||
_t.previous[fId] = factory.previousYearOutputNumber;
|
||||
@@ -204,10 +210,17 @@ async function getHomeTarget() {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetcher(params) {
|
||||
const { code, data } = await axios.post("/ip/prod-output/query-by-date", {
|
||||
...params,
|
||||
});
|
||||
async function fetcher(type = "yield", params) {
|
||||
const { code, data } = await axios.post(
|
||||
type == "yield"
|
||||
? // 产量 数据
|
||||
"/ip/prod-output/query-by-date"
|
||||
: // 目标数据
|
||||
"/ip/prod-target/query-by-date",
|
||||
{
|
||||
...params,
|
||||
}
|
||||
);
|
||||
if (code == 0) {
|
||||
return data;
|
||||
}
|
||||
@@ -215,7 +228,13 @@ async function fetcher(params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function getCopilotYield(period) {
|
||||
/**
|
||||
*
|
||||
* @param {*} period 周期: 日周月年
|
||||
* @param {*} target 是否获取目标数据:默认 否
|
||||
* @returns
|
||||
*/
|
||||
async function getCopilotYield(period, target = false) {
|
||||
// 请求参数,直接一次性获取所有工厂
|
||||
let queryParams = {
|
||||
factorys: [],
|
||||
@@ -240,5 +259,8 @@ async function getCopilotYield(period) {
|
||||
break;
|
||||
}
|
||||
|
||||
return { data: await fetcher(queryParams), type: "yield" };
|
||||
return {
|
||||
data: await fetcher(target ? "target" : "yield", queryParams),
|
||||
type: "yield",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user