Commit d76c32af by LJM

修复快速移位问题

parent 7203fc48
Showing with 150 additions and 142 deletions
......@@ -229,157 +229,164 @@
</template>
<script>
import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce';
import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce';
export default {
data() {
return {
is_focus: true,
is_submit: true,
single_style: false, //区分一条和多条样式
input_flag: false,
input_flag_position_code: false,
page: 1,
limit: 1000,
index: 0,
array: ['入库批次号'],
list: [],
searchParams: {
stock_in_batch_sn: '' //入库批次号
},
formParams: {
stock_id: '',
transfer_qty: '',
position_code: ''
}
};
},
onLoad(options) {
this.searchParams.stock_in_batch_sn = options.stock_in_batch_sn || '';
},
watch: {
list: {
handler(newList) {
if (newList.length > 0) {
this.formParams.transfer_qty = newList[0].useable_qty;
this.formParams.stock_id = newList[0].id;
} else {
this.formParams.transfer_qty = '';
export default {
data() {
return {
is_focus: true,
is_submit: true,
single_style: false, //区分一条和多条样式
input_flag: false,
input_flag_position_code: false,
page: 1,
limit: 1000,
index: 0,
array: ['入库批次号'],
list: [],
searchParams: {
stock_in_batch_sn: '' //入库批次号
},
formParams: {
stock_id: '',
transfer_qty: '',
position_code: ''
}
},
deep: true
}
},
methods: {
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
};
},
onFocus(event) {
if (this.flag) {
this.flag = false;
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.reLaunch({
url: '/pages/transfer/record'
});
}
},
/**
* 选中一条数据
*/
filterChange(targetId) {
this.list = this.list.filter(item => item.id === targetId);
this.single_style = true;
onLoad(options) {
this.searchParams.stock_in_batch_sn = options.stock_in_batch_sn || '';
},
/**
* 获取列表数据
*/
getData() {
this.request(API.searchStockListByYW, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
this.list = res.data.list;
this.single_style = Number(res.data.count) > 1 ? false : true;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
watch: {
list: {
handler(newList) {
if (newList.length > 0) {
this.formParams.transfer_qty = newList[0].useable_qty;
this.formParams.stock_id = newList[0].id;
} else {
this.formParams.transfer_qty = '';
}
},
deep: true
}
},
/**
* 快速移位
*/
quickTransfer() {
this.request(API.quickTransfer, 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
this.is_submit = true;
uni.showModal({
title: '提示',
content: '移位成功',
showCancel: false,
confirmText: '确定',
success: res => {
if (res.confirm) {
//恢复初始
this.searchParams.stock_in_batch_sn = '';
this.list = [];
this.is_focus = false;
setTimeout(() => {
this.is_focus = true;
}, 800);
}
}
});
} else {
this.is_submit = false;
uni.showToast({
title: res.msg,
icon: 'none'
});
methods: {
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
},
onFocus(event) {
if (this.flag) {
this.flag = false;
}
});
},
/**
* 单号搜索
* @param {Object} event
* @param {Object} type 1 目标移位
*/
handleInput: debounce(function(event, type) {
var val = event.target.value;
if (val) {
if (type == 1) {
this.input_flag_position_code = true;
this.quickTransfer(); //调用快速移位
},
/**
* 选中一条数据
*/
filterChange(targetId) {
this.list = this.list.filter(item => item.id === targetId);
this.single_style = true;
},
/**
* 获取列表数据
*/
getData() {
this.request(API.searchStockListByYW, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
this.list = res.data.list;
this.single_style = Number(res.data.count) > 1 ? false : true;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
/**
* 快速移位
*/
quickTransfer() {
this.request(API.quickTransfer, 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
this.is_submit = true;
uni.showModal({
title: '提示',
content: '移位成功',
showCancel: false,
confirmText: '确定',
success: res => {
if (res.confirm) {
//恢复初始
this.searchParams.stock_in_batch_sn = '';
this.list = [];
this.is_focus = false;
setTimeout(() => {
this.is_focus = true;
}, 800);
}
}
});
} else {
this.is_submit = false;
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
/**
* 单号搜索
* @param {Object} event
* @param {Object} type 1 目标移位
*/
handleInput: debounce(function(event, type) {
var val = event.target.value;
if (val) {
if (type == 1) {
this.input_flag_position_code = true;
this.quickTransfer(); //调用快速移位
} else {
this.input_flag = true;
this.getData();
}
} else {
this.input_flag = true;
this.getData();
if (type == 1) {
this.input_flag_position_code = false;
} else {
this.input_flag = false;
this.list = [];
}
}
} else {
if (type == 1) {
}, 500),
/**
* 清空数据
*/
clearInput(type) {
this.is_submit = true;
if (type) {
this.formParams.position_code = '';
this.input_flag_position_code = false;
} else {
this.input_flag = false;
this.searchParams.stock_in_batch_sn = '';
this.list = [];
}
}
}, 500),
/**
* 清空数据
*/
clearInput(type) {
this.is_submit = true;
if (type) {
this.formParams.position_code = '';
this.input_flag_position_code = false;
} else {
this.input_flag = false;
this.searchParams.stock_in_batch_sn = '';
this.list = [];
}
}
}
};
};
</script>
<style scoped lang="scss">
@import '@/assets/css/transfer/quick.scss';
</style>
@import '@/assets/css/transfer/quick.scss';
</style>
\ No newline at end of file
// const API_BASE_USER = 'http://user.liexindev.net'; //用户系统
// const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统
// const API_BASE = 'http://wms.liexindev.net'; //WMS系统
// const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统
const API_BASE_USER = 'http://user.liexindev.net'; //用户系统
const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统
const API_BASE = 'http://wms.liexindev.net'; //WMS系统
const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统
const API_BASE_USER = 'https://user.ichunt.net'; //用户系统
const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统
const API_BASE = 'https://wms.ichunt.net'; //WMS系统
const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
// const API_BASE_USER = 'https://user.ichunt.net'; //用户系统
// const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统
// const API_BASE = 'https://wms.ichunt.net'; //WMS系统
// const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
const API = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment