Brak opisu

work-assign.js 3.8KB

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