修复 foreach循环 发送请求时,可能会导致死锁的问题,切换成for...of 加 同步请求
| | |
| | | <view class="content"> |
| | | <view class="search-condition"> |
| | | <view class="title"><text>源单单号: </text></view> |
| | | <view class="right"><input type="text" v-model="HSourceBillNo" /></view> |
| | | <view class="right"><input type="text" v-model="HSourceBillNo" @confirm="getBillList" /></view> |
| | | </view> |
| | | <view class="search-condition"> |
| | | <view class="title"><text>物料: </text></view> |
| | | <view class="right"><input type="text" v-model="HMater" /></view> |
| | | <view class="right"><input auto-focus type="text" v-model="HMater" @confirm="getBillList" /></view> |
| | | </view> |
| | | <view class="search-condition"> |
| | | <view class="title"><text>关联项: </text></view> |
| | | <view class="right"><input type="text" v-model="HCustom" /></view> |
| | | <view class="right"><input type="text" v-model="HCustom" @confirm="getBillList" /></view> |
| | | </view> |
| | | <view class="buttons"> |
| | | <view style="flex: 1;"></view> |
| | | <button size="mini" type="primary" @click="search">搜索</button> |
| | | <button v-if="MultiSourceBill" size="mini" type="primary" @click="ret">返回</button> |
| | | <button size="mini" type="primary" @click="exit">退出</button> |
| | | </view> |
| | | <scroll-view id="#BillListPanel" scroll-y="true" style="height: 55vh;"> |
| | | <view class="options-wrapper" v-show="HBillList.length != 0"> |
| | | <uni-card v-for="(bill, index) in HBillList[curPage-1]" :key="index" :title="bill['物料名称']" |
| | | :extra="`数量: ${bill['数量']}`" @tap="clickCard(bill['HSourceInterID'], bill['单据号'])"> |
| | | <uni-card :is-active="bill.isActive" v-for="(bill, index) in HBillList[curPage-1]" :key="index" |
| | | :title="bill['物料名称']" :extra="`数量: ${bill['数量']}`" |
| | | @tap="clickCard(bill['HSourceInterID'], bill['单据号'], index)"> |
| | | <view class="item"> |
| | | <view class="left">单据号: </view> |
| | | <view class="right">{{bill['单据号']}}</view> |
| | |
| | | HCustom: '', |
| | | HBillList: [], |
| | | panelHeight: 0, |
| | | |
| | | multiSouceBillList: [] |
| | | }; |
| | | }, |
| | | props: { |
| | |
| | | type: [String, Number], |
| | | required: true |
| | | }, |
| | | MultiSourceBill: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | model: { |
| | | prop: "HSourceBill", |
| | |
| | | search() { |
| | | this.getBillList() |
| | | }, |
| | | ret() { |
| | | uni.$emit('BillSelectComplete', { |
| | | HInterID: 0, |
| | | HBillNo: 0, |
| | | enableMultiSourceBill: this.MultiSourceBill, |
| | | MultiSourceBillList: this.multiSouceBillList |
| | | }) |
| | | }, |
| | | showPopup() { |
| | | this.$refs.popup.open(); |
| | | }, |
| | | clickCard(interid, billno) { |
| | | clickCard(interid, billno, index) { |
| | | if (this.MultiSourceBill == false) { // 非多源单模式 |
| | | uni.$emit('BillSelectComplete', { |
| | | HInterID: interid, |
| | | HBillNo: billno, |
| | | enableMultiSourceBill: this.MultiSourceBill |
| | | }) |
| | | } else { |
| | | this.$set(this.HBillList[this.curPage - 1][index], 'isActive', !this.HBillList[this.curPage - 1][ |
| | | index |
| | | ]['isActive']) |
| | | console.log(this.HBillList[this.curPage - 1][index]) |
| | | // 设置了多源单模式 |
| | | this.setMultiSourceBillList({ |
| | | HInterID: interid, |
| | | HBillNo: billno |
| | | }) |
| | | } |
| | | |
| | | // this.exit() |
| | | }, |
| | | setMultiSourceBillList(billInfo) { |
| | | let index = this.multiSouceBillList.findIndex(item => item.HInterID == billInfo.HInterID) |
| | | if (index == -1) { |
| | | this.multiSouceBillList.push(billInfo) |
| | | } else { |
| | | this.multiSouceBillList.splice(index, 1) |
| | | } |
| | | }, |
| | | getBillList() { |
| | | this.HBillList = [] |
| | |
| | | Message |
| | | } = res.data |
| | | if (count == 1) { |
| | | console.log(data) |
| | | this.length = Array.from(data).length |
| | | const result = []; |
| | | for (let i = 0; i < data.length; i += this.size) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .uni-card[is-active] { |
| | | background-color: rgba(0, 122, 255, 0.2); |
| | | } |
| | | } |
| | | </style> |
| | |
| | | </view> |
| | | </view> |
| | | <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HMainSourceBillType" |
| | | :HStockOrgID="hform.HStockOrgID"></BillListPopupVue> |
| | | :HStockOrgID="hform.HStockOrgID" :MultiSourceBill="enableMultiSourceBill"></BillListPopupVue> |
| | | <BarCodePopupVue ref="barcodePopup"></BarCodePopupVue> |
| | | </view> |
| | | </template> |
| | |
| | | |
| | | this.getRelationStore() |
| | | |
| | | uni.$on('BillSelectComplete', (e) => { |
| | | console.log("接收到的消息: ", e.HBillNo) |
| | | uni.$on('BillSelectComplete', async (e) => { |
| | | console.log("接收到的消息: ", e) |
| | | console.log("是否应用多源单: ", e.enableMultiSourceBill) |
| | | if(e.enableMultiSourceBill){ |
| | | |
| | | for(let item of e.MultiSourceBillList) { |
| | | try{ |
| | | await this.getHBarCodeData(item.HBillNo) |
| | | }catch { |
| | | return |
| | | } |
| | | } |
| | | this.$refs.billList.exit() |
| | | if(e.MultiSourceBillList.length != 0){ |
| | | this.showHSourceBillNo = false |
| | | } |
| | | |
| | | }else { |
| | | this.getHBarCodeData(e.HBillNo) |
| | | this.$refs.billList.exit() |
| | | } |
| | | |
| | | |
| | | |
| | | }) |
| | | }, |
| | | onUnload() { |
| | | uni.$off('BillSelectComplete') |
| | | }, |
| | | computed: { |
| | | enableMultiSourceBill: { |
| | | get() { |
| | | if(uni.getStorageSync("Organization").includes("海诚") && this.hform.HMainSourceBillType == 3720){ |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | async qrCodeDisplay() { |
| | |
| | | } |
| | | }, |
| | | //选中源单 |
| | | getHBarCodeData(HBarCode) { |
| | | async getHBarCodeData(HBarCode) { |
| | | if (!this.hform.HFIFOWHName) { |
| | | this.hform.HFIFOWHID = 0 |
| | | } |
| | | return new Promise((resolve, reject) => { |
| | | uni.request({ |
| | | url: this.serverUrl + '/WEBSController/get_SourceBarCode_MateOut_Json', |
| | | data: { |
| | |
| | | this.barCodeFocus = true |
| | | this.playSound(1) |
| | | this.DisBillEntryList() |
| | | resolve() |
| | | } else { |
| | | this.playSound(0) |
| | | this.refreshHSourceBillState() |
| | |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | reject() |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | |
| | | title: '接口请求失败', |
| | | icon: 'none' |
| | | }) |
| | | reject() |
| | | }, |
| | | }); |
| | | }) |
| | | |
| | | }, |
| | | //扫条码处理 |
| | | getCode(HBarCode) { |