Compare commits

..

No commits in common. "08c9cf8dd66bcf9f36978045c28c48f124fdbfb1" and "752df8417d6171c719221f4cdedf7ac8f4b1c2e6" have entirely different histories.

13 changed files with 163 additions and 200 deletions

View File

@ -5,8 +5,7 @@ ENV = 'development'
VUE_APP_TITLE = 芋道管理系统 VUE_APP_TITLE = 芋道管理系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://192.168.1.61:48080' VUE_APP_BASE_API = 'http://192.168.1.61:48080'
VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

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

View File

@ -6,7 +6,7 @@
--> -->
<template> <template>
<DoubleRingWrapperVue data-source="BIPV产出" :period="period" /> <DoubleRingWrapperVue :data-source="dataBundle" :period="period" />
</template> </template>
<script> <script>
@ -22,7 +22,7 @@ export default {
}, },
}, },
data() { data() {
return {}; return { dataBundle: null };
}, },
}; };
</script> </script>

View File

@ -10,8 +10,7 @@
:legend="legend" :legend="legend"
:series="series" :series="series"
:xAxis="xAxis" :xAxis="xAxis"
in="ChipInvest" class="fto-chart"
class="chip-invest-chart"
/> />
</template> </template>
@ -45,8 +44,8 @@ export default {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
const month = new Date().getMonth() + 1; const month = new Date().getMonth() + 1;
return [ return [
{ label: `${year - 1}${month}`, color: "#12f7f1" }, { label: `${year}${month}`, color: "#12f7f1" },
{ label: `${year}${month}`, color: "#58adfa" }, { label: `${year - 1}${month}`, color: "#58adfa" },
]; ];
} }
case "年": { case "年": {
@ -64,43 +63,59 @@ export default {
} }
}, },
series() { series() {
const { chipInvest } = this.$store.getters.copilot.yield; const template =
let dataList = null; this.period == "日" || this.period == "周"
switch (this.period) { ? [
case "日": {
case "周": name: "样例数据--2023年",
dataList = chipInvest?.current; data: Array.from({ length: 7 }, () =>
break; Math.floor(Math.random() * 1000)
default: ),
dataList = []; },
dataList[0] = chipInvest?.pervious; ]
dataList[1] = chipInvest?.current; : [
{
name: "样例数据--2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
name: "样例数据--2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
];
const ftoInvest = this.$store.getters.home.ftoInvest;
if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) {
return [
{
name: "样例数据--2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
name: "样例数据--2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
];
} }
return getTemplate(this.period, dataList);
return [
{
name: `${new Date().getFullYear() - 1}`,
data: ftoInvest.previous,
},
{
name: `${new Date().getFullYear()}`,
data: ftoInvest.current,
},
];
}, },
}, },
}; };
function getTemplate(period, dataList) {
const year = new Date().getFullYear();
const month = new Date().getMonth() + 1;
return period == "日" || period == "周"
? [
{
name: period == "日" ? "昨日" : "本周",
data: dataList ?? [],
},
]
: [
{
name: period == "年" ? `${year - 1}` : `${year - 1}${month}`,
data: dataList ? dataList[0] : [],
},
{
name: period == "年" ? `${year}` : `${year}${month}`,
data: dataList ? dataList[1] : [],
// : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)),
},
];
}
</script> </script>

View File

@ -6,7 +6,7 @@
--> -->
<template> <template>
<DoubleRingWrapperVue data-source="芯片产出" :period="period" /> <DoubleRingWrapperVue :data-source="dataBundle" :period="period" />
</template> </template>
<script> <script>
@ -22,7 +22,7 @@ export default {
}, },
}, },
data() { data() {
return {}; return { dataBundle: null };
}, },
}; };
</script> </script>

View File

@ -10,7 +10,6 @@
:legend="legend" :legend="legend"
:series="series" :series="series"
:xAxis="xAxis" :xAxis="xAxis"
in="ftoInvest"
class="fto-chart" class="fto-chart"
/> />
</template> </template>
@ -45,8 +44,8 @@ export default {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
const month = new Date().getMonth() + 1; const month = new Date().getMonth() + 1;
return [ return [
{ label: `${year - 1}${month}`, color: "#12f7f1" }, { label: `${year}${month}`, color: "#12f7f1" },
{ label: `${year}${month}`, color: "#58adfa" }, { label: `${year - 1}${month}`, color: "#58adfa" },
]; ];
} }
case "年": { case "年": {
@ -64,45 +63,59 @@ export default {
} }
}, },
series() { series() {
const { ftoInvest } = this.$store.getters.copilot.yield; const template =
let dataList = null; this.period == "日" || this.period == "周"
? [
switch (this.period) { {
case "日": name: "样例数据--2023年",
case "周": data: Array.from({ length: 7 }, () =>
dataList = ftoInvest?.current; Math.floor(Math.random() * 1000)
break; ),
default: },
dataList = []; ]
dataList[0] = ftoInvest?.pervious; : [
dataList[1] = ftoInvest?.current; {
name: "样例数据--2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
name: "样例数据--2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
];
const ftoInvest = this.$store.getters.home.ftoInvest;
if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) {
return [
{
name: "样例数据--2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
name: "样例数据--2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
];
} }
return getTemplate(this.period, dataList); return [
{
name: `${new Date().getFullYear() - 1}`,
data: ftoInvest.previous,
},
{
name: `${new Date().getFullYear()}`,
data: ftoInvest.current,
},
];
}, },
}, },
}; };
function getTemplate(period, dataList) {
const year = new Date().getFullYear();
const month = new Date().getMonth() + 1;
return period == "日" || period == "周"
? [
{
name: period == "日" ? "昨日" : "本周",
data: dataList ?? [],
},
]
: [
{
name: period == "年" ? `${year - 1}` : `${year - 1}${month}`,
data: dataList ? dataList[0] : [],
},
{
name: period == "年" ? `${year}` : `${year}${month}`,
data: dataList ? dataList[1] : [],
// : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)),
},
];
}
</script> </script>

