wu
2024-12-23 b9b44b51b201e2f5a9a1f3665c7fb76b5690f9af
UI-Project/src/views/largescreen/largescreen.vue
@@ -1,30 +1,16 @@
<template>
  <el-card style="flex: 1;margin-left: 1px;margin-top: 10px;margin-right: 1px;" v-loading="loading">
    <el-scrollbar height="600px">
<div id="top" style="height: 150px;display: flex;">
  <div class="echarts-container">
  <div v-for="(processData, index) in processesData" :key="index" class="echarts-item">
    <div :id="'pieChart_' + index" class="pie-chart"></div>
  </div>
</div>
</div>
<div style="display: flex;">
<!-- <div id="centerleft" style="margin-top: 10px;height: 240px;width: 340px;background-color: #911005;">
  <el-table height="240" ref="table" width="340px"
      @selection-change="handleSelectionChange"
      :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
        <el-table-column fixed prop="orderId" align="center" :label="$t('large.number')" min-width="110" />
        <el-table-column prop="project" align="center" :label="$t('large.projectname')" min-width="100" />
        <el-table-column prop="responsibleProcess" align="center" :label="$t('large.responsibleprocess')" min-width="100" />
        <el-table-column prop="breakageQuantity" align="center" :label="$t('large.numberfractions')" min-width="110" />
        <el-table-column prop="patchProcesses" align="center" :label="$t('large.process')" min-width="100" />
        <el-table-column fixed="right" :label="$t('large.operate')" align="center" width="100">
          <template #default="scope">
            <el-button size="mini" type="text" plain @click="handleBinda">{{ $t('large.mes') }}</el-button>
          </template>
      </el-table-column>
      </el-table>
</div>  -->
<template>
  <div style="height: 500px;">
    <el-card style="flex: 1;margin-left: 1px;margin-top: 10px;margin-right: 1px;" v-loading="loading">
      <el-scrollbar height="800px">
        <div style="font-size: 20px;font-weight: bold;">{{ $t('large.loading') }}{{ temperingtotal }}</div>
        <div id="top" style="height: 150px;display: flex; justify-content: center; align-items: center;">
          <div class="echarts-container">
            <div v-for="(processData, index) in processesData" :key="index" class="echarts-item" @click="showDialog">
              <div :id="'pieChart_' + index" class="pie-chart"></div>
            </div>
          </div>
        </div>
        <div style="display: flex;">
<div class="parter" style="margin-top: 10px;margin-left: 150px; height: 240px;width: 1000px;">
    <img src="../../assets/dpxsa.png" style="margin-left: -10px; width: 100%;height: 100%;" alt="Your Image">
  <div  class="moving-rect lipiana" v-show="woshia"></div>
@@ -34,7 +20,6 @@
  <div  class="moving-rect overlaya" v-show="flake"></div>
  <div  class="moving-rect overlayb" v-show="flakeb"></div>
  <div  class="moving-rect overlayc" v-show="flakec"></div>
  <div  class="moving-rect overlayd" v-show="flaked"></div>
  <div  class="moving-rect longa" v-show="dalipiana"></div>
  <div  class="moving-rect longb" v-show="dalipianb"></div>
  <div  class="moving-rect shangpianji" v-show="shangpian"></div>
@@ -46,32 +31,9 @@
  <div  class="moving-rect xiapianji5" v-show="xiapian5"></div>
  <div  class="moving-rect xiapianji6" v-show="xiapian6"></div>
</div>
<!-- <div class="parter" style="margin-top: 10px;margin-left: 150px; height: 240px;width: 1000px;">
    <img src="../../assets/dpxsa.png" style="margin-left: -10px; width: 100%;height: 100%;" alt="Your Image">
    <div class="moving-rect vertical"></div>
    <div class="moving-rect all"></div>
    <div class="moving-rect horizontal"></div>
    <div class="moving-rect xiao"></div>
    <div class="moving-rect zhan"></div>
    <div class="moving-rect tu"></div>
    <div class="moving-rect zi"></div>
    <div class="moving-rect xia"></div>
    <div class="moving-rect zan"></div>
    <div class="moving-rect fa"></div>
    <div class="moving-rect hua"></div>
    <div class="moving-rect shui"></div>
