whychdw
2020-07-11 180472e80ece1806561363174451781e1b388e8e
实时添加查询最近时间
1个文件已修改
25 ■■■■■ 已修改文件
src/pages/batt-list/real-time-page.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/batt-list/real-time-page.vue
@@ -60,6 +60,7 @@
            options: {},
            drawer: false,
            showChartTitle: [],
            table_name: new Date().format('yyyy-MM-dd'),
        }
    },
    watch: {
@@ -118,6 +119,27 @@
                // 设置选中的显示的内容
                self.setShowChartTille();
                // 查询后台数据
                self.searchHistoryTimeRange();
            });
        },
        searchHistoryTimeRange() {
            let batt  = this.$store.state.batt;
            if(batt.dev_id == "") {
                return;
            }
            // 构造查询条件
            let searchParams = {
                dev_id: batt.dev_id,
            };
            let self = this;
            this.$api.batt.searchHistoryTimeRange(searchParams)
            .then(function(res) {
                res = JSON.parse(res.data.result);
                self.table_name = new Date().format('yyyy-MM-dd');
                if(res.code == 1) {
                    self.table_name = res.data[1];
                }
                // 请求前100笔数据
                self.searchHistory100();
            });
        },
@@ -130,7 +152,8 @@
            var self = this;
            // 构造查询条件
            var searchParams = {
                dev_id: batt.dev_id
                dev_id: batt.dev_id,
                table_name: this.table_name,
            };
            
            // 查询后台