Нет описания

tj_manage.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. mui.init({
  2. beforeback: function() {    
  3. var list = plus.webview.currentWebview().opener();    
  4. //refresh是A页面自定义事件
  5. mui.fire(list, 'refresh');
  6. //返回true,继续页面关闭逻辑
  7. return true;
  8. }
  9. });
  10. //初始化单页的区域滚动
  11. mui('.mui-scroll-wrapper').scroll();
  12. mui.plusReady(function() {
  13. // 产品代码
  14. var Product = [];
  15. $.ajax({
  16. type: "get",
  17. url: huayi.config.callcenter_url + 'Department/GetDeptList',
  18. async: false,
  19. data: {
  20. flag: "CPDM",
  21. token:localStorage.getItem("token")
  22. },
  23. dataType: 'json',
  24. success: function(res) {
  25. if(res.state.toLowerCase() === "success") {
  26. res = res.data;
  27. if(res && res.length > 0) {
  28. res.forEach(function(v, i) {
  29. var obj = {};
  30. obj.id = v.id;
  31. obj.text = v.text;
  32. obj.children = v.children;
  33. Product.push(obj);
  34. });
  35. }
  36. }
  37. }
  38. });
  39. (function($, doc) {
  40. $.init();
  41. $.ready(function() {
  42. //产品代码
  43. var userPicker2 = new $.PopPicker({layer: 3});
  44. userPicker2.setData(Product);
  45. var showUserPickerButton2 = doc.getElementById('showUserPickerProduct');
  46. var F_Product = doc.getElementById('F_ProductType');
  47. showUserPickerButton2.addEventListener('tap', function(event) {
  48. userPicker2.show(function(items) {
  49. if (items[2].text==undefined) {
  50. if (items[1].text==undefined) {
  51. F_Product.value = items[0].text;
  52. F_Product.setAttribute("data-index", items[0].id);
  53. } else {
  54. F_Product.value = items[1].text;
  55. F_Product.setAttribute("data-index", items[1].id);
  56. }
  57. }else {
  58. F_Product.value =items[2].text;
  59. F_Product.setAttribute("data-index", items[2].id);
  60. }
  61. });
  62. }, false);
  63. })
  64. })(mui, document);
  65. })
  66. $('#xgPassword').on('tap', function() {
  67. // alert($('.F_UserName').val());
  68. // alert($('.password').val());
  69. // alert($("#F_ProductType").attr("data-index"));
  70. // alert($(".F_Mobile").val());
  71. if($('#F_CusName').val() == '') {
  72. mui.alert('请输入用户名!')
  73. } else if($('.password').val() == '') {
  74. mui.alert('请输入密码!')
  75. } else if($("#F_ProductType").val() == '') {
  76. mui.alert('请选择部门!')
  77. } else {
  78. $.ajax({
  79. type: "post",
  80. dataType: 'json',
  81. url: huayi.config.callcenter_url + '/UserAccount/AddUsers',
  82. async: true,
  83. data: {
  84. username: $('.F_UserName').val(), //用户名
  85. password: $('.password').val(), //密码
  86. deptid:$("#F_ProductType").attr("data-index"), //部门
  87. roleid: 53,
  88. mobile:$(".F_Mobile").val(),
  89. token: localStorage.getItem("token")
  90. },
  91. success: function(data) {
  92. if(data.state == "success") {
  93. mui.alert( '账号'+data.data.F_UserCode+'--密码'+data.data.F_Password,'添加成功', function() {
  94. var wobj = plus.webview.getWebviewById("Setting_manage");
  95. wobj.reload(true);
  96. });
  97. } else {
  98. mui.toast(data.message);
  99. }
  100. }
  101. });
  102. }
  103. })