|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<view style=" "> |
|
|
|
<uni-drawer ref="showRight" mode="left" :mask-click="true" :width="330"> |
|
|
|
<u-popup v-model="show" mode="left" : :width="330"> |
|
|
|
<view style="height:100vh;display:flex;flex-direction:column;"> |
|
|
|
<view class="uni-flex" style="justify-content: center; |
|
|
|
background-color:#007AFF ; |
|
|
@ -16,8 +16,8 @@ |
|
|
|
物料号: |
|
|
|
</view> |
|
|
|
<view style=" margin: 10rpx; display: flex; align-items: center;"> |
|
|
|
<uni-easyinput class="uni-mt-5" prefixIcon="search" v-model="itemCode" placeholder="请输入物料号" |
|
|
|
@clear="clearItemCode" @confirm="onConfirmItemCode"></uni-easyinput> |
|
|
|
<u-input class="uni-mt-5" prefixIcon="search" v-model="itemCode" placeholder="请输入物料号" |
|
|
|
@clear="clearItemCode" @confirm="onConfirmItemCode"></u-input> |
|
|
|
<!-- <view>查询</view> --> |
|
|
|
<!-- <button style="height: 80rpx; align-items: center; text-align: center;" type="primary" size="mini" >查询</button> --> |
|
|
|
</view> |
|
|
@ -43,23 +43,23 @@ |
|
|
|
style="width: 330px; display: flex; align-items: center; justify-content: center; "> |
|
|
|
<view |
|
|
|
style="width: 330px; display: flex;justify-content: center; background-color: #fff; padding-bottom: 150rpx;"> |
|
|
|
<uni-table border stripe emptyText="暂无更多数据"> |
|
|
|
<u-table border stripe emptyText="暂无更多数据"> |
|
|
|
<!-- 表头行 --> |
|
|
|
<uni-tr> |
|
|
|
<uni-th width="60" align="left">批次</uni-th> |
|
|
|
<uni-th width="100" align="left">库位</uni-th> |
|
|
|
<uni-th width="60" align="left">状态</uni-th> |
|
|
|
<uni-th width="120" align="left">数量</uni-th> |
|
|
|
</uni-tr> |
|
|
|
<u-tr> |
|
|
|
<u-th width="60" align="left">批次</u-th> |
|
|
|
<u-th width="100" align="left">库位</u-th> |
|
|
|
<u-th width="60" align="left">状态</u-th> |
|
|
|
<u-th width="120" align="left">数量</u-th> |
|
|
|
</u-tr> |
|
|
|
<!-- 表格数据行 --> |
|
|
|
<uni-tr v-for="(item, index) in tableData" :key="index"> |
|
|
|
<uni-td>{{item.batch}}</uni-td> |
|
|
|
<uni-td>{{item.locationCode}}</uni-td> |
|
|
|
<uni-td>{{statusDesc(item.inventoryStatus)}}</uni-td> |
|
|
|
<uni-td>{{item.totalQty}}</uni-td> |
|
|
|
</uni-tr> |
|
|
|
|
|
|
|
</uni-table> |
|
|
|
<u-tr v-for="(item, index) in tableData" :key="index"> |
|
|
|
<u-td>{{item.batch}}</u-td> |
|
|
|
<u-td>{{item.locationCode}}</u-td> |
|
|
|
<u-td>{{statusDesc(item.inventoryStatus)}}</u-td> |
|
|
|
<u-td>{{item.totalQty}}</u-td> |
|
|
|
</u-tr> |
|
|
|
|
|
|
|
</u-table> |
|
|
|
<!-- <view class="uni-flex" style=" flex-direction: column; position: fixed; bottom: 0; margin-bottom: 100rpx; background-color: #fff; width: 100%; align-items: center;" > |
|
|
|
<view class="" style="width: 100%; display: flex; justify-content: center; font-size: 32rpx;margin-top: 10rpx;margin-bottom: 10rpx;"> |
|
|
|
<view class="" >当前页:{{ current }},总数:{{ total }}条,每页:{{ pageSize }} |
|
|
@ -79,12 +79,12 @@ |
|
|
|
<button @click="closeDrawer" type="primary" style="padding-left: 20rpx; width: 100%;">关闭</button> |
|
|
|
</view> |
|
|
|
|
|
|
|
</uni-drawer> |
|
|
|
</u-popup> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script setup> |
|
|
|
import { |
|
|
|
getBasicItemByCodeSenior, |
|
|
|
getBalanceByBusinessType |
|
|
@ -95,116 +95,110 @@ |
|
|
|
getInventoryStatusName |
|
|
|
} from '@/common/directory.js'; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: {}, |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
itemCode: "", |
|
|
|
itemCodeResult: [], |
|
|
|
current: 1, |
|
|
|
total: 18, |
|
|
|
tableData: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
props: { |
|
|
|
// detail: { |
|
|
|
// type: Object, |
|
|
|
// default: {} |
|
|
|
// }, |
|
|
|
businessTypeCode: { |
|
|
|
type: String, |
|
|
|
default: "" |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
statusStyle: function(val) { |
|
|
|
return getInventoryStatusStyle(val); |
|
|
|
}, |
|
|
|
statusDesc(value) { |
|
|
|
return getInventoryStatusName(value) |
|
|
|
}, |
|
|
|
change() { |
|
|
|
|
|
|
|
}, |
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
selectItemCode(item) { |
|
|
|
this.itemCode = item.code |
|
|
|
this.itemCodeResult = [] |
|
|
|
this.getBalanceByBusiness(this.itemCode, this.businessTypeCode) |
|
|
|
}, |
|
|
|
clearItemCode() { |
|
|
|
this.itemCode = "" |
|
|
|
this.itemCodeResult = [] |
|
|
|
this.tableData =[] |
|
|
|
}, |
|
|
|
onConfirmItemCode() { |
|
|
|
if (!this.itemCode) { |
|
|
|
this.showErrorMessage("物料号为空,请先输入物料号") |
|
|
|
return; |
|
|
|
} |
|
|
|
this.tableData=[] |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
getBasicItemByCodeSenior(this.itemCode).then(res => { |
|
|
|
if (res.data && res.data.list.length > 0) { |
|
|
|
if (res.data.list.length == 1) { |
|
|
|
this.itemCode = res.data.list[0].code |
|
|
|
this.getBalanceByBusiness(this.itemCode, this.businessTypeCode) |
|
|
|
} else { |
|
|
|
uni.hideLoading() |
|
|
|
this.itemCodeResult = res.data.list |
|
|
|
} |
|
|
|
} else { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage("未查找到物料[" + this.itemCode + "]") |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getBalanceByBusiness(itemCode, businessType) { |
|
|
|
var params = { |
|
|
|
itemCode: itemCode, |
|
|
|
businessType: businessType, |
|
|
|
inOrOut:"out" |
|
|
|
} |
|
|
|
getBalanceByBusinessType(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data && res.data.length > 0) { |
|
|
|
this.tableData = res.data |
|
|
|
} else { |
|
|
|
this.showErrorMessage("系统异常:按"+res.msg+"未查找到库存") |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
showDrawer() { |
|
|
|
this.$refs.showRight.open(); |
|
|
|
}, |
|
|
|
closeDrawer() { |
|
|
|
this.$refs.showRight.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
import { ref } from 'vue'; |
|
|
|
import { onLoad } from '@dcloudio/uni-app'; // 引入 uni-app 的 onLoad 钩子 |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
businessTypeCode: { |
|
|
|
type: String, |
|
|
|
default: "" |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
const comMessage = ref(null); |
|
|
|
|
|
|
|
const itemCode = ref(""); |
|
|
|
const itemCodeResult = ref([]); |
|
|
|
const current = ref(1); |
|
|
|
const total = ref(18); |
|
|
|
const tableData = ref([]); |
|
|
|
|
|
|
|
const statusStyle = (val) => { |
|
|
|
return getInventoryStatusStyle(val); |
|
|
|
}; |
|
|
|
|
|
|
|
const statusDesc = (value) => { |
|
|
|
return getInventoryStatusName(value); |
|
|
|
}; |
|
|
|
|
|
|
|
const change = () => { |
|
|
|
}; |
|
|
|
|
|
|
|
const showErrorMessage = (message) => { |
|
|
|
comMessage.value.showErrorMessage(message, (res) => { |
|
|
|
if (res) { |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const selectItemCode = (item) => { |
|
|
|
itemCode.value = item.code; |
|
|
|
itemCodeResult.value = []; |
|
|
|
getBalanceByBusiness(itemCode.value, props.businessTypeCode); |
|
|
|
}; |
|
|
|
|
|
|
|
const clearItemCode = () => { |
|
|
|
itemCode.value = ""; |
|
|
|
itemCodeResult.value = []; |
|
|
|
tableData.value = []; |
|
|
|
}; |
|
|
|
|
|
|
|
const onConfirmItemCode = () => { |
|
|
|
if (!itemCode.value) { |
|
|
|
showErrorMessage("物料号为空,请先输入物料号"); |
|
|
|
return; |
|
|
|
} |
|
|
|
tableData.value = []; |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
getBasicItemByCodeSenior(itemCode.value).then((res) => { |
|
|
|
if (res.data && res.data.list.length > 0) { |
|
|
|
if (res.data.list.length === 1) { |
|
|
|
itemCode.value = res.data.list[0].code; |
|
|
|
getBalanceByBusiness(itemCode.value, props.businessTypeCode); |
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
itemCodeResult.value = res.data.list; |
|
|
|
} |
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
showErrorMessage("未查找到物料[" + itemCode.value + "]"); |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
uni.hideLoading(); |
|
|
|
showErrorMessage(error); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const getBalanceByBusiness = (itemCode, businessType) => { |
|
|
|
const params = { |
|
|
|
itemCode: itemCode, |
|
|
|
businessType: businessType, |
|
|
|
inOrOut: "out" |
|
|
|
}; |
|
|
|
getBalanceByBusinessType(params).then((res) => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data && res.data.length > 0) { |
|
|
|
tableData.value = res.data; |
|
|
|
} else { |
|
|
|
showErrorMessage("系统异常:按" + res.msg + "未查找到库存"); |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
uni.hideLoading(); |
|
|
|
showErrorMessage(error); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const showDrawer = () => { |
|
|
|
show.value = true |
|
|
|
}; |
|
|
|
|
|
|
|
const closeDrawer = () => { |
|
|
|
show.value = false |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style> |
|
|
|