wireRopeHis.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. var _this;
  2. var loading;
  3. new Vue({
  4. el: '#app',
  5. data: function() {
  6. return {
  7. activeName: "0",
  8. wireImeiLi: [{
  9. imei: "WTC23060426427",
  10. name: "振浮6-钢丝绳"
  11. }],
  12. wireItem: {},
  13. queryParams: {
  14. imei: null,
  15. startime: "",
  16. endtime: "",
  17. orderSql: "time desc",
  18. page: 1,
  19. rows: 12,
  20. accessToken: getCookie("wireToken")
  21. },
  22. wireHis: [],
  23. allTotal: 1,
  24. endPicker: false,
  25. starPicker: false,
  26. activeNames: ['0']
  27. }
  28. },
  29. created() {
  30. _this = this;
  31. _this.wireItem = _this.wireImeiLi[0];
  32. _this.queryParams.imei = _this.wireItem.imei;
  33. },
  34. methods: {
  35. handleQuery(){
  36. _this.queryParams.page = 1;
  37. _this.getWireHis();
  38. },
  39. endConfirm(val){
  40. _this.queryParams.endtime = getDTime(val)[0];
  41. _this.endPicker = false;
  42. },
  43. startConfirm(val){
  44. _this.queryParams.startime = getDTime(val)[0];
  45. _this.starPicker = false;
  46. },
  47. handleCurrentChange(val) {
  48. _this.getWireHis();
  49. },
  50. getWireHis(){
  51. if(_this.queryParams.startime == null||_this.queryParams.startime == ""){
  52. _this.$toast({
  53. type: 'fail',
  54. message: '请选择开始时间'
  55. });
  56. return;
  57. }
  58. if(_this.queryParams.endtime == null||_this.queryParams.endtime == ""){
  59. _this.$toast({
  60. type: 'fail',
  61. message: '请选择结束间'
  62. });
  63. return;
  64. }
  65. if(_this.queryParams.imei != null){
  66. loading = _this.$toast({
  67. type: 'loading',
  68. loadingType: 'spinner',
  69. duration: 0
  70. });
  71. _this.queryParams.gt = new Date(_this.queryParams.startime + " 00:00:00").getTime()/1000;
  72. _this.queryParams.lt = new Date(_this.queryParams.endtime + " 23:59:59").getTime()/1000;
  73. getWireHistory(_this.queryParams,function(res){
  74. _this.wireHis = res.data;
  75. _this.allTotal = res.total;
  76. loading.close();
  77. });
  78. }
  79. },
  80. goBack(){
  81. top.location.href = "../mainPh.html?sn=4";
  82. }
  83. }
  84. })