From 1dfbf152be9db7bc8c589a4d0bfba5df8d240585 Mon Sep 17 00:00:00 2001
From: cnf <3200815559@qq.com>
Date: 星期二, 16 九月 2025 13:10:40 +0800
Subject: [PATCH] 首检,来料检修改

---
 pages/QC/LLJ/Add.vue |   32 +++++
 pages/QC/SJ/Add.vue  |  313 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 344 insertions(+), 1 deletions(-)

diff --git a/pages/QC/LLJ/Add.vue b/pages/QC/LLJ/Add.vue
index 1b1d505..030990e 100644
--- a/pages/QC/LLJ/Add.vue
+++ b/pages/QC/LLJ/Add.vue
@@ -136,6 +136,7 @@
 			<button class="action-btn small" @click="addDestruction" v-if="this.current">鐮村潖瀹為獙</button>
 			<button class="action-btn small" @click="uploadImages">涓婁紶/鏌ョ湅鍥剧墖</button>
 			<button class="action-btn small" @click="fetchDrawingNumber">璋冨彇PLM鍥剧焊</button>
+			<button class="action-btn small" @click="getBom">Bom鐢ㄦ枡娓呭崟</button>
 			<button class="action-btn small" @click="viewAttachmentInfo">鏌ョ湅闄勪欢淇℃伅</button>
 			<button class="action-btn small" @click="addDefectDescription" v-if="this.current">娣诲姞涓嶈壇鎻忚堪</button>
 			<button class="action-btn small primary" @click="submitInspection" v-if="this.current">妫�楠屾彁浜�</button>
@@ -169,6 +170,32 @@
 				<button @click="clearDestruction">娓呴櫎</button>
 				<button @click="destructionPopup = !destructionPopup">鍙栨秷</button>
 			</view>
+		</view>
+		
+		<view class="barcode">
+			<u-modal :show="itemShow" title="鐗╂枡鏄庣粏" @confirm="drawingConfirm" @cancel="drawingCancel"
+				showCancelButton :z-index="1000">
+				<uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁" style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;">
+					<uni-tr>
+						<uni-th align="center">鏂欏彿</uni-th>
+						<uni-th align="center" width="90">鍚嶇О</uni-th>
+						<uni-th align="center" width="90">瑙勬牸鍨嬪彿</uni-th>
+						<uni-th align="center" width="150">璋冨彇PLM鍥剧焊</uni-th>
+					</uni-tr>
+					<uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;">
+						<uni-td align="center">{{item.itemNo}}</uni-td>
+						<uni-td align="center" style="font-size:25px;">
+							<div >{{item.itemName}}</div>
+						</uni-td>
+						<uni-td align="center" style="font-size:25px;">
+							<div>{{item.itemModel}}</div>
+						</uni-td>
+						<uni-td align="center" class="click-wd">
+							<div @click="fetchDrawingNumber">璋冨彇鍥剧焊</div>
+						</uni-td>
+					</uni-tr>
+				</uni-table>
+			</u-modal>
 		</view>
 		
 		<view class="barcode">
@@ -338,6 +365,7 @@
 				current: true,
 				drawing: [],
 				drawingShow: false,
+				itemShow: false,
 				badreason: '',
 				PSTYPE: '',
 				WORKSHOP: '',
@@ -806,11 +834,13 @@
 				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() {
@@ -860,7 +890,7 @@
 				});
 				this.drawingShow = true
 			},
