成品组合件
This commit is contained in:
parent
3aa3bec7de
commit
9f5aa25aca
|
@ -62,10 +62,32 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="12" :sm="24">
|
<el-col :md="12" :sm="24">
|
||||||
<el-form-item label="组合件" prop="is_assemb">
|
<el-form-item label="组合件" prop="is_assemb">
|
||||||
<el-switch v-model="form.is_assemb" />
|
<el-switch v-model="form.is_assemb"/>
|
||||||
|
<el-button v-if="form.is_assemb" type="primary" icon="el-icon-plus" style="margin-left: 20px;" @click="addComponent"></el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row v-if="form.is_assemb">
|
||||||
|
<template v-for="(item,$index) in componentList" :key="item.id">
|
||||||
|
<el-col :md="11" :sm="24">
|
||||||
|
<el-form-item label="物料名称">
|
||||||
|
<el-select v-model="item.id" placeholder="物料名称" clearable style="width:100%">
|
||||||
|
<el-option v-for="item in materialOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="11" :sm="24">
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number v-model="item.count" controls-position="right" placeholder="数量" clearable style="width:100%"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="2">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<el-icon class="deleteIcons" @click="delComponent($index)"><CircleCloseFilled /></el-icon>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-main>
|
</el-main>
|
||||||
<el-footer>
|
<el-footer>
|
||||||
|
@ -110,6 +132,9 @@ export default {
|
||||||
materialOptions: [],
|
materialOptions: [],
|
||||||
setFiltersVisible: false,
|
setFiltersVisible: false,
|
||||||
processOptions: [],
|
processOptions: [],
|
||||||
|
componentList:[
|
||||||
|
{id:'',count:1}
|
||||||
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -146,6 +171,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.isSaveing = true;
|
this.isSaveing = true;
|
||||||
this.form.brothers = this.brothers;
|
this.form.brothers = this.brothers;
|
||||||
|
if(this.form.is_assemb){
|
||||||
|
let obj = {};
|
||||||
|
this.componentList.forEach(item=>{
|
||||||
|
obj[item.id] = item.count;
|
||||||
|
})
|
||||||
|
this.form.components = obj;
|
||||||
|
}
|
||||||
if (this.mode == "add") {
|
if (this.mode == "add") {
|
||||||
this.$API.mtm.material.create.req(this.form).then(res => {
|
this.$API.mtm.material.create.req(this.form).then(res => {
|
||||||
this.isSaveing = false;
|
this.isSaveing = false;
|
||||||
|
@ -173,8 +205,26 @@ export default {
|
||||||
setData(data) {
|
setData(data) {
|
||||||
Object.assign(this.form, data);
|
Object.assign(this.form, data);
|
||||||
this.brothers = data.brothers;
|
this.brothers = data.brothers;
|
||||||
|
let arr = [];
|
||||||
|
for(let key in data.components){
|
||||||
|
let obj = {};
|
||||||
|
obj.id=key;
|
||||||
|
obj.count = data.components[key]
|
||||||
|
arr.push(obj)
|
||||||
|
}
|
||||||
|
this.componentList = arr;
|
||||||
this.getMaterial(data.type)
|
this.getMaterial(data.type)
|
||||||
},
|
},
|
||||||
|
addComponent(){
|
||||||
|
let obj = {};
|
||||||
|
obj.id='';
|
||||||
|
obj.count = 1;
|
||||||
|
this.componentList.push(obj)
|
||||||
|
},
|
||||||
|
delComponent(index){
|
||||||
|
this.componentList.splice(index,1);
|
||||||
|
console.log('this.componentList:',this.componentList);
|
||||||
|
},
|
||||||
//设置过滤项
|
//设置过滤项
|
||||||
setFilters(filters) {
|
setFilters(filters) {
|
||||||
this.selectionFilters = filters;
|
this.selectionFilters = filters;
|
||||||
|
@ -183,4 +233,11 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style></style>
|
<style>
|
||||||
|
.deleteIcons{
|
||||||
|
color: #f56c6c;
|
||||||
|
font-size: 25px;
|
||||||
|
line-height: 34px;
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -195,7 +195,7 @@
|
||||||
},
|
},
|
||||||
option2: {
|
option2: {
|
||||||
title: {
|
title: {
|
||||||
text: '预制棒(10车间)',
|
text: '预制管(10车间)',
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: '80px'
|
top: '80px'
|
||||||
|
|
Loading…
Reference in New Issue