Browse Source

非生产领料和退料线边 添加查询物料

pda_nev
李俊城 10 months ago
parent
commit
0702474e76
  1. 7
      fe/PDA/api/index.js
  2. 10
      fe/PDA/mycomponents/wincom/winScanByCode.vue
  3. 6
      fe/PDA/mycomponents/wincom/winScanByProductCode.vue
  4. 6
      fe/PDA/pages/query/item.vue
  5. 153
      fe/PDA/pages/task/unProducePickWipDetail.vue
  6. 105
      fe/PDA/pages/task/unProduceReturnWipDetail.vue
  7. 11
      fe/PDA/uni_modules/wz-select-popup/components/wz-select-popup/util/utils.js
  8. 59
      fe/PDA/uni_modules/wz-select-popup/components/wz-select-popup/wz-select-popup.vue

7
fe/PDA/api/index.js

@ -207,6 +207,13 @@ export const getBalancesByItemCode = (params) => promise(
method: 'post', method: 'post',
data: params data: params
}); });
// ERP料号模糊匹配查询所有物料数据
export const getItemCodeByLike = (itemCode,pageIndex,pageSize) => promise(
devUrl + "/api/pda/item/get-fuzzy?itemCode="+itemCode+"&pageIndex="+pageIndex+"&pageSize="+pageSize, {
method: 'get',
data: {}
});
//根据库位查询库存 //根据库位查询库存

10
fe/PDA/mycomponents/wincom/winScanByCode.vue

