update 产量驾驶舱

This commit is contained in:
DESKTOP-FUDKNA8\znjsz
2024-04-24 16:31:27 +08:00
parent bd0faef33f
commit 30af8faa49
11 changed files with 793 additions and 28 deletions

View File

@@ -34,6 +34,17 @@ async function getHomeTarget() {
return null;
}
async function getCopilotYield(params) {
const { code, data } = await axios.post("/ip/prod-output/query-by-date", {
...params,
});
if (code == 0) {
return data;
}
console.warn("getCopilotYield failed, code: ", code);
return null;
}
/* 状态 */
const state = {
copilot: {
@@ -61,7 +72,19 @@ const mutations = {
state.home.stdOutput = payload.stdOutput;
state.home.bipvOutput = payload.bipvOutput;
},
SET_COPILOT_INFO: (state) => {},
SET_COPILOT_INFO: (state, payload) => {
switch (payload.type) {
case "yield":
state.copilot.yield = payload.data;
break;
case "energy":
state.copilot.energy = payload.data;
break;
case "efficiency":
state.copilot.efficiency = payload.data;
break;
}
},
};
const actions = {
@@ -104,7 +127,11 @@ const actions = {
if (target) {
chipOutput.target.splice(factoryId, 1, target.chipYield ?? 0);
stdOutput.target.splice(factoryId, 1, target.componentYield ?? 0);
bipvOutput.target.splice(factoryId, 1, target.bipvProductOutput ?? 0);
bipvOutput.target.splice(
factoryId,
1,
target.bipvProductOutput ?? 0
);
}
}
/* 收集芯片投入数据 */
@@ -184,7 +211,47 @@ const actions = {
}
},
/** 初始化驾驶舱数据 */
async initCopilot({ commit }) {},
async initCopilot({ commit }, payload) {
const { period } = payload;
let dummyData = null;
let type = null;
// 请求参数,直接一次性获取所有工厂
let queryParams = {
factorys: [],
date: 4,
};
switch (period) {
case "日":
queryParams.date = 1;
break;
case "周":
queryParams.date = 2;
break;
case "月":
queryParams.date = 3;
break;
case "年":
queryParams.date = 4;
break;
default:
queryParams.date = 1;
break;
}
const data = await getCopilotYield(queryParams);
if (data) {
dummyData = data;
type = "yield";
}
console.log("[copilot yield data]: ", dummyData, type);
// commit
// commit('SET_COPILOT_INFO', {
// type,
// data: dummyData
// })
},
};
export default {