<div class="div-card" >
<template>
<el-table :data="proGroupTable[indexes].modelPropertyItemBOList" border stripe style="width: 100%;" >
<el-table-column prop="id" label="id" align="center"v-show="false">
</el-table-column>
<el-table-column prop="propertySequence" label="顺序" align="center">
<template slot-scope="scope">
<span v-if="paramEditFlag[indexes]==false">{{scope.row.propertySequence}}</span>
<el-input v-else-if="paramEditFlag[indexes]==true || scope.row.propertySequence" v-model="scope.row.propertySequence"></el-input>
</template>
</el-table-column>
<el-table-column prop="propertyName" label="属性名" align="center">
<template slot-scope="scope" >
<span v-if="paramEditFlag[indexes]==false">{{scope.row.propertyName}}</span>
<el-input v-else-if="paramEditFlag[indexes]==true || scope.row.propertyName" v-model="scope.row.propertyName"></el-input>
</template>
</el-table-column>
<el-table-column prop="propertyQualifier" label="标识符" align="center">
<template slot-scope="scope">
<span v-if="paramEditFlag[indexes]==false">{{scope.row.propertyQualifier}}</span>
<el-input v-else-if="paramEditFlag[indexes]==true || scope.row.propertyQualifier" v-model="scope.row.propertyQualifier"></el-input>
</template>
</el-table-column>
<el-table-column prop="propertyType" label="参数类型" align="center">
<template slot-scope="scope">
<span v-if="paramEditFlag[indexes]==false">{{scope.row.propertyType}}</span>
<el-input v-else-if="paramEditFlag[indexes]==true || scope.row.propertyType" v-model="scope.row.propertyType"></el-input>
</template>
</el-table-column>
<el-table-column prop="accuracy" label="精度" align="center">
<template slot-scope="scope">
<span v-if="paramEditFlag[indexes]==false">{{scope.row.accuracy}}</span>
<el-input v-else-if="paramEditFlag[indexes]==true || scope.row.accuracy" v-model="scope.row.accuracy"></el-input>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" align="center">
<template slot-scope="scope">
<span v-if="paramEditFlag[indexes]==false">{{scope.row.unit}}</span>
<el-input v-else-if="paramEditFlag[indexes]==true || scope.row.unit" v-model="scope.row.unit"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="medium" @click="deleteParam(scope.row,scope.$index,indexes)">
<i class="el-icon-delete" aria-hidden="true"></i>
</el-button>
</template>
</el-table-column>
</el-table>
</template>
</div>
<div style="text-align: center">
<el-button type="text" @click="addParam(indexes)">增加</el-button>
<el-button type="text" @click="saveParam(indexes)">保存</el-button>
<el-button type="text" @click="editParam(indexes)">修改</el-button>
<el-button type="text" @click="delParamGroup(indexes)">删除</el-button>
</div>
addParam(indexes){
Vue.set(this.paramEditFlag,indexes,true)
this.proGroupTable[indexes].modelPropertyItemBOList.push({
edit:true
})
}
editParam(indexes){
Vue.set(this.paramEditFlag,indexes,true)
}
saveParam(indexes) {
Vue.set(this.paramEditFlag,indexes,false)
var modelPropertyItemList= [];
var modelPropertyGroupParam= {};
for (var i=0;i<this.proGroupTable[indexes].modelPropertyItemBOList.length;i++){
var mPro = {};
mPro["id"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].id;
mPro["groupId"]=this.proGroupTable[indexes].id;
mPro["accuracy"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].accuracy;
mPro["propertyName"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].propertyName;
mPro["propertyQualifier"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].propertyQualifier;
mPro["propertyType"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].propertyType;
mPro["propertySequence"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].propertySequence;
mPro["unit"]=this.proGroupTable[indexes].modelPropertyItemBOList[i].unit;
modelPropertyItemList.push(mPro);
}
modelPropertyGroupParam["id"] = this.proGroupTable[indexes].id;
modelPropertyGroupParam["modelId"] =this.proGroupTable[indexes].modelId;
modelPropertyGroupParam["groupName"] =this.proGroupTable[indexes].groupName;
modelPropertyGroupParam["groupQualifier"] =this.proGroupTable[indexes].groupQualifier;
modelPropertyGroupParam["category"] =this.cValue;
modelPropertyGroupParam["modelPropertyItemList"] = modelPropertyItemList;
console.log("---保存属性----")
savePro(modelPropertyGroupParam).then(response =>{
});
},
deleteParam(row,index,indexes) {
this.proGroupTable[indexes].modelPropertyItemBOList.splice(index, 1);
},
delParamGroup(indexes) {
this.$confirm('此操作将永久删除该属性组, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
var groupId = this.proGroupTable[indexes].id;
proDelete(groupId).then(res => {
if (res.success == true) {
this.propertyDetail();
this.$message({
message: '删除成功',
type: 'success'
});
} else {
this.$message({
message: res.errMsg,
type: 'error'
});
}
})
})
},