@ -55,11 +55,17 @@
}, },
getfocus() { getfocus() {
if (this.isShow) { if (this.isShow) {
this.$refs.scan.getfocus() if(this.$refs.scan){
this.$refs.scan.getfocus()
}
} }
}, },
losefocus() { losefocus() {
this.$refs.scan.losefocus() if(this.$refs.scan){
this.$refs.scan.losefocus()
}
}, },
scanClick() { scanClick() {

6
fe/PDA/mycomponents/wincom/winScanByProductCode.vue

@ -80,8 +80,9 @@
getMesBarCode(result.data.code).then(item=>{ getMesBarCode(result.data.code).then(item=>{
uni.hideLoading();
if (item) { if (item) {
this.losefocus(); //,getfocus() //,getfocus()
this.scanResult = { this.scanResult = {
scanCode:result.data.code, scanCode:result.data.code,
itemCode:item.itemCode, itemCode:item.itemCode,
@ -92,11 +93,10 @@
qty:item.qty, qty:item.qty,
locationCode:item.locationCode locationCode:item.locationCode
}; };
uni.hideLoading();
this.callBack(); this.callBack();
} else { } else {
this.losefocus();
this.showMessage('单件码【' + result.data.code + '】,不存在') this.showMessage('单件码【' + result.data.code + '】,不存在')
uni.hideLoading();
} }
}).catch(err => { }).catch(err => {
uni.hideLoading(); uni.hideLoading();

6
fe/PDA/pages/query/item.vue

@ -142,7 +142,7 @@
}, },
getScanCode(code) { getScanCode(code) {
if (code == "") { if (code == "") {
this.showMessage('零件号不能为空') this.showMessage('ERP料号不能为空')
return; return;
} }
this.itemCode = ''; this.itemCode = '';
@ -153,7 +153,7 @@
}, },
getItemInfo(code) { getItemInfo(code) {
uni.showLoading({ uni.showLoading({
title: "正在查询零件信息...", title: "正在查询ERP料号信息...",
mask: true mask: true
}); });
@ -165,7 +165,7 @@
this.itemDetail = res; this.itemDetail = res;
this.getContentByTab(this.tabIndex) this.getContentByTab(this.tabIndex)
} else { } else {
this.showMessage('未查找到零件【' + code + '】'); this.showMessage('未查找到ERP料号【' + code + '】');
this.itemCode = ""; this.itemCode = "";
} }
uni.hideLoading(); uni.hideLoading();

153
fe/PDA/pages/task/unProducePickWipDetail.vue

@ -6,8 +6,8 @@
<com-job-scan-detail :jobContent="datacontent" :allCount="allCount" :scanCount="scanCount"> <com-job-scan-detail :jobContent="datacontent" :allCount="allCount" :scanCount="scanCount">
</com-job-scan-detail> </com-job-scan-detail>
</view> </view>
<scroll-view scroll-y="true" @scrolltoupper="upper" @scrolltolower="lower" <scroll-view scroll-y="true" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll"
@scroll="scroll" class="scroll-detail"> class="scroll-detail">
<view class="detail-list margin_top" v-for="(item, index) in details" :key="item.id"> <view class="detail-list margin_top" v-for="(item, index) in details" :key="item.id">
<view class="detail-content"> <view class="detail-content">
@ -46,8 +46,8 @@
@click="showLocation(item)">扫描库位</button> @click="showLocation(item)">扫描库位</button>
</view> </view>
</view> </view>
</uni-th> </uni-th>
</uni-tr> </uni-tr>
<uni-tr> <uni-tr>
@ -67,7 +67,7 @@
</view> </view>
</uni-th> </uni-th>
</uni-tr> </uni-tr>
</uni-table> </uni-table>
</view> </view>
</view> </view>
@ -76,7 +76,7 @@
<view v-if="item.scaned" class="choose_marked_count" <view v-if="item.scaned" class="choose_marked_count"
style="background-color: #5FCB94; opacity: 0.65"> style="background-color: #5FCB94; opacity: 0.65">
<view class="" style="background-color: #5FCB94; width: 200rpx;height: 300rpx;"> <view class="" style="background-color: #5FCB94; width: 200rpx;height: 300rpx;">
; ;
</view> </view>
<!-- <image src="@/static/image_marked.svg"></image> --> <!-- <image src="@/static/image_marked.svg"></image> -->
</view> </view>
@ -89,11 +89,16 @@
</view> </view>
<com-balance ref='issueitems' @selectedItem='selectedBalanceItem'></com-balance> <com-balance ref='issueitems' @selectedItem='selectedBalanceItem'></com-balance>
<win-scan-button @goScan='openScanPopup' title="单件码"></win-scan-button> <win-scan-button @goScan='openScanPopup' title="单件码"></win-scan-button>
<winScanButtonTop @goScan='openItemScanPopup' title="ERP料号"></winScanButtonTop>
<winScanButtonBottom @goScan='queryItemCode' title="ERP查询"></winScanButtonBottom>
<winScanByProductCode ref="scanPackPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode> <winScanByProductCode ref="scanPackPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode>
<winScanLocationCode ref="location" title="库位" @getLocation="getToLocation"></winScanLocationCode> <winScanLocationCode ref="location" title="库位" @getLocation="getToLocation"></winScanLocationCode>
<win-scan-by-code ref="scanPopupItem" title='ERP料号' @getScanCode='getScanCode'>
</win-scan-by-code>
<com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance> <com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance>
<wz-select-popup ref="wzSelectPopup" @select="selectCheckbox" />
<com-message ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()' <com-message ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()'
@afterCloseScanMessage='closeScanMessage'></com-message> @afterCloseScanMessage='closeScanMessage' @afterClose="closeScanMessage"></com-message>
</view> </view>
</template> </template>
@ -103,6 +108,8 @@
takeIssueJob, takeIssueJob,
cancelTakeIssueJob, cancelTakeIssueJob,
finshUnProducePickJob, finshUnProducePickJob,
getitems,
getItemCodeByLike
} from '@/api/index.js'; } from '@/api/index.js';
import { import {
getJobStatuStyle, getJobStatuStyle,
@ -116,6 +123,8 @@
} from '@/common/basic.js'; } from '@/common/basic.js';
import comMessage from '@/mycomponents/common/comMessage.vue' import comMessage from '@/mycomponents/common/comMessage.vue'
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' import winScanButton from '@/mycomponents/wincom/winScanButton.vue'
import winScanButtonTop from '@/mycomponents/wincom/winScanButtonTop.vue'
import winScanButtonBottom from '@/mycomponents/wincom/winScanButtonBottom.vue'
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue' import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue'
import comBalance from '@/mycomponents/common/comBalance.vue' import comBalance from '@/mycomponents/common/comBalance.vue'
import comJobScanDetail from '@/mycomponents/comjob/comJobScanDetail.vue' import comJobScanDetail from '@/mycomponents/comjob/comJobScanDetail.vue'
@ -123,18 +132,22 @@
import comNumberBox from '@/mycomponents/common/comNumberBox.vue'; import comNumberBox from '@/mycomponents/common/comNumberBox.vue';
import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue' import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue'
import winScanLocationCode from '@/mycomponents/wincom/winScanLocationCode.vue'; import winScanLocationCode from '@/mycomponents/wincom/winScanLocationCode.vue';
import winScanByCode from '@/mycomponents/wincom/winScanByCode.vue'
export default { export default {
components: { components: {
comMessage, comMessage,
winScanButton, winScanButton,
winScanButtonTop,
winScanButtonBottom,
winMulitScan, winMulitScan,
comBalance, comBalance,
comJobScanDetail, comJobScanDetail,
winScanByPack, winScanByPack,
comNumberBox, comNumberBox,
winScanByProductCode, winScanByProductCode,
winScanLocationCode winScanLocationCode,
winScanByCode
}, },
data() { data() {
return { return {
@ -149,6 +162,11 @@
scanCount: 0, scanCount: 0,
isPack: true, isPack: true,
titleArray: ['箱标签'], titleArray: ['箱标签'],
userForm: {
names: [],
values: [],
origin: []
}
} }
}, },
filters: { filters: {
@ -204,8 +222,9 @@
}, },
getToLocation(locationInfo) { getToLocation(locationInfo) {
if(this.currentItem.recommendFromLocationCode!=locationInfo.code){ if (this.currentItem.recommendFromLocationCode != locationInfo.code) {
this.showMessage("扫描库位["+locationInfo.code+"]与推荐来源库位["+this.currentItem.recommendFromLocationCode+"]不一致") this.showMessage("扫描库位[" + locationInfo.code + "]与推荐来源库位[" + this.currentItem
.recommendFromLocationCode + "]不一致")
return; return;
} }
this.currentItem.handledFromLocationCode = locationInfo.code; this.currentItem.handledFromLocationCode = locationInfo.code;
@ -222,6 +241,43 @@
// } // }
this.$refs.scanPackPopup.openScanPopup(); this.$refs.scanPackPopup.openScanPopup();
}, },
openItemScanPopup() {
this.$refs.scanPopupItem.openScanPopup();
},
queryItemCode(){
this.$refs.wzSelectPopup.open({
mode: 'radio', //radio checkbox
// dataList:[], //dataList使proxyConfig
selected: this.userForm.values, //
proxyConfig: { //
reqFun: this.reqGetList, //,Promise.resolve([])
localPaging: false //
},
search: {
type: 'remote', //local | remote
},
fields: {
label: 'name',
value: 'code'
}
})
},
reqGetList(data) {
let params = {
pageSize: data.pageSize,
pageIndex: data.pageIndex,
itemCode: data.searchValue,
};
return getItemCodeByLike(data.searchValue,data.pageIndex,data.pageSize);
},
selectCheckbox(mode, result){
this.getScanResult(result,false)
},
// //
getDetail() { getDetail() {
let that = this; let that = this;
@ -262,19 +318,51 @@
}); });
}, },
getScanResult(result) { getScanCode(code) {
if (code == "") {
this.showMessage('ERP料号不能为空')
return;
}
getitems(code).then((res) => {
uni.hideLoading();
if (res) {
var result ={
itemCode:res.code
}
this.getScanResult(result,false)
} else {
this.showMessage('未查找到ERP料号【' + code + '】');
}
}).catch((err) => {
this.showMessage(err.message);
uni.hideLoading();
})
},
getScanResult(result,isMesCode=true) {
// AH240321AM0153 AH240321AM0198 AH240321AM0199 // AH240321AM0153 AH240321AM0198 AH240321AM0199
let item = this.details.find(r => { let item = this.details.find(r => {
return r.itemCode == result.itemCode return r.itemCode == result.itemCode
}); });
if (item == undefined) { if (item == undefined) {
this.showMessage('在任务详情中,单件码【' + result.scanCode + '】所对应的ERP料号与任务中的ERP料号不一致,请重新扫描'); if(isMesCode){
this.showMessage('在任务详情中,单件码【' + result.scanCode + '】所对应的ERP料号与任务中的ERP料号不一致,请重新扫描');
}else {
this.showMessage('在任务详情中,没有找到ERP料号[' + result.itemCode+"]的信息,请重新扫描");
}
return; return;
} }
if(item.scaned){ if (item.scaned) {
this.showMessage('单件码['+result.scanCode+"]已经扫描") if(isMesCode){
}else { this.showMessage('单件码[' + result.scanCode + "]已经扫描")
}else {
this.showMessage('ERP料号[' + result.itemCode + "]已经扫描")
}
} else {
item.scaned = true; item.scaned = true;
item.scanDate = new Date() item.scanDate = new Date()
this.details.sort(compareDesc('scanDate')); this.details.sort(compareDesc('scanDate'));
@ -282,7 +370,7 @@
this.calcScanCount() this.calcScanCount()
this.$forceUpdate() this.$forceUpdate()
} }
}, },
qtyChanged(value, item, index) { qtyChanged(value, item, index) {
@ -326,7 +414,7 @@
if (items.length == this.details.length) { if (items.length == this.details.length) {
this.finsh(); this.finsh();
} else { } else {
this.showMessage("还有未扫描的单件码或库位") this.showMessage("还有未扫描的ERP物料或库位")
} }
}, },
@ -363,17 +451,17 @@
that.datacontent.details = that.details; that.datacontent.details = that.details;
let params = JSON.stringify(that.datacontent); let params = JSON.stringify(that.datacontent);
console.log("提交", params); console.log("提交", params);
finshUnProducePickJob(that.id, params) // finshUnProducePickJob(that.id, params)
.then(res => { // .then(res => {
uni.hideLoading(); // uni.hideLoading();
if (res != null) { // if (res != null) {
that.showCommitSuccessMessage(); // that.showCommitSuccessMessage();
} // }
}) // })
.catch(err => { // .catch(err => {
that.showMessage(err.message); // that.showMessage(err.message);
uni.hideLoading(); // uni.hideLoading();
}); // });
}, },
// //
@ -392,14 +480,19 @@
this.getDetail(); this.getDetail();
}, },
showMessage(message) { showMessage(message) {
this.$refs.scanPackPopup.losefocus();
this.$refs.scanPopupItem.losefocus();
this.$refs.comMessage.showMessage(message); this.$refs.comMessage.showMessage(message);
}, },
showScanMessage(message) { showScanMessage(message) {
this.$refs.scanPackPopup.losefocus();
this.$refs.scanPopupItem.losefocus();
this.$refs.comMessage.showScanMessage(message); this.$refs.comMessage.showScanMessage(message);
}, },
closeScanMessage() { closeScanMessage() {
this.$refs.scanPackPopup.getfocus(); this.$refs.scanPackPopup.getfocus();
this.$refs.scanPopupItem.getfocus();
}, },
calcScanCount() { calcScanCount() {
@ -419,11 +512,9 @@
closeScanPopup() { closeScanPopup() {
if (this.allCount == this.scanCount) { if (this.allCount == this.scanCount) {
this.$refs.scanPackPopup.closeScanPopup(); this.$refs.scanPackPopup.closeScanPopup();
this.$refs.scanPopupItem.closeScanPopup();
} }
}, },
scanPopupGetFocus() {
this.$refs.scanPackPopup.getfocus();
},
} }
} }

