Няма описание

personal.js 6.4KB

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