<el-dialog title="配件更换" :visible.sync="dialogFormVisible" width="86%">
<div class="bad">
<div class="bad-item">
<!-- <div>
<h3>序号</h3>
</div> -->
<div>
<h3>部件名称</h3>
</div>
<div>
<h3>配件型号</h3>
</div>
<div>
<h3>更换原因</h3>
</div>
<div>
<h3>数量</h3>
</div>
</div>
<div class="bad-item list" v-for="(item,index) in badData" :key="index">
<!-- <div>
<el-input :disabled="item.id?true:false" v-model="item.index" size="small"></el-input>
</div> -->
<div>
<el-select v-model="item.fDevicePartId" placeholder="请选择" filterable @change="choosePartModel"
@focus="elDatePickerOnFocus">
<el-option v-for="(item, index) in GetDevicepartsList" :key="item.fid" :label="item.fName"
:value="item.fid">
</el-option>
</el-select>
</div>
<div>
<el-input style="width:100%" v-model="item.fPartModel" disabled size="small" placeholder="配件型号">
</el-input>
</div>
<div>
<el-input style="width:100%" v-model="item.fReplaceReason" size="small" placeholder="请输入更换原因">
</el-input>
</div>
<div style="display:flex; align-items: center;">
<el-input style="width:90%" v-model="item.fQty" size="small" placeholder="请输入" type="number"
oninput="if(value.length > 8) value = value.slice(0,8)"></el-input>
<i @click="badFocus(item)" style="margin-right: 15px;" class="el-icon-plus"></i>
<i @click="deleteBad(item,i)" :class="badData.length==1?'forbid':''" class="el-icon-delete"></i>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="changePartsOK()">确定</el-button>
</div>
</el-dialog>
--------------------------
//追加
badFocus(item) {
//最后一个,自动下一个
let obj = {
"fid": "",
"fEntryId": "",
"fDevicePartId": "",
"fDevicePartName": "",
"fPartModel": "",
"fQty": '',
"fReplaceReason": "",
"fModel": "",
sortNum: parseInt(item.sortNum + 1),
index: parseInt(item.index + 1),
};
this.badData.push(obj);
},
//删除
deleteBad(item, index) {
this.badData.splice(index, 1);
},