No Description

WorkOrderTransfer.js 4.0KB

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