Merge branch 'v2' of https://e.coding.net/ctcdevteam/ehs/ehs_web into v2
This commit is contained in:
commit
5538f8354c
|
@ -67,28 +67,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-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">
|
<el-row v-if="form.is_assemb">
|
||||||
<template v-for="(item,$index) in componentList" :key="item.id">
|
<template v-for="(item, $index) in componentList" :key="item.id">
|
||||||
<el-col :md="11" :sm="24">
|
<el-col :md="11" :sm="24">
|
||||||
<el-form-item label="物料名称">
|
<el-form-item label="物料名称">
|
||||||
<el-select v-model="item.id" placeholder="物料名称" clearable style="width:100%">
|
<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-option v-for="item in materialOptions" :key="item.id" :label="item.full_name" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="11" :sm="24">
|
<el-col :md="11" :sm="24">
|
||||||
<el-form-item label="数量">
|
<el-form-item label="数量">
|
||||||
<el-input-number v-model="item.count" controls-position="right" placeholder="数量" clearable style="width:100%"></el-input-number>
|
<el-input-number v-model="item.count" controls-position="right" placeholder="数量" clearable
|
||||||
|
style="width:100%"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="2">
|
<el-col :md="2">
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<el-icon class="deleteIcons" @click="delComponent($index)"><CircleCloseFilled /></el-icon>
|
<el-icon class="deleteIcons" @click="delComponent($index)">
|
||||||
|
<CircleCloseFilled />
|
||||||
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
|
@ -138,8 +142,8 @@ export default {
|
||||||
materialOptions: [],
|
materialOptions: [],
|
||||||
setFiltersVisible: false,
|
setFiltersVisible: false,
|
||||||
processOptions: [],
|
processOptions: [],
|
||||||
componentList:[
|
componentList: [
|
||||||
{id:'',count:1}
|
{ id: '', count: 1 }
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -166,8 +170,8 @@ export default {
|
||||||
query.is_hidden = false;
|
query.is_hidden = false;
|
||||||
this.$API.mtm.material.list.req(query).then(res => {
|
this.$API.mtm.material.list.req(query).then(res => {
|
||||||
that.materialOptions = [];
|
that.materialOptions = [];
|
||||||
res.forEach(item=>{
|
res.forEach(item => {
|
||||||
item.label = item.name+'—'+item.specification+'/'+item.model;
|
item.label = item.name + '—' + item.specification + '/' + item.model;
|
||||||
})
|
})
|
||||||
that.materialOptions = res;
|
that.materialOptions = res;
|
||||||
})
|
})
|
||||||
|
@ -181,9 +185,9 @@ 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){
|
if (this.form.is_assemb) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
this.componentList.forEach(item=>{
|
this.componentList.forEach(item => {
|
||||||
obj[item.id] = item.count;
|
obj[item.id] = item.count;
|
||||||
})
|
})
|
||||||
this.form.components = obj;
|
this.form.components = obj;
|
||||||
|
@ -216,24 +220,24 @@ export default {
|
||||||
Object.assign(this.form, data);
|
Object.assign(this.form, data);
|
||||||
this.brothers = data.brothers;
|
this.brothers = data.brothers;
|
||||||
let arr = [];
|
let arr = [];
|
||||||
for(let key in data.components){
|
for (let key in data.components) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.id=key;
|
obj.id = key;
|
||||||
obj.count = data.components[key]
|
obj.count = data.components[key]
|
||||||
arr.push(obj)
|
arr.push(obj)
|
||||||
}
|
}
|
||||||
this.componentList = arr;
|
this.componentList = arr;
|
||||||
this.getMaterial(data.type)
|
this.getMaterial(data.type)
|
||||||
},
|
},
|
||||||
addComponent(){
|
addComponent() {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.id='';
|
obj.id = '';
|
||||||
obj.count = 1;
|
obj.count = 1;
|
||||||
this.componentList.push(obj)
|
this.componentList.push(obj)
|
||||||
},
|
},
|
||||||
delComponent(index){
|
delComponent(index) {
|
||||||
this.componentList.splice(index,1);
|
this.componentList.splice(index, 1);
|
||||||
console.log('this.componentList:',this.componentList);
|
console.log('this.componentList:', this.componentList);
|
||||||
},
|
},
|
||||||
//设置过滤项
|
//设置过滤项
|
||||||
setFilters(filters) {
|
setFilters(filters) {
|
||||||
|
@ -244,10 +248,9 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.deleteIcons{
|
.deleteIcons {
|
||||||
color: #f56c6c;
|
color: #f56c6c;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
height: 34px;
|
height: 34px;
|
||||||
}
|
}</style>
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue