From e6044ce7c9513de2733ffbfb76cc953bcf7bd5d3 Mon Sep 17 00:00:00 2001 From: 展杰 <1240968267@qq.com> Date: 星期三, 03 七月 2024 14:12:49 +0800 Subject: [PATCH] 看图纸 --- pages/inspection/inspectionInfo.vue | 458 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 373 insertions(+), 85 deletions(-) diff --git a/pages/inspection/inspectionInfo.vue b/pages/inspection/inspectionInfo.vue index 5d02df2..8553222 100644 --- a/pages/inspection/inspectionInfo.vue +++ b/pages/inspection/inspectionInfo.vue @@ -2,62 +2,90 @@ <view> <view> <uni-card> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>妫�楠屽崟鍙�:</label> - </u-col> - <u-col span="4"> - <label>{{item.TASK_NO}}</label> - </u-col> - </u-row> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>鏈哄彴鍙�:</label> - </u-col> - <u-col span="4"> - <label>{{item.MACHINE_NO}}</label> - </u-col> - </u-row> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>宸ュ簭鍚嶇О:</label> - </u-col> - <u-col span="4"> - <label>{{item.PROC_NAME}}</label> - </u-col> - </u-row> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>浜у搧鍚嶇О:</label> - </u-col> - <u-col span="4"> - <label>{{item.ITEM_NAME}}</label> - </u-col> - </u-row> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>浜у搧缂栧彿:</label> - </u-col> - <u-col span="4"> - <label>{{item.ITEM_NO}}</label> - </u-col> - </u-row> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>妫�楠屽憳:</label> - </u-col> - <u-col span="4"> - <label>{{name}}</label> - </u-col> - </u-row> - <u-row customStyle="margin-bottom: 10px"> - <u-col span="2"> - <label>妫�楠岀被鍨�</label> - </u-col> - <u-col span="4"> - <label>{{item.REMEKE}}</label> - </u-col> - </u-row> + <view :class="new Date().getTime()-new Date(item.BEGIN_TIME).getTime()>7200000?'red':''"> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>妫�楠屽崟鍙�:</label> + </u-col> + <u-col span="4"> + <label>{{item.TASK_NO}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px" v-if="item.LOT_NO"> + <u-col span="2"> + <label>閿�鍞崟鍙�:</label> + </u-col> + <u-col span="4"> + <label>{{item.LOT_NO}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>宸ュ崟鏁伴噺:</label> + </u-col> + <u-col span="4"> + <label>{{item.DAA008}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>鏈哄彴 / 浜х嚎:</label> + </u-col> + <u-col span="4"> + <label>{{item.MACHINE_NO}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px" v-if="item.PROC_NAME"> + <u-col span="2"> + <label>宸ュ簭鍚嶇О:</label> + </u-col> + <u-col span="4"> + <label>{{item.PROC_NAME}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>浜у搧鍚嶇О:</label> + </u-col> + <u-col span="4"> + <label>{{item.ITEM_NO}} | {{item.ITEM_NAME}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>鍥惧彿棰滆壊:</label> + </u-col> + <u-col> + <label>{{item.ENGINEERING_NO}} / {{item.COLOR_NAME}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>瑙勬牸鏉愯川:</label> + </u-col> + <u-col> + <label>{{item.MODEL}} / {{item.MATERIAL}}</label> + </u-col> + </u-row> + <u-row customStyle="margin-bottom: 10px"> + <u-col span="2"> + <label>妫�楠屽憳/妫�楠岀被鍨�:</label> + </u-col> + <u-col span="4"> + <label>{{item.OPERATE_MAN}} / {{item.FTYPE}}</label> + </u-col> + </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> + </uni-card> </view> @@ -65,20 +93,24 @@ <uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁" style="margin-left: 5px;margin-right: 5px;"> <!-- 琛ㄥご琛� --> <uni-tr> - <uni-th align="center" width="80">妫�楠岄」鐩�</uni-th> - <uni-th align="left" width="100">妫�楠屽伐鍏�</uni-th> - <uni-th align="left" width="180">澶囨敞</uni-th> - <uni-th align="left" width="30">妫�楠屾暟閲�</uni-th> - <uni-th align="left" width="80">涓婇檺鍊�</uni-th> - <uni-th align="left" width="80">涓嬮檺鍊�</uni-th> - <uni-th align="left" width="100">妫�楠屽��</uni-th> - <uni-th align="left" width="80">妫�楠岀粨鏋�</uni-th> + <uni-th align="center" width="60">妫�楠岄」鐩�</uni-th> + <uni-th align="center" width="60">妫�楠屽伐鍏�</uni-th> + <uni-th align="center" width="140">瑙勬牸</uni-th> + <uni-th align="center" width="80" v-if="item.DEPARTMENT_NO=='HS0202'">缁勪欢鍚嶇О</uni-th> + <uni-th align="center" width="40">鏁伴噺</uni-th> + <uni-th align="center" width="60">涓婇檺鍊�</uni-th> + <uni-th align="center" width="60">涓嬮檺鍊�</uni-th> + <uni-th align="center" width="70">妫�楠屽��</uni-th> + <uni-th align="center" width="78">缁撴灉</uni-th> + <uni-th align="center" width="80">涓嶈壇鍘熷洜</uni-th> + <uni-th align="center" width="80">澶囨敞</uni-th> </uni-tr> <!-- 琛ㄦ牸鏁版嵁琛� --> - <uni-tr v-for="item in table"> + <uni-tr v-for="(item,index) in table"> <uni-td>{{item.CHECK_ITEM}}</uni-td> <uni-td>{{item.CHECK_TOOL}}</uni-td> <uni-td>{{item.SPECIFICATION}}</uni-td> + <uni-td v-if="item.FTEXT_TYPE">{{item.FTEXT_TYPE}}</uni-td> <uni-td>{{item.CHECK_NUM}}</uni-td> <uni-td>{{item.UP_ALLOW}}</uni-td> <uni-td>{{item.DOWN_ALLOW}}</uni-td> @@ -89,29 +121,76 @@ </uni-td> <uni-td> <u-tag - v-if="item.UP_ALLOW && item.VALUE <= item.UP_ALLOW && item.VALUE >= item.DOWN_ALLOW || !item.UP_ALLOW && item.VALUE == '鍚堟牸'" + v-if="item.UP_ALLOW && (parseFloat(item.VALUE) <= parseFloat(item.UP_ALLOW) && parseFloat(item.VALUE) >= parseFloat(item.DOWN_ALLOW)) || (!item.UP_ALLOW && item.VALUE == '鍚堟牸')" text="鍚堟牸" type="success"></u-tag> - <u-tag - v-if="item.UP_ALLOW && (item.VALUE > item.UP_ALLOW || item.VALUE < item.DOWN_ALLOW) || !item.UP_ALLOW && item.VALUE == '涓嶅悎鏍�'" - text="涓嶅悎鏍�" type="error"></u-tag> + <u-tag v-else text="涓嶅悎鏍�" type="error"></u-tag> + </uni-td> + <uni-td> + <!-- <view class="content" @click="useOutClickSide"> + <easy-select ref="easySelect" size="medium" :value="item.BAD_REASON" @selectOne="selectOne($event,index)"></easy-select> + </view> --> + <view class="login"> + <w-select style="margin-left: 20rpx;" v-model='chooseValue' defaultValue="璇烽�夋嫨" :list='list' + valueName='CONTENT' keyName="ID" @change='change(index)'> + </w-select> + </view> + </uni-td> + <uni-td> + <u--textarea height="40px" v-model="item.MEMO" placeholder="璇疯緭鍏ュ唴瀹�"></u--textarea> </uni-td> </uni-tr> </uni-table> </view> - <u-button text="鎻愪氦" type="primary" style="position: absolute;bottom:0;" @click="submit()"></u-button> + <view style="margin-top: 10px;"> + <u-row style="margin-bottom: 5px;"> + <u--text type="info" text="澶囨敞"></u--text> + </u-row> + <u-row> + <u--textarea v-model="remeke" placeholder="璇疯緭鍏ュ唴瀹�"></u--textarea> + </u-row> + </view> + <!-- 寮瑰嚭绐楀彛 --> + <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 class="pdf-view"> + <!-- 鍦ㄦ澶勬樉绀� PDF 鍐呭 --> + <iframe :src="pdfLink" width="100%" height="100%"></iframe> + </view> + </view> + </view> + + <u-button text="鎻愪氦" type="primary" style="margin-top: 10px;" @click="submit()"></u-button> + <u-toast ref="uToast" /> </view> </template> <script> import { - getInspectionInfo, saveInspectionInfo + getInspectionInfo, + saveInspectionInfo, + getBadReason, + generateInfoc } from '../../api/inspection'; + import { + baseUrl + } from '../../config.js' export default { data() { return { item: {}, table: [], - name:'' + name: '', + remeke: '', + pdfVisible: false, // 鍦ㄨ繖閲屽0鏄� pdfVisible + pdfLink: '', // 涔熷0鏄� pdfLink锛岀‘淇濆畠浠槸鍝嶅簲寮忕殑 + //show: false + chooseValue: "", + list: [] } }, onLoad(option) { @@ -119,27 +198,70 @@ this.item = item this.getInspection(item.CHECK_NO) this.name = uni.getStorageSync('userInfo').username + this.getBadReason() + }, + onNavigationBarButtonTap(e) { + let that = this + uni.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['camera'], + success: chooseImage => { + const tempFilePaths = chooseImage.tempFilePaths; + uni.uploadFile({ + url: 'http://183.249.77.50:8008' + '/hkFile/upload?mid=' + that.item.CHECK_NO + + '&username=' + uni.getStorageSync('userInfo').code, + filePath: tempFilePaths[0], + name: 'file', + success: (uploadFileRes) => { + console.log(uploadFileRes.data); + + }, + fail: (res) => { + console.log(res) + } + }); + } + }) }, methods: { getInspection(chenkNo) { getInspectionInfo(chenkNo).then(res => { - // this.table = res.data for (let item of res.data) { - for (let i = 0; i < parseInt(item.CHECK_NUM); i++) { - let insert = JSON.parse(JSON.stringify(item)) + // for (let i = 0; i < parseInt(item.CHECK_NUM); i++) { + // let insert = JSON.parse(JSON.stringify(item)) - insert.CHECK_ITEM = insert.CHECK_ITEM + '-' + i - if (!insert.UP_ALLOW) { - insert.VALUE = '鍚堟牸' - } else { - insert.VALUE = 0 - } - this.table.push(insert) + // insert.CHECK_ITEM = insert.CHECK_ITEM + '-' + i + // if (!insert.UP_ALLOW) { + // insert.VALUE = '鍚堟牸' + // } else { + // insert.VALUE = null + // } + // this.table.push(insert) + // } + if (!item.UP_ALLOW) { + item.VALUE = '鍚堟牸' + } else { + item.VALUE = null } + + this.table.push(item) } + console.log(this.table) }) }, + // selectOne(options,index) { + // this.table[index].BAD_REASON = options.label + // console.log(options.label); + // }, + // useOutClickSide() { + // this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions() + // }, + change(index) { + this.table[index].BAD_REASON = this.chooseValue; + }, changeSwitch(item) { + console.log(item) if (item.VALUE == '鍚堟牸') { item.VALUE = '涓嶅悎鏍�' } else { @@ -147,11 +269,129 @@ } }, submit() { - saveInspectionInfo(this.item.CHECK_NO,this.table).then(res => { - console.log(res) + if (this.table.length == 0) { + this.$refs.uToast.show({ + message: "鎻愪氦澶辫触锛岃缁存姢妫�楠岄」鐩�", + type: 'error' + }) + return + } else { + if (this.check()) { + saveInspectionInfo(this.item.CHECK_NO, this.table, this.remeke).then(res => { + if (!res.result) { + this.$refs.uToast.show({ + message: res.msg, + type: 'error' + }) + return + } else { + // this.$refs.uToast.show({ + // message: "鎻愪氦鎴愬姛", + // type: 'success' + // }) + let pages = getCurrentPages(); + let beforePage = pages[pages.length - 2]; + uni.navigateBack({ + delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤� + success: (event) => { + console.log('鎻愪氦鎴愬姛'); + beforePage.$vm.reload() + } + }); + } + }) + return + } + this.$refs.uToast.show({ + message: '鏈夋楠岄」鐩湭褰曞叆瀹屾暣娴嬭瘯缁撴灉锛�', + type: 'error' + }) + return + } + }, + generate() { + generateInfo(this.item.CHECK_NO).then(res => { + if (!res.result) { + this.$refs.uToast.show({ + message: res.msg, + type: 'error' + }) + return + } else { + this.$refs.uToast.show({ + message: "鏇存柊鎴愬姛", + type: 'success' + }) + this.table.splice(0, this.table.length) + this.getInspection(this.item.CHECK_NO) + } }) + }, + getBadReason() { + + getBadReason().then(res => { + console.log(res) + if (!res.result) { + this.$refs.uToast.show({ + message: res.msg, + type: 'error' + }) + return + } + this.list = res.data + }) + }, + check() { + for (let item of this.table) { + if (item.VALUE === null) { + return false + } + } + return true + + }, + fetchDrawingNumber() { + let lb = 0; + if (this.item.ITEM_NO.startsWith('A') || this.item.ITEM_NO.startsWith('B')) { + lb = 1; + } else if (this.item.ITEM_NO.startsWith('C')) { + lb = 2; + } + const id = this.item.ENGINEERING_NO; + // lb = 2; + // const id = 'A3-A010'; + const url = "http://192.168.0.98:808/deviceMessage.ashx?lb='"+lb+"'&id='"+id+"'"; + //const url = `/api/deviceMessage.ashx?lb=${lb}&id=${id}`; // 浣跨敤浠g悊璺緞 + + // 鎵撳嵃 URL 杩涜璋冭瘯 + console.log("Request URL:", url); + uni.request({ + url: url, + method: 'POST', + success: (response) => { + const respData = response.data; + if (respData != "") { + this.pdfLink = respData; + this.pdfVisible = true; + } else { + uni.showToast({ + title: respData.msg, + icon: 'none' + }); + } + }, + fail: (error) => { + uni.showToast({ + title: '璇锋眰鍥惧彿閾炬帴澶辫触', + icon: 'none' + }); + } + }); + }, + closeModal() { + this.pdfVisible = false; } - } + }, } </script> @@ -180,4 +420,52 @@ .text { font-size: x-large; } + + .red { + color: red; + } + + + .modal { + display: flex; + justify-content: center; + align-items: center; + position: absolute; + top: 10%; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + z-index: 1000; + } + + .modal-content { + background-color: white; + padding: 20px; + border-radius: 10px; + width: 80%; + height: 80%; + } + + .pdf-view { + width: 100%; + height: 100%; + } + + button { + background-color: #4CAF50; + color: white; + border: none; + padding: 10px 20px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; + } + + button:hover { + background-color: #45a049; + } </style> \ No newline at end of file -- Gitblit v1.9.3