ZengTao
2024-08-10 7fd37a99f4bf0a3f2955e60436c63e59b58054f4
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -14,6 +14,10 @@
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
import { WebSocketHost, host } from '@/utils/constants'
import PrintFlow from './PrintFlow.vue'
import print from 'vue3-print-nb';
const printLoading = ref(true)
const fullFlowCard =ref('')
const dialogFormVisiblea = ref(false)
const dialogFormVisiblea2 = ref(false)
const dialogFormVisibleaDownGlass = ref(false)
@@ -28,12 +32,22 @@
const flowCardOptions = ref('[]');
const tableData = reactive([]);
const downGlass = ref([]);
const timeRange = ref(["2022-01-01", "2025-01-01"])
const selectValuesa = reactive({});
const selectOptionsa = ref([]);
const dialogTableVisible = ref(false)
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 printWithoutPreview = () => {
  const printElement = document.getElementById('printMe');
  // 调用打印函数,传递打印区域的 DOM 元素和跳过预览的参数
  print(printElement, { preview: false });
};
const handleInputChangea = (value, rowId) => {
  // 更新对应行的 select 值  
@@ -164,6 +178,17 @@
  }
  // tableData.splice(0, tableData.length, ...data.params[0]);
  if (fullFlowCard.value == "") {
    for (let i = 0; i < tableData.length; i++) {
      if (tableData[i].totalQuantity == tableData[i].racksNumber + tableData[i].otherNumber&&fullFlowCard.value!=tableData[i].flowCardId) {
        // printFlowCardId.value = tableData[i].flowCardId;
        fullFlowCard.value=tableData[i].flowCardId;
        open(tableData[i]);
        break;
      }
    }
  }
  //  console.log("更新后数据", data.params[0]);
};
@@ -218,14 +243,13 @@
// 查询数据
const selectDownGlassData = async () => {
  
  const response = await request.post("/unLoadGlass/downGlassInfo/selectDownGlassInfo", {
  const response = await request.post("/unLoadGlass/downGlassInfo/setDownGlassInfoRequest", {
    workStationId: selectValuesa[0],
    engineerId: selectValuesa[1],
    beginDate: timeRange.value[0],
    endDate: timeRange.value[1],
  })
  if (response.code === 200) {
    sendDownGlass.value = response.data;
    ElMessage.success(response.message);
  } else {
    ElMessage.error(response.message);
@@ -241,8 +265,10 @@
  dialogTableVisible.value = true;
  setTimeout(() => {
    printFlowCard(); // 替换成你要执行的函数名
    dialogTableVisible.value = false;
    }, 1000);
  ;
}
const printFlowCard = () => {
@@ -351,9 +377,12 @@
            @input="handleInputChangea($event, row.id)">
            <el-option v-for="item in selectOptionsa" :key="item" :label="item" :value="item" />
          </el-select>
          <el-date-picker style="margin-left: 10px;" v-model="timeRange" type="daterange" format="YYYY/MM/DD"
            value-format="YYYY-MM-DD" :start-placeholder="$t('reportmanage.starttime')"
            :end-placeholder="$t('reportmanage.endtime')" :default-time="defaultTime" />
          <span class="demonstration">时间段</span>
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
          <el-button type="primary" style="margin-left: 10px;" @click="selectDownGlassData()">{{
        $t('reportmanage.inquire')
      }}</el-button>
@@ -429,18 +458,11 @@
    </template>
  </el-dialog>
  <el-dialog
        id="sizePrintCalrd"
        v-model="dialogTableVisible"
        destroy-on-close
        style="width: 75%;height:75% ">
  <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> -->
      <print-flow
          id="child"
          :printFlowCardId="printFlowCardId"
          :printLayer="printLayer"
    <print-flow id="child" :printFlowCardId="printFlowCardId" :printLayer="printLayer"
          style="width: 100%;height: 100%"/>
    </el-dialog>