From aa75a9d46ee325f0a92e42f733aabb1f92103aeb Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 28 三月 2025 17:44:29 +0800 Subject: [PATCH] 走航融合模块完成 --- src/components/monitor/FactorLegend.vue | 76 ++++++++++++++++++++++++++++++------- 1 files changed, 61 insertions(+), 15 deletions(-) diff --git a/src/components/monitor/FactorLegend.vue b/src/components/monitor/FactorLegend.vue index 56fc697..bcd447d 100644 --- a/src/components/monitor/FactorLegend.vue +++ b/src/components/monitor/FactorLegend.vue @@ -27,6 +27,18 @@ <span class="w-60 m-l-8">{{ item.unit }}</span> </el-row> </div> + <div> + 鍒囨崲缁樺浘妯″紡锛� + <el-switch + v-model="legendType" + width="60" + inline-prompt + style="" + active-text="鍔ㄦ��" + inactive-text="鏍囧噯" + @change="handleChange" + /> + </div> </template> </BaseCard> </template> @@ -43,21 +55,38 @@ default: () => new Factor() } }, + emits: ['change'], data() { - return {}; + return { + // 缁樺浘妯″紡锛宖alse: 鏍囧噯妯″紡锛泃rue锛氬姩鎬佹ā寮� + legendType: false, + legends: [] + }; + }, + watch: { + factor(nValue, oValue) { + if (nValue != oValue && nValue) { + this.legends = this.refreshLegend( + nValue.factorName, + nValue.legendType, + nValue.min, + nValue.max + ); + } + } }, computed: { - legends() { - const res = this.factor - ? this.refreshLegend( - this.factor.factorName, - this.factor.legendType, - this.factor.min, - this.factor.max - ) - : []; - return res; - } + // legends() { + // const res = this.factor + // ? this.refreshLegend( + // this.factor.factorName, + // this.factor.legendType, + // this.factor.min, + // this.factor.max + // ) + // : []; + // return res; + // } }, methods: { /** @@ -99,15 +128,27 @@ ', ' + color[3] + ')'; + const { scale = 1, unit = '' } = factorUnit[name]; legendList.push({ color: bgColor, - min: r[0], - max: nextR ? nextR[0] : undefined, - unit: factorUnit[name] ? factorUnit[name].unit : '' + min: r[0] * scale, + max: nextR ? nextR[0] * scale : undefined, + unit: unit }); } return legendList; + }, + + handleChange(value) { + this.$emit('change', value, () => { + this.legends = this.refreshLegend( + this.factor.factorName, + this.factor.legendType, + this.factor.min, + this.factor.max + ); + }); } } }; @@ -120,4 +161,9 @@ .text-center { text-align: center; } + +.el-switch { + --el-switch-on-color: #1f9956; + --el-switch-off-color: #8b8b8b; +} </style> -- Gitblit v1.9.3