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.

557 lines
14 KiB
Vue

<template>
<view class="page-raw-receipt">
<view class="top"></view>
<view class="header">
<view class="left">
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack()" />
</view>
<view class="title">{{ $t('message.create') }}</view>
<view class="right"></view>
</view>
<view class="content">
<view class="single">
<view class="single-right">
<u-button type="primary" @click="propoWindow">{{ $t('message.Warehouse_Tip6') }}</u-button>
</view>
</view>
<view class="material">
<view class="material-right">
<view class="material-right-title">{{ $t('message.Production') }}:</view>
<view class="material-right-code" style="overflow: hidden">{{ some.prdOrder }}</view>
</view>
</view>
<view class="material">
<view class="material-right">
<view class="material-right-title">{{ $t('message.Pi_materielNo') }}:</view>
<view class="material-right-code" style="overflow: hidden">{{ some.materialCode }}</view>
</view>
</view>
<view class="material">
<view class="material-right">
<view class="material-right-title">{{ $t('message.materialName') }}:</view>
<view class="material-right-code" style="overflow: hidden">{{ some.materialDesc }}</view>
</view>
</view>
<view class="material">
<view class="material-right">
<view class="material-right-title">{{ $t('message.Pi_unit') }}:</view>
<view class="material-right-code" style="overflow: hidden">{{ some.unit }}</view>
</view>
</view>
<!-- 库位 -->
<view class="library">
<view class="library-left">
<view>{{ $t('message.receiveAStation') }}:</view>
<view class="material-right-code" style="overflow: hidden">{{ some.sendSpot }}</view>
</view>
</view>
<view class="library">
<view class="library-right">
<view class="library-right-title">{{ $t('message.quantityNum') }}:</view>
<u-input :placeholder="$t('message.Summary_PleaseInputNumber')" v-model="qty" type="number" :border="border" class="input" />
</view>
<!-- 添加 -->
<view class="add">
<u-button type="primary" @click="Add">{{ $t('message.product_add') }}</u-button>
</view>
</view>
<!-- 表格 -->
<wyb-table class="table" ref="table" width="100%" show-left-and-right-border :headers="detailHeader" :contents="List" :show-vert-border="false" @onCellClick="deleteItem($event)"></wyb-table>
</view>
<!-- 弹窗 -->
<u-popup v-model="show" mode="center" closeable width="95%" height="90%" border-radius="14">
<view class="single">
<view class="single-left">
<view>{{ $t('message.Production') }}</view>
<u-search :placeholder="$t('message.Commission_tips1')" v-model.trim="prdOrder" :show-action="false"> </u-search>
</view>
</view>
<view class="singles">
<view class="single-lefts">
<view>{{ $t('message.po_MaterielNo') }}</view>
<u-search :placeholder="$t('message.materialCode')" v-model.trim="materialCode" :show-action="false"> </u-search>
</view>
<view class="single-rights">
<u-button type="primary" @click="query">{{ $t('message.Query') }}</u-button>
</view>
</view>
<scroll-view scroll-y="true" scroll-x="true" style="height: 360px; padding-top: 20px; white-space: nowrap">
<view style="display: inline-block">
<wyb-table class="table" ref="table" enable-check="single" show-left-and-right-border width="100%" :headers="PropoHeader" @onCheck="selectItem($event)" :contents="PopupList" :show-vert-border="false"> </wyb-table>
</view>
</scroll-view>
<wyb-pagination @change="Change" :total-items="model.MaterialList.length" page-items="10" :prev-text="$t('message.previousPage')" :next-text="$t('message.nextPage')" :first-text="$t('message.HomePage')" :last-text="$t('message.TailPage')" v-if="PageShow" />
<u-button type="primary" style="margin-top: 20px" @click="onOk">{{ $t('message.workArea_Confirm') }}</u-button>
</u-popup>
<view class="bottom-bar">
<div class="container">
<u-row>
<u-col :span="6">
<u-button type="success" @click="onSubmit">
{{ $t('message.product_Confirm') }}
</u-button>
</u-col>
<u-col :span="6">
<u-button type="error" @click="uni.navigateBack()">
{{ $t('message.po_Return') }}
</u-button>
</u-col>
</u-row>
</div>
</view>
</view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import model from './model';
import jPicker from '@/components/J-Picker/jPicker.vue';
import { CreteListHeader, PropoHeader } from './config';
@Component({
components: {
jPicker,
},
})
export default class RawReceiptDetail extends BasePage {
detailHeader = CreteListHeader;
PropoHeader = PropoHeader;
model = model;
border = true;
show = false;
PageShow = true;
List: any = [];
some: any = {};
qty: any = '';
PopupList: any = [];
obj: any;
//生产订单号
prdOrder: any = '';
//物料号
materialCode: any = '';
async propoWindow() {
this.show = !this.show;
if (this.obj != undefined) {
this.PopupList = this.obj[0];
}
if (this.PopupList.length == 0) {
this.PageShow = false;
} else {
this.PageShow = true;
}
}
async query() {
this.PageShow = false;
this.PopupList = [];
this.obj = undefined;
let params = {
prdOrder: this.prdOrder,
materialCode: this.materialCode,
};
await this.model.queryMaterialList(params);
this.obj = this.group(this.model.MaterialList, 10);
this.PopupList = this.obj[0];
this.PageShow = true;
}
group(array: any, subGroupLength: number) {
let index = 0;
let newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, (index += subGroupLength)));
}
return newArray;
}
Change(e: any) {
this.PopupList = this.obj[e.current - 1];
this.PopupList.forEach((item: any) => {
item.checked = false;
});
}
selectItem(e: any) {
console.log(e);
}
onOk() {
let flag = false;
let dataIndex = 0;
this.PopupList.forEach((item: any, index: any) => {
if (item.checked) {
flag = true;
dataIndex = index;
}
});
if (flag == false) {
uni.showToast({
title: this.$t('message.Commission_tips6') as any,
image: '/static/icons/icon-52.png',
});
return;
}
this.some = this.PopupList[dataIndex];
this.show = !this.show;
this.prdOrder = '';
this.materialCode = '';
}
Add() {
if (this.some == {}) {
uni.showToast({
title: this.$t('message.Commission_tips6') as any,
image: '/static/icons/icon-52.png',
});
this.qty = '';
return;
}
if (this.qty == '') {
uni.showToast({
title: this.$t('message.Summary_PleaseInputNumber') as any,
image: '/static/icons/icon-52.png',
});
return;
}
if (this.List.length != 0) {
let next = true;
this.List.forEach((item: any) => {
if (item.prdOrder == this.some.prdOrder && item.materialCode == this.some.materialCode && item.mrpCode == this.some.mrpCode && item.sendSpot == this.some.sendSpot) {
return (next = false);
}
});
if (next) {
this.some.amount = this.qty;
this.List.push(this.some);
this.qty = '';
} else {
uni.showToast({
title: this.$t('message.repeatedly') as any,
image: '/static/icons/icon-52.png',
});
this.qty = '';
return;
}
} else {
this.some.amount = this.qty;
this.List.push(this.some);
this.qty = '';
}
}
deleteItem(e: any) {
console.log(e);
uni.showModal({
title: this.$t('message.product_Delete') as any,
success: (res: any) => {
if (res.confirm) {
this.List.splice(e.contentIndex, 1);
} else if (res.cancel) {
return;
}
},
});
}
async onSubmit() {
if (this.List.length == 0) {
uni.showToast({
title: this.$t('message.Pi_tip4') as any,
image: '/static/icons/icon-52.png',
});
return;
}
this.List.forEach((item: any) => {
item.factoryCode = this.session.factoryCode;
item.loginName = this.session.loginName;
});
await this.model.submitList(this.List);
console.log('submitListCode', this.model.submitListCode);
if (this.model.submitListCode) {
uni.showToast({
title: this.$t('message.Warehouse_Tip9') as any,
image: '/static/icons/icon-51.png',
});
this.empty();
}
}
empty() {
this.List = [];
this.some = {};
this.qty = '';
this.prdOrder = '';
this.materialCode = '';
}
}
</script>
<style lang="scss" scoped>
.page-raw-receipt {
background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
background-size: 100% 600rpx;
padding: 118rpx 30rpx 162rpx;
min-height: 100%;
.uni-scroll-view-content {
overflow-x: auto;
.single {
width: 100%;
height: 80px;
display: flex;
padding-top: 30px;
.single-left {
width: 100%;
height: 60px;
display: flex;
view {
width: 110rpx;
height: 100%;
line-height: 100rpx;
}
}
.single-right {
button {
margin-top: 15rpx;
width: 150rpx;
height: 70rpx;
}
}
}
.singles {
width: 100%;
height: 50px;
// height: 100px;
display: flex;
.single-lefts {
width: 80%;
height: 60px;
display: flex;
view {
width: 110rpx;
height: 100%;
line-height: 100rpx;
}
}
.single-rights {
button {
margin-top: 15rpx;
width: 150rpx;
height: 70rpx;
}
}
}
}
.header {
position: fixed;
top: 36rpx;
left: 0;
right: 0;
z-index: 99;
display: flex;
height: 88rpx;
line-height: 88rpx;
color: #fff;
font-size: 34rpx;
font-weight: 500;
text-align: center;
.title {
flex: 3;
}
.left,
.right {
flex: 1;
}
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 88rpx;
height: 88rpx;
}
}
.content {
width: 100%;
background: white;
border-radius: 15rpx;
padding: 10rpx;
.material {
width: 100%;
height: 100rpx;
display: flex;
.material-left {
width: 100%;
height: 100%;
display: flex;
view {
width: 145rpx;
line-height: 100rpx;
}
.search {
padding-left: 12px;
}
}
}
.material {
width: 100%;
height: 100rpx;
display: flex;
.material-right {
width: 100%;
height: 100%;
display: flex;
.material-right-title {
width: 145rpx;
height: 100%;
line-height: 100rpx;
}
.material-right-code {
width: 80%;
height: 100%;
line-height: 100rpx;
text-align: left;
padding-left: 10px;
// line-height: 100rpx;
}
}
}
.number {
height: 100rpx;
display: flex;
.number-left {
width: 50%;
height: 100%;
display: flex;
.number-left-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
}
.input {
width: 200rpx;
height: 70rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
}
.number-right {
width: 50%;
height: 100%;
display: flex;
.number-right-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
text-align: center;
}
.input {
width: 200rpx;
height: 70rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
}
}
.library {
width: 100%;
height: 100rpx;
.library-left {
width: 100%;
height: 100%;
// display: flex;
view {
width: 120rpx;
line-height: 100rpx;
}
.material-right-code {
width: 200px;
padding-left: 20px;
}
}
.library-right {
width: 50%;
height: 100%;
display: flex;
.library-right-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
// text-align: center;
}
.input {
width: 200rpx;
height: 70rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
}
.add {
width: 100%;
height: 100rpx;
position: relative;
button {
position: absolute;
top: 10rpx;
right: 20rpx;
}
}
}
}
.bottom-bar {
z-index: 21;
position: fixed;
bottom: 0;
left: 0;
right: 0;
.container {
background: #ffffff;
// box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
padding: 20rpx;
}
.extra {
background-color: #fff;
margin: 5px;
border-radius: 5px;
padding: 0 10px;
}
.bottom-info {
.u-form-item {
padding: 0;
}
}
}
}
</style>