Browse Source

feat:说明

master
waibao2 1 month ago
parent
commit
8011336968
  1. 2
      README.md
  2. 36
      src/components/ChartsBar/index.vue
  3. 34
      src/components/ChartsBarLine/index.vue
  4. 34
      src/components/ChartsDataZoom/index.vue
  5. 2
      src/components/HistoryData/index.vue
  6. 2
      src/components/TimeProcess/index.vue
  7. 2
      src/components/ZhengBian/index.vue
  8. 2
      src/views/statistic/rain/lxwy.vue
  9. 566
      src/views/statistic/rain/lxyy.vue
  10. 2
      src/views/statistic/rain/sdjsl.vue

2
README.md

@ -44,7 +44,7 @@ yarn dev
* seriesData:只有一个对象的时候使用 * seriesData:只有一个对象的时候使用
2. ChartsBarLine 2. ChartsBarLine
* seriesData:是数组的时候使用 * seriesData:是数组的时候使用
2. ChartsTimeBar 2. ChartsDataZoom
* 时间轴的趋势图(缩放echarts使用) * 时间轴的趋势图(缩放echarts使用)
* legendData: 图例数据 * legendData: 图例数据
* xAxisData: x轴数据 * xAxisData: x轴数据

36
src/components/ChartsBar/index.vue

