Sin descripción

personal.js 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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() {ajaxRefresh()},60*1000);
  10. setInterval(function() {clienGet()},huayi.config.indextime);
  11. })
  12. window.addEventListener('refreshPer', function(e) { //点返回按钮时执行刷新
  13. ajaxRefresh();
  14. });
  15. //权限判断
  16. $.ajax({
  17. data: {
  18. token: token,
  19. },
  20. dataType: 'json', //服务器返回json格式数据
  21. url: huayi.config.callcenter_url + '/UserAccount/GetNowUser',
  22. type: 'get', //HTTP请求类型
  23. success: function(data) {
  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. //权限判断
  52. $.ajax({
  53. data: {
  54. token: token,
  55. pageindex: 1,
  56. pagesize: 10,
  57. },
  58. dataType: 'json', //服务器返回json格式数据
  59. url: huayi.config.callcenter_url + '/Rotation/Getlist',
  60. type: 'get', //HTTP请求类型
  61. success: function(data) {
  62. if(data.state="success"){
  63. // alert(JSON.stringify(data.data.modelList[0].romath))
  64. // alert(data.data.modelList.length)
  65. $('<div class="mui-slider-item">'+
  66. '<a href="#">'+
  67. '<img src="'+data.data.modelList[0].romath+'">'+
  68. '</a>'+
  69. '</div>').appendTo('#baneSlider');
  70. $(data.data.modelList).each(function(i,n){
  71. if(n.isEnable==0){
  72. $('<div class="mui-slider-item">'+
  73. '<a href="#">'+
  74. '<img src="'+n.romath+'">'+
  75. '</a>'+
  76. '</div>').appendTo('#baneSlider');
  77. if(i==0){
  78. $('<div class="mui-indicator mui-active"></div>').appendTo('#baneQuan');
  79. }else{
  80. $('<div class="mui-indicator"></div>').appendTo('#baneQuan');
  81. }
  82. }
  83. })
  84. $('<div class="mui-slider-item">'+
  85. '<a href="#">'+
  86. '<img src="'+data.data.modelList[data.data.modelList.length-1].romath+'">'+
  87. '</a>'+
  88. '</div>').appendTo('#baneSlider');
  89. var slider = mui("#slider");
  90. slider.slider({interval: 5000});
  91. }
  92. },
  93. error: function(xhr, type, errorThrown) {
  94. //异常处理;
  95. }
  96. });
  97. function ajaxRefresh() {
  98. //权限判断
  99. $.ajax({
  100. data: {
  101. token: token,
  102. },
  103. url: huayi.config.callcenter_url + '/WorkorderApp/GetCount',
  104. dataType: 'json', //服务器返回json格式数据
  105. type: 'get', //HTTP请求类型
  106. timeout: 10000, //超时时间设置为10秒;
  107. headers: {
  108. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  109. },
  110. success: function(data) {
  111. if(data.DTJ == 0) {
  112. $(".DTJ").hide(); //待提交
  113. } else {
  114. $(".DTJ").text(data.DTJ); //待提交
  115. }
  116. if(data.DFP == 0) {
  117. $(".DFP").hide(); //待提交
  118. } else {
  119. $(".DFP").text(data.DFP); //待提交
  120. }
  121. if(data.DCL == 0) {
  122. $(".DCL").hide(); //待提交
  123. } else {
  124. $(".DCL").text(data.DCL); //待处理
  125. }
  126. if(data.CLZ == 0) {
  127. $(".CLZ").hide(); //待提交
  128. } else {
  129. $(".CLZ").text(data.CLZ); //处理中
  130. }
  131. if(data.YWJ == 0) {
  132. $(".YWJ").hide(); //待提交
  133. } else {
  134. $(".YWJ").text(data.YWJ); //已完结
  135. }
  136. if(data.CJSL == 0) {
  137. $(".CJSL").hide(); //待提交
  138. } else {
  139. //alert(data.CJSL)
  140. $(".CJSL").text(data.CJSL); //抽检工单
  141. }
  142. if(data.THDTJ == 0) {
  143. $(".THDTJ").hide(); //待提交
  144. } else {
  145. $(".THDTJ").text(data.THDTJ); //退回待提交
  146. }
  147. if(data.THDFP == 0) {
  148. $(".THDFP").hide(); //待提交
  149. } else {
  150. $(".THDFP").text(data.THDFP); //退回待分配
  151. }
  152. if(data.YJGD == 0) {
  153. $(".YJGD").hide(); //待提交
  154. } else {
  155. $(".YJGD").text(data.YJGD); //一级工单
  156. }
  157. if(data.EJGD == 0) {
  158. $(".EJGD").hide(); //待提交
  159. } else {
  160. $(".EJGD").text(data.EJGD); //二级工单
  161. }
  162. if(data.SJGD == 0) {
  163. $(".SJGD").hide(); //待提交
  164. } else {
  165. $(".SJGD").text(data.SJGD); //三级工单
  166. }
  167. },
  168. error: function(xhr, type, errorThrown) {
  169. //异常处理;
  170. }
  171. });
  172. }
  173. //一级查看-待处理列表
  174. $(".work-list").on('tap', function() {
  175. var index = $(this).attr('index');
  176. mui.openWindow({
  177. id: 'Work-list',
  178. url: 'workOrder/Work-list.html',
  179. createNew: true,
  180. show: {
  181. autoShow: false
  182. },
  183. waiting: {
  184. autoShow: true //自动显示等待框,默认为true
  185. },
  186. extras: {
  187. index: index,
  188. }
  189. });
  190. })
  191. //工单等级列表
  192. $(".work-class").on('tap', function() {
  193. var importClass = $(this).attr('index');
  194. mui.openWindow({
  195. id: 'Work-listClass',
  196. url: 'workOrder/Work-listClass.html',
  197. createNew: true,
  198. show: {
  199. autoShow: false
  200. },
  201. waiting: {
  202. autoShow: true //自动显示等待框,默认为true
  203. },
  204. extras: {
  205. importClass: importClass
  206. }
  207. });
  208. })
  209. //工单等级列表
  210. $(".work-CJ").on('tap', function() {
  211. var importClass = $(this).attr('index');
  212. var choujian=$(this).attr('choujian');
  213. mui.openWindow({
  214. id: 'Work-listCJ',
  215. url: 'workOrder/Work-listCJ.html',
  216. createNew: true,
  217. show: {
  218. autoShow: false
  219. },
  220. waiting: {
  221. autoShow: true //自动显示等待框,默认为true
  222. },
  223. extras: {
  224. importClass: importClass,
  225. choujian: choujian
  226. }
  227. });
  228. })
  229. function clienGet() {
  230. var pinf = plus.push.getClientInfo();
  231. var cid = pinf.clientid;//客户端标识
  232. if (plus.device.model.indexOf('iPhone') > -1) {
  233. var apptype=2;
  234. }else{
  235. var apptype=1;
  236. }
  237. $.ajax({
  238. type: "get",
  239. url: huayi.config.callcenter_url + 'PushMessage/PutAppClientIdAsync',
  240. async: false,
  241. data: {
  242. apptype:apptype,
  243. clientid: cid,
  244. token:localStorage.getItem("token")
  245. },
  246. dataType: 'json',
  247. success: function(res) {
  248. if(res.state.toLowerCase() === "success") {
  249. }
  250. }
  251. });
  252. }
  253. function upData() {
  254. // 版本更新
  255. var Code_;
  256. var NewCode_;
  257. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  258. console.log("当前应用版本:" + wgtinfo.version + "---" + plus.runtime.version);
  259. localStorage.setItem("Code", wgtinfo.version) //缓存保存版本号;
  260. Code_ = localStorage.getItem("Code");
  261. $('.update').text(Code_);
  262. });
  263. if (plus.device.model.indexOf('iPhone') > -1) {
  264. typeUp=1;
  265. }else{
  266. typeUp=0;
  267. }
  268. //检查更新
  269. var server = huayi.config.callcenter_url + "ApplicationsVersion/GetAndroid?"; //获取升级描述文件服务器地址
  270. mui.ajax(server, {
  271. data: {
  272. type:typeUp,
  273. isNew: true,
  274. token: token
  275. },
  276. dataType: 'json', //服务器返回json格式数据
  277. type: 'post', //HTTP请求类型
  278. timeout: 10000, //超时时间设置为10秒;
  279. headers: {
  280. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  281. },
  282. success: function(data) {
  283. if (data.state == "success") {
  284. NewCode_ = data.data.F_VersionCode;
  285. localStorage.setItem("Code", NewCode_); //缓存保存版本号;
  286. if(NewCode_&&Code_){
  287. if (Code_ != NewCode_) {
  288. var Codes = localStorage.setItem("Code", NewCode_);
  289. console.log(Codes);
  290. plus.nativeUI.confirm("发现新版本", function(event) {
  291. var tapIndex = event.index;
  292. if (tapIndex == 0) {
  293. if (typeUp==1) {
  294. plus.runtime.openURL(data.data.F_Url);
  295. }else{
  296. plus.runtime.openURL(data.data.FileUrl[0].F_Url);
  297. }
  298. } else {
  299. mui.toast("取消更新");
  300. }
  301. }, "提示", ["立即更新", "取消"])
  302. }
  303. }
  304. } else {
  305. mui.toast(data.message);
  306. }
  307. },
  308. error: function(data) {
  309. //异常处理;
  310. console.log(data.message);
  311. }
  312. })
  313. }