|
|
@@ -309,6 +309,18 @@
|
|
|
min-width="300"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
+ <!-- <el-button
|
|
|
+ @click="handleDownLoadChartImage(scope.row)"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ :disabled="downloadDisabled"
|
|
|
+ v-if="
|
|
|
+ (scope.row.errState == 1 && scope.row.analysisState == 30) ||
|
|
|
+ scope.row.analysisState == 30
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 下载图表
|
|
|
+ </el-button> -->
|
|
|
<el-button
|
|
|
@click="handleDownLoadChart(scope.row)"
|
|
|
type="text"
|
|
|
@@ -593,7 +605,7 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- typeChart
|
|
|
+ typeChart,
|
|
|
) {
|
|
|
try {
|
|
|
if (itemField.analysisTypeName === "环境温度传感器") {
|
|
|
@@ -625,18 +637,18 @@ export default {
|
|
|
filterAnalysis.typeDocxName === "production_indicator_unit"
|
|
|
? "radar"
|
|
|
: urlType,
|
|
|
- }
|
|
|
+ },
|
|
|
);
|
|
|
// 每完成 10% 提示一次(可调)
|
|
|
const percent = Math.floor(
|
|
|
- (this.progress.current / this.progress.total) * 100
|
|
|
+ (this.progress.current / this.progress.total) * 100,
|
|
|
);
|
|
|
if (percent % 5 === 0 && !this._shownPercents?.includes(percent)) {
|
|
|
this._shownPercents = this._shownPercents || [];
|
|
|
this._shownPercents.push(percent);
|
|
|
|
|
|
this.$notify.info(
|
|
|
- `📈 已完成 ${percent}%/${this.progress.current}张,共 ${this.progress.total} 张图表`
|
|
|
+ `📈 已完成 ${percent}%/${this.progress.current}张,共 ${this.progress.total} 张图表`,
|
|
|
);
|
|
|
}
|
|
|
let key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-${typeChart}`;
|
|
|
@@ -685,6 +697,231 @@ export default {
|
|
|
console.error("生成失败:", err);
|
|
|
}
|
|
|
},
|
|
|
+ async handleDownLoadChartImage(row) {
|
|
|
+ this.progress.current = 0;
|
|
|
+ this.progress.total = 0;
|
|
|
+ this.fileDataList = {};
|
|
|
+ this.setDownloadDisabled(true);
|
|
|
+ try {
|
|
|
+ await this.getAllAnalysis(row.batchCode);
|
|
|
+ await this.getFieldDetail(row.batchCode);
|
|
|
+ this.$message.info("开始下载图片");
|
|
|
+ const limit = pLimit(5); // 限制同时并发的请求数量为 5
|
|
|
+ const tasks = [];
|
|
|
+ for (const itemAnalysis of this.allAnalysis) {
|
|
|
+ const filterAnalysis = allAnalysisType.filter(
|
|
|
+ (itemType) => itemType.typeName === itemAnalysis.analysisTypeName,
|
|
|
+ )[0];
|
|
|
+ console.log(filterAnalysis, "filterAnalysis");
|
|
|
+ if (itemAnalysis.generalFiles) {
|
|
|
+ //这里过滤的是发电机温度的类型 在url 中是否能找到filterFileAddr
|
|
|
+ for (const itemField of filterAnalysis.filterFileAddr
|
|
|
+ ? itemAnalysis.generalFiles
|
|
|
+ .filter((item) => item.fileAddr.endsWith(".json"))
|
|
|
+ .filter((item) =>
|
|
|
+ item.fileAddr.includes(filterAnalysis.filterFileAddr),
|
|
|
+ ) || []
|
|
|
+ : itemAnalysis.generalFiles) {
|
|
|
+ //静态偏航误差 --通过allAnalysisType.js文件配置实现需求
|
|
|
+ if (Array.isArray(filterAnalysis.generalFiles.urlType)) {
|
|
|
+ filterAnalysis.generalFiles.urlType.map(
|
|
|
+ (itemUrlType, indUrlType) => {
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ itemUrlType,
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "generalFiles",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ );
|
|
|
+ } else if (filterAnalysis.typeCode === "fault") {
|
|
|
+ if (itemField.fileAddr.includes("turbine_fault_result")) {
|
|
|
+ if (itemField.engineTypeCode === "turbine_fault_result") {
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ "faultUnitChart",
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "generalFiles",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (itemField.engineTypeCode === "total_fault_result") {
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ "faultAllChart",
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "generalFiles",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (filterAnalysis.typeCode === "production_indicator") {
|
|
|
+ //总图全场
|
|
|
+ if (
|
|
|
+ itemField.fileAddr.includes(
|
|
|
+ filterAnalysis.generalFiles.FileTypeFromUrl,
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ filterAnalysis.generalFiles.urlType,
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "generalFiles",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ // 每完成 10% 提示一次(可调)
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ "radarChart",
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "generalFiles",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ filterAnalysis.generalFiles.urlType,
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "generalFiles",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (itemAnalysis.diagramRelations) {
|
|
|
+ for (const itemField of filterAnalysis.filterFileAddr
|
|
|
+ ? itemAnalysis.diagramRelations
|
|
|
+ .filter((item) => item.fileAddr.endsWith(".json"))
|
|
|
+ .filter((item) =>
|
|
|
+ item.fileAddr.includes(filterAnalysis.filterFileAddr),
|
|
|
+ ) || []
|
|
|
+ : itemAnalysis.diagramRelations) {
|
|
|
+ const urlType = Array.isArray(
|
|
|
+ filterAnalysis.diagramRelations.urlType,
|
|
|
+ )
|
|
|
+ ? this.getFileTypeFromUrl(
|
|
|
+ itemField.fileAddr,
|
|
|
+ filterAnalysis.diagramRelations.FileTypeFromUrl,
|
|
|
+ ) === filterAnalysis.diagramRelations.FileTypeFromUrl
|
|
|
+ ? filterAnalysis.diagramRelations.urlType[0]
|
|
|
+ : filterAnalysis.diagramRelations.urlType[1]
|
|
|
+ : filterAnalysis.diagramRelations.urlType;
|
|
|
+ tasks.push(
|
|
|
+ limit(async () => {
|
|
|
+ await this.postChartData(
|
|
|
+ urlType,
|
|
|
+ row,
|
|
|
+ itemAnalysis,
|
|
|
+ itemField,
|
|
|
+ filterAnalysis,
|
|
|
+ "diagramRelations",
|
|
|
+ );
|
|
|
+ this.progress.current++;
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.progress.total = tasks.length;
|
|
|
+ await Promise.all(tasks);
|
|
|
+
|
|
|
+ const engineTypeList = await this.getEngineTypeList(
|
|
|
+ this.fieldInfo.engineMillTypes,
|
|
|
+ row.batchCode,
|
|
|
+ );
|
|
|
+ this.$notify.success("✅ 图表全部生成完成,开始下载图片...");
|
|
|
+ const wordFilePath = await axios.post(
|
|
|
+ "/downLoadChart/chartServer/charts/CopyFileImage",
|
|
|
+ {
|
|
|
+ fieldInfo: this.fieldInfo,
|
|
|
+ dataTime: `${this.analysisInfo.dataStartTime}-${this.analysisInfo.dataEndTime}`,
|
|
|
+ bucketName: "bucket-zhzn",
|
|
|
+ objectName: `charts/${row.fieldCode}/${row.batchCode}`,
|
|
|
+ engineTypeList: engineTypeList,
|
|
|
+ chartsImages: {
|
|
|
+ ...this.fileDataList,
|
|
|
+ // "zn-techcn-replace-tags-data_integrity_minute-generalFiles": [
|
|
|
+ // "http://106.120.102.238:26900/bucket-zhzn/charts/WOF039800012/WOF039800012-WOB000002/temperature_environment/bartotal_Mid.jpg",
|
|
|
+ // ],
|
|
|
+
|
|
|
+ // "zn-techcn-replace-tags-data_integrity_second-generalFiles": [
|
|
|
+ // "http://106.120.102.238:26900/bucket-zhzn/charts/WOF039800012/WOF039800012-WOB000002/temperature_large_components/gearbox_low_speed_shaft_bearing_temperature/%2302.jpg",
|
|
|
+ // "http://106.120.102.238:26900/bucket-zhzn/charts/WOF039800012/WOF039800012-WOB000002/temperature_environment/bartotal_Mid.jpg",
|
|
|
+ // ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ );
|
|
|
+
|
|
|
+ // //下载minio 文件
|
|
|
+ this.downloadZip(wordFilePath.data.data.url);
|
|
|
+ // downloadDocx(
|
|
|
+ // wordFilePath.data.data.url,
|
|
|
+ // wordFilePath.data.data.fileName,
|
|
|
+ // );
|
|
|
+ this.$notify.success("🎉 图片已下载!");
|
|
|
+ this.setDownloadDisabled(false);
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error, "error");
|
|
|
+ this.$notify.error("🎉 图片下载失败!");
|
|
|
+ this.setDownloadDisabled(false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async downloadZip(url) {
|
|
|
+ const res = await axios.get(url, {
|
|
|
+ responseType: "blob",
|
|
|
+ });
|
|
|
+ const blob = new Blob([res.data], {
|
|
|
+ type: "application/zip",
|
|
|
+ });
|
|
|
+
|
|
|
+ const link = document.createElement("a");
|
|
|
+ link.href = URL.createObjectURL(blob);
|
|
|
+ link.download = "charts_images.zip";
|
|
|
+
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ link.remove();
|
|
|
+ },
|
|
|
async handleDownLoadChart(row) {
|
|
|
this.progress.current = 0;
|
|
|
this.progress.total = 0;
|
|
|
@@ -697,20 +934,21 @@ export default {
|
|
|
this.$message.info("开始生成word文档");
|
|
|
const limit = pLimit(5); // 限制同时并发的请求数量为 5
|
|
|
const tasks = [];
|
|
|
+ let minioUrl = "";
|
|
|
for (const itemAnalysis of this.allAnalysis) {
|
|
|
const filterAnalysis = allAnalysisType.filter(
|
|
|
- (itemType) => itemType.typeName === itemAnalysis.analysisTypeName
|
|
|
+ (itemType) => itemType.typeName === itemAnalysis.analysisTypeName,
|
|
|
)[0];
|
|
|
-
|
|
|
if (itemAnalysis.generalFiles) {
|
|
|
//这里过滤的是发电机温度的类型 在url 中是否能找到filterFileAddr
|
|
|
for (const itemField of filterAnalysis.filterFileAddr
|
|
|
? itemAnalysis.generalFiles
|
|
|
.filter((item) => item.fileAddr.endsWith(".json"))
|
|
|
.filter((item) =>
|
|
|
- item.fileAddr.includes(filterAnalysis.filterFileAddr)
|
|
|
+ item.fileAddr.includes(filterAnalysis.filterFileAddr),
|
|
|
) || []
|
|
|
: itemAnalysis.generalFiles) {
|
|
|
+ minioUrl = new URL(itemField.fileAddr);
|
|
|
//静态偏航误差 --通过allAnalysisType.js文件配置实现需求
|
|
|
if (Array.isArray(filterAnalysis.generalFiles.urlType)) {
|
|
|
filterAnalysis.generalFiles.urlType.map(
|
|
|
@@ -723,12 +961,12 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "generalFiles",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
- }
|
|
|
+ },
|
|
|
);
|
|
|
} else if (filterAnalysis.typeCode === "fault") {
|
|
|
if (itemField.fileAddr.includes("turbine_fault_result")) {
|
|
|
@@ -741,10 +979,10 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "generalFiles",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -757,10 +995,10 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "generalFiles",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -768,7 +1006,7 @@ export default {
|
|
|
//总图全场
|
|
|
if (
|
|
|
itemField.fileAddr.includes(
|
|
|
- filterAnalysis.generalFiles.FileTypeFromUrl
|
|
|
+ filterAnalysis.generalFiles.FileTypeFromUrl,
|
|
|
)
|
|
|
) {
|
|
|
tasks.push(
|
|
|
@@ -779,11 +1017,11 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "generalFiles",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
// 每完成 10% 提示一次(可调)
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
} else {
|
|
|
tasks.push(
|
|
|
@@ -794,10 +1032,10 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "generalFiles",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -809,10 +1047,10 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "generalFiles",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -822,15 +1060,16 @@ export default {
|
|
|
? itemAnalysis.diagramRelations
|
|
|
.filter((item) => item.fileAddr.endsWith(".json"))
|
|
|
.filter((item) =>
|
|
|
- item.fileAddr.includes(filterAnalysis.filterFileAddr)
|
|
|
+ item.fileAddr.includes(filterAnalysis.filterFileAddr),
|
|
|
) || []
|
|
|
: itemAnalysis.diagramRelations) {
|
|
|
+ minioUrl = new URL(itemField.fileAddr);
|
|
|
const urlType = Array.isArray(
|
|
|
- filterAnalysis.diagramRelations.urlType
|
|
|
+ filterAnalysis.diagramRelations.urlType,
|
|
|
)
|
|
|
? this.getFileTypeFromUrl(
|
|
|
itemField.fileAddr,
|
|
|
- filterAnalysis.diagramRelations.FileTypeFromUrl
|
|
|
+ filterAnalysis.diagramRelations.FileTypeFromUrl,
|
|
|
) === filterAnalysis.diagramRelations.FileTypeFromUrl
|
|
|
? filterAnalysis.diagramRelations.urlType[0]
|
|
|
: filterAnalysis.diagramRelations.urlType[1]
|
|
|
@@ -843,10 +1082,10 @@ export default {
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "diagramRelations"
|
|
|
+ "diagramRelations",
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -856,7 +1095,7 @@ export default {
|
|
|
|
|
|
const engineTypeList = await this.getEngineTypeList(
|
|
|
this.fieldInfo.engineMillTypes,
|
|
|
- row.batchCode
|
|
|
+ row.batchCode,
|
|
|
);
|
|
|
this.$notify.success("✅ 图表全部生成完成,开始生成 Word 文档...");
|
|
|
const wordFilePath = await axios.post(
|
|
|
@@ -868,12 +1107,18 @@ export default {
|
|
|
objectName: `charts/${row.fieldCode}/${row.batchCode}`,
|
|
|
engineTypeList: engineTypeList,
|
|
|
...this.fileDataList,
|
|
|
- }
|
|
|
+ },
|
|
|
);
|
|
|
+ const path = wordFilePath.data.data.url.replace(
|
|
|
+ /^https?:\/\/[^/]+/,
|
|
|
+ "",
|
|
|
+ );
|
|
|
+
|
|
|
// //下载minio 文件
|
|
|
downloadDocx(
|
|
|
- wordFilePath.data.data.url,
|
|
|
- wordFilePath.data.data.fileName
|
|
|
+ `${minioUrl.origin}${path}`,
|
|
|
+ // wordFilePath.data.data.url,
|
|
|
+ wordFilePath.data.data.fileName,
|
|
|
);
|
|
|
this.$notify.success("🎉 Word 文档生成并已下载!");
|
|
|
this.setDownloadDisabled(false);
|
|
|
@@ -885,7 +1130,7 @@ export default {
|
|
|
},
|
|
|
async getEngineTypeList(typeList, batchCode) {
|
|
|
return await Promise.all(
|
|
|
- typeList.map((item) => this.getEngineMillList(item, batchCode))
|
|
|
+ typeList.map((item) => this.getEngineMillList(item, batchCode)),
|
|
|
);
|
|
|
},
|
|
|
// 查询
|
|
|
@@ -912,7 +1157,7 @@ export default {
|
|
|
this.loading = true;
|
|
|
const res = await windEngineMillPage(paramsData);
|
|
|
const filterMill = uniqueList.filter(
|
|
|
- (item) => item.millTypeCode === res.data.list[0].millTypeCode
|
|
|
+ (item) => item.millTypeCode === res.data.list[0].millTypeCode,
|
|
|
);
|
|
|
return { ...res.data.list[0], ratedPower: filterMill[0].ratedCapacity };
|
|
|
},
|
|
|
@@ -935,7 +1180,7 @@ export default {
|
|
|
handleAutoAsstessList() {
|
|
|
window.open(
|
|
|
this.$router.resolve({ path: "/home/performance/autoAssetss" }).href,
|
|
|
- "_blank"
|
|
|
+ "_blank",
|
|
|
);
|
|
|
},
|
|
|
// 创建分析时请求
|
|
|
@@ -1061,7 +1306,7 @@ export default {
|
|
|
if (state === "0") {
|
|
|
// 分析状态为分析中
|
|
|
this.$confirm(
|
|
|
- "当前查看的分析记录为历史分析结果,最新分析记录还未分析完成不展示!"
|
|
|
+ "当前查看的分析记录为历史分析结果,最新分析记录还未分析完成不展示!",
|
|
|
)
|
|
|
.then(() => {
|
|
|
navigateToDetails();
|