Keine Beschreibung

personal.js 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. mui.init();
  2. var slider = mui("#slider");
  3. window.addEventListener('refreshPer', function(e) { //执行刷新
  4. ajaxRefresh();
  5. });
  6. slider.slider({
  7. interval: 5000
  8. });
  9. var token = localStorage.getItem("token"); //获取本地存储
  10. ajaxRefresh();
  11. //权限判断
  12. $.ajax({
  13. data: {
  14. token: token,
  15. },
  16. dataType: 'json', //服务器返回json格式数据
  17. url: huayi.config.callcenter_url + '/UserAccount/GetNowUser',
  18. type: 'get', //HTTP请求类型
  19. success: function(data) {
  20. //alert(JSON.stringify(data.data.user.F_RoleId))
  21. if(data.data.display == "1") {
  22. $(".addDisplay").show()
  23. } else {
  24. $(".addDisplay").hide()
  25. }
  26. var RoleCode = data.data.user.F_See;
  27. $(".F_UserName").text(data.data.user.F_UserName);
  28. localStorage.setItem("F_UserName", data.data.user.F_UserName);
  29. localStorage.setItem("F_RoleId", data.data.user.F_RoleId);
  30. localStorage.setItem("F_See", data.data.user.F_See);
  31. $(".rolname").text(data.data.user.rolname);
  32. if(RoleCode == "0") { //调度
  33. $(".RoleCode_0").css('display', 'block')
  34. } else if(RoleCode == "1") {
  35. $(".RoleCode_1").css('display', 'block')
  36. } else if(RoleCode == "2") {
  37. $(".RoleCode_2").css('display', 'block')
  38. } else if(RoleCode == "3") {
  39. $(".RoleCode_3").css('display', 'block')
  40. } else if(RoleCode == "4") {
  41. $(".RoleCode_4").css('display', 'block')
  42. }
  43. },
  44. error: function(xhr, type, errorThrown) {
  45. //异常处理;
  46. }
  47. });
  48. function ajaxRefresh() {
  49. //权限判断
  50. $.ajax({
  51. data: {
  52. token: token,
  53. },
  54. url: huayi.config.callcenter_url + '/WorkorderApp/GetCount',
  55. dataType: 'json', //服务器返回json格式数据
  56. type: 'get', //HTTP请求类型
  57. timeout: 10000, //超时时间设置为10秒;
  58. headers: {
  59. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  60. },
  61. success: function(data) {
  62. if(data.DTJ == 0) {
  63. $(".DTJ").hide(); //待提交
  64. } else {
  65. $(".DTJ").text(data.DTJ); //待提交
  66. }
  67. if(data.DFP == 0) {
  68. $(".DFP").hide(); //待提交
  69. } else {
  70. $(".DFP").text(data.DFP); //待提交
  71. }
  72. if(data.DCL == 0) {
  73. $(".DCL").hide(); //待提交
  74. } else {
  75. $(".DCL").text(data.DCL); //待处理
  76. }
  77. if(data.CLZ == 0) {
  78. $(".CLZ").hide(); //待提交
  79. } else {
  80. $(".CLZ").text(data.CLZ); //处理中
  81. }
  82. if(data.YWJ == 0) {
  83. $(".YWJ").hide(); //待提交
  84. } else {
  85. $(".YWJ").text(data.YWJ); //已完结
  86. }
  87. if(data.CJSL == 0) {
  88. $(".CJSL").hide(); //待提交
  89. } else {
  90. $(".CJSL").text(data.CJSL); //抽检工单
  91. }
  92. if(data.THDTJ == 0) {
  93. $(".THDTJ").hide(); //待提交
  94. } else {
  95. $(".THDTJ").text(data.THDTJ); //退回待提交
  96. }
  97. if(data.THDFP == 0) {
  98. $(".THDFP").hide(); //待提交
  99. } else {
  100. $(".THDFP").text(data.THDFP); //退回待分配
  101. }
  102. if(data.YJGD == 0) {
  103. $(".YJGD").hide(); //待提交
  104. } else {
  105. $(".YJGD").text(data.YJGD); //一级工单
  106. }
  107. if(data.EJGD == 0) {
  108. $(".EJGD").hide(); //待提交
  109. } else {
  110. $(".EJGD").text(data.EJGD); //二级工单
  111. }
  112. if(data.SJGD == 0) {
  113. $(".SJGD").hide(); //待提交
  114. } else {
  115. $(".SJGD").text(data.SJGD); //三级工单
  116. }
  117. },
  118. error: function(xhr, type, errorThrown) {
  119. //异常处理;
  120. }
  121. });
  122. }
  123. //一级查看-待处理列表
  124. $(".work-list").on('tap', function() {
  125. var index = $(this).attr('index');
  126. mui.openWindow({
  127. id: 'Work-list',
  128. url: 'workOrder/Work-list.html',
  129. createNew: true,
  130. show: {
  131. autoShow: false
  132. },
  133. waiting: {
  134. autoShow: true //自动显示等待框,默认为true
  135. },
  136. extras: {
  137. index: index,
  138. }
  139. });
  140. })
  141. //工单等级列表
  142. $(".work-class").on('tap', function() {
  143. var importClass = $(this).attr('index');
  144. var choujian=$(this).attr('choujian');
  145. mui.openWindow({
  146. id: 'Work-listClass',
  147. url: 'workOrder/Work-listClass.html',
  148. createNew: true,
  149. show: {
  150. autoShow: false
  151. },
  152. waiting: {
  153. autoShow: true //自动显示等待框,默认为true
  154. },
  155. extras: {
  156. importClass: importClass,
  157. choujian: choujian
  158. }
  159. });
  160. })
  161. mui.plusReady(function() {
  162. // 版本更新
  163. var Code_;
  164. var NewCode_;
  165. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  166. console.log("当前应用版本:" + wgtinfo.version + "---" + plus.runtime.version);
  167. localStorage.setItem("Code", wgtinfo.version) //缓存保存版本号;
  168. Code_ = localStorage.getItem("Code");
  169. $('.update').text(Code_);
  170. });
  171. //检查更新
  172. var server = huayi.config.callcenter_url + "ApplicationsVersion/GetAndroid?"; //获取升级描述文件服务器地址
  173. mui.ajax(server, {
  174. data: {
  175. isNew: true,
  176. token: token
  177. },
  178. dataType: 'json', //服务器返回json格式数据
  179. type: 'post', //HTTP请求类型
  180. timeout: 10000, //超时时间设置为10秒;
  181. headers: {
  182. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  183. },
  184. success: function(data) {
  185. if (data.state == "success") {
  186. NewCode_ = data.data.F_VersionCode;
  187. localStorage.setItem("Code", NewCode_); //缓存保存版本号;
  188. if (Code_ != NewCode_) {
  189. var Codes = localStorage.setItem("Code", NewCode_);
  190. console.log(Codes);
  191. plus.nativeUI.confirm("发现新版本", function(event) {
  192. var tapIndex = event.index;
  193. if (tapIndex == 0) {
  194. plus.runtime.openURL(data.data.F_Url);
  195. } else {
  196. mui.toast("取消更新");
  197. }
  198. }, "提示", ["立即更新", "取消"])
  199. }
  200. } else {
  201. mui.toast(data.message);
  202. }
  203. },
  204. error: function(data) {
  205. //异常处理;
  206. console.log(data.message);
  207. }
  208. })
  209. })