ZengTao
2024-08-18 f1916b183ebcff81c64bccae502a63b097c304f5
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -6,6 +6,9 @@
import request from "@/utils/request";
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";
const router = useRouter()
const {t} = useI18n()
@@ -23,6 +26,7 @@
const dialogFormVisible = ref(false);
// 表单数据
const workstationId = ref('');
const workFlowCard = ref('');
const selectedProjectNoa = ref(null); // 当前选中的角色
const flowCardId = ref('');
const flowCardOptions = ref('[]');
@@ -35,7 +39,7 @@
const printFlowCardId = ref('')
const printLayer = ref('')
const now = new Date();
const timeRange = ref([new Date(now.setHours(0, 0, 0, 0)), new Date(now.setHours(23, 59, 59, 999))])
const timeRange = ref([])
const handleChange = async () => {
  console.log("触发开关")
@@ -103,7 +107,6 @@
      flowCardId: firstPart,
      layer: twoPart
    });
    console.log(response)
    if (response.code == 200) {
      // 绑定成功,处理逻辑
      console.log('绑定成功');
@@ -129,6 +132,7 @@
const handleBindRack2 = (row) => {
  workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名
  dialogFormVisiblea2.value = true; // 打开绑定架子对话框
  workFlowCard.value=row.flowCardId;
};
//清除内容
const handleclear = async () => {
@@ -143,6 +147,9 @@
      console.log('清除成功');
      ElMessage.success(response.message);
      dialogFormVisiblea2.value = false;
      if(fullFlowCard.value==workFlowCard.value){
        fullFlowCard.value="";
      }
    } else if (response.code === 500) {
      // 清除失败的逻辑
      console.log('清除失败');
@@ -183,18 +190,17 @@
  // 更新 tableData 的数据
  if (data.downGlassInfos != null) {
    downGlass.value = data.downGlassInfos[0][1];
    downGlass.value = data.downGlassInfos[0];
  }
  if (data.engineerIdList != null) {
    selectOptionsa.value = data.engineerIdList[0]
  }
  if (data.autoPrint != null) {
    autoPrint.value = data.autoPrint;
    autoPrint.value = data.autoPrint[0];
  }
  console.log(autoPrint.value)
  tableData.splice(0, tableData.length, ...data.params[0]);
  if (fullFlowCard.value == "") {
  if (fullFlowCard.value == ""&&autoPrint.value==true) {
    for (let i = 0; i < tableData.length; i++) {
      if (tableData[i].totalQuantity != 0) {
        if (tableData[i].totalQuantity == tableData[i].racksNumber + tableData[i].otherNumber && fullFlowCard.value != tableData[i].flowCardId) {
@@ -208,7 +214,9 @@
      }
    }
  }
  if(data.params!=null){
    tableData.splice(0, tableData.length, ...data.params[0]);
  }
  //  console.log("更新后数据", data.params[0]);
};
@@ -285,9 +293,9 @@
  dialogTableVisible.value = true;
  setTimeout(() => {
    printFlowCard(); // 替换成你要执行的函数名
    dialogTableVisible.value = false;
    //dialogTableVisible.value = false;
  }, 1000);
  ;
}
@@ -304,19 +312,22 @@
  // 样式控制与打印无关的元素隐藏
  let style = doc.createElement("style");
  console.log("style1:"+style.innerHTML)
  style.innerHTML =
      "body>#" +
      printId +
      "{display:none}@media print{" +
      "{display:none;}@media print{" +
      "@page {" +
      "    size: auto; " +
      "    margin: 2mm 2mm 0mm 1mm; " +
      "    margin: 10mm 5mm 10mm 5mm; " +
      "  }body>:not(#" +
      printId +
      "){display:none !important}body>#" +
      "){display:none !important;}body>#" +
      printId +
      "{display:block;padding-top:1px}}";
  //
      "{display:block;}#" +
      printId +
      "{display: block; padding: 0; margin: 0;  width: 100%;  position: absolute; top: 0; left: 0; height: 100vh;  box-sizing: border-box;}} ";
  content.innerHTML = el.outerHTML;
  // // console.log("el.outerHTML", el.outerHTML);
  body.appendChild(style);
@@ -330,6 +341,8 @@
    body.removeChild(style);
  }, 20);
}
// beforeUnmount(() => {
@@ -392,9 +405,6 @@
            <el-option label="5" value="5"></el-option>
            <el-option label="6" value="6"></el-option>
            <el-option label="7" value="7"></el-option>
            <el-option label="8" value="8"></el-option>
            <el-option label="9" value="9"></el-option>
            <el-option label="10" value="10"></el-option>
          </el-select>
          <el-select v-model="selectValuesa[1]" filterable :placeholder="$t('basicData.plselectproject')" clearable
@@ -403,7 +413,7 @@
          </el-select>
          <span class="demonstration">时间段</span>
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期"
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" value-format = "YYYY-MM-DD hh:mm:ss"
                          end-placeholder="结束日期">
          </el-date-picker>
@@ -483,10 +493,7 @@
    </template>
  </el-dialog>
  <el-dialog id="sizePrintCalrd" v-model="dialogTableVisible" destroy-on-close style="width: 75%;height:75% ">
    <!-- <template #header="{ close, titleId, titleClass }">
        <el-button  @click="printFlowCard" >打印</el-button>
      </template> -->
  <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>