更新区域名称映射,替换简短区域名称为完整名称,并调整前端表格列宽

This commit is contained in:
wangqifan 2025-04-02 22:37:29 +08:00
parent 5bb223d6c8
commit eed105572a
3 changed files with 97 additions and 42 deletions

View File

@ -30,35 +30,106 @@ AWS_PRICING_EBS = {
# 区域中文名称映射 # 区域中文名称映射
AWS_REGION_NAMES = { AWS_REGION_NAMES = {
"us-east-1": "美国东部 (弗吉尼亚北部)", "af-south-1": "非洲 (开普敦)",
"us-east-2": "美国东部 (俄亥俄)",
"us-west-1": "美国西部 (加利福尼亚北部)",
"us-west-2": "美国西部 (俄勒冈)",
"ap-south-1": "亚太地区 (孟买)",
"ap-east-1": "亚太地区 (香港)",
"ap-northeast-1": "亚太地区 (东京)", "ap-northeast-1": "亚太地区 (东京)",
"ap-northeast-2": "亚太地区 (首尔)", "ap-northeast-2": "亚太地区 (首尔)",
"ap-northeast-3": "亚太地区 (大阪)",
"ap-east-1": "亚太地区 (香港)",
"ap-south-1": "亚太地区 (孟买)",
"ap-south-2": "亚太地区 (海得拉巴)",
"ap-southeast-1": "亚太地区 (新加坡)", "ap-southeast-1": "亚太地区 (新加坡)",
"ap-southeast-2": "亚太地区 (悉尼)", "ap-southeast-2": "亚太地区 (悉尼)",
"ap-southeast-3": "亚太地区 (雅加达)",
"ap-southeast-4": "亚太地区 (墨尔本)",
"ap-southeast-5": "亚太地区 (马来西亚)",
"ap-southeast-7": "亚太地区 (泰国)",
"ca-central-1": "加拿大 (中部)", "ca-central-1": "加拿大 (中部)",
"ca-west-1": "加拿大西部 (卡尔加里)",
"eu-central-1": "欧洲 (法兰克福)", "eu-central-1": "欧洲 (法兰克福)",
"eu-central-2": "欧洲 (苏黎世)",
"eu-north-1": "欧洲 (斯德哥尔摩)",
"eu-south-1": "欧洲 (米兰)",
"eu-south-2": "欧洲 (西班牙)",
"eu-west-1": "欧洲 (爱尔兰)", "eu-west-1": "欧洲 (爱尔兰)",
"eu-west-2": "欧洲 (伦敦)", "eu-west-2": "欧洲 (伦敦)",
"eu-west-3": "欧洲 (巴黎)", "eu-west-3": "欧洲 (巴黎)",
"sa-east-1": "南美洲 (圣保罗)", "il-central-1": "以色列 (特拉维夫)",
"me-central-1": "中东 (阿联酋)", "me-central-1": "中东 (阿联酋)",
"eu-north-1": "欧洲 (斯德哥尔摩)", "me-south-1": "中东 (巴林)",
"eu-west-4": "欧洲 (比利时)", "mx-central-1": "墨西哥 (中部)",
"eu-south-1": "欧洲 (米兰)", "sa-east-1": "南美洲 (圣保罗)",
"eu-west-5": "欧洲 (阿姆斯特丹)", "us-east-1": "美国东部 (弗吉尼亚北部)",
"eu-west-6": "欧洲 (华沙)", "us-east-2": "美国东部 (俄亥俄)",
"eu-west-7": "欧洲 (伦敦)", "us-east-2-mci-1": "美国东部 (堪萨斯城)",
"eu-west-8": "欧洲 (米兰)", "us-gov-east-1": "AWS GovCloud (美国东部)",
"eu-west-9": "欧洲 (马德里)", "us-gov-west-1": "AWS GovCloud (美国西部)",
"eu-west-10": "欧洲 (巴黎)", "us-west-1": "美国西部 (加利福尼亚北部)",
"eu-west-11": "欧洲 (阿姆斯特丹)", "us-west-2": "美国西部 (俄勒冈)",
"eu-west-12": "欧洲 (米兰)", "ap-northeast-1-tpe-1": "亚太地区 (台湾)",
"eu-west-13": "欧洲 (米兰)" "ap-northeast-1-wl1-kix1": "亚太地区 (KDDI) - 大阪",
"ap-northeast-1-wl1-nrt1": "亚太地区 (KDDI) - 东京",
"ap-northeast-2-wl1-cjj1": "亚太地区 (SKT) - 大田",
"ap-northeast-2-wl1-sel1": "亚太地区 (SKT) - 首尔",
"ca-central-1-wl1-yto1": "加拿大 (BELL) - 多伦多",
"eu-central-1-wl1-ber1": "欧洲 (沃达丰) - 柏林",
"eu-central-1-wl1-dtm1": "欧洲 (沃达丰) - 多特蒙德",
"eu-central-1-wl1-muc1": "欧洲 (沃达丰) - 慕尼黑",
"eu-west-2-wl1-lon1": "欧洲 (沃达丰) - 伦敦",
"eu-west-2-wl1-man1": "欧洲 (沃达丰) - 曼彻斯特",
"eu-west-2-wl2-man1": "欧洲 (英国电信) - 曼彻斯特",
"eu-west-3-wl1-cmn1": "摩洛哥 (卡萨布兰卡)",
"us-east-1-wl1": "美国东部 (Verizon) - 波士顿",
"us-east-1-wl1-atl1": "美国东部 (Verizon) - 亚特兰大",
"us-east-1-wl1-bna1": "美国东部 (Verizon) - 纳什维尔",
"us-east-1-wl1-chi1": "美国东部 (Verizon) - 芝加哥",
"us-east-1-wl1-clt1": "美国东部 (Verizon) - 夏洛特",
"us-east-1-wl1-dfw1": "美国东部 (Verizon) - 达拉斯",
"us-east-1-wl1-dtw1": "美国东部 (Verizon) - 底特律",
"us-east-1-wl1-iah1": "美国东部 (Verizon) - 休斯顿",
"us-east-1-wl1-mia1": "美国东部 (Verizon) - 迈阿密",
"us-east-1-wl1-msp1": "美国东部 (Verizon) - 明尼阿波利斯",
"us-east-1-wl1-nyc1": "美国东部 (Verizon) - 纽约",
"us-east-1-wl1-tpa1": "美国东部 (Verizon) - 坦帕",
"us-east-1-wl1-was1": "美国东部 (Verizon) - 华盛顿特区",
"us-west-2-wl1": "美国西部 (Verizon) - 旧金山湾区",
"us-west-2-wl1-den1": "美国西部 (Verizon) - 丹佛",
"us-west-2-wl1-las1": "美国西部 (Verizon) - 拉斯维加斯",
"us-west-2-wl1-lax1": "美国西部 (Verizon) - 洛杉矶",
"us-west-2-wl1-phx1": "美国西部 (Verizon) - 凤凰城",
"us-west-2-wl1-sea1": "美国西部 (Verizon) - 西雅图",
"af-south-1-los-1": "尼日利亚 (拉各斯)",
"ap-south-1-ccu-1": "印度 (加尔各答)",
"ap-south-1-del-1": "印度 (德里)",
"ap-southeast-1-bkk-1": "泰国 (曼谷)",
"ap-southeast-1-mnl-1": "菲律宾 (马尼拉)",
"ap-southeast-2-akl-1": "新西兰 (奥克兰)",
"ap-southeast-2-per-1": "澳大利亚 (珀斯)",
"eu-central-1-ham-1": "德国 (汉堡)",
"eu-central-1-waw-1": "波兰 (华沙)",
"eu-north-1-cph-1": "丹麦 (哥本哈根)",
"eu-north-1-hel-1": "芬兰 (赫尔辛基)",
"me-south-1-mct-1": "阿曼 (马斯喀特)",
"us-east-1-atl-1": "美国东部 (亚特兰大)",
"us-east-1-bos-1": "美国东部 (波士顿)",
"us-east-1-bue-1": "阿根廷 (布宜诺斯艾利斯)",
"us-east-1-chi-1": "美国东部 (芝加哥)",
"us-east-1-dfw-1": "美国东部 (达拉斯)",
"us-east-1-iah-1": "美国东部 (休斯顿)",
"us-east-1-lim-1": "秘鲁 (利马)",
"us-east-1-mci-1": "美国东部 (堪萨斯城 2)",
"us-east-1-mia-1": "美国东部 (迈阿密)",
"us-east-1-msp-1": "美国东部 (明尼阿波利斯)",
"us-east-1-nyc-1": "美国东部 (纽约市)",
"us-east-1-phl-1": "美国东部 (费城)",
"us-east-1-qro-1": "墨西哥 (克雷塔罗)",
"us-east-1-scl-1": "智利 (圣地亚哥)",
"us-west-2-den-1": "美国西部 (丹佛)",
"us-west-2-hnl-1": "美国西部 (火奴鲁鲁)",
"us-west-2-las-1": "美国西部 (拉斯维加斯)",
"us-west-2-lax-1": "美国西部 (洛杉矶)",
"us-west-2-pdx-1": "美国西部 (波特兰)",
"us-west-2-phx-1": "美国西部 (凤凰城)",
"us-west-2-sea-1": "美国西部 (西雅图)"
} }
# 可以添加其他云平台的配置 # 可以添加其他云平台的配置

View File

@ -353,9 +353,9 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="区域" width="100" align="center"> <el-table-column label="区域" width="120" align="center">
<template #default="scope"> <template #default="scope">
<span>{{ getShortRegionName(scope.row.region) }}</span> <span>{{ getRegionName(scope.row.region) }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -615,7 +615,7 @@
`${instance.cpu}${instance.memory}G ${instance.instance_type}`, `${instance.cpu}${instance.memory}G ${instance.instance_type}`,
`${instance.disk_gb}G GP3`, `${instance.disk_gb}G GP3`,
this.formatOS(instance.operating_system), this.formatOS(instance.operating_system),
this.getShortRegionName(instance.region), this.getRegionName(instance.region),
officialMonthlyPrice.toFixed(2), officialMonthlyPrice.toFixed(2),
discountedMonthlyPrice.toFixed(2), discountedMonthlyPrice.toFixed(2),
officialYearlyPrice.toFixed(2), officialYearlyPrice.toFixed(2),
@ -644,7 +644,7 @@
{ wch: 25 }, // B { wch: 25 }, // B
{ wch: 15 }, // C { wch: 15 }, // C
{ wch: 15 }, // D { wch: 15 }, // D
{ wch: 15 }, // E { wch: 25 }, // E
{ wch: 25 }, // F { wch: 25 }, // F
{ wch: 25 }, // G { wch: 25 }, // G
{ wch: 25 }, // H { wch: 25 }, // H
@ -790,14 +790,6 @@
const region = this.regions.find(r => r.code === regionCode) const region = this.regions.find(r => r.code === regionCode)
return region ? region.name : regionCode return region ? region.name : regionCode
}, },
//
getShortRegionName(regionCode) {
const region = this.regions.find(r => r.code === regionCode)
if (!region) return regionCode
const match = region.name.match(/\(([^)]+)\)/)
return match ? match[1] : region.name
},
// YYYY/MM/DD // YYYY/MM/DD
getCurrentDate() { getCurrentDate() {
const date = new Date() const date = new Date()

View File

@ -325,7 +325,7 @@
<el-table-column label="区域" width="120" align="center"> <el-table-column label="区域" width="120" align="center">
<template #default="scope"> <template #default="scope">
<span>{{ getShortRegionName(scope.row.region) }}</span> <span>{{ getRegionName(scope.row.region) }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -563,7 +563,7 @@ export default {
`${instance.cpu}${instance.memory}G ${instance.instance_type}`, `${instance.cpu}${instance.memory}G ${instance.instance_type}`,
`${instance.disk_gb}G GP3`, `${instance.disk_gb}G GP3`,
this.formatOS(instance.operating_system), this.formatOS(instance.operating_system),
this.getShortRegionName(instance.region), this.getRegionName(instance.region),
instance.total_monthly_price.toFixed(2), instance.total_monthly_price.toFixed(2),
(instance.total_monthly_price * 12).toFixed(2) (instance.total_monthly_price * 12).toFixed(2)
]) ])
@ -587,7 +587,7 @@ export default {
{ wch: 25 }, // B { wch: 25 }, // B
{ wch: 15 }, // C { wch: 15 }, // C
{ wch: 15 }, // D { wch: 15 }, // D
{ wch: 15 }, // E { wch: 25 }, // E
{ wch: 25 }, // F { wch: 25 }, // F
{ wch: 25 } // G { wch: 25 } // G
] ]
@ -701,14 +701,6 @@ export default {
const region = this.regions.find(r => r.code === regionCode) const region = this.regions.find(r => r.code === regionCode)
return region ? region.name : regionCode return region ? region.name : regionCode
}, },
//
getShortRegionName(regionCode) {
const region = this.regions.find(r => r.code === regionCode)
if (!region) return regionCode
const match = region.name.match(/\(([^)]+)\)/)
return match ? match[1] : region.name
},
// YYYY/MM/DD // YYYY/MM/DD
getCurrentDate() { getCurrentDate() {
const date = new Date() const date = new Date()