View File

@ -6,7 +6,7 @@
--> -->
<template> <template>
<DoubleRingWrapperVue data-source="标准组件" :period="period" /> <DoubleRingWrapperVue data-source="标准组件" :period="period" />
</template> </template>
<script> <script>

View File

@ -52,10 +52,6 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
in: {
type: String,
default: "",
},
}, },
data() { data() {
return { return {
@ -201,8 +197,8 @@ export default {
const actualOptions = JSON.parse(JSON.stringify(this.options)); const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = val[0].data; actualOptions.series[0].data = val[0].data;
actualOptions.series[0].name = val[0].name; actualOptions.series[0].name = val[0].name;
actualOptions.series[1].data = val?.[1]?.data || []; actualOptions.series[1].data = val[1].data;
actualOptions.series[1].name = val?.[1]?.name || ""; actualOptions.series[1].name = val[1].name;
this.actualOptions = actualOptions; this.actualOptions = actualOptions;
this.initOptions(actualOptions); this.initOptions(actualOptions);
}, },

View File

@ -57,13 +57,13 @@ export default {
headquarterValue() { headquarterValue() {
let getterName = ""; let getterName = "";
switch (this.dataSource) { switch (this.dataSource) {
case "标准组件出": case "标准组件出":
getterName = "stdOutput"; getterName = "stdOutput";
break; break;
case "芯片出": case "芯片出":
getterName = "chipOutput"; getterName = "chipOutput";
break; break;
case "BIPV出": case "BIPV出":
getterName = "bipvOutput"; getterName = "bipvOutput";
break; break;
} }
@ -74,13 +74,13 @@ export default {
cities() { cities() {
let getterName = ""; let getterName = "";
switch (this.dataSource) { switch (this.dataSource) {
case "标准组件出": case "标准组件出":
getterName = "stdOutput"; getterName = "stdOutput";
break; break;
case "芯片出": case "芯片出":
getterName = "chipOutput"; getterName = "chipOutput";
break; break;
case "BIPV出": case "BIPV出":
getterName = "bipvOutput"; getterName = "bipvOutput";
break; break;
} }

View File

@ -23,7 +23,7 @@
<script> <script>
import chartMixin from "@/mixins/chart.js"; import chartMixin from "@/mixins/chart.js";
import fullscreenMixin from "@/mixins/fullscreen.js"; import fullscreenMixin from "@/mixins/fullscreen.js";
import getOptions from "./double-ring-chart-options"; import options from "./double-ring-chart-options";
export default { export default {
name: "DoubleRingChart", name: "DoubleRingChart",
@ -37,10 +37,6 @@ export default {
type: String, type: String,
default: "日", default: "日",
}, },
dataSource: {
type: String,
default: null,
},
}, },
data() { data() {
return {}; return {};
@ -49,25 +45,9 @@ export default {
legendItems() { legendItems() {
return calculateItems(this.period); return calculateItems(this.period);
}, },
options() {
// TODO:
let titleValue = "10%",
subtitle = "测试子标题",
previousSum = 10,
currentSum = 0,
targetSum = 100;
return getOptions({
titleValue,
subtitle,
previousSum,
currentSum,
targetSum,
});
},
}, },
mounted() { mounted() {
this.initOptions(this.options); this.initOptions(options);
}, },
methods: { methods: {
// fullscreen mixin // fullscreen mixin
@ -156,17 +136,17 @@ function calculateItems(period) {
} }
.legend-item:nth-child(1) .legend-item__label::before { .legend-item:nth-child(1) .legend-item__label::before {
background: #12fff5; background: #0f65ff;
} }
.legend-item:nth-child(1) .legend-item__value { .legend-item:nth-child(1) .legend-item__value {
color: #12fff5; color: #0f65ff;
} }
.legend-item:nth-child(2) .legend-item__label::before { .legend-item:nth-child(2) .legend-item__label::before {
background: #0f65ff; background: #12fff5;
} }
.legend-item:nth-child(2) .legend-item__value { .legend-item:nth-child(2) .legend-item__value {
color: #0f65ff; color: #12fff5;
} }
.legend-item:nth-child(3) .legend-item__label::before { .legend-item:nth-child(3) .legend-item__label::before {

View File

@ -13,7 +13,7 @@
:options="cityOptions" :options="cityOptions"
/> />
<div class="flex-1 stretch"> <div class="flex-1 stretch">
<DoubleRingChartVue :data-source="dataSource" :period="period" /> <DoubleRingChartVue :period="period" />
</div> </div>
</template> </template>
<template v-else> <template v-else>
@ -24,6 +24,7 @@
<script> <script>
import CopilotSelect from "../../select.vue"; import CopilotSelect from "../../select.vue";
import fetcher from "./fetcherDoubleRing";
import DoubleRingChartVue from "./DoubleRingChart.vue"; import DoubleRingChartVue from "./DoubleRingChart.vue";
import CityData from "./CityData.vue"; import CityData from "./CityData.vue";
@ -53,9 +54,15 @@ export default {
], ],
}; };
}, },
computed: {},
mounted() {
fetcher.getData().then((res) => {
console.log("getData--->", res);
});
},
methods: { methods: {
handleActiveUpdate(index) { handleActiveUpdate(val) {
console.log("handleActiveUpdate--->", index); console.log("handleActiveUpdate--->", val);
}, },
}, },
}; };

View File

@ -1,10 +1,4 @@
export default ({ export default {
titleValue,
subtitle,
previousSum,
currentSum,
targetSum,
}) => ({
grid: { grid: {
left: 0, left: 0,
right: 0, right: 0,
@ -14,16 +8,16 @@ export default ({
}, },
tooltip: {}, tooltip: {},
title: { title: {
text: titleValue, text: "78%",
left: "49%", left: "50%",
top: "39%", top: "40%",
textAlign: "center", textAlign: "center",
textStyle: { textStyle: {
fontWeight: 600, fontWeight: 600,
fontSize: 32, fontSize: 32,
color: "#fffd", color: "#fffd",
}, },
subtext: `\u2002${subtitle}\u2002`, subtext: "\u200224年累计产出\u2002",
subtextStyle: { subtextStyle: {
fontSize: 14, fontSize: 14,
fontWeight: 100, fontWeight: 100,
@ -32,17 +26,17 @@ export default ({
}, },
}, },
series: [ series: [
// 背景 series // 背景 series - 2024计划
{ {
type: "pie", type: "pie",
name: "当前目标", name: "2024目标",
radius: ["70%", "85%"], radius: ["70%", "85%"],
center: ["50%", "52%"], center: ["50%", "52%"],
emptyCircleStyle: { emptyCircleStyle: {
color: "#042c5f33", color: "#042c5f33",
}, },
}, },
// 数据 series // 数据 series - 2024累计
{ {
type: "pie", type: "pie",
radius: ["70%", "85%"], radius: ["70%", "85%"],
@ -50,14 +44,15 @@ export default ({
avoidLabelOvervlap: false, avoidLabelOvervlap: false,
label: { label: {
show: false, show: false,
// position: "center",
}, },
labelLine: { labelLine: {
show: false, show: false,
}, },
data: [ data: [
{ {
value: currentSum, value: 90,
name: "当前累计产出", name: "2024累计产出",
selected: false, selected: false,
itemStyle: { itemStyle: {
borderJoin: "round", borderJoin: "round",
@ -78,15 +73,8 @@ export default ({
}, },
}, },
{ {
value: value: 20,
targetSum > currentSum name: "-",
? targetSum - currentSum
: targetSum == currentSum
? currentSum == 0
? 1
: 0
: 0,
name: "未达成累计",
itemStyle: { color: "transparent" }, itemStyle: { color: "transparent" },
label: { show: false }, label: { show: false },
}, },
@ -106,8 +94,8 @@ export default ({
}, },
data: [ data: [
{ {
value: previousSum, value: 90,
name: "上期累计产出", name: "2023累计产出",
selected: false, selected: false,
itemStyle: { itemStyle: {
borderJoin: "round", borderJoin: "round",
@ -128,7 +116,7 @@ export default ({
}, },
}, },
{ {
value: targetSum > previousSum ? targetSum - previousSum : 0, value: 20,
name: "-", name: "-",
itemStyle: { color: "transparent" }, itemStyle: { color: "transparent" },
label: { show: false }, label: { show: false },
@ -136,4 +124,4 @@ export default ({
], ],
}, },
], ],
}); };

View File

@ -39,18 +39,7 @@ export default {
watch: { watch: {
currentActive: { currentActive: {
handler(val) { handler(val) {
this.$emit( this.$emit("update:active", val);
"update:active",
[
"瑞昌",
"邯郸",
"株洲",
"佳木斯",
"成都",
"凯盛光伏",
"蚌埠兴科",
].indexOf(val)
);
}, },
immediate: true, immediate: true,
}, },