|
@@ -106,6 +106,7 @@
|
|
|
<div class="main-body">
|
|
|
<keep-alive>
|
|
|
<component
|
|
|
+ ref="activeComponent"
|
|
|
:is="activeTab"
|
|
|
:codedata="tabData[activeTab].codedata"
|
|
|
v-bind="
|
|
@@ -276,10 +277,14 @@ export default {
|
|
|
});
|
|
|
|
|
|
axios
|
|
|
- .get(`/ETLapi/waveData/getAllSamplingFrequency/${data.codeNumber}`)
|
|
|
- .then((res) => {
|
|
|
- condition.frequencyoptions = res.data.datas;
|
|
|
- });
|
|
|
+ .get(`/ETLapi/waveData/getAllSamplingFrequency/${data.codeNumber}`)
|
|
|
+.then((res) => {
|
|
|
+ condition.frequencyoptions = (res.data.datas || [])
|
|
|
+ .map(item => Number(item))
|
|
|
+ .filter(num => num >= 12800)
|
|
|
+ .map(num => num.toString());
|
|
|
+});
|
|
|
+
|
|
|
|
|
|
condition.companyCode = data.codeNumber;
|
|
|
},
|
|
@@ -337,114 +342,122 @@ export default {
|
|
|
|
|
|
conditions(page, isPageChange = false) {
|
|
|
const tab = this.activeTab;
|
|
|
- const condition = this.tabConditions[tab];
|
|
|
-
|
|
|
- if (tab === "Temperature") {
|
|
|
- const temperature = {
|
|
|
- windCode: condition.companyCode,
|
|
|
- windTurbineNumberList: [condition.unitvalue],
|
|
|
- startTime: this.$formatDateTWO(condition.timevalue[0]),
|
|
|
- endTime: this.$formatDateTWO(condition.timevalue[1]),
|
|
|
- pageNo: page,
|
|
|
- pageSize: 500,
|
|
|
- }
|
|
|
-
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: "温度诊断数据加载中,请稍候…",
|
|
|
- spinner: "el-icon-loading",
|
|
|
- background: "rgba(0, 0, 0, 0.8)",
|
|
|
- })
|
|
|
-
|
|
|
- const emptyEchartsData = {
|
|
|
- gearbox_oil: { timestamps: [], values: [] },
|
|
|
- generator_drive_end: { timestamps: [], values: [] },
|
|
|
- generator_nondrive_end: { timestamps: [], values: [] },
|
|
|
- main_bearing: { timestamps: [], values: [] },
|
|
|
- }
|
|
|
-
|
|
|
- const trendRequest = () => {
|
|
|
- const trendStart = performance.now()
|
|
|
- return axios
|
|
|
- .post("/WJJdiag/SPRT/trend", temperature)
|
|
|
- .then((res) => {
|
|
|
- const trendEnd = performance.now()
|
|
|
- console.log(
|
|
|
- `温度诊断 trend 接口耗时: ${(
|
|
|
- (trendEnd - trendStart) /
|
|
|
- 1000
|
|
|
- ).toFixed(2)}s`
|
|
|
- )
|
|
|
- const echartsdata = res.data.data || {}
|
|
|
- this.tabData[tab].echartsdata = echartsdata
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error("趋势图请求失败:", err)
|
|
|
- this.$message.error("温度趋势图数据请求失败,请稍后再试")
|
|
|
- })
|
|
|
- }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const comp = this.$refs.activeComponent;
|
|
|
+ if (comp && typeof comp.reset === "function") {
|
|
|
+ comp.reset();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- const thresholdStart = performance.now()
|
|
|
- const thresholdReq = axios
|
|
|
- .post("/WJJdiag/temperature/threshold", temperature)
|
|
|
- .then((res) => {
|
|
|
- const thresholdEnd = performance.now()
|
|
|
- console.log(
|
|
|
- `温度诊断 threshold 接口耗时: ${(
|
|
|
- (thresholdEnd - thresholdStart) /
|
|
|
- 1000
|
|
|
- ).toFixed(2)}s`
|
|
|
- )
|
|
|
-
|
|
|
- const data = res.data.data.records || []
|
|
|
- this.tabData[tab].codedata = data
|
|
|
- this.tabData[tab].totalCount = res.data.data.totalSize || 0
|
|
|
-
|
|
|
- if (!data.length) {
|
|
|
- this.$message.warning("暂无诊断数据")
|
|
|
- // 清空echartsdata为固定空结构
|
|
|
- this.tabData[tab].echartsdata = emptyEchartsData
|
|
|
- return Promise.resolve("skip trend")
|
|
|
- }
|
|
|
+ // 把后面接口请求部分放进延迟里,确保 reset 先执行完成
|
|
|
+ setTimeout(() => {
|
|
|
+ const condition = this.tabConditions[tab];
|
|
|
+
|
|
|
+ if (tab === "Temperature") {
|
|
|
+ const temperature = {
|
|
|
+ windCode: condition.companyCode,
|
|
|
+ windTurbineNumberList: [condition.unitvalue],
|
|
|
+ startTime: this.$formatDateTWO(condition.timevalue[0]),
|
|
|
+ endTime: this.$formatDateTWO(condition.timevalue[1]),
|
|
|
+ pageNo: page,
|
|
|
+ pageSize: 500,
|
|
|
+ };
|
|
|
+
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: "温度诊断数据加载中,请稍候…",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.8)",
|
|
|
+ });
|
|
|
|
|
|
- // 有数据时,根据是否分页决定是否请求趋势图
|
|
|
- return isPageChange ? Promise.resolve() : trendRequest()
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error("温度诊断请求失败:", err)
|
|
|
- this.$message.error("温度诊断数据请求失败,请稍后再试")
|
|
|
- })
|
|
|
+ const emptyEchartsData = {
|
|
|
+ gearbox_oil: { timestamps: [], values: [] },
|
|
|
+ generator_drive_end: { timestamps: [], values: [] },
|
|
|
+ generator_nondrive_end: { timestamps: [], values: [] },
|
|
|
+ main_bearing: { timestamps: [], values: [] },
|
|
|
+ };
|
|
|
+
|
|
|
+ const trendRequest = () => {
|
|
|
+ const trendStart = performance.now();
|
|
|
+ return axios
|
|
|
+ .post("/AnalysisMulti/SPRT/trend", temperature)
|
|
|
+ .then((res) => {
|
|
|
+ const trendEnd = performance.now();
|
|
|
+ console.log(
|
|
|
+ `温度诊断 trend 接口耗时: ${(
|
|
|
+ (trendEnd - trendStart) /
|
|
|
+ 1000
|
|
|
+ ).toFixed(2)}s`
|
|
|
+ );
|
|
|
+ const echartsdata = res.data.data || {};
|
|
|
+ this.tabData[tab].echartsdata = echartsdata;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error("趋势图请求失败:", err);
|
|
|
+ this.$message.error("温度趋势图数据请求失败,请稍后再试");
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const thresholdStart = performance.now();
|
|
|
+ const thresholdReq = axios
|
|
|
+ .post("/AnalysisMulti/temperature/threshold", temperature)
|
|
|
+ .then((res) => {
|
|
|
+ const thresholdEnd = performance.now();
|
|
|
+ console.log(
|
|
|
+ `温度诊断 threshold 接口耗时: ${(
|
|
|
+ (thresholdEnd - thresholdStart) /
|
|
|
+ 1000
|
|
|
+ ).toFixed(2)}s`
|
|
|
+ );
|
|
|
|
|
|
- Promise.resolve(thresholdReq).finally(() => {
|
|
|
- loading.close()
|
|
|
- })
|
|
|
- } else {
|
|
|
- const params = {
|
|
|
- samplingFrequency: condition.frequencyvalue,
|
|
|
- windCode: condition.companyCode,
|
|
|
- windTurbineNumberList: [condition.unitvalue],
|
|
|
- mesureNameList: [condition.monitoringvalue],
|
|
|
- startTime: this.$formatDateTWO(condition.timevalue[0]),
|
|
|
- endTime: this.$formatDateTWO(condition.timevalue[1]),
|
|
|
- pageNo: page,
|
|
|
- pageSize: 10,
|
|
|
- };
|
|
|
-
|
|
|
- const startTime = performance.now();
|
|
|
- axios
|
|
|
- .post("/ETLapi/waveData/getMesureDataWithSF", params)
|
|
|
- .then((res) => {
|
|
|
- const endTime = performance.now();
|
|
|
- console.log(
|
|
|
- `其他 tab 接口请求耗时: ${(endTime - startTime).toFixed(2)}ms`
|
|
|
- );
|
|
|
+ const data = res.data.data.records || [];
|
|
|
+ this.tabData[tab].codedata = data;
|
|
|
+ this.tabData[tab].totalCount = res.data.data.totalSize || 0;
|
|
|
+
|
|
|
+ if (!data.length) {
|
|
|
+ this.$message.warning("暂无诊断数据");
|
|
|
+ this.tabData[tab].echartsdata = emptyEchartsData;
|
|
|
+ return Promise.resolve("skip trend");
|
|
|
+ }
|
|
|
+
|
|
|
+ return isPageChange ? Promise.resolve() : trendRequest();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error("温度诊断请求失败:", err);
|
|
|
+ this.$message.error("温度诊断数据请求失败,请稍后再试");
|
|
|
+ });
|
|
|
|
|
|
- const data = res.data || {};
|
|
|
- this.tabData[tab].codedata = data.datas || [];
|
|
|
- this.tabData[tab].totalCount = data.totalCount || 0;
|
|
|
- this.tabData[tab].totalPage = data.totalPage || 0;
|
|
|
+ Promise.resolve(thresholdReq).finally(() => {
|
|
|
+ loading.close();
|
|
|
});
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ const params = {
|
|
|
+ samplingFrequency: condition.frequencyvalue,
|
|
|
+ windCode: condition.companyCode,
|
|
|
+ windTurbineNumberList: [condition.unitvalue],
|
|
|
+ mesureNameList: [condition.monitoringvalue],
|
|
|
+ startTime: this.$formatDateTWO(condition.timevalue[0]),
|
|
|
+ endTime: this.$formatDateTWO(condition.timevalue[1]),
|
|
|
+ pageNo: page,
|
|
|
+ pageSize: 10,
|
|
|
+ };
|
|
|
+
|
|
|
+ const startTime = performance.now();
|
|
|
+ axios
|
|
|
+ .post("/ETLapi/waveData/getMesureDataWithSF", params)
|
|
|
+ .then((res) => {
|
|
|
+ const endTime = performance.now();
|
|
|
+ console.log(
|
|
|
+ `其他 tab 接口请求耗时: ${(endTime - startTime).toFixed(2)}ms`
|
|
|
+ );
|
|
|
+
|
|
|
+ const data = res.data || {};
|
|
|
+ this.tabData[tab].codedata = data.datas || [];
|
|
|
+ this.tabData[tab].totalCount = data.totalCount || 0;
|
|
|
+ this.tabData[tab].totalPage = data.totalPage || 0;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, 300); // 延迟100毫秒执行接口请求逻辑
|
|
|
},
|
|
|
},
|
|
|
};
|