欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

vue+ele启用停用

程序员文章站 2022-05-30 22:38:41
...
	//停用/启用
			change_status(row,index) {
        let _this=this;
        console.log(row);
        let obj={};
        if(row.status==0){
           obj={
            uid:1,
            id:row.id,
            project_id:row.project_id,
            title:row.title,
            logo:row.logo,
            content:row.content,
            status:1,
            ntype:row.ntype,
            ptype:row.ptype,
          };
           postFormAPI(obj, "/web_notice/addnotice").then(res => {
            if (res.data.code === 1) {
              this.tableData[index].status=1;
              this.flag=1;
              console.log("status=1");
            } else {
              _this.$message.error(res.data.data.info.detail);
            }
            }).catch(error => {
              alert(error)
              _this.$message.error(error);
          });
        }else{
           obj={
            uid:1,
            id:row.id,
            project_id:row.project_id,
            title:row.title,
            logo:row.logo,
            content:row.content,
            status:0,
            ntype:row.ntype,
            ptype:row.ptype,
          };
           postFormAPI(obj, "/web_notice/addnotice").then(res => {
            if (res.data.code === 1) {
              this.tableData[index].status=0;
              this.flag=1;
              console.log("status=0");
            } else {
              _this.$message.error(res.data.data.info.detail);
            }
            }).catch(error => {
              alert(error)
              _this.$message.error(error);
          });
        }
       
         
        
         
      },