element 表格中使用el-switch前弹出提示

<el-table-column label="是否启用">
    <template slot-scope="scope">
           <el-switch v-model="scope.row.enable" @change="upadteEnable($event,scope.row)" active-color="#3C78FF" inactive-color="#C0C4CC"></el-switch>
    </template>
</el-table-column>
/**
 * 启用禁用
 * @param callback 当前操作回调
 * @param row 当前操作行
 */
 upadteEnable(callback, row){
     let text = ''
     if (callback) {//修改启用之前是否确认修改
         text = '启用'
         row.enable = false
     } else {
         text = '禁用'
         row.enable = true
     }
     this.$confirm(`确认${text}该逻辑流程吗`, language.confirm_title, {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         iconClass: 'icon-warning',
         customClass:'custom-message-box'
      }).then(async () => {
         let body = {
             groupName : row.groupName,
             description : row.description,
             pageList :  row.pageList,
             isAutoPlay : row.isAutoPlay
         }
        // axios.put(`/api/groups/${row.id}?t=${Date.now()}`, body).then(res => {
        //     if (res.data.response) {
        //         this.successTip(language.operate_success);
        //     } else {
        //         this.failTip(language.operate_fail);
        //     }
        //     this.loading = false;
        // }).catch(e => {
        //     console.log(e);
        //     this.loading = false;
        //     if(e.data && e.data.errorInfo) {
        //         this.failTip(e.data.errorInfo);
        //     } else {
        //         this.failTip(language.error_500);
        //     }
        // });
      })
 },

猜你喜欢

转载自blog.csdn.net/yxgd_1442962728/article/details/115407262
今日推荐