105
fe/PDA/pages/task/unProduceReturnWipDetail.vue

@ -89,11 +89,16 @@
</view> </view>
<com-balance ref='issueitems' @selectedItem='selectedBalanceItem'></com-balance> <com-balance ref='issueitems' @selectedItem='selectedBalanceItem'></com-balance>
<win-scan-button @goScan='openScanPopup' title="单件码"></win-scan-button> <win-scan-button @goScan='openScanPopup' title="单件码"></win-scan-button>
<winScanButtonTop @goScan='openItemScanPopup' title="ERP料号"></winScanButtonTop>
<winScanButtonBottom @goScan='queryItemCode' title="ERP查询"></winScanButtonBottom>
<winScanByProductCode ref="scanPackPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode> <winScanByProductCode ref="scanPackPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode>
<winScanLocationCode ref="location" title="库位" @getLocation="getToLocation"></winScanLocationCode> <winScanLocationCode ref="location" title="库位" @getLocation="getToLocation"></winScanLocationCode>
<win-scan-by-code ref="scanPopupItem" title='ERP料号' @getScanCode='getScanCode'>
</win-scan-by-code>
<com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance> <com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance>
<wz-select-popup ref="wzSelectPopup" @select="selectCheckbox" />
<com-message ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()' <com-message ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()'
@afterCloseScanMessage='closeScanMessage'></com-message> @afterCloseScanMessage='closeScanMessage' @afterClose="closeScanMessage"></com-message>
</view> </view>
</template> </template>
@ -103,6 +108,8 @@
takeIssueJob, takeIssueJob,
cancelTakeIssueJob, cancelTakeIssueJob,
finshUnProduceReturnJob, finshUnProduceReturnJob,
getitems,
getItemCodeByLike
} from '@/api/index.js'; } from '@/api/index.js';
import { import {
getJobStatuStyle, getJobStatuStyle,
@ -116,6 +123,8 @@
} from '@/common/basic.js'; } from '@/common/basic.js';
import comMessage from '@/mycomponents/common/comMessage.vue' import comMessage from '@/mycomponents/common/comMessage.vue'
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' import winScanButton from '@/mycomponents/wincom/winScanButton.vue'
import winScanButtonTop from '@/mycomponents/wincom/winScanButtonTop.vue'
import winScanButtonBottom from '@/mycomponents/wincom/winScanButtonBottom.vue'
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue' import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue'
import comBalance from '@/mycomponents/common/comBalance.vue' import comBalance from '@/mycomponents/common/comBalance.vue'
import comJobScanDetail from '@/mycomponents/comjob/comJobScanDetail.vue' import comJobScanDetail from '@/mycomponents/comjob/comJobScanDetail.vue'
@ -123,18 +132,22 @@
import comNumberBox from '@/mycomponents/common/comNumberBox.vue'; import comNumberBox from '@/mycomponents/common/comNumberBox.vue';
import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue' import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue'
import winScanLocationCode from '@/mycomponents/wincom/winScanLocationCode.vue'; import winScanLocationCode from '@/mycomponents/wincom/winScanLocationCode.vue';
import winScanByCode from '@/mycomponents/wincom/winScanByCode.vue'
export default { export default {
components: { components: {
comMessage, comMessage,
winScanButton, winScanButton,
winScanButtonTop,
winScanButtonBottom,
winMulitScan, winMulitScan,
comBalance, comBalance,
comJobScanDetail, comJobScanDetail,
winScanByPack, winScanByPack,
comNumberBox, comNumberBox,
winScanByProductCode, winScanByProductCode,
winScanLocationCode winScanLocationCode,
winScanByCode
}, },
data() { data() {
return { return {
@ -149,6 +162,11 @@
scanCount: 0, scanCount: 0,
isPack: true, isPack: true,
titleArray: ['箱标签'], titleArray: ['箱标签'],
userForm: {
names: [],
values: [],
origin: []
}
} }
}, },
filters: { filters: {
@ -222,6 +240,42 @@
// } // }
this.$refs.scanPackPopup.openScanPopup(); this.$refs.scanPackPopup.openScanPopup();
}, },
openItemScanPopup() {
this.$refs.scanPopupItem.openScanPopup();
},
queryItemCode(){
this.$refs.wzSelectPopup.open({
mode: 'radio', //radio checkbox
// dataList:[], //dataList使proxyConfig
selected: this.userForm.values, //
proxyConfig: { //
reqFun: this.reqGetList, //,Promise.resolve([])
localPaging: false //
},
search: {
type: 'remote', //local | remote
},
fields: {
label: 'name',
value: 'code'
}
})
},
reqGetList(data) {
let params = {
pageSize: data.pageSize,
pageIndex: data.pageIndex,
itemCode: data.searchValue,
};
return getItemCodeByLike(data.searchValue,data.pageIndex,data.pageSize);
},
selectCheckbox(mode, result){
this.getScanResult(result,false)
},
// //
getDetail() { getDetail() {
let that = this; let that = this;
@ -262,18 +316,50 @@
}); });
}, },
getScanResult(result) { getScanCode(code) {
if (code == "") {
this.showMessage('ERP料号不能为空')
return;
}
getitems(code).then((res) => {
uni.hideLoading();
if (res) {
var result ={
itemCode:res.code
}
this.getScanResult(result,false)
} else {
this.showMessage('未查找到ERP料号【' + code + '】');
}
}).catch((err) => {
this.showMessage(err.message);
uni.hideLoading();
})
},
getScanResult(result,isMesCode=true) {
// AH240321AM0153 AH240321AM0198 AH240321AM0199 // AH240321AM0153 AH240321AM0198 AH240321AM0199
let item = this.details.find(r => { let item = this.details.find(r => {
return r.itemCode == result.itemCode return r.itemCode == result.itemCode
}); });
if (item == undefined) { if (item == undefined) {
this.showMessage('在任务详情中,单件码【' + result.scanCode + '】所对应的ERP料号与任务中的ERP料号不一致,请重新扫描'); if(isMesCode){
this.showMessage('在任务详情中,单件码【' + result.scanCode + '】所对应的ERP料号与任务中的ERP料号不一致,请重新扫描');
}else {
this.showMessage('在任务详情中,没有找到ERP料号[' + result.itemCode+"]的信息,请重新扫描");
}
return; return;
} }
if (item.scaned) { if (item.scaned) {
this.showMessage('单件码[' + result.scanCode + "]已经扫描") if(isMesCode){
this.showMessage('单件码[' + result.scanCode + "]已经扫描")
}else {
this.showMessage('ERP料号[' + result.itemCode + "]已经扫描")
}
} else { } else {
item.scaned = true; item.scaned = true;
item.scanDate = new Date() item.scanDate = new Date()
@ -387,14 +473,19 @@
this.getDetail(); this.getDetail();
}, },
showMessage(message) { showMessage(message) {
this.$refs.scanPackPopup.losefocus();
this.$refs.scanPopupItem.losefocus();
this.$refs.comMessage.showMessage(message); this.$refs.comMessage.showMessage(message);
}, },
showScanMessage(message) { showScanMessage(message) {
this.$refs.scanPackPopup.losefocus();
this.$refs.scanPopupItem.losefocus();
this.$refs.comMessage.showScanMessage(message); this.$refs.comMessage.showScanMessage(message);
}, },
closeScanMessage() { closeScanMessage() {
this.$refs.scanPackPopup.getfocus(); this.$refs.scanPackPopup.getfocus();
this.$refs.scanPopupItem.getfocus();
}, },
calcScanCount() { calcScanCount() {
@ -414,11 +505,9 @@
closeScanPopup() { closeScanPopup() {
if (this.allCount == this.scanCount) { if (this.allCount == this.scanCount) {
this.$refs.scanPackPopup.closeScanPopup(); this.$refs.scanPackPopup.closeScanPopup();
this.$refs.scanPopupItem.closeScanPopup();
} }
}, },
scanPopupGetFocus() {
this.$refs.scanPackPopup.getfocus();
},
} }
} }

