vAlertManage.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. var _this;
  2. var loading;
  3. var baseTok = null, shipForm = {}, nowDate = "";
  4. var fatCount = 1;
  5. new Vue({
  6. el: '#app',
  7. filters: {
  8. setTime(_key){
  9. let _sf = getDTime(new Date((_key+"").length>10?parseInt(_key):parseInt(_key)*1000));
  10. return _sf[0] + _sf[1];
  11. },
  12. setImg(_key){
  13. let _sfj = "";
  14. if(_key != undefined){
  15. let _safd = _sfj.split(";")[0];
  16. _sfj = "https://www.enstation.vip:9443" + _safd.split(":8170")[1];
  17. if(_key.indexOf("Waring") == -1){
  18. _sfj = _sfj.replace(/faceImg\/businessFile/g,"alarm_folder/display_image");
  19. }
  20. }
  21. return _sfj
  22. }
  23. },
  24. data: function() {
  25. return {
  26. alretList: [],
  27. alretType: "",
  28. shipName: "",
  29. loading: true,
  30. endDay: "",
  31. starDay: "",
  32. curPage: 1,
  33. allTotal: 0,
  34. endPicker: false,
  35. starPicker: false,
  36. showPreview: false,
  37. imagePreview: [],
  38. hisVideo: false,
  39. hisVideoSrc: ""
  40. }
  41. },
  42. created:function(){
  43. _this = this;
  44. nowDate = getDTime(new Date());
  45. shipForm = JSON.parse(localStorage.getItem("nowShip"));
  46. let dh = location.search.split("&");
  47. fatCount = dh[1].split("=")[1];
  48. _this.alretType = dh[0].split("=")[1];
  49. _this.getList();
  50. },
  51. methods: {
  52. getList(){
  53. if(shipForm !=null && shipForm != "null"&&shipForm.en_name != ""&&shipForm.en_name != null){
  54. loading = _this.$toast({
  55. type: 'loading',
  56. loadingType: 'spinner',
  57. duration: 0
  58. });
  59. let _opts = {
  60. url: vipUrl + "/receive",
  61. type:"GET"
  62. };
  63. let _data = {
  64. user: shipForm.en_name,
  65. msgType: _this.alretType,
  66. enddate: _this.endDay,
  67. startdate: _this.starDay,
  68. pageNum: (_this.curPage - 1),
  69. pageSize: 12,
  70. };
  71. let _hea = {
  72. "Authorization": "ZDhlNjhjOTAwM2EyJWd6eXolaWUldXNlciV6aF9DTg==",
  73. "Content-Type": "application/json;charset=UTF-8"
  74. };
  75. getAxios(_opts, _data, _hea).then((res) => {
  76. if(res.success&&res.data.length){
  77. _this.allTotal = res.total;
  78. _this.alretList = res.data;
  79. }else{
  80. _this.allTotal = 0;
  81. _this.alretList = [];
  82. }
  83. loading.close();
  84. })
  85. }else{
  86. _this.alretList = [];
  87. }
  88. },
  89. endConfirm(val){
  90. _this.endDay = getDTime(val)[0];
  91. _this.endPicker = false;
  92. },
  93. startConfirm(val){
  94. _this.starDay = getDTime(val)[0];
  95. _this.starPicker = false;
  96. },
  97. seachLi(){
  98. if(_this.endDay == ""&&_this.starDay == ""){
  99. this.$toast({
  100. type: 'fail',
  101. message: '至少选择一个时间段查询!'
  102. });
  103. }else{
  104. _this.curPage = 1;
  105. _this.starDay = _this.starDay == "" ? "2021-01-01" : _this.starDay;
  106. _this.endDay = _this.endDay == "" ? nowDate[0] : _this.endDay;
  107. _this.getList();
  108. }
  109. },
  110. previewImg(kyt){
  111. let _arr = [];
  112. if(kyt != undefined){
  113. let _safd = kyt.split(";");
  114. _safd.forEach(item =>{
  115. item = "https://www.enstation.vip:9443" + item.split(":8170")[1];
  116. if(item.indexOf("Waring") == -1){
  117. item = item.replace(/faceImg\/businessFile/g,"alarm_folder/display_image");
  118. }
  119. _arr.push(item);
  120. });
  121. }
  122. _this.showPreview = true;
  123. _this.imagePreview = _arr;
  124. },
  125. seeVid(val){
  126. _this.hisVideo = true;
  127. if(val.indexOf(":8170/") != -1){
  128. _this.hisVideoSrc = `https://www.enstation.vip:9443${val.split(":8170")[1]}`
  129. }else{
  130. _this.hisVideoSrc = "";
  131. }
  132. },
  133. changePage(val){
  134. _this.curPage = val;
  135. _this.getList();
  136. },
  137. goBack(){
  138. top.location.href = "../mainPh.html?sn="+fatCount;
  139. }
  140. }
  141. })