-
+			
 
 			//鍥剧焊鐩稿叧鏂囨。
 			openDrawings(item) {
diff --git a/pages/QC/SJ/Add.vue b/pages/QC/SJ/Add.vue
index 6a3c50f..a846c6d 100644
--- a/pages/QC/SJ/Add.vue
+++ b/pages/QC/SJ/Add.vue
@@ -115,6 +115,12 @@
 			<button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">
 				涓婁紶/鏌ョ湅鍥剧墖
 			</button>
+			<button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="fetchDrawingNumber(formData.itemNo)">
+				璋冨彇PLM鍥剧焊
+			</button>
+			<button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="getBom">
+				Bom鐢ㄦ枡娓呭崟
+			</button>
 			<button class="action-btn secondary" v-if="!isUpdate && !isShowTable && formData.xjGenFlag == 0"
 				@click="saveXJ">
 				鐢熸垚宸℃
@@ -138,6 +144,61 @@
 				鎻愪氦妫�楠�
 			</button>
 		</view>
+		
+		<view class="barcode">
+			<u-modal :show="itemShow" title="鐗╂枡鏄庣粏" @confirm="drawingConfirm" @cancel="itemCancel"
+				showCancelButton :z-index="1000">
+				<uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁" style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;">
+					<uni-tr>
+						<uni-th align="center">鏂欏彿</uni-th>
+						<uni-th align="center" width="90">鍚嶇О</uni-th>
+						<uni-th align="center" width="90">瑙勬牸鍨嬪彿</uni-th>
+						<uni-th align="center" width="150">璋冨彇PLM鍥剧焊</uni-th>
+					</uni-tr>
+					<uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;">
+						<uni-td align="center">{{item.itemNo}}</uni-td>
+						<uni-td align="center" style="font-size:25px;">
+							<div >{{item.itemName}}</div>
+						</uni-td>
+						<uni-td align="center" style="font-size:25px;">
+							<div>{{item.itemModel}}</div>
+						</uni-td>
+						<uni-td align="center" class="click-wd">
+							<div @click="fetchDrawingNumber(item.itemNo)">璋冨彇鍥剧焊</div>
+						</uni-td>
+					</uni-tr>
+				</uni-table>
+			</u-modal>
+		</view>
+		
+		<view class="barcode">
+			<u-modal :show="drawingShow" title="鍥剧焊鏄庣粏" @confirm="drawingConfirm" @cancel="drawingCancel"
+				showCancelButton :z-index="1000">
+				<uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁" style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;">
+					<uni-tr>
+						<uni-th align="center">鐩稿叧鏂囨。</uni-th>
+						<uni-th align="center" width="90">鏈夋棤鍏宠仈PDF鏂囦欢</uni-th>
+						<uni-th align="center" width="90">鑳藉惁鎵撳紑鏂囦欢</uni-th>
+						<uni-th align="center" width="150">鎿嶄綔锛堢偣鍑伙級</uni-th>
+					</uni-tr>
+					<uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;">
+						<uni-td align="center">{{item.fName}}</uni-td>
+						<uni-td align="center" style="font-size:25px;">
+							<div v-if="item.fRelevantObject==' '" style="color: #E47470;">脳</div>
+							<div style="color: #90BA87;" v-else>鈭�</div>
+						</uni-td>
+						<uni-td align="center" style="font-size:25px;">
+							<div v-if="item.isSupported || item.fRelevantObject!=' '" style="color: #90BA87;">鈭�</div>
+							<div style="color: #E47470;" v-else>脳</div>
+						</uni-td>
+						<uni-td align="center" class="click-wd">
+							<div @click="openDrawings(item)">鎵撳紑鏂囨。</div>
+						</uni-td>
+					</uni-tr>
+				</uni-table>
+			</u-modal>
+		</view>
+		
 		<!-- 寮瑰嚭妗� -->
 		<view v-if="remarksPopup" class="overlay">
 			<view class="popup">
@@ -191,12 +252,17 @@
 				womdaaList: [],
 
 				tableData: [],
+				
+				drawing: [],
 
 				isSubmit: true,
 
 				isUpdate: true,
 
 				isShowTable: false,
+				
+				drawingShow: false,
+				itemShow: false,
 
 				remarks: "",
 				remarksPopup: false,
@@ -545,6 +611,253 @@
 					});
 				}
 			},