11
fe/PDA/uni_modules/wz-select-popup/components/wz-select-popup/util/utils.js

@ -0,0 +1,11 @@
export function debounceSetting(fn, wait) {
let timeout = null;
wait = wait || 600;
return function () {
let that = this;
if(timeout !== null) clearTimeout(timeout);
timeout = setTimeout(() => {
fn.apply(that);
}, wait);
}
}

59
fe/PDA/uni_modules/wz-select-popup/components/wz-select-popup/wz-select-popup.vue

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<u-popup ref="popup" v-model="showPopup" border-radius="15" style="width: 100%;" mode="center"> <u-popup ref="popup" v-model="showPopup" border-radius="15" style="width: 100%;" mode="center">
<view class="select-popup-content"> <view class="select-popup-content">
<view class="uni-flex" style="display: flex; width: 100%;justify-content: center; "> <view class="uni-flex" style="display: flex; width: 100%;justify-content: center; ">
<view class="" style=" font-size: 35rpx; margin: 20rpx; font-weight: bold;"> <view class="" style=" font-size: 35rpx; margin: 20rpx; font-weight: bold;">
@ -8,9 +8,10 @@
</view> </view>
</view> </view>
<u-line></u-line> <u-line></u-line>
<view class="popup-search"> <view class="popup-search">
<wz-search v-model="searchValue" @search="searchData('search')" @clear="searchData('clear')" @input="change"/> <wz-search v-model="searchValue" @search="searchData('search')" @clear="searchData('clear')"
@input="changeValue" />
</view> </view>
<scroll-view class="popup-scroll-y" :scroll-top="scroll.newTop" scroll-y <scroll-view class="popup-scroll-y" :scroll-top="scroll.newTop" scroll-y
:style="{'--popup-scroll-height': scrollH}" @scrolltolower="scrolltolower" @scroll="viewScroll"> :style="{'--popup-scroll-height': scrollH}" @scrolltolower="scrolltolower" @scroll="viewScroll">
@ -33,6 +34,8 @@
<script> <script>
import wzSearch from "./wz-search.vue" import wzSearch from "./wz-search.vue"
import wzList from "./wz-list.vue" import wzList from "./wz-list.vue"
import {debounceSetting} from "./util/utils.js"
import { import {
deepMerge, deepMerge,
deepClone, deepClone,
@ -65,8 +68,8 @@
type: String, type: String,
default: '物料查询' default: '物料查询'
}, },
}, },
data() { data() {
return { return {
@ -81,7 +84,7 @@
newTop: 0 newTop: 0
}, },
popConfig: {}, popConfig: {},
showPopup:false showPopup: false,
}; };
}, },
mounted() { mounted() {
@ -103,11 +106,19 @@
this.scroll.oldTop = e.detail.scrollTop this.scroll.oldTop = e.detail.scrollTop
}, 100) }, 100)
}, },
change(data){
console.log("输入",data) changeValue: debounceSetting(function() {
this.searchData("search") this.searchData("search")
}, }, 500),
// change(data){
// console.log("",data)
// this.searchValue = debounce(this.searchData("search"), 500)
// // this.searchData("search")
// },
searchData(type) { searchData(type) {
console.log("输入", this.searchValue)
const { const {
search, search,
fields, fields,
@ -161,14 +172,14 @@
if (config) { if (config) {
this.popConfig = deepMerge(this.popConfig, config) this.popConfig = deepMerge(this.popConfig, config)
} }
this.dataList=[] this.dataList = []
this.searchValue="" this.searchValue = ""
this.listInit(dataList) this.listInit(dataList)
this.showPopup =true; this.showPopup = true;
}, },
/**列表数据初始化*/ /**列表数据初始化*/
listInit(dataList) { listInit(dataList) {
this.pageStatus.loading = 'loading' this.pageStatus.loading = 'loading'
//dataListproxyConfig.reqFun //dataListproxyConfig.reqFun
if (dataList && dataList instanceof Array) { if (dataList && dataList instanceof Array) {
@ -189,19 +200,25 @@
/**组件代理请求*/ /**组件代理请求*/
proxyRequest() { proxyRequest() {
console.log("请求proxyRequest") console.log("请求proxyRequest")
uni.showLoading({
title: "加载中",
mask: true
})
const { const {
proxyConfig, proxyConfig,
page page
} = this.popConfig } = this.popConfig
this.pageStatus.loading = 'loading' this.pageStatus.loading = 'loading'
proxyConfig.reqFun({ proxyConfig.reqFun({
...page, ...page,
searchValue: this.searchValue searchValue: this.searchValue
}).then(list => { }).then(list => {
list.items.forEach(res=>{ uni.hideLoading()
res.code =res.itemCode list.items.forEach(res => {
res.name =res.itemName; res.itemCode = res.itemCode?res.itemCode:res.code
res.itemName = res.itemName?res.itemName:res.name
res.itemDesc1 =res.itemDesc1?res.itemDesc1:res.desc1
}) })
if (proxyConfig.localPaging) { // if (proxyConfig.localPaging) { //
@ -210,12 +227,12 @@
return return
} }
this.pageStatus.loading = 'loadmore' this.pageStatus.loading = 'loadmore'
// if (!list.items || list.items.length != page.pageSize) { // if (!list.items || list.items.length != page.pageSize) {
// this.pageStatus.loading = 'nomore' // this.pageStatus.loading = 'nomore'
// this.pageStatus.isEmpty = true // this.pageStatus.isEmpty = true
// } // }
if (!list.items || list.items.length ==0) { if (!list.items || list.items.length == 0) {
this.pageStatus.loading = 'nomore' this.pageStatus.loading = 'nomore'
this.pageStatus.isEmpty = true this.pageStatus.isEmpty = true
} }
@ -225,7 +242,7 @@
}) })
}, },
close() { close() {
this.showPopup =false; this.showPopup = false;
this.$emit('close') this.$emit('close')
setTimeout(() => { setTimeout(() => {
this.allDataList = null this.allDataList = null

Loading…
Cancel
Save