diff --git a/src/views/codes/index/utils/hook.tsx b/src/views/codes/index/utils/hook.tsx index 82a6bb5..de36ab0 100644 --- a/src/views/codes/index/utils/hook.tsx +++ b/src/views/codes/index/utils/hook.tsx @@ -452,39 +452,136 @@ export const useIndex = (tableRef: Ref) => { 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" - ] - ); + let description = ""; + if (response.result_text[0]["hts_data"]["oneResult"]) { + description = + description + + `${ + response.result_text[0]["hts_data"]["oneResult"]["htsno"] + ? response.result_text[0]["hts_data"]["oneResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["oneResult"][ + "description" + ] + }\n`; } else { - row.push(""); + description = description + "\n"; } + if (response.result_text[0]["hts_data"]["secondResult"]) { + description = + description + + `\t${ + response.result_text[0]["hts_data"]["secondResult"]["htsno"] + ? response.result_text[0]["hts_data"]["secondResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["secondResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\n"; + } + if (response.result_text[0]["hts_data"]["threeResult"]) { + description = + description + + `\t\t${ + response.result_text[0]["hts_data"]["threeResult"]["htsno"] + ? response.result_text[0]["hts_data"]["threeResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["threeResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\t\n"; + } + if (response.result_text[0]["hts_data"]["fourResult"]) { + description = + description + + `\t\t\t${ + response.result_text[0]["hts_data"]["fourResult"]["htsno"] + ? response.result_text[0]["hts_data"]["fourResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["fourResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\t\t\n"; + } + if (response.result_text[0]["hts_data"]["fiveResult"]) { + description = + description + + `\t\t\t\t${ + response.result_text[0]["hts_data"]["fiveResult"]["htsno"] + ? response.result_text[0]["hts_data"]["fiveResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["fiveResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\t\t\t\n"; + } + row.push(description); + // 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(""); } diff --git a/src/views/codes/log/components/details.vue b/src/views/codes/log/components/details.vue index d569035..2533099 100644 --- a/src/views/codes/log/components/details.vue +++ b/src/views/codes/log/components/details.vue @@ -512,33 +512,124 @@ const exportToExcel = (dataList: QueryCodeLogInfo[], filename: string) => { 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"] - ); + let description = ""; + if (response.result_text[0]["hts_data"]["oneResult"]) { + description = + description + + `${ + response.result_text[0]["hts_data"]["oneResult"]["htsno"] + ? response.result_text[0]["hts_data"]["oneResult"]["htsno"] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["oneResult"][ + "description" + ] + }\n`; } else { - row.push(""); + description = description + "\n"; } + if (response.result_text[0]["hts_data"]["secondResult"]) { + description = + description + + `\t${ + response.result_text[0]["hts_data"]["secondResult"]["htsno"] + ? response.result_text[0]["hts_data"]["secondResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["secondResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\n"; + } + if (response.result_text[0]["hts_data"]["threeResult"]) { + description = + description + + `\t\t${ + response.result_text[0]["hts_data"]["threeResult"]["htsno"] + ? response.result_text[0]["hts_data"]["threeResult"][ + "htsno" + ] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["threeResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\t\n"; + } + if (response.result_text[0]["hts_data"]["fourResult"]) { + description = + description + + `\t\t\t${ + response.result_text[0]["hts_data"]["fourResult"]["htsno"] + ? response.result_text[0]["hts_data"]["fourResult"]["htsno"] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["fourResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\t\t\n"; + } + if (response.result_text[0]["hts_data"]["fiveResult"]) { + description = + description + + `\t\t\t\t${ + response.result_text[0]["hts_data"]["fiveResult"]["htsno"] + ? response.result_text[0]["hts_data"]["fiveResult"]["htsno"] + .replace(/(\d{2})/g, "$1.") + .slice(0, -1) + : "" + }:${ + response.result_text[0]["hts_data"]["fiveResult"][ + "description" + ] + }\n`; + } else { + description = description + "\t\t\t\t\n"; + } + row.push(description); + // 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(""); }