Нет описания

work-assign.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. mui.init({
  2. swipeBack: false,
  3. })
  4. mui.ready(function() {
  5. var urlParams = new URLSearchParams(window.location.search);
  6. var param1 = urlParams.get('name');
  7. var param2 = urlParams.get('classImport');
  8. var wv = {
  9. name: param1,
  10. classImport: classImport,
  11. }//plus.webview.currentWebview();
  12. var token = localStorage.getItem("token");
  13. var classImport = wv.classImport;
  14. var isdeals = wv.name;
  15. //交办单位
  16. var dwList = [];
  17. $.ajax({
  18. type: "get",
  19. url: huayi.config.callcenter_url + 'Department/GetCusAreaList',
  20. async: false,
  21. data: {
  22. pid:1,
  23. F_Layer: 1,
  24. token: token
  25. },
  26. dataType: 'json',
  27. success: function(data) {
  28. res = data.data;
  29. if(res && res.length > -1) {
  30. res.forEach(function(v, i) {
  31. var obj = {};
  32. obj.value = v.F_DeptId;
  33. obj.text = v.F_DeptName;
  34. dwList.push(obj);
  35. });
  36. }
  37. }
  38. });
  39. //接收人员
  40. function getReceiveUser() {
  41. renyuan = []
  42. if ($("#DWResult").val()!="") {
  43. $.ajax({
  44. url: huayi.config.callcenter_url + 'UserAccount/GetList',
  45. type: 'get',
  46. data: {
  47. dptid: $('#DWResult').attr('data-index'),
  48. type: 1,
  49. token: token
  50. },
  51. dataType: "json",
  52. async: true,
  53. success: function(res) {
  54. res = res.rows;
  55. if(res && res.length > -1) {
  56. res.forEach(function(v, i) {
  57. var obj = {};
  58. obj.value = v.F_UserId;
  59. obj.text = v.F_RoleName+"-"+v.F_UserName;
  60. renyuan.push(obj);
  61. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  62. });
  63. cityPicker5.setData(renyuan);
  64. }
  65. },
  66. });
  67. }else{
  68. cityPicker5.setData(renyuan);
  69. }
  70. }
  71. (function($, doc) {
  72. $.ready(function() {
  73. //交办单位
  74. var ZTiPickers = new $.PopPicker({
  75. layer: 1
  76. });
  77. ZTiPickers.setData(dwList);
  78. var ZXs = doc.getElementById('DW');
  79. var ZXResults = doc.getElementById('DWResult');
  80. ZXs.addEventListener('tap', function(event) {
  81. ZTiPickers.show(function(items) {
  82. ZXResults.value = items[0].text;
  83. ZXResults.setAttribute("data-index", items[0].value);
  84. });
  85. }, false);
  86. // 接收人员
  87. cityPicker5 = new $.PopPicker();
  88. var showCityPickerButton5 = doc.getElementById('showCityPicker5');
  89. var cityResult5 = doc.getElementById('ower_recive');
  90. showCityPickerButton5.addEventListener('tap', function(event) {
  91. getReceiveUser();
  92. cityPicker5.show(function(items) {
  93. if (items[0].text!=undefined) {
  94. cityResult5.value = items[0].text;
  95. cityResult5.setAttribute("data-index", items[0].value);
  96. }
  97. //返回 false 可以阻止选择框的关闭
  98. //return false;
  99. });
  100. }, false);
  101. })
  102. })(mui, document);
  103. //提交按钮
  104. $('.submit').on('tap', function() {
  105. var DWResult = $("#DWResult").val();
  106. var ower_recive = $("#ower_recive").val();
  107. if(!DWResult) {
  108. plus.nativeUI.toast('请选择部门');
  109. } else if(!ower_recive) {
  110. plus.nativeUI.toast('请选择提交人');
  111. } else {
  112. var btnArray = ['取消', '确定'];
  113. mui.confirm('是否提交工单', '提示', btnArray, function(e) {
  114. if(e.index == 1) {
  115. mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/Submission', {
  116. data: {
  117. id: isdeals,
  118. clid: $("#ower_recive").attr('data-index'), //单位
  119. cont:"",
  120. type:1,
  121. token: token
  122. },
  123. dataType: 'json', //服务器返回json格式数据
  124. type: 'post', //HTTP请求类型
  125. timeout: 10000, //超时时间设置为10秒;
  126. success: function(data) {
  127. plus.nativeUI.toast('成功');
  128. $("#ower_recive").val('');
  129. $("#DWResult").val('');
  130. if (classImport) {
  131. if (classImport==2) {
  132. var wobj = plus.webview.getWebviewById("Work-listCJ");
  133. }else{
  134. var wobj = plus.webview.getWebviewById("Work-listClass");
  135. }
  136. }else{
  137. var wobj = plus.webview.getWebviewById("Work-list");
  138. }
  139. wobj.reload(true);
  140. },
  141. error: function(xhr, type, errorThrown) {
  142. plus.nativeUI.toast('失败');
  143. }
  144. });
  145. } else {
  146. plus.nativeUI.toast('取消申请');
  147. }
  148. })
  149. }
  150. })
  151. });