</div> -->
<!-- <div id="centerright" style="margin-top: 10px;margin-left: 10px; height: 240px;width: 240px;background-color: #911005;">
  <el-table height="240" ref="table" width="340px"
      @selection-change="handleSelectionChange"
      :data="tableDatab" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
        <el-table-column prop="projectNo" align="center" :label="$t('large.projectnumber')" min-width="50" />
        <el-table-column prop="projectName" align="center" :label="$t('large.projectname')" min-width="50" />
      </el-table>
</div>  -->
</div>
<div id="bottom" style="margin-top: 10px;height: 190px;background-color: #911005;">
<el-table height="190" ref="table"
<div id="bottom" style="margin-top: 10px;height: 190px;">
<el-table height="350" ref="table"
      @selection-change="handleSelectionChange"
      :data="tableDatac" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
        <el-table-column prop="orderId" align="center" :label="$t('large.orderId')" min-width="50" />
@@ -102,7 +64,7 @@
</el-scrollbar>
</el-card>
<el-dialog v-model="blinda" top="5vh" width="85%">
  <el-table height="400" ref="table"
  <el-table height="650" ref="table"
      @selection-change="handleSelectionChange"
      :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
        <el-table-column prop="orderId" fixed align="center" :label="$t('large.orderId')" min-width="110" />
@@ -133,8 +95,6 @@
          </el-table-column> 
        <el-table-column prop="packType"  align="center" :label="$t('large.quantity')" min-width="110" />
        <el-table-column prop="projectNo"  align="center" :label="$t('large.projectnumber')" min-width="110" />
        <!-- <el-table-column prop="processingNote" fixed align="center" :label="$t('large.method')" min-width="110" /> -->
        <!-- <el-table-column prop="deliveryDate" fixed align="center" :label="$t('large.deliveryDate')" min-width="130" /> -->
      </el-table>
  <template #footer>
    <div id="dialog-footer" style="text-align: center;">
@@ -142,26 +102,41 @@
    </div>
  </template>
</el-dialog>
</template>
<script setup>
import { Delete, Upload } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, onMounted , onBeforeUnmount, reactive, computed, shallowRef, onUnmounted, watchEffect } from "vue";
<el-dialog v-model="blind" top="10vh" width="70%" >
  <el-date-picker style="margin-left: 1px;" v-model="timeRange" type="daterange" format="YYYY/MM/DD" value-format="YYYY-MM-DD"
                  :start-placeholder="$t('large.starttime')" :end-placeholder="$t('large.endtime')"
                  :default-time="defaultTime"/>
  <el-button type="primary" style="margin-left: 10px;margin-top: -6px;" @click="selectReportData()">
    {{ $t('large.inquire') }}
  </el-button>
  <div style="height: 550px;display: flex;margin-top: 10px;justify-content: center; align-items: center;">
    <div class="echarts-container">
      <div v-for="(processData, index) in dialogprocesses" :key="index" class="echarts-item">
        <div :id="'dialogPieChart_' + index" class="pie-chart"></div>
      </div>
    </div>
  </div>
</el-dialog>
  </div>
