<div v-for="(DTOList, i) in productSpecsSaveDTOList" :key="i">
<el-form :model="DTOList" ref="DTOList" style="margin:20px">
<el-form-item label="规格名" class="noneBorderLeft">
<el-row>
<el-col :span="4">
<el-input v-model="DTOList.specsName" />
</el-col>
<el-col :span="1" :offset="18">
<span><i @click.prevent="removeDTOList(DTOList)" slot="suffix" class="el-input__icon el-icon-error" style="font-size: 20px"></i></span>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="规格值" class="noneBorderLeft">
<el-row :gutter="4">
<el-col :span="4" v-for="(item1, index1) in DTOList.productSpecsValueSaveDTOS" :key="index1" style="display:inline-block">
<el-input v-model="item1.specsValues">
<i @click.prevent="removespecsValues(item1, DTOList, i)" slot="suffix" class="el-input__icon el-icon-close" style="color:black;font-weight:bold;font-size:20px"></i>
</el-input>
</el-col>
<el-col :span="4" >
<el-button type="text" size="small" style="padding:5px" @click="addSpecsValues(DTOList,i)">添加规格值</el-button>
</el-col>
</el-row>
</el-form-item>
</el-form>
</div>
<el-button type="primary" size="small" @click="addList()">添加规格</el-button>
removeDTOList(DTOList) {
var index = this.productSpecsSaveDTOList.indexOf(DTOList)
if (index !== -1) {
this.productSpecsSaveDTOList.splice(index, 1)
}
},
removespecsValues(item1,DTOList,i) {
let index = DTOList.productSpecsValueSaveDTOS.indexOf(item1)
if (index !== -1) {
DTOList.productSpecsValueSaveDTOS.splice(index, 1)
}
},
addList() {
this.productSpecsSaveDTOList.push({
productSpecsValueSaveDTOS:[
{
cost : null,
imgUrl : "",
marketValue : null,
price : null,
specsValues: "",
stock : null,
}
],
specsName : "",
key: Date.now()
})
},
addSpecsValues(DTOList, i) {
DTOList.productSpecsValueSaveDTOS.push({
cost : null,
imgUrl : "",
marketValue : null,
price : null,
stock : null,
specsValues: '',
key: Date.now()
})
},