wangfei
2025-09-12 18b5b27959b7868c7cf7e19a7b636ffc1a494e41
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -1,18 +1,18 @@
<script setup>
import { onBeforeUnmount, onMounted, onUnmounted, reactive, ref } from "vue";
import { useRouter } from "vue-router"
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import {onBeforeUnmount, onMounted, onUnmounted, reactive, ref} from "vue";
import {useRouter} from "vue-router"
import {useI18n} from 'vue-i18n'
import {ElMessage} from 'element-plus'
import request from "@/utils/request";
import { closeWebSocket, initializeWebSocket } from '@/utils/WebSocketService';
import { host, WebSocketHost } from '@/utils/constants'
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import {host, WebSocketHost} from '@/utils/constants'
import PrintFlow from "@/views/UnLoadGlass/PrintFlow.vue";
import Landingindication from "./Landingindication.vue";
import Landingindicationtwo from "./Landingindicationtwo.vue";
import PrintLabel from "@/views/UnLoadGlass/PrintCustomLabelSemi1.vue";
const router = useRouter()
const { t } = useI18n()
const {t} = useI18n()
let language = ref(localStorage.getItem('lang') || 'zh')
const printLoading = ref(true)
const fullFlowCard = ref('')
@@ -23,6 +23,7 @@
 
const dialogFormVisiblea = ref(false)
const dialogFormVisiblea2 = ref(false)
const dialogFormVisiblea3 = ref(false)
const dialogFormVisibleaDownGlass = ref(false)
const dialogFormVisibleaDownGlasss = ref(false)
// 数据
@@ -95,6 +96,21 @@
  fetchFlowCardId();
  dialogFormVisiblea.value = true; // 打开绑定架子对话框
};
const clearGlass = async () => {
  try {
      const response = await request.post("/unLoadGlass/downGlassTask/updateOutGlassTask")
      if (response.code === 200) {
        tableData.value = response.data;
        ElMessage.success(response.message);
      } else {
        ElMessage.error(response.message);
      }
      dialogFormVisiblea3.value = false;
  } catch (error) {
    console.error('发生错误:', error);
  }
}
//获取流程卡号
const fetchFlowCardId = async () => {
  try {
@@ -149,6 +165,9 @@
  workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名
  dialogFormVisiblea2.value = true; // 打开绑定架子对话框
  workFlowCard.value = row.flowCardId;
};
const handleBindRack3 = (row) => {
  dialogFormVisiblea3.value = true; // 打开清空玻璃对话框
};
//清除内容
const handleclear = async () => {
@@ -434,29 +453,28 @@
    body.removeChild(style);
  }, 20);
}
// beforeUnmount(() => {
//   closeWebSocket();
// });
// setInterval(fetchTableData, 2000)
</script>
<template>
  <div>
    <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 10px;" id="searchButton" type="primary"
      @click="dialogFormVisibleaDownGlass = true">{{ $t('reportWork.details') }}
    </el-button>
    <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 10px;" id="searchButton" type="primary"
      @click="dialogFormVisibleaDownGlasss = true">{{ $t('reportWork.filming') }}
    </el-button>
    <el-switch style="margin-top: 10px;margin-left: 15px;margin-bottom: 10px;" v-model="autoPrint" class="mb-2"
      :inactive-text="$t('basicData.printing')" @change="handleChange" />
    <el-card style="flex: 1;" v-loading="loading">
      <el-card style="flex: 1;margin-left: 4px;margin-top: 1px;" v-loading="loading">
  <div style="height: 500px;">
    <div>
      <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 10px;" id="searchButton" type="primary"
                 @click="dialogFormVisibleaDownGlass = true">{{ $t('reportWork.details') }}
      </el-button>
      <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 10px;" id="searchButton" type="primary"
                 @click="dialogFormVisibleaDownGlasss = true">{{ $t('reportWork.filming') }}
      </el-button>
      <el-switch style="margin-top: 10px;margin-left: 15px;margin-bottom: 10px;" v-model="autoPrint" class="mb-2"
                 :inactive-text="$t('basicData.Automaticprintingswitch')" @change="handleChange"/>
      <el-card style="flex: 1;" v-loading="loading">
        <el-card style="flex: 1;margin-left: 4px;margin-top: 1px;" v-loading="loading">
        <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
          <el-table height="350px" ref="table" @selection-change="handleSelectionChange" :data="tableData"
          <el-table height="400px" ref="table" @selection-change="handleSelectionChange" :data="tableData"
            :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
            <el-table-column prop="workstationId" align="center" :label="$t('reportWork.lowerbit')" min-width="80" />
            <el-table-column prop="workstationId" align="center" :label="$t('reportWork.shelfnumber')"
