Nenhuma Descrição

WorkOrderMark.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. var id = helper.request.queryString("id");
  2. $(document).ready(function () {
  3. //获取工单详情
  4. getWorkOrderdetails();
  5. //保存
  6. $('.customerSubmit').click(function() {
  7. saveCustomer();
  8. });
  9. //重要级别
  10. getDealTimely();
  11. //普通工单禁止选择原因
  12. $('#reason').attr("disabled", "disabled");
  13. })
  14. // 重要级别
  15. function getDealTimely() {
  16. $.ajax({
  17. type: "get",
  18. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  19. dataType: 'json',
  20. async: true,
  21. data: {
  22. token: $.cookie("token"),
  23. flag: "GDDJ"
  24. },
  25. success: function(data) {
  26. var Count = data.data;
  27. $(Count).each(function(i, n) {
  28. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#dealTimely"));
  29. })
  30. }
  31. });
  32. }
  33. // 重要级别原因(Ⅰ级)
  34. function getReasonOne() {
  35. $("#reason").empty();
  36. $("#reason").append("<option value='' selected='selected'>请选择</option>");
  37. $.ajax({
  38. type: "get",
  39. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  40. dataType: 'json',
  41. async: true,
  42. data: {
  43. token: $.cookie("token"),
  44. flag: "YJYY"
  45. },
  46. success: function(data) {
  47. var Count = data.data;
  48. $(Count).each(function(i, n) {
  49. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#reason"));
  50. })
  51. }
  52. });
  53. }
  54. // 重要级别原因(Ⅱ级)
  55. function getReasonTwo() {
  56. $("#reason").empty();
  57. $("#reason").append("<option value='' selected='selected'>请选择</option>");
  58. $.ajax({
  59. type: "get",
  60. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  61. dataType: 'json',
  62. async: true,
  63. data: {
  64. token: $.cookie("token"),
  65. flag: "EJYY"
  66. },
  67. success: function(data) {
  68. var Count = data.data;
  69. $(Count).each(function(i, n) {
  70. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#reason"));
  71. })
  72. }
  73. });
  74. }
  75. // 重要级别显示原因
  76. $('#dealTimely').on('change',function(){
  77. if ($('#dealTimely').val() === 'Ⅰ级' || $('#dealTimely').val() === "1类问题"){
  78. $('#reason').val('');
  79. $('#reason').removeAttr("disabled");
  80. getReasonOne();
  81. } else if ($('#dealTimely').val() === 'Ⅱ级' || $('#dealTimely').val() === "2类问题"){
  82. $('#reason').val('');
  83. $('#reason').removeAttr("disabled");
  84. getReasonTwo();
  85. } else {
  86. $('#reason').val('');
  87. $('#reason').attr("disabled", "disabled");
  88. }
  89. })
  90. //获取工单详情
  91. function getWorkOrderdetails() {
  92. $.ajax({
  93. type: "get",
  94. url: huayi.config.callcenter_url + "WorkOrder/GetDetails",
  95. dataType: 'json',
  96. async: true,
  97. cache: false,
  98. data: {
  99. id: id,
  100. token: $.cookie("token")
  101. },
  102. success: function(result) {
  103. if (result.rows.length > 0) {
  104. var data = result.rows[0];
  105. // 重要级别
  106. $("#dealTimely option:selected").text(data.F_DealTimely);
  107. $("#dealTimely option:selected").val(data.F_DealTimely);
  108. // 重要级别原因
  109. $("#reason option:selected").text(data.F_Reason);
  110. $("#reason option:selected").val(data.F_Reason);
  111. }
  112. }
  113. });
  114. }
  115. //保存
  116. function saveCustomer() {
  117. $.ajax({
  118. type: "post",
  119. url: huayi.config.callcenter_url + "WorkOrder/Sing",
  120. dataType: 'json',
  121. async: true,
  122. beforeSend: function() { //触发ajax请求开始时执行
  123. $('.customerSubmit').attr("disabled", true);
  124. $('.customerSubmit').text('确定中...');
  125. },
  126. data: {
  127. token: $.cookie("token"),
  128. id: id,
  129. dealTimely: $('#dealTimely').val(), //重要级别内容
  130. reason: $('#reason').val(), //重要级别原因
  131. },
  132. success: function(data) {
  133. if (data.state.toLowerCase() == 'success') {
  134. $('.customerSubmit').attr("disabled", false);
  135. $('.customerSubmit').text('确定');
  136. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  137. parent.layer.close(index); //再执行关闭
  138. parent.layer.msg("保存成功!");
  139. // parent.$('#workorderlist').bootstrapTable('refresh');
  140. parent.initTable();
  141. } else {
  142. $('.customerSubmit').attr("disabled", false);
  143. $('.customerSubmit').text('确定');
  144. }
  145. }
  146. });
  147. }