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>
<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: {},
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app'; // uni-app onLoad
data() {
return {
itemCode: "",
itemCodeResult: [],
current: 1,
total: 18,
tableData: []
}
},
props: {
// detail: {
// type: Object,
// default: {}
// },
const props = defineProps({
businessTypeCode: {
type: String,
default: ""
}
},
watch: {
});
const comMessage = ref(null);
},
methods: {
statusStyle: function(val) {
const itemCode = ref("");
const itemCodeResult = ref([]);
const current = ref(1);
const total = ref(18);
const tableData = ref([]);
const statusStyle = (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
this.itemCodeResult = []
this.getBalanceByBusiness(this.itemCode, this.businessTypeCode)
},
clearItemCode() {
this.itemCode = ""
this.itemCodeResult = []
this.tableData =[]
},
onConfirmItemCode() {
if (!this.itemCode) {
this.showErrorMessage("物料号为空,请先输入物料号")
};
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;
}
this.tableData=[]
tableData.value = [];
uni.showLoading({
title: "加载中",
mask: true
})
});
getBasicItemByCodeSenior(this.itemCode).then(res => {
getBasicItemByCodeSenior(itemCode.value).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)
if (res.data.list.length === 1) {
itemCode.value = res.data.list[0].code;
getBalanceByBusiness(itemCode.value, props.businessTypeCode);
} else {
uni.hideLoading()
this.itemCodeResult = res.data.list
uni.hideLoading();
itemCodeResult.value = res.data.list;
}
} else {
uni.hideLoading()
this.showErrorMessage("未查找到物料[" + this.itemCode + "]")
uni.hideLoading();
showErrorMessage("未查找到物料[" + itemCode.value + "]");
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
getBalanceByBusiness(itemCode, businessType) {
var params = {
const getBalanceByBusiness = (itemCode, businessType) => {
const params = {
itemCode: itemCode,
businessType: businessType,
inOrOut:"out"
}
getBalanceByBusinessType(params).then(res => {
uni.hideLoading()
inOrOut: "out"
};
getBalanceByBusinessType(params).then((res) => {
uni.hideLoading();
if (res.data && res.data.length > 0) {
this.tableData = res.data
tableData.value = res.data;
} else {
this.showErrorMessage("系统异常:按"+res.msg+"未查找到库存")
showErrorMessage("系统异常:按" + res.msg + "未查找到库存");
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
showDrawer() {
this.$refs.showRight.open();
},
closeDrawer() {
this.$refs.showRight.close();
}
}
}
const showDrawer = () => {
show.value = true
};
const closeDrawer = () => {
show.value = false
};
</script>
<style>

48
src/mycomponents/query/showListItem.vue

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

Loading…
Cancel
Save