You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

446 lines
11 KiB
Vue

<!-- 扫描rfid,选择缓存区根据选择的缓存区查询库位勾选是否取走托盘提交托盘变更信息 -->
<template>
<view class="page-product-receipt">
<view class="header" :style="{ backgroundColor: `rgba(250, 53, 52, ${scrollTop / 100})` }">
<view class="left">
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack({})" />
</view>
<view class="title">备品备件出库</view>
<view class="right"></view>
</view>
<div class="singlebox">
<view class="single-left" style="background-color: #ffffff">
<!-- <view>扫描设备码:</view> -->
<u-search style="" placeholder="请扫描" @search="query" :focus="shouciFocus" v-model="orderNo" :show-action="false"> </u-search>
</view>
</div>
<u-form class="form" ref="uForm" :model="formdata" label-width="180rpx">
<!-- 单号 -->
<u-form-item label="备品备件编码" prop="materialCode">
<u-input placeholder="请输入编码" v-model="formdata.materialCode" />
</u-form-item>
<!-- 订单 -->
<u-form-item label="备品备件名称" prop="materialDesc">
<u-input placeholder="请输入名称" v-model="formdata.materialDesc" />
</u-form-item>
<u-form-item label="现有库存" prop="amount">
<u-input placeholder="请输入库存" v-model="formdata.amount" />
</u-form-item>
<!-- 机台 -->
<u-form-item label="出库数量" prop="quantity">
<u-input type="number" placeholder="请输入数量" v-model="formdata.quantity" />
</u-form-item>
<!-- <u-form-item label="出库仓库"> 成品库 </u-form-item> -->
</u-form>
<!-- <view class="list" >
<u-input @click="onfocus" placeholder="请选择日期" v-model="createTime" :clearable="false" />
<div class="item1" style="color: red">设备编码:{{ item.equipmentCode }}</div>
<div class="item1" style="color: red">设备名称:{{ item.equipmentName }}</div>
<div class="item1">车间编码: {{ item.planWorkshop }}</div>
<div class="item1" style="color: red">周期: {{ item.planLoop }}{{ item.planLoopType == 'month' ? '月' : item.planLoopType == 'day' ? '日' : item.planLoopType == 'year' ? '年' : '周' }}</div>
<div class="item1">循环执行时间开始: {{ item.planLoopStart }}</div>
<div class="item1">循环执行时间结束: {{ item.planLoopEnd }}</div>
</view> -->
<view class="bottom-bar">
<u-row class="button-bar">
<!-- 确定 -->
<u-col :span="6">
<u-button @click="onsubmit" type="primary">提交</u-button>
</u-col>
<!-- 返回 -->
<u-col :span="6">
<u-button type="error" @click="uni.navigateBack({})"></u-button>
</u-col>
</u-row>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import model from './model';
import chooseOne from '@/components/choose-one/choose-one.vue';
import jPicker from '@/components/J-Picker/jPicker.vue';
//import store from '@/store';
@Component({
components: {
chooseOne,
jPicker,
},
})
export default class SparepartsInto extends BasePage {
params: any = { year: true, month: true, day: true, hour: true, minute: true, second: true };
endTime: any = {};
model = model;
orderNoItemList: any = {};
orderNo: any = '';
formdata: any = {
spareCode: null,
spareName: null,
quantity: null,
storageId: null,
};
shouciFocus = true;
rules: any = {
spareCode: [
{
required: true,
message: '编码不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
},
],
spareName: [
{
required: true,
message: '名称不能为空',
trigger: ['change', 'blur'],
},
],
// amount: [
// {
// required: true,
// message: '库存不能为空',
// trigger: ['change'],
// },
// ],
quantity: [
{
required: true,
message: '数量不能为空',
trigger: ['change'],
},
{
validator: (rule: any, value: number, callback: (error?: Error) => void) => {
if (value <= 0) {
callback(new Error('数量必须大于0'));
} else {
callback();
}
},
trigger: ['change'],
},
],
};
async onReady() {
(this.$refs.uForm as any).setRules(this.rules);
}
onShow() {
// (this.$refs.uForm as any).setRules(this.rules);
}
cleardata() {
(this.$refs.uForm as any).resetFields();
this.orderNoItemList = [];
this.orderNo = '';
this.shouciFocus = false;
this.$nextTick(() => {
this.shouciFocus = true;
});
console.log(this.formdata);
// (this.$refs.uForm as any).setRules(this.rules);
}
async query() {
this.formdata = {};
// uni.showLoading({ title: '加载中' });
// this.customToast('请扫码设备编码');
if (this.orderNo == '' || this.orderNo.length == 0) {
(this.$refs.uToast as any).show({
title: '请扫码条码',
type: 'default',
});
return;
}
await this.model.queryOrderNo(this.orderNo);
if (model.orderNoItemList == undefined) {
(this.$refs.uToast as any).show({
title: '该条码未查到数据,请使用正确的条码!',
type: 'default',
});
} else {
if (this.orderNoItemList.productCode == 'EmptyPallet') {
(this.$refs.uToast as any).show({
title: '该条码未查到数据,请使用正确的条码!',
type: 'default',
});
return;
} else {
this.orderNoItemList = model.orderNoItemList;
this.formdata = this.orderNoItemList;
}
}
}
async onsubmit() {
//(this.$refs.uForm as any).setRules(this.rules);
(this.$refs.uForm as any).validate(async (valid) => {
if (valid) {
let query = {
spareCode: this.formdata.materialCode,
spareName: this.formdata.materialDesc,
amount: this.formdata.quantity,
storageId: this.formdata.storageId,
inOutType: 'type_out',
};
console.log(query);
this.cleardata();
await this.model.sparePartsInOutStorage(query);
if (this.model.SubmitCode.code == '200') {
(this.$refs.uToast as any).show({
title: '成功',
type: 'default',
});
this.cleardata();
} else {
(this.$refs.uToast as any).show({
title: '失败',
type: 'default',
});
}
} else {
// console.log('验证失败');
}
});
}
}
</script>
<style lang="scss" scoped>
.page-product-receipt {
background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #f8262c 51%, #d9001b 100%) no-repeat;
background-size: 100% 600rpx;
padding: 118rpx 30rpx 162rpx;
min-height: 100%;
.singlebox {
margin-top: 10px;
background-color: #fff;
padding: 10px;
border-radius: 5px;
box-shadow: 0 0 10px 0 rgba(128, 128, 128, 0.2);
}
.single-left {
display: flex;
.Scan {
border-radius: 6px;
}
}
.header {
position: fixed;
top: 0rpx;
left: 0;
right: 0;
z-index: 99;
display: flex;
height: 120rpx;
line-height: 88rpx;
color: #fff;
font-size: 34rpx;
font-weight: 500;
text-align: center;
padding: 45rpx 0rpx 0rpx;
.title {
flex: 3;
}
.left,
.right {
flex: 1;
}
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 88rpx;
height: 88rpx;
}
}
.form {
background-color: #fff;
padding: 30rpx;
padding-right: 10px;
border-radius: 15px 15px 15px 15px;
margin-top: 10px;
.u-form-item {
padding: 10rpx 0;
line-height: 35rpx;
}
.single {
width: 100%;
height: 100rpx;
display: flex;
.single-left {
width: 80%;
height: 100%;
display: flex;
view {
width: 142rpx;
height: 100%;
line-height: 100rpx;
}
}
.single-right {
button {
margin-top: 15rpx;
width: 25px;
height: 70rpx;
background-color: #fa3534;
font-size: 12px;
}
button:first-child {
margin-left: 3px;
}
}
}
.photoList {
display: flex;
padding-top: 12rpx;
.chooseBtn {
width: 202rpx;
height: 202rpx;
background: #fafafa;
border-radius: 12rpx;
border: 2rpx dashed #e2e2e2;
display: flex;
justify-content: center;
align-items: center;
.inner {
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.desc {
font-size: 28rpx;
font-weight: 400;
color: #24252a;
line-height: 40rpx;
}
.img {
width: 50rpx;
height: 50rpx;
margin-bottom: 6rpx;
}
}
.photoBox {
width: 202rpx;
height: 202rpx;
background: #fafafa;
border-radius: 12rpx;
position: relative;
.closeBtn {
position: absolute;
top: -12rpx;
right: -12rpx;
z-index: 2;
width: 36rpx;
height: 36rpx;
.img {
width: 36rpx;
height: 36rpx;
}
}
.img {
width: 202rpx;
height: 202rpx;
border-radius: 12rpx;
}
}
.itemBox {
flex: 0 0 202rpx;
margin-right: 20rpx;
&:last-child {
margin-right: 0;
}
}
}
}
.listform {
padding: 0px;
}
.list {
background-color: #ffffff;
padding: 21px;
box-sizing: border-box;
margin-top: 10px;
border-radius: 15px 15px 15px 15px;
border: rgba(121, 121, 121, 1) solid 1px;
.item-name {
.quest {
// width: 367px;
// border-radius: 5px;
// border: rgba(121, 121, 121, 1) solid 1px;
// background-color: #ffffff;
padding: 7px 8px 7px 12px;
box-sizing: border-box;
text-align: center;
font-size: 18px;
font-weight: 600;
color: black;
}
.details {
display: flex;
font-size: 16px;
// font-weight: 600;
// justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
}
}
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 99;
background: #ffffff;
box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
padding: 20rpx;
}
::v-deep .yjy-switch-container .yjy-switch-item {
width: 100%;
}
::v-deep .yjy-switch-container {
width: 50%;
}
.listbottom ::v-deep .uni-input-input {
width: 94%;
padding: 5px;
}
.listbottom1 ::v-deep .uni-input-input {
border: 1px solid black;
width: 94%;
padding: 5px;
}
::v-deep .u-form-item {
padding: 6px 0;
}
::v-deep .uni-textarea-textarea {
border: 1px solid black;
width: 94%;
padding: 5px;
}
.photoList1 {
width: 220px;
overflow-y: scroll;
border: 1px solid black;
}
}
</style>