This commit is contained in:
朱菊兰 2024-05-20 14:56:35 +08:00
commit f84355b673
29 changed files with 738 additions and 468 deletions

View File

@ -1,7 +1,7 @@
### ###
# @Author: zhp # @Author: zhp
# @Date: 2024-04-28 13:42:51 # @Date: 2024-04-28 13:42:51
# @LastEditTime: 2024-05-13 13:30:20 # @LastEditTime: 2024-05-20 08:31:10
# @LastEditors: zhp # @LastEditors: zhp
# @Description: # @Description:
### ###

View File

@ -1,7 +1,7 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-04-28 09:28:12 * @Date: 2024-04-28 09:28:12
* @LastEditTime: 2024-04-28 09:43:40 * @LastEditTime: 2024-05-16 08:56:59
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */
@ -13,3 +13,11 @@ export function getEnergyPage(data) {
data: data data: data
}) })
} }
export function getEnergySumPage(data) {
return request({
url: 'ip/prod-output/cockpitComprehensiveDataMonitor',
method: 'post',
data: data
})
}

View File

@ -1,14 +1,7 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 08:54:59 * @Date: 2024-05-07 08:54:59
* @LastEditTime: 2024-05-07 09:34:17 * @LastEditTime: 2024-05-14 15:43:50
* @LastEditors: zhp
* @Description:
*/
/*
* @Author: zhp
* @Date: 2024-04-26 14:53:45
* @LastEditTime: 2024-05-06 14:53:04
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */

View File

