diff --git a/src/views/codes/index/index.vue b/src/views/codes/index/index.vue index b1ca534..af3ce2d 100644 --- a/src/views/codes/index/index.vue +++ b/src/views/codes/index/index.vue @@ -178,7 +178,7 @@ type="primary" :icon="useRenderIcon(Export)" :disabled="!hasAuth('code:btn:export')" - @click="exportToExcel([queryResult], '查询结果')" + @click="exportToExcel([queryResult], 'QueryResults')" > {{ t("buttons.ExportAll") }} diff --git a/src/views/codes/index/utils/hook.tsx b/src/views/codes/index/utils/hook.tsx index 7af80c3..82a6bb5 100644 --- a/src/views/codes/index/utils/hook.tsx +++ b/src/views/codes/index/utils/hook.tsx @@ -123,6 +123,30 @@ export const useIndex = (tableRef: Ref) => { return ""; } }, + { + label: transformI18n($t("HtsDescription.tag.standard_description")), + prop: "result_text", + formatter: ({ result_text }) => { + if (result_text.length > 0) { + if (result_text[0]["hts_data"]) { + if (result_text[0]["hts_data"]["fiveResult"]) { + return result_text[0]["hts_data"]["fiveResult"]["description"]; + } else if (result_text[0]["hts_data"]["fourResult"]) { + return result_text[0]["hts_data"]["fourResult"]["description"]; + } else if (result_text[0]["hts_data"]["threeResult"]) { + return result_text[0]["hts_data"]["threeResult"]["description"]; + } else if (result_text[0]["hts_data"]["secondResult"]) { + return result_text[0]["hts_data"]["secondResult"]["description"]; + } else if (result_text[0]["hts_data"]["oneResult"]) { + return result_text[0]["hts_data"]["oneResult"]["description"]; + } + return ""; + } + return ""; + } + return ""; + } + }, { label: transformI18n($t("buttons.Operation")), fixed: "right", @@ -363,16 +387,20 @@ export const useIndex = (tableRef: Ref) => { transformI18n($t("QueryStatistics.tag.operationTime")), transformI18n($t("QueryStatistics.tag.enterTextId")), transformI18n($t("QueryStatistics.tag.enterText")), - transformI18n($t("QueryStatistics.tag.resultStatus")) + transformI18n($t("QueryStatistics.tag.resultStatus")), + transformI18n($t("QueryStatistics.tag.resultId")), + transformI18n($t("HtsDescription.tag.similar_code")), + transformI18n($t("HtsDescription.tag.similar_description")), + transformI18n($t("HtsDescription.tag.standard_description")) ]; - for (let i = 1; i <= 5; i++) { - headers.push( - `${transformI18n($t("QueryStatistics.tag.resultId")) + i}`, - `${transformI18n($t("QueryStatistics.tag.HTSCode")) + i}`, - `${transformI18n($t("QueryStatistics.tag.description")) + i}`, - `${transformI18n($t("QueryStatistics.tag.matchRatio")) + i}` - ); - } + // for (let i = 1; i <= 5; i++) { + // headers.push( + // `${transformI18n($t("QueryStatistics.tag.resultId")) + i}`, + // `${transformI18n($t("QueryStatistics.tag.HTSCode")) + i}`, + // `${transformI18n($t("QueryStatistics.tag.description")) + i}`, + // `${transformI18n($t("QueryStatistics.tag.matchRatio")) + i}` + // ); + // } const data = []; let index = 1; for (const jsonData of dataList) { @@ -417,19 +445,63 @@ export const useIndex = (tableRef: Ref) => { if (typeof response.result_text === "string") { response.result_text = JSON.parse(response.result_text); } - for (let i = 0; i < 5; i++) { - if (i < response.result_text.length) { - const match = response.result_text[i]; - row.push( - match.id, - match.code, - match.description, - match.match_rate - ); + if (response.result_text.length > 0) { + row.push( + response.result_text[0]["id"], + response.result_text[0]["code"], + response.result_text[0]["description"] + ); + if (response.result_text[0]["hts_data"]) { + if (response.result_text[0]["hts_data"]["fiveResult"]) { + row.push( + response.result_text[0]["hts_data"]["fiveResult"][ + "description" + ] + ); + } else if (response.result_text[0]["hts_data"]["fourResult"]) { + row.push( + response.result_text[0]["hts_data"]["fourResult"][ + "description" + ] + ); + } else if (response.result_text[0]["hts_data"]["threeResult"]) { + row.push( + response.result_text[0]["hts_data"]["threeResult"][ + "description" + ] + ); + } else if (response.result_text[0]["hts_data"]["secondResult"]) { + row.push( + response.result_text[0]["hts_data"]["secondResult"][ + "description" + ] + ); + } else if (response.result_text[0]["hts_data"]["oneResult"]) { + row.push( + response.result_text[0]["hts_data"]["oneResult"][ + "description" + ] + ); + } else { + row.push(""); + } } else { - row.push("", "", "", ""); + row.push(""); } } + // for (let i = 0; i < 5; i++) { + // if (i < response.result_text.length) { + // const match = response.result_text[i]; + // row.push( + // match.id, + // match.code, + // match.description, + // match.match_rate + // ); + // } else { + // row.push("", "", "", ""); + // } + // } data.push(row); }); } @@ -460,7 +532,7 @@ export const useIndex = (tableRef: Ref) => { response_result: selecteList }; - exportToExcel([exportData], "查询结果"); + exportToExcel([exportData], "QueryResults"); }; /**处理反馈 */ /**处理反馈 */ diff --git a/src/views/codes/log/components/details.vue b/src/views/codes/log/components/details.vue index 319b262..d569035 100644 --- a/src/views/codes/log/components/details.vue +++ b/src/views/codes/log/components/details.vue @@ -38,7 +38,7 @@