工厂驾驶舱样式

This commit is contained in:
朱菊兰 2024-05-09 18:35:12 +08:00
parent bfa8a73423
commit 3765db0611
3 changed files with 105 additions and 52 deletions

View File

@ -9,19 +9,14 @@
>{{ item.label }}</span >{{ item.label }}</span
> >
</div> </div>
<div <div id="factoryEnergyChart" style="width: 100%; height: 100%"></div>
ref="chart"
style="width: 100%"
:style="{ height: vHeight + 'vh' }"
></div>
</div> </div>
</template> </template>
<script> <script>
import chartMixin from "@/mixins/chart.js"; import { debounce } from "@/utils/debounce";
import * as echarts from "echarts"; import * as echarts from "echarts";
export default { export default {
name: "Energy", name: "Energy",
mixins: [chartMixin],
props: { props: {
vHeight: { vHeight: {
type: Number, type: Number,
@ -44,6 +39,7 @@ export default {
return { return {
isFullscreen: false, isFullscreen: false,
actualOptions: null, actualOptions: null,
chart: "",
options: { options: {
color: ["#FFD160", "#2760FF", "#12FFF5"], color: ["#FFD160", "#2760FF", "#12FFF5"],
grid: { grid: {
@ -205,49 +201,67 @@ export default {
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
// this.initOptions(this.actualOptions); // this.initOptions(this.actualOptions);
// }, // },
series(val) { // series(val) {
if (!val) { // if (!val) {
this.initOptions(this.options); // this.initOptions(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; // 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;
actualOptions.series[2].data = val[2].data; // actualOptions.series[2].data = val[2].data;
actualOptions.series[2].name = val[2].name; // actualOptions.series[2].name = val[2].name;
this.actualOptions = actualOptions; // this.actualOptions = actualOptions;
this.initOptions(actualOptions); // this.initOptions(actualOptions);
}, // },
}, },
mounted() { mounted() {
console.log("00000000000000000000");
const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = this.series[0].data;
actualOptions.series[0].name = this.series[0].name;
actualOptions.series[1].data = this.series[1].data;
actualOptions.series[1].name = this.series[1].name;
actualOptions.series[2].data = this.series[2].data;
actualOptions.series[2].name = this.series[2].name;
this.actualOptions = actualOptions;
console.log(actualOptions);
console.log("1111111111");
this.initOptions(actualOptions);
// 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.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(document.getElementById("factoryEnergyChart"));
const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = this.series[0].data;
actualOptions.series[0].name = this.series[0].name;
actualOptions.series[1].data = this.series[1].data;
actualOptions.series[1].name = this.series[1].name;
actualOptions.series[2].data = this.series[2].data;
actualOptions.series[2].name = this.series[2].name;
this.actualOptions = actualOptions;
this.chart.setOption(actualOptions);
},
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.left-chart-base { .left-chart-base {
// position: relative; // position: relative;
height: 100%;
.legend { .legend {
position: absolute; position: absolute;

View File

@ -1,11 +1,17 @@
<template> <template>
<dv-scroll-board :config="config" style="width: 100%; height: 100%" /> <dv-scroll-board
v-if="aa"
:config="config"
style="width: 100%; height: 100%"
/>
</template> </template>
<script> <script>
import { debounce } from "@/utils/debounce";
export default { export default {
name: "Order", name: "Order",
data() { data() {
return { return {
aa: true,
config: { config: {
header: ["序号", "客户名称", "产品名称", "计划加工数量", "加工进度"], header: ["序号", "客户名称", "产品名称", "计划加工数量", "加工进度"],
headerBGC: "rgba(0, 106, 205, 0.22)", headerBGC: "rgba(0, 106, 205, 0.22)",
@ -41,5 +47,20 @@ export default {
}, },
}; };
}, },
mounted() {
this.tableReset();
window.addEventListener("resize", this.tableReset);
},
methods: {
tableReset() {
this.aa = false;
debounce(() => {
this.initTable();
}, 500)();
},
initTable() {
this.aa = true;
},
},
}; };
</script> </script>

View File

@ -1,15 +1,11 @@
<template> <template>
<div <div id="factoryStoreChart" style="width: 100%; height: 100%"></div>
ref="chart"
style="width: 100%"
:style="{ height: vHeight + 'vh' }"
></div>
</template> </template>
<script> <script>
import chartMixin from "@/mixins/chart.js"; import { debounce } from "@/utils/debounce";
import * as echarts from "echarts";
export default { export default {
name: "Store", name: "Store",
mixins: [chartMixin],
props: { props: {
vHeight: { vHeight: {
type: Number, type: Number,
@ -28,6 +24,7 @@ export default {
return { return {
isFullscreen: false, isFullscreen: false,
actualOptions: null, actualOptions: null,
chart: "",
options: { options: {
grid: { grid: {
left: "3%", left: "3%",
@ -134,18 +131,39 @@ export default {
}, },
}, },
mounted() { mounted() {
console.log("store");
const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = this.series[0].data;
actualOptions.series[0].name = this.series[0].name;
this.actualOptions = actualOptions;
this.initOptions(actualOptions);
// if (screenfull.isEnabled) { // if (screenfull.isEnabled) {
// screenfull.on("change", () => { // screenfull.on("change", () => {
// this.isFullscreen = screenfull.isFullscreen; // this.isFullscreen = screenfull.isFullscreen;
// }); // });
// } // }
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(document.getElementById("factoryStoreChart"));
const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = this.series[0].data;
actualOptions.series[0].name = this.series[0].name;
this.actualOptions = actualOptions;
this.chart.setOption(actualOptions);
},
}, },
}; };
</script> </script>