| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 | 
							- <template>
 
-   <div ref="chart" class="chart" :style="{height: '400px', width: '100%'}" />
 
- </template>
 
- <script>
 
- import * as echarts from "echarts";
 
- import resize from '@/utils/resize'
 
- export default {
 
-   mixins: [resize],
 
-   props: {
 
-     plain: Object,
 
-   },
 
-   mounted() {
 
-     this.$nextTick(() => {
 
-       this.chart = echarts.init(this.$refs.chart, 'macarons');
 
-     })
 
-   },
 
-   beforeDestroy() {
 
-     if (!this.chart) {
 
-       return
 
-     }
 
-     this.chart.dispose()
 
-     this.chart = null
 
-   },
 
-   watch: {
 
-     plain: {
 
-       handler(value) {
 
-         this.setOptions(value)
 
-       },
 
-       deep: true,
 
-       immediate: true,
 
-     }
 
-   },
 
-   methods: {
 
-     setOptions(plain) {
 
-       if (!this.chart) {
 
-         return;
 
-       }
 
-       const { sections, wlevelmax, wlevelmin, wlevel } = plain;
 
-       const seriesData = sections.map(({ x, y }) => [x, y]);
 
-       const options = {
 
-         xAxis: {
 
-           name: '起点距',
 
-           boundaryGap: false,
 
-           type: 'value',
 
-           min: 'dataMin',
 
-           max: 'dataMax',
 
-           axisLine: {
 
-             lineStyle: {
 
-               color: '#FF8500'
 
-             }
 
-           },
 
-           axisTick: {
 
-             lineStyle: {
 
-               color: '#8D99A4'
 
-             }
 
-           },
 
-           axisLabel: {
 
-             color: '#54606C'
 
-           },
 
-           nameTextStyle: {
 
-             color: '#54606C'
 
-           }
 
-         },
 
-         yAxis: [
 
-           {
 
-             name: '高程(m)',
 
-             triggerEvent: true,
 
-             axisLine: {
 
-               show: true,
 
-               lineStyle: {
 
-                 color: '#FF8500'
 
-               }
 
-             },
 
-             axisTick: {
 
-               show: true,
 
-               lineStyle: {
 
-                 color: '#8D99A4'
 
-               }
 
-             },
 
-             axisLabel: {
 
-               color: '#54606C'
 
-             },
 
-             nameTextStyle: {
 
-               color: '#54606C'
 
-             },
 
-             min: 'dataMin',
 
-             max: 'dataMax',
 
-           },
 
-           {
 
-             axisLine: {
 
-               show: true,
 
-               lineStyle: {
 
-                 color: '#FF8500'
 
-               }
 
-             },
 
-             axisTick: {
 
-               show: false,
 
-             },
 
-             axisLabel: {
 
-               show: false,
 
-             },
 
-           },
 
-         ],
 
-         grid: {
 
-           left: 50,
 
-           right: 50,
 
-           bottom: 40,
 
-           top: 40,
 
-           containLabel: true
 
-         },
 
-         tooltip: {
 
-           trigger: 'axis',
 
-           axisPointer: {
 
-             type: 'cross'
 
-           },
 
-           padding: [5, 10]
 
-         },
 
-         series: [{
 
-           name: '高程',
 
-           itemStyle: {
 
-             normal: {
 
-               color: '#FF8500',
 
-               lineStyle: {
 
-                 color: '#FF8500',
 
-                 width: 2
 
-               }
 
-             }
 
-           },
 
-           areaStyle: {
 
-             color: '#FF8500',
 
-             opacity: 0.5
 
-           },
 
-           smooth: false,
 
-           symbol: 'none',
 
-           type: 'line',
 
-           data: seriesData,
 
-           animations: false,
 
-           markLine: {
 
-             symbol: 'none',
 
-             silent: true,
 
-             lineStyle: { normal: { type: 'dashed' } },
 
-             label: { position: 'start' },
 
-             data: [
 
-               {
 
-                 yAxis: wlevelmax,
 
-                 lineStyle: { width: 1, color: 'red' },
 
-                 name: '最高水位',
 
-                 label: {
 
-                   formatter: '{b}'
 
-                 }
 
-               },
 
-               {
 
-                 yAxis: wlevelmin,
 
-                 lineStyle: { width: 1, color: 'red' },
 
-                 name: '最低水位',
 
-                 label: {
 
-                   formatter: '{b}'
 
-                 }
 
-               },
 
-             ]
 
-           },
 
-         }]
 
-       };
 
-       if (wlevel > wlevelmin && wlevel < wlevelmax) {
 
-         options.series.push({
 
-           name: '起测水位',
 
-           symbol: 'none',
 
-           silent: true,
 
-           lineStyle: {
 
-             width: 0,
 
-           },
 
-           data: new Array(seriesData.length).fill(wlevel),
 
-           type: 'line',
 
-           markLine: {
 
-             symbol: 'none',
 
-             silent: true,
 
-             lineStyle: { normal: { type: 'dashed' } },
 
-             label: { position: 'start' },
 
-             data: [{
 
-               name: '起测水位',
 
-               yAxis: wlevel,
 
-               label: {
 
-                 formatter: '{b}'
 
-               }
 
-             }],
 
-           },
 
-         });
 
-       }
 
-       this.chart.setOption(options);
 
-     }
 
-   }
 
- }
 
- </script>
 
- <style scoped>
 
- </style>
 
 
  |