手持机代码初始化
This commit is contained in:
158
RuoYi-App-master/pages/out/klxout.vue
Normal file
158
RuoYi-App-master/pages/out/klxout.vue
Normal file
@@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="form-card">
|
||||
<uni-forms>
|
||||
<uni-forms-item label="仓库:">
|
||||
<uni-data-select
|
||||
v-model="formData.warehouseId"
|
||||
:localdata="warehouseList"
|
||||
:clear="false"
|
||||
placeholder="请选择仓库"
|
||||
@change="handleWarehouseChange"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出口:">
|
||||
<uni-data-select
|
||||
v-model="formData.exitId"
|
||||
:localdata="exitList"
|
||||
:clear="false"
|
||||
placeholder="请选择出口"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<button class="submit-button" hover-class="button-hover" @click="handleSubmit">空料箱出库</button>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBasWarehouList } from '@/api/bas/bas.js'
|
||||
import{ emptyBoxOut } from '@/api/out/ktpout.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
warehouseId: '',
|
||||
exitId: ''
|
||||
},
|
||||
warehouseList: [],
|
||||
exitList: []
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.getWarehouseList()
|
||||
},
|
||||
methods: {
|
||||
// 获取仓库列表
|
||||
async getWarehouseList() {
|
||||
try {
|
||||
const response = await getBasWarehouList({warehouseType:'2'})
|
||||
if (response.code === 200) {
|
||||
this.warehouseList = response.rows.map(item => ({
|
||||
value: item.warehouseId,
|
||||
text: item.warehouseName
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取仓库列表失败:', error)
|
||||
uni.showToast({
|
||||
title: '获取仓库列表失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 处理仓库变化
|
||||
handleWarehouseChange(warehouseId) {
|
||||
this.formData.exitId = ''
|
||||
// 模拟出口数据
|
||||
this.exitList = [
|
||||
{ value: '1', text: '出口1' },
|
||||
{ value: '2', text: '出口2' },
|
||||
{ value: '3', text: '出口3' }
|
||||
]
|
||||
},
|
||||
// 提交表单
|
||||
async handleSubmit() {
|
||||
if (!this.formData.warehouseId) {
|
||||
uni.showToast({
|
||||
title: '请选择仓库',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.formData.exitId) {
|
||||
uni.showToast({
|
||||
title: '请选择出口',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
// TODO: 调用出库API
|
||||
const response = await emptyBoxOut(this.formData)
|
||||
if (response.code === 200) {
|
||||
uni.showToast({
|
||||
title: '空料箱出库成功',
|
||||
icon:'success'
|
||||
})
|
||||
// 清空表单
|
||||
this.formData = {
|
||||
warehouseId: '',
|
||||
exitId: ''
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: response.msg || '出库操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
padding: 30rpx;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.form-card {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 40rpx 30rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item) {
|
||||
padding-bottom: 30rpx;
|
||||
|
||||
.uni-forms-item__label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.uni-easyinput__content {
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
height: 80rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.submit-button {
|
||||
margin-top: 40rpx;
|
||||
width: 100%;
|
||||
background-color: #3B7FFF;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
|
||||
&.button-hover {
|
||||
background-color: #2c6be6;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user