瀏覽代碼

监测曲线

zxh 3 年之前
父節點
當前提交
4d7d414caa

+ 20 - 49
src/views/spectrum/common/historyCurve/index.vue

@@ -233,8 +233,8 @@ export default {
         this.$set(this.form, 'date2', this.form.date[0])
       }
     },
-    dialogVisible(val,oldVal){
-      if(!val){
+    dialogVisible(val, oldVal) {
+      if (!val) {
         this.loadingClose()
       }
     }
@@ -301,13 +301,28 @@ export default {
     /**
      * 展示曲线
      */
-    async show(siteId = null) {
+    async show(siteId = null, obj = {}) {
       Object.assign(this.$data, this.$options.data.call(this))
       await this.getSites(siteId)
       this.dialogVisible = true
-      if (siteId != null) {
-        this.getHistoryCurve({ siteId: siteId, checkCodes: this.targets.join(',') })
+
+      if (!siteId) return
+
+      let params = { siteId: siteId }
+      if (obj.beginDate && obj.endDate) {
+        params['beginTime'] = this.$moment(obj.beginDate).format('YYYY-MM-DD 00:00:00')
+        params['endTime'] = this.$moment(obj.beginDate).format('YYYY-MM-DD 23:59:59')
+        this.$set(this.form, 'date', [
+          this.$moment(obj.beginDate).format('YYYY-MM-DD'),
+          this.$moment(obj.endDate).format('YYYY-MM-DD')
+        ])
+      }
+      if (obj.targets) {
+        params['checkCodes'] = obj.targets.join(',')
+        this.targets = obj.targets
       }
+      // 获取曲线数据
+      this.getHistoryCurve(params)
     },
     /**
      * 获取站点
@@ -511,50 +526,6 @@ export default {
       this.pageTableData = []
       this.loadingClose()
     },
-    /**
-     * 获取查询时间
-     */
-    // getQueryTime() {
-    //   // 当前时间
-    //   const CURRENT_TIME = this.$moment().format('YYYY-MM-DD HH:mm:ss')
-    //   let endTime = ''
-    //   let startTime = ''
-    //   // 获取时间
-    //   switch (this.timeType) {
-    //     case 1: // 近24小时
-    //       endTime = CURRENT_TIME // 当前时间
-    //       startTime = this.$moment(CURRENT_TIME).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss')
-    //       break
-    //     case 2: // 今天
-    //       endTime = this.$moment(CURRENT_TIME).format('YYYY-MM-DD HH:mm:ss')
-    //       startTime = this.$moment(CURRENT_TIME).format('YYYY-MM-DD 00:00:00')
-    //       break
-    //     case 3: // 昨天
-    //       endTime = this.$moment(CURRENT_TIME).subtract(1, 'day').format('YYYY-MM-DD 23:59:59')
-    //       startTime = this.$moment(CURRENT_TIME).subtract(1, 'day').format('YYYY-MM-DD 00:00:00')
-    //       break
-    //     case 4: // 近7天
-    //       endTime = this.$moment(CURRENT_TIME).subtract(1, 'day').format('YYYY-MM-DD 23:59:59')
-    //       startTime = this.$moment(endTime).subtract(7, 'day').format('YYYY-MM-DD 00:00:00')
-    //       break
-    //     case 5: // 近15天
-    //       endTime = this.$moment(CURRENT_TIME).subtract(1, 'day').format('YYYY-MM-DD 23:59:59')
-    //       startTime = this.$moment(endTime).subtract(15, 'day').format('YYYY-MM-DD 00:00:00')
-    //       break
-    //     case 6:
-    //       endTime = this.$moment(CURRENT_TIME).subtract(1, 'day').format('YYYY-MM-DD 23:59:59')
-    //       startTime = this.$moment(endTime).subtract(30, 'day').format('YYYY-MM-DD 00:00:00')
-    //       break
-    //     case 7:
-    //       endTime = this.$moment(this.form.date[1]).format('YYYY-MM-DD 23:59:59')
-    //       startTime = this.$moment(this.form.date[0]).format('YYYY-MM-DD 00:00:00')
-    //       break
-    //   }
-    //   return {
-    //     startTime: startTime,
-    //     endTime: endTime
-    //   }
-    // },
     /**
      * 查询
      */

+ 7 - 1
src/views/spectrum/reform/groundWater/widget.vue

@@ -286,8 +286,14 @@ export default {
       })
     },
     viewCurve(row = null) {
+      const siteId = row ? row.id : null;
+      const options = row ? {
+        beginDate: row.beginDate,
+        endDate: row.monitorDate,
+        targets: [row.checkCode]
+      } : undefined
       // 查看历史曲线
-      this.$refs.historyCurve.show(row ? row.id : null)
+      this.$refs.historyCurve.show(siteId, options)
     },
     moniterClose() { }
   }

+ 8 - 1
src/views/spectrum/reform/preAssess/widget.vue

@@ -383,7 +383,14 @@ export default {
       option && myChart.setOption(option)
     },
     viewCurve(row = null) {
-      this.$refs.historyCurve.show(row.id)
+      const siteId = row ? row.id : null;
+      const options = row ? {
+        beginDate: row.beginDate,
+        endDate: row.monitorDate,
+        targets: [row.checkCode]
+      } : undefined
+      // 查看历史曲线
+      this.$refs.historyCurve.show(siteId, options)
     },
     moniterClose() {
       this.moniterVisible = false

+ 7 - 1
src/views/spectrum/reform/sewageDirect/widget.vue

@@ -286,8 +286,14 @@ export default {
       })
     },
     viewCurve(row = null) {
+      const siteId = row ? row.id : null;
+      const options = row ? {
+        beginDate: row.beginDate,
+        endDate: row.monitorDate,
+        targets: [row.checkCode]
+      } : undefined
       // 查看历史曲线
-      this.$refs.historyCurve.show(row ? row.id : null)
+      this.$refs.historyCurve.show(siteId, options)
     },
     moniterClose() { }
   }