説明なし

xg_manage.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. var wv = plus.webview.currentWebview();
  14. var nameid = wv.nameid;
  15. var name = wv.name;
  16. mui.ajax(huayi.config.callcenter_url + '/UserAccount/GetUser', {
  17. data: {
  18. usercode:name,
  19. userid:nameid,
  20. token: localStorage.getItem("token"),
  21. },
  22. dataType: 'json', //服务器返回json格式数据
  23. async: false,
  24. type: 'get', //HTTP请求类型
  25. timeout: 10000, //超时时间设置为10秒;
  26. headers: {
  27. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  28. },
  29. success: function(data) {
  30. var RoleCode = data.data;
  31. $("#UserId").val(RoleCode.F_UserId) //用户id
  32. $(".F_UserName").val(RoleCode.F_UserName); //员工姓名
  33. $(".F_SeatGroup").val(RoleCode.depname); //部门
  34. $(".rolname").val(RoleCode.F_UserCode); //员工工号
  35. $(".password").val(RoleCode.F_Password); //密码
  36. $(".F_Mobile").val(RoleCode.F_Mobile); //手机号
  37. },
  38. error: function(xhr, type, errorThrown) {
  39. //异常处理;
  40. }
  41. });
  42. // 产品代码
  43. var Product = [];
  44. $.ajax({
  45. type: "get",
  46. url: huayi.config.callcenter_url + 'Department/GetDeptList',
  47. async: false,
  48. data: {
  49. flag: "CPDM",
  50. token:localStorage.getItem("token")
  51. },
  52. dataType: 'json',
  53. success: function(res) {
  54. if(res.state.toLowerCase() === "success") {
  55. res = res.data;
  56. if(res && res.length > 0) {
  57. res.forEach(function(v, i) {
  58. var obj = {};
  59. obj.value = v.id;
  60. obj.text = v.text;
  61. obj.children = v.children;
  62. Product.push(obj);
  63. });
  64. }
  65. }
  66. }
  67. });
  68. (function($, doc) {
  69. $.init();
  70. $.ready(function() {
  71. //产品代码
  72. var userPicker2 = new $.PopPicker({layer: 3});
  73. userPicker2.setData(Product);
  74. var showUserPickerButton2 = doc.getElementById('showUserPickerProduct');
  75. var F_Product = doc.getElementById('F_ProductType');
  76. showUserPickerButton2.addEventListener('tap', function(event) {
  77. userPicker2.show(function(items) {
  78. F_Product.value = items[0].textt + "-" + items[1].text + "-" + items[2].text;
  79. F_Product.setAttribute("data-index", items[2].value);
  80. if (items[2].text="undefined") {
  81. F_Product.value = items[0].text + "-" + items[1].text;
  82. F_Product.setAttribute("data-index", items[1].value);
  83. }else if (items[1].text="undefined") {
  84. F_Product.value = items[0].text;
  85. F_Product.setAttribute("data-index", items[0].value);
  86. }else {
  87. }
  88. });
  89. }, false);
  90. })
  91. })(mui, document);
  92. })
  93. $('#xgPassword').on('tap', function() {
  94. $.ajax({
  95. type: "post",
  96. dataType: 'json',
  97. url: huayi.config.callcenter_url + '/UserAccount/EditUsers',
  98. async: true,
  99. data: {
  100. userid:$("#UserId").val(),
  101. username: $('.F_UserName').val(), //用户名
  102. usercode: $('.rolname').val(), //账号
  103. Password: $('.password').val(), //密码
  104. token: localStorage.getItem("token")
  105. },
  106. success: function(data) {
  107. if(data.state == "success") {
  108. mui.toast('修改成功!');
  109. setTimeout(function () {
  110. window.location.href="../login.html"
  111. },1500)
  112. } else {
  113. mui.toast(data.message);
  114. }
  115. }
  116. });
  117. })