/**
* 监听开关 状态 操作*/form.on('switch(switchTest)', function (data) {/**
* 禁用标签
* 状态 赋值为 1*/
var layerIndex = layer.load(3);if ((this.checked ? 'true' : 'false') == 'false') {
$.ajax({
url:'/users/delete',
data: {
state:1,
userId: data.elem.getAttribute("switchId")
},
type:'PUT', //HTTP请求类型
success: function (data) {
console.log(data);
$.message({
message:"禁用用户",
type:'success',
showClose:true});
}, error: function () {
$.message({
message:"boom..",
type:'error',
showClose:true});
}
})
}else{/**
* 启动标签
* 状态 赋值为 0*/$.ajax({
url:'/users/delete',
data: {
state:0,
userId: data.elem.getAttribute("switchId")
},
type:'PUT',
success: function (data) {
console.log(data);
$.message({
message:"启动用户",
type:'success',
showClose:true});
}, error: function () {
$.message({
message:"boom..",
type:'error',
showClose:true});
}
})
}
layer.close(layerIndex);
});