stop_special_service.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. !function(){
  2. var httpData=GetRequest();
  3. var userInfo = JSON.parse(window.localStorage.getItem(httpRequest.agentName));
  4. //设置网页打印的页眉页脚为空
  5. function PageSetup_Null() {
  6. var HKEY_Root,HKEY_Path,HKEY_Key;
  7. HKEY_Root="HKEY_CURRENT_USER";
  8. HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
  9. try {
  10. var Wsh = new ActiveXObject("WScript.Shell");
  11. HKEY_Key="header";
  12. Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
  13. HKEY_Key="footer";
  14. Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
  15. window.print();
  16. } catch(e) {
  17. window.print();
  18. }
  19. }
  20. function bindEvent() {
  21. $("#printBtn").click(function() {
  22. var bdhtml = window.document.body.innerHTML,
  23. sprnstr = "<!--startprint-->",
  24. eprnstr = "<!--endprint-->",
  25. prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
  26. prnhtml=prnhtml.substring(0, prnhtml.indexOf(eprnstr));
  27. window.document.body.innerHTML = prnhtml;
  28. PageSetup_Null();
  29. })
  30. }
  31. new Vue({
  32. el:"#app",
  33. data:{
  34. accountList: {}
  35. },
  36. mounted:function(){
  37. this.getServiceItemsAfterStop()
  38. bindEvent()
  39. },
  40. methods:{
  41. getServiceItemsAfterStop: function() {
  42. var vm = this,
  43. loadding = layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  44. rehaAPI.getServiceItemsAfterStop({planId: httpData.planids}).then(function(res){
  45. layer.close(loadding);
  46. if(res.status==200){
  47. vm.accountList = res.data
  48. }else{
  49. layer.msg(res.msg,{icon:5});
  50. }
  51. })
  52. }
  53. },
  54. filters:{
  55. formatDate:function(value, format) {
  56. if(!value) return ;
  57. var fmt=format || "yyyy-MM-dd hh:mm";
  58. var date = new Date(value);
  59. if (/(y+)/.test(fmt)) {
  60. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
  61. }
  62. let o = {
  63. 'M+': date.getMonth() + 1,
  64. 'd+': date.getDate(),
  65. 'h+': date.getHours(),
  66. 'm+': date.getMinutes(),
  67. 's+': date.getSeconds()
  68. };
  69. for (let k in o) {
  70. if (new RegExp(`(${k})`).test(fmt)) {
  71. let str = o[k] + '';
  72. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : ('00' + str).substr(str.length));
  73. }
  74. }
  75. return fmt;
  76. },
  77. getImgUrl: function(value) {
  78. var url = httpRequest.getImgUrl(value);
  79. return url;
  80. }
  81. }
  82. })
  83. }();