From 7c2192a2f000d94add173b77b6bd4c8c4fc6a5e4 Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期三, 17 九月 2025 09:41:47 +0800 Subject: [PATCH] SJ穴模数 --- pages/QC/SJ/detail.vue | 388 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 346 insertions(+), 42 deletions(-) diff --git a/pages/QC/SJ/detail.vue b/pages/QC/SJ/detail.vue index 5cd7f31..023ce37 100644 --- a/pages/QC/SJ/detail.vue +++ b/pages/QC/SJ/detail.vue @@ -52,6 +52,14 @@ <view class="info-label">涓婇檺</view> <view class="info-value">{{ formData.maxValue }}</view> </view> + <view class="info-item" v-if="formData.mnum"> + <view class="info-label">寮�绌存�绘暟</view> + <view class="info-value">{{ formData.mnum }}</view> + </view> + <view class="info-item" v-if="formData.dnum"> + <view class="info-label">鍫电┐鍙�</view> + <view class="info-value">{{ formData.dnum }}</view> + </view> <view class="info-item" v-if="formData.updater"> <view class="info-label">鏇存柊浜�</view> <view class="info-value">{{ formData.updater }}</view> @@ -114,13 +122,13 @@ 涓嶅悎鏍兼弿杩� </button> - <input v-if="tableData.length < formData.levelNum" + <input v-if="!isAllCompleted" v-model="formData.fcheckResu" type="text" class="result-input" placeholder="娌℃湁鏈�澶у�煎拰鏈�灏忓�兼椂濉啓0锛堟湭閫氳繃妫�楠岋級鎴�1锛堥�氳繃妫�楠岋級" placeholder-class="placeholder" /> - <button v-if="(tableData.length < formData.levelNum)" + <button v-if="!isAllCompleted" style="margin: 0px;background-color: #3498db;color:#ffffff ;" class="btn primary-btn" @tap="submit">淇濆瓨缁撴灉</button> </view> @@ -129,28 +137,38 @@ </view> <!-- 缁撴灉琛ㄦ牸 --> - <view v-if="tableData.length > 0" class="table-container"> + <view v-if="formData.levelNum > 0" class="table-container"> <view class="table-header"> <view class="th">缂栧彿</view> + <view class="th">绌村彿</view> + <view class="th">璁板綍鍊�</view> <view class="th">妫�楠岀粨鏋�<i style="color: rgb(0 212 68);" - v-if="!(tableData.length < formData.levelNum)">锛堣緭鍏ュ凡瀹屾垚锛�</i></view> + v-if="isAllCompleted">锛堣緭鍏ュ凡瀹屾垚锛�</i></view> <view class="th">鎿嶄綔</view> </view> - <view v-for="(item, index) in tableData" :key="index" class="table-row"> + <view v-for="(item, index) in displayTableData" :key="index" class="table-row"> <view class="td">{{ index + 1 }}</view> + <view class="td">{{ getHoleNumber(index) }}</view> <view class="td"> - <view :class="['result-badge', getResultClass(item.fcheckResu, item.fstand)]"> - {{ item.fcheckResu }} + <view class="record-value">{{ getRecordValue(item, index) }}</view> + </view> + <view class="td"> + <view :class="['result-badge', getResultClass(item.fcheckResu, item.fstand, index)]"> + {{ getResultText(item.fcheckResu, item.fstand, index) }} </view> </view> <view class="td"> - <button v-if="!isNumber" class="btn danger-btn" @tap="numberEdit(item)"> + <!-- 淇敼鎸夐挳 - 宸插~鍐欏悗鏄剧ず --> + <button v-if="!isHoleBlocked(index) && item.fcheckResu && !isNumber" class="btn danger-btn" @tap="numberEdit(item)"> {{ editResult(item.fcheckResu) }} </button> - <button v-if="isNumber" class="btn danger-btn" @tap="toDetail(item)"> + <button v-if="!isHoleBlocked(index) && item.fcheckResu && isNumber" class="btn danger-btn" @tap="toDetail(item)"> 淇敼 </button> + <!-- 鐘舵�佹樉绀� --> + <span v-if="isHoleBlocked(index)" class="blocked-text">宸插牭绌�</span> + <span v-else-if="!item.fcheckResu" class="ready-text">鍙~鍐�</span> </view> </view> </view> @@ -203,6 +221,7 @@ </view> </view> </view> + </view> </template> @@ -228,16 +247,178 @@ tabs: [] } }, + computed: { + // 鏍规嵁绌村彿淇℃伅鐢熸垚瀹屾暣鐨勬樉绀烘暟鎹� + displayTableData() { + const result = []; + + console.log('displayTableData - formData:', this.formData); + console.log('displayTableData - tableData:', this.tableData); + + // 濡傛灉鏈夌┐鍙蜂俊鎭紝浣跨敤绌村彿淇℃伅鐢熸垚鏁版嵁 + if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) { + // 瀵规暟鎹簱璁板綍鎸夊垱寤烘椂闂存帓搴忥紝纭繚椤哄簭绋冲畾 + const sortedTableData = [...this.tableData].sort((a, b) => { + if (a.id && b.id) return a.id - b.id; + if (a.createDate && b.createDate) return new Date(a.createDate) - new Date(b.createDate); + return 0; + }); + + console.log('displayTableData - sortedTableData:', sortedTableData); + + this.formData.holeNumbers.forEach((holeInfo, index) => { + // 鐩存帴閫氳繃绱㈠紩鑾峰彇瀵瑰簲鐨勬暟鎹簱璁板綍 + const actualData = sortedTableData[index]; + + if (actualData) { + // 濡傛灉鏈夊疄闄呮暟鎹紝浣跨敤瀹為檯鏁版嵁 + result.push({ + ...actualData, + index: index, + holeInfo: holeInfo + }); + } else { + // 濡傛灉娌℃湁瀹為檯鏁版嵁锛屽垱寤虹┖璁板綍 + result.push({ + id: null, + fcheckResu: holeInfo.isBlocked ? "/" : null, + fstand: holeInfo.isBlocked ? "/" : null, + index: index, + pid: this.id, + gid: this.gid, + holeInfo: holeInfo + }); + } + }); + } else { + // 濡傛灉娌℃湁绌村彿淇℃伅锛屼娇鐢ㄥ師鏉ョ殑閫昏緫 + const levelNum = this.formData.levelNum || 0; + + // 鎸夌収鍒涘缓鏃堕棿鎴朓D鎺掑簭锛岀‘淇濋『搴忕ǔ瀹� + const sortedTableData = [...this.tableData].sort((a, b) => { + if (a.id && b.id) return a.id - b.id; + if (a.createDate && b.createDate) return new Date(a.createDate) - new Date(b.createDate); + return 0; + }); + + console.log('displayTableData - sortedTableData (no holes):', sortedTableData); + + for (let i = 0; i < levelNum; i++) { + const actualData = sortedTableData[i]; + + if (actualData) { + result.push({ + ...actualData, + index: i + }); + } else { + result.push({ + id: null, + fcheckResu: null, + fstand: null, + index: i, + pid: this.id, + gid: this.gid + }); + } + } + } + + console.log('displayTableData - result:', result); + return result; + }, + + // 鍒ゆ柇鏄惁鎵�鏈夋楠岄兘宸插畬鎴� + isAllCompleted() { + // 鍙鏌ラ潪鍫电┐鐨勮鏄惁閮藉凡濉啓 + return this.displayTableData.every(item => { + // 濡傛灉鏄牭绌达紝璺宠繃妫�鏌� + if (item.holeInfo && item.holeInfo.isBlocked) { + return true; + } + // 闈炲牭绌寸殑琛屽繀椤绘湁妫�楠岀粨鏋� + return item.fcheckResu !== null && item.fcheckResu !== undefined; + }); + } + }, methods: { - getResultClass(fcheckResu, fstand) { - // 鏍规嵁妫�楠岀粨鏋滃拰鍒ゅ畾鏍囪瘑纭畾鏍峰紡绫� - if (fstand === '鈭�' || fcheckResu === 'OK') { + getResultClass(fcheckResu, fstand, index) { + // 妫�鏌ユ槸鍚﹁鍫电┐ + if (this.isHoleBlocked(index)) { + return 'BLOCKED'; + } + + // 濡傛灉娌℃湁璁板綍鍊硷紝鏄剧ず鏈楠屾牱寮� + if (!fcheckResu) { + return 'PENDING'; + } + + // 浼樺厛鏍规嵁fstand鍒ゆ柇 + if (fstand === '鈭�') { return 'OK'; - } else if (fstand === '脳' || fcheckResu === 'NG') { + } else if (fstand === '脳') { return 'NG'; } else { - // 瀵逛簬鏁板瓧缁撴灉锛屾牴鎹甪stand鍒ゆ柇 - return fstand === '鈭�' ? 'OK' : 'NG'; + // 濡傛灉娌℃湁fstand锛屾牴鎹甪checkResu鐨勫�煎垽鏂� + if (fcheckResu === '1' || fcheckResu === 1) { + return 'OK'; + } else if (fcheckResu === '0' || fcheckResu === 0) { + return 'NG'; + } else { + // 瀵逛簬鏈変笂涓嬮檺鐨勬暟鍊兼楠岋紝鏍规嵁fcheckResu鏄惁鍦ㄨ寖鍥村唴鍒ゆ柇 + if (this.formData.maxValue && this.formData.minValue) { + const value = parseFloat(fcheckResu); + if (!isNaN(value)) { + if (value >= this.formData.minValue && value <= this.formData.maxValue) { + return 'OK'; + } else { + return 'NG'; + } + } + } + // 榛樿杩斿洖OK鏍峰紡 + return 'OK'; + } + } + }, + + getResultText(fcheckResu, fstand, index) { + // 妫�鏌ユ槸鍚﹁鍫电┐ + if (this.isHoleBlocked(index)) { + return '/'; + } + + // 濡傛灉娌℃湁璁板綍鍊硷紝鏄剧ず鏈楠� + if (!fcheckResu) { + return '鏈楠�'; + } + + // 浼樺厛鏍规嵁fstand鍒ゆ柇 + if (fstand === '鈭�') { + return '鍚堟牸'; + } else if (fstand === '脳') { + return '涓嶅悎鏍�'; + } else { + // 濡傛灉娌℃湁fstand锛屾牴鎹甪checkResu鐨勫�煎垽鏂� + if (fcheckResu === '1' || fcheckResu === 1) { + return '鍚堟牸'; + } else if (fcheckResu === '0' || fcheckResu === 0) { + return '涓嶅悎鏍�'; + } else { + // 瀵逛簬鏈変笂涓嬮檺鐨勬暟鍊兼楠岋紝鏍规嵁fcheckResu鏄惁鍦ㄨ寖鍥村唴鍒ゆ柇 + if (this.formData.maxValue && this.formData.minValue) { + const value = parseFloat(fcheckResu); + if (!isNaN(value)) { + if (value >= this.formData.minValue && value <= this.formData.maxValue) { + return '鍚堟牸'; + } else { + return '涓嶅悎鏍�'; + } + } + } + // 濡傛灉鏄湁鏁板�肩殑妫�楠岀粨鏋滐紝鐩存帴鏄剧ず鏁板�� + return fcheckResu || '鏈娴�'; + } } }, @@ -248,6 +429,31 @@ // this.gid = id; // this.refreshResult(); }, + + // ===== 绌村彿鐩稿叧鏂规硶 ===== + getHoleNumber(index) { + const item = this.displayTableData[index]; + if (item && item.holeInfo) { + return item.holeInfo.holeNumber; + } + return index + 1; + }, + + getRecordValue(item, index) { + if (this.isHoleBlocked(index)) { + return '/'; + } + return item.fcheckResu || '鏃�'; + }, + + isHoleBlocked(index) { + const item = this.displayTableData[index]; + if (item && item.holeInfo) { + return item.holeInfo.isBlocked; + } + return false; + }, + previewImage() { uni.previewImage({ @@ -288,23 +494,39 @@ if (this.formData.fcheckResu == 0 || this.formData.fcheckResu == 1) { this.formData.isPass = this.formData.fcheckResu + // 鏍规嵁fcheckResu璁剧疆fstand + if (this.formData.fcheckResu == 1) { + fstand = "鈭�"; // 鍚堟牸 + } else { + fstand = "脳"; // 涓嶅悎鏍� + } } else { this.$showMessage("鏃犳爣鍑嗗�兼椂锛屾楠岀粨鏋滃彧鑳戒负0鎴�1!"); return; } - count = count - this.tableData.length; + + // 璁$畻瀹為檯闇�瑕佸~鍐欑殑鏁伴噺锛堣�冭檻绌村彿淇℃伅锛� + if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) { + // 濡傛灉鏈夌┐鍙蜂俊鎭紝璁$畻闈炲牭绌寸殑鏁伴噺 + const nonBlockedCount = this.formData.holeNumbers.filter(hole => !hole.isBlocked).length; + count = nonBlockedCount; + } else { + // 鍚﹀垯浣跨敤levelNum + count = this.formData.levelNum || 1; + } } this.formData.updater = this.$loginInfo.account; + // 鐩存帴鎵ц淇濆瓨锛屼笉鏄剧ず纭寮圭獥 this.$post({ url: "/SJ/SetQSItemDetail", data: { pid: this.id, gid: this.gid, - fstand: fstand, - fcheckResu: this.formData.fcheckResu, - updateBy: this.formData.updater, + Fstand: fstand, + FcheckResu: this.formData.fcheckResu, + UpdateBy: this.formData.updater, count: count } }).then(res => { @@ -315,9 +537,11 @@ }, refreshResult() { + // 鍏堣幏鍙栨楠岄」鐩熀鏈俊鎭� this.$post({ url: "/SJ/getQSItems", data: { + pid: this.gid, id: this.id } }).then(res => { @@ -330,17 +554,21 @@ if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) { this.isNumber = true; } - }) - - this.$post({ - url: "/SJ/getQSItemDetail", - data: { - pid: this.id, - gid: this.gid - } + + // 鐒跺悗鑾峰彇妫�楠岃鎯呮暟鎹� + return this.$post({ + url: "/SJ/getQSItemDetail", + data: { + pid: this.id, + gid: this.gid + } + }); }).then(res => { this.tableData = res.data.tbBillList; - }) + console.log('鍒锋柊鍚庣殑tableData:', this.tableData); + }).catch(error => { + console.error('鍒锋柊鏁版嵁澶辫触:', error); + }); }, toDetail(item) { this.showPopup = !this.showPopup; @@ -390,21 +618,33 @@ this.editData.updater = this.$loginInfo.account; - this.$post({ - url: "/SJ/UpdateQSItemDetail", - data: { - id: this.editData.id, - pid: this.id, - gid: this.gid, - fstand: fstand, - fcheckResu: this.editData.fcheckResu, - updateBy: this.editData.updater, + // 鏄剧ず纭鎻愮ず妗� + uni.showModal({ + title: '纭淇敼', + content: '纭畾瑕佷慨鏀规楠岀粨鏋滃悧锛�', + confirmText: '纭畾淇敼', + cancelText: '鍙栨秷', + success: (res) => { + if (res.confirm) { + // 鐢ㄦ埛纭鍚庢墽琛屼慨鏀� + this.$post({ + url: "/SJ/UpdateQSItemDetail", + data: { + id: this.editData.id, + pid: this.id, + gid: this.gid, + fstand: fstand, + fcheckResu: this.editData.fcheckResu, + updateBy: this.editData.updater, + } + }).then(res => { + this.showPopup = !this.showPopup; + this.$showMessage("淇敼鎴愬姛"); + this.refreshResult();//鍒锋柊椤甸潰 + }) + } } - }).then(res => { - this.showPopup = !this.showPopup; - this.$showMessage("淇敼鎴愬姛"); - this.refreshResult();//鍒锋柊椤甸潰 - }) + }); }, numberEdit(item) { @@ -645,7 +885,52 @@ background-color: rgba($danger-color, 0.1); color: $danger-color; } + + &.PENDING { + background-color: rgba(#E6A23C, 0.1); + color: #E6A23C; + } + + &.BLOCKED { + background-color: rgba(#909399, 0.1); + color: #909399; + } } + +.record-value { + font-family: 'Courier New', monospace; + font-weight: 500; + color: #333; + padding: 2px 4px; + background-color: #f8f9fa; + border-radius: 3px; + border: 1px solid #e9ecef; +} + +.no-data-text { + color: #E6A23C; + font-size: 12px; + font-style: italic; +} + +.blocked-text { + color: #909399; + font-size: 12px; + font-style: italic; +} + +.waiting-text { + color: #E6A23C; + font-size: 12px; + font-style: italic; +} + +.ready-text { + color: #67C23A; + font-size: 12px; + font-weight: bold; +} + .spec-text { font-size: 14px; @@ -754,6 +1039,12 @@ color: #2c3e50; margin: 0; } + + .popup-subtitle { + font-size: 14px; + color: #7f8c8d; + margin: 5px 0 0 0; + } } .popup-content { @@ -778,6 +1069,19 @@ background-color: white; } } + + .input-hint { + margin-top: 8px; + padding: 8px 12px; + background-color: #f8f9fa; + border-radius: 4px; + border-left: 3px solid #409EFF; + + text { + font-size: 12px; + color: #666; + } + } } .popup-actions { -- Gitblit v1.9.3