|
@@ -10,6 +10,10 @@ export default {
|
|
|
mixins: [resize],
|
|
|
props: {
|
|
|
plain: Object,
|
|
|
+ onlyShowCurrentPlain: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.$nextTick(() => {
|
|
@@ -37,7 +41,7 @@ export default {
|
|
|
if (!this.chart) {
|
|
|
return;
|
|
|
}
|
|
|
- const { sections, wlevelmax, wlevelmin, list } = plain;
|
|
|
+ const { sections, wlevelmax, wlevelmin, list, waterlevel } = plain;
|
|
|
const xAxisData = sections.map(({ x }) => x);
|
|
|
const seriesData = sections.map(({ x, y }) => ([x, y]));
|
|
|
const options = {
|
|
@@ -159,9 +163,9 @@ export default {
|
|
|
},
|
|
|
}]
|
|
|
};
|
|
|
- if (plain.waterlevel) {
|
|
|
+ if (waterlevel) {
|
|
|
options.series.push({
|
|
|
- data: [[Math.min(...xAxisData), plain.waterlevel],[Math.max(...xAxisData), plain.waterlevel]],
|
|
|
+ data: [[Math.min(...xAxisData), waterlevel],[Math.max(...xAxisData), waterlevel]],
|
|
|
type: 'line',
|
|
|
symbol: 'none',
|
|
|
z: 0,
|
|
@@ -174,6 +178,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ let hasSetCurrent = false;
|
|
|
list.forEach((plain, index) => {
|
|
|
const themes = [
|
|
|
'#2ec7c9',
|
|
@@ -188,6 +193,11 @@ export default {
|
|
|
'#9a7fd1',
|
|
|
]
|
|
|
const { wlevel, positions, planid } = plain;
|
|
|
+ if (this.onlyShowCurrentPlain && (hasSetCurrent || wlevel > waterlevel)) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ hasSetCurrent = true;
|
|
|
+ }
|
|
|
const positions1 = JSON.parse(positions) || [];
|
|
|
const pointsData = positions1.reduce((init, p) => {
|
|
|
const xIndex = xAxisData.findIndex(x => x === p.x);
|