</template>
<script setup>
import {ElMessage} from 'element-plus'
import {nextTick, onBeforeUnmount, onMounted, onUnmounted, ref} from "vue";
import request from "@/utils/request"
import { WebSocketHost ,host} from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import {host, WebSocketHost} from '@/utils/constants'
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import {useI18n} from 'vue-i18n'
import * as echarts from 'echarts';
const {t} = useI18n()
const tableData = ref([])
const tableDatab = ref([])
const tableDatac = ref([])
const adjustedRects = ref([]);
const chartRefs = ref([]);
const adjustedRects = ref([]);
const chartRefs = ref([]);
const timeRange = ref([])
const flake = ref(false)
const flakeb = ref(false)
const flakec = ref(false)
const flaked = ref(false)
const woshia = ref(false)
const woshic = ref(false)
const dalipiana = ref(false)
@@ -174,9 +149,9 @@
const xiapian4 = ref(false)
const xiapian5 = ref(false)
const xiapian6 = ref(false)
const thisProcess = ref(); // 用于存储process_id的响应式引用
// 定义一个响应式引用来存储图表实例
const blind = ref(false)
const temperingtotal = ref(0)
const thisProcess = ref();
const chartDom = ref(null);  
let chartInstance = null;  
const blinda = ref(false)
@@ -185,6 +160,7 @@
  await fetchFlowCardId(row.orderId);
};  
const processesData = ref([]);
const dialogprocesses = ref([]);
const fetchFlowCardId = async (orderId) => {
  try  {
    const response = await request.post('/loadGlass/order/order/selectOrderdetail',{
@@ -199,7 +175,6 @@
    }
}
catch (error) {
    // 处理错误
    console.error(error);
  }
}
@@ -231,7 +206,6 @@
let socket6 = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/screen`;
const handleMessage = (data) => {
// tableData.value = data.awaitingRepairs[0]
tableDatab.value = data.DoingTask[0]
tableDatac.value = data.orders[0]
  socket.onmessage = (event) => {  
@@ -258,38 +232,36 @@
    flake.value = tasks.some(task => task.state == 1);
    flakeb.value = tasks.some(task => task.state == 2);
    flakec.value = tasks.some(task => task.state == 3);
    flaked.value = tasks.some(task => task.state == 4);
};
// 卧式理片
const socketUrl3 = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlassIsRun`;
const handleMessage3 = (data) => {
  const tasks = data.taskCaches[0];
    const tasks = data.taskCaches[0];
  woshia.value = tasks.some(task => task.line == 2001);  
  woshic.value = tasks.some(task => task.line == 2002);  
  console.log(tasks);
};
// 大理片笼
const socketUrl4 = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/isRun`;
const handleMessage4 = (data) => {
  const tasks = data.bigStorageCageDetailsOutTask[0];
  const taskss = data.bigStorageCageDetailsFeedTask[0];
    const tasks = data.bigStorageCageDetailsOutTask[0];
    dalipiana.value = tasks.some(task => task.slot !== null && task.slot !== undefined);  
  const taskss = data.bigStorageCageDetailsFeedTask[0];
dalipianb.value = taskss.some(task => task.slot !== null && task.slot !== undefined);  
};
// 上片
const socketUrl5 = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlassIsRun`;
const handleMessage5 = (data) => {
  if(data.engineering.length !==0 ){
    shangpian.value = true;
}
};
    const tasks = data.engineering;
    shangpian.value = tasks.some(task => task.state == 1);
    temperingtotal.value = data.engineering[0].engineerId
  };
