| | |
| | | <view class="bill-main-area"> |
| | | <!-- 主表页签 --> |
| | | <view class="bill-main-tabs"> |
| | | <view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">基本信息</view> |
| | | <view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">扫描信息</view> |
| | | <view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">制单信息</view> |
| | | <view :class="mainTabSelected == 4 ? 'selected' : ''" @tap="mainTabSelected = 4">其他信息</view> |
| | | <view class="tabs-left"> |
| | | <view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">基本信息</view> |
| | | <view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">扫描信息</view> |
| | | <view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">制单信息</view> |
| | | <view :class="mainTabSelected == 4 ? 'selected' : ''" @tap="mainTabSelected = 4">其他信息</view> |
| | | </view> |
| | | <view class="mode-switch-right"> |
| | | <text class="mode-text">{{ directInputMode ? '直接输入' : '双击累加' }}</text> |
| | | <switch :checked="directInputMode" @change="onModeSwitchChange" color="#3a78ff" style="transform: scale(0.7);" /> |
| | | </view> |
| | | </view> |
| | | <!-- 主表内容 --> |
| | | <view class="bill-main-contents"> |
| | |
| | | |
| | | <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HSourceBillType" |
| | | :HStockOrgID="hform.HStockOrgID" @BillSelectComplete="HandleBillSelectComplete"></BillListPopupVue> |
| | | |
| | | <!-- 直接输入数量弹窗 --> |
| | | <uni-popup ref="inputQtyPopup" type="center"> |
| | | <view class="input-qty-popup"> |
| | | <view class="popup-title">输入不良数量</view> |
| | | <view class="popup-content"> |
| | | <view class="popup-info"> |
| | | <text class="popup-label">不良原因:</text> |
| | | <text class="popup-value">{{ currentItem && currentItem.不良原因名称 || '' }}</text> |
| | | </view> |
| | | <view class="popup-info"> |
| | | <text class="popup-label">当前数量:</text> |
| | | <text class="popup-value">{{ currentItem && currentItem.num || 0 }}</text> |
| | | </view> |
| | | <view class="popup-input-row"> |
| | | <text class="popup-label">输入数量:</text> |
| | | <input class="popup-input" type="number" v-model="inputQtyValue" placeholder="请输入数量" /> |
| | | </view> |
| | | </view> |
| | | <view class="popup-buttons"> |
| | | <button class="btn-c" size="mini" @tap="cancelInputQty">取消</button> |
| | | <view style="flex: 1;"></view> |
| | | <button class="btn-a" size="mini" @tap="confirmInputQty">确认</button> |
| | | </view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | //上一次点击时间 |
| | | lastClickTime: 0, |
| | | operationType: 1, |
| | | |
| | | // 直接输入模式开关 |
| | | directInputMode: true, |
| | | // 弹窗相关 |
| | | currentItem: null, |
| | | inputQtyValue: '', |
| | | |
| | | mainTabSelected: 1, |
| | | subTabSelected: 0, |
| | | |
| | |
| | | }, |
| | | //不良原因单击 |
| | | reasonClick(item) { |
| | | // 直接输入模式下,单击直接弹出输入框 |
| | | if (this.directInputMode) { |
| | | this.showDirectInputDialog(item); |
| | | return; |
| | | } |
| | | const now = Date.now(); |
| | | if (now - this.lastClickTime < 300) { |
| | | // 双击逻辑 |
| | |
| | | this.handleSingleClick(item); |
| | | this.lastClickTime = now; |
| | | } |
| | | }, |
| | | // 模式切换 |
| | | onModeSwitchChange(e) { |
| | | this.directInputMode = e.detail.value; |
| | | }, |
| | | // 显示直接输入数量的弹窗 |
| | | showDirectInputDialog(item) { |
| | | this.currentItem = item; |
| | | this.inputQtyValue = String(item.num || 0); |
| | | this.$refs.inputQtyPopup.open(); |
| | | }, |
| | | // 取消输入 |
| | | cancelInputQty() { |
| | | this.$refs.inputQtyPopup.close(); |
| | | this.currentItem = null; |
| | | this.inputQtyValue = ''; |
| | | }, |
| | | // 确认输入 |
| | | confirmInputQty() { |
| | | const inputQty = parseInt(this.inputQtyValue); |
| | | if (isNaN(inputQty) || inputQty < 0) { |
| | | uni.showToast({ |
| | | title: '请输入有效数量', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | this.submitBarCodeWithQty(this.currentItem, inputQty); |
| | | this.$refs.inputQtyPopup.close(); |
| | | this.currentItem = null; |
| | | this.inputQtyValue = ''; |
| | | }, |
| | | handleSingleClick(item) { |
| | | console.log('单击:', item.不良原因名称); |
| | |
| | | } |
| | | }) |
| | | this.HBadReasonList = data; |
| | | |
| | | this.getHisReportList();//获取历史记录 |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: '温馨提示', |
| | |
| | | this.hform.HProcName= data[0].当前工序 |
| | | this.hform.HDeptID= data[0].HWorkShopID |
| | | this.getGy_BadReasonList(); |
| | | |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: '温馨提示', |
| | |
| | | url: "/Sc_QualityReportBill/get_BarCodeDetail", |
| | | data: { |
| | | HInterID: this.hform.HInterID, |
| | | |
| | | |
| | | }, |
| | | }); |
| | | |
| | | |
| | | let { |
| | | data, |
| | | Message, |
| | | count |
| | | } = res.data; |
| | | |
| | | |
| | | if (count == 1) { |
| | | console.log("data: ", data); |
| | | this.HisReportList = data; |
| | | |
| | | // 统计各不良原因的数量并更新到 HBadReasonList |
| | | this.updateBadReasonNumFromHisReport(); |
| | | |
| | | } else { |
| | | this.HisReportList = []; |
| | | this.clearBadReasonNum(); |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `获取历史扫码记录失败: ${Message}`, |
| | |
| | | message: `获取历史扫码记录失败: ${err}`, |
| | | }); |
| | | } |
| | | }, |
| | | // 从 HisReportList 统计更新 HBadReasonList 的 num |
| | | updateBadReasonNumFromHisReport() { |
| | | // 先清空所有 num |
| | | this.HBadReasonList.forEach(item => { |
| | | this.$set(item, 'num', 0); |
| | | }); |
| | | |
| | | // 统计 HisReportList 中各不良原因的数量 |
| | | if (this.HisReportList && this.HisReportList.length > 0) { |
| | | this.HisReportList.forEach(hisItem => { |
| | | // 根据 HBadReasonID 匹配 |
| | | const matchedItem = this.HBadReasonList.find( |
| | | badItem => badItem.不良原因代码 == hisItem.HBadReasonNumber |
| | | ); |
| | | if (matchedItem) { |
| | | const currentNum = matchedItem.num || 0; |
| | | this.$set(matchedItem, 'num', currentNum + hisItem.HBadReasonHQty||1); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | // 清空 HBadReasonList 的 num |
| | | clearBadReasonNum() { |
| | | this.HBadReasonList.forEach(item => { |
| | | this.$set(item, 'num', 0); |
| | | }); |
| | | }, |
| | | //删除历史记录 |
| | | delReason(item) { |
| | |
| | | title: "保存成功", |
| | | message: `保存成功`, |
| | | }); |
| | | if(!item.num){ |
| | | this.$set(item, 'num', 1); |
| | | }else{ |
| | | this.$set(item, 'num', item.num+1); |
| | | } |
| | | console.log(item.num) |
| | | //this.$set(item, 'num', newValue); |
| | | // 刷新历史记录,num会自动从HisReportList统计更新 |
| | | this.getHisReportList(); |
| | | this.hasCheckQty=true; |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `不良原因保存错误: ${Message}`, |
| | | }); |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `不良原因保存错误: ${err}`, |
| | | }); |
| | | } |
| | | }, |
| | | //提交不良原因扫码记录缓存(直接输入数量) |
| | | async submitBarCodeWithQty(item, qty){ |
| | | if(!this.checkSubmitValidate()){ |
| | | return |
| | | } |
| | | try { |
| | | let oMainObject = { |
| | | HInterID:this.hform.HInterID |
| | | ,HBillNo:this.hform.HBillNo |
| | | ,HBillType:this.hform.HBillType |
| | | ,HDate:new Date() |
| | | ,HICMOBillNo:this.hform.HICMOBillNo |
| | | ,HICMOInterID:this.hform.HICMOInterID |
| | | ,HICMOEntryID:this.hform.HICMOEntryID |
| | | ,HProcExchBillNo:this.hform.HProcExchBillNo |
| | | ,HProcExchInterID:this.hform.HProcExchInterID |
| | | ,HProcExchEntryID:this.hform.HProcExchEntryID |
| | | ,HProcID:this.hform.HProcID |
| | | ,HMaterID:this.hform.HMaterID |
| | | ,HSourceID:this.hform.HSourceID |
| | | ,HGroupID:this.hform.HGroupID |
| | | ,HDeptID:this.hform.HDeptID |
| | | ,HCheckManID:this.hform.HEmpID |
| | | ,HBadReasonID:item.HItemID |
| | | ,HBarCode:item.不良原因代码 |
| | | ,HMaker:this.hform.HMaker |
| | | ,HMakeDate:this.hform.HMakeDate |
| | | ,HReportType:1 |
| | | ,HSourceBillType:this.hform.HSourceBillType |
| | | ,HSourceBillNo:this.hform.HSourceBillNo |
| | | ,HSourceInterID:this.hform.HMainSourceInterID |
| | | ,HSourceEntryID:this.hform.HMainSourceEntryID |
| | | ,HBadReasonHQty:qty |
| | | ,HQty:this.hform.HCheckQty |
| | | } |
| | | var sMainStr = JSON.stringify(oMainObject); |
| | | var oMain = sMainStr + ';' + this.operationType; |
| | | |
| | | let res = await CommonUtils.doRequest2Sync({ |
| | | url: "/Sc_QualityReportBill/set_SaveBarCode", |
| | | data: { |
| | | oMain: oMain, |
| | | }, |
| | | method: "POST", |
| | | }); |
| | | |
| | | if (!res) { |
| | | return; |
| | | } |
| | | |
| | | let { |
| | | count, |
| | | Message, |
| | | data |
| | | } = res.data; |
| | | if (count == 1) { |
| | | CommonUtils.showTips({ |
| | | title: "保存成功", |
| | | message: `保存成功,数量: ${qty}`, |
| | | }); |
| | | // 刷新历史记录,num会自动从HisReportList统计更新 |
| | | this.getHisReportList(); |
| | | this.hasCheckQty = true; |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | |
| | | padding: 0; |
| | | } |
| | | |
| | | .bill-main-tabs, |
| | | .bill-main-tabs { |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | | display: flex; |
| | | flex-direction: row; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | border-bottom: 1px solid #ddd; |
| | | padding: 20rpx 10rpx; |
| | | |
| | | .tabs-left { |
| | | display: flex; |
| | | flex-direction: row; |
| | | flex-wrap: nowrap; |
| | | gap: 20rpx; |
| | | flex-shrink: 0; |
| | | overflow-x: auto; |
| | | white-space: nowrap; |
| | | |
| | | view { |
| | | width: auto; |
| | | font-size: 30rpx; |
| | | color: #555; |
| | | text-align: center; |
| | | padding: 16rpx 0; |
| | | } |
| | | |
| | | .selected { |
| | | color: #3a78ff; |
| | | font-weight: bold; |
| | | border-bottom: 3px solid #3a78ff; |
| | | } |
| | | } |
| | | |
| | | .mode-switch-right { |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | gap: 10rpx; |
| | | flex-shrink: 0; |
| | | padding-right: 10rpx; |
| | | |
| | | .mode-text { |
| | | font-size: 24rpx; |
| | | color: #666; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .bill-sub-tabs { |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | |
| | | } |
| | | } |
| | | |
| | | /* 直接输入数量弹窗样式 */ |
| | | .input-qty-popup { |
| | | background-color: #fff; |
| | | border-radius: 20rpx; |
| | | padding: 30rpx; |
| | | width: 600rpx; |
| | | box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.15); |
| | | |
| | | .popup-title { |
| | | font-size: 32rpx; |
| | | font-weight: bold; |
| | | color: #333; |
| | | text-align: center; |
| | | padding-bottom: 20rpx; |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | |
| | | .popup-content { |
| | | padding: 20rpx 0; |
| | | |
| | | .popup-info { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 10rpx 0; |
| | | |
| | | .popup-label { |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | width: 180rpx; |
| | | } |
| | | |
| | | .popup-value { |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | } |
| | | } |
| | | |
| | | .popup-input-row { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 15rpx 0; |
| | | margin-top: 10rpx; |
| | | |
| | | .popup-label { |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | width: 180rpx; |
| | | } |
| | | |
| | | .popup-input { |
| | | flex: 1; |
| | | height: 60rpx; |
| | | border: 1px solid #acacac; |
| | | border-radius: 10rpx; |
| | | padding: 0 15rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .popup-buttons { |
| | | display: flex; |
| | | flex-direction: row; |
| | | gap: 10rpx; |
| | | padding-top: 20rpx; |
| | | border-top: 1px solid #eee; |
| | | |
| | | button { |
| | | border-radius: 50rpx; |
| | | width: 150rpx; |
| | | height: 60rpx; |
| | | line-height: 60rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .btn-a { |
| | | background-color: #3a78ff; |
| | | color: #fff; |
| | | } |
| | | |
| | | .btn-c { |
| | | background-color: #acacac; |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .bill-main-content, |
| | | .bill-sub-content { |
| | | box-sizing: border-box; |