update 产量驾驶舱
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user