// 下片
const socketUrl6 = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unLoadGlassIsRun`;
const handleMessage6 = (data) => {
  const tasks = data.downWorkstation[0];  
  if (tasks && tasks.length >= 6) {
    xiapian.value = tasks.some(task => task.racksNumber!== 0);
  const tasks1 = data.downGlassTask[0];
    xiapian.value = tasks1.some(task => task.thickness!== '');
    if (tasks && tasks.length >= 6) {
    xiapian1.value = tasks[0].racksNumber !== 0;
    xiapian2.value = tasks[1].racksNumber !== 0;
    xiapian3.value = tasks[2].racksNumber !== 0;
@@ -336,7 +308,47 @@
      }
    ]
  };
  chart.setOption(options);
});
};
const renderPieCharts1 = () => {
dialogprocesses.value.forEach((data, index) => {
  const chart = echarts.init(document.getElementById('dialogPieChart_' + index));
  const options = {
    title: {
        text: `${data.thisProcess} `,
        left: 'center',
      },
    tooltip: {
      trigger: 'item',
    },
    series: [
      {
        name: `${data.thisProcess} `,
        type: 'pie',
        radius: ['40%', '70%'],
        avoidLabelOverlap: false,
        data: [
          { value: data.completedQuantity, name: t('large.completedquantity') },
          { value: data.breakageQuantity, name: t('large.scrapquantity') }
        ],
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        },
        label: {
          show: false,
          position: 'center',
        },
      labelLine: {
        show: false
      },
      }
    ]
  };
  chart.setOption(options);
});
};
@@ -377,8 +389,30 @@
closeWebSocket5();
closeWebSocket6();
});
</script>
function showDialog() {
  blind.value = true;
}
// 查询数据
const selectReportData = async () => {
  const response = await request.post("/loadGlass/reporting_work/reporting-work/selectDamage", {
    reportingWorkTime: timeRange.value[0],
    reportingWorkTime2: timeRange.value[1],
  })
  if (response.code === 200) {
    dialogprocesses.value = response.data.map(rect => ({
    ...rect,
    completedQuantity: rect.completedQuantity,
    breakageQuantity: rect.breakageQuantity,
    thisProcess: rect.thisProcess,
  }));
  await nextTick();
  renderPieCharts1();
    ElMessage.success(response.message);
  } else {
    ElMessage.error(response.message);
  }
};
</script>
<style scoped>  
.echarts-container {
display: flex;
@@ -395,19 +429,19 @@
height: 100%;
}
.parter {
    position: relative;
    display: inline-block; /* 使容器大小适应图片大小 */
  width: 1500px;
  margin-left: -300px
 position: relative;
 display: inline-block; /* 使容器大小适应图片大小 */
 width: 1500px;
 margin-left: -300px
}
img {
    display: block; /* 让图片以块级元素显示 */
    max-width: 100%; /* 确保图片不超出容器 */
 display: block; /* 让图片以块级元素显示 */
 max-width: 100%; /* 确保图片不超出容器 */
}
.moving-rect {
    width: 100px;
    height: 50px;
    position: absolute;
 width: 100px;
 height: 50px;
 position: absolute;
}
.longa{
  z-index: 1;
@@ -474,13 +508,13 @@
  margin-left: 293px;
}
.xiapianji {
    width: 20px;
    height: 10px;
    background-color: #529b2e;
    top: 9px;
    left: 200px;
    transform: translateX(-50%);
    animation: move-xiapianji 6s infinite;
 width: 20px;
 height: 10px;
 background-color: #529b2e;
 top: 9px;
 left: 200px;
 transform: translateX(-50%);
 animation: move-xiapianji 15s infinite;
}
@keyframes move-xiapianji {
    0% {
@@ -497,7 +531,7 @@
    top: 190px;
    right: 530px;
    transform: translateX(-50%);
    animation: move-lipiana 6s infinite;
    animation: move-lipiana 15s infinite;
}
@keyframes move-lipiana {
    0% {
@@ -514,7 +548,7 @@
    top: 160px;
    left: 502px;
    transform: translateX(-50%);
    animation: move-lipianb 6s infinite;
    animation: move-lipianb 15s infinite;
}
@keyframes move-lipianb {
    0% {
@@ -531,7 +565,7 @@
    top: 215px;
    right: 490px;
    transform: translateX(-50%);
    animation: move-lipianc 6s infinite;
    animation: move-lipianc 15s infinite;
}
@keyframes move-lipianc {
    0% {
@@ -548,7 +582,7 @@
    top: 160px;
    left: 555px;
    transform: translateX(-50%);
    animation: move-lipiand 6s infinite;
    animation: move-lipiand 15s infinite;
}
@keyframes move-lipiand {
    0% {
@@ -565,7 +599,7 @@
    top: 213px;
    right: 800px;
    transform: translateX(-50%);
    animation: move-overlaya 6s infinite;
    animation: move-overlaya 15s infinite;
}
@keyframes move-overlaya {
    0% {
@@ -582,7 +616,7 @@
    top: 110px;
    left: 13px;
    transform: translateX(-50%);
    animation: move-overlayb 6s infinite;
    animation: move-overlayb 15s infinite;
}
@keyframes move-overlayb {
    0% {
@@ -599,7 +633,7 @@
    top: 7px;
    left: 13px;
    transform: translateX(-50%);
    animation: move-overlayc 6s infinite;
    animation: move-overlayc 15s infinite;
}
@keyframes move-overlayc {
    0% {
@@ -616,7 +650,7 @@
    top: 157px;
    right: 90px;
    transform: translateX(-50%);
    animation: move-shangpianji 6s infinite;
    animation: move-shangpianji 15s infinite;
}
@keyframes move-shangpianji {
    0% {