update 标准组件产出 环形图
This commit is contained in:
джерело
517874ffc2
коміт
08c9cf8dd6
@ -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",
|
||||
};
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ export default {
|
||||
},
|
||||
in: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -194,8 +194,6 @@ export default {
|
||||
this.initOptions(this.actualOptions);
|
||||
},
|
||||
series(val) {
|
||||
debugger;
|
||||
console.log(`[BarChartBase] [${this.in}] should update component`, val);
|
||||
if (!val) {
|
||||
this.initOptions(this.options);
|
||||
return;
|
||||
|
@ -23,7 +23,7 @@
|
||||
<script>
|
||||
import chartMixin from "@/mixins/chart.js";
|
||||
import fullscreenMixin from "@/mixins/fullscreen.js";
|
||||
import options from "./double-ring-chart-options";
|
||||
import getOptions from "./double-ring-chart-options";
|
||||
|
||||
export default {
|
||||
name: "DoubleRingChart",
|
||||
@ -37,6 +37,10 @@ export default {
|
||||
type: String,
|
||||
default: "日",
|
||||
},
|
||||
dataSource: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
@ -45,9 +49,25 @@ export default {
|
||||
legendItems() {
|
||||
return calculateItems(this.period);
|
||||
},
|
||||
options() {
|
||||
// TODO: 此处更新数据
|
||||
let titleValue = "10%",
|
||||
subtitle = "测试子标题",
|
||||
previousSum = 10,
|
||||
currentSum = 0,
|
||||
targetSum = 100;
|
||||
|
||||
return getOptions({
|
||||
titleValue,
|
||||
subtitle,
|
||||
previousSum,
|
||||
currentSum,
|
||||
targetSum,
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initOptions(options);
|
||||
this.initOptions(this.options);
|
||||
},
|
||||
methods: {
|
||||
// fullscreen mixin 需要的回调
|
||||
@ -136,17 +156,17 @@ function calculateItems(period) {
|
||||
}
|
||||
|
||||
.legend-item:nth-child(1) .legend-item__label::before {
|
||||
background: #0f65ff;
|
||||
background: #12fff5;
|
||||
}
|
||||
.legend-item:nth-child(1) .legend-item__value {
|
||||
color: #0f65ff;
|
||||
color: #12fff5;
|
||||
}
|
||||
|
||||
.legend-item:nth-child(2) .legend-item__label::before {
|
||||
background: #12fff5;
|
||||
background: #0f65ff;
|
||||
}
|
||||
.legend-item:nth-child(2) .legend-item__value {
|
||||
color: #12fff5;
|
||||
color: #0f65ff;
|
||||
}
|
||||
|
||||
.legend-item:nth-child(3) .legend-item__label::before {
|
||||
|
@ -13,7 +13,7 @@
|
||||
:options="cityOptions"
|
||||
/>
|
||||
<div class="flex-1 stretch">
|
||||
<DoubleRingChartVue :period="period" />
|
||||
<DoubleRingChartVue :data-source="dataSource" :period="period" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
<script>
|
||||
import CopilotSelect from "../../select.vue";
|
||||
import fetcher from "./fetcherDoubleRing";
|
||||
import DoubleRingChartVue from "./DoubleRingChart.vue";
|
||||
import CityData from "./CityData.vue";
|
||||
|
||||
@ -54,15 +53,9 @@ export default {
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
fetcher.getData().then((res) => {
|
||||
console.log("getData--->", res);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
handleActiveUpdate(val) {
|
||||
console.log("handleActiveUpdate--->", val);
|
||||
handleActiveUpdate(index) {
|
||||
console.log("handleActiveUpdate--->", index);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -1,4 +1,10 @@
|
||||
export default {
|
||||
export default ({
|
||||
titleValue,
|
||||
subtitle,
|
||||
previousSum,
|
||||
currentSum,
|
||||
targetSum,
|
||||
}) => ({
|
||||
grid: {
|
||||
left: 0,
|
||||
right: 0,
|
||||
@ -8,16 +14,16 @@ export default {
|
||||
},
|
||||
tooltip: {},
|
||||
title: {
|
||||
text: "78%",
|
||||
left: "50%",
|
||||
top: "40%",
|
||||
text: titleValue,
|
||||
left: "49%",
|
||||
top: "39%",
|
||||
textAlign: "center",
|
||||
textStyle: {
|
||||
fontWeight: 600,
|
||||
fontSize: 32,
|
||||
color: "#fffd",
|
||||
},
|
||||
subtext: "\u200224年累计产出\u2002",
|
||||
subtext: `\u2002${subtitle}\u2002`,
|
||||
subtextStyle: {
|
||||
fontSize: 14,
|
||||
fontWeight: 100,
|
||||
@ -26,17 +32,17 @@ export default {
|
||||
},
|
||||
},
|
||||
series: [
|
||||
// 背景 series - 2024计划
|
||||
// 背景 series
|
||||
{
|
||||
type: "pie",
|
||||
name: "2024目标",
|
||||
name: "当前目标",
|
||||
radius: ["70%", "85%"],
|
||||
center: ["50%", "52%"],
|
||||
emptyCircleStyle: {
|
||||
color: "#042c5f33",
|
||||
},
|
||||
},
|
||||
// 数据 series - 2024累计
|
||||
// 数据 series
|
||||
{
|
||||
type: "pie",
|
||||
radius: ["70%", "85%"],
|
||||
@ -44,15 +50,14 @@ export default {
|
||||
avoidLabelOvervlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
// position: "center",
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: 90,
|
||||
name: "2024累计产出",
|
||||
value: currentSum,
|
||||
name: "当前累计产出",
|
||||
selected: false,
|
||||
itemStyle: {
|
||||
borderJoin: "round",
|
||||
@ -73,8 +78,15 @@ export default {
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 20,
|
||||
name: "-",
|
||||
value:
|
||||
targetSum > currentSum
|
||||
? targetSum - currentSum
|
||||
: targetSum == currentSum
|
||||
? currentSum == 0
|
||||
? 1
|
||||
: 0
|
||||
: 0,
|
||||
name: "未达成累计",
|
||||
itemStyle: { color: "transparent" },
|
||||
label: { show: false },
|
||||
},
|
||||
@ -94,8 +106,8 @@ export default {
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: 90,
|
||||
name: "2023累计产出",
|
||||
value: previousSum,
|
||||
name: "上期累计产出",
|
||||
selected: false,
|
||||
itemStyle: {
|
||||
borderJoin: "round",
|
||||
@ -116,7 +128,7 @@ export default {
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 20,
|
||||
value: targetSum > previousSum ? targetSum - previousSum : 0,
|
||||
name: "-",
|
||||
itemStyle: { color: "transparent" },
|
||||
label: { show: false },
|
||||
@ -124,4 +136,4 @@ export default {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
|
@ -39,7 +39,18 @@ export default {
|
||||
watch: {
|
||||
currentActive: {
|
||||
handler(val) {
|
||||
this.$emit("update:active", val);
|
||||
this.$emit(
|
||||
"update:active",
|
||||
[
|
||||
"瑞昌",
|
||||
"邯郸",
|
||||
"株洲",
|
||||
"佳木斯",
|
||||
"成都",
|
||||
"凯盛光伏",
|
||||
"蚌埠兴科",
|
||||
].indexOf(val)
|
||||
);
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
|
Завантаження…
Посилання в новій задачі
Block a user