説明なし

overTimeReasons.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * 提交超时原因
  3. * */
  4. $(function() {
  5. autosize($('textarea'));
  6. $('#pro_save').on('click', saveOverTimeReasons);
  7. });
  8. //提交
  9. function saveOverTimeReasons() {
  10. if(!$.trim($("#timeoutreason").val())) {
  11. layer.confirm('请输入原因', {
  12. icon: 2,
  13. btn: ['确定'] //按钮
  14. });
  15. return;
  16. }
  17. var id = helper.request.queryString('edit_id');
  18. var loadIndex;
  19. $.ajax({
  20. type: 'post',
  21. url: huayi.config.callcenter_url + "equipmentapi/api/WoTimeOut/upreason",
  22. dataType: 'json',
  23. async: true,
  24. beforeSend: function() { //触发ajax请求开始时执行
  25. $('#pro_save').attr("disabled", true);
  26. $('#pro_save').text('提交中...');
  27. loadIndex = layer.load();
  28. },
  29. data: {
  30. id: id, // 是 string id
  31. timeoutreason: $('#timeoutreason').val(), // 是 string 超时原因
  32. istimeout: $('#istimeout').find('input[name="istimeoutRadios"]:checked').val(), // 是 int 主管确认是否超时 0未确认,1超时,2不超时
  33. },
  34. success: function(data) {
  35. layer.close(loadIndex);
  36. if(data.state == "success") {
  37. var index = parent.layer.getFrameIndex(window.name);
  38. parent.layer.close(index);
  39. parent.$('#table_all').bootstrapTable('refresh');
  40. parent.layer.msg("提交成功");
  41. } else {
  42. $('#pro_save').attr("disabled", false);
  43. $('#pro_save').text('提交');
  44. }
  45. },
  46. error: function(textStatus) {
  47. layer.close(loadIndex);
  48. layer.confirm('网络繁忙,请稍后再试...', {
  49. closeBtn: 0,
  50. btn: ['确定'] //按钮
  51. });
  52. $('#pro_save').attr("disabled", false);
  53. $('#pro_save').text('提交');
  54. },
  55. complete: function(XMLHttpRequest, textStatus) {
  56. layer.close(loadIndex);
  57. if(textStatus == 'timeout') {
  58. var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
  59. xmlhttp.abort();
  60. layer.confirm('网络超时,请稍后再试...', {
  61. closeBtn: 0,
  62. btn: ['确定'] //按钮
  63. });    
  64. }
  65. $('#pro_save').attr("disabled", false);
  66. $('#pro_save').text('提交');
  67. },
  68. });
  69. }