From 75b4aeda7ad7011a6239dc1bfa8362695f6c451a Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期一, 12 八月 2024 11:29:00 +0800 Subject: [PATCH] 添加下片自动打印流程卡开关 --- UI-Project/src/views/UnLoadGlass/loadmachinerack.vue | 54 +++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 41 insertions(+), 13 deletions(-) diff --git a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue index 7f796a3..ea71644 100644 --- a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue +++ b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue @@ -16,7 +16,8 @@ import PrintFlow from './PrintFlow.vue' import print from 'vue3-print-nb'; const printLoading = ref(true) -const fullFlowCard =ref('') +const fullFlowCard = ref('') +const autoPrint = ref(false) const dialogFormVisiblea = ref(false) const dialogFormVisiblea2 = ref(false) @@ -41,12 +42,28 @@ 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'); +const handleChange = async () => { + console.log("瑙﹀彂寮�鍏�") + try { + const body = { + flag: autoPrint.value, // 浣跨敤 ganghua.value 鑾峰彇褰撳墠寮�鍏崇殑鐘舵�� + }; - // 璋冪敤鎵撳嵃鍑芥暟锛屼紶閫掓墦鍗板尯鍩熺殑 DOM 鍏冪礌鍜岃烦杩囬瑙堢殑鍙傛暟 - print(printElement, { preview: false }); -}; + 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) => { @@ -169,6 +186,7 @@ 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]; @@ -176,15 +194,23 @@ 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 == 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; + 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") } } } @@ -268,7 +294,7 @@ dialogTableVisible.value = false; }, 1000); ; - + } const printFlowCard = () => { @@ -321,6 +347,8 @@ <div> <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary" @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;"> -- Gitblit v1.8.0