优化取消补链提示

master
chenzhi 5 years ago
parent 93c3c13017
commit 81e56063c7

@ -132,9 +132,9 @@ class MendController extends ThinkController {
$id = I('id'); $id = I('id');
$status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]); $status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]);
if ($status) { if ($status) {
$this->success('取消补链成功', U('lists'), 2); $this->ajaxReturn(array("status"=>1,"url"=> U('lists')));
} else { } else {
$this->error("取消失败,或补链已生效",U('lists')); $this->ajaxReturn(array("status"=>0,"url"=> U('lists')));
} }
} }
} }

@ -130,6 +130,7 @@
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css"> <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script> <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script> <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
var start = $("#bind_time").val(); var start = $("#bind_time").val();
@ -151,8 +152,25 @@ Think.setValue("prmoote_id_to", {$data.promote_id|default = "''"});
$('#submit').click(function(){ $('#submit').click(function(){
//获取id //获取id
var taskid = $(this).data("id"); var taskid = $(this).data("id");
$.ajax({
window.location.href = "{:U('Mend/cancelShift')}"+"&id="+taskid; type:"get",
dataType:"json",
url:"{:U('Mend/cancelShift')}"+"&id="+taskid,
success:function(data){
if(data.status == 1){
layer.msg('取消补链成功',function(){
window.location.href = data.url;
});
}else{
layer.msg('取消补链失败,或补链已经生效无法取消')
}
},
error:function(){
layer.msg('网络错误');
}
})
// window.location.href = "{:U('Mend/cancelShift')}"+"&id="+taskid;
}); });
$(function(){ $(function(){
$('.time').datetimepicker({ $('.time').datetimepicker({

Loading…
Cancel
Save