|
@@ -91,11 +91,12 @@
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"
|
|
|
/>
|
|
|
+ <!-- :picker-options="datePickerOptions" -->
|
|
|
</p>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
size="small"
|
|
|
- @click="conditions(1)"
|
|
|
+ @click="onSearchClick"
|
|
|
class="search-btn"
|
|
|
>查询</el-button
|
|
|
>
|
|
@@ -105,6 +106,7 @@
|
|
|
<div class="main-body">
|
|
|
<keep-alive>
|
|
|
<component
|
|
|
+ ref="activeComponent"
|
|
|
:is="activeTab"
|
|
|
:codedata="tabData[activeTab].codedata"
|
|
|
v-bind="
|
|
@@ -114,6 +116,8 @@
|
|
|
"
|
|
|
:totalCount="tabData[activeTab].totalCount"
|
|
|
:totalPage="tabData[activeTab].totalPage"
|
|
|
+ :fieldCode="tabConditions[activeTab].companyCode"
|
|
|
+ :windTurbineNumber="tabConditions[activeTab].unitvalue"
|
|
|
@updatePage="handlePageChange"
|
|
|
/>
|
|
|
</keep-alive>
|
|
@@ -150,8 +154,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- activeTab: "Temperature",
|
|
|
- activeName: "Temperature",
|
|
|
+ activeTab: "Bearing",
|
|
|
+ activeName: "Bearing",
|
|
|
menuItems: [
|
|
|
{
|
|
|
name: "轴承诊断",
|
|
@@ -205,6 +209,24 @@ export default {
|
|
|
echartsdata: {},
|
|
|
},
|
|
|
},
|
|
|
+ datePickerOptions: {
|
|
|
+ onPick: ({ minDate, maxDate }) => {
|
|
|
+ if (minDate && !maxDate) {
|
|
|
+ const maxTime = new Date(
|
|
|
+ minDate.getTime() + 30 * 24 * 60 * 60 * 1000
|
|
|
+ );
|
|
|
+ this.datePickerOptions.disabledDate = (time) => {
|
|
|
+ return (
|
|
|
+ time.getTime() < minDate.getTime() ||
|
|
|
+ time.getTime() > maxTime.getTime()
|
|
|
+ );
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ this.datePickerOptions.disabledDate = () => false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ disabledDate: () => false,
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -241,9 +263,7 @@ export default {
|
|
|
},
|
|
|
parentChange(data) {
|
|
|
const condition = this.tabConditions[this.activeTab];
|
|
|
-
|
|
|
if (!data?.codeNumber) return;
|
|
|
-
|
|
|
condition.unitvalue = "";
|
|
|
condition.monitoringvalue = "";
|
|
|
condition.frequencyvalue = "";
|
|
@@ -257,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;
|
|
|
},
|
|
@@ -275,7 +299,7 @@ export default {
|
|
|
if (res.data.code === 500) {
|
|
|
condition.monitoringoptions = [];
|
|
|
this.$message({
|
|
|
- message: res.data.message || "未知错误",
|
|
|
+ message: "当前风场不存在测点和采样频率数据" || "未知错误",
|
|
|
type: "warning",
|
|
|
});
|
|
|
return;
|
|
@@ -309,82 +333,131 @@ export default {
|
|
|
});
|
|
|
return processedData;
|
|
|
},
|
|
|
+ onSearchClick() {
|
|
|
+ this.conditions(1, false); // 主动查询,第一页,非分页触发
|
|
|
+ },
|
|
|
handlePageChange(page) {
|
|
|
- this.conditions(page);
|
|
|
+ this.conditions(page, true); // true 表示分页触发
|
|
|
},
|
|
|
- conditions(page) {
|
|
|
- const tab = this.activeTab;
|
|
|
- const condition = this.tabConditions[tab];
|
|
|
-
|
|
|
- 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,
|
|
|
- };
|
|
|
|
|
|
- if (tab === "Temperature") {
|
|
|
- const temperature = {
|
|
|
- windCode: "WOF046400029",
|
|
|
- windTurbineNumberList: ["WOG01312"],
|
|
|
- startTime: "2023-10-01 00:00",
|
|
|
- endTime: "2023-10-07 00:00",
|
|
|
- pageNo: page,
|
|
|
- pageSize: 500,
|
|
|
- };
|
|
|
-
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: "温度诊断数据加载中,请稍候…",
|
|
|
- spinner: "el-icon-loading",
|
|
|
- background: "rgba(0, 0, 0, 0.8)", // 稍浅一些,更柔和
|
|
|
- customClass: "custom-loading-style", // 可选:如果你有样式可以加类名
|
|
|
- });
|
|
|
+ conditions(page, isPageChange = false) {
|
|
|
+ const tab = this.activeTab;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const comp = this.$refs.activeComponent;
|
|
|
+ if (comp && typeof comp.reset === "function") {
|
|
|
+ comp.reset();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- const thresholdReq = axios
|
|
|
- .post("/AnalysisMulti/temperature/threshold", temperature)
|
|
|
- .then((res) => {
|
|
|
- const data = res.data.data.records || [];
|
|
|
- this.tabData[tab].codedata = data;
|
|
|
- this.tabData[tab].totalCount = res.data.data.totalSize || 0;
|
|
|
- console.log("温度诊断总数:", res.data.data.totalSize);
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error("温度诊断请求失败:", err);
|
|
|
- this.$message.error("温度诊断数据请求失败,请稍后再试");
|
|
|
+ // 把后面接口请求部分放进延迟里,确保 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)",
|
|
|
});
|
|
|
|
|
|
- const trendReq = axios
|
|
|
- .post("/AnalysisMulti/SPRT/trend", temperature)
|
|
|
- .then((res) => {
|
|
|
- const echartsdata = res.data.data || {};
|
|
|
- this.tabData[tab].echartsdata = echartsdata;
|
|
|
- console.log("趋势图数据:", echartsdata);
|
|
|
- })
|
|
|
- .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`
|
|
|
+ );
|
|
|
+
|
|
|
+ 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("温度诊断数据请求失败,请稍后再试");
|
|
|
+ });
|
|
|
|
|
|
- // 所有请求完成后关闭 loading
|
|
|
- Promise.allSettled([thresholdReq, trendReq]).finally(() => {
|
|
|
- loading.close();
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 默认其他组件逻辑
|
|
|
- axios
|
|
|
- .post("/ETLapi/waveData/getMesureDataWithSF", params)
|
|
|
- .then((res) => {
|
|
|
- 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毫秒执行接口请求逻辑
|
|
|
},
|
|
|
},
|
|
|
};
|