|
@@ -117,35 +117,76 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.powerCurveData.turbines =
|
|
|
- this.lineMarkerData.data &&
|
|
|
- this.lineMarkerData.data.length > 0 &&
|
|
|
- this.lineMarkerData.data.filter(
|
|
|
- (item) => item.enginName !== "合同功率曲线"
|
|
|
- );
|
|
|
- this.powerCurveData.contractPowerCurve =
|
|
|
- this.lineMarkerData.data &&
|
|
|
- this.lineMarkerData.data.length > 0 &&
|
|
|
- this.lineMarkerData.data.filter(
|
|
|
- (item) => item.enginName === "合同功率曲线"
|
|
|
- );
|
|
|
- if (
|
|
|
- this.comType === "generalDrawing" &&
|
|
|
- this.lineMarkerData &&
|
|
|
- this.lineMarkerData.data
|
|
|
- ) {
|
|
|
- this.renderPlot();
|
|
|
- } else if (
|
|
|
- this.comType === "graph" &&
|
|
|
- this.lineMarkerData &&
|
|
|
- this.lineMarkerData.data
|
|
|
- ) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.initializeEngineCharts();
|
|
|
- });
|
|
|
- }
|
|
|
+ this.updateCharts(); // 初次渲染
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ lineMarkerData: {
|
|
|
+ deep: true,
|
|
|
+ handler() {
|
|
|
+ console.log("====================================");
|
|
|
+ console.log("变化了");
|
|
|
+ console.log("====================================");
|
|
|
+ this.updateCharts(); // 数据变化时更新
|
|
|
+ },
|
|
|
+ },
|
|
|
+ comType(newType, oldType) {
|
|
|
+ if (newType !== oldType) {
|
|
|
+ this.updateCharts(); // 类型变化时更新
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
+ // mounted() {
|
|
|
+ // console.log("====================================");
|
|
|
+ // console.log(this.lineMarkerData, "this.lineMarkerData");
|
|
|
+ // console.log("====================================");
|
|
|
+ // this.powerCurveData.turbines =
|
|
|
+ // this.lineMarkerData.data &&
|
|
|
+ // this.lineMarkerData.data.length > 0 &&
|
|
|
+ // this.lineMarkerData.data.filter(
|
|
|
+ // (item) => item.enginName !== "合同功率曲线"
|
|
|
+ // );
|
|
|
+ // this.powerCurveData.contractPowerCurve =
|
|
|
+ // this.lineMarkerData.data &&
|
|
|
+ // this.lineMarkerData.data.length > 0 &&
|
|
|
+ // this.lineMarkerData.data.filter(
|
|
|
+ // (item) => item.enginName === "合同功率曲线"
|
|
|
+ // );
|
|
|
+ // if (
|
|
|
+ // this.comType === "generalDrawing" &&
|
|
|
+ // this.lineMarkerData &&
|
|
|
+ // this.lineMarkerData.data
|
|
|
+ // ) {
|
|
|
+ // this.renderPlot();
|
|
|
+ // } else if (
|
|
|
+ // this.comType === "graph" &&
|
|
|
+ // this.lineMarkerData &&
|
|
|
+ // this.lineMarkerData.data
|
|
|
+ // ) {
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.initializeEngineCharts();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
methods: {
|
|
|
+ updateCharts() {
|
|
|
+ this.powerCurveData.turbines =
|
|
|
+ this.lineMarkerData.data?.filter(
|
|
|
+ (item) => item.enginName !== "合同功率曲线"
|
|
|
+ ) || [];
|
|
|
+
|
|
|
+ this.powerCurveData.contractPowerCurve =
|
|
|
+ this.lineMarkerData.data?.filter(
|
|
|
+ (item) => item.enginName === "合同功率曲线"
|
|
|
+ ) || [];
|
|
|
+
|
|
|
+ if (this.comType === "generalDrawing" && this.lineMarkerData?.data) {
|
|
|
+ this.renderPlot();
|
|
|
+ } else if (this.comType === "graph" && this.lineMarkerData?.data) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.initializeEngineCharts();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
renderPlot() {
|
|
|
const data = [];
|
|
|
// Add traces for each turbine with colors from config
|