element tree 更新节点信息

操作步骤:

1、点击打开操作节点--------重点:node一定要存一手,没他办不了事

this.showUpdateLd = true; //显示操作模态框
this.handleNode = node;   //当前操作的节点对象
//具体业务逻辑

 

2、使用VUE 提供的$set()方法 

   this.$set(this.handleNode.data,    'label',   this.updateLdForm.lph+this.updateLdForm.lmc)
       param1:当前操作对象
       param2:要更新字段名称
       param3:要更新的内容

this.$refs.updateLdForm.validate((valid) => {
    if (valid) {
        let url = `${BaseUrl}/fwfzxx/gxLdxx`;
        let data = {
            ldid:this.updateLdForm.lphId,
            ldmc:this.updateLdForm.lph, 
            ldbm:this.updateLdForm.lmc,
        }
        this.$post(url,data).then(res => {
            // console.log('楼栋信息更新失败   res=',res)
            if(res.code==200){
                this.showUpdateLd = false;
                this.$notify({type:'success',showClose:false,message:'楼栋信息更新成功'})
                this.$set(this.handleNode.data, 'label',this.updateLdForm.lph+this.updateLdForm.lmc)
            }else{
                this.$notify({type:'warning',showClose:false,message:'楼栋信息更新失败,请重新操作!'})
                console.log('楼栋信息更新失败   res=',res)
            }
        })
    }
})

猜你喜欢

转载自blog.csdn.net/qq_42715494/article/details/113757323