Browse Source

mycomponents/query 文件迁移Vue2升级Vue3 8/2-10/25

hella_vue3
王志国 3 weeks ago
parent
commit
96f6b6ecaa
  1. 198
      src/mycomponents/query/balanceQuery.vue
  2. 48
      src/mycomponents/query/showListItem.vue

198
src/mycomponents/query/balanceQuery.vue

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

48
src/mycomponents/query/showListItem.vue

@ -1,6 +1,6 @@
<template> <template>
<view class="wyf"> <view class="wyf">
<uni-popup ref="listPopup" type="dialog"> <u-popup v-model="show" mode="center">
<view class="container"> <view class="container">
<uni-list class="list"> <uni-list class="list">
<uni-list-item v-for="(item,index) in list" :title="item.title" <uni-list-item v-for="(item,index) in list" :title="item.title"
@ -11,42 +11,26 @@
</template> </template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
</view> </view>
</uni-popup> </u-popup>
</view> </view>
</template> </template>
<script> <script setup>
import { onShow } from '@dcloudio/uni-app'; import {ref} from 'vue'
export default { const isScanedASN = ref(false)
emits: ["selectItem"], const list = ref([])
components: { const show = ref(false)
}, const emit = defineEmits(['selectItem'])
data() { const openList = (list) => {
return { list.value = list
isScanedASN:false, show.value = true
list: [] }
// [{ const selectItem = (item,index)=>{
// title:'', show.value = false
// selected:false emit("selectItem", item)
// }], }
}
},
props: {
},
methods:{
openList(list){
this.list = list;
this.$refs.listPopup.open('center')
},
selectItem(item,index){
this.$refs.listPopup.close();
this.$emit("selectItem", item);
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save