var id = helper.request.queryString("id"); $(document).ready(function () { //保存 $('.customerSubmit').click(function() { saveCustomer(); }); //重要级别 getDealTimely(); //重要级别原因 getReason(); }) // 重要级别 function getDealTimely() { $.ajax({ type: "get", url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", dataType: 'json', async: true, data: { token: $.cookie("token"), flag: "GDDJ" }, success: function(data) { var Count = data.data; $(Count).each(function(i, n) { $('').appendTo($("#dealTimely")); }) } }); } // 重要级别原因 function getReason() { $.ajax({ type: "get", url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", dataType: 'json', async: true, data: { token: $.cookie("token"), flag: "YJYY" }, success: function(data) { var Count = data.data; $(Count).each(function(i, n) { $('').appendTo($("#reason")); }) } }); } // 重要级别为一级时显示原因 $('#dealTimely').on('change',function(){ console.log('1111',$('#dealTimely').val()); if ($('#dealTimely').val() !== '506'){ $('#reason').val(''); $('#reason').attr("disabled", "disabled"); } else { $('#reason').removeAttr("disabled"); } }) //保存 function saveCustomer() { $.ajax({ type: "post", url: huayi.config.callcenter_url + "WorkOrder/Sing", dataType: 'json', async: true, beforeSend: function() { //触发ajax请求开始时执行 $('.customerSubmit').attr("disabled", true); $('.customerSubmit').text('确定中...'); }, data: { token: $.cookie("token"), id: id, dealTimely: $('#dealTimely').val(), //重要级别内容 reason: $('#reason').val(), //重要级别原因 }, success: function(data) { if (data.state.toLowerCase() == 'success') { $('.customerSubmit').attr("disabled", false); $('.customerSubmit').text('确定'); var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭 parent.layer.msg("保存成功!"); // parent.$('#workorderlist').bootstrapTable('refresh'); // parent.$('#workorderlist_').bootstrapTable('refresh'); // parent.$('#orderlist').bootstrapTable('refresh'); parent.initTable(); } else { $('.customerSubmit').attr("disabled", false); $('.customerSubmit').text('确定'); } } }); }