@ -1,6 +1,6 @@
<template> <template>
<!-- <div > --> <!-- <div > -->
<div ref="ChartsTimeBarRef" style="height:100%;width: 100%;" class="chart-container"></div> <div ref="ChartsBarRef" style="height:100%;width: 100%;" class="chart-container"></div>
<!-- </div> --> <!-- </div> -->
</template> </template>
<script setup> <script setup>
@ -60,7 +60,7 @@
}) })
const ChartsTimeBarRef = ref(null); const ChartsBarRef = ref(null);
let echartsBar = null; let echartsBar = null;
let resizeObserver = null; let resizeObserver = null;
// props // props
@ -73,16 +73,16 @@
initEcharts(); initEcharts();
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
// //
if (ChartsTimeBarRef.value) { if (ChartsBarRef.value) {
resizeObserver = new ResizeObserver(handleResize); resizeObserver = new ResizeObserver(handleResize);
resizeObserver.observe(ChartsTimeBarRef.value); resizeObserver.observe(ChartsBarRef.value);
} }
}); });
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener('resize', handleResize); window.removeEventListener('resize', handleResize);
if (resizeObserver && ChartsTimeBarRef.value) { if (resizeObserver && ChartsBarRef.value) {
resizeObserver.unobserve(ChartsTimeBarRef.value); resizeObserver.unobserve(ChartsBarRef.value);
} }
if (echartsBar) { if (echartsBar) {
echartsBar.dispose(); echartsBar.dispose();
@ -91,17 +91,17 @@
const echartsLoading = ref(true); const echartsLoading = ref(true);
const initEcharts = () => { const initEcharts = () => {
nextTick(() => { nextTick(() => {
if (ChartsTimeBarRef.value) { if (ChartsBarRef.value) {
echartsBar = echarts.init(ChartsTimeBarRef.value, "macarons"); echartsBar = echarts.init(ChartsBarRef.value, "macarons");
let option = getChartOption(); let option = getChartOption();
echartsBar.setOption(option); echartsBar.setOption(option);
// //
const resizeChart = () => { const resizeChart = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsBarRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight height: ChartsBarRef.value.clientHeight
}); });
} }
}; };
@ -122,22 +122,22 @@
}; };
const resizeChart = () => { const resizeChart = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsBarRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight height: ChartsBarRef.value.clientHeight
}); });
} }
}; };
const handleResize = () => { const handleResize = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarRef.value) {
// //
clearTimeout(window.resizeTimer); clearTimeout(window.resizeTimer);
window.resizeTimer = setTimeout(() => { window.resizeTimer = setTimeout(() => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsBarRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight, height: ChartsBarRef.value.clientHeight,
animation: { animation: {
duration: 300 duration: 300
} }

34
src/components/ChartsBarLine/index.vue

@ -1,6 +1,6 @@
<template> <template>
<!-- <div > --> <!-- <div > -->
<div ref="ChartsTimeBarRef" style="height:100%;width: 100%;" class="chart-container"></div> <div ref="ChartsBarLineRef" style="height:100%;width: 100%;" class="chart-container"></div>
<!-- </div> --> <!-- </div> -->
</template> </template>
<script setup> <script setup>
@ -46,7 +46,7 @@
} }
}) })
const ChartsTimeBarRef = ref(null); const ChartsBarLineRef = ref(null);
let echartsBar = null; let echartsBar = null;
let resizeObserver = null; let resizeObserver = null;
// props // props
@ -62,16 +62,16 @@
initEcharts(); initEcharts();
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
// //
if (ChartsTimeBarRef.value) { if (ChartsBarLineRef.value) {
resizeObserver = new ResizeObserver(handleResize); resizeObserver = new ResizeObserver(handleResize);
resizeObserver.observe(ChartsTimeBarRef.value); resizeObserver.observe(ChartsBarLineRef.value);
} }
}); });
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener('resize', handleResize); window.removeEventListener('resize', handleResize);
if (resizeObserver && ChartsTimeBarRef.value) { if (resizeObserver && ChartsBarLineRef.value) {
resizeObserver.unobserve(ChartsTimeBarRef.value); resizeObserver.unobserve(ChartsBarLineRef.value);
} }
if (echartsBar) { if (echartsBar) {
echartsBar.dispose(); echartsBar.dispose();
@ -80,17 +80,17 @@
const echartsLoading = ref(true); const echartsLoading = ref(true);
const initEcharts = () => { const initEcharts = () => {
nextTick(() => { nextTick(() => {
if (ChartsTimeBarRef.value) { if (ChartsBarLineRef.value) {
echartsBar = echarts.init(ChartsTimeBarRef.value, "macarons"); echartsBar = echarts.init(ChartsBarLineRef.value, "macarons");
let option = getChartOption(); let option = getChartOption();
echartsBar.setOption(option); echartsBar.setOption(option);
// //
const resizeChart = () => { const resizeChart = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarLineRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsBarLineRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight height: ChartsBarLineRef.value.clientHeight
}); });
} }
}; };
@ -111,21 +111,21 @@
}; };
const resizeChart = () => { const resizeChart = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarLineRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsBarLineRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight height: ChartsBarLineRef.value.clientHeight
}); });
} }
}; };
const handleResize = () => { const handleResize = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsBarLineRef.value) {
// //
clearTimeout(window.resizeTimer); clearTimeout(window.resizeTimer);
window.resizeTimer = setTimeout(() => { window.resizeTimer = setTimeout(() => {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsBarLineRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight, height: ChartsBarLineRef.value.clientHeight,
animation: { animation: {
duration: 300 duration: 300
} }

34
src/components/ChartsTimeBar/index.vue → src/components/ChartsDataZoom/index.vue

@ -1,6 +1,6 @@
<template> <template>
<!-- <div > --> <!-- <div > -->
<div ref="ChartsTimeBarRef" style="height:100%;width: 100%;" class="chart-container"></div> <div ref="ChartsDataZoomRef" style="height:100%;width: 100%;" class="chart-container"></div>
<!-- </div> --> <!-- </div> -->
</template> </template>
<script setup> <script setup>
@ -38,7 +38,7 @@
} }
}) })
const ChartsTimeBarRef = ref(null); const ChartsDataZoomRef = ref(null);
let echartsBar = null; let echartsBar = null;
let resizeObserver = null; let resizeObserver = null;
// props // props
@ -51,16 +51,16 @@
initEcharts(); initEcharts();
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
// //
if (ChartsTimeBarRef.value) { if (ChartsDataZoomRef.value) {
resizeObserver = new ResizeObserver(handleResize); resizeObserver = new ResizeObserver(handleResize);
resizeObserver.observe(ChartsTimeBarRef.value); resizeObserver.observe(ChartsDataZoomRef.value);
} }
}); });
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener('resize', handleResize); window.removeEventListener('resize', handleResize);
if (resizeObserver && ChartsTimeBarRef.value) { if (resizeObserver && ChartsDataZoomRef.value) {
resizeObserver.unobserve(ChartsTimeBarRef.value); resizeObserver.unobserve(ChartsDataZoomRef.value);
} }
if (echartsBar) { if (echartsBar) {
echartsBar.dispose(); echartsBar.dispose();
@ -69,17 +69,17 @@
const echartsLoading = ref(true); const echartsLoading = ref(true);
const initEcharts = () => { const initEcharts = () => {
nextTick(() => { nextTick(() => {
if (ChartsTimeBarRef.value) { if (ChartsDataZoomRef.value) {
echartsBar = echarts.init(ChartsTimeBarRef.value, "macarons"); echartsBar = echarts.init(ChartsDataZoomRef.value, "macarons");
let option = getChartOption(); let option = getChartOption();
echartsBar.setOption(option); echartsBar.setOption(option);
// //
const resizeChart = () => { const resizeChart = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsDataZoomRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsDataZoomRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight height: ChartsDataZoomRef.value.clientHeight
}); });
} }
}; };
@ -100,21 +100,21 @@
}; };
const resizeChart = () => { const resizeChart = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsDataZoomRef.value) {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsDataZoomRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight height: ChartsDataZoomRef.value.clientHeight
}); });
} }
}; };
const handleResize = () => { const handleResize = () => {
if (echartsBar && ChartsTimeBarRef.value) { if (echartsBar && ChartsDataZoomRef.value) {
// //
clearTimeout(window.resizeTimer); clearTimeout(window.resizeTimer);
window.resizeTimer = setTimeout(() => { window.resizeTimer = setTimeout(() => {
echartsBar.resize({ echartsBar.resize({
width: ChartsTimeBarRef.value.clientWidth, width: ChartsDataZoomRef.value.clientWidth,
height: ChartsTimeBarRef.value.clientHeight, height: ChartsDataZoomRef.value.clientHeight,
animation: { animation: {
duration: 300 duration: 300
} }

2
src/components/HistoryData/index.vue

@ -72,7 +72,7 @@
import { ref, reactive, watch, toRaw, computed, onMounted } from 'vue' import { ref, reactive, watch, toRaw, computed, onMounted } from 'vue'
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import ESelectSingle from '@/components/ESelectSingle/index.vue' import ESelectSingle from '@/components/ESelectSingle/index.vue'
import TimeBarChart from '@/components/ChartsTimeBar/index.vue' import TimeBarChart from '@/components/ChartsDataZoom/index.vue'
import { import {
Splitpanes, Splitpanes,

2
src/components/TimeProcess/index.vue

@ -59,7 +59,7 @@
} from 'splitpanes' } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import BarChart from '@/components/ChartsBar/index.vue' import BarChart from '@/components/ChartsBar/index.vue'
import TimeBarChart from '@/components/ChartsTimeBar/index.vue' import TimeBarChart from '@/components/ChartsDataZoom/index.vue'
import ETree from '@/components/ETree/index.vue' import ETree from '@/components/ETree/index.vue'
import useAppStore from '@/store/modules/app' import useAppStore from '@/store/modules/app'

2
src/components/ZhengBian/index.vue

@ -121,7 +121,7 @@
Pane Pane
} from 'splitpanes' } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import TimeBarChart from '@/components/ChartsTimeBar/index.vue' import TimeBarChart from '@/components/ChartsDataZoom/index.vue'
import ESelectSingle from '@/components/ESelectSingle/index.vue' import ESelectSingle from '@/components/ESelectSingle/index.vue'
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import useAppStore from '@/store/modules/app' import useAppStore from '@/store/modules/app'

2
src/views/statistic/rain/lxwy.vue

@ -130,7 +130,7 @@
Pane Pane
} from 'splitpanes' } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import TimeBarChart from '@/components/ChartsTimeBar/index.vue' import TimeBarChart from '@/components/ChartsDataZoom/index.vue'
import useAppStore from '@/store/modules/app' import useAppStore from '@/store/modules/app'
const device = computed(() => useAppStore().device); const device = computed(() => useAppStore().device);

566
src/views/statistic/rain/lxyy.vue

@ -1,126 +1,48 @@
<!-- 有效降雨日统计 -->
<template> <template>
<div class="app-container app-container-bg"> <div class="app-container app-container-bg">
<el-card class="first-card" ref='firstCard' shadow="always"> <el-card class="first-card" ref='firstCard' shadow="always">
<el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent> <el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent>
<el-form-item label="站点"> <el-form-item label="指标(大于)">
<el-cascader v-model="defaultOption" placeholder="请选择站点" :options="selectOptions" style="width: 250px;" filterable clearable></el-cascader> <el-input placeholder="请输入指标(大于)" v-model="queryParams.filterText" clearable @keyup.enter.native="handleQuery"> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="开始时间"> <el-form-item label="开始时间">
<el-date-picker v-model="queryParams.startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" placeholder="选择开始时间" :disabled-date="disabledStartDate"> <el-date-picker class="picker-year" v-model="queryParams.startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" placeholder="选择开始时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="结束时间"> <el-form-item label="结束时间">
<el-date-picker v-model="queryParams.endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择结束时间" :disabled-date="disabledEndDate"> <el-date-picker class="picker-year" v-model="queryParams.endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" placeholder="选择结束时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item>
<el-checkbox v-model="queryParams.xindao" @change='handleQuery' :true-label="1" :false-label="0">遥测数据</el-checkbox>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">查询</el-button> <el-button type="primary" icon="Search" @click="handleQuery">查询</el-button>
<el-switch class="ml20" v-model="staticType" size="large" inline-prompt style="--el-switch-on-color: #13ce66; --el-switch-off-color: #1890FF" active-text="逐日显示" inactive-text="逐时显示" />
</el-form-item>
<br />
<el-form-item label="对比站点">
<el-cascader v-model="defaultOption2" placeholder="请选择对比站" :options="selectOptions2" :props="{multiple: true, }" :show-all-levels="false" collapse-tags filterable clearable></el-cascader>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="compareQuery" icon="Search">对比查询</el-button>
<el-button type="success" plain icon="Edit" @click="updateData">数据修改</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<splitpanes :horizontal="device === 'mobile'" class="el-card-p card-shadow carder-border mt10 pad10 default-theme container-box" :push-other-panes="false"> <splitpanes :horizontal="device === 'mobile'" class="el-card-p card-shadow carder-border mt10 pad10 default-theme container-box" :push-other-panes="false">
<pane :size="firstSize" :min-size="SPLITPANES_CONFIG.MIN_SIZE" :max-size="SPLITPANES_CONFIG.MAX_SIZE" ref="firstPane" class="mr10"> <pane :size="firstSize" :min-size="SPLITPANES_CONFIG.MIN_SIZE" :max-size="SPLITPANES_CONFIG.MAX_SIZE" ref="firstPane" class="mr10">
<el-collapse v-model="activeName" accordion @change="handleChangeCollapse"> <e-tree ref="eTreeRef" :stationType="stationType" @stationChange="handleStationChange" @loadingChange="handleStationLoading"></e-tree>
<el-collapse-item title="预处理数据" name="1">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="yclExport">导出 </el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="RefreshRight" @click="yclUpdate"> 整编 </el-button>
</el-col>
</el-row>
<!-- <el-table v-loading="loading" :data="tableData1" height="450" border style="width:100%">
<el-table-column prop="tm" label="时间" width="170">
</el-table-column>
<el-table-column prop="value" label="数值">
<template #default="scope">
<el-input type="text" v-model="scope.row.value" />
</template>
</el-table-column>
</el-table> -->
<vxe-grid v-bind="gridOptions1"></vxe-grid>
</el-collapse-item>
<el-collapse-item :title="stationType==='A'?'小时数据':'摘录数据'" name="2">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="hourExport">导出 </el-button>
</el-col>
</el-row>
<!-- <el-table v-loading="loading" :data="tableData1" height="450" border style="width:100%">
<el-table-column prop="tm" label="时间" width="170">
</el-table-column>
<el-table-column prop="value" label="数值">
<template #default="scope">
<el-input type="text" v-model="scope.row.value" />
</template>
</el-table-column>
</el-table> -->
<vxe-grid v-bind="gridOptions2"></vxe-grid>
</el-collapse-item>
<el-collapse-item title="遥测数据" name="3">
<!-- <el-table :data="tableData3" height="450" border>
<el-table-column width="180" :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead" :key="index">
</el-table-column>
</el-table> -->
<vxe-grid v-bind="gridOptions3"></vxe-grid>
</el-collapse-item>
</el-collapse>
</pane> </pane>
<pane :size="100 - firstSize"> <pane :size="100 - firstSize" style="height: 100%;">
<div v-table-height='{bottom:0}' style="width:100%;"> <div class="main-table-header">
<TimeBarChart v-loading="echartsLoading" :legendData='legendData' :xAxisData="xAxisData" :seriesData="seriesData" :textTitle="textTitle" :unit="unit" :echartType="echartType" /> <div class="table-title">{{tableTitle}}</div>
<div class="table-time mb5">
<div>
<span>时间: </span><span id="title1">{{ tableTime}}</span>
</div> </div>
</pane> <div>
</splitpanes> <span>单位: </span><span id="title2"></span>
<el-dialog class="custom-dialog" title="数据修改" v-model="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
<el-form-item label="修改方式" prop="updateType">
<el-select v-model="form.updateType" placeholder="请选择修改方式">
<el-option v-for="dict in update_type_options" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="开始时间" v-if="form.updateType!='2'&&form.updateType!=null">
<el-date-picker v-model="form.startTime" type="datetime" placeholder="选择开始时间" value-format="yyyy-MM-dd HH:mm:ss" class="w320">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" v-if="form.updateType!='2'&&form.updateType!=null">
<el-date-picker v-model="form.endTime" type="datetime" placeholder="选择结束时间" value-format="yyyy-MM-dd HH:mm:ss" class="w320">
</el-date-picker>
</el-form-item>
<el-form-item label="替换值" v-if="form.updateType=='1'">
<el-input v-model="form.value1" placeholder="请输入替换值" style="width:220px" />
</el-form-item>
<div style="width:80%;margin: 0 auto;" v-if="form.updateType=='2'">
<el-upload class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" multiple>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
将文件拖到此处<em>点击上传</em>
</div> </div>
</el-upload>
</div> </div>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm(formRef)" v-loading='btnLoading'> </el-button>
<el-button @click="cancel"> </el-button>
</div> </div>
</template> <el-table v-table-height v-loading="loading" :data="tableData" border :span-method="arraySpanMethod">
</el-dialog> <el-table-column :align="alignment" v-for="column in tableColumns" :key="column.prop" :prop="column.prop" :label="column.label" :min-width="column.width || 120">
</el-table-column>
</el-table>
</pane>
</splitpanes>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -130,373 +52,165 @@
Pane Pane
} from 'splitpanes' } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import TimeBarChart from '@/components/ChartsTimeBar/index.vue' import ETree from '@/components/ETree/index.vue'
import useAppStore from '@/store/modules/app' import useAppStore from '@/store/modules/app'
const device = computed(() => useAppStore().device); const device = computed(() => useAppStore().device);
const props = defineProps({ const props = defineProps({
stationType: { tableTitle: {
type: String, type: String,
default: 'A' default: '表格标题'
}, },
requestPrefix: {
type: String,
default: '/ycraindata'
},
fixed: {
type: Number,
default: 1
}
}) })
const { const {
proxy proxy
} = getCurrentInstance() } = getCurrentInstance()
const { update_type_options } = proxy.useDict("update_type_options") // const { } = proxy.useDict("")
const textTitle = computed(() => {
switch (props.stationType) {
case 'A':
return '雨量过程线';
case 'B':
return '水位过程线';
case 'C':
return '水位过程线';
case 'D':
return '潮位过程线';
case 'E':
return '流量过程线';
}
});
const unit = computed(() => {
switch (props.stationType) {
case 'A':
return 'mm';
case 'B':
return 'm';
case 'C':
return 'm';
case 'D':
return 'm';
case 'E':
return 'm³/s';
}
});
const echartType = computed(() => {
switch (props.stationType) {
case 'A':
return 'bar';
case 'B':
return 'line';
case 'C':
return 'line';
case 'D':
return 'line';
case 'E':
return 'line';
}
});
const staticType = ref(0)
const queryParams = reactive({
startTime: dayjs().subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss'),
endTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
xindao: 1,
stnmId: null,
dataType: staticType.value,
chartType: echartType.value
});
//
const disabledStartDate = (time) => {
const endTime = queryParams.endTime ? dayjs(queryParams.endTime) : null;
return dayjs(time).isAfter(dayjs()) ||
(endTime && dayjs(time).isAfter(endTime));
};
//
const disabledEndDate = (time) => {
const startTime = queryParams.startTime ? dayjs(queryParams.startTime) : null;
return dayjs(time).isAfter(dayjs()) ||
(startTime && dayjs(time).isBefore(startTime));
};
//
const selectOptions = ref([]);
const selectOptions2 = ref([]);
const defaultOption = ref([])
const defaultOption2 = ref([])
const getSingleStation = async () => {
let res = await proxy.axiosGet('/basic/stype/getTreeStation2New/' + props.stationType);
if (res.code === 0) {
selectOptions.value = res.data;
defaultOption.value = res.defaultOption
queryParams.stnmId = defaultOption.value.length > 0 ? parseInt(defaultOption.value[2]) : null
queryParams.stnmIds = queryParams.stnmId
try {
await Promise.all([
drawTable1(),
drawTable2(),
drawTable3(),
getEchartsData()
]);
} catch (error) {
console.error('请求执行出错:', error);
}
}
}
const stationType = 'A'
const alignment = 'center'
const firstSize = ref(proxy.SPLITPANES_CONFIG.DEFAULT_SIZE) const firstSize = ref(proxy.SPLITPANES_CONFIG.DEFAULT_SIZE)
const eTreeRef = ref(null)
let stnmIdsList = []
const handleStationLoading = (loadingState) => {
loading.value = loadingState;
}
//
const handleStationChange = (stnmIds) => {
stnmIdsList = stnmIds
queryParams.stnmIds = stnmIds.join(',')
if (stnmIdsList.length == 0) {
proxy.$modal.msgWarning("请选择站点后查询");
return
} else if (stnmIdsList.length > 50) {
proxy.$modal.msg("站点最多可选择50个");
return
} else {
getList()
const activeName = ref('1')
const tableData1 = ref([])
const tableData2 = ref([])
const tableData3 = ref([])
//
const handleChangeCollapse = (val) => { }
//
const baseGridOptions = {
border: true,
loading: false,
showOverflow: false,
height: 450,
columnConfig: {
resizable: true
},
virtualYConfig: {
enabled: true,
gt: 0
}
} }
//
const gridOptions1 = reactive({
...baseGridOptions,
columns: [{
title: '时间',
field: 'tm',
width: 160,
align: "center"
},
{
title: '数值',
field: 'value',
align: "center"
} }
], const tableTime = computed(() => {
data: [] let startTime = dayjs(queryParams.startTime).format('YYYY-MM-DD')
let endTime = dayjs(queryParams.endTime).format('YYYY-MM-DD')
return `${startTime}${endTime}`
}) })
const queryParams = reactive({
startTime: dayjs().subtract(7, 'day').format('YYYY-MM-DD 08:00:00'),
endTime: dayjs().format('YYYY-MM-DD 08:00:00'),
stnmIds: '',
filterText: 1.0,
});
// const tableColumns = ref([])
const drawTable1 = async () => { const tableData = ref([])
gridOptions1.loading = true const loading = ref(false)
// getList
const getList = async () => {
loading.value = true;
try { try {
let url = props.requestPrefix + '/originaldata' let res = await proxy.axiosPost2('/report/yxjsr', queryParams)
let res = await proxy.axiosPost2(url, queryParams); if (res.code == 0) {
if (res.code === 0) { getZXTableData(res)
let data = res.data;
for (var i = 0; i < data.length; i++) {
data[i].value = data[i].value.toFixed(proxy.fixed)
}
gridOptions1.data = data
// selectOptions.value = res.data;
} }
} catch (error) { } catch (error) {
tableColumns.value = [];
tableData.value = [];
} finally { } finally {
gridOptions1.loading = false loading.value = false
} }
} }
// / const getZXTableData = (res) => {
const gridOptions2 = reactive({ let { year, list, name, max, min } = res.data;
...baseGridOptions, let columns = [
columns: [{ {
title: '时间', prop: "station",
field: 'tm', label: "站点"
width: 160,
align: "center"
}, },
{ {
title: '数值', prop: "type",
field: 'value', label: ""
align: "center" }
} ]
], //
data: [] year.forEach(item => {
}) columns.push({
// prop: item,
const drawTable2 = async () => { label: item
gridOptions2.loading = true
try {
let url = props.requestPrefix + '/countdata'
let res = await proxy.axiosPost2(url, queryParams);
if (res.code === 0) {
let data = res.data;
gridOptions2.data = data
}
gridOptions2.loading = false
} catch (error) {
gridOptions2.loading = false
}
}
//
const gridOptions3 = reactive({
...baseGridOptions,
columns: [],
data: []
})
//
const drawTable3 = async () => {
gridOptions3.loading = true
try {
let url = props.requestPrefix + '/xindaodaydata'
let res = await proxy.axiosPost2(url, queryParams);
if (res.code === 0) {
let data = res.data;
let header = data[0];
let tableColumn = []
tableColumn.push({
field: 'tm',
title: '时间',
width: 160,
align: "center"
}); });
for (let k in header) {
if (k != 'tm' && k != 'avg') {
tableColumn.push({
field: k,
title: k,
width: 100,
align: "center"
}); });
} columns.push(
}
gridOptions3.columns = tableColumn; {
gridOptions3.data = data prop: "max",
} label: "最大值",
gridOptions3.loading = false },
} catch (error) { {
gridOptions3.loading = false prop: "min",
} label: "最小值",
} }
// echarts );
const legendData = ref([]) tableColumns.value = columns
const xAxisData = ref([]) // -
const seriesData = ref([]) const processedData = [];
const echartsLoading = ref(false)
const getEchartsData = async () => { list.forEach((item, index) => {
echartsLoading.value = true // ""
let baseUrl = '/chartdata' const row1 = {
if (staticType.value == 1) { station: name[index],
baseUrl = "/chartdatabyday"; type: "天数"
}
try {
let url = props.requestPrefix + baseUrl
let res = await proxy.axiosPost2(url, queryParams);
if (res.code === 0) {
legendData.value = res.data.legend
// seriesdata
if (res.data.series && res.data.series.length > 0) {
// seriesdata
xAxisData.value = res.data.series[0].data.map(item => {
// item
if (typeof item === 'object' && item !== null) {
// tm, time, or the first element
const timeValue = item.tm || item.time || item[0];
return dayjs(timeValue).format('YYYY-MM-DD HH:mm');
} else {
// item
return dayjs(item).format('YYYY-MM-DD HH:mm');
}
});
}
seriesData.value = res.data.series
}
} catch (error) {
console.log(error)
} finally {
echartsLoading.value = false
}
}; };
//
year.forEach(y => {
row1[y] = item[0].value ? item[0].value.toFixed(1) : '-';
});
// //
const yclExport = () => { row1.max = max[index] && max[index].value ? max[index].value.toFixed(1) : '';
row1.min = min[index] && min[index].value ? min[index].value.toFixed(1) : '';
// // ""
const row2 = {
station: name[index],
type: "时间"
};
} //
// year.forEach(y => {
const yclUpdate = () => { row2[y] = item[0].tm ? item[0].tm.slice(5) : '-';
});
//
row2.max = max[index] && max[index].tm ? max[index].tm : '';
row2.min = min[index] && min[index].tm ? min[index].tm : '';
processedData.push(row1);
processedData.push(row2);
});
console.log(processedData, 'processedData')
tableData.value = processedData;
} }
//
const hourExport = () => { }
// //
const handleQuery = async () => { const handleQuery = async () => {
try { getList()
await Promise.all([ }
drawTable1(), //
drawTable2(), const arraySpanMethod = ({ row, column, rowIndex, columnIndex }) => {
drawTable3(), if (columnIndex === 0) {
getEchartsData() //
if (rowIndex % 2 === 0) {
]); //
} catch (error) { return [2, 1];
console.error('请求执行出错:', error); } else {
} //
} return [0, 0];
//
const compareQuery = () => {
}
let open = ref(false)
const form = reactive({
updateType: null
});
//
const updateData = () => {
open.value = true
}
/**************************************************** 数据修改弹窗 ******************************************************/
let formRef = ref(null)
//
const cancel = () => {
open.value = false;
reset();
} }
const reset = () => {
Object.assign(form, {});
proxy.resetForm("formRef");
} }
/** 提交按钮 */
const submitForm = async (formEl) => {
if (!formEl) return
await formEl.validate(async (valid, fields) => {
if (valid) {
try {
// let res = await proxy.axiosPost('/riverBasin', form);
// if (res.code === 0) {
// proxy.$modal.msgSuccess("");
// open.value = false;
// getList();
// }
} catch (error) { }
}
})
} }
onMounted(() => {
getSingleStation();
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-collapse) {
border-top: none !important;
}
</style> </style>

2
src/views/statistic/rain/sdjsl.vue

@ -67,7 +67,7 @@
} from 'splitpanes' } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import BarChart from '@/components/ChartsBar/index.vue' import BarChart from '@/components/ChartsBar/index.vue'
import TimeBarChart from '@/components/ChartsTimeBar/index.vue' import TimeBarChart from '@/components/ChartsDataZoom/index.vue'
import ETree from '@/components/ETree/index.vue' import ETree from '@/components/ETree/index.vue'
import useAppStore from '@/store/modules/app' import useAppStore from '@/store/modules/app'

Loading…
Cancel
Save