| | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { reactive, onMounted, onBeforeUnmount, onUnmounted } from "vue"; |
| | | import {onBeforeUnmount, onMounted, onUnmounted, reactive, ref} from "vue"; |
| | | import { useRouter } from "vue-router" |
| | | const router = useRouter() |
| | | 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' |
| | | |
| | | const router = useRouter() |
| | | const { t } = useI18n() |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import Landingindication from "./Landingindication.vue"; |
| | | import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost, host } from '@/utils/constants' |
| | | // import PrintFlow from './PrintFlow.vue' |
| | | const printLoading = ref(true) |
| | | const fullFlowCard = ref('') |
| | | const autoPrint = ref(false) |
| | | |
| | | const dialogFormVisiblea = ref(false) |
| | | const dialogFormVisiblea2 = ref(false) |
| | | const dialogFormVisibleaDownGlass = ref(false) |
| | |
| | | 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 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 handleChange = async () => { |
| | | console.log("触发开关") |
| | | try { |
| | | const body = { |
| | | flag: autoPrint.value, // 使用 ganghua.value 获取当前开关的状态 |
| | | }; |
| | | |
| | | var url = "/unLoadGlass/downWorkStation/autoPrint?flag=" + autoPrint.value; |
| | | const response = await request.post(url) |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | autoPrint.value = response.data |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } |
| | | |
| | | |
| | | const handleInputChangea = (value, rowId) => { |
| | | // 更新对应行的 select 值 |
| | |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | |
| | | // 更新 tableData 的数据 |
| | | if (data.downGlassInfos != null) { |
| | | downGlass.value = data.downGlassInfos[0][1]; |
| | |
| | | if (data.engineerIdList != null) { |
| | | selectOptionsa.value = data.engineerIdList[0] |
| | | } |
| | | if (data.autoPrint != null) { |
| | | autoPrint.value = data.autoPrint; |
| | | } |
| | | console.log(autoPrint.value) |
| | | |
| | | // tableData.splice(0, tableData.length, ...data.params[0]); |
| | | tableData.splice(0, tableData.length, ...data.params[0]); |
| | | if (fullFlowCard.value == "") { |
| | | 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) { |
| | | // printFlowCardId.value = tableData[i].flowCardId; |
| | | fullFlowCard.value = tableData[i].flowCardId; |
| | | open(tableData[i]); |
| | | break; |
| | | } |
| | | } else { |
| | | console.log("没有flowCardId") |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // console.log("更新后数据", data.params[0]); |
| | | }; |
| | |
| | | // 查询数据 |
| | | 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); |
| | |
| | | } |
| | | |
| | | |
| | | // const open=async(row)=>{ |
| | | const open = async (row) => { |
| | | |
| | | // printFlowCardId.value=row.flowCardId; |
| | | // printLayer.value=row.layer |
| | | // dialogTableVisible.value = true; |
| | | // setTimeout(() => { |
| | | // printFlowCard(); // 替换成你要执行的函数名 |
| | | // }, 1000); |
| | | // ; |
| | | // } |
| | | printFlowCardId.value = row.flowCardId; |
| | | printLayer.value = row.layer |
| | | dialogTableVisible.value = true; |
| | | setTimeout(() => { |
| | | printFlowCard(); // 替换成你要执行的函数名 |
| | | dialogTableVisible.value = false; |
| | | }, 1000); |
| | | ; |
| | | |
| | | // const printFlowCard = () => { |
| | | // // 需要打印的局部区域赋予"print-wrap"的id |
| | | // let el = document.getElementById("child"); |
| | | // let doc = document; |
| | | // let body = doc.body || doc.getElementsByTagName("body")[0]; |
| | | // let printId = "print-" + Date.now(); |
| | | } |
| | | |
| | | // // 创建无副作用的打印容器(因不确定页面的打印元素有无其它样式) |
| | | // let content = doc.createElement("div"); |
| | | // content.id = printId; |
| | | const printFlowCard = () => { |
| | | // 需要打印的局部区域赋予"print-wrap"的id |
| | | let el = document.getElementById("child"); |
| | | let doc = document; |
| | | let body = doc.body || doc.getElementsByTagName("body")[0]; |
| | | let printId = "print-" + Date.now(); |
| | | |
| | | // // 样式控制与打印无关的元素隐藏 |
| | | // let style = doc.createElement("style"); |
| | | // style.innerHTML = |
| | | // "body>#" + |
| | | // printId + |
| | | // "{display:none}@media print{" + |
| | | // "@page {" + |
| | | // " size: auto; " + |
| | | // " margin: 2mm 2mm 0mm 1mm; " + |
| | | // " }body>:not(#" + |
| | | // printId + |
| | | // "){display:none !important}body>#" + |
| | | // printId + |
| | | // "{display:block;padding-top:1px}}"; |
| | | // // |
| | | // content.innerHTML = el.outerHTML; |
| | | // // // console.log("el.outerHTML", el.outerHTML); |
| | | // body.appendChild(style); |
| | | // 创建无副作用的打印容器(因不确定页面的打印元素有无其它样式) |
| | | let content = doc.createElement("div"); |
| | | content.id = printId; |
| | | |
| | | // // 与style元素设置的样式相配合 |
| | | // // 把打印内容的元素添加到body(作为body的子元素,可用body的子选择器 '>' 控制打印样式) |
| | | // body.appendChild(content); |
| | | // setTimeout(() => { |
| | | // window.print(); |
| | | // body.removeChild(content); |
| | | // body.removeChild(style); |
| | | // }, 20); |
| | | // } |
| | | // 样式控制与打印无关的元素隐藏 |
| | | let style = doc.createElement("style"); |
| | | style.innerHTML = |
| | | "body>#" + |
| | | printId + |
| | | "{display:none}@media print{" + |
| | | "@page {" + |
| | | " size: auto; " + |
| | | " margin: 2mm 2mm 0mm 1mm; " + |
| | | " }body>:not(#" + |
| | | printId + |
| | | "){display:none !important}body>#" + |
| | | printId + |
| | | "{display:block;padding-top:1px}}"; |
| | | // |
| | | content.innerHTML = el.outerHTML; |
| | | // // console.log("el.outerHTML", el.outerHTML); |
| | | body.appendChild(style); |
| | | |
| | | // 与style元素设置的样式相配合 |
| | | // 把打印内容的元素添加到body(作为body的子元素,可用body的子选择器 '>' 控制打印样式) |
| | | body.appendChild(content); |
| | | setTimeout(() => { |
| | | window.print(); |
| | | body.removeChild(content); |
| | | body.removeChild(style); |
| | | }, 20); |
| | | } |
| | | |
| | | |
| | | // beforeUnmount(() => { |
| | |
| | | <template> |
| | | <div> |
| | | <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary" |
| | | @click="dialogFormVisibleaDownGlass = true">落架详情</el-button> |
| | | @click="dialogFormVisibleaDownGlass = true">落架详情 |
| | | </el-button> |
| | | <el-switch style="margin-top: 5px;margin-left: 10px;" v-model="autoPrint" class="mb-2" :inactive-text="$t('自动打印')" |
| | | @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-column fixed="right" :label="$t('reportWork.operate')" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain v-show="scope.row.enableState !== '已启用'" |
| | | @click="handleBindRack(scope.row)">{{ $t('reportWork.bindingshelves') }}</el-button> |
| | | @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> |
| | | <el-button @click="open(scope.row)" :disabled="scope.row.flowCardId==null">打印</el-button> |
| | |
| | | @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> |
| | | }} |
| | | </el-button> |
| | | <el-table height="200px" ref="table" @selection-change="handleSelectionChange" :data="downGlass" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }"> |
| | | <el-table-column prop="workStationId" align="center" :label="$t('工位号')" min-width="80" /> |
| | |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- <el-dialog |
| | | id="sizePrintCalrd" |
| | | v-model="dialogTableVisible" |
| | | destroy-on-close |
| | | style="width: 75%;height:75% "> |
| | | <print-flow |
| | | id="child" |
| | | :printFlowCardId="printFlowCardId" |
| | | :printLayer="printLayer" |
| | | <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" |
| | | style="width: 100%;height: 100%"/> |
| | | </el-dialog> --> |
| | | </el-dialog> |
| | | |
| | | </template> |
| | | <style scoped> |