pda_uniapp/pages/work/wms/clearEmptyLoc.vue

236 lines
5.1 KiB
Vue

<!--托盘信息查询-->
<template>
<view class="container">
<cu-custom :isBack="true">
<block slot="backText"></block>
<block slot="content"> 整巷道清空</block>
</cu-custom>
<view class="example">
<uni-forms ref="form" labelWidth="80px">
<uni-forms-item label="货位编号" name="locCode">
<view class="fromItem">
<view class="flex-twice padding-0 radius">
<uni-easyinput v-model="locCode" placeholder="请扫描货位编号" @blur="queryLocInfo" />
</view>
<image style="width: 28rpx;" src="/static/images/right.png" mode="widthFix"></image>
</view>
</uni-forms-item>
</uni-forms>
<!-- <button type="primary" @click="handleClear">一键清空</button> -->
<!-- 货位信息表格 -->
<view v-if='locList.length>0'>
<view class="uni-container">
<uni-table border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th style="flex: 1;" align="center">货位编号</uni-th>
<uni-th style="flex: 1;" align="center">托盘编号</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in locList" :key="index">
<uni-td style="flex: 1;" align="center">{{ item.locCode }}</uni-td>
<uni-td style="flex: 1;" align="center">{{ item.palletCode || '--' }}</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
</view>
<bottomBtn :isSubmit="true" :isWhite="false" position="fixed" :texts="['一键清空']"
@onSubmit="handleClear"></bottomBtn>
</view>
</template>
<script>
import { queryEmptyLoc, clearEmptyLoc } from "@/api/wms/agvRf.js"
import {
bottomBtn
} from '@/components/bottomBtn/bottomBtn.vue'
export default {
data() {
return {
locCode: "", // 输入的货位编号
locList: [], // 查询到的货位列表
whCode: this.$store.state.user.warehouse[0]?.warehouseCode,
userCode: this.$store.state.user.name,
rules: {
locCode: {
rules: [{
required: true,
errorMessage: '货位编号不能为空'
}]
}
}
};
},
component: {
bottomBtn
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
// 查询货位信息
async queryLocInfo() {
if (!this.locCode) return
this.$modal.loading("查询中...")
try {
const { code, data } = await queryEmptyLoc({
locCode: this.locCode ,
userCode: this.userCode,
warehouseCode: this.whCode
})
if (code === 200) {
this.locList = data || []
if (data.length === 0) {
this.$modal.msg("该巷道暂无货位信息")
}
}
} catch (e) {
console.error(e)
} finally {
this.$modal.closeLoading()
}
},
// 显示清空确认对话框
showClearConfirm() {
if (!this.locCode) {
return this.$modal.msg("请先输入货位编号")
}
uni.showModal({
title: '确认清空',
content: `确定要清空货位【${this.locCode}】下的所有托盘吗?`,
confirmText: '确定清空',
confirmColor: '#DD524D',
cancelText: '取消',
success: res => {
if (res.confirm) {
this.handleClear()
}
}
})
},
// 执行清空操作
async handleClear() {
this.$modal.loading("清空中...")
try {
const { code, msg } = await clearEmptyLoc({
locCode: this.locCode ,
userCode: this.userCode,
warehouseCode: this.whCode
})
if (code === 200) {
this.$modal.msgSuccess("清空成功")
this.locList = [] // 清空列表
this.locCode = "" // 清空输入
} else {
this.$modal.msgError(msg || "清空失败")
}
} catch (e) {
console.error(e)
this.$modal.msgError("请求失败")
} finally {
this.$modal.closeLoading()
}
}
}
}
</script>
<style lang="scss">
.container {
background: rgb(242, 243, 245);
height: 100vh;
}
.uni-forms-item {
border-bottom: 1px solid #E5E6EB;
margin-bottom: 0;
padding: 24rpx 0;
}
::v-deep .uni-forms-item__label {
color: #1D2129;
font-size: 28rpx;
font-weight: 400;
}
::v-deep .uni-select {
border: 0px;
}
::v-deep.uni-select__input-placeholder {
font-size: 28rpx;
font-weight: 400;
color: #86909C;
}
.textarea {
background-color: #F2F3F5;
width: 100%;
}
::v-deep.full-width-textarea {
width: 100% !important;
border: unset !important;
}
::v-deep .is-input-border {
border: unset;
}
::v-deep .uni-easyinput__placeholder-class {
font-size: 28rpx;
color: #86909C;
}
::v-deep .uni-input-input {
font-size: 28rpx;
}
::v-deep .uni-select__input-placeholder {
font-size: 28rpx;
color: #86909C;
}
::v-deep .uniui-bottom {
display: none;
}
::v-deep .uniui-top {
display: none;
}
.fromItem {
display: flex;
align-items: center;
}
.example {
padding: 0 24rpx;
background-color: #fff;
width: 702rpx;
border-radius: 24rpx;
margin: 24rpx auto;
}
/* 原有样式保留 */
.cu-form-group .title {
min-width: calc(4em + 15px);
}
page {
background-color: #ffffff;
}
.example {
padding: 15px;
background-color: #fff;
}
.button {
margin: 15px 0;
}
</style>