From 2b0e70bb88ced210dbc693a4d2ded2d658b1da02 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期一, 21 七月 2025 15:30:03 +0800 Subject: [PATCH] 111 --- pages/QC/OQC/ScanCode.vue | 1605 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 894 insertions(+), 711 deletions(-) diff --git a/pages/QC/OQC/ScanCode.vue b/pages/QC/OQC/ScanCode.vue index aec1edf..f7c77cf 100644 --- a/pages/QC/OQC/ScanCode.vue +++ b/pages/QC/OQC/ScanCode.vue @@ -1,745 +1,928 @@ <template> - <view class="container"> - <!-- 琛ㄥ崟鍖哄煙 --> - <view class="form-container card"> - <form :modelValue="formData"> - <view class="form-grid"> - <view class="form-group col-2"> - <label class="form-label">鐗╂枡鏉$爜:</label> - <view class="input-with-scan"> - <input class="form-input scan-input" type="text" v-model="formData.ItemBarcode" - @confirm="addItemBarCode" - placeholder="杈撳叆鍚庣寮�鎴栨寜鍥炶溅" /> - <view class="scan-button" @tap="startScan"> - <uni-icons type="scan" size="24" color="#007bff"></uni-icons> - <text class="scan-text">鎵爜</text> - </view> - </view> - </view> - <view class="form-group col-2"> - <label class="form-label">浜у搧鍚嶇О:</label> - <input class="form-input" disabled="true" type="text" v-model="formData.itemName" /> - </view> - <view class="form-group col-2"> - <label class="form-label">浜у搧缂栫爜:</label> - <input class="form-input" disabled="true" type="text" v-model="formData.itemNo" /> - </view> - <view class="form-group col-2"> - <label class="form-label">璁㈠崟缂栧彿:</label> - <input class="form-input" disabled="true" type="text" v-model="formData.taskNo" /> - </view> - <view class="form-group col-2"> - <label class="form-label">宸叉壂鏁伴噺:</label> - <input class="form-input" disabled="true" type="text" v-model="quantity" /> - </view> - </view> - </form> - </view> + <view class="container"> + <!-- 琛ㄥ崟鍖哄煙 --> + <view class="form-container card"> + <form :modelValue="formData"> + <view class="form-grid"> + <view class="form-group col-2"> + <label class="form-label">鐗╂枡鏉$爜:</label> + <view class="input-with-scan"> + <input v-model="formData.ItemBarcode" class="form-input scan-input" placeholder="杈撳叆鍚庣寮�鎴栨寜鍥炶溅" + type="text" + @confirm="addItemBarCode"/> + <view class="scan-button" @tap="startScan"> + <uni-icons color="#007bff" size="24" type="scan"></uni-icons> + <text class="scan-text">鎵爜</text> + </view> + </view> + </view> + <view class="form-group col-2"> + <label class="form-label">浜у搧鍚嶇О:</label> + <input v-model="formData.itemName" class="form-input" disabled="true" type="text"/> + </view> + <view class="form-group col-2"> + <label class="form-label">浜у搧缂栫爜:</label> + <input v-model="formData.itemNo" class="form-input" disabled="true" type="text"/> + </view> + <view class="form-group col-2"> + <label class="form-label">璁㈠崟缂栧彿:</label> + <input v-model="formData.taskNo" class="form-input" disabled="true" type="text"/> + </view> + <view class="form-group col-2"> + <label class="form-label">宸叉壂鏁伴噺:</label> + <input v-model="quantity" class="form-input" disabled="true" type="text"/> + </view> + </view> + </form> + </view> - <!-- 寰呮鏉$爜琛ㄦ牸鍖哄煙 --> - <view class="table-container card"> - <view class="table-header"> - <text class="section-title">寰呮鏉$爜鍒楄〃</text> - <view class="table-tip"> - <text class="tip-text">馃憟 宸﹀彸婊戝姩鏌ョ湅鏇村淇℃伅</text> - </view> - </view> - <view class="table-wrapper"> - <scroll-view class="table-scroll" scroll-x="true" show-scrollbar="true"> - <uni-table ref="table" border emptyText="鏆傛棤鏇村鏁版嵁" class="custom-table"> - <uni-tr class="table-header-row"> - <uni-th align="center" class="th" width="80">搴忓彿</uni-th> - <uni-th align="center" class="th" width="160">鐗╂枡鏉$爜</uni-th> - <uni-th align="center" class="th" width="140">璁㈠崟缂栧彿</uni-th> - <uni-th align="center" class="th" width="140">浜у搧缂栫爜</uni-th> - <uni-th align="center" class="th" width="160">浜у搧鍚嶇О</uni-th> - <uni-th align="center" class="th" width="100">鏉$爜鏁伴噺</uni-th> - <uni-th align="center" class="th" width="80">銆�</uni-th> - </uni-tr> - <uni-tr v-for="(item, index) in tableData" :key="index" class="table-row"> - <uni-td align="center" width="80"> - <view class="description-text">{{ index + 1 }}</view> - </uni-td> - <uni-td align="center" width="160"> - <view class="cell-content">{{ item.itemBarcode }}</view> - </uni-td> - <uni-td align="center" width="140"> - <view class="cell-content">{{ item.taskNo || '-' }}</view> - </uni-td> - <uni-td align="center" width="140"> - <view class="cell-content">{{ item.itemNo }}</view> - </uni-td> - <uni-td align="center" width="160"> - <view class="cell-content" :title="item.itemName">{{ item.itemName }}</view> - </uni-td> - <uni-td align="center" width="100"> - <view class="cell-content quantity">{{ item.quantity }}</view> - </uni-td> - <uni-td align="center" width="80"> - <view class="cell-content">銆�</view> - </uni-td> - </uni-tr> - </uni-table> - </scroll-view> - - <!-- 鍙冲浐瀹氭偓娴垹闄ゆ寜閽垪 --> - <view class="fixed-delete-column"> - <view class="fixed-header"> - <text class="fixed-header-text">鎿嶄綔</text> - </view> - <view class="fixed-content"> - <view v-for="(item, index) in tableData" :key="index" class="fixed-delete-item" - :class="{ 'even': index % 2 === 1 }"> - <view @click="deleteItem(index)" class="delete-icon"> - <uni-icons type="trash" size="24"></uni-icons> - </view> - </view> - </view> - </view> - </view> - </view> + <!-- 寰呮鏉$爜琛ㄦ牸鍖哄煙 --> + <view class="table-container card"> + <view class="table-header"> + <text class="section-title">寰呮鏉$爜鍒楄〃</text> + <view class="table-tip"> + <text class="tip-text">馃憟 宸﹀彸婊戝姩鏌ョ湅鏇村淇℃伅</text> + </view> + </view> + <view class="table-wrapper"> + <scroll-view class="table-scroll" scroll-x="true" show-scrollbar="true"> + <uni-table ref="table" border class="custom-table" emptyText="鏆傛棤鏇村鏁版嵁"> + <uni-tr class="table-header-row"> + <uni-th align="center" class="th" width="80">搴忓彿</uni-th> + <uni-th align="center" class="th" width="160">鐗╂枡鏉$爜</uni-th> + <uni-th align="center" class="th" width="140">璁㈠崟缂栧彿</uni-th> + <uni-th align="center" class="th" width="140">浜у搧缂栫爜</uni-th> + <uni-th align="center" class="th" width="160">浜у搧鍚嶇О</uni-th> + <uni-th align="center" class="th" width="100">鏉$爜鏁伴噺</uni-th> + <uni-th align="center" class="th" width="80">鍒犻櫎</uni-th> + </uni-tr> + <uni-tr v-for="(item, index) in tableData" :key="index" class="table-row"> + <uni-td align="center" width="80"> + <view class="description-text">{{ index + 1 }}</view> + </uni-td> + <uni-td align="center" width="160"> + <view class="cell-content">{{ item.itemBarcode }}</view> + </uni-td> + <uni-td align="center" width="140"> + <view class="cell-content">{{ item.taskNo || '-' }}</view> + </uni-td> + <uni-td align="center" width="140"> + <view class="cell-content">{{ item.itemNo }}</view> + </uni-td> + <uni-td align="center" width="160"> + <view :title="item.itemName" class="cell-content">{{ item.itemName }}</view> + </uni-td> + <uni-td align="center" width="100"> + <view class="cell-content quantity">{{ item.quantity }}</view> + </uni-td> + <uni-td align="center" width="80"> + <view class="delete-icon" @click="deleteItem(index)"> + <uni-icons size="24" type="trash"></uni-icons> + </view> + </uni-td> + </uni-tr> + </uni-table> + </scroll-view> + </view> + </view> - <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> - <view class="action-buttons-container button-group"> - <view class="plus-button" :class="{ 'submitting': isSubmitting }" @tap="handleSubmit"> - <text>{{ isSubmitting ? '鎻愪氦涓�...' : '鐢熸垚OQC妫�楠屽崟' }}</text> - </view> - </view> - </view> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <view class="action-buttons-container button-group"> + <view :class="{ 'submitting': isSubmitting }" class="plus-button" @tap="handleSubmit"> + <text>{{ isSubmitting ? '鎻愪氦涓�...' : '鐢熸垚OQC妫�楠屽崟' }}</text> + </view> + </view> + </view> </template> <script> - export default { - data() { - return { - formData: {}, - tableData: [], - quantity: 0, - isSubmitting: false, // 闃叉閲嶅鎻愪氦 - isProcessing: false, // 闃叉閲嶅澶勭悊鏉$爜 - } - }, - methods: { - // 鍚姩鎵爜鍔熻兘 - startScan() { - // 妫�鏌ユ槸鍚︽鍦ㄥ鐞嗘潯鐮侊紝闃叉閲嶅鎵爜 - if (this.isProcessing) { - this.$showMessage("姝e湪澶勭悊鏉$爜锛岃绋嶅��"); - return; - } +export default { + data() { + return { + formData: {}, + tableData: [], + quantity: 0, + isSubmitting: false, // 闃叉閲嶅鎻愪氦 + isProcessing: false, // 闃叉閲嶅澶勭悊鏉$爜 + } + }, + methods: { + // 鍚姩鎵爜鍔熻兘 + startScan() { + // 妫�鏌ユ槸鍚︽鍦ㄥ鐞嗘潯鐮侊紝闃叉閲嶅鎵爜 + if (this.isProcessing) { + this.$showMessage("姝e湪澶勭悊鏉$爜锛岃绋嶅��"); + return; + } - uni.scanCode({ - scanType: ['barCode', 'qrCode'], // 鏀寔鏉$爜鍜屼簩缁寸爜 - success: (res) => { - console.log('鎵爜鎴愬姛:', res); - // 灏嗘壂鐮佺粨鏋滆缃埌杈撳叆妗� - this.formData.ItemBarcode = res.result; - // 鑷姩澶勭悊鎵爜缁撴灉 - this.addItemBarCode(); - }, - fail: (err) => { - console.log('鎵爜澶辫触:', err); - if (err.errMsg && err.errMsg.indexOf('cancel') === -1) { - this.$showMessage("鎵爜澶辫触锛岃閲嶈瘯"); - } - } - }); - }, + uni.scanCode({ + scanType: ['barCode', 'qrCode'], // 鏀寔鏉$爜鍜屼簩缁寸爜 + success: (res) => { + console.log('鎵爜鎴愬姛:', res); + // 灏嗘壂鐮佺粨鏋滆缃埌杈撳叆妗� + this.formData.ItemBarcode = res.result; + // 鑷姩澶勭悊鎵爜缁撴灉 + this.addItemBarCode(); + }, + fail: (err) => { + console.log('鎵爜澶辫触:', err); + if (err.errMsg && err.errMsg.indexOf('cancel') === -1) { + this.$showMessage("鎵爜澶辫触锛岃閲嶈瘯"); + } + } + }); + }, - addItemBarCode() { - // 闃叉閲嶅澶勭悊 - if (this.isProcessing) { - return; - } + addItemBarCode() { + // 闃叉閲嶅澶勭悊 + if (this.isProcessing) { + return; + } - // 鏍¢獙鐗╂枡鏉$爜鏄惁涓虹┖ - if (!this.formData.ItemBarcode || this.formData.ItemBarcode.trim() === '') { - this.$showMessage("璇疯緭鍏ョ墿鏂欐潯鐮�"); - return; - } + // 鏍¢獙鐗╂枡鏉$爜鏄惁涓虹┖ + if (!this.formData.ItemBarcode || this.formData.ItemBarcode.trim() === '') { + this.$showMessage("璇疯緭鍏ョ墿鏂欐潯鐮�"); + return; + } - // 妫�鏌ョ墿鏂欐潯鐮佹槸鍚﹀凡瀛樺湪浜� tableData 涓� - const isDuplicate = this.tableData.some(item => item.itemBarcode === this.formData.ItemBarcode); - if (isDuplicate) { - this.$showMessage("璇ョ墿鏂欐潯鐮佸凡瀛樺湪锛岃妫�鏌ワ紒"); - return; - } + // 妫�鏌ョ墿鏂欐潯鐮佹槸鍚﹀凡瀛樺湪浜� tableData 涓� + const isDuplicate = this.tableData.some(item => item.itemBarcode === this.formData.ItemBarcode); + if (isDuplicate) { + this.$showMessage("璇ョ墿鏂欐潯鐮佸凡瀛樺湪锛岃妫�鏌ワ紒"); + return; + } - // 璁剧疆澶勭悊鐘舵�� - this.isProcessing = true; + // 璁剧疆澶勭悊鐘舵�� + this.isProcessing = true; - // 濡傛灉閫氳繃浜嗕笂杩版牎楠岋紝鍙戦�佽姹傚苟鏇存柊鏁版嵁 - this.$post({ - url: "/MesOqcItemsDetect02/GetItemBarCode", - data: { - ItemCode: this.formData.ItemBarcode - } - }).then(res => { - let fr = res.data.tbBillList; + // 濡傛灉閫氳繃浜嗕笂杩版牎楠岋紝鍙戦�佽姹傚苟鏇存柊鏁版嵁 + this.$post({ + url: "/MesOqcItemsDetect02/GetItemBarCode", + data: { + ItemCode: this.formData.ItemBarcode + } + }).then(res => { + let fr = res.data.tbBillList; - // 鏁版嵁瀹屾暣鎬ф牎楠� - if (!fr) { - this.$showMessage("鑾峰彇鏉$爜淇℃伅澶辫触锛岃閲嶈瘯"); - return; - } + // 鏁版嵁瀹屾暣鎬ф牎楠� + if (!fr) { + this.$showMessage("鑾峰彇鏉$爜淇℃伅澶辫触锛岃閲嶈瘯"); + return; + } - if (!fr.itemId || !fr.itemName || !fr.itemNo) { - this.$showMessage("鏉$爜淇℃伅涓嶅畬鏁达紝璇锋鏌ユ潯鐮�"); - return; - } + if (!fr.itemId || !fr.itemName || !fr.itemNo) { + this.$showMessage("鏉$爜淇℃伅涓嶅畬鏁达紝璇锋鏌ユ潯鐮�"); + return; + } - if (fr.quantity <= 0) { - this.$showMessage("鏉$爜鏁伴噺涓�0锛岃纭"); - return; - } + if (fr.quantity <= 0) { + this.$showMessage("鏉$爜鏁伴噺涓�0锛岃纭"); + return; + } - //闇�瑕侀獙璇� - //鎵殑鐮佺殑itemId蹇呴』鏄拰tableData涓殑itemId鐩稿悓 蹇呴』鐨勬潯浠� - //鎵殑鐮佺殑TaskNo涔熷繀椤绘槸鍜宼ableData涓殑TaskNo鐩稿悓 - //TaskNo涓虹┖鐨勫彧鑳藉拰TaskNo涓虹┖鐨勪竴璧锋壂 - - // 濡傛灉tableData涓凡鏈夋暟鎹紝闇�瑕侀獙璇乮temId鍜孴askNo鐨勪竴鑷存�� - if (this.tableData.length > 0) { - const firstItem = this.tableData[0]; - - // 楠岃瘉itemId鏄惁鐩稿悓锛堝繀椤绘潯浠讹級 - if (fr.itemId !== firstItem.itemId) { - this.$showMessage("鐗╂枡缂栫爜涓嶄竴鑷达紝璇锋壂鎻忕浉鍚岀墿鏂欑殑鏉$爜"); - return; - } - - // 楠岃瘉TaskNo鏄惁鐩稿悓 - if (fr.taskNo !== firstItem.taskNo) { - this.$showMessage("璁㈠崟缂栧彿涓嶄竴鑷达紝璇锋壂鎻忕浉鍚岃鍗曠殑鏉$爜"); - return; - } - - // 楠岃瘉绌篢askNo鐨勬儏鍐碉細TaskNo涓虹┖鐨勫彧鑳藉拰TaskNo涓虹┖鐨勪竴璧锋壂 - if ((fr.taskNo === '' || fr.taskNo === null || fr.taskNo === undefined) && - (firstItem.taskNo !== '' && firstItem.taskNo !== null && firstItem.taskNo !== undefined)) { - this.$showMessage("璁㈠崟缂栧彿涓嶅尮閰嶏紝绌鸿鍗曠紪鍙峰彧鑳戒笌绌鸿鍗曠紪鍙蜂竴璧锋壂鎻�"); - return; - } - - if ((fr.taskNo !== '' && fr.taskNo !== null && fr.taskNo !== undefined) && - (firstItem.taskNo === '' || firstItem.taskNo === null || firstItem.taskNo === undefined)) { - this.$showMessage("璁㈠崟缂栧彿涓嶅尮閰嶏紝鏈夎鍗曠紪鍙风殑鏉$爜鍙兘涓庢湁璁㈠崟缂栧彿鐨勬潯鐮佷竴璧锋壂鎻�"); - return; - } - } + //闇�瑕侀獙璇� + //鎵殑鐮佺殑itemId蹇呴』鏄拰tableData涓殑itemId鐩稿悓 蹇呴』鐨勬潯浠� + //鎵殑鐮佺殑TaskNo涔熷繀椤绘槸鍜宼ableData涓殑TaskNo鐩稿悓 + //TaskNo涓虹┖鐨勫彧鑳藉拰TaskNo涓虹┖鐨勪竴璧锋壂 - this.formData = fr; - this.tableData.push(fr); // 灏嗘柊鏁版嵁娣诲姞鍒拌〃鏍� - this.quantity = this.tableData.reduce(function(accumulator, current) { - return accumulator + current["quantity"]; - }, 0); - - // 娓呯┖杈撳叆妗� - this.formData.ItemBarcode = ''; - }).catch(error => { - this.$showMessage("鑾峰彇鏉$爜淇℃伅澶辫触锛岃閲嶈瘯"); - }).finally(() => { - // 閲嶇疆澶勭悊鐘舵�� - this.isProcessing = false; - }); - }, + // 濡傛灉tableData涓凡鏈夋暟鎹紝闇�瑕侀獙璇乮temId鍜孴askNo鐨勪竴鑷存�� + if (this.tableData.length > 0) { + const firstItem = this.tableData[0]; - // 鍒犻櫎鎿嶄綔锛氬垹闄� tableData 涓寚瀹氱储寮曠殑鏁版嵁 - deleteItem(index) { - this.tableData.splice(index, 1); // 鍒犻櫎璇ヨ鏁版嵁 - this.quantity = this.tableData.reduce(function(accumulator, current) { - return accumulator + current["quantity"]; - }, 0); // 鏇存柊鏉$爜鏁伴噺 + // 楠岃瘉itemId鏄惁鐩稿悓锛堝繀椤绘潯浠讹級 + if (fr.itemId !== firstItem.itemId) { + this.$showMessage("鐗╂枡缂栫爜涓嶄竴鑷达紝璇锋壂鎻忕浉鍚岀墿鏂欑殑鏉$爜"); + return; + } - if (this.tableData.length <= 0) { - this.formData = {}; - } - }, + // 楠岃瘉TaskNo鏄惁鐩稿悓 + if (fr.taskNo !== firstItem.taskNo) { + this.$showMessage("璁㈠崟缂栧彿涓嶄竴鑷达紝璇锋壂鎻忕浉鍚岃鍗曠殑鏉$爜"); + return; + } - handleSubmit() { - console.log("handleSubmit鏂规硶琚皟鐢紝isSubmitting:", this.isSubmitting); - console.log("tableData闀垮害:", this.tableData.length); - console.log("quantity:", this.quantity); - this.submit(); - }, + // 楠岃瘉绌篢askNo鐨勬儏鍐碉細TaskNo涓虹┖鐨勫彧鑳藉拰TaskNo涓虹┖鐨勪竴璧锋壂 + if ((fr.taskNo === '' || fr.taskNo === null || fr.taskNo === undefined) && + (firstItem.taskNo !== '' && firstItem.taskNo !== null && firstItem.taskNo !== undefined)) { + this.$showMessage("璁㈠崟缂栧彿涓嶅尮閰嶏紝绌鸿鍗曠紪鍙峰彧鑳戒笌绌鸿鍗曠紪鍙蜂竴璧锋壂鎻�"); + return; + } - submit() { - console.log("submit鏂规硶琚皟鐢�"); - - // 闃叉閲嶅鎻愪氦 - if (this.isSubmitting) { - this.$showMessage("姝e湪鎻愪氦涓紝璇峰嬁閲嶅鎿嶄綔"); - return; - } + if ((fr.taskNo !== '' && fr.taskNo !== null && fr.taskNo !== undefined) && + (firstItem.taskNo === '' || firstItem.taskNo === null || firstItem.taskNo === undefined)) { + this.$showMessage("璁㈠崟缂栧彿涓嶅尮閰嶏紝鏈夎鍗曠紪鍙风殑鏉$爜鍙兘涓庢湁璁㈠崟缂栧彿鐨勬潯鐮佷竴璧锋壂鎻�"); + return; + } + } - // 鏍¢獙鐢ㄦ埛鐧诲綍鐘舵�� - if (!this.$loginInfo.account) { - this.$showMessage("鐢ㄦ埛鏈櫥褰曪紝璇烽噸鏂扮櫥褰�"); - return; - } + this.formData = fr; + this.tableData.push(fr); // 灏嗘柊鏁版嵁娣诲姞鍒拌〃鏍� + this.quantity = this.tableData.reduce(function (accumulator, current) { + return accumulator + current["quantity"]; + }, 0); - // 鏍¢獙鏉$爜鏁伴噺鏄惁鏈夋晥 - if (this.quantity <= 0) { - this.$showMessage("鏉$爜鏁伴噺蹇呴』澶т簬0"); - return; - } + // 娓呯┖杈撳叆妗� + this.formData.ItemBarcode = ''; + }).catch(error => { + this.$showMessage("鑾峰彇鏉$爜淇℃伅澶辫触锛岃閲嶈瘯"); + }).finally(() => { + // 閲嶇疆澶勭悊鐘舵�� + this.isProcessing = false; + }); + }, - // 鏍¢獙鏄惁鏈夋暟鎹� - if (this.tableData.length === 0) { - this.$showMessage("璇锋壂鎻忔潯鐮�"); - return; - } + // 鍒犻櫎鎿嶄綔锛氬垹闄� tableData 涓寚瀹氱储寮曠殑鏁版嵁 + deleteItem(index) { + this.tableData.splice(index, 1); // 鍒犻櫎璇ヨ鏁版嵁 + this.quantity = this.tableData.reduce(function (accumulator, current) { + return accumulator + current["quantity"]; + }, 0); // 鏇存柊鏉$爜鏁伴噺 - let userName = this.$loginInfo.account; - this.isSubmitting = true; // 璁剧疆鎻愪氦鐘舵�� + if (this.tableData.length <= 0) { + this.formData = {}; + } + }, - // 鍙戦�佽姹� - this.$post({ - url: "/MesOqcItemsDetect02/ItemBarCodeSubmit", - data: { - itemBarCodeData: this.tableData, - CreateUser: userName - } - }).then(response => { - if(response.status == 0){ - // 璇锋眰鎴愬姛鍚庢樉绀洪�夋嫨妗� - uni.showModal({ - title: "鎿嶄綔鎴愬姛", - content: "宸茬粡鎴愬姛鐢熸垚妫�楠屽崟", - showCancel: true, - cancelText: "缁х画鎵爜", - confirmText: "璺宠浆鍒版楠屽崟", - success: (res) => { - if (res.confirm) { - // 鐢ㄦ埛鐐瑰嚮浜�"璺宠浆鍒版楠屽崟" - uni.navigateTo({ - url: '/pages/QC/OQC/Add?id=' + response.data - }); - } else if (res.cancel) { - // 鐢ㄦ埛鐐瑰嚮浜�"缁х画鎵爜" - this.clearData(); - } - } - }); - }else{ - this.$showMessage(response.message); - } - - }).catch(error => { - // 璇锋眰澶辫触鏃剁殑澶勭悊 - this.$showMessage("璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯"); - }).finally(() => { - // 鏃犺鎴愬姛杩樻槸澶辫触閮介噸缃彁浜ょ姸鎬� - this.isSubmitting = false; - }); - }, + handleSubmit() { + console.log("handleSubmit鏂规硶琚皟鐢紝isSubmitting:", this.isSubmitting); + console.log("tableData闀垮害:", this.tableData.length); + console.log("quantity:", this.quantity); + this.submit(); + }, - // 娓呯┖琛ㄦ牸鍜岃〃鍗曟暟鎹� - clearData() { - this.tableData = []; - this.formData = {}; - this.quantity = 0; - this.isSubmitting = false; - this.isProcessing = false; - } + submit() { + console.log("submit鏂规硶琚皟鐢�"); - } - } + // 闃叉閲嶅鎻愪氦 + if (this.isSubmitting) { + this.$showMessage("姝e湪鎻愪氦涓紝璇峰嬁閲嶅鎿嶄綔"); + return; + } + + // 鏍¢獙鐢ㄦ埛鐧诲綍鐘舵�� + if (!this.$loginInfo.account) { + this.$showMessage("鐢ㄦ埛鏈櫥褰曪紝璇烽噸鏂扮櫥褰�"); + return; + } + + // 鏍¢獙鏉$爜鏁伴噺鏄惁鏈夋晥 + if (this.quantity <= 0) { + this.$showMessage("鏉$爜鏁伴噺蹇呴』澶т簬0"); + return; + } + + // 鏍¢獙鏄惁鏈夋暟鎹� + if (this.tableData.length === 0) { + this.$showMessage("璇锋壂鎻忔潯鐮�"); + return; + } + + let userName = this.$loginInfo.account; + this.isSubmitting = true; // 璁剧疆鎻愪氦鐘舵�� + + // 鍙戦�佽姹� + this.$post({ + url: "/MesOqcItemsDetect02/ItemBarCodeSubmit", + data: { + itemBarCodeData: this.tableData, + CreateUser: userName + } + }).then(response => { + if (response.status == 0) { + // 璇锋眰鎴愬姛鍚庢樉绀洪�夋嫨妗� + uni.showModal({ + title: "鎿嶄綔鎴愬姛", + content: "宸茬粡鎴愬姛鐢熸垚妫�楠屽崟", + showCancel: true, + cancelText: "缁х画鎵爜", + confirmText: "璺宠浆鍒版楠屽崟", + success: (res) => { + if (res.confirm) { + // 鐢ㄦ埛鐐瑰嚮浜�"璺宠浆鍒版楠屽崟" + uni.navigateTo({ + url: '/pages/QC/OQC/Add?id=' + response.data + }); + } else if (res.cancel) { + // 鐢ㄦ埛鐐瑰嚮浜�"缁х画鎵爜" + this.clearData(); + } + } + }); + } else { + this.$showMessage(response.message); + } + + }).catch(error => { + // 璇锋眰澶辫触鏃剁殑澶勭悊 + this.$showMessage("璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯"); + }).finally(() => { + // 鏃犺鎴愬姛杩樻槸澶辫触閮介噸缃彁浜ょ姸鎬� + this.isSubmitting = false; + }); + }, + + // 娓呯┖琛ㄦ牸鍜岃〃鍗曟暟鎹� + clearData() { + this.tableData = []; + this.formData = {}; + this.quantity = 0; + this.isSubmitting = false; + this.isProcessing = false; + } + + } +} </script> <style> - .container { - padding: 24rpx; - background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); - min-height: 100vh; - display: flex; - flex-direction: column; - } - - /* 鍗$墖閫氱敤鏍峰紡 */ - .card { - background: #ffffff; - border-radius: 12rpx; - box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08); - margin-bottom: 24rpx; - padding: 32rpx; - border: 1rpx solid #e9ecef; - } - - /* 琛ㄥ崟鍖哄煙 */ - .form-container { - .form-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 24rpx 16rpx; - } - - .form-group { - display: flex; - flex-direction: column; - gap: 16rpx; - - .form-label { - font-size: 28rpx; - color: #495057; - font-weight: 600; - padding-left: 4rpx; - position: relative; - - &::after { - content: ""; - position: absolute; - left: 0; - bottom: -4rpx; - width: 24rpx; - height: 3rpx; - background: #007bff; - border-radius: 2rpx; - } - } - - .form-input { - height: 92rpx; - padding: 0 24rpx; - border: 2rpx solid #dee2e6; - border-radius: 8rpx; - font-size: 28rpx; - color: #212529; - background: #ffffff; - transition: all 0.3s ease; - - &[disabled] { - background: #f8f9fa; - color: #6c757d; - border-color: #e9ecef; - } - - &:focus { - border-color: #007bff; - box-shadow: 0 0 0 4rpx rgba(0, 123, 255, 0.1); - outline: none; - } - - &::placeholder { - color: #adb5bd; - } - } - } - } - - /* 琛ㄦ牸浼樺寲 */ - .table-container { - .table-header { - margin-bottom: 24rpx; - padding-bottom: 16rpx; - border-bottom: 2rpx solid #e9ecef; - display: flex; - justify-content: space-between; - align-items: center; - - .section-title { - font-size: 32rpx; - color: #212529; - font-weight: 700; - position: relative; - padding-left: 24rpx; - - &::before { - content: ""; - position: absolute; - left: 0; - top: 50%; - transform: translateY(-50%); - width: 4rpx; - height: 28rpx; - background: linear-gradient(135deg, #007bff, #0056b3); - border-radius: 2rpx; - } - } - - .table-tip { - .tip-text { - font-size: 22rpx; - color: #6c757d; - background: #f8f9fa; - padding: 8rpx 16rpx; - border-radius: 16rpx; - border: 1rpx solid #e9ecef; - } - } - } - - .table-wrapper { - position: relative; - border-radius: 8rpx; - overflow: hidden; - border: 1rpx solid #dee2e6; - } - - .table-scroll { - width: calc(100% - 80rpx); /* 鍑忓幓鍥哄畾鍒楀搴� */ - white-space: nowrap; - } - - .custom-table { - border: none; - min-width: 780rpx; - - .table-header-row { - background: linear-gradient(135deg, #f8f9fa, #e9ecef); - - .th { - font-size: 26rpx; - color: #495057; - font-weight: 600; - padding: 20rpx 12rpx; - background: transparent !important; - border-right: 1rpx solid #dee2e6; - white-space: nowrap; - min-width: 80rpx; - - &:last-child { - border-right: none; - } - } - } - - .table-row { - transition: background-color 0.2s ease; - - &:nth-child(even) { - background: #f8f9fa; - } - - &:hover { - background: #e3f2fd; - } - - .uni-td { - padding: 16rpx 12rpx; - border-color: #dee2e6 !important; - border-right: 1rpx solid #dee2e6; - white-space: nowrap; - min-width: 80rpx; - - &:last-child { - border-right: none; - } - - .cell-content { - font-size: 24rpx; - color: #495057; - line-height: 1.4; - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - - &.quantity { - font-weight: 600; - color: #007bff; - background: linear-gradient(135deg, #e3f2fd, #bbdefb); - padding: 8rpx 16rpx; - border-radius: 12rpx; - display: inline-block; - min-width: 60rpx; - text-align: center; - } - } - - .description-text { - font-size: 24rpx; - color: #6c757d; - font-weight: 500; - } - } - } - } - - /* 鍙冲浐瀹氭偓娴垹闄ゅ垪 */ - .fixed-delete-column { - position: absolute; - top: 0; - right: 0; - width: 80rpx; - background: #ffffff; - border-left: 1rpx solid #dee2e6; - box-shadow: -4rpx 0 8rpx rgba(0, 0, 0, 0.05); - z-index: 10; - - .fixed-header { - height: 60rpx; - background: linear-gradient(135deg, #f8f9fa, #e9ecef); - display: flex; - align-items: center; - justify-content: center; - border-bottom: 1rpx solid #dee2e6; - - .fixed-header-text { - font-size: 26rpx; - color: #495057; - font-weight: 600; - } - } - - .fixed-content { - .fixed-delete-item { - height: 48rpx; - display: flex; - align-items: center; - justify-content: center; - border-bottom: 1rpx solid #dee2e6; - transition: background-color 0.2s ease; - - &.even { - background: #f8f9fa; - } - - &:hover { - background: #e3f2fd; - } - - &:last-child { - border-bottom: none; - } - } - } - } - } - - /* 鍒犻櫎鍥炬爣浼樺寲 */ - .delete-icon { - cursor: pointer; - color: #dc3545; - transition: all 0.3s ease; - padding: 12rpx; - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; - min-width: 48rpx; - min-height: 48rpx; - - &:hover { - color: #c82333; - background: rgba(220, 53, 69, 0.1); - transform: scale(1.1); - } - - &:active { - transform: scale(0.95); - background: rgba(220, 53, 69, 0.2); - } - } - - /* 鎸夐挳浼樺寲 */ - .action-buttons-container { - display: flex; - justify-content: center; - margin-top: 48rpx; - padding: 0 24rpx; - - .plus-button { - width: 100%; - max-width: 600rpx; - height: 96rpx; - background: linear-gradient(135deg, #007bff, #0056b3); - border-radius: 48rpx; - display: flex; - justify-content: center; - align-items: center; - color: #ffffff; - font-size: 32rpx; - font-weight: 600; - box-shadow: 0 8rpx 24rpx rgba(0, 123, 255, 0.3); - transition: all 0.3s ease; - border: none; - position: relative; - overflow: hidden; - - &::before { - content: ""; - position: absolute; - top: 0; - left: -100%; - width: 100%; - height: 100%; - background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); - transition: left 0.5s ease; - } - - &:active { - transform: scale(0.98); - box-shadow: 0 4rpx 12rpx rgba(0, 123, 255, 0.4); - - &::before { - left: 100%; - } - } - - &.submitting { - background: linear-gradient(135deg, #6c757d, #5a6268); - cursor: not-allowed; - - &::before { - display: none; - } - } - } - } - - /* 鏁伴噺鏄剧ず浼樺寲 */ - .form-group { - &:nth-child(5) .form-input { - font-weight: 600; - color: #007bff; - background: linear-gradient(135deg, #e3f2fd, #bbdefb); - border: 2rpx solid #007bff; - text-align: center; - } - } +.container { + padding: 24rpx; + background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); + min-height: 100vh; + display: flex; + flex-direction: column; +} - /* 鎵爜杈撳叆妗嗘牱寮� */ - .input-with-scan { - display: flex; - align-items: center; - gap: 16rpx; - - .scan-input { - flex: 1; - } - - .scan-button { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 16rpx 20rpx; - background: linear-gradient(135deg, #e3f2fd, #bbdefb); - border: 2rpx solid #007bff; - border-radius: 8rpx; - min-width: 120rpx; - height: 92rpx; - cursor: pointer; - transition: all 0.3s ease; - - &:hover { - background: linear-gradient(135deg, #bbdefb, #90caf9); - transform: translateY(-2rpx); - box-shadow: 0 4rpx 12rpx rgba(0, 123, 255, 0.2); - } - - &:active { - transform: translateY(0); - box-shadow: 0 2rpx 6rpx rgba(0, 123, 255, 0.3); - } - - .scan-text { - font-size: 22rpx; - color: #007bff; - font-weight: 600; - margin-top: 4rpx; - } - } - } +/* 鍗$墖閫氱敤鏍峰紡 */ +.card { + background: #ffffff; + border-radius: 12rpx; + box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08); + margin-bottom: 24rpx; + padding: 32rpx; + border: 1rpx solid #e9ecef; +} + +/* 琛ㄥ崟鍖哄煙 */ +.form-container { + .form-grid { + display: grid; + grid-template-columns: 1fr; + gap: 24rpx; + } + + .form-group { + display: flex; + flex-direction: column; + gap: 16rpx; + + .form-label { + font-size: 28rpx; + color: #495057; + font-weight: 600; + padding-left: 4rpx; + position: relative; + + &::after { + content: ""; + position: absolute; + left: 0; + bottom: -4rpx; + width: 24rpx; + height: 3rpx; + background: #007bff; + border-radius: 2rpx; + } + } + + .form-input { + height: 92rpx; + padding: 0 24rpx; + border: 2rpx solid #dee2e6; + border-radius: 8rpx; + font-size: 28rpx; + color: #212529; + background: #ffffff; + transition: all 0.3s ease; + + &[disabled] { + background: #f8f9fa; + color: #6c757d; + border-color: #e9ecef; + } + + &:focus { + border-color: #007bff; + box-shadow: 0 0 0 4rpx rgba(0, 123, 255, 0.1); + outline: none; + } + + &::placeholder { + color: #adb5bd; + } + } + } +} + +/* 琛ㄦ牸浼樺寲 */ +.table-container { + .table-header { + margin-bottom: 24rpx; + padding-bottom: 16rpx; + border-bottom: 2rpx solid #e9ecef; + display: flex; + justify-content: space-between; + align-items: center; + + .section-title { + font-size: 32rpx; + color: #212529; + font-weight: 700; + position: relative; + padding-left: 24rpx; + + &::before { + content: ""; + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); + width: 4rpx; + height: 28rpx; + background: linear-gradient(135deg, #007bff, #0056b3); + border-radius: 2rpx; + } + } + + .table-tip { + .tip-text { + font-size: 22rpx; + color: #6c757d; + background: #f8f9fa; + padding: 8rpx 16rpx; + border-radius: 16rpx; + border: 1rpx solid #e9ecef; + } + } + } + + .table-wrapper { + position: relative; + border-radius: 8rpx; + overflow: hidden; + border: 1rpx solid #dee2e6; + display: flex; + } + + .table-scroll { + flex: 1; + overflow-x: auto; + white-space: nowrap; + } + + .custom-table { + border: none; + min-width: 780rpx; + + .table-header-row { + background: linear-gradient(135deg, #f8f9fa, #e9ecef); + + .th { + font-size: 26rpx; + color: #495057; + font-weight: 600; + padding: 0 8rpx; + height: 68rpx; + line-height: 68rpx; + background: transparent !important; + border-right: 1rpx solid #dee2e6; + white-space: nowrap; + min-width: 80rpx; + + &:last-child { + border-right: none; + } + } + } + + .table-row { + transition: background-color 0.2s ease; + + &:nth-child(even) { + background: #f8f9fa; + } + + &:hover { + background: #e3f2fd; + } + + .uni-td { + padding: 0 8rpx; + height: 68rpx; + border-color: #dee2e6 !important; + border-right: 1rpx solid #dee2e6; + white-space: nowrap; + min-width: 80rpx; + vertical-align: middle; + + &:last-child { + border-right: none; + } + + .cell-content { + font-size: 24rpx; + color: #495057; + line-height: 68rpx; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: flex; + align-items: center; + height: 68rpx; + + &.quantity { + font-weight: 600; + color: #007bff; + background: linear-gradient(135deg, #e3f2fd, #bbdefb); + padding: 8rpx 16rpx; + border-radius: 12rpx; + display: inline-block; + min-width: 60rpx; + text-align: center; + } + } + + .description-text { + font-size: 24rpx; + color: #6c757d; + font-weight: 500; + line-height: 68rpx; + display: flex; + align-items: center; + height: 68rpx; + } + } + } + } + + /* 鍙冲浐瀹氭偓娴垹闄ゅ垪 */ + + .fixed-delete-column { + flex-shrink: 0; + width: 100rpx; + background: #ffffff; + border-left: 1rpx solid #dee2e6; + box-shadow: -4rpx 0 8rpx rgba(0, 0, 0, 0.05); + + .fixed-header { + height: 68rpx; + background: linear-gradient(135deg, #f8f9fa, #e9ecef); + display: flex; + align-items: center; + justify-content: center; + border-bottom: 1rpx solid #dee2e6; + + .fixed-header-text { + font-size: 26rpx; + color: #495057; + font-weight: 600; + } + } + + .fixed-content { + .fixed-delete-item { + height: 68rpx; + display: flex; + align-items: center; + justify-content: center; + border-bottom: 1rpx solid #dee2e6; + transition: background-color 0.2s ease; + + &.even { + background: #f8f9fa; + } + + &:hover { + background: #e3f2fd; + } + + &:last-child { + border-bottom: none; + } + } + } + } +} + +/* 鍒犻櫎鍥炬爣浼樺寲 */ +.delete-icon { + cursor: pointer; + color: #dc3545; + transition: all 0.3s ease; + padding: 12rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + min-width: 48rpx; + min-height: 48rpx; + + &:hover { + color: #c82333; + background: rgba(220, 53, 69, 0.1); + transform: scale(1.1); + } + + &:active { + transform: scale(0.95); + background: rgba(220, 53, 69, 0.2); + } +} + +/* 鎸夐挳浼樺寲 */ +.action-buttons-container { + display: flex; + justify-content: center; + margin-top: 48rpx; + padding: 0 24rpx; + + .plus-button { + width: 100%; + max-width: 600rpx; + height: 96rpx; + background: linear-gradient(135deg, #007bff, #0056b3); + border-radius: 12rpx; + border: 2rpx solid #007bff; + cursor: pointer; + display: flex; + justify-content: center; + align-items: center; + color: #ffffff; + font-size: 32rpx; + font-weight: 600; + box-shadow: 0 8rpx 24rpx rgba(0, 123, 255, 0.3); + transition: all 0.3s ease; + position: relative; + overflow: hidden; + text-align: center; + + /* 纭繚鎸夐挳鍙偣鍑� */ + -webkit-tap-highlight-color: transparent; + -webkit-user-select: none; + user-select: none; + + text { + color: #ffffff; + font-size: 32rpx; + font-weight: 600; + line-height: 1; + } + + &::before { + content: ""; + position: absolute; + top: 0; + left: -100%; + width: 100%; + height: 100%; + background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); + transition: left 0.5s ease; + } + + &:active { + transform: scale(0.98); + box-shadow: 0 4rpx 12rpx rgba(0, 123, 255, 0.4); + + &::before { + left: 100%; + } + } + + &.submitting { + background: linear-gradient(135deg, #6c757d, #5a6268); + cursor: not-allowed; + + &::before { + display: none; + } + } + + /* 鎮仠鏁堟灉 */ + + &:hover:not(.submitting) { + background: linear-gradient(135deg, #0056b3, #004085); + border-color: #0056b3; + box-shadow: 0 12rpx 32rpx rgba(0, 123, 255, 0.4); + transform: translateY(-2rpx); + } + } +} + +/* 鏁伴噺鏄剧ず浼樺寲 */ +.form-group { + &:nth-child(5) .form-input { + font-weight: 600; + color: #007bff; + background: linear-gradient(135deg, #e3f2fd, #bbdefb); + border: 2rpx solid #007bff; + text-align: center; + } +} + +/* 鎵爜杈撳叆妗嗘牱寮� */ +.input-with-scan { + display: flex; + align-items: center; + gap: 16rpx; + + .scan-input { + flex: 1; + } + + .scan-button { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 16rpx 20rpx; + background: linear-gradient(135deg, #e3f2fd, #bbdefb); + border: 2rpx solid #007bff; + border-radius: 8rpx; + min-width: 120rpx; + height: 92rpx; + cursor: pointer; + transition: all 0.3s ease; + + &:hover { + background: linear-gradient(135deg, #bbdefb, #90caf9); + transform: translateY(-2rpx); + box-shadow: 0 4rpx 12rpx rgba(0, 123, 255, 0.2); + } + + &:active { + transform: translateY(0); + box-shadow: 0 2rpx 6rpx rgba(0, 123, 255, 0.3); + } + + .scan-text { + font-size: 22rpx; + color: #007bff; + font-weight: 600; + margin-top: 4rpx; + } + } +} + +/* 鎵嬫満绔搷搴斿紡浼樺寲 */ +@media (max-width: 768px) { + .container { + padding: 16rpx; + } + + .card { + padding: 24rpx; + margin-bottom: 16rpx; + } + + .form-container .form-grid { + grid-template-columns: 1fr; + gap: 20rpx; + } + + .form-group .form-label { + font-size: 26rpx; + } + + .form-group .form-input { + height: 84rpx; + font-size: 26rpx; + padding: 0 20rpx; + } + + .scan-button { + min-width: 100rpx !important; + height: 84rpx !important; + padding: 12rpx 16rpx !important; + + .scan-text { + font-size: 20rpx !important; + } + } + + .table-scroll { + flex: 1; + } + + .fixed-delete-column { + width: 80rpx; + flex-shrink: 0; + + .fixed-header { + height: 60rpx; + + .fixed-header-text { + font-size: 22rpx; + } + } + + .fixed-content .fixed-delete-item { + height: 60rpx; + } + } + + .custom-table { + .th { + font-size: 22rpx; + padding: 0 6rpx; + height: 60rpx; + line-height: 60rpx; + } + + .uni-td { + padding: 0 6rpx; + height: 60rpx; + + .cell-content { + font-size: 22rpx; + line-height: 60rpx; + height: 60rpx; + } + + .description-text { + line-height: 60rpx; + height: 60rpx; + } + } + } + + .delete-icon { + padding: 8rpx; + min-width: 40rpx; + min-height: 40rpx; + } + + .plus-button { + height: 88rpx; + font-size: 30rpx; + border-radius: 8rpx; + + text { + font-size: 30rpx; + color: #ffffff; + } + + &.submitting text { + color: #ffffff; + } + } +} + +/* 寮哄埗鎸夐挳鏍峰紡 - 瑙e喅鎵嬫満绔樉绀洪棶棰� */ +.plus-button { + background: #007bff !important; + background: linear-gradient(135deg, #007bff, #0056b3) !important; + border: 2rpx solid #007bff !important; + border-radius: 12rpx !important; + color: #ffffff !important; + font-size: 32rpx !important; + font-weight: 600 !important; + box-shadow: 0 8rpx 24rpx rgba(0, 123, 255, 0.3) !important; + width: 100% !important; + max-width: 600rpx !important; + height: 96rpx !important; + display: flex !important; + justify-content: center !important; + align-items: center !important; + text-align: center !important; +} + +.plus-button text { + color: #ffffff !important; + font-size: 32rpx !important; + font-weight: 600 !important; +} + +.plus-button.submitting { + background: #6c757d !important; + background: linear-gradient(135deg, #6c757d, #5a6268) !important; + border-color: #6c757d !important; +} + +.plus-button.submitting text { + color: #ffffff !important; +} + +/* 鎵嬫満绔寜閽己鍒舵牱寮� */ +@media (max-width: 768px) { + .plus-button { + background: #007bff !important; + background: linear-gradient(135deg, #007bff, #0056b3) !important; + border: 2rpx solid #007bff !important; + border-radius: 8rpx !important; + height: 88rpx !important; + font-size: 30rpx !important; + } + + .plus-button text { + color: #ffffff !important; + font-size: 30rpx !important; + font-weight: 600 !important; + } + + .plus-button.submitting text { + color: #ffffff !important; + font-size: 30rpx !important; + } +} </style> \ No newline at end of file -- Gitblit v1.9.3