From b22000f1e0034376f408d236f4425e1dc98e51d8 Mon Sep 17 00:00:00 2001
From: yhj <1836460075@qq.com>
Date: 星期三, 05 六月 2024 13:58:28 +0800
Subject: [PATCH] 查看图号
---
pages/inspection/inspectionInfo.vue | 83 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 82 insertions(+), 1 deletions(-)
diff --git a/pages/inspection/inspectionInfo.vue b/pages/inspection/inspectionInfo.vue
index 53a5a60..ae31139 100644
--- a/pages/inspection/inspectionInfo.vue
+++ b/pages/inspection/inspectionInfo.vue
@@ -77,6 +77,23 @@
</u-row>
<u-button text="鐢熸垚妫�楠岃祫鏂�" type="primary" :plain="true" style="width: 200px;height: 100px;position: absolute;top: 30%;right: 10%;" @click="generate()"></u-button>
</view>
+
+
+ <view class="container">
+ <button @click="fetchDrawingNumber">鏌ョ湅鍥惧彿</button>
+
+ <!-- 寮瑰嚭绐楀彛 -->
+ <view v-if="pdfVisible" class="modal">
+ <view class="modal-content">
+ <view class="modal-header">
+ <text>PDF棰勮</text>
+ <button @click="closeModal">鍏抽棴</button>
+ </view>
+ <web-view v-if="pdfLink" :src="pdfLink" class="pdf-view"></web-view>
+ </view>
+ </view>
+ </view>
+
</uni-card>
</view>
@@ -304,6 +321,7 @@
})
},
getBadReason() {
+
getBadReason().then(res => {
console.log(res)
if(!res.result) {
@@ -323,8 +341,71 @@
}
}
return true
+
}
- }
+ },
+ getMaterialInfo(checkNo) {
+ return uni.request({
+ url: '/check/getMaterialInfo?checkNo=' + checkNo,
+ method: 'POST',
+ header: {
+ 'Content-Type': 'application/json',
+ 'dataType': 'json',
+ 'Accept': 'application/json'
+ }
+ });
+ },
+ closeModal() {
+ this.pdfVisible = false;
+ },
+ fetchDrawingNumber() {
+ // 鑾峰彇褰撳墠椤甸潰鐨勬楠屽崟鍙�
+ const checkNo = this.item.CHECK_NO;
+
+ // 绗竴娆¤姹傦細鑾峰彇鐗╂枡淇℃伅
+ this.getMaterialInfo(checkNo).then(res => {
+ const data = res[1].data; // uni.request 杩斿洖鐨勬槸涓�涓暟缁勶紝res[1] 鎵嶆槸 response
+ if (data.result) {
+ const { materialId, drawingNumber } = data.data;
+ const url = `http://192.168.0.98:808/deviceMessage.ashx?lb=${materialId}&id=${drawingNumber}`;
+
+ // 绗簩娆¤姹傦細鑾峰彇PDF閾炬帴
+ uni.request({
+ url: url,
+ method: 'POST',
+ success: (response) => {
+ const respData = response.data;
+ if (respData.result) {
+ this.pdfLink = respData.link; // 璁剧疆PDF閾炬帴
+ this.pdfVisible = true; // 鎵撳紑寮瑰嚭绐楀彛
+ } else {
+ uni.showToast({
+ title: respData.msg,
+ icon: 'none'
+ });
+ }
+ },
+ fail: (error) => {
+ uni.showToast({
+ title: '璇锋眰鍥惧彿閾炬帴澶辫触',
+ icon: 'none'
+ });
+ }
+ });
+ } else {
+ uni.showToast({
+ title: data.msg,
+ icon: 'none'
+ });
+ }
+ }).catch(error => {
+ uni.showToast({
+ title: '鑾峰彇鐗╂枡淇℃伅澶辫触',
+ icon: 'none'
+ });
+ });
+
+ }
}
</script>
--
Gitblit v1.9.3