//删除 多/单条数据
functiondel(cid){var id=‘‘;if(cid==‘-1‘){if(getSelections().length > 0){
id=getSelections();
}else{
$.messager.alert("提示", "请选择要删除的行", "error");return;
}
}else{
id=cid;
}var arr =id.split(":");//分割选中的特卫ID
for(var i = 0; i < arr.length; i++){var delOrder =isConfirmOrder(arr[i]);
}
}functionisConfirmOrder(id){
parent.window.$("#loadingImg").css("display","");
$.ajax({
url :‘/LiveManager/sg/delSpecialguardInfo‘,//②后台url
data : {‘ids‘:id,"queryOrder":2},//①向后台传入id参数和queryOrder参数(查询是否有预约)
type : ‘POST‘,
dataType :‘json‘,
async:true,
success :function(data) {var confirmDelOrder = "0";//console.info("data",data);
if(data.isOrder == 0){//十三:没有预约直接删除,刷新
parent.window.$("#loadingImg").css("display","none");
$(‘#tt‘).datagrid(‘reload‘);
clearSelections();return;
}if(data.isOrder == 1){//⑦证明有预约的特位要被删除
//⑧提示是否确认删除
$.messager.confirm("提示",data.name + "有预约未完成,确认删除?", function(r) {if(r) {
parent.window.$("#loadingImg").css("display","");
$.ajax({
url :‘/LiveManager/sg/delSpecialguardInfo‘,
data : {‘ids‘:id,"queryOrder":1},//⑨再次调删除的url,传参数id和queryOrder
type : ‘POST‘,
dataType :‘json‘,
success :function() {
parent.window.$("#loadingImg").css("display","none");
$(‘#tt‘).datagrid(‘reload‘);
clearSelections();
$.messager.alert("提示", "操作成功", "success");
}
});
}
});
}
parent.window.$("#loadingImg").css("display","none");
$(‘#tt‘).datagrid(‘reload‘);
clearSelections();
}
});
}