+			
+			drawingConfirm() {
+				this.drawingShow = false
+				this.imageShow = false
+				this.productionShow = false
+				this.itemShow=false
+			},
+			drawingCancel() {
+				this.drawingShow = false
+				this.imageShow = false
+				this.productionShow = false
+			},
+			itemCancel() {
+				this.itemShow=false
+			},
+			
+			fetchDrawingNumber(itemNo) {
+				// const item = '83040700101'
+				const item = itemNo;
+				console.log(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.100: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
+			},
+			
+			getBom(){
+				// const item = '83040700101'
+				const item = this.formData.daa001;
+				console.log(this.formData.daa001 );
+				console.log('daa001:', item);
+				console.log('ItemNo:', this.formData.itemNo);
+				
+				const url = this.$store.state.serverInfo.serverAPI + "/LLJ/getWomdab";
+				// 鎴栬�呭鏋滆矾寰勪笉鍚岋紝璇蜂娇鐢ㄦ纭殑绔偣
+				// const url = "http://192.168.0.100:10054/api/getWomdab"
+				
+				let _this = this;
+				
+				uni.request({
+				    url: url,
+				    method: 'POST',
+				    header: {
+				        'Content-Type': 'application/json'
+				    },
+				    data: {
+				          daa001: item,  // 鏍规嵁DTO灞炴�у悕浼犻��
+				          ItemNo: this.formData.itemNo   // 娉ㄦ剰澶у皬鍐欏尮閰�
+				    },
+				    success: (response) => {
+				        console.log(response);
+				        console.log("-------------------------------------");
+				        // 鏍规嵁鍚庣杩斿洖鐨勬暟鎹粨鏋勮繘琛岃皟鏁�
+				        if (response.data.status === 1) {
+				            // 鐘舵�佷负1琛ㄧず娌℃湁鏁版嵁
+				            _this.drawing = [];
+				            uni.showToast({
+				                title: response.data.message || '璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭�',
+				                icon: 'none'
+				            });
+				        } else if (response.data.status === 0) {
+				            // 鐘舵�佷负0琛ㄧず鎴愬姛
+				            if (response.data.data && response.data.data.tbBillList) {
+				                _this.drawing = response.data.data.tbBillList;
+				                
+				                // 閬嶅巻鏁版嵁锛屽垽鏂枃浠跺悗缂�骞舵坊鍔犲瓧娈�
+				                _this.drawing.forEach((file) => {
+				                    // 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑
+				                    const fileExtension = file.fName ? file.fName.split('.').pop().toLowerCase() : '';
+				                    
+				                    // 瀹氫箟鏀寔鐨勬枃浠剁被鍨�
+				                    const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc', 'docx', 'xls'];
+				                    
+				                    // 鍒ゆ柇鏄惁鏀寔璇ユ枃浠剁被鍨�
+				                    file.isSupported = supportedExtensions.includes(fileExtension);
+				                });
+				            } else {
+				                _this.drawing = [];
+				            }
+				        } else {
+				            // 鍏朵粬鐘舵�佺爜澶勭悊
+				            _this.drawing = [];
+				            uni.showToast({
+				                title: response.data.message || '璇锋眰澶辫触',
+				                icon: 'none'
+				            });
+				        }
+				    },
+				    fail: (error) => {
+				        uni.showToast({
+				            title: '璇锋眰鍥剧焊閾炬帴澶辫触',
+				            icon: 'none'
+				        });
+				        console.error('璇锋眰澶辫触:', error);
+				    }
+				});
+				this.itemShow = true
+			},
+			
+		//鍥剧焊鐩稿叧鏂囨。
+		openDrawings(item) {
+			console.log("jkjoi", item)
+			if (item.fRelevantObject.length > 2) {
+				// 鐢熸垚璇锋眰URL锛堢畝鍖栫紪鐮侀�昏緫锛�
+				const encodedName = encodeURIComponent(item.fName); 
+				const url = this.$store.state.serverInfo.serverAPI+`/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'
+						});
+					}
+				});
+			}
+			else
+			{
+				uni.showToast({
+					title: '璇锋眰棰勮閾炬帴澶辫触',
+					icon: 'none'
+				});
+			}
+		},
+			
 			getGenUpdate() {
 				if (!this.formData.id || !this.formData.billNo) {
 					this.$showMessage("璇峰厛淇濆瓨妫�楠屽崟锛�");

--
Gitblit v1.9.3