Brak opisu

work-appoint.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. mui.init({
  2. swipeBack: false,
  3. })
  4. mui.plusReady(function() {
  5. var wv = plus.webview.currentWebview();
  6. var classImport = wv.classImport;
  7. var token = wv.token;
  8. var isdeals = wv.name;
  9. //交办单位
  10. var dwList = [];
  11. $.ajax({
  12. type: "get",
  13. url: huayi.config.callcenter_url + 'UserAccount/GetList',
  14. async: false,
  15. data: {
  16. type: 2,
  17. token: token
  18. },
  19. dataType: 'json',
  20. success: function(data) {
  21. res = data.rows;
  22. if(res && res.length > -1) {
  23. res.forEach(function(v, i) {
  24. var obj = {};
  25. obj.value = v.F_UserId;
  26. obj.text = v.F_UserName;
  27. dwList.push(obj);
  28. });
  29. }
  30. }
  31. });
  32. (function($, doc) {
  33. $.ready(function() {
  34. //交办单位
  35. var ZTiPickers = new $.PopPicker({
  36. layer: 1
  37. });
  38. ZTiPickers.setData(dwList);
  39. var ZXs = doc.getElementById('DW');
  40. var ZXResults = doc.getElementById('DWResult');
  41. ZXs.addEventListener('tap', function(event) {
  42. ZTiPickers.show(function(items) {
  43. ZXResults.value = items[0].text;
  44. ZXResults.setAttribute("data-index", items[0].value);
  45. });
  46. }, false);
  47. })
  48. })(mui, document);
  49. //提交按钮
  50. $('.submit').on('tap', function() {
  51. var DWResult = $("#DWResult").attr('data-index');
  52. if(!DWResult) {
  53. plus.nativeUI.toast('请选择提交人');
  54. } else {
  55. var btnArray = ['取消', '确定'];
  56. mui.confirm('是否提交工单', '提示', btnArray, function(e) {
  57. if(e.index == 1) {
  58. mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/Submission', {
  59. data: {
  60. id: isdeals,
  61. clid: $("#DWResult").attr('data-index'), //单位
  62. type:2,
  63. token: token
  64. },
  65. dataType: 'json', //服务器返回json格式数据
  66. type: 'post', //HTTP请求类型
  67. timeout: 10000, //超时时间设置为10秒;
  68. success: function(data) {
  69. plus.nativeUI.toast('成功');
  70. $("#ower_recive").val('');
  71. if (classImport) {
  72. if (classImport==2) {
  73. var wobj = plus.webview.getWebviewById("Work-listCJ");
  74. }else{
  75. var wobj = plus.webview.getWebviewById("Work-listClass");
  76. }
  77. }else{
  78. var wobj = plus.webview.getWebviewById("Work-list");
  79. }
  80. wobj.reload(true);
  81. },
  82. error: function(xhr, type, errorThrown) {
  83. plus.nativeUI.toast('失败');
  84. }
  85. });
  86. } else {
  87. plus.nativeUI.toast('取消申请');
  88. }
  89. })
  90. }
  91. })
  92. });