Compare commits

..

No commits in common. "3d765b40261503a11d6309d601abb5b9018e9f0c" and "d78e93b49446650bc30e492792b72a0e5efab457" have entirely different histories.

17 changed files with 95 additions and 279 deletions

View File

@ -7,11 +7,11 @@ import { useWsStore } from "./store";
const store = useWsStore(); const store = useWsStore();
// use websocket // use websocket
let urlPath = ref(document.location.pathname); let urlPath = document.location.pathname;
if (urlPath.value === "/") { if (urlPath === "/") {
urlPath.value = "/1-1"; urlPath = "/1-1";
} }
useWebsocket(store, urlPath.value); useWebsocket(store, urlPath);
// size setting // size setting
const size = ref(80); const size = ref(80);
@ -23,6 +23,7 @@ onMounted(() => {
const styles = ref({}); const styles = ref({});
function setSize(value) { function setSize(value) {
const v = (value / 100).toFixed(2); const v = (value / 100).toFixed(2);
console.log("size change", value);
styles.value = { styles.value = {
transform: `scale(${v})`, transform: `scale(${v})`,
// transform: `scale(${v * 24 / 33}, ${v})`, // transform: `scale(${v * 24 / 33}, ${v})`,
@ -33,7 +34,7 @@ function setSize(value) {
<template> <template>
<div id="app-container"> <div id="app-container">
<MainPage :style="styles" :path="urlPath" /> <MainPage :style="styles" />
<Slider :size="size" @size-change="setSize" /> <Slider :size="size" @size-change="setSize" />
</div> </div>
</template> </template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch } from "vue"; import { ref } from "vue";
import Tools from "./components/Tools.vue"; import Tools from "./components/Tools.vue";
import NavMenu from "./components/NavMenu.vue"; import NavMenu from "./components/NavMenu.vue";
import AnnoucementPage from "./pages/AnnouncementPage.vue"; import AnnoucementPage from "./pages/AnnouncementPage.vue";
@ -10,25 +10,10 @@ import DataPage from "./pages/DataPage.vue";
import DatetimeTool from "./components/HeadTime.vue"; import DatetimeTool from "./components/HeadTime.vue";
import TriplePage from "./pages/3D.vue"; import TriplePage from "./pages/3D.vue";
const props = defineProps(["path"]);
const pathMap = {
'/1-1': 1,
'/1-2': 2,
'/1-3': 3,
'/1-4': 4,
'/2-1': 5,
'/2-2': 6,
'/2-3': 7,
'/2-4': 8,
'/3-1': 9,
'/3-2': 10,
'/3-3': 11,
'/3-4': 12
}
const currentPage = ref("3d"); const currentPage = ref("3d");
const handlePageChange = (page) => { const handlePageChange = (page) => {
currentPage.value = page; currentPage.value = page;
console.log(currentPage.value);
}; };
</script> </script>
@ -44,7 +29,7 @@ const handlePageChange = (page) => {
/> />
<div v-else class="pages-wrapper"> <div v-else class="pages-wrapper">
<NavMenu @change="handlePageChange" /> <NavMenu @change="handlePageChange" />
<TriplePage v-if="currentPage === '3d'" :line="pathMap[path] ?? '1'" /> <TriplePage v-if="currentPage === '3d'" line="8" />
<DataPage v-if="currentPage === 'data'" /> <DataPage v-if="currentPage === 'data'" />
<AlertListPage v-if="currentPage === 'alert'" /> <AlertListPage v-if="currentPage === 'alert'" />
<RealtimePage v-if="currentPage === 'realtime'" /> <RealtimePage v-if="currentPage === 'realtime'" />

View File

@ -40,7 +40,7 @@ defineProps({
result="shadowBlurOuter1" result="shadowBlurOuter1"
></feGaussianBlur> ></feGaussianBlur>
<feColorMatrix <feColorMatrix
values="0 0 0 0 0.0123 0 0 0 0 0.0123 0 0 0 0 0.0123 0 0 0 1 0" values="0 0 0 0 0.000727194297 0 0 0 0 0.0682545659 0 0 0 0 0.141870471 0 0 0 1 0"
type="matrix" type="matrix"
in="shadowBlurOuter1" in="shadowBlurOuter1"
result="shadowMatrixOuter1" result="shadowMatrixOuter1"

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, nextTick } from "vue"; import { ref, watch, onMounted } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import Container from "./Base/Container.vue"; import Container from "./Base/Container.vue";
import { useWsStore } from "../store"; import { useWsStore } from "../store";
@ -9,69 +9,47 @@ const store = useWsStore();
const chartChart = ref(null); const chartChart = ref(null);
const chart = ref(null); const chart = ref(null);
// //
const hourData = ref([]); const hourData = ref(null);
store.$subscribe((mutation, state) => { store.$subscribe((mutation, state) => {
console.log("=======>", state.data2.lineHourList?.length);
if (
state.data2.lineHourList == undefined ||
state.data2.lineHourList?.length == 0
) {
hourData.value.splice(0);
if (chart.value) chart.value.dispose();
return;
}
console.log("lineHourList ===> ", state.data2.lineHourList); console.log("lineHourList ===> ", state.data2.lineHourList);
hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({ hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({
id: `${item.lineName}_${index}`, id: `${item.lineName}_${index}`,
hour: item.hour || `${index}`.padStart(2, "0"), hour: item.hour || `${index}`.padStart(2, "0"),
data: item.num || Math.floor(Math.random() * 100), data: item.num || Math.random() * 100,
})); }));
setupChart(); chartSetup(
chart.value,
hourData.value.map((item) => item.hour),
hourData.value.map((item) => item.data)
);
}); });
function setupChart() { // watch(hourData, (newVal) => {
if (chart.value) chart.value.dispose(); // console.log("hourData", newVal);
nextTick(() => { // if (newVal) {
chart.value = echarts.init(chartChart.value); // chartSetup(
chartSetup( // chart.value,
chart.value, // newVal.map((item) => item.hour),
hourData.value.map((item) => item.hour), // newVal.map((item) => item.data)
hourData.value.map((item) => item.data) // );
); // }
}); // });
// chart.value.setOption({
// xAxis: {
// type: "category",
// data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
// },
// yAxis: {
// type: "value",
// },
// series: [
// {
// data: [150, 230, 224, 218, 135, 147, 260],
// type: "line",
// },
// ],
// });
}
onMounted(() => { onMounted(() => {
chartChart.value.classList.add("h-full"); chartChart.value.classList.add("h-full");
chart.value = echarts.init(chartChart.value);
chart.value.setOption({})
}); });
</script> </script>
<template> <template>
<Container class="chart" title="小时数据" icon="cube"> <Container class="chart" title="小时数据" icon="cube">
<div <div
v-show="hourData && hourData.length > 0"
ref="chartChart" ref="chartChart"
class="chart-chart" class="chart-chart"
style="{opacity: (hourData && hourData.length > 0) ? 1 : 0}"
></div> ></div>
<p v-show="!hourData || hourData.length === 0" class="empty-data-hint"> <p v-show="!hourData || hourData.length === 0" class="empty-data-hint">暂无数据</p>
暂无数据
</p>
</Container> </Container>
</template> </template>
@ -81,6 +59,7 @@ onMounted(() => {
} }
.chart-inner { .chart-inner {
background: #0f0;
} }
.chart-chart { .chart-chart {

View File

@ -1,22 +1,21 @@
export const options = { export const options = {
grid: { grid: {
top: "10", top: "5%",
bottom: "10", bottom: "5%",
left: "10", left: "3%",
right: "10", right: "3%",
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
type: "category", type: "category",
data: [], data: ["00", "11", "22", "33", "44", "55", "66"],
axisLabel: { axisLabel: {
fontSize: 16, fontSize: 16,
color: '#fff8'
}, },
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#e6e6e633", color: "#dff1fe",
}, },
}, },
}, },
@ -25,21 +24,13 @@ export const options = {
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#e6e6e633", color: "#dff1fe",
}, },
}, },
splitLine: {
lineStyle: {
color: '#e6e6e633'
}
},
axisLabel: { axisLabel: {
fontSize: 16, fontSize: 16,
color: '#fff8'
}, },
minInterval: 1, minInterval: 1,
max: 100,
min: 1
}, },
series: [ series: [
{ {

View File

@ -3,59 +3,43 @@ import { ref, onMounted } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import Container from "./Base/Container.vue"; import Container from "./Base/Container.vue";
import { useWsStore } from "../store"; import { useWsStore } from "../store";
import setupFn from "./TeamChartDayOptions"; import chartSetup from "./HourChartOptions";
const store = useWsStore(); const store = useWsStore();
const chartChart = ref(null); const chartChart = ref(null);
const chart = ref(null); const chart = ref(null);
const dayData = ref([]); //
const hourData = ref(null);
store.$subscribe((mutation, state) => { store.$subscribe((mutation, state) => {
if ( console.log("lineHourList ===> ", state.data2.lineHourList);
state.data2.classTodayProductYield == undefined || hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({
state.data2.classTodayProductYield?.length == 0 id: `${item.lineName}_${index}`,
) { hour: item.hour || `${index}`.padStart(2, "0"),
dayData.value.splice(0); data: item.num || Math.random() * 100,
if (chart.value) chart.value.dispose(); }));
return; chartSetup(
} chart.value,
console.log( hourData.value.map((item) => item.hour),
"classTodayProductYield ===> ", hourData.value.map((item) => item.data)
state.data2.classTodayProductYield
); );
for (let i = 0; i < state.data2.classTodayProductYield.length; ++i) {
if (state.data2.classTodayProductYield[i].teamName == "A组") {
dayData.value[0] = parseInt(state.data2.classTodayProductYield[i].yield);
} else if (state.data2.classTodayProductYield[i].teamName == "B组") {
dayData.value[1] = parseInt(state.data2.classTodayProductYield[i].yield);
} else if (state.data2.classTodayProductYield[i].teamName == "C组") {
dayData.value[2] = parseInt(state.data2.classTodayProductYield[i].yield);
}
}
setupChart();
}); });
function setupChart() {
if (chart.value) chart.value.dispose();
nextTick(() => {
chart.value = echarts.init(chartChart.value);
setupFn(chart.value, dayData.value);
});
}
onMounted(() => { onMounted(() => {
chartChart.value.classList.add("h-full"); chartChart.value.classList.add("h-full");
chart.value = echarts.init(chartChart.value);
chart.value.setOption({});
}); });
</script> </script>
<template> <template>
<Container class="chart" title="本日班组情况" icon="cube"> <Container class="chart" title="本日班组情况" icon="cube">
<div <div
v-show="hourData && hourData.length > 0"
ref="chartChart" ref="chartChart"
class="chart-chart" class="chart-chart"
style="{opacity: (dayData && dayData.length > 0) ? 1 : 0}"
></div> ></div>
<p v-show="!dayData || dayData.length === 0" class="empty-data-hint"> <p v-show="!hourData || hourData.length === 0" class="empty-data-hint">
暂无数据 暂无数据
</p> </p>
</Container> </Container>
@ -67,6 +51,7 @@ onMounted(() => {
} }
.chart-inner { .chart-inner {
background: #0f0;
} }
.chart-chart { .chart-chart {

View File

@ -1,16 +1,15 @@
export const options = { export const options = {
grid: { grid: {
top: "10", top: "10%",
bottom: "10", bottom: "5%",
left: "10", left: "3%",
right: "10", right: "5%",
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
max: 100, max: 100,
axisLabel: { axisLabel: {
fontSize: 22, fontSize: 22,
color: "#e5e5e533",
}, },
}, },
yAxis: { yAxis: {
@ -22,11 +21,6 @@ export const options = {
max: 2, // only the largest 3 bars will be displayed max: 2, // only the largest 3 bars will be displayed
axisLabel: { axisLabel: {
fontSize: 22, fontSize: 22,
color: "#e5e5e533",
},
splitLine: {
show: false,
color: "#e5e5e533",
}, },
}, },
series: [ series: [
@ -40,7 +34,7 @@ export const options = {
position: "right", position: "right",
valueAnimation: true, valueAnimation: true,
formatter: "{c}%", formatter: "{c}%",
color: "#fff8", color: "rgba(255, 255, 255, 1)",
fontWeight: "bold", fontWeight: "bold",
fontSize: 22, fontSize: 22,
}, },

View File

@ -3,50 +3,45 @@ import { ref, onMounted } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import Container from "./Base/Container.vue"; import Container from "./Base/Container.vue";
import { useWsStore } from "../store"; import { useWsStore } from "../store";
import setupFn from "./TeamChartMonthOptions"; import chartSetup from "./HourChartOptions";
const store = useWsStore(); const store = useWsStore();
const chartChart = ref(null); const chartChart = ref(null);
const chart = ref(null); const chart = ref(null);
const monthData = ref(null); //
const hourData = ref(null);
store.$subscribe((mutation, state) => { store.$subscribe((mutation, state) => {
if ( console.log("lineHourList ===> ", state.data2.lineHourList);
state.data2.monthlyTarget == undefined || hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({
state.data2.monthlyTarget?.length == 0 id: `${item.lineName}_${index}`,
) { hour: item.hour || `${index}`.padStart(2, "0"),
monthData.value = null; data: item.num || Math.random() * 100,
if (chart.value) chart.value.dispose(); }));
return; chartSetup(
} chart.value,
console.log("monthlyTarget ===> ", state.data2.monthlyTarget); hourData.value.map((item) => item.hour),
const { targetProduction, nowProduction, targetYield, nowYield } = hourData.value.map((item) => item.data)
state.data2.monthlyTarget[0]; );
monthData.value = { targetProduction, nowProduction, targetYield, nowYield };
setupChart();
}); });
function setupChart() {
if (chart.value) chart.value.dispose();
nextTick(() => {
chart.value = echarts.init(chartChart.value);
setupFn(chart.value, monthData.value);
});
}
onMounted(() => { onMounted(() => {
chartChart.value.classList.add("h-full"); chartChart.value.classList.add("h-full");
chart.value = echarts.init(chartChart.value);
chart.value.setOption({});
}); });
</script> </script>
<template> <template>
<Container class="chart" title="本月班组情况" icon="cube"> <Container class="chart" title="本月班组情况" icon="cube">
<div <div
v-show="hourData && hourData.length > 0"
ref="chartChart" ref="chartChart"
class="chart-chart" class="chart-chart"
style="{opacity: (monthData) ? 1 : 0}"
></div> ></div>
<p v-show="!monthData" class="empty-data-hint">暂无数据</p> <p v-show="!hourData || hourData.length === 0" class="empty-data-hint">
暂无数据
</p>
</Container> </Container>
</template> </template>
@ -56,6 +51,7 @@ onMounted(() => {
} }
.chart-inner { .chart-inner {
background: #0f0;
} }
.chart-chart { .chart-chart {

View File

@ -117,7 +117,7 @@ export const options = {
offsetCenter: [0, "0%"], offsetCenter: [0, "0%"],
formatter: 0 + "%", formatter: 0 + "%",
// formatter: (nowYield / targetYield * 100).toFixed(1) + '%', // formatter: (nowYield / targetYield * 100).toFixed(1) + '%',
color: "#fff8", color: "rgba(255, 255, 255, 1)",
}, },
data: [ data: [
{ {

View File

@ -3,15 +3,11 @@ import { ref, watch, onMounted } from "vue";
import IconBack from "../assets/menu_icon/IconBack.vue"; import IconBack from "../assets/menu_icon/IconBack.vue";
import IconExchange from "../assets/menu_icon/IconExchange.vue"; import IconExchange from "../assets/menu_icon/IconExchange.vue";
import IconSetting from "../assets/menu_icon/IconSetting.vue"; import IconSetting from "../assets/menu_icon/IconSetting.vue";
function toHome() {
document.location.href = '/1-1'
}
</script> </script>
<template> <template>
<div class="tools"> <div class="tools">
<button @click="toHome"><IconBack /></button> <button><IconBack /></button>
<button><IconSetting /></button> <button><IconSetting /></button>
<button><IconExchange /></button> <button><IconExchange /></button>
</div> </div>

View File

@ -380,106 +380,6 @@ const props = defineProps({
top: 80px; top: 80px;
} }
/* info 9 */
.info-9 .info:nth-child(1) {
left: 400px;
bottom: 250px;
}
.info-9 .info:nth-child(2) {
left: 1100px;
bottom: 220px;
}
.info-9 .info:nth-child(3) {
left: 496px;
bottom: 570px;
}
.info-9 .info:nth-child(4) {
left: 1100px;
bottom: 490px;
}
.info-9 .info:nth-child(5) {
left: 670px;
top: 144px;
}
.info-9 .info:nth-child(6) {
left: 1100px;
top: 155px;
}
/* info 10 */
.info-10 .info:nth-child(1) {
left: 620px;
bottom: 450px;
}
.info-10 .info:nth-child(2) {
left: 1000px;
bottom: 320px;
}
.info-10 .info:nth-child(3) {
left: 736px;
top: 270px;
}
.info-10 .info:nth-child(4) {
left: 1200px;
top: 330px;
}
.info-10 .info:nth-child(5) {
left: 870px;
top: 144px;
}
.info-10 .info:nth-child(6) {
left: 1100px;
top: 195px;
}
.info-10 .info:nth-child(7) {
left: 900px;
top: 55px;
}
.info-10 .info:nth-child(8) {
left: 1200px;
top: 68px;
}
/* info 11 */
.info-11 .info:nth-child(1) {
left: 570px;
bottom: 450px;
}
.info-11 .info:nth-child(2) {
left: 1100px;
bottom: 410px;
}
.info-11 .info:nth-child(3) {
left: 436px;
bottom: 170px;
}
.info-11 .info:nth-child(4) {
left: 1036px;
bottom: 170px;
}
.info-11 .info:nth-child(5) {
left: 890px;
top: 94px;
}
/* info 12 */
.info-12 .info:nth-child(1) {
left: 570px;
bottom: 250px;
}
.info-12 .info:nth-child(2) {
left: 800px;
bottom: 80px;
}
.info-12 .info:nth-child(3) {
left: 1136px;
bottom: 670px;
}
.info-12 .info:nth-child(4) {
left: 836px;
top: 70px;
}
/* other */ /* other */
.line-1 { .line-1 {
background: url(../assets/model/F1.png) no-repeat; background: url(../assets/model/F1.png) no-repeat;

View File

@ -25,10 +25,6 @@ store.$subscribe((mutation, state) => {
position: `${item.productLine} - ${item.segment}`, position: `${item.productLine} - ${item.segment}`,
})); }));
}); });
function handleIgnore(){
alarmList.value.splice(0)
}
</script> </script>
<template> <template>
@ -65,7 +61,7 @@ function handleIgnore(){
<el-table-column prop="position" label="定位"></el-table-column> <el-table-column prop="position" label="定位"></el-table-column>
</el-table> </el-table>
</div> </div>
<button @click="handleIgnore" class="alert-btn">忽略</button> <button class="alert-btn">忽略</button>
</Container> </Container>
</div> </div>
</template> </template>

View File

@ -2,7 +2,6 @@
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
import { useWsStore } from "../store"; import { useWsStore } from "../store";
import IconBack from "../assets/menu_icon/IconBack.vue";
const emit = defineEmits(["home"]); const emit = defineEmits(["home"]);
// load // load
@ -46,18 +45,10 @@ const handleClose = () => {
</main> </main>
<div class="announcement-footer"> <div class="announcement-footer">
<button <button
style=" style="position: absolute; left: 0; bottom: 10px"
position: absolute;
left: 0;
bottom: 10px;
appearance: none;
background: transparent;
border: none;
cursor: pointer;
"
@click="handleClose" @click="handleClose"
> >
<IconBack /> 返回
</button> </button>
<ScrollText> {{ horizontal_content }} </ScrollText> <ScrollText> {{ horizontal_content }} </ScrollText>
</div> </div>

View File

@ -8,6 +8,7 @@ export const useWsStore = defineStore("wsData", () => {
const data3 = ref({}); const data3 = ref({});
function updateData(category, data) { function updateData(category, data) {
console.log('update', data)
switch (category) { switch (category) {
case "1": case "1":
data1.value = data; data1.value = data;

View File

@ -15,15 +15,19 @@ function connectPath(store, path) {
(message) => { (message) => {
try { try {
const data = JSON.parse(message.data); const data = JSON.parse(message.data);
console.log("message", JSON.parse(message.data));
if ("specificationChanges" in data) { if ("specificationChanges" in data) {
console.log("[*] setting data1");
// 分屏推送1数据 // 分屏推送1数据
store.updateData("1", data); store.updateData("1", data);
} else if ("deliveryNotification" in data) { } else if ("deliveryNotification" in data) {
// 分屏推送3数据 // 分屏推送3数据
console.log("[*] setting data3");
store.updateData("3", data); store.updateData("3", data);
} else { } else {
// 分屏推送2数据 // 分屏推送2数据
console.log("[*] setting data2");
store.updateData("2", data); store.updateData("2", data);
} }
} catch (err) { } catch (err) {

View File

@ -35,6 +35,7 @@ export default class XClient {
heartbeat() { heartbeat() {
if (this.hb) clearInterval(this.hb); if (this.hb) clearInterval(this.hb);
return setInterval(() => { return setInterval(() => {
console.log(`${this.name} ping...`);
if (this.ws.readyState == WebSocket.OPEN) { if (this.ws.readyState == WebSocket.OPEN) {
this.ws.send("ping"); this.ws.send("ping");
} else { } else {

View File

@ -4,8 +4,4 @@ import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
server: {
host: '0.0.0.0',
port: '5173'
}
}) })