|
|
@@ -587,269 +587,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations("settings", ["setDownloadDisabled"]),
|
|
|
- // async handleDownLoadChart(row) {
|
|
|
- // this.setDownloadDisabled(true);
|
|
|
- // this.$notify.warning("开始生成 Word 文档...");
|
|
|
- // await this.getAllAnalysis(row.batchCode);
|
|
|
- // await this.getFieldDetail(row.batchCode);
|
|
|
- // const limit = pLimit(5);
|
|
|
- // const tasks = [];
|
|
|
|
|
|
- // for (const itemAnalysis of this.allAnalysis) {
|
|
|
- // const filterAnalysis = allAnalysisType.find(
|
|
|
- // (itemType) => itemType.typeName === itemAnalysis.analysisTypeName
|
|
|
- // );
|
|
|
- // if (!filterAnalysis) continue;
|
|
|
- // const pushTask = (urlType, itemField, analysisType, sourceType) => {
|
|
|
- // //静态偏航误差 --通过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++;
|
|
|
- // // 每完成 10% 提示一次(可调)
|
|
|
- // const percent = Math.floor(
|
|
|
- // (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} 张图表`
|
|
|
- // );
|
|
|
- // }
|
|
|
- // })
|
|
|
- // );
|
|
|
- // }
|
|
|
- // );
|
|
|
- // } 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++;
|
|
|
- // // 每完成 10% 提示一次(可调)
|
|
|
- // const percent = Math.floor(
|
|
|
- // (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} 张图表`
|
|
|
- // );
|
|
|
- // }
|
|
|
- // })
|
|
|
- // );
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (itemField.engineTypeCode === "total_fault_result") {
|
|
|
- // tasks.push(
|
|
|
- // limit(async () => {
|
|
|
- // await this.postChartData(
|
|
|
- // "faultAllChart",
|
|
|
- // row,
|
|
|
- // itemAnalysis,
|
|
|
- // itemField,
|
|
|
- // filterAnalysis,
|
|
|
- // "generalFiles"
|
|
|
- // );
|
|
|
- // this.progress.current++;
|
|
|
- // // 每完成 10% 提示一次(可调)
|
|
|
- // const percent = Math.floor(
|
|
|
- // (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} 张图表`
|
|
|
- // );
|
|
|
- // }
|
|
|
- // })
|
|
|
- // );
|
|
|
- // }
|
|
|
- // }
|
|
|
- // } else if (filterAnalysis.typeCode === "production_indicator") {
|
|
|
- // //总图全场
|
|
|
- // if (
|
|
|
- // itemField.fileAddr.includes(
|
|
|
- // filterAnalysis.generalFiles.FileTypeFromUrl
|
|
|
- // )
|
|
|
- // ) {
|
|
|
- // tasks.push(
|
|
|
- // limit(() =>
|
|
|
- // this.postChartData(
|
|
|
- // filterAnalysis.generalFiles.urlType,
|
|
|
- // row,
|
|
|
- // itemAnalysis,
|
|
|
- // itemField,
|
|
|
- // filterAnalysis,
|
|
|
- // "generalFiles"
|
|
|
- // )
|
|
|
- // )
|
|
|
- // );
|
|
|
- // } else {
|
|
|
- // tasks.push(
|
|
|
- // limit(async () => {
|
|
|
- // await this.postChartData(
|
|
|
- // "radarChart",
|
|
|
- // row,
|
|
|
- // itemAnalysis,
|
|
|
- // itemField,
|
|
|
- // filterAnalysis,
|
|
|
- // "generalFiles"
|
|
|
- // );
|
|
|
- // this.progress.current++;
|
|
|
- // // 每完成 10% 提示一次(可调)
|
|
|
- // const percent = Math.floor(
|
|
|
- // (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} 张图表`
|
|
|
- // );
|
|
|
- // }
|
|
|
- // })
|
|
|
- // );
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // tasks.push(
|
|
|
- // limit(async () => {
|
|
|
- // await this.postChartData(
|
|
|
- // urlType,
|
|
|
- // row,
|
|
|
- // itemAnalysis,
|
|
|
- // itemField,
|
|
|
- // filterAnalysis,
|
|
|
- // sourceType
|
|
|
- // );
|
|
|
- // this.progress.current++;
|
|
|
- // // 每完成 10% 提示一次(可调)
|
|
|
- // const percent = Math.floor(
|
|
|
- // (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} 张图表`
|
|
|
- // );
|
|
|
- // }
|
|
|
- // })
|
|
|
- // );
|
|
|
- // }
|
|
|
- // };
|
|
|
- // const processFiles = (source, sourceType) => {
|
|
|
- // const fileList = filterAnalysis.filterFileAddr
|
|
|
- // ? source
|
|
|
- // .filter((item) => item.fileAddr.endsWith(".json"))
|
|
|
- // .filter((item) =>
|
|
|
- // item.fileAddr.includes(filterAnalysis.filterFileAddr)
|
|
|
- // )
|
|
|
- // : source;
|
|
|
- // for (const itemField of fileList || []) {
|
|
|
- // // if (Array.isArray(filterAnalysis[sourceType]?.urlType)) {
|
|
|
- // // filterAnalysis[sourceType].urlType.forEach((urlType) => {
|
|
|
- // // pushTask(
|
|
|
- // // urlType,
|
|
|
- // // itemField,
|
|
|
- // // filterAnalysis.typeName,
|
|
|
- // // sourceType
|
|
|
- // // );
|
|
|
- // // });
|
|
|
- // // } else {
|
|
|
- // let urlType = filterAnalysis[sourceType]?.urlType;
|
|
|
- // if (sourceType === "diagramRelations" && Array.isArray(urlType)) {
|
|
|
- // const actualType = this.getFileTypeFromUrl(
|
|
|
- // itemField.fileAddr,
|
|
|
- // filterAnalysis.diagramRelations.FileTypeFromUrl
|
|
|
- // );
|
|
|
- // urlType =
|
|
|
- // actualType === filterAnalysis.diagramRelations.FileTypeFromUrl
|
|
|
- // ? urlType[0]
|
|
|
- // : urlType[1];
|
|
|
- // }
|
|
|
-
|
|
|
- // pushTask(urlType, itemField, filterAnalysis.typeName, sourceType);
|
|
|
- // }
|
|
|
- // // }
|
|
|
- // };
|
|
|
- // if (itemAnalysis.generalFiles) {
|
|
|
- // processFiles(itemAnalysis.generalFiles, "generalFiles");
|
|
|
- // }
|
|
|
- // if (itemAnalysis.diagramRelations) {
|
|
|
- // processFiles(itemAnalysis.diagramRelations, "diagramRelations");
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // this.progress.total = tasks.length;
|
|
|
- // this.progress.current = 0;
|
|
|
- // // console.log(`📝 总共要生成 ${this.progress.total} 张图表`);
|
|
|
-
|
|
|
- // await Promise.all(tasks);
|
|
|
-
|
|
|
- // this.$notify.success("✅ 图表全部生成完成,开始生成 Word 文档...");
|
|
|
-
|
|
|
- // const wordFilePath = await axios.post(
|
|
|
- // "/downLoadChart/chartServer/charts/CopyFileCsv",
|
|
|
- // {
|
|
|
- // fieldInfo: this.fieldInfo,
|
|
|
- // bucketName: "bucket-zhzn",
|
|
|
- // objectName: `charts/${row.fieldCode}/${row.batchCode}`,
|
|
|
- // ...this.fileDataList,
|
|
|
- // }
|
|
|
- // );
|
|
|
-
|
|
|
- // downloadDocx(wordFilePath.data.data.url, wordFilePath.data.data.fileName);
|
|
|
-
|
|
|
- // this.$notify.success("🎉 Word 文档生成并已下载!");
|
|
|
- // this.setDownloadDisabled(false);
|
|
|
- // },
|
|
|
async postChartData(
|
|
|
urlType,
|
|
|
row,
|
|
|
@@ -885,6 +623,18 @@ export default {
|
|
|
: urlType,
|
|
|
}
|
|
|
);
|
|
|
+ // 每完成 10% 提示一次(可调)
|
|
|
+ const percent = Math.floor(
|
|
|
+ (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} 张图表`
|
|
|
+ );
|
|
|
+ }
|
|
|
let key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-${typeChart}`;
|
|
|
if (urlType === "yawErrorBarSumChart") {
|
|
|
key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-generalFiles2`;
|
|
|
@@ -902,7 +652,6 @@ export default {
|
|
|
}
|
|
|
this.fileDataList["rows"] = res?.data?.data?.data;
|
|
|
}
|
|
|
- //
|
|
|
if (itemField.engineTypeCode === "total_fault_result") {
|
|
|
if (!this.fileDataList["faultRows"]) {
|
|
|
this.$set(this.fileDataList, "faultRows", []); // Vue 2 中响应式设置对象属性
|
|
|
@@ -933,68 +682,92 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async handleDownLoadChart(row) {
|
|
|
+ this.fileDataList = {};
|
|
|
this.setDownloadDisabled(true);
|
|
|
this.$notify.warning("开始生成 Word 文档...");
|
|
|
- await this.getAllAnalysis(row.batchCode);
|
|
|
- await this.getFieldDetail(row.batchCode);
|
|
|
- this.$message.info("开始生成word文档");
|
|
|
- const limit = pLimit(5); // 限制同时并发的请求数量为 5
|
|
|
- const tasks = [];
|
|
|
- for (const itemAnalysis of this.allAnalysis) {
|
|
|
- const filterAnalysis = allAnalysisType.filter(
|
|
|
- (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)
|
|
|
- ) || []
|
|
|
- : 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++;
|
|
|
- // 每完成 10% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (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} 张图表`
|
|
|
+ try {
|
|
|
+ await this.getAllAnalysis(row.batchCode);
|
|
|
+ await this.getFieldDetail(row.batchCode);
|
|
|
+ this.$message.info("开始生成word文档");
|
|
|
+ const limit = pLimit(5); // 限制同时并发的请求数量为 5
|
|
|
+ const tasks = [];
|
|
|
+ for (const itemAnalysis of this.allAnalysis) {
|
|
|
+ const filterAnalysis = allAnalysisType.filter(
|
|
|
+ (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)
|
|
|
+ ) || []
|
|
|
+ : 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 === "fault") {
|
|
|
- if (itemField.fileAddr.includes("turbine_fault_result")) {
|
|
|
- if (itemField.engineTypeCode === "turbine_fault_result") {
|
|
|
+ } else if (filterAnalysis.typeCode === "production_indicator") {
|
|
|
+ //总图全场
|
|
|
+ if (
|
|
|
+ itemField.fileAddr.includes(
|
|
|
+ filterAnalysis.generalFiles.FileTypeFromUrl
|
|
|
+ )
|
|
|
+ ) {
|
|
|
tasks.push(
|
|
|
limit(async () => {
|
|
|
await this.postChartData(
|
|
|
- "faultUnitChart",
|
|
|
+ filterAnalysis.generalFiles.urlType,
|
|
|
row,
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
@@ -1003,30 +776,13 @@ export default {
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
// 每完成 10% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (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} 张图表`
|
|
|
- );
|
|
|
- }
|
|
|
})
|
|
|
);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (itemField.engineTypeCode === "total_fault_result") {
|
|
|
+ } else {
|
|
|
tasks.push(
|
|
|
limit(async () => {
|
|
|
await this.postChartData(
|
|
|
- "faultAllChart",
|
|
|
+ "radarChart",
|
|
|
row,
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
@@ -1034,67 +790,14 @@ export default {
|
|
|
"generalFiles"
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- // 每完成 10% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (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} 张图表`
|
|
|
- );
|
|
|
- }
|
|
|
})
|
|
|
);
|
|
|
}
|
|
|
- }
|
|
|
- } 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% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (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} 张图表`
|
|
|
- );
|
|
|
- }
|
|
|
- })
|
|
|
- );
|
|
|
} else {
|
|
|
tasks.push(
|
|
|
limit(async () => {
|
|
|
await this.postChartData(
|
|
|
- "radarChart",
|
|
|
+ filterAnalysis.generalFiles.urlType,
|
|
|
row,
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
@@ -1102,154 +805,75 @@ export default {
|
|
|
"generalFiles"
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- // 每完成 10% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (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} 张图表`
|
|
|
- );
|
|
|
- }
|
|
|
})
|
|
|
);
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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(
|
|
|
- filterAnalysis.generalFiles.urlType,
|
|
|
+ urlType,
|
|
|
row,
|
|
|
itemAnalysis,
|
|
|
itemField,
|
|
|
filterAnalysis,
|
|
|
- "generalFiles"
|
|
|
+ "diagramRelations"
|
|
|
);
|
|
|
this.progress.current++;
|
|
|
- // 每完成 10% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (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} 张图表`
|
|
|
- );
|
|
|
- }
|
|
|
})
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- 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;
|
|
|
- // console.log("urlType", filterAnalysis.typeName, urlType);
|
|
|
- tasks.push(
|
|
|
- limit(async () => {
|
|
|
- await this.postChartData(
|
|
|
- urlType,
|
|
|
- row,
|
|
|
- itemAnalysis,
|
|
|
- itemField,
|
|
|
- filterAnalysis,
|
|
|
- "diagramRelations"
|
|
|
- );
|
|
|
- this.progress.current++;
|
|
|
- // 每完成 10% 提示一次(可调)
|
|
|
- const percent = Math.floor(
|
|
|
- (this.progress.current / this.progress.total) * 100
|
|
|
- );
|
|
|
+ this.progress.total = tasks.length;
|
|
|
+ await Promise.all(tasks);
|
|
|
|
|
|
- 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} 张图表`
|
|
|
- );
|
|
|
- }
|
|
|
- })
|
|
|
- );
|
|
|
+ const engineTypeList = await this.getEngineTypeList(
|
|
|
+ this.fieldInfo.engineMillTypes,
|
|
|
+ row.batchCode
|
|
|
+ );
|
|
|
+ this.$notify.success("✅ 图表全部生成完成,开始生成 Word 文档...");
|
|
|
+ const wordFilePath = await axios.post(
|
|
|
+ "/downLoadChart/chartServer/charts/CopyFileCsv",
|
|
|
+ {
|
|
|
+ fieldInfo: this.fieldInfo,
|
|
|
+ dataTime: `${this.analysisInfo.dataStartTime}-${this.analysisInfo.dataEndTime}`,
|
|
|
+ bucketName: "bucket-zhzn",
|
|
|
+ objectName: `charts/${row.fieldCode}/${row.batchCode}`,
|
|
|
+ engineTypeList: engineTypeList,
|
|
|
+ ...this.fileDataList,
|
|
|
}
|
|
|
- }
|
|
|
+ );
|
|
|
+ // //下载minio 文件
|
|
|
+ downloadDocx(
|
|
|
+ wordFilePath.data.data.url,
|
|
|
+ wordFilePath.data.data.fileName
|
|
|
+ );
|
|
|
+ this.$notify.success("🎉 Word 文档生成并已下载!");
|
|
|
+ this.setDownloadDisabled(false);
|
|
|
+ } catch (error) {
|
|
|
+ this.$notify.error("🎉 Word 文档生成并下载失败!");
|
|
|
+ this.setDownloadDisabled(false);
|
|
|
}
|
|
|
- await Promise.all(tasks);
|
|
|
-
|
|
|
- const engineTypeList = await this.getEngineTypeList(
|
|
|
- this.fieldInfo.engineMillTypes,
|
|
|
- row.batchCode
|
|
|
- );
|
|
|
- console.log(engineTypeList, "engineTypeList");
|
|
|
- this.$notify.success("✅ 图表全部生成完成,开始生成 Word 文档...");
|
|
|
- const wordFilePath = await axios.post(
|
|
|
- "/downLoadChart/chartServer/charts/CopyFileCsv",
|
|
|
- {
|
|
|
- fieldInfo: this.fieldInfo,
|
|
|
- dataTime: `${this.analysisInfo.dataStartTime}-${this.analysisInfo.dataEndTime}`,
|
|
|
- bucketName: "bucket-zhzn",
|
|
|
- objectName: `charts/${row.fieldCode}/${row.batchCode}`,
|
|
|
- // engineTypeList: [
|
|
|
- // {
|
|
|
- // machineTypeCode: "CCWE-1500/93.DF",
|
|
|
- // manufacturerName: "华创",
|
|
|
- // rotorDiameter: 93,
|
|
|
- // ratedWindSpeed: 11,
|
|
|
- // ratedCutInWindspeed: 3,
|
|
|
- // ratedCutOutWindspeed: 25,
|
|
|
- // ratedPower: 1500,
|
|
|
- // engineTypeCode: "aa",
|
|
|
- // },
|
|
|
- // {
|
|
|
- // machineTypeCode: "CCWE-1500/93.DF",
|
|
|
- // manufacturerName: "华创",
|
|
|
- // rotorDiameter: 93,
|
|
|
- // ratedWindSpeed: 11,
|
|
|
- // ratedCutInWindspeed: 3,
|
|
|
- // ratedCutOutWindspeed: 25,
|
|
|
- // ratedPower: 1700,
|
|
|
- // engineTypeCode: "bb",
|
|
|
- // },
|
|
|
- // ],
|
|
|
- engineTypeList: engineTypeList,
|
|
|
- ...this.fileDataList,
|
|
|
- }
|
|
|
- );
|
|
|
- // //下载minio 文件
|
|
|
- downloadDocx(wordFilePath.data.data.url, wordFilePath.data.data.fileName);
|
|
|
- this.$notify.success("🎉 Word 文档生成并已下载!");
|
|
|
- this.setDownloadDisabled(false);
|
|
|
},
|
|
|
async getEngineTypeList(typeList, batchCode) {
|
|
|
return await Promise.all(
|
|
|
@@ -1285,12 +909,6 @@ export default {
|
|
|
return { ...res.data.list[0], ratedPower: filterMill[0].ratedCapacity };
|
|
|
},
|
|
|
|
|
|
- // millTypeCode
|
|
|
- // :
|
|
|
- // "WEM00018"
|
|
|
- // ratedCapacity
|
|
|
- // :
|
|
|
- // 2000
|
|
|
getFileTypeFromUrl(url, keyword) {
|
|
|
return url.includes(keyword) ? keyword : "Unknown";
|
|
|
},
|