From ea5c60a0ac52216b22d6096d2d0394c2480f5bc3 Mon Sep 17 00:00:00 2001
From: yhj <1836460075@qq.com>
Date: 星期五, 19 十二月 2025 14:53:03 +0800
Subject: [PATCH] 20251219 cnf修改
---
夏蒙注塑报工/pages/scbg/scbg.vue | 751 +++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 588 insertions(+), 163 deletions(-)
diff --git "a/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue" "b/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue"
index 9d42411..177a4c3 100644
--- "a/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue"
+++ "b/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue"
@@ -178,6 +178,8 @@
<view class="history-record">
<button @click="viewHistory" class="lsjl">鍘嗗彶璁板綍</button <!-- 寮瑰嚭绐楀彛鏄剧ず鍘嗗彶璁板綍 -->
+ <button @click="fetchDrawingNumber" class="lsjl">璋冨彇PLM鍥剧焊</button <!-- 寮瑰嚭绐楀彛鏄剧ずplm鍥剧焊璁板綍 -->
+
<view v-if="showHistoryPopup" class="history-popup">
<!-- 寮圭獥澶撮儴 -->
<view class="popup-header">
@@ -206,10 +208,61 @@
</view>
</scroll-view>
</view>
+
</view>
- <!-- <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button>
- --></view>
+ <view v-if="drawingShow" class="history-popup">
+ <!-- 寮圭獥瀹瑰櫒 -->
+ <view class="popup-container">
+ <!-- 鍐呭鍖哄煙 -->
+ <view class="popup-content">
+ <!-- 琛ㄥご -->
+ <view class="history-header">
+ <view class="header-item" id="tm">鐩稿叧鏂囨。</view>
+ <view class="header-item" id="sl">鏈夋棤鍏宠仈PDF鏂囦欢</view>
+ <view class="header-item" id="sj">鑳藉惁鎵撳紑鏂囦欢</view>
+ <view class="header-item" id="ry">鎿嶄綔锛堢偣鍑伙級</view>
+ </view>
+
+ <!-- 琛ㄦ牸鍐呭鍖哄煙 -->
+ <scroll-view scroll-y="true" class="history-scroll">
+ <!-- 鏁版嵁涓虹┖鏃剁殑鎻愮ず -->
+ <view v-if="(!drawing || drawing.length === 0)" class="empty-text">
+ 鏆傛棤鏇村鏁版嵁
+ </view>
+
+ <!-- 鏈夋暟鎹椂鏄剧ず鐨勫垪琛� -->
+ <view v-for="(item, index) in (drawing || [])" :key="index" class="history-record">
+ <view class="record-item">{{ item.fName }}</view>
+ <view class="record-item" style="font-size:25px;">
+ <div v-if="item.fRelevantObject==' '" style="color: #E47470;">脳</div>
+ <div style="color: #90BA87;" v-else>鈭�</div>
+ </view>
+ <view class="record-item" style="font-size:25px;">
+ <div v-if="item.isSupported || item.fRelevantObject!=' '"
+ style="color: #90BA87;">鈭�</div>
+ <div style="color: #E47470;" v-else>脳</div>
+ </view>
+ <view class="record-item click-wd" @click="openDrawings(item)">
+ 鎵撳紑鏂囨。
+ </view>
+ </view>
+ </scroll-view>
+ </view>
+
+ <!-- 鍥哄畾鍦ㄦ渶搴曢儴鐨勬寜閽尯鍩� -->
+ <view class="popup-footer">
+ <view class="popup-buttons">
+ <button class="popup-button cancel-button" @click="drawingCancel">鍙栨秷</button>
+ <button class="popup-button confirm-button" @click="drawingConfirm">纭畾</button>
+ </view>
+ </view>
+ </view>
+ </view>
+
+ <!-- <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button>
+ -->
+ </view>
</view>
</view>
@@ -230,12 +283,13 @@
{{ deviceState }}
</view>
</view>
- <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button>
-
+ <button @click="reprintLast" :disabled="isButtonDisabled2"
+ class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button>
+
<!-- 鎸夐挳鏀惧湪鐘舵�佹枃鏈殑涓嬫柟 -->
<!-- <button @click="manualCheck" class="check-button">鎵嬪姩妫�娴�</button> -->
<view class="version" v-if="version">
- 鐗堟湰鍙凤細{{ version }}
+ 鐗堟湰鍙凤細{{ version }}
</view>
</view>
@@ -247,7 +301,7 @@
<button @click="sendForFirstInspection" class="round-btn">棣栨閫佹</button>
</view>
</view>
-
+
</view>
</template>
@@ -267,6 +321,9 @@
data() {
return {
showHistoryPopup: false, // 鎺у埗寮瑰嚭妗嗘樉绀�
+ drawing: [],
+ drawingShow: false,
+ itemShow: false,
selectedPerson: '',
selectedLine: '',
selectedOrder: '',
@@ -288,7 +345,7 @@
orderQuantity: '', // 璁㈠崟鏁伴噺
producedQuantity: '', // 宸茬敓浜ф暟
bzsl: '', // 鎺ㄨ崘鍖呰鏁�
- gdzt:'',
+ gdzt: '',
itemId: '', // 鐗╂枡ID
itemNo: '', // 鐗╂枡缂栫爜
itemname: '', // 鐗╂枡鍚嶇О
@@ -329,8 +386,8 @@
networkState: "妫�娴嬩腑...",
deviceState: "妫�娴嬩腑...",
networkModalVisible: false, // 鎺у埗缃戠粶寮圭獥鏄惁宸叉樉绀�
- usbModalVisible: false ,// 鎺у埗 USB 寮圭獥鏄惁宸叉樉绀�
- updateChecked: false,
+ usbModalVisible: false, // 鎺у埗 USB 寮圭獥鏄惁宸叉樉绀�
+ updateChecked: false,
};
},
// components:{
@@ -350,9 +407,9 @@
console.log("椤甸潰鍔犺浇锛屽紑濮嬫娴� USB 鍜岀綉缁�...");
console.log("UsbModule:", UsbModule); // 鎵撳嵃 UsbModule 鏄惁鍙敤
console.log("UsbModule.isUsbConnect:", UsbModule?.isUsbConnect); // 鎵撳嵃鏂规硶鏄惁瀛樺湪
- if (typeof plus !== 'undefined') {
- this.version = plus.runtime.version;
- }
+ if (typeof plus !== 'undefined') {
+ this.version = plus.runtime.version;
+ }
this.checkForUpdate(); // 鍚姩鏃舵鏌ョ増鏈洿鏂�
//this.startAutoUpdateCheck(); // 寮�濮嬪畾鏃舵鏌ョ増鏈洿鏂�
@@ -376,7 +433,7 @@
this.stopAutoUpdateCheck(); // 椤甸潰閿�姣佹椂鍋滄瀹氭椂鍣紝闃叉鍐呭瓨娉勬紡
},
checkForUpdate() {
- if (this.updateChecked) return;
+ if (this.updateChecked) return;
uni.request({
url: "http://192.168.0.107:10086/update.json", // 浣犵殑鏈嶅姟鍣� JSON 鏂囦欢鍦板潃
success: (res) => {
@@ -395,9 +452,9 @@
// }
// });
this.downloadNewApk(res.data.apkUrl);
- this.updateChecked = true; // 鏍囪鏇存柊宸叉鏌ヨ繃
+ this.updateChecked = true; // 鏍囪鏇存柊宸叉鏌ヨ繃
// // 濡傛灉鏈夋柊鐗堟湰锛屽紑濮嬩笅杞�
- //download(res.data.apkUrl);
+ //download(res.data.apkUrl);
}
},
fail: (err) => {
@@ -405,7 +462,7 @@
}
});
},
-
+
downloadNewApk(apkUrl) {
uni.showToast({
@@ -423,7 +480,7 @@
}, function() {
console.log("瀹夎鎴愬姛锛岄噸鍚簲鐢�");
//plus.runtime.restart();
- //plus.runtime.quit();
+ //plus.runtime.quit();
// uni.navigateBack()
}, function(e) {
console.error("瀹夎澶辫触:", e);
@@ -918,7 +975,7 @@
productionOrder: '', // 鐢熶骇璁㈠崟
orderQuantity: '', // 璁㈠崟鏁伴噺
bzsl: '', // 鎺ㄨ崘鍖呰鏁�
- gdzt:'',
+ gdzt: '',
producedQuantity: '', // 宸茬敓浜ф暟
itemId: '', // 鐗╂枡ID
itemNo: '', // 鐗╂枡缂栫爜
@@ -1050,61 +1107,61 @@
});
}
});
-
- // 璋冪敤 API 鑾峰彇宸ュ崟璇︽儏
- uni.request({
- url: `http://192.168.0.107:44380/api/orderDetails?orderNo=${encodeURIComponent(this.orderNo)}`, // 浣跨敤瀛樺偍鐨刼rderNo
- method: 'GET',
- header: {
- 'Content-Type': 'application/json'
- },
- success: (res) => {
- console.log('gongdanxinx', res.data);
- if (res.statusCode === 200) {
- this.orderDetails = {
- requirementDoc: res.data.requirementDoc, // 闇�姹傚崟鎹�
- productionOrder: res.data.productionOrder, // 鐢熶骇璁㈠崟
- orderQuantity: res.data.orderQuantity, // 璁㈠崟鏁伴噺
- bzsl: res.data.bzsl, // 鎺ㄨ崘鍖呰鏁�
- gdzt: res.data.gdzt, // 宸ュ崟鐘舵��
- producedQuantity: res.data.producedQuantity, // 宸茬敓浜ф暟
- itemId: res.data.itemId, // 鐗╂枡ID
- itemNo: res.data.itemNO, // 鐗╂枡缂栫爜
- itemname: res.data.itemname, // 鐗╂枡鍚嶇О
- itemmodel: res.data.itemmodel, // 瑙勬牸鍨嬪彿
-
-
- };
- // 鏍规嵁 sj 鍜� xj 鐨勫�兼潵璁剧疆棣栨鍜屽贰妫�鐘舵��
- // 鏍规嵁 sj 鍜� xj 鐨勫�兼潵璁剧疆棣栨鍜屽贰妫�鐘舵��
- if (res.data.sj === 1) {
- this.checkFirstPass = true; // 棣栨鍚堟牸
- } else if (res.data.sj === 2) {
- this.checkFirstPass = false; // 棣栨涓嶅悎鏍�
+
+ // 璋冪敤 API 鑾峰彇宸ュ崟璇︽儏
+ uni.request({
+ url: `http://192.168.0.107:44380/api/orderDetails?orderNo=${encodeURIComponent(this.orderNo)}`, // 浣跨敤瀛樺偍鐨刼rderNo
+ method: 'GET',
+ header: {
+ 'Content-Type': 'application/json'
+ },
+ success: (res) => {
+ console.log('gongdanxinx', res.data);
+ if (res.statusCode === 200) {
+ this.orderDetails = {
+ requirementDoc: res.data.requirementDoc, // 闇�姹傚崟鎹�
+ productionOrder: res.data.productionOrder, // 鐢熶骇璁㈠崟
+ orderQuantity: res.data.orderQuantity, // 璁㈠崟鏁伴噺
+ bzsl: res.data.bzsl, // 鎺ㄨ崘鍖呰鏁�
+ gdzt: res.data.gdzt, // 宸ュ崟鐘舵��
+ producedQuantity: res.data.producedQuantity, // 宸茬敓浜ф暟
+ itemId: res.data.itemId, // 鐗╂枡ID
+ itemNo: res.data.itemNO, // 鐗╂枡缂栫爜
+ itemname: res.data.itemname, // 鐗╂枡鍚嶇О
+ itemmodel: res.data.itemmodel, // 瑙勬牸鍨嬪彿
+
+
+ };
+ // 鏍规嵁 sj 鍜� xj 鐨勫�兼潵璁剧疆棣栨鍜屽贰妫�鐘舵��
+ // 鏍规嵁 sj 鍜� xj 鐨勫�兼潵璁剧疆棣栨鍜屽贰妫�鐘舵��
+ if (res.data.sj === 1) {
+ this.checkFirstPass = true; // 棣栨鍚堟牸
+ } else if (res.data.sj === 2) {
+ this.checkFirstPass = false; // 棣栨涓嶅悎鏍�
+ } else {
+ this.checkFirstPass = null; // 棣栨鏈仛
+ }
+
+ if (res.data.xj === 1) {
+ this.checkXJ = true; // 宸℃鍚堟牸
+ } else if (res.data.xj === 2) {
+ this.checkXJ = false; // 宸℃涓嶅悎鏍�
+ } else {
+ this.checkXJ = null; // 宸℃鏈仛
+ }
+
+
+ console.log('Order details loaded:', this.orderDetails);
+
} else {
- this.checkFirstPass = null; // 棣栨鏈仛
+ console.error('Failed to fetch order details:', res);
}
-
- if (res.data.xj === 1) {
- this.checkXJ = true; // 宸℃鍚堟牸
- } else if (res.data.xj === 2) {
- this.checkXJ = false; // 宸℃涓嶅悎鏍�
- } else {
- this.checkXJ = null; // 宸℃鏈仛
- }
-
-
- console.log('Order details loaded:', this.orderDetails);
-
- } else {
- console.error('Failed to fetch order details:', res);
+ },
+ fail: (err) => {
+ console.error('Error fetching order details:', err);
}
- },
- fail: (err) => {
- console.error('Error fetching order details:', err);
- }
- });
-
+ });
+
},
mapStatus(status) {
if (status === 3) {
@@ -1245,19 +1302,19 @@
// 鎻愪氦鎶ュ伐淇℃伅鐨勬柟娉�
printBarcode() {
// **鍏堟鏌� USB 杩炴帴鐘舵��**
- if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
- uni.showModal({
- title: ` ${this.networkState}`,
- content: "璇锋鏌ユ墦鍗版満杩炴帴",
- showCancel: false,
- success: () => {
- this.modalVisible = false;
+ /* if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
+ uni.showModal({
+ title: ` ${this.networkState}`,
+ content: "璇锋鏌ユ墦鍗版満杩炴帴",
+ showCancel: false,
+ success: () => {
+ this.modalVisible = false;
- }
- });
- return; // **USB 杩炴帴澶辫触锛岀洿鎺ヨ繑鍥烇紝闃叉鎵ц鎵撳嵃**
- }
-
+ }
+ });
+ return; // **USB 杩炴帴澶辫触锛岀洿鎺ヨ繑鍥烇紝闃叉鎵ц鎵撳嵃**
+ }*/
+
uni.request({
url: `http://192.168.0.107:44380/api/persons/${encodeURIComponent(this.personCode)}`, // 淇敼鍚庣殑璇锋眰璺緞
method: 'GET',
@@ -1302,7 +1359,7 @@
return;
}
-
+
// 鏍煎紡鍖栧綋鍓嶆椂闂翠负"骞存湀鏃ユ椂鍒嗙"鏍煎紡
const currentTime = new Date();
const formattedTime = this.formatDate(currentTime);
@@ -1317,8 +1374,8 @@
//itemSpec: '瑙勬牸鍨嬪彿', // 杩欓噷鍙敼鎴愬疄闄呮暟鎹�
quantity: Number(this.reportedQuantity) // 纭繚鏄暣鏁�
- };
- this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃鏉$爜鍓�",requestData.uniqueValue);
+ };
+ this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃鏉$爜鍓�", requestData.uniqueValue);
// 灏� requestData 淇濆瓨鍒� lastRequestData 涓�
this.lastRequestData = requestData;
console.log(requestData);
@@ -1368,8 +1425,8 @@
//鎵撳嵃鏉$爜
return;
}
- // **鍏堣褰� "鎵撳嵃鍓�" 浜嬩欢**
- this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃", requestData.uniqueValue);
+ // **鍏堣褰� "鎵撳嵃鍓�" 浜嬩欢**
+ this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃", requestData.uniqueValue);
//鎵撳嵃鏉$爜
console.log('tiaoma', requestData.uniqueValue);
console.log('gd', this.orderDetails.productionOrder);
@@ -1443,27 +1500,27 @@
// command.setFeed(30);
this.sendData = command.getData();
- // 1. 鎵ц鍙戦��
- let printResult = this.senUSBData();
-
- // 2. 鍒ゆ柇鍙戦�佹槸鍚︽垚鍔�
- if (printResult.success) {
- // 鉁� 鍙戦�佹垚鍔燂紝璁板綍鎵撳嵃鏃ュ織
- this.logPrintEvent("鎵撳嵃鍚�", "鎵撳嵃", requestData.uniqueValue);
- } else {
- // 鉂� 鍙戦�佸け璐ワ紝鎻愮ず鐢ㄦ埛锛屼笉璁板綍鏃ュ織
- uni.showToast({
- title: "鎵撳嵃澶辫触锛屾湭璁板綍鏃ュ織",
- duration: 2000
- });
- }
+ // 1. 鎵ц鍙戦��
+ let printResult = this.senUSBData();
- this.oldbgs = this.reportedQuantity;
- this.bgr=
- //浠庢柊鍒锋柊宸ュ崟淇℃伅
- loadOrderDetails();
+ // 2. 鍒ゆ柇鍙戦�佹槸鍚︽垚鍔�
+ if (printResult.success) {
+ // 鉁� 鍙戦�佹垚鍔燂紝璁板綍鎵撳嵃鏃ュ織
+ this.logPrintEvent("鎵撳嵃鍚�", "鎵撳嵃", requestData.uniqueValue);
+ } else {
+ // 鉂� 鍙戦�佸け璐ワ紝鎻愮ず鐢ㄦ埛锛屼笉璁板綍鏃ュ織
+ uni.showToast({
+ title: "鎵撳嵃澶辫触锛屾湭璁板綍鏃ュ織",
+ duration: 2000
+ });
+ }
+
+ this.oldbgs = this.reportedQuantity;
+ this.bgr =
+ //浠庢柊鍒锋柊宸ュ崟淇℃伅
+ loadOrderDetails();
//浠庢柊鍒锋柊鍘嗗彶璁板綍
-
+
this.fetchHistoryRecords(this.orderNo);
},
@@ -1486,10 +1543,179 @@
// lines.push(text); // 鏈�鍚庝竴琛�
// return lines;
// },
-
+
+ drawingConfirm() {
+ this.drawingShow = false
+ // this.imageShow = false
+ // this.productionShow = false
+ // this.itemShow = false
+ },
+ drawingCancel() {
+ this.drawingShow = false
+ // this.imageShow = false
+ // this.productionShow = false
+ // this.itemShow = false
+ },
+
+ fetchDrawingNumber() {
+ // const item = 'BC.XM.001.006.009.0002'
+ const item = this.orderDetails.itemNo;
+ console.log(this.orderDetails.itemNo)
+ // console.log(item)
+ // const url = this.$store.state.serverInfo.serverAPI +"/PLM/RetrieveDrawings?ItemNo=" + item
+
+ // const item = '5.06.04.4002';
+ const url = "http://192.168.0.107:10054/api/PLM/RetrieveDrawings?ItemNo=" + item
+
+ let _this = this;
+
+ uni.request({
+ url: url,
+ method: 'POST',
+ success: (response) => {
+ console.log(response)
+ if (response.data.data == '杩斿洖缁撴灉涓虹┖') {
+ _this.drawing = []
+ } else {
+ _this.drawing = response.data.data
+ // 閬嶅巻鏁版嵁锛屽垽鏂枃浠跺悗缂�骞舵坊鍔犲瓧娈�
+ _this.drawing.forEach((file) => {
+ // 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑
+ const fileExtension = file.fName.split('.').pop()
+ .toLowerCase();
+
+ // 瀹氫箟鏀寔鐨勬枃浠剁被鍨�
+ const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc',
+ 'docx',
+ 'xls'
+ ];
+
+ // 鍒ゆ柇鏄惁鏀寔璇ユ枃浠剁被鍨�
+ file.isSupported = supportedExtensions.includes(fileExtension);
+ });
+ }
+ },
+ fail: (error) => {
+ uni.showToast({
+ title: '璇锋眰鍥剧焊閾炬帴澶辫触',
+ icon: 'none'
+ });
+ }
+ });
+ this.drawingShow = true
+ },
+
+
+ //鍥剧焊鐩稿叧鏂囨。
+ openDrawings(item) {
+ console.log("jkjoi", item.fRelevantObject)
+ if (item.fRelevantObject.length > 2) {
+ // 鐢熸垚璇锋眰URL锛堢畝鍖栫紪鐮侀�昏緫锛�
+ const encodedName = encodeURIComponent(item.fName);
+ const url = `http://192.168.0.107:10054/api/PLM/OpenDrawingsGet?fileId=${item.fRelevantObject}&fName=${encodedName}`;
+ console.log('璇锋眰URL:', url);
+
+ const now = new Date();
+ const timestamp = [
+ now.getFullYear(),
+ String(now.getMonth() + 1).padStart(2, '0'),
+ String(now.getDate()).padStart(2, '0'),
+ String(now.getHours()).padStart(2, '0'),
+ String(now.getMinutes()).padStart(2, '0'),
+ String(now.getSeconds()).padStart(2, '0')
+ ].join('');
+
+ // 鐢熸垚鏂版枃浠跺悕锛堝熀纭�鍚峗鏃堕棿鎴�.鍚庣紑锛�
+ this.fileName = `${item.fName}_${timestamp}.pdf`;
+ console.log('鏂版枃浠跺悕:', this.fileName);
+
+ uni.downloadFile({
+ url: url,
+ success: (res) => {
+ console.log(res);
+ let fileName = this.fileName;
+ let fileExt = fileName.split('.').pop();
+ // let newFilePath = "_doc/uniapp_temp_1742877118745/download" + "/" + fileName;
+ // console.log('newFilePath', newFilePath)
+ if (fileExt === 'xls' || fileExt === 'xlsx' || fileExt === 'pdf' || fileExt ===
+ 'jpg' || fileExt === 'png') {
+ plus.io.resolveLocalFileSystemURL(res.tempFilePath, (entry) => {
+ // 鑾峰彇鏂囦欢鎵�鍦ㄧ殑鐩綍
+ entry.getParent((parentEntry) => {
+ let newFileName = this.fileName; // 鏂扮殑鏂囦欢鍚�
+
+ // 绉诲姩骞堕噸鍛藉悕鏂囦欢
+ entry.moveTo(
+ parentEntry,
+ newFileName,
+ (newEntry) => {
+ console.log('閲嶅懡鍚嶆垚鍔�:', newEntry.fullPath);
+
+ // 鎵撳紑 Excel 鏂囦欢
+ plus.runtime.openFile(newEntry
+ .fullPath, {}, (e) => {
+ console.error('鏃犳硶鎵撳紑 Excel 鏂囦欢:',
+ e);
+ });
+
+ // let pages = getCurrentPages();
+ // let beforePage = pages[pages.length - 2];
+ // uni.navigateBack({
+ // delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤�
+ // success: (event) => {
+ // beforePage.$vm.reload()
+ // }
+ // });
+
+ },
+ (err) => {
+ console.error('閲嶅懡鍚嶅け璐�:', err);
+ }
+ );
+ }, (err) => {
+ console.error('鑾峰彇鐖剁洰褰曞け璐�:', err);
+ });
+ }, (err) => {
+ console.error('鑾峰彇鏂囦欢澶辫触:', err);
+ });
+ } else {
+ console.error('鏂囦欢鏍煎紡涓嶅尮閰�:', fileExt);
+ uni.showToast({
+ title: '鏂囦欢鏍煎紡涓嶆敮鎸�',
+ icon: 'none'
+ });
+ }
+ }
+ })
+
+ uni.request({
+ url: url,
+ method: 'POST',
+ responseType: 'arraybuffer',
+ success: (response) => {
+ console.log(response.data)
+ if (!response) {
+ uni.showToast({
+ title: "鍗忚棰勮澶辫触",
+ duration: 2000
+ });
+ }
+
+ },
+ fail: (error) => {
+ console.log(error)
+ uni.showToast({
+ title: '璇锋眰棰勮閾炬帴澶辫触',
+ icon: 'none'
+ });
+ }
+ });
+ }
+ },
+
// 琛ユ墦涓婁竴寮犺褰�
reprintLast() {
-
+
// 绂佺敤鎸夐挳5绉�
this.isButtonDisabled2 = true;
setTimeout(() => {
@@ -1530,7 +1756,7 @@
});
}
});
- this.selectedPerson = this.lastRequestData.printedBy;
+ this.selectedPerson = this.lastRequestData.printedBy;
// 琛ユ墦涓婁竴寮犺褰�
this.fetchHistoryRecords(this.orderNo);
if (!this.lastRequestData) {
@@ -1541,8 +1767,8 @@
});
return;
}
- //20250507 鏂板姞璧嬪�煎巻鍙叉潯鐮佹姤宸ヤ汉
- this.selectedPerson = this.lastRequestData.printedBy;
+ //20250507 鏂板姞璧嬪�煎巻鍙叉潯鐮佹姤宸ヤ汉
+ this.selectedPerson = this.lastRequestData.printedBy;
console.log("鑰佹潯鐮�", this.oldbgs);
// 閲嶆柊鎵撳嵃涓婁竴寮犺褰�
// async reprintLast() {
@@ -1562,8 +1788,8 @@
// });
// return; // 閫�鍑猴紝閬垮厤缁х画鎵ц鎵撳嵃
// }
- // **璁板綍 "琛ユ墦鍓�" 浜嬩欢**
- this.logPrintEvent("鎵撳嵃鍓�", "琛ユ墦", this.lastRequestData);
+ // **璁板綍 "琛ユ墦鍓�" 浜嬩欢**
+ this.logPrintEvent("鎵撳嵃鍓�", "琛ユ墦", this.lastRequestData);
// 鎵撳嵃鍐呭鏍峰紡璁剧疆
const command = tsc.jpPrinter.createNew();
@@ -1622,59 +1848,58 @@
command.setPagePrint();
command.setFeed(3);
this.sendData = command.getData();
- // 1. 鎵ц鍙戦��
- let printResult = this.senUSBData();
-
- // 2. 鍒ゆ柇鍙戦�佹槸鍚︽垚鍔�
- if (printResult.success) {
- // 鍙戦�佹垚鍔燂紝璁板綍鎵撳嵃鏃ュ織
- this.logPrintEvent("鎵撳嵃鍚�", "琛ユ墦", this.lastRequestData);
- } else {
- // 鍙戦�佸け璐ワ紝鎻愮ず鐢ㄦ埛锛屼笉璁板綍鏃ュ織
- uni.showToast({
- title: "鎵撳嵃澶辫触锛屾湭璁板綍鏃ュ織",
- duration: 2000
- });
- }
-F
+ // 1. 鎵ц鍙戦��
+ let printResult = this.senUSBData();
+
+ // 2. 鍒ゆ柇鍙戦�佹槸鍚︽垚鍔�
+ if (printResult.success) {
+ // 鍙戦�佹垚鍔燂紝璁板綍鎵撳嵃鏃ュ織
+ this.logPrintEvent("鎵撳嵃鍚�", "琛ユ墦", this.lastRequestData);
+ } else {
+ // 鍙戦�佸け璐ワ紝鎻愮ず鐢ㄦ埛锛屼笉璁板綍鏃ュ織
+ uni.showToast({
+ title: "鎵撳嵃澶辫触锛屾湭璁板綍鏃ュ織",
+ duration: 2000
+ });
+ }
+ F
// 鍙戦�佹暟鎹�
this.senUSBData();
- // **璁板綍 "琛ユ墦鍚�" 浜嬩欢**
-
+ // **璁板綍 "琛ユ墦鍚�" 浜嬩欢**
+
+ },
+ logPrintEvent(eventType, printType, barcodeValue) {
+
+
+ const requestData = {
+ barcode: barcodeValue, // 鏉$爜
+ worker: this.personCode, // 鎶ュ伐浜�
+ eventType: eventType, // "鎵撳嵃鍓�" 鎴� "鎵撳嵃鍚�"
+ printType: printType, // "鎵撳嵃" 鎴� "琛ユ墦"
+ orderNo: this.selectedOrder, // 宸ュ崟鍙�
+ line: this.selectedLine,
+ version: this.version // 绾夸綋
+ };
+ console.log(requestData);
+ uni.request({
+ url: "http://192.168.0.107:44380/api/LogPrintEvent/logEvent",
+ method: 'POST',
+ header: {
+ 'Content-Type': 'application/json'
+ },
+ data: requestData,
+ success: (response) => {
+ if (response.statusCode === 200) {
+ console.log(`${eventType} - ${printType} 璁板綍鎴愬姛`);
+ } else {
+ console.error(`${eventType} - ${printType} 璁板綍澶辫触:`, response);
+ }
+ },
+ fail: (err) => {
+ console.error("璇锋眰澶辫触:", err);
+ }
+ });
}
- ,
- logPrintEvent(eventType, printType, barcodeValue) {
-
-
- const requestData = {
- barcode: barcodeValue, // 鏉$爜
- worker: this.personCode, // 鎶ュ伐浜�
- eventType: eventType, // "鎵撳嵃鍓�" 鎴� "鎵撳嵃鍚�"
- printType: printType, // "鎵撳嵃" 鎴� "琛ユ墦"
- orderNo: this.selectedOrder, // 宸ュ崟鍙�
- line: this.selectedLine ,
- version:this.version// 绾夸綋
- };
- console.log(requestData);
- uni.request({
- url: "http://192.168.0.107:44380/api/LogPrintEvent/logEvent",
- method: 'POST',
- header: {
- 'Content-Type': 'application/json'
- },
- data: requestData,
- success: (response) => {
- if (response.statusCode === 200) {
- console.log(`${eventType} - ${printType} 璁板綍鎴愬姛`);
- } else {
- console.error(`${eventType} - ${printType} 璁板綍澶辫触:`, response);
- }
- },
- fail: (err) => {
- console.error("璇锋眰澶辫触:", err);
- }
- });
- }
}
};
</script>
@@ -2369,4 +2594,204 @@
box-sizing: border-box;
/* 纭繚鍐呰竟璺濆拰杈规鍖呭惈鍦ㄥ搴﹀唴 */
}
+
+ /* 濡傛灉闇�瑕佹寜閽瓑瀹藉苟闈犺竟 */
+ .popup-buttons {
+ display: flex;
+ justify-content: space-between;
+ /* 宸﹀彸鍒嗗竷 */
+ gap: 20px;
+ /* 鎸夐挳涔嬮棿鐨勯棿璺� */
+ }
+
+ .popup-button {
+ flex: 1;
+ /* 璁╀袱涓寜閽瓑瀹� */
+ min-width: 100px;
+ padding: 12px 0;
+ border-radius: 6px;
+ font-size: 8px;
+ font-weight: 500;
+ }
+
+ /* 鎴栬�呬繚鎸佸師瀹藉害浣嗗浐瀹氬湪涓よ竟 */
+ .popup-buttons.fixed-sides {
+ display: flex;
+ justify-content: space-between;
+ }
+
+ .popup-buttons.fixed-sides .popup-button {
+ flex: 0 0 auto;
+ /* 涓嶄几缂╋紝淇濇寔鍘熷ぇ灏� */
+ }
+
+ /* 寮圭獥鏁翠綋鏍峰紡淇濇寔涓嶅彉锛屽鍔犻珮搴︽帶鍒� */
+ .history-popup {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 80%;
+ height: 70%;
+ background-color: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
+ z-index: 1000;
+ display: flex;
+ flex-direction: column;
+ }
+
+ /* 寮圭獥澶撮儴 */
+ .popup-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px;
+ border-bottom: 1px solid #ccc;
+ flex-shrink: 0;
+ /* 闃叉澶撮儴琚帇缂� */
+ }
+
+ .popup-title {
+ font-size: 18px;
+ font-weight: bold;
+ }
+
+ /* 鍐呭鍖呰鍣� - 鍥哄畾楂樺害锛屽彲婊氬姩 */
+ .popup-content-wrapper {
+ flex: 1;
+ /* 鍗犳嵁鍓╀綑绌洪棿 */
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ /* 闅愯棌婧㈠嚭鍐呭 */
+ }
+
+ /* 琛ㄥご鍥哄畾 */
+ .history-header {
+ display: flex;
+ justify-content: space-between;
+ font-weight: bold;
+ border-bottom: 1px solid #ccc;
+ padding: 10px 5px;
+ background-color: #fff;
+ flex-shrink: 0;
+ /* 闃叉琛ㄥご琚帇缂� */
+ z-index: 1;
+ /* 纭繚琛ㄥご鍦ㄦ渶涓婂眰 */
+ }
+
+ /* 婊氬姩鍖哄煙 - 鑷�傚簲楂樺害 */
+ .history-scroll {
+ flex: 1;
+ /* 鍗犳嵁鍓╀綑绌洪棿 */
+ overflow-y: auto;
+ padding: 0 5px;
+ }
+
+ /* 绌烘暟鎹彁绀� */
+ .empty-text {
+ text-align: center;
+ padding: 40px 0;
+ color: #999;
+ font-size: 16px;
+ }
+
+ /* 鍥哄畾鍦ㄥ脊绐楀簳閮ㄧ殑鎸夐挳鍖哄煙 */
+ .popup-footer {
+ padding: 15px 20px;
+ border-top: 1px solid #eee;
+ background-color: #fff;
+ flex-shrink: 0;
+ /* 闃叉搴曢儴琚帇缂� */
+ box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
+ }
+
+ /* 鎸夐挳鍖哄煙 */
+ .popup-buttons {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ }
+
+ .popup-button {
+ flex: 1;
+ min-width: 100px;
+ padding: 12px 0;
+ border-radius: 6px;
+ font-size: 16px;
+ font-weight: 500;
+ border: none;
+ outline: none;
+ cursor: pointer;
+ }
+
+ .cancel-button {
+ background-color: #f8f9fa;
+ color: #6c757d;
+ border: 1px solid #dee2e6;
+ }
+
+ .cancel-button:hover {
+ background-color: #e9ecef;
+ color: #495057;
+ }
+
+ .confirm-button {
+ background-color: #1890ff;
+ color: white;
+ }
+
+ .confirm-button:hover {
+ background-color: #40a9ff;
+ }
+
+ /* 琛ㄦ牸鍐呭琛屾牱寮� */
+ .history-record {
+ display: flex;
+ justify-content: space-between;
+ border-bottom: 1px solid #eee;
+ padding: 10px 0;
+ font-size: 14px;
+ }
+
+ /* 琛ㄥご鍜岃〃鏍煎唴瀹圭殑姣忓垪鏍峰紡 */
+ .header-item,
+ .record-item {
+ flex: 1;
+ text-align: center;
+ padding: 0 5px;
+ word-wrap: break-word;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ /* 鎵撳紑鏂囨。鏍峰紡 */
+ .click-wd {
+ color: #1890ff;
+ cursor: pointer;
+ text-decoration: underline;
+ }
+
+ .click-wd:hover {
+ color: #40a9ff;
+ }
+
+ /* 绉诲姩绔�傞厤 */
+ @media (max-width: 768px) {
+ .history-popup {
+ width: 95%;
+ height: 85%;
+ }
+
+ .popup-button {
+ min-width: 80px;
+ padding: 10px 0;
+ font-size: 14px;
+ }
+
+ .popup-buttons {
+ gap: 10px;
+ }
+ }
</style>
\ No newline at end of file
--
Gitblit v1.9.3