zhouwenxuan
2023-10-25 7098891a4ac92dbe365596883099d63e99b8015c
src/views/monitorData/gasData/index.vue
@@ -38,7 +38,7 @@
                    </el-button>
                </el-form>
            </div>
            <div id="gasChart" style="height: 500px;width: auto"></div>
            <div :id="gasChart" style="height: 500px;width: auto"></div>
            <el-table :data="state.tableData.data" style="width: 100%;margin-top: 20px" v-loading="loading">
                <el-table-column type="index" label="序号" width="80" />
                <el-table-column align="center" prop="time" label="采集时间"/>
@@ -93,6 +93,7 @@
        gasList: []
    }
});
const gasChart = ref("eChartgasN" + Date .now() + Math .random())
const chooseTime = (val: any) => {
    let sTime = Date.parse(new Date(val[0]));
@@ -149,8 +150,6 @@
                return item.gasValue;
            })
            dataZoomEnd.value = xData.value.length > 25 ? 30 : 100;
            markLines.value = 110;
        }else {
            xData.value = [];
            yData.value = [];
@@ -195,7 +194,10 @@
    let res = await gasManageApi().getGas({});
    if(res.data.code == 100) {
        state.tableData.gasList = res.data.data;
        console.log("气体",state.tableData.gasList)
        //默认选择第一个气体
        state.tableData.listQuery.searchParams.gas = state.tableData.gasList[0].id;
        markLines.value = state.tableData.gasList[0].threshold;
        initInfoData();
    }else {
        ElMessage({
@@ -216,12 +218,17 @@
};
const search = () => {
    state.tableData.listQuery.pageIndex = 1;
    const gasObj = state.tableData.gasList.filter(item => {
        return item.id == state.tableData.listQuery.searchParams.gas
    });
    markLines.value = gasObj[0].threshold;
    initInfoData();
    console.log("vla",state.tableData.listQuery.searchParams)
}
const reset = () => {
    getNowTime();
    state.tableData.listQuery.searchParams.gas = state.tableData.gasList[0].id;
    markLines.value = state.tableData.gasList[0].threshold;
    state.tableData.listQuery.pageIndex = 1;
    initInfoData();
}
@@ -230,7 +237,7 @@
    if (myChart.value != null && myChart.value != "" && myChart.value != undefined) {
        myChart.value.dispose();
    }
     myChart.value = echarts.init(document.getElementById('gasChart'));
     myChart.value = echarts.init(document.getElementById(gasChart.value));
    // 指定图表的配置项和数据
    const option = {
        tooltip: {