<template>
|
<div class="enterEdit height overflow">
|
<div class="width overflow height92">
|
<div class="width edter-height">
|
<div class="flex margintopbot justify-between">
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">组盘单号:</label>
|
<el-input size="mini" disabled clearable v-model="iqnuer.cviCode" class="width60"> </el-input>
|
</div>
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">入库类型:</label>
|
|
<el-select class="width60" size="mini" filterable clearable v-model="iqnuer.inType" placeholder="请选择">
|
<el-option
|
v-for="(item, index) in inTypeList"
|
:key="'inType' + index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="flex margintopbot justify-between">
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">制件状态:</label>
|
|
<el-select
|
class="width60"
|
size="mini"
|
clearable
|
v-model="iqnuer.isBad"
|
placeholder="请选择"
|
@change="isbadchange"
|
>
|
<el-option
|
v-for="(item, index) in isBadList"
|
:key="'isbad' + index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">器具编号:</label>
|
<!-- <el-input size="mini" clearable v-model="iqnuer.containerName" class="width60"> </el-input> -->
|
|
<el-select
|
class="width60"
|
size="mini"
|
filterable
|
remote
|
reserve-keyword
|
:remote-method="remoteMethod"
|
:loading="remoloading"
|
clearable
|
@change="containerNamechange"
|
v-model="iqnuer.containerName"
|
placeholder="请输入关键词"
|
>
|
<el-option
|
v-for="(item, index) in containerNamelist"
|
:key="'badByFactory' + index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="flex margintopbot justify-between">
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">返修类型:</label>
|
|
<el-select class="width60" size="mini" clearable v-model="iqnuer.badByFactory" placeholder="请选择">
|
<el-option
|
v-for="(item, index) in badByFactorylist"
|
:key="'badByFactory' + index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">器具类型:</label>
|
<el-input size="mini" disabled clearable v-model="iqnuer.containerType" class="width60"> </el-input>
|
</div>
|
</div>
|
<div class="flex margintopbot justify-between">
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">合计数量:</label>
|
<el-input size="mini" disabled v-model="iqnuer.itemNum" class="width60"> </el-input>
|
</div>
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">合计重量:</label>
|
<el-input size="mini" disabled v-model="iqnuer.totalWeight" class="width60"> </el-input>
|
</div>
|
</div>
|
<div class="flex margintopbot justify-between">
|
<div class="width45 flex align-center">
|
<label class="width40 textalign">动态称重:</label>
|
<el-input size="mini" disabled v-model="iqnuer.getWeight" class="width60"> </el-input>
|
</div>
|
</div>
|
|
<el-button-group>
|
<el-button type="primary" size="mini" icon="el-icon-plus" @click="$emit('partclick')">添加零件</el-button>
|
<el-button type="primary" size="mini" icon="el-icon-delete" @click="deltable">删除</el-button>
|
</el-button-group>
|
</div>
|
<div class="width enter-tebleheight overflow">
|
<table-container
|
height="88%"
|
:wipelist="wipelist"
|
:tableHead="tableHead"
|
:tableData="tableData"
|
:inOrderCodeList="inOrderCodeList"
|
:setshow="false"
|
:operation="true"
|
:editShow="true"
|
:naxnumShow="true"
|
:selectionShow="true"
|
:inputshow="true"
|
:roweditshow="roweditshow"
|
:currentPage="page"
|
:pageSize="pageSize"
|
:totle="totle"
|
:operationwidth="80"
|
@handleSelectionChange="handleSelectionChange"
|
@CurrentChange="CurrentChange"
|
@itemchange="itemchange"
|
/>
|
</div>
|
</div>
|
<div class="enterEdit-button text-right margin-right15 margin-top2">
|
<el-button type="primary" size="mini" class="form-buttom" :loading="savloading" @click="submitForm"
|
>保存</el-button
|
>
|
<el-button type="primary" size="mini" class="form-buttom" @click="$emit('cancel')">取消</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { TableContainer, Modal } from '@/components/index';
|
import { getCache, setCache } from '@/utils/sessionStorage';
|
import { GetDateStr, GetTimeStr, getDate } from '@/utils/date';
|
const { enterEdit } = require('@/components/tableContainer/tableHead');
|
import { ContainerSearch } from '@/api/palte';
|
import { itemSearch } from '@/api/enterchoose';
|
import { InOrderSearch } from '@/api/quotation';
|
import {
|
ContainerVsItemSearch,
|
ContainerVsItemAdd,
|
ContainerVsItemUpdate,
|
ContainerVsItemAddAll,
|
GetCode
|
} from '@/api/enter';
|
import { ProductionLineSearch } from '@/api/cass-line';
|
export default {
|
data() {
|
return {
|
userinfo: getCache('userInfo'),
|
iqnuer: {
|
cviCode: null,
|
// itemName: null,
|
isFinish: 0,
|
containerName: null,
|
itemNum: null,
|
isBad: null,
|
badByFactory: null,
|
createLine: null,
|
inType: null,
|
itemList: null
|
},
|
remoloading: false,
|
itemList: [],
|
inTypeList: [
|
{
|
label: '即墨入库',
|
value: '即墨入库'
|
},
|
{
|
label: '李沧入库',
|
value: '李沧入库'
|
},
|
{
|
label: '余料回库',
|
value: '余料回库'
|
},
|
{
|
label: 'EU箱入立体库',
|
value: 'EU箱入立体库'
|
}
|
],
|
isBadList: [
|
{
|
label: '返修',
|
value: '1'
|
},
|
{
|
label: '不返修',
|
value: '0'
|
}
|
],
|
inOrderCodeList: [], //计划单号
|
createLineList: [],
|
containerNamelist: [], //器具编号
|
badByFactorylist: [],
|
wipelist: [],
|
tableData: [],
|
page: 1,
|
totle: 0,
|
pageSize: 20,
|
Selection: [], //勾选数据
|
storagelist: [], //存数据
|
roweditshow: false,
|
savloading: false
|
};
|
},
|
props: {
|
rowitem: {
|
type: Object,
|
default: () => {}
|
},
|
chooselist: {
|
type: Array,
|
default: () => []
|
}
|
},
|
components: { TableContainer },
|
computed: {
|
tableHead() {
|
return enterEdit;
|
}
|
},
|
mounted() {
|
console.log(this.userinfo.userName);
|
if (JSON.stringify(this.rowitem) != '{}') {
|
console.log(this.rowitem);
|
this.iqnuer = this.rowitem;
|
this.iqnuer.isBad = this.iqnuer.isBad == 1 ? '返修' : this.iqnuer.isBad == 0 ? '不返修' : this.iqnuer.isBad;
|
this.ContainerVsItemSearch();
|
} else {
|
this.GetCode();
|
}
|
this.containerNamelist = [];
|
this.ContainerSearch({ containerName: '' });
|
// this.ProductionLineSearch();
|
},
|
methods: {
|
//组盘编号
|
GetCode() {
|
GetCode().then(res => {
|
this.iqnuer.cviCode = res;
|
});
|
},
|
//生产计划单号
|
InOrderSearch(row) {
|
const { itemName } = row;
|
InOrderSearch('1&onePageNum=999', { itemName }).then(res => {
|
if (res.code == 0) {
|
this.inOrderCodeList = res.data;
|
}
|
});
|
},
|
remoteMethod(query) {
|
if (query !== '') {
|
this.remoloading = true;
|
setTimeout(() => {
|
this.remoloading = false;
|
this.ContainerSearch({ containerName: query });
|
}, 200);
|
}
|
},
|
//班线
|
// ProductionLineSearch() {
|
// ProductionLineSearch('1&onePageNum=999', { isDestination: 0 }).then(res => {
|
// if (res.code == 0) {
|
// this.createLineList = res.data.filter(item => {
|
// if (item.productionName.indexOf('出口') == -1) {
|
// return item;
|
// }
|
// });
|
// }
|
// });
|
// },
|
//器具编号
|
ContainerSearch(query) {
|
const { containerName } = query;
|
this.containerNamelist = [];
|
ContainerSearch('1&onePageNum=999', { containerName }).then(res => {
|
if (res.code == 0) {
|
let data = res.data || [];
|
data.forEach(element => {
|
this.containerNamelist.push({
|
label: element.containerName,
|
value: element.containerName,
|
containerType: element.containerType
|
});
|
});
|
}
|
});
|
},
|
//器具类型
|
containerNamechange(e) {
|
this.containerNamelist.forEach(element => {
|
if (e == element.value) {
|
this.iqnuer.containerType = element.containerType;
|
}
|
});
|
},
|
//编辑时获取零件列表数据
|
ContainerVsItemSearch() {
|
ContainerVsItemSearch(this.page, { containerName: this.rowitem.containerName }).then(res => {
|
if (res.code == 0) {
|
this.storgage(res.data);
|
this.totle = res.num;
|
}
|
});
|
},
|
//分页
|
CurrentChange(e) {
|
this.page = e;
|
this.ContainerVsItemSearch();
|
},
|
submitForm() {
|
console.log(this.iqnuer);
|
if (this.roweditshow) {
|
this.$message({
|
type: 'warning',
|
message: '请先保存'
|
});
|
} else {
|
if (this.storagelist.length == 0) {
|
this.$message({
|
type: 'warning',
|
message: '请添加零件'
|
});
|
} else {
|
this.iqnuer.isBad = this.iqnuer.isBad == '返修' ? 1 : this.iqnuer.isBad == '不返修' ? 0 : this.iqnuer.isBad;
|
this.iqnuer.itemList = JSON.stringify(this.itemList);
|
const { cviCode, inType, itemList, containerName, isBad, badByFactory } = this.iqnuer;
|
|
if (this.iqnuer.isBad != null && this.iqnuer.inType != null && this.iqnuer.itemList != null) {
|
this.savloading = true;
|
// createUser:this.userinfo.userName
|
ContainerVsItemAddAll({
|
cviCode,
|
inType,
|
itemList,
|
containerName,
|
isBad,
|
badByFactory,
|
createUser: this.userinfo.userName
|
}).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '添加成功'
|
});
|
this.$emit('cancel');
|
} else {
|
this.$message({
|
type: 'warning',
|
message: res.msg
|
});
|
}
|
this.savloading = false;
|
});
|
}
|
}
|
}
|
},
|
//返修类型
|
isbadchange(e) {
|
console.log(e);
|
this.iqnuer.badByFactory = '';
|
if (e == 1) {
|
this.badByFactorylist = [
|
{
|
label: '焊装返修',
|
value: '焊装返修'
|
},
|
{
|
label: '冲压返修',
|
value: '冲压返修'
|
}
|
];
|
} else {
|
this.badByFactorylist = [];
|
}
|
},
|
//过滤存储
|
storgage(lists) {
|
let list = [...lists];
|
list.forEach(element => {
|
this.storagelist.push(element);
|
// this.storagelist = lists;
|
// this.iqnuer.itemName = this.storagelist[0].itemName;
|
// if (JSON.stringify(this.rowitem) == '{}') {
|
// this.iqnuer.itemNum = 0;
|
// }
|
});
|
this.itemList = [];
|
this.filtration();
|
},
|
filtration(lists) {
|
let list = [...this.storagelist];
|
let weight = '';
|
let getWeight = '';
|
list.forEach(element => {
|
element.edit = false;
|
if (element.weight) {
|
weight = element.weight;
|
}
|
if (JSON.stringify(this.rowitem) == '{}') {
|
if (element.maxNum) {
|
this.iqnuer.itemNum += parseInt(element.maxNum);
|
}
|
element.itemNum = element.maxNum;
|
} else {
|
element.maxNum = this.iqnuer.itemNum;
|
}
|
this.itemList.push({
|
itemName: element.itemName,
|
inOrderCode: element.inOrderCode,
|
itemNum: element.maxNum
|
});
|
});
|
if (weight && this.iqnuer.itemNum) {
|
getWeight += weight * parseInt(this.iqnuer.itemNum);
|
}
|
this.iqnuer.totalWeight = getWeight;
|
this.tableData = list;
|
},
|
|
//勾选table
|
handleSelectionChange(e) {
|
console.log(e);
|
this.Selection = e;
|
},
|
|
//数量
|
itemchange(e, item) {
|
this.itemList = [];
|
this.InOrderSearch(item);
|
this.roweditshow = !this.roweditshow;
|
this.iqnuer.itemNum = 0;
|
let weight = '';
|
let getWeight = '';
|
e.forEach(element => {
|
// element.edit = false;
|
this.itemList.push({
|
itemName: element.itemName,
|
inOrderCode: element.inOrderCode,
|
itemNum: element.maxNum
|
});
|
if (element.weight) {
|
weight = element.weight;
|
}
|
if (element.maxNum) {
|
this.iqnuer.itemNum += parseInt(element.maxNum);
|
}
|
element.itemNum = element.maxNum;
|
});
|
if (weight && this.iqnuer.itemNum) {
|
getWeight += weight * parseInt(this.iqnuer.itemNum);
|
}
|
this.iqnuer.totalWeight = getWeight;
|
this.storagelist = e;
|
console.log(this.tableData);
|
// this.chooselist.forEach(item => {
|
// if (item.itemName == e.itemName) {
|
// item.maxNum = e.itemNum;
|
// }
|
// });
|
},
|
//删除表格数据
|
deltable() {
|
this.Selection.forEach(element => {
|
let index = this.tableData.findIndex(item => item.itemName == element.itemName);
|
let storgindex = this.storagelist.findIndex(item => item.itemName == element.itemName);
|
this.tableData.splice(index, 1);
|
this.storagelist.splice(storgindex, 1);
|
});
|
this.itemList = [];
|
this.storagelist.forEach(element => {
|
this.itemList.push({
|
itemName: element.itemName,
|
inOrderCode: element.inOrderCode,
|
itemNum: element.maxNum
|
});
|
});
|
// this.storgage(this.storagelist);
|
}
|
},
|
watch: {
|
chooselist: {
|
handler(nvl, ovl) {
|
this.storgage(nvl);
|
},
|
deep: true
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.enterEdit {
|
width: 98%;
|
padding: 1%;
|
.edter-height {
|
height: 220px;
|
}
|
.enter-tebleheight {
|
height: calc(100% - 240px);
|
}
|
.show-pwd {
|
position: absolute;
|
right: 10px;
|
top: 3px;
|
font-size: 16px;
|
color: #889aa4;
|
cursor: pointer;
|
user-select: none;
|
}
|
.centent-form {
|
height: 92%;
|
width: 100%;
|
margin: auto;
|
}
|
.enterEdit-button {
|
}
|
::v-deep .el-form-item__content {
|
width: 60%;
|
}
|
::v-deep .el-select {
|
// width: 100%;
|
}
|
}
|
</style>
|