@ -1,9 +1,9 @@
import * as echarts from "echarts"; import * as echarts from "echarts";
function __resizeHandler(entries) { function __resizeHandler(entries) {
console.log(entries)
for (const entry of entries) { for (const entry of entries) {
if (entry.contentBoxSize) { if (entry.contentBoxSize) {
// manipulate contentBoxSize
// const contentBoxSize = Array.isArray(entry.contentBoxSize) // const contentBoxSize = Array.isArray(entry.contentBoxSize)
// ? entry.contentBoxSize[0] // ? entry.contentBoxSize[0]
// : entry.contentBoxSize; // : entry.contentBoxSize;

View File

@ -1,7 +1,15 @@
/*
* @Author: zhp
* @Date: 2024-04-28 13:42:51
* @LastEditTime: 2024-05-16 11:59:04
* @LastEditors: zhp
* @Description:
*/
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import app from './modules/app' import app from './modules/app'
import user from './modules/user' import user from './modules/user'
import home from './modules/home'
import tagsView from './modules/tagsView' import tagsView from './modules/tagsView'
import permission from './modules/permission' import permission from './modules/permission'
import settings from './modules/settings' import settings from './modules/settings'
@ -19,6 +27,7 @@ const store = new Vuex.Store({
permission, permission,
settings, settings,
dict, dict,
home,
copilot copilot
}, },
getters getters

View File

@ -14,7 +14,12 @@ const state = {
bipvOutput: null, bipvOutput: null,
}, },
/* 能源驾驶舱 */ /* 能源驾驶舱 */
energy: {}, energy: {
stockDOData: [],
waterList: {},
gasList: [],
elecList:{}
},
/* 效率驾驶舱 */ /* 效率驾驶舱 */
efficiency: { efficiency: {
chipOee: { chipOee: {
@ -66,10 +71,12 @@ const mutations = {
state.copilot.yield.bipvOutput = payload.bipvOutput; state.copilot.yield.bipvOutput = payload.bipvOutput;
break; break;
case "energy": case "energy":
state.copilot.energy = payload.data; state.copilot.energy.stockDOData = payload.stockDOData;
state.copilot.energy.gasList = payload.gasList;
state.copilot.energy.waterList = payload.waterList;
state.copilot.energy.elecList = payload.elecList;
break; break;
case "efficiency": case "efficiency":
console.log('222222', payload)
state.copilot.efficiency.chipOee = payload.chipOee; state.copilot.efficiency.chipOee = payload.chipOee;
state.copilot.efficiency.transformRate = payload.transformRate; state.copilot.efficiency.transformRate = payload.transformRate;
state.copilot.efficiency.chipRate = payload.chipRate; state.copilot.efficiency.chipRate = payload.chipRate;
@ -83,40 +90,47 @@ const actions = {
/** 初始化首页数据 */ /** 初始化首页数据 */
async initHome({ commit }) { async initHome({ commit }) {
const dataArr = await getHomeInfo(); const dataArr = await getHomeInfo();
const targetArr = await getHomeInfo(); console.log('dataArr',dataArr);
const payload = splitCurrentAndPrevious(dataArr.prodOutputResultDO, targetArr.prodTargetDO); // const targetArr = await getHomeInfo();
const payload = splitCurrentAndPrevious(dataArr.prodOutputOutDO, dataArr.prodTargetDO,dataArr.prodOutputFtoDO
);
commit("SET_HOME_INFO", payload); commit("SET_HOME_INFO", payload);
}, },
/** 初始化驾驶舱数据 */ /** 初始化驾驶舱数据 */
async initCopilot({ commit }, { period, source }) { async initCopilot({ commit }, { period, source }) {
if (source == "comprehensive") return; // if (source == "energy") return;
const fetcher = { const fetcher = {
yield: getCopilotYield, yield: getCopilotYield,
comprehensive: getCopilotEnergy, energy: getCopilotEnergy,
efficiency: getCopilotEfficiency, efficiency: getCopilotEfficiency,
}[source]; }[source];
const handler = { const handler = {
yield: splitCurrentAndPrevious, yield: splitCurrentAndPrevious,
comprehensive: () => null, energy: splitCurrentAndPreviousB,
efficiency: splitCurrentAndPreviousA, efficiency: splitCurrentAndPreviousA,
}[source] }[source]
console.log(handler)
// 获取产量数据 // 获取产量数据
// console.log('qqqqqq',handler)
let { data: factoryList, type } = await fetcher(period) let { data: factoryList, type } = await fetcher(period)
console.log(factoryList,type);
let targetList = null; let targetList = null;
if (source === "yield" || source === "efficiency") { if (source === "yield" || source === "efficiency") {
// 获取目标数据 // 获取目标数据
let { data } = await fetcher(period, true) let { data } = await fetcher(period, true)
// console.log('11111',data)
targetList = data targetList = data
} }
let factoryData = factoryList.prodOutputResultDO ? factoryList.prodOutputResultDO : factoryList.prodOutputRateDO if (source == "energy") {
let targetData = targetList.prodTargetDO ? targetList.prodTargetDO : targetList.prodTargetDO let factoryData = factoryList
const payload = handler(factoryData, targetData) const payload = handler(factoryData)
commit("SET_COPILOT_INFO", { type, payload }); commit("SET_COPILOT_INFO", { type, payload });
} else {
let factoryData = factoryList.prodOutputOutDO ? factoryList.prodOutputOutDO : factoryList.prodOutputRateDO
let prodOutputFtoDO = factoryList.prodOutputFtoDO ? factoryList.prodOutputFtoDO : []
let targetData = targetList.prodTargetDO ? targetList.prodTargetDO : targetList.prodTargetDO
const payload = handler(factoryData, targetData,prodOutputFtoDO)
commit("SET_COPILOT_INFO", { type, payload });
}
}, },
}; };
@ -127,8 +141,147 @@ export default {
actions, actions,
}; };
function splitCurrentAndPreviousB(factoryListResponse) {
let factoryArr = [
{
id: 0,
name: '瑞昌中建材光电材料有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
{
id: 1,
name: '邯郸中建材光电材料有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
{
id: 2,
name: '中建材株洲光电材料有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
{
id: 3,
name: '佳木斯中建材光电材料有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
{
id: 4,
name: '成都中建材光电材料有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
{
id: 5,
name: '凯盛光伏材料有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
{
id: 6,
name: '蚌埠兴科玻璃有限公司',
stockData: [],
waterData: [],
elsData: [],
gasData: [],
},
]
if (factoryListResponse) {
for (let i in factoryListResponse.stockDO) {
const index = factoryArr.findIndex(item => item.id == factoryListResponse.stockDO[i].factory)
if (index != -1) {
factoryListResponse.stockDO[i].stockInfo.forEach(ele => {
factoryArr[index].stockData.push(ele)
});
}
}
let stockDOData = []
factoryArr.forEach((ele, index) => [
stockDOData[index] = [],
ele.stockData.forEach((item) => {
let obj = {}
obj.name = item.glassType == 0 ? '玻璃芯片' : item.glassType == 1 ? '标准组件' : item.glassType == 2 ? 'BIPV' : '定制组件'
obj.value = item.stockNumber
stockDOData[index].push(obj)
}),
])
let gasList = []
// if (factoryListResponse.gasDO) {
factoryListResponse.gasDO.forEach((ele) => {
gasList[ele.factory] = ele.totalEnergyValue
})
// }
// console.log(factoryListResponse.gasDO);
let waterObj = Object.groupBy(factoryListResponse.waterDO, ({ groupName }) => groupName)
let waterList = {
times: [],
0: [],
1: [],
2: [],
3: [],
4: [],
5: [],
6: [],
}
for (let i in waterObj) {
waterList.times.push(i)
waterObj[i].forEach((ele, index) => {
waterList[ele.factory].push(ele.totalEnergyValue)
})
}
let elecObj = Object.groupBy(factoryListResponse.elecDO, ({ groupName }) => groupName)
let elecList = {
times: [],
0: [],
1: [],
2: [],
3: [],
4: [],
5: [],
6: [],
}
for (let i in elecObj) {
elecList.times.push(i)
elecObj[i].forEach((ele, index) => {
elecList[ele.factory].push(ele.totalEnergyValue)
})
}
return {
stockDOData,
waterList,
gasList,
elecList,
};
} else {
let stockDOData = Array[7].fill([])
let waterList = {}
return {
stockDOData,
waterList,
gasList,
elecList
};
}
}
function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) { function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
console.log('工厂',targetListResponse);
// console.log('工厂',factoryListResponse); // console.log('工厂',factoryListResponse);
// 初始数据 // 初始数据
@ -209,7 +362,6 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
// 芯片良率 与 标准组件良率 // 芯片良率 与 标准组件良率
if (![0, 1].includes(factory.glassType)) continue; if (![0, 1].includes(factory.glassType)) continue;
const _t = [chipRate, stdRate][factory.glassType] const _t = [chipRate, stdRate][factory.glassType]
console.log('_t',_t);
_t.current[fId] = factory.yieldRate ; _t.current[fId] = factory.yieldRate ;
_t.previous[fId] = factory.previousYearYieldRate ; _t.previous[fId] = factory.previousYearYieldRate ;
} }
@ -223,14 +375,20 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
} }
} }
function splitCurrentAndPrevious(factoryListResponse, targetListResponse) { function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOutputFtoListRes) {
console.log('工厂',factoryListResponse); console.log('prodOutputFtoListRes',prodOutputFtoListRes);
// 初始数据 // 初始数据
const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init(); const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init()
if (prodOutputFtoListRes) {
for (const factory of prodOutputFtoListRes) {
console.log(factory);
const fId = getFactoryId(factory);
ftoInvest.current[fId] = factory.chipInput;
ftoInvest.previous[fId] = factory.previousYearChipInput;
}
}
if (factoryListResponse) { if (factoryListResponse) {
for (const factory of factoryListResponse) { for (const factory of factoryListResponse) {
const fId = getFactoryId(factory); const fId = getFactoryId(factory);
// 获取目标值 // 获取目标值
if (targetListResponse) { if (targetListResponse) {
@ -244,8 +402,11 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse) {
chipInvest.current[fId] = factory.inputNumber; chipInvest.current[fId] = factory.inputNumber;
chipInvest.previous[fId] = factory.previousYearInputNumber; chipInvest.previous[fId] = factory.previousYearInputNumber;
// FTO投入 // FTO投入
ftoInvest.current[fId] = factory.chipInput; // if (factory.chipInput || factory.previousYearChipInput) {
ftoInvest.previous[fId] = factory.previousYearChipInput; // ftoInvest.current[fId] = factory.chipInput;
// ftoInvest.previous[fId] = factory.previousYearChipInput;
// }
// 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出 // 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出
// 因为后端写的垃圾数据,所以这里要做一下判断 // 因为后端写的垃圾数据,所以这里要做一下判断
if (![0, 1, 2].includes(factory.glassType)) continue; if (![0, 1, 2].includes(factory.glassType)) continue;
@ -257,6 +418,7 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse) {
return { return {
chipInvest, chipInvest,
// ftoInvest,
ftoInvest, ftoInvest,
chipOutput, chipOutput,
stdOutput, stdOutput,
@ -407,7 +569,7 @@ function getUrl(copilot_module) {
// 对比数据的 URL // 对比数据的 URL
comparison: "", comparison: "",
// 目标数据的 URL // 目标数据的 URL
target: "", // target: "",
}; };
switch (copilot_module) { switch (copilot_module) {
case "yield": case "yield":
@ -415,6 +577,7 @@ function getUrl(copilot_module) {
// url.target = "/ip/prod-target/query-by-date"; // url.target = "/ip/prod-target/query-by-date";
break; break;
case "energy": case "energy":
url.comparison = "ip/prod-output/cockpitComprehensiveDataMonitor";
break; break;
case "efficiency": case "efficiency":
url.comparison = "ip/prod-output/cockpitDataRate"; url.comparison = "ip/prod-output/cockpitDataRate";

View File

@ -8,33 +8,25 @@
<template> <template>
<chart-container class="bar-chart-base"> <chart-container class="bar-chart-base">
<div class="legend"> <div class="legend">
<span <span v-for="item in legend" :key="item.label" class="legend-item"
v-for="item in legend" :style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span>
:key="item.label"
class="legend-item"
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }"
>{{ item.label }}</span
>
</div> </div>
<div <div ref="chart" :style="{ height: '95%',width: width}"></div>
ref="chart"
style="max-width: 40vw"
:style="{ height: vHeight + 'vh' }"
></div>
</chart-container> </chart-container>
</template> </template>
<script> <script>
import screenfull from "screenfull"; import screenfull from "screenfull";
import ChartContainer from "./ChartContainer.vue"; import ChartContainer from "./ChartContainer.vue";
import chartMixin from "@/mixins/chart.js"; import { debounce } from "@/utils/debounce";
// import chartMixin from "@/mixins/chart.js";
import * as echarts from "echarts";
export default { export default {
name: "BarChartBase", name: "BarChartBase",
components: { components: {
ChartContainer, ChartContainer,
}, },
mixins: [chartMixin], // mixins: [chartMixin],
props: { props: {
vHeight: { vHeight: {
type: Number, type: Number,
@ -59,6 +51,7 @@ export default {
}, },
data() { data() {
return { return {
width: '',
isFullscreen: false, isFullscreen: false,
actualOptions: null, actualOptions: null,
options: { options: {
@ -182,8 +175,26 @@ export default {
}, },
}; };
}, },
computed: {
isOpen() {
return this.$store.getters.sidebar.opened
},
},
watch: { watch: {
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
isOpen(val) {
// console.log(val)
if (val === true) {
console.log('ztl')
this.width = 95 + '%'
this.canvasReset()
console.log(this.width)
} else {
this.watch = 100 + '%'
this.canvasReset()
}
},
isFullscreen(val) { isFullscreen(val) {
this.actualOptions.series.map((item) => { this.actualOptions.series.map((item) => {
item.barWidth = val ? 18 : 12; item.barWidth = val ? 18 : 12;
@ -191,11 +202,26 @@ export default {
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initOptions(this.actualOptions); this.initChart(this.actualOptions);
if (val === false && this.isOpen === true) {
console.log(val)
this.width = 97 + '%'
this.canvasReset()
} else if (val === false && this.isOpen === false) {
this.watch = 100 + '%'
this.canvasReset()
}
// this.actualOptions.series.map((item) => {
// item.barWidth = val ? 18 : 12;
// });
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initChart(this.actualOptions);
}, },
series(val) { series(val) {
if (!val) { if (!val) {
this.initOptions(this.options); this.initChart(this.options);
return; return;
} }
const actualOptions = JSON.parse(JSON.stringify(this.options)); const actualOptions = JSON.parse(JSON.stringify(this.options));
@ -205,18 +231,41 @@ export default {
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.initChart(actualOptions);
}, },
}, },
mounted() { mounted() {
this.actualOptions = this.options;
this.initOptions(this.options);
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.on("change", () => { screenfull.on("change", () => {
this.isFullscreen = screenfull.isFullscreen; this.isFullscreen = screenfull.isFullscreen;
}); });
} }
this.actualOptions = this.options
this.canvasReset();
window.addEventListener("resize", this.canvasReset);
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose();
}
},
destroyed() {
window.removeEventListener("resize", this.canvasReset);
},
methods: {
canvasReset() {
debounce(() => {
this.initChart();
}, 500)();
},
initChart() {
if (this.chart) {
this.chart.dispose();
}
this.chart = echarts.init(this.$refs.chart);
this.chart.setOption(this.actualOptions);
},
}, },
}; };
</script> </script>

View File

@ -62,7 +62,6 @@ export default {
methods: { methods: {
toggleFullScreen() { toggleFullScreen() {
this.isFullscreen = !this.isFullscreen; this.isFullscreen = !this.isFullscreen;
screenfull.toggle(document.querySelector(".copilot-layout")) screenfull.toggle(document.querySelector(".copilot-layout"))
// //
// const el = document.querySelector(".copilot-layout"); // const el = document.querySelector(".copilot-layout");

View File

@ -11,7 +11,7 @@
<span v-for="item in legend" :key="item.label" class="legend-item" <span v-for="item in legend" :key="item.label" class="legend-item"
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span> :style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span>
</div> </div>
<div ref="elsChart" :style="{ height: '100%',width: width}"></div> <div ref="elsChart" :style="{ height: '95%',width: width}"></div>
</chart-container> </chart-container>
</template> </template>
@ -36,12 +36,12 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
xAxis: { // xAxis: {
type: Array, // type: Array,
required: true, // required: true,
}, // },
series: { series: {
type: Array, type: Object,
required: true, required: true,
}, },
in: { in: {
@ -84,19 +84,16 @@ export default {
// }, // },
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '2%',
bottom: '3%', bottom: '3%',
containLabel: true containLabel: true
}, },
xAxis: [ xAxis:{
{
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
} },
], yAxis: {
yAxis: [
{
min: function () { // min: function () { //
return 0 return 0
}, },
@ -143,7 +140,6 @@ export default {
// } // }
// }, // },
}, },
],
series: [ series: [
{ {
name: '瑞昌', name: '瑞昌',
@ -367,22 +363,31 @@ export default {
watch: { watch: {
isOpen(val) { isOpen(val) {
if (val === true) { if (val === true) {
this.width = '99%' this.width = 97 + '%'
this.canvasReset() this.canvasReset()
console.log(this.width) console.log(this.width)
} else { } else {
this.watch = 100 + '%' this.watch = 100 + '%'
this.canvasReset() this.canvasReset()
} }
}, },
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
isFullscreen(val) { isFullscreen(val) {
this.actualOptions.series.map((item) => { if (val === false && this.isOpen === true) {
item.barWidth = val ? 18 : 12; this.width = 97 + '%'
}); this.canvasReset()
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; } else if (val === false && this.isOpen === false) {
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; this.watch = 100 + '%'
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; this.canvasReset()
}
// this.actualOptions.series.map((item) => {
// item.barWidth = val ? 18 : 12;
// });
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initChart(this.actualOptions); this.initChart(this.actualOptions);
}, },
series(val) { series(val) {
@ -391,21 +396,26 @@ export default {
return; return;
} }
const actualOptions = JSON.parse(JSON.stringify(this.options)); const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = val[0].data; actualOptions.xAxis.data = val.times
actualOptions.series[0].name = val[0].name; actualOptions.series[0].data = val[0]
actualOptions.series[1].data = val?.[1]?.data || []; actualOptions.series[1].data = val[1];
actualOptions.series[1].name = val?.[1]?.name || ""; actualOptions.series[2].data = val[2];
actualOptions.series[3].data = val[3];
actualOptions.series[4].data = val[4];
actualOptions.series[5].data = val[5];
actualOptions.series[6].data = val[6];
this.actualOptions = actualOptions; this.actualOptions = actualOptions;
this.initChart(actualOptions); this.initChart(actualOptions);
}, },
}, },
mounted() { mounted() {
// if (screenfull.isEnabled) { if (screenfull.isEnabled) {
// screenfull.on("change", () => { screenfull.on("change", () => {
// this.isFullscreen = screenfull.isFullscreen; this.isFullscreen = screenfull.isFullscreen;
// }); });
// } }
this.actualOptions = this.options this.actualOptions = this.options
this.canvasReset(); this.canvasReset();
window.addEventListener("resize", this.canvasReset); window.addEventListener("resize", this.canvasReset);

View File

@ -11,7 +11,7 @@
<span v-for="item in legend" :key="item.label" class="legend-item" <span v-for="item in legend" :key="item.label" class="legend-item"
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span> :style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span>
</div> </div>
<div ref="waterChart" :style="{ height: '100%',width: width}"></div> <div ref="waterChart" :style="{ height: '95%',width: width}"></div>
</chart-container> </chart-container>
</template> </template>
@ -36,12 +36,12 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
xAxis: { // xAxis: {
type: Array, // type: Array,
required: true, // required: true,
}, // },
series: { series: {
type: Array, type: Object,
required: true, required: true,
}, },
in: { in: {
@ -56,8 +56,8 @@ export default {
actualOptions: null, actualOptions: null,
options: { options: {
grid: { grid: {
left: "1%", left: "3%",
right: "4%", right: "2%",
bottom: "3%", bottom: "3%",
top: "15%", top: "15%",
containLabel: true, containLabel: true,
@ -88,15 +88,12 @@ export default {
bottom: '3%', bottom: '3%',
containLabel: true containLabel: true
}, },
xAxis: [ xAxis:{
{
type: 'category', type: 'category',
boundaryGap: false, // boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: []
} },
], yAxis: {
yAxis: [
{
min: function () { // min: function () { //
return 0 return 0
}, },
@ -143,7 +140,6 @@ export default {
// } // }
// }, // },
}, },
],
series: [ series: [
{ {
name: '瑞昌', name: '瑞昌',
@ -173,7 +169,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
{ {
name: '邯郸', name: '邯郸',
@ -203,7 +199,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
{ {
name: '株洲', name: '株洲',
@ -233,7 +229,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
{ {
name: '佳木斯', name: '佳木斯',
@ -263,7 +259,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
{ {
name: '成都', name: '成都',
@ -293,7 +289,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
{ {
name: '凯盛', name: '凯盛',
@ -323,7 +319,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
{ {
name: '蚌埠', name: '蚌埠',
@ -353,7 +349,7 @@ export default {
// emphasis: { // emphasis: {
// focus: 'series' // focus: 'series'
// }, // },
data: [120, 132, 101, 134, 90, 230, 210] data: []
}, },
] ]
}, },
@ -364,8 +360,9 @@ export default {
// console.log(val) // console.log(val)
if (val === true) { if (val === true) {
console.log('ztl') console.log('ztl')
this.width = '99%' this.width = 97 + '%'
this.canvasReset() this.canvasReset()
console.log(this.width) console.log(this.width)
} else { } else {
this.watch = 100 + '%' this.watch = 100 + '%'
@ -374,15 +371,20 @@ export default {
}, },
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
isFullscreen(val) { isFullscreen(val) {
if (val === true && this.isOpen === true) { if (val === false && this.isOpen === true) {
this.width = '99%' console.log(val)
this.width = 97 + '%'
this.canvasReset()
} else if(val === false && this.isOpen === false) {
this.watch = 100 + '%'
this.canvasReset()
} }
this.actualOptions.series.map((item) => { // this.actualOptions.series.map((item) => {
item.barWidth = val ? 18 : 12; // item.barWidth = val ? 18 : 12;
}); // });
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; // this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initChart(this.actualOptions); this.initChart(this.actualOptions);
}, },
series(val) { series(val) {
@ -390,11 +392,22 @@ export default {
this.initChart(this.options); this.initChart(this.options);
return; return;
} }
const actualOptions = JSON.parse(JSON.stringify(this.options)); const actualOptions = JSON.parse(JSON.stringify(this.options))
actualOptions.series[0].data = val[0].data; // console.log(actualOptions)
actualOptions.series[0].name = val[0].name; actualOptions.xAxis.data = val.times
actualOptions.series[1].data = val?.[1]?.data || []; // actualOptions.series.forEach((ele,index) => {
actualOptions.series[1].name = val?.[1]?.name || ""; // ele.data = val.index
// })
actualOptions.series[0].data = val[0]
actualOptions.series[1].data = val[1];
actualOptions.series[2].data = val[2];
actualOptions.series[3].data = val[3];
actualOptions.series[4].data = val[4];
actualOptions.series[5].data = val[5];
actualOptions.series[6].data = val[6];
// actualOptions.series[1].data = val?.[1]?.data || [];
// actualOptions.series[1].name = val?.[1]?.name || "";
this.actualOptions = actualOptions; this.actualOptions = actualOptions;
this.initChart(actualOptions); this.initChart(actualOptions);
}, },

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-13 14:08:51 * @Date: 2024-05-13 14:08:51
* @LastEditTime: 2024-05-14 08:46:07 * @LastEditTime: 2024-05-17 09:37:01
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -12,7 +12,7 @@
<!-- <span v-for="item in legend" :key="item.label" class="legend-item" <!-- <span v-for="item in legend" :key="item.label" class="legend-item"
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span> --> :style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span> -->
</div> </div>
<div ref="gasChart" :style="{ height: '100%',width: width}"></div> <div ref="gasChart" :style="{ height: '95%',width: width}"></div>
</chart-container> </chart-container>
</template> </template>
@ -33,22 +33,22 @@ export default {
type: Number, type: Number,
default: 38, default: 38,
}, },
legend: { // legend: {
type: Array, // type: Array,
required: false, // required: false,
}, // },
xAxis: { xAxis: {
type: Array, type: Array,
required: true, required: true,
}, },
series: { series: {
type: Array, type: Array,
required: true, required: false,
},
in: {
type: String,
default: "",
}, },
// in: {
// type: String,
// default: "",
// },
}, },
data() { data() {
return { return {
@ -57,8 +57,8 @@ export default {
actualOptions: null, actualOptions: null,
options: { options: {
grid: { grid: {
left: "1%", left: "3%",
right: "4%", right: "2%",
bottom: "3%", bottom: "3%",
top: "15%", top: "15%",
containLabel: true, containLabel: true,
@ -140,38 +140,38 @@ export default {
}, },
data: [], // this.series[0].data, data: [], // this.series[0].data,
}, },
{ // {
name: "", // this.series[1].name, // name: "", // this.series[1].name,
type: "bar", // type: "bar",
barWidth: 12, // barWidth: 12,
// tooltip: { // // tooltip: {
// valueFormatter: function (value) { // // valueFormatter: function (value) {
// return value + " ml"; // // return value + " ml";
// // },
// // },
// itemStyle: {
// borderRadius: [10, 10, 0, 0],
// color: {
// type: "linear",
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// colorStops: [
// {
// offset: 0,
// color: "#57abf8", // 0%
// },
// {
// offset: 1,
// color: "#364BFE66", // 100%
// },
// ],
// global: false, // false
// }, // },
// }, // },
itemStyle: { // data: [], // this.series[1].data,
borderRadius: [10, 10, 0, 0], // },
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#57abf8", // 0%
},
{
offset: 1,
color: "#364BFE66", // 100%
},
],
global: false, // false
},
},
data: [], // this.series[1].data,
},
], ],
}, },
}; };
@ -185,39 +185,44 @@ export default {
isOpen(val) { isOpen(val) {
// console.log(val) // console.log(val)
if (val === true) { if (val === true) {
console.log('ryf') this.width = 97 + '%'
this.width = '99%'
this.canvasReset() this.canvasReset()
console.log(this.width) console.log(this.width)
} else { } else {
console.log('ryf')
this.watch = 100 + '%' this.watch = 100 + '%'
this.canvasReset() this.canvasReset()
} }
}, },
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
isFullscreen(val) { isFullscreen(val) {
if (val === true && this.isOpen === true) { if (val === false && this.isOpen === true) {
this.width = '99%' this.width = 97 + '%'
this.canvasReset()
} else if (val === false && this.isOpen === false) {
this.watch = 100 + '%'
this.canvasReset()
} }
this.actualOptions.series.map((item) => { // this.actualOptions.series.map((item) => {
item.barWidth = val ? 18 : 12; // item.barWidth = val ? 18 : 12;
}); // });
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; // this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initOptions(this.actualOptions); this.initChart(this.actualOptions);
}, },
series(val) { series(val) {
if (!val) { if (!val) {
this.initOptions(this.options); this.initChart(this.options);
return; return;
} }
const actualOptions = JSON.parse(JSON.stringify(this.options)); const actualOptions = JSON.parse(JSON.stringify(this.options));
console.log('actualOptions', this.options) console.log('actualOptions', this.options)
actualOptions.series[0].data = val[0].data; actualOptions.series[0].data = val;
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.initChart(actualOptions); this.initChart(actualOptions);
}, },

View File

@ -7,7 +7,8 @@
--> -->
<template> <template>
<div class="copilot-layout" ref="copilot-layout" :class="[ page== '产量' ? 'produce': 'other' ]"> <!-- <div class="copilot-layout" ref="copilot-layout"> -->
<div class="copilot-layout" ref="copilot-layout" :class="[page == '效率' ? 'other' : 'produce' ]">
<CopilotHeaderVue :active="page" :period="period" @update:active="page = $event" @update:period="period = $event" /> <CopilotHeaderVue :active="page" :period="period" @update:active="page = $event" @update:period="period = $event" />
<YieldCopilot v-if="page == '产量'" :period="period" /> <YieldCopilot v-if="page == '产量'" :period="period" />
@ -71,6 +72,7 @@ export default {
position: absolute; position: absolute;
left: -16px; left: -16px;
/* top: -8px; */ /* top: -8px; */
/* height: calc(100% + 38px); */
width: calc(100% + 30px); width: calc(100% + 30px);
z-index: 1001; z-index: 1001;
color: #fff; color: #fff;
@ -83,7 +85,7 @@ export default {
height: calc(100% + 38px); height: calc(100% + 38px);
} }
.other { .other {
height: 100vh + 50px; height: calc(100% + 240px);
} }
.copilot-footer { .copilot-footer {
/** position: absolute; /** position: absolute;

View File

@ -110,4 +110,6 @@ function getTemplate(period, dataList) {
} }
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss">
</style>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 10:25:10 * @Date: 2024-05-07 10:25:10
* @LastEditTime: 2024-05-11 14:51:07 * @LastEditTime: 2024-05-20 10:04:03
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -11,7 +11,7 @@
<div class="span-2"> <div class="span-2">
<StdRateItem :period="period" :city="cities[5]" /> <StdRateItem :period="period" :city="cities[5]" />
</div> </div>
<div v-for="item in cities.filter((val, index) => index != 5)" :key="item.name"> <div class="flex-item" v-for="item in cities.filter((val, index) => index != 5)" :key="item.name">
<StdRateItem :period="period" :city="item" /> <StdRateItem :period="period" :city="item" />
</div> </div>
</div> </div>
@ -97,13 +97,22 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.std-rate { .std-rate {
display: grid; display: flex;
gap: 8px; // gap: 1px;
grid-template-columns: repeat(2, 1fr); flex: 1 1 auto;
grid-template-rows: repeat(4, 1fr);
}
// display: -webkit-box;
flex-wrap: wrap;
align-items: center;
// grid-template-columns: repeat(2, 1fr);
// grid-template-rows: repeat(4, 1fr);
}
.flex-item{
// flex: 1 1 auto;
width: 50%;
}
.span-2 { .span-2 {
grid-column: span 2; // flex: 1 1 auto;
flex-basis: 100%;
} }
</style> </style>

View File

@ -145,6 +145,7 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.chip-rate-item { .chip-rate-item {
flex: 1; flex: 1;
display: flex; display: flex;
@ -153,17 +154,20 @@ export default {
justify-content: center; justify-content: center;
gap: 3px; gap: 3px;
backdrop-filter: blur(24px); backdrop-filter: blur(24px);
.cities { .cities {
height: 40px; height: 40px;
} }
.chart { .chart {
width: 390px; // margin-left: 5%;
// width: 290px;
align-self: stretch; align-self: stretch;
height: 280px; // flex: 1 1 auto;
// padding: 0 10%;
/* margin: 10%; */
/* min-width: 300px; */
height: 200px;
} }
.legend { .legend {
height: 80px; height: 80px;
display: flex; display: flex;

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 10:25:10 * @Date: 2024-05-07 10:25:10
* @LastEditTime: 2024-05-11 15:05:17 * @LastEditTime: 2024-05-20 09:46:19
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -109,15 +109,16 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
flex: 1 1 auto;
padding: 12px; padding: 12px;
} }
.std-rate-item__value { .std-rate-item__value {
flex: 1; flex: 1 1 auto;
margin: 6px; margin: 6px;
display: flex; display: flex;
gap: 12px; gap: 12px;
height: 60px; // height: auto;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 10:04:53 * @Date: 2024-05-07 10:04:53
* @LastEditTime: 2024-05-09 08:56:44 * @LastEditTime: 2024-05-17 17:05:36
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->

View File

@ -85,48 +85,25 @@ export default {
// } // }
// }, // },
series() { series() {
const { ftoInvest } = this.$store.getters.copilot.yield; return this.$store.getters.copilot.energy.elecList;
let dataList = null; // let dataList = null;
switch (this.period) { // switch (this.period) {
case "日": // case "":
case "周": // case "":
dataList = ftoInvest?.current; // dataList = ftoInvest?.current;
break; // break;
default: // default:
dataList = []; // dataList = [];
dataList[0] = ftoInvest?.pervious; // dataList[0] = ftoInvest?.pervious;
dataList[1] = ftoInvest?.current; // dataList[1] = ftoInvest?.current;
} // }
return getTemplate(this.period, dataList); // return getTemplate(this.period, dataList);
}, },
}, },
methods: {}, methods: {},
}; };
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>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,3 +1,11 @@
<!--
* @Author: zhp
* @Date: 2024-05-14 08:48:34
* @LastEditTime: 2024-05-17 09:42:41
* @LastEditors: zhp
* @Description:
-->
<!-- <!--
filename: NatGas.vue filename: NatGas.vue
author: liubin author: liubin
@ -30,81 +38,37 @@ export default {
// //
const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"]; const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
return { return {
// series: [],
xAxis: cities, xAxis: cities,
}; };
}, },
computed: { // watch: {
// legend() { // period() {
// switch (this.period) { // this.series = this.$store.getters.copilot.energy.stockDOData;
// case "":
// return [{ label: "", color: "#12f7f1" }];
// case "":
// return [{ label: "", color: "#12f7f1" }];
// case "": {
// const year = new Date().getFullYear();
// const month = new Date().getMonth() + 1;
// return [
// { label: `${year - 1}${month}`, color: "#12f7f1" },
// { label: `${year}${month}`, color: "#58adfa" },
// ];
// }
// case "": {
// const year = new Date().getFullYear();
// return [
// { label: `${year - 1}`, color: "#12f7f1" },
// { label: `${year}`, color: "#58adfa" },
// ];
// }
// default:
// return [
// { label: `${year - 1}`, color: "#12f7f1" },
// { label: `${year}`, color: "#58adfa" },
// ];
// } // }
// }, // },
computed: {
series() { series() {
const { ftoInvest } = this.$store.getters.copilot.yield; console.log('this.$store.getters.copilot.energy.gasList', this.$store.getters.copilot.energy.gasList);
let dataList = null; return this.$store.getters.copilot.energy.gasList;
// let dataList = null;
// let dataList = gasList
// switch (this.period) {
// case "":
// case "":
// dataList = ftoInvest?.current;
// break;
// default:
// dataList = [];
// dataList[0] = ftoInvest?.pervious;
// dataList[1] = ftoInvest?.current;
// }
switch (this.period) { // return gasList
case "日":
case "周":
dataList = ftoInvest?.current;
break;
default:
dataList = [];
dataList[0] = ftoInvest?.pervious;
dataList[1] = ftoInvest?.current;
}
return getTemplate(this.period, dataList);
}, },
}, },
methods: {}, methods: {},
}; };
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>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,18 +1,15 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 10:25:10 * @Date: 2024-05-07 10:25:10
* @LastEditTime: 2024-05-08 09:39:15 * @LastEditTime: 2024-05-17 10:34:51
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<div class="stock-monitor"> <div class="stock-monitor">
<MonitorItem <MonitorItem :cities="['成都', '邯郸', '株洲', '瑞昌', '佳木斯']" :stockDOData="stockDOData" />
:cities="['成都', '邯郸', '株洲', '瑞昌', '佳木斯']" <MonitorItem :cities="['凯盛光伏', '蚌埠兴科']" :stockDOData="stockDOData" />
:legendList="dhgList"
/>
<MonitorItem :cities="['凯盛光伏', '蚌埠兴科']" :legendList="otherList" />
</div> </div>
</template> </template>
@ -22,23 +19,33 @@ import MonitorItemVue from "./sub/monitor/MonitorItem.vue";
export default { export default {
name: "StockMonitor", name: "StockMonitor",
components: { MonitorItem: MonitorItemVue }, components: { MonitorItem: MonitorItemVue },
props: {}, props: {
stockDOData: {
type: Array,
default: [],
},
},
data() { data() {
return { return {
dhgList: [ // dhgList: [
{ name: "总库存", value: 1000 }, // { name: "", value: 1000 },
{ name: "已用库存", value: 500 }, // { name: "", value: 500 },
{ name: "剩余库存", value: 500 }, // { name: "", value: 500 },
], // ],
otherList: [ // otherList: [
{ name: "分类1", value: 1000 }, // { name: "1", value: 1000 },
{ name: "分类2", value: 1000 }, // { name: "2", value: 1000 },
{ name: "分类3", value: 1000 }, // { name: "3", value: 1000 },
{ name: "分类4", value: 1000 }, // { name: "4", value: 1000 },
], // ],
}; };
}, },
computed: {}, computed: {
dhgList() {
console.log(this.stockDOData);
// console.log()
}
},
methods: {}, methods: {},
}; };
</script> </script>

View File

@ -85,48 +85,13 @@ export default {
// } // }
// }, // },
series() { series() {
const { ftoInvest } = this.$store.getters.copilot.yield; console.log('this.$store.getters.copilot.energy.waterList', this.$store.getters.copilot.energy.waterList.times);
let dataList = null; return this.$store.getters.copilot.energy.waterList
// return getTemplate(this.period, dataList);
switch (this.period) {
case "日":
case "周":
dataList = ftoInvest?.current;
break;
default:
dataList = [];
dataList[0] = ftoInvest?.pervious;
dataList[1] = ftoInvest?.current;
}
return getTemplate(this.period, dataList);
}, },
}, },
methods: {}, methods: {},
}; };
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>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -10,16 +10,16 @@
<div class="cities"> <div class="cities">
<CopilotButtons :options="cities" @update:active="handleCityUpdate" /> <CopilotButtons :options="cities" @update:active="handleCityUpdate" />
</div> </div>
<div style="padding: 0 30px;width: 90%;"> <!-- <div style="width: 90%;"> -->
<div class="chart" ref="chart"></div> <div class="chart" ref="chart"></div>
</div> <!-- </div> -->
<div class="legend" v-if="1"> <div class="legend" v-if="1">
<div class="legend-item" v-for="(lgd,index) in legendList" :key="lgd.name"> <div class="legend-item" v-for="(lgd, index) in legendList" :key="lgd.name">
<div> <div>
<span :style="'backgroundColor:' + colors[index%5]" class="legend-item__chart"></span> <span :style="'backgroundColor:' + colors[index % 5]" class="legend-item__chart"></span>
<span :style="'color:' + colors[index%5]" class="legend-item__label">{{ lgd.name }}</span> <span :style="'color:' + colors[index % 5]" class="legend-item__label">{{ lgd.name }}</span>
</div> </div>
<div :style="'color:' + colors[index%5]" class="legend-item__value">{{ lgd.value }}</div> <div :style="'color:' + colors[index % 5]" class="legend-item__value">{{ lgd.value }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -40,10 +40,10 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
legendList: { // legendList: {
type: Array, // type: Array,
default: () => [], // default: () => [],
}, // },
color: { color: {
type: Number, type: Number,
default: 1, default: 1,
@ -52,42 +52,95 @@ export default {
data() { data() {
return { return {
period: "月", period: "月",
colors:['#2760FF', '#5996F7', '#8BC566', '#11FAF0', '#F3C000'], factoryId: 0,
valueTuple: [100, 100, 200], // legendList:[],
colors: ['#2760FF', '#5996F7', '#8BC566', '#11FAF0', '#F3C000'],
// valueTuple: [100, 100, 200],
}; };
}, },
computed: { computed: {
data() {
console.log('ztl', this.$store.getters.copilot.energy.gasList)
return this.$store.getters.copilot.energy.stockDOData
},
valueTuple() {
return this.data[this.factoryId]
},
legendList() {
// if (this.valueTuple) {
// if (this.valueTuple.length == 0) {
return this.valueTuple
// } else {
// return []
// }
// console.log(this.valueTuple)
// } else {
// return []
// }
},
options() { options() {
const year = new Date().getFullYear(); // const year = new Date().getFullYear();
const month = new Date().getMonth() + 1; // const month = new Date().getMonth() + 1;
let arr = [] let arr = []
let titleValue = ''
if (this.legendList != 0) {
this.legendList.forEach(ele => { this.legendList.forEach(ele => {
arr.push(ele.value) arr.push(ele.value)
}); });
let vt = arr let vt = arr
console.log(arr) titleValue = vt.reduce(function (prev, cur, index, arr) {
let titleValue = vt.reduce(function (prev, cur, index, arr) {
return prev + cur return prev + cur
}) })
let subtitle = `总计/片`; } else {
titleValue = ''
// this.legendList = []
}
let subtitle = `总计/片`;
return getOptions({ return getOptions({
single: true, // single: true,
color: this.color == 1 ? "#4CF0E8" : "#1065ff", // color: this.color == 1 ? "#4CF0E8" : "#1065ff",
titleValue, titleValue,
subtitle, subtitle,
dataList:this.legendList, dataList: this.data[this.factoryId],
previousSum: this.valueTuple[0], // previousSum: this.valueTuple[0],
currentSum: this.valueTuple[1], // currentSum: this.valueTuple[1],
targetSum: this.valueTuple[2], // targetSum: this.valueTuple[2],
}); });
}, },
}, },
watch: {
period() {
this.initOptions(this.options);
},
legendList() {
this.initOptions(this.options);
},
factoryId(newVal, oldVal) {
console.log(newVal);
// if (newVal) {
// this.legendList = this.data[newVal]
// if ( == 0) {
// this.initOptions(this.options)
// }
// console.log(this.valueTuple.length)
// console.log(this.options)
this.initOptions(this.options)
// }
},
// chipRate() {
// this.initOptions(this.options);
// },
},
mounted() { mounted() {
// console.log(this.legendList)
this.initOptions(this.options); this.initOptions(this.options);
}, },
methods: { methods: {
handleCityUpdate() {}, handleCityUpdate(id) {
console.log(id)
this.factoryId = id;
},
fullscreenCallback(isFullscreen) { fullscreenCallback(isFullscreen) {
console.log("isFullscreen--->", isFullscreen); console.log("isFullscreen--->", isFullscreen);
}, },
@ -110,10 +163,14 @@ export default {
} }
.chart { .chart {
margin-left: 5%; // margin-left: 5%;
width: 290px; // width: 290px;
align-self: stretch; align-self: stretch;
height: 280px; flex: 1 1 auto;
// padding: 0 10%;
/* margin: 10%; */
/* min-width: 300px; */
height: 0;
} }
.legend { .legend {
@ -132,7 +189,8 @@ export default {
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: 3px; gap: 3px;
.legend-item__chart{
.legend-item__chart {
display: inline-block; display: inline-block;
width: 14px; width: 14px;
height: 14px; height: 14px;
@ -140,9 +198,11 @@ export default {
border-radius: 2px; border-radius: 2px;
// margin-right: 8px; // margin-right: 8px;
} }
.legend-item__label { .legend-item__label {
margin-left: 8px; margin-left: 8px;
} }
// } // }
} }
@ -152,4 +212,3 @@ export default {
} }
} }
</style> </style>
l

View File

@ -1,25 +1,29 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 10:25:10 * @Date: 2024-05-07 10:25:10
* @LastEditTime: 2024-05-13 15:48:10 * @LastEditTime: 2024-05-16 15:31:20
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<div class="energy-copilot"> <div class="energy-copilot">
<section class="top flex">
<Container title="仓库监控·当前" icon="ware"> <Container title="仓库监控·当前" icon="ware">
<StockMonitorVue :period="period" /> <StockMonitorVue :stockDOData="stockDOData" :period="period" />
</Container> </Container>
<Container title="天然气能耗" icon="gas"> <Container title="天然气能耗" icon="gas">
<NatGasVue :period="period" /> <NatGasVue :period="period" />
</Container> </Container>
</section>
<section class="bottom flex">
<Container title="电能耗" icon="flash"> <Container title="电能耗" icon="flash">
<ElecCostVue :period="period" /> <ElecCostVue :period="period" />
</Container> </Container>
<Container title="水能耗" icon="water"> <Container title="水能耗" icon="water">
<WaterCostVue :period="period" /> <WaterCostVue :period="period" />
</Container> </Container>
</section>
</div> </div>
</template> </template>
@ -29,7 +33,6 @@ import StockMonitorVue from "./components/StockMonitor.vue";
import ElecCostVue from "./components/ElecCost.vue"; import ElecCostVue from "./components/ElecCost.vue";
import NatGasVue from "./components/NatGas.vue"; import NatGasVue from "./components/NatGas.vue";
import WaterCostVue from "./components/WaterCost.vue"; import WaterCostVue from "./components/WaterCost.vue";
export default { export default {
name: "EnergyCopilot", name: "EnergyCopilot",
components: { components: {
@ -46,7 +49,9 @@ export default {
}, },
}, },
data() { data() {
return {}; return {
stockDOData:[],
};
}, },
watch: { watch: {
period: { period: {
@ -61,11 +66,16 @@ export default {
fetchData(period = "日") { fetchData(period = "日") {
// console.log(this.width); // console.log(this.width);
// console.log('sidebar', this.$store.getters.sidebar); // console.log('sidebar', this.$store.getters.sidebar);
console.log(`效率驾驶舱,获取${period}数据`); console.log(`综合驾驶舱,获取${period}数据`);
// this.getData(this.period)
this.$store.dispatch("copilot/initCopilot", { this.$store.dispatch("copilot/initCopilot", {
period, period,
source: "comprehensive", source: "energy",
}); });
// this.$store.dispatch("copilot/initCopilot", {
// period,
// source: "comprehensive",
// });
}, },
}, },
}; };
@ -74,13 +84,19 @@ export default {
<style scoped> <style scoped>
.energy-copilot { .energy-copilot {
flex: 1; flex: 1;
display: grid; display: flex;
flex-direction: column;
gap: 16px; gap: 16px;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
} }
.energy-copilot > div { .flex {
display: flex;
gap: 16px;
flex: 1;
}
.top>div,
.bottom>div {
height: 100%; height: 100%;
} }
</style> </style>

View File

@ -1,19 +1,16 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 10:25:10 * @Date: 2024-05-07 10:25:10
* @LastEditTime: 2024-05-10 16:10:49 * @LastEditTime: 2024-05-16 13:35:50
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */
export default function ({ export default function ({
single = false, // single = false,
colors = ['#2760FF', '#5996F7', '#8BC566', '#11FAF0','#F3C000'], colors = ['#2760FF', '#5996F7', '#8BC566', '#11FAF0','#F3C000'],
titleValue, titleValue,
subtitle, subtitle,
dataList, dataList,
previousSum,
currentSum,
targetSum,
}) { }) {
return { return {
grid: { grid: {
@ -26,7 +23,7 @@ export default function ({
// tooltip: {}, // tooltip: {},
title: { title: {
text: titleValue, text: titleValue,
left: "49%", left: "47%",
top: "39%", top: "39%",
textAlign: "center", textAlign: "center",
textStyle: { textStyle: {
@ -50,7 +47,7 @@ export default function ({
{ {
name: 'Access From', name: 'Access From',
type: 'pie', type: 'pie',
// center: ['50%', '40%'], center: ['50%', '50%'],
radius: ['50%', '80%'], radius: ['50%', '80%'],
avoidLabelOverlap: false, avoidLabelOverlap: false,
labelLine: { labelLine: {
@ -62,7 +59,6 @@ export default function ({
data: dataList && dataList.length > 0 && dataList.map((item, index) => ({ data: dataList && dataList.length > 0 && dataList.map((item, index) => ({
name:item.name, name:item.name,
value: item.value, value: item.value,
itemStyle:{ itemStyle:{
color:{ color:{
type: 'linear', type: 'linear',

View File

@ -65,6 +65,7 @@ export default {
}, },
series() { series() {
const { ftoInvest } = this.$store.getters.copilot.yield; const { ftoInvest } = this.$store.getters.copilot.yield;
console.log('ftoInvest', this.$store.getters.copilot.yield);
let dataList = null; let dataList = null;
switch (this.period) { switch (this.period) {

View File

@ -7,9 +7,9 @@
<template> <template>
<div class="double-ring-chart"> <div class="double-ring-chart">
<div class="double-ring-chart__container"> <!-- <div> -->
<div ref="chart" style="height: 90%;"></div> <div ref="chart" class="double-ring-chart__container"></div>
</div> <!-- </div> -->
<!-- style="{ height: vHeight + 'vh' }" --> <!-- style="{ height: vHeight + 'vh' }" -->
<div class="double-ring-chart__legend"> <div class="double-ring-chart__legend">
<div v-for="item in legendItems" :key="item.label" class="legend-item"> <div v-for="item in legendItems" :key="item.label" class="legend-item">
@ -22,12 +22,12 @@
<script> <script>
import chartMixin from "@/mixins/chart.js"; import chartMixin from "@/mixins/chart.js";
import fullscreenMixin from "@/mixins/fullscreen.js"; import screenfull from "screenfull";
import getOptions from "../../../options/double-ring-chart-options"; import getOptions from "../../../options/double-ring-chart-options";
export default { export default {
name: "DoubleRingChart", name: "DoubleRingChart",
mixins: [chartMixin, fullscreenMixin], mixins: [chartMixin],
props: { props: {
vHeight: { vHeight: {
type: Number, type: Number,
@ -47,7 +47,9 @@ export default {
}, },
}, },
data() { data() {
return {}; return {
isFullscreen: false,
};
}, },
filters: { filters: {
numberFilter(val) { numberFilter(val) {
@ -111,18 +113,32 @@ export default {
}, },
}, },
watch: { watch: {
isFullscreen(val) {
// this.actualOptions.series.map((item) => {
// item.barWidth = val ? 18 : 12;
// });
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initOptions(this.options)
},
legendItems() { legendItems() {
this.initOptions(this.options); this.initOptions(this.options);
}, },
}, },
mounted() { mounted() {
this.initOptions(this.options); this.initOptions(this.options);
if (screenfull.isEnabled) {
screenfull.on("change", () => {
this.isFullscreen = screenfull.isFullscreen;
});
}
}, },
methods: { methods: {
// fullscreen mixin // fullscreen mixin
fullscreenCallback(isFullscreen) { // fullscreenCallback(isFullscreen) {
console.log("isFullscreen--->", isFullscreen); // console.log("isFullscreen--->", isFullscreen);
}, // },
}, },
}; };
@ -171,7 +187,7 @@ function calculateItems(period, valueTuple) {
} }
.double-ring-chart__container { .double-ring-chart__container {
flex:1; flex:1 1 auto;
padding: 0 10%; padding: 0 10%;
/* margin: 10%; */ /* margin: 10%; */
/* min-width: 300px; */ /* min-width: 300px; */

View File

@ -42,9 +42,11 @@ export default {
}, },
mounted() { mounted() {
this.getTimes() this.getTimes()
this.getWeather()
this.getTimesInterval()
this.weatherInterval = setInterval(() => { this.weatherInterval = setInterval(() => {
this,this.getWeather() this.getWeather()
}, 1000) }, 1800000)
}, },
destroyed() { destroyed() {
// console.log(1111) // console.log(1111)
@ -52,9 +54,9 @@ export default {
}, },
methods: { methods: {
getTimes() { getTimes() {
setInterval(this.getTimesInterval, 1000); setInterval(this.getTimesInterval, 60000);
}, },
getTimesInterval: function () { getTimesInterval() {
var now = new Date(); var now = new Date();
var weekDay = now.getDay(); var weekDay = now.getDay();
var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");