代码如下:
角色关联
新增节点
{{scope.row.nodeName}}
{{scope.row.userId}}
{{scope.row.userName}}
{{scope.row.remark}}
修改
保存
删除
上移
下移
add(){
let length=this.relNodeList.length
if(length>0&&this.relNodeList[length-1].edit){
this.$message.info('请先保存上一条')
return false
}
var list = {
nodeId:'',
nodeName:'',
userId: '',
userName:'',
remark:'',
edit:true
};
this.relNodeList.push(list)
},
//修改
handleEdit(scope){
scope.row.edit=true;
},
//保存
handleSaveRow(scope){
if(scope.row.nodeName==''){
this.$message.error('请输入结点名称')
return false
}
if(scope.row.userId==''){
this.$message.error('请输入关联账号')
return false
}
if(scope.row.userName==''){
this.$message.error('请输入关联账号姓名')
return false
}
scope.row.edit=false;
},
///删除
handleDelRow(scope){
this.$confirm('确定删除吗', '提示').then(() => {
this.relNodeList.splice(scope.$index,1);
})
},
moveUp(index){
if (index > 0) {
let upDate = this.relNodeList[index - 1];
this.relNodeList.splice(index - 1, 1);
this.relNodeList.splice(index, 0, upDate);
} else {
this.$message.error('已经是第一条,不可上移');
}
},
moveDown(index){
if (index + 1 === this.relNodeList.length) {
this.$message.error('已经是最后一条,不可下移');
} else {
let downDate = this.relNodeList[index + 1];
this.relNodeList.splice(index + 1, 1);
this.relNodeList.splice(index, 0, downDate);
}
},
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)