Няма описание

WorkOrderTransfer.js 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. var id = helper.request.queryString("id");
  2. var type = helper.request.queryString("type");
  3. $(document).ready(function () {
  4. if (type === "1") {
  5. // 获取部门
  6. getDepartment($("#customer_department"));
  7. // 获取提交人
  8. $('#customer_department').on('change',function(){
  9. getManager($('#customer_submitter'));
  10. });
  11. //修改文本
  12. $(".submitterTitle").text("提交人:");
  13. $(".contentTitle").text("提交内容:")
  14. } else if (type === "2"){
  15. getSalesman($('#customer_submitter'));
  16. $(".comaddressTitle").hide();
  17. $(".comaddressSelect").hide();
  18. //修改文本
  19. $(".submitterTitle").text("指派人:");
  20. $(".contentTitle").text("指派内容:")
  21. }
  22. //保存
  23. $('.customerSubmit').click(function() {
  24. saveCustomer();
  25. });
  26. })
  27. //办事处 提交人
  28. function getDepartment(obj) {
  29. obj.empty();
  30. obj.append('<option selected="selected" value="">请选择</option>');
  31. $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
  32. "token": $.cookie("token"),
  33. pid: 1,
  34. F_Layer: 1,
  35. }, function (data) {
  36. if (data.state.toLowerCase() == "success") {
  37. var content = data.data;
  38. $(content).each(function (i, n) {
  39. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  40. })
  41. }
  42. })
  43. }
  44. //部门
  45. //function getDepartment(obj) {
  46. // obj.empty();
  47. // obj.append('<option selected="selected" value="">请选择</option>');
  48. // $.getJSON(huayi.config.callcenter_url + "Department/GetSubordinate", {
  49. // "token": $.cookie("token"),
  50. // }, function (data) {
  51. // if (data.state.toLowerCase() == "success") {
  52. // var content = data.data[0].children;
  53. // $(content).each(function (i, n) {
  54. // $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  55. // })
  56. // }
  57. // })
  58. //}
  59. //业务员
  60. function getSalesman(obj) {
  61. obj.empty();
  62. obj.append('<option selected="selected" value="" deptId="">请选择</option>');
  63. $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
  64. "token": $.cookie("token"),
  65. type: 2,
  66. dptid: $("#customer_department").val(),
  67. }, function (data) {
  68. var content = data.rows;
  69. $(content).each(function (i, n) {
  70. $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_UserName + "</option>").appendTo(obj);
  71. })
  72. })
  73. }
  74. //获取经理
  75. function getManager(obj) {
  76. obj.empty();
  77. obj.append('<option selected="selected" value="" deptId="">请选择</option>');
  78. $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
  79. "token": $.cookie("token"),
  80. type: 1,
  81. dptid: $("#customer_department").val(),
  82. }, function (data) {
  83. var content = data.rows;
  84. $(content).each(function (i, n) {
  85. $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_UserName + "</option>").appendTo(obj);
  86. })
  87. })
  88. }
  89. // 获取提交人
  90. //$('#customer_department').on('change',function(){
  91. // if (type === "1") {
  92. // getManager($('#customer_submitter'));
  93. // } else if (type === "2") {
  94. // getSalesman($('#customer_submitter'));
  95. // }
  96. //});
  97. //保存
  98. function saveCustomer() {
  99. $.ajax({
  100. type: "post",
  101. url: huayi.config.callcenter_url + "WorkOrder/Submission",
  102. dataType: 'json',
  103. async: true,
  104. beforeSend: function() { //触发ajax请求开始时执行
  105. $('.customerSubmit').attr("disabled", true);
  106. $('.customerSubmit').text('保存中...');
  107. },
  108. data: {
  109. token: $.cookie("token"),
  110. id: id,
  111. cont: $('#cont').val(), //提交内容
  112. clid: $('#customer_submitter').val(), // 提交人
  113. type: type,
  114. },
  115. success: function(data) {
  116. if (data.state.toLowerCase() == 'success') {
  117. $('.customerSubmit').attr("disabled", false);
  118. $('.customerSubmit').text('确定');
  119. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  120. parent.layer.close(index); //再执行关闭
  121. parent.layer.msg("保存成功!");
  122. // parent.$('#workorderlist').bootstrapTable('refresh');
  123. parent.initTable();
  124. } else {
  125. $('.customerSubmit').attr("disabled", false);
  126. $('.customerSubmit').text('确定');
  127. }
  128. }
  129. });
  130. }