Sfoglia il codice sorgente

温箱05 8 16 48 霉菌 三综合 电压历史数据导出前判断是否在3个月内

LLL 1 anno fa
parent
commit
0a0360306f

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory05List.vue

@@ -313,9 +313,10 @@
     methods: {
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -357,36 +358,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+      //   const year1 = time1.getFullYear()
+      //   const year2 = time2.getFullYear()
+      //   const month1 = time1.getMonth() + 1
+      //   const month2 = time2.getMonth() + 1
+      //   const day1 = time1.getDate()
+      //   const day2 = time2.getDate()
+      //   if (year2 === year1) { // 判断两个日期 是否是同年
+      //     if (month2 - month1 > m) { // 相差是否 在m个月中
+      //       return false
+      //     } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+      //       if (day2 > day1) {
+      //         return false
+      //       }
+      //     }
+      //   } else { // 不同年
+      //     if (year2 - year1 > 1) {
+      //       return false
+      //     }
+      //     else if (year2 - year1 === 1) {
+      //       if (month2 > m || month1 + m - month2 < 12) {
+      //         return false
+      //       }
+      //       else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+      //         if (day2 > day1) {
+      //           return false
+      //         }
+      //       }
+      //     }
+      //   }
+      //   return true
       },
 
       initDictConfig(){

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory16List.vue

@@ -313,9 +313,10 @@
     methods: {
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -357,36 +358,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+        // const year1 = time1.getFullYear()
+        // const year2 = time2.getFullYear()
+        // const month1 = time1.getMonth() + 1
+        // const month2 = time2.getMonth() + 1
+        // const day1 = time1.getDate()
+        // const day2 = time2.getDate()
+        // if (year2 === year1) { // 判断两个日期 是否是同年
+        //   if (month2 - month1 > m) { // 相差是否 在m个月中
+        //     return false
+        //   } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+        //     if (day2 > day1) {
+        //       return false
+        //     }
+        //   }
+        // } else { // 不同年
+        //   if (year2 - year1 > 1) {
+        //     return false
+        //   }
+        //   else if (year2 - year1 === 1) {
+        //     if (month2 > m || month1 + m - month2 < 12) {
+        //       return false
+        //     }
+        //     else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+        //       if (day2 > day1) {
+        //         return false
+        //       }
+        //     }
+        //   }
+        // }
+        // return true
       },
 
       initDictConfig(){

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory48List.vue

@@ -313,9 +313,10 @@
     methods: {
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -357,36 +358,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+        // const year1 = time1.getFullYear()
+        // const year2 = time2.getFullYear()
+        // const month1 = time1.getMonth() + 1
+        // const month2 = time2.getMonth() + 1
+        // const day1 = time1.getDate()
+        // const day2 = time2.getDate()
+        // if (year2 === year1) { // 判断两个日期 是否是同年
+        //   if (month2 - month1 > m) { // 相差是否 在m个月中
+        //     return false
+        //   } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+        //     if (day2 > day1) {
+        //       return false
+        //     }
+        //   }
+        // } else { // 不同年
+        //   if (year2 - year1 > 1) {
+        //     return false
+        //   }
+        //   else if (year2 - year1 === 1) {
+        //     if (month2 > m || month1 + m - month2 < 12) {
+        //       return false
+        //     }
+        //     else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+        //       if (day2 > day1) {
+        //         return false
+        //       }
+        //     }
+        //   }
+        // }
+        // return true
       },
 
       initDictConfig(){

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory8List.vue

@@ -313,9 +313,10 @@
     methods: {
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -357,36 +358,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+        // const year1 = time1.getFullYear()
+        // const year2 = time2.getFullYear()
+        // const month1 = time1.getMonth() + 1
+        // const month2 = time2.getMonth() + 1
+        // const day1 = time1.getDate()
+        // const day2 = time2.getDate()
+        // if (year2 === year1) { // 判断两个日期 是否是同年
+        //   if (month2 - month1 > m) { // 相差是否 在m个月中
+        //     return false
+        //   } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+        //     if (day2 > day1) {
+        //       return false
+        //     }
+        //   }
+        // } else { // 不同年
+        //   if (year2 - year1 > 1) {
+        //     return false
+        //   }
+        //   else if (year2 - year1 === 1) {
+        //     if (month2 > m || month1 + m - month2 < 12) {
+        //       return false
+        //     }
+        //     else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+        //       if (day2 > day1) {
+        //         return false
+        //       }
+        //     }
+        //   }
+        // }
+        // return true
       },
 
       initDictConfig(){

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistoryMjList.vue

@@ -313,9 +313,10 @@
     methods: {
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -357,36 +358,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+        // const year1 = time1.getFullYear()
+        // const year2 = time2.getFullYear()
+        // const month1 = time1.getMonth() + 1
+        // const month2 = time2.getMonth() + 1
+        // const day1 = time1.getDate()
+        // const day2 = time2.getDate()
+        // if (year2 === year1) { // 判断两个日期 是否是同年
+        //   if (month2 - month1 > m) { // 相差是否 在m个月中
+        //     return false
+        //   } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+        //     if (day2 > day1) {
+        //       return false
+        //     }
+        //   }
+        // } else { // 不同年
+        //   if (year2 - year1 > 1) {
+        //     return false
+        //   }
+        //   else if (year2 - year1 === 1) {
+        //     if (month2 > m || month1 + m - month2 < 12) {
+        //       return false
+        //     }
+        //     else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+        //       if (day2 > day1) {
+        //         return false
+        //       }
+        //     }
+        //   }
+        // }
+        // return true
       },
 
       initDictConfig(){

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistorySzhList.vue

@@ -313,9 +313,10 @@
     methods: {
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -357,36 +358,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+        // const year1 = time1.getFullYear()
+        // const year2 = time2.getFullYear()
+        // const month1 = time1.getMonth() + 1
+        // const month2 = time2.getMonth() + 1
+        // const day1 = time1.getDate()
+        // const day2 = time2.getDate()
+        // if (year2 === year1) { // 判断两个日期 是否是同年
+        //   if (month2 - month1 > m) { // 相差是否 在m个月中
+        //     return false
+        //   } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+        //     if (day2 > day1) {
+        //       return false
+        //     }
+        //   }
+        // } else { // 不同年
+        //   if (year2 - year1 > 1) {
+        //     return false
+        //   }
+        //   else if (year2 - year1 === 1) {
+        //     if (month2 > m || month1 + m - month2 < 12) {
+        //       return false
+        //     }
+        //     else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+        //       if (day2 > day1) {
+        //         return false
+        //       }
+        //     }
+        //   }
+        // }
+        // return true
       },
 
       initDictConfig(){

+ 43 - 32
itdmWeb/src/views/module-iTDM/itdmWenxiangVoltage/ItdmWenxiangVoltageList.vue

@@ -249,9 +249,10 @@
 
       // 判断时间段是否在3个月内,在的话导出,超出的话提示
       dc(fileName){
-        console.log(11111,this.queryParam)
+        let param = this.getQueryParams();
+        console.log(11111,param)
         //判断时间段是否在3个月内
-        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+        let flag = this.completeDate(param.createTime_begin,param.createTime_end,3)
 
         if(flag){
           this.handleExportXls(fileName)
@@ -293,36 +294,46 @@
 
       //判断时间段是否在3个月内,是的话返回true,否则返回false
       completeDate (time1, time2, m) {
-        const year1 = time1.getFullYear()
-        const year2 = time2.getFullYear()
-        const month1 = time1.getMonth() + 1
-        const month2 = time2.getMonth() + 1
-        const day1 = time1.getDate()
-        const day2 = time2.getDate()
-        if (year2 === year1) { // 判断两个日期 是否是同年
-          if (month2 - month1 > m) { // 相差是否 在m个月中
-            return false
-          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
-            if (day2 > day1) {
-              return false
-            }
-          }
-        } else { // 不同年
-          if (year2 - year1 > 1) {
-            return false
-          }
-          else if (year2 - year1 === 1) {
-            if (month2 > m || month1 + m - month2 < 12) {
-              return false
-            }
-            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
-              if (day2 > day1) {
-                return false
-              }
-            }
-          }
-        }
-        return true
+
+        var date1 = new Date(time1);
+        var date2 = new Date(time2);
+
+        // 计算时间差
+        var diffMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth();
+
+        // 判断时间差是否小于等于m个月
+        return diffMonths <= m;
+
+        // const year1 = time1.getFullYear()
+        // const year2 = time2.getFullYear()
+        // const month1 = time1.getMonth() + 1
+        // const month2 = time2.getMonth() + 1
+        // const day1 = time1.getDate()
+        // const day2 = time2.getDate()
+        // if (year2 === year1) { // 判断两个日期 是否是同年
+        //   if (month2 - month1 > m) { // 相差是否 在m个月中
+        //     return false
+        //   } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+        //     if (day2 > day1) {
+        //       return false
+        //     }
+        //   }
+        // } else { // 不同年
+        //   if (year2 - year1 > 1) {
+        //     return false
+        //   }
+        //   else if (year2 - year1 === 1) {
+        //     if (month2 > m || month1 + m - month2 < 12) {
+        //       return false
+        //     }
+        //     else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+        //       if (day2 > day1) {
+        //         return false
+        //       }
+        //     }
+        //   }
+        // }
+        // return true
       },
 
       initDictConfig(){