From 4c8a962edd7ce5db6c78edf4995d06641c1e968e Mon Sep 17 00:00:00 2001
From: wcq <744800102@qq.com>
Date: Fri, 11 Aug 2023 15:05:21 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=8C=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/common/rateConfig.ts | 10 +-
src/types/bj.ts | 23 +++-
src/views/rate/companyDataManage.vue | 77 ++++++++-----
src/views/rate/rateManage.vue | 162 +++++++++++++++++----------
4 files changed, 175 insertions(+), 97 deletions(-)
diff --git a/src/common/rateConfig.ts b/src/common/rateConfig.ts
index b894a2e..92f4b32 100644
--- a/src/common/rateConfig.ts
+++ b/src/common/rateConfig.ts
@@ -7,11 +7,11 @@ const rateLevelConfig: RateLevelConfig = {
// AR: { badge: "3", ranking: "20%" },
// BR: { ranking: "30%" },
// CR: { ranking: "40%" },
- AAAʀ: { badge: "1", ranking: "5%" },
- AAʀ: { badge: "2", ranking: "10" },
- Aʀ: { badge: "3", ranking: "20%" },
- Bʀ: { ranking: "30%" },
- Cʀ: { ranking: "40%" }
+ AAA: { badge: "1", ranking: "5%" },
+ AA: { badge: "2", ranking: "10" },
+ A: { badge: "3", ranking: "20%" },
+ B: { ranking: "30%" },
+ C: { ranking: "40%" }
// B: { ranking: "50%" },
// CCC: { ranking: "60%" },
// CC: { ranking: "80%" },
diff --git a/src/types/bj.ts b/src/types/bj.ts
index 1c2834a..a883ff8 100644
--- a/src/types/bj.ts
+++ b/src/types/bj.ts
@@ -41,12 +41,25 @@ interface Indicator {
得分: number;
档位: string;
}
+
+interface 指标数值与得分{
+ 指标: string
+ 数值: number
+ 单位: string
+ 权重: number
+ 得分: number
+}
interface RateResContent {
- final_scope: number;
- final_level: string;
- level: string;
- total_score: number;
- indicator: Indicator[];
+ 评级结果:{
+ 级别:string,
+ 总分:number
+ }
+ 指标数值与得分:指标数值与得分[]
+ // final_scope: number;
+ // final_level: string;
+ // level: string;
+ // total_score: number;
+ // indicator: Indicator[];
}
const RateDataMock: RateData[] = [
diff --git a/src/views/rate/companyDataManage.vue b/src/views/rate/companyDataManage.vue
index 0542519..86f36b2 100644
--- a/src/views/rate/companyDataManage.vue
+++ b/src/views/rate/companyDataManage.vue
@@ -258,17 +258,18 @@
:column-config="scope.row"
v-if="tableEditAble"
class="max-w-[12rem]"
- :model-value="manDataEditTemp[scope.row?.key]"
+ :model-value="manDataEditTemp['经营问卷'][scope.row?.key]"
:size="'small'"
- @update:model-value="(newVal)=>manDataEditTemp[scope.row?.key] = newVal"
+ @update:model-value="(newVal)=>manDataEditTemp['经营问卷'][scope.row?.key] = newVal"
>
-
{{ manDataEditTemp[scope.row?.key] }}
+ {{ manDataEditTemp['经营问卷'][scope.row?.key] }}
+
编辑
@@ -282,11 +283,11 @@
@@ -297,26 +298,28 @@
>
{{ scope.row?.name }}
+
{{ scope.row?.name }}
- manDataEditTemp["财报数据"][ item ][scope.row?.key] = newVal'
- >
- {{ manDataEditTemp["财报数据"][item][scope.row?.key] }}
+
+ manDataEditTemp["财务问卷"][ item ][scope.row?.key] = newVal'
+ >
+
+ {{ manDataEditTemp["财务问卷"][item][scope.row?.key] }}
@@ -327,6 +330,22 @@
+
+
+ {{ item }}:
+
+ manDataEditTemp["财务问卷"][ item] = newVal'
+ >
+
+ {{ manDataEditTemp["财务问卷"][item] }}
+
+
+
编辑
@@ -433,11 +452,12 @@ const detailEditTab = ref("企业填报数据-问卷");
const tableEditAble = ref(false)
const rowTemp = ref(null);
const manDataEditTemp = ref({
- "问卷数据": {},
- "财报数据": {
- "2023": {},
- "2022": {},
- "2021": {},
+ "经营问卷": {},
+ "财务问卷": {
+ 资产负债表: {},
+ 利润表: {},
+ 是否审计: null,
+ 会计事务所: null
}
});
@@ -522,15 +542,16 @@ function showDetailEdit(row: RateData) {
rowTemp.value = res.data
if (!rowTemp.value?.man_data) {
manDataEditTemp.value = {
- "问卷数据": {},
- "财报数据": {
- "2023": {},
- "2022": {},
- "2021": {},
+ "经营问卷": {},
+ "财务问卷": {
+ 资产负债表: {},
+ 利润表: {},
+ 是否审计: null,
+ 会计事务所: null
}
};
} else {
- // manDataEditTemp.value = JSON.parse(rowTemp.value.man_data);
+ manDataEditTemp.value = JSON.parse(rowTemp.value.man_data);
}
// if (!rowTemp.value?.file_data) {
@@ -557,7 +578,7 @@ function showDetailEdit(row: RateData) {
const arraySpanMethod = ({row, column, rowIndex, columnIndex}) => {
if (row.type == "label") {
- return [1, Object.keys(manDataEditTemp.value['财报数据']).length + 1];
+ return [1, 3 + 1];
}
};
diff --git a/src/views/rate/rateManage.vue b/src/views/rate/rateManage.vue
index 9130c57..56a3f16 100644
--- a/src/views/rate/rateManage.vue
+++ b/src/views/rate/rateManage.vue
@@ -128,13 +128,17 @@
prop="rate_time"
width="180"
>
-
+
评级
+
报告下载
+
{{ rowTemp.company_name }}
-
等级:{{ detailData.final_level }}
-
得分:{{ detailData.final_scope }}
+
等级:{{ detailData.评级结果.级别 }}
+
得分:{{ detailData.评级结果.总分 }}
@@ -205,63 +209,55 @@
-
-
-
- {{ ellipsis(scope.row["一级指标"]) }}
-
+
+
+
+
+
-
-
- {{ ellipsis(scope.row["二级指标"]) }}
-
+
+
-
-
- {{ ellipsis(scope.row["三级指标"]) }}
-
+
+
-
-
- {{ ellipsis(scope.row["四级指标"]) }}
-
+
+
-
-
- {{ ellipsis(scope.row["数值"]) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -333,6 +329,55 @@ function doRate(row: RateData) {
});
}
+// 辅助函数:将 Blob 转换为文本
+function blobToText(blob) {
+ return new Promise((resolve, reject) => {
+ const reader = new FileReader();
+ reader.onload = () => {
+ resolve(reader.result);
+ };
+ reader.onerror = () => {
+ reject(new Error("Failed to read blob."));
+ };
+ reader.readAsText(blob);
+ });
+}
+
+function downReport(row: RateData) {
+ // ElMessage.success("正在处理,请稍等")
+ api.post("/wd-smebiz/smebiz_rate/company_rate/get_report_admin", {id: row.id}, {responseType: "blob"})
+ .then(response => {
+ console.log(response)
+ const url = window.URL.createObjectURL(new Blob([response.data]));
+ const link = document.createElement('a');
+ link.href = url;
+ const contentDisposition = response.headers['content-disposition'];
+ let decodedFilename = "报告.docx"
+ if (contentDisposition) {
+ const filenameMatch = contentDisposition.match(/filename\*?=utf-8''([^;]+)/);
+ if (filenameMatch && filenameMatch.length > 1) {
+ const encodedFilename = filenameMatch[1];
+ decodedFilename = decodeURIComponent(encodedFilename);
+ }
+ }
+ link.setAttribute('download', decodedFilename); // 指定下载的文件名
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ ElMessage.success("开始下载")
+ }).catch(async (error) => {
+ console.error(error);
+ // ElMessage.warning(e.response?.data?.detail || "错误");
+ if (error.response && error.response.data instanceof Blob) {
+ const errorText = await blobToText(error.response.data);
+ const data = JSON.parse(errorText)
+ ElMessage.warning(data.detail)
+ } else {
+ ElMessage.warning("错误")
+ }
+ });
+}
+
function doPublish(row: RateData) {
api
.post("/wd-smebiz/smebiz_rate/company_rate/update", {
@@ -379,15 +424,14 @@ function showDetail(row: RateData) {
if (rowTemp.value?.rate_data) {
const data = JSON.parse(rowTemp.value.rate_data);
console.log("data", data);
- detailData.value = data.content;
+ detailData.value = data.data;
} else {
detailData.value = {
- final_scope: null,
- final_level: null,
- total_score: null,
- level: null,
- 调整项: {},
- indicator: []
+ 评级结果: {
+ 总分: 0,
+ 级别: ""
+ },
+ 指标数值与得分: []
};
}