From 56fab901b298857ff4985b7429ef843c9a9d1471 Mon Sep 17 00:00:00 2001 From: wangfei <3597712270@qq.com> Date: 星期三, 28 八月 2024 16:20:02 +0800 Subject: [PATCH] 钢化模块打印功能,新增表格字段 --- UI-Project/src/views/UnLoadGlass/loadmachinerack.vue | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-) diff --git a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue index ec9f524..513c5a5 100644 --- a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue +++ b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue @@ -42,6 +42,7 @@ const printLayer = ref('') const now = new Date(); const timeRange = ref([]) +const browser=ref(false) const handleChange = async () => { console.log("瑙﹀彂寮�鍏�") @@ -64,7 +65,15 @@ console.error(error); } } - +const confirmBrowser = () =>{ + if (/chrome|chromium/i.test(navigator.userAgent) && !/edg/i.test(navigator.userAgent)) { + browser.value=true +} else if (/edg/i.test(navigator.userAgent)) { + browser.value=false +} else { + browser.value=false +} +} const handleInputChangea = (value, rowId) => { // 鏇存柊瀵瑰簲琛岀殑 select 鍊� @@ -201,8 +210,8 @@ autoPrint.value = data.autoPrint[0]; } - - if (fullFlowCard.value == ""&&autoPrint.value==true) { + //鑷姩鎵撳嵃 + if (fullFlowCard.value == ""&&autoPrint.value==true&&browser.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) { @@ -224,6 +233,7 @@ }; // 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁� onMounted(() => { + confirmBrowser();//鑾峰彇娴忚鍣� fetchFlowCardId(); fetchTableData(); // 鑾峰彇鏁版嵁 socket = initializeWebSocket(socketUrl, handleMessage); @@ -294,19 +304,19 @@ printLayer.value = row.layer dialogTableVisible.value = true; setTimeout(() => { - printFlowCard(); // 鏇挎崲鎴愪綘瑕佹墽琛岀殑鍑芥暟鍚� - //dialogTableVisible.value = false; - }, 1000); + printFlowCard(); + dialogTableVisible.value = false; + }, 2000); } const open1 = async (row) => { printFlowCardId.value = row.flowCardId; printLayer.value = row.layer dialogTableVisible1.value = true; -// setTimeout(() => { -// printFlowCard1(); // 鏇挎崲鎴愪綘瑕佹墽琛岀殑鍑芥暟鍚� -// //dialogTableVisible1.value = false; -// }, 1000); +setTimeout(() => { + printFlowCard1(); + //dialogTableVisible1.value = false; +}, 1000); } const printFlowCard = () => { @@ -319,6 +329,8 @@ // 鍒涘缓鏃犲壇浣滅敤鐨勬墦鍗板鍣�(鍥犱笉纭畾椤甸潰鐨勬墦鍗板厓绱犳湁鏃犲叾瀹冩牱寮�) let content = doc.createElement("div"); content.id = printId; + + // alert(/Chrome/.test(userAgent) && !/Edge/.test(userAgent)); // 鏍峰紡鎺у埗涓庢墦鍗版棤鍏崇殑鍏冪礌闅愯棌 let style = doc.createElement("style"); @@ -402,10 +414,10 @@ </script> <template> <div> - <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary" + <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 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('鑷姩鎵撳嵃')" + <el-switch style="margin-top: 10px;margin-left: 15px;margin-bottom: 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"> -- Gitblit v1.8.0