@@ -464,27 +482,29 @@
            <el-table-column prop="flowCardId" align="center" :label="$t('reportWork.cardnumber')" min-width="150" />
            <el-table-column prop="totalQuantity" align="center" :label="$t('reportWork.totalquantity')"
              min-width="120" />
            <el-table-column prop="racksNumber" align="center" :label="$t('reportWork.beendropped')" min-width="120" />
            <el-table-column prop="racksNumber" align="center" :label="$t('reportWork.beendropped')" min-width="130" />
            <el-table-column prop="layer" align="center" :label="$t('reportWork.cenumber')" min-width="120" />
            <el-table-column prop="otherNumber" align="center" :label="$t('reportWork.artificialorder')" min-width="120" />
            <!-- <el-table-column prop="work_state" align="center" :label="$t('reportWork.state')" min-width="120" /> -->
            <el-table-column prop="deviceId" align="center" :label="$t('reportWork.devicenumber')" min-width="120" />
            <el-table-column align="center" :label="$t('reportWork.startstatus')" min-width="80" prop="enableState">
            <el-table-column prop="deviceId" align="center" :label="$t('reportWork.devicenumber')" min-width="110" />
            <el-table-column align="center" :label="$t('reportWork.startstatus')" min-width="90" prop="enableState">
              <template #default="scope">
                <el-tag :type="getTagType(scope.row.enableState)" @click="toggleStatus(scope.row)">
                  {{ scope.row.enableState === 1 ? $t('reportWork.enable') : $t('reportWork.unenable') }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column fixed="right" :label="$t('reportWork.operate')" align="center" width="400">
            <el-table-column fixed="right" :label="$t('reportWork.operate')" align="center" width="500">
              <template #default="scope">
                <el-button size="mini" type="text" plain v-show="scope.row.enableState !== '已启用'"
                <el-button size="mini" type="text" v-if="scope.row.workstationId!=7" plain v-show="scope.row.enableState !== '已启用'"
                  @click="handleBindRack(scope.row)">{{ $t('reportWork.bindingshelves') }}
                </el-button>
                <el-button size="mini" type="text" plain @click="handleBindRack2(scope.row)">{{ $t('reportWork.clear')
                <el-button size="mini" type="text" v-if="scope.row.workstationId!=7" plain @click="handleBindRack2(scope.row)">{{ $t('reportWork.clear')
                  }}</el-button>
                <el-button @click="open(scope.row)" :disabled="scope.row.flowCardId == null">{{ $t('reportWork.processcard') }}</el-button>
                <el-button @click="open1(scope.row)" :disabled="scope.row.flowCardId == null">{{ $t('reportWork.printlabels') }}</el-button>
                <el-button @click="open(scope.row)" v-if="scope.row.workstationId!=7" :disabled="scope.row.flowCardId == null">{{ $t('reportWork.processcard') }}</el-button>
                <el-button @click="open1(scope.row)" v-if="scope.row.workstationId!=7" :disabled="(scope.row.flowCardId == null&&scope.row.workstationId!=7)">{{ $t('reportWork.printlabels') }}</el-button>
                <el-button @click="handleBindRack3()" :disabled="(scope.row.totalQuantity ==0)" v-if="scope.row.workstationId==7">{{ $t('reportWork.clear') }}</el-button>
                <el-button @click="open1(scope.row)" v-if="scope.row.workstationId==7" :disabled="(scope.row.totalQuantity ==0&&scope.row.workstationId==7)">{{ $t('reportWork.printlabels') }}</el-button>
              </template>
 
            </el-table-column>
@@ -503,13 +523,13 @@
            <el-option label="7" value="7"></el-option>
          </el-select>
 
          <el-select v-model="selectValuesa[1]" filterable :placeholder="$t('basicData.plselectproject')" clearable
          <el-select v-model="selectValuesa[1]" filterable :placeholder="$t('basicData.plselectproject')" clearable style="margin-left: 20px;"
            @input="handleInputChangea($event, row.id)">
            <el-option v-for="item in selectOptionsa" :key="item" :label="item" :value="item" />
          </el-select>
 
          <span class="demonstration">{{ $t('reportWork.timeperiod') }}</span>
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" :start-placeholder="$t('reportmanage.starttime')"
          <span class="demonstration" style="margin-left: 20px;">{{ $t('reportWork.timeperiod') }}</span>
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" :start-placeholder="$t('reportmanage.starttime')" style="margin-left: 20px;"
            value-format="YYYY-MM-DD hh:mm:ss" :end-placeholder="$t('reportmanage.endtime')">
          </el-date-picker>
 
@@ -517,11 +537,11 @@
            $t('reportmanage.inquire')
          }}
          </el-button>
          <el-table height="200px" ref="table" @selection-change="handleSelectionChange" :data="downGlass"
          <el-table height="600px" ref="table" @selection-change="handleSelectionChange" :data="downGlass" style="margin-top: 10px;"
            :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
            <el-table-column prop="workStationId" align="center" :label="$t('reportWork.stationnumber')" min-width="80" />
            <el-table-column prop="engineerId" align="center" :label="$t('basicData.projectnumber')" min-width="80" />
            <el-table-column prop="flowCardId" align="center" :label="$t('workOrder.cardnumber')" min-width="80" />
            <el-table-column prop="flowCardId" align="center" :label="$t('workOrder.cardnumber')" min-width="90" />
            <el-table-column prop="layer" align="center" :label="$t('searchOrder.ceng')" min-width="120" />
            <el-table-column prop="sequence" align="center" :label="$t('reportWork.order')" min-width="150" />
            <el-table-column prop="width" align="center" :label="$t('basicData.width')" min-width="120" />
@@ -531,7 +551,7 @@
            <el-table-column prop="glassId" align="center" :label="$t('searchOrder.glassID')" min-width="120" />
          </el-table>
        </el-dialog>
        <el-dialog v-model="dialogFormVisibleaDownGlasss" top="2vh" width="97%" :title="$t('searchOrder.filminformation')">
        <el-dialog v-model="dialogFormVisibleaDownGlasss" top="2vh" width="97%" :title="$t('reportWork.filminformation')">
          <div style="display:flex;justify-content: space-around;">
            <el-card
              style="display: flex; justify-content: center; align-items: center; width:800px; height: 800px;position: relative;">
@@ -586,7 +606,6 @@
    </el-card>
 
  </div>
  <el-dialog v-model="dialogFormVisiblea" top="21vh" width="40%" :title="$t('reportWork.bindingshelves')">
    <div style="margin-left: 50px;margin-top: 10px;margin-bottom: 10px;">
      <el-form size="mini" label-width="100px">
@@ -613,7 +632,7 @@
      </div>
    </template>
  </el-dialog>
  <el-dialog v-model="dialogFormVisiblea2" top="21vh" width="30%" :title="$t('reportWork.clearglass')">
  <el-dialog v-model="dialogFormVisiblea2" top="21vh" width="30%" :title="$t('reportWork.confirmclear')">
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="handleclear">
@@ -623,15 +642,25 @@
      </div>
    </template>
  </el-dialog>
  <el-dialog id="sizePrintCalrd" v-model="dialogTableVisible" destroy-on-close>
    <print-flow id="child" :printFlowCardId="printFlowCardId" :printLayer="printLayer"
      style="width: 100%;height: 100%" />
  <el-dialog v-model="dialogFormVisiblea3" top="21vh" width="30%" :title="$t('reportWork.confirmclear')">
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="clearGlass()">
          {{ $t('reportWork.sure') }}
        </el-button>
        <el-button @click="dialogFormVisiblea3 = false">{{ $t('reportWork.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog>
  <el-dialog id="sizePrintCalrd1" v-model="dialogTableVisible1" destroy-on-close>
    <print-label id="printFlowCard" :printFlowCardId="printFlowCardId" :printLayer="printLayer" :printGlassId="printGlassId"  style="" />
  </el-dialog>
    <el-dialog style="width: 75%;height: 75%;" id="sizePrintCalrd" v-model="dialogTableVisible" destroy-on-close>
      <print-flow id="child" :printFlowCardId="printFlowCardId" :printLayer="printLayer"
                  style="width: 100%;height: 100%"/>
    </el-dialog>
    <el-dialog id="sizePrintCalrd1" v-model="dialogTableVisible1" destroy-on-close>
      <print-label id="printFlowCard" :printFlowCardId="printFlowCardId" :printLayer="printLayer"
                   :printGlassId="printGlassId" style=""/>
    </el-dialog>
  </div>
</template>
<style scoped>
#dt {