forked from wangqifan/calc
2 lines
86 KiB
JavaScript
2 lines
86 KiB
JavaScript
(()=>{var e={870:(e,t,n)=>{"use strict";n(3792),n(3362),n(9085),n(9391);var r=n(3751),o=n(641),a={id:"app"},l={class:"header-content"};function i(e,t,n,r,i,s){var c=(0,o.g2)("el-menu-item"),u=(0,o.g2)("el-menu"),d=(0,o.g2)("el-header"),f=(0,o.g2)("router-view"),p=(0,o.g2)("el-main"),m=(0,o.g2)("el-footer"),k=(0,o.g2)("el-container");return(0,o.uX)(),(0,o.CE)("div",a,[(0,o.bF)(k,null,{default:(0,o.k6)((function(){return[(0,o.bF)(d,{class:"header"},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",l,[t[2]||(t[2]=(0,o.Lk)("h1",null,[(0,o.Lk)("i",{class:"el-icon-cloudy-and-sunny"}),(0,o.eW)(" AWS EC2 价格计算器")],-1)),(0,o.bF)(u,{mode:"horizontal",router:"",class:"menu","background-color":"#3498db","text-color":"#fff","active-text-color":"#ffd04b"},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{index:"/awsSearch"},{default:(0,o.k6)((function(){return t[0]||(t[0]=[(0,o.Lk)("i",{class:"el-icon-search"},null,-1),(0,o.eW)("AWS报价")])})),_:1}),(0,o.bF)(c,{index:"/awsSearchDiscount"},{default:(0,o.k6)((function(){return t[1]||(t[1]=[(0,o.Lk)("i",{class:"el-icon-search"},null,-1),(0,o.eW)("AWS折扣")])})),_:1})]})),_:1})])]})),_:1}),(0,o.bF)(p,{class:"main-content"},{default:(0,o.k6)((function(){return[t[3]||(t[3]=(0,o.Lk)("div",{class:"sun-rays"},null,-1)),(0,o.bF)(f)]})),_:1}),(0,o.bF)(m,{class:"footer"},{default:(0,o.k6)((function(){return t[4]||(t[4]=[(0,o.Lk)("p",null,"AWS EC2 价格计算器 © 2023",-1)])})),_:1})]})),_:1})])}const s={name:"App"};var c=n(6262);const u=(0,c.A)(s,[["render",i]]),d=u;var f=n(5220),p=(n(9868),n(33)),m={class:"price-calculator"},k={class:"form-container"},b={key:0,class:"price-result animated fadeIn"},h={class:"price-card hourly"},g={class:"price-amount"},v={class:"price-card monthly"},_={class:"price-amount"},L={class:"price-card total"},y={class:"price-amount"},F={class:"price-period"},w={key:0,class:"saving-tip"},x={key:1,class:"saving-tip"};function C(e,t,n,r,a,l){var i=(0,o.g2)("el-option"),s=(0,o.g2)("el-select"),c=(0,o.g2)("el-form-item"),u=(0,o.g2)("el-col"),d=(0,o.g2)("el-row"),f=(0,o.g2)("el-slider"),C=(0,o.g2)("el-button"),S=(0,o.g2)("el-form"),V=(0,o.g2)("el-card");return(0,o.uX)(),(0,o.CE)("div",m,[(0,o.bF)(V,{class:"calculator-card"},{header:(0,o.k6)((function(){return t[5]||(t[5]=[(0,o.Lk)("div",{class:"card-header"},[(0,o.Lk)("span",null,[(0,o.Lk)("i",{class:"el-icon-s-finance"}),(0,o.eW)(" EC2 价格计算器")]),(0,o.Lk)("div",{class:"card-subtitle"},"选择您的实例配置,即时获取价格")],-1)])})),default:(0,o.k6)((function(){return[(0,o.Lk)("div",k,[(0,o.bF)(S,{model:a.form,"label-width":"120px"},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"实例类型"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.instance_type,"onUpdate:modelValue":t[0]||(t[0]=function(e){return a.form.instance_type=e}),placeholder:"请选择实例类型",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.instanceTypes,(function(e){return(0,o.uX)(),(0,o.Wv)(i,{key:e,label:e,value:e},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"区域"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.region,"onUpdate:modelValue":t[1]||(t[1]=function(e){return a.form.region=e}),placeholder:"请选择区域",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.regions,(function(e){return(0,o.uX)(),(0,o.Wv)(i,{key:e,label:e,value:e},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"操作系统"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.operating_system,"onUpdate:modelValue":t[2]||(t[2]=function(e){return a.form.operating_system=e}),placeholder:"请选择操作系统",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{label:"Linux",value:"Linux"},{default:(0,o.k6)((function(){return t[6]||(t[6]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"🐧"),(0,o.Lk)("span",null,"Linux")],-1)])})),_:1}),(0,o.bF)(i,{label:"Windows",value:"Windows"},{default:(0,o.k6)((function(){return t[7]||(t[7]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"🪟"),(0,o.Lk)("span",null,"Windows")],-1)])})),_:1})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"购买选项"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.purchase_option,"onUpdate:modelValue":t[3]||(t[3]=function(e){return a.form.purchase_option=e}),placeholder:"请选择购买选项",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{label:"按需实例",value:"OnDemand"},{default:(0,o.k6)((function(){return t[8]||(t[8]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"⏱️"),(0,o.Lk)("span",null,"按需实例")],-1)])})),_:1}),(0,o.bF)(i,{label:"预留实例",value:"Reserved"},{default:(0,o.k6)((function(){return t[9]||(t[9]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"📅"),(0,o.Lk)("span",null,"预留实例")],-1)])})),_:1}),(0,o.bF)(i,{label:"Spot实例",value:"Spot"},{default:(0,o.k6)((function(){return t[10]||(t[10]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"💸"),(0,o.Lk)("span",null,"Spot实例")],-1)])})),_:1})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"使用时长(月)"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.duration,"onUpdate:modelValue":t[4]||(t[4]=function(e){return a.form.duration=e}),min:1,max:36,"format-tooltip":l.formatDuration,marks:{1:"1个月",12:"1年",36:"3年"},class:"duration-slider"},null,8,["modelValue","format-tooltip"])]})),_:1})]})),_:1}),(0,o.bF)(u,{md:12,sm:24,class:"flexible-col"},{default:(0,o.k6)((function(){return[(0,o.bF)(c,null,{default:(0,o.k6)((function(){return[(0,o.bF)(C,{type:"primary",onClick:l.calculatePrice,icon:"el-icon-money",class:"calculate-button"},{default:(0,o.k6)((function(){return t[11]||(t[11]=[(0,o.eW)("计算价格")])})),_:1},8,["onClick"])]})),_:1})]})),_:1})]})),_:1})]})),_:1},8,["model"])]),a.priceResult?((0,o.uX)(),(0,o.CE)("div",b,[t[20]||(t[20]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-data-analysis"}),(0,o.eW)(" 价格计算结果")],-1)),(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",h,[t[12]||(t[12]=(0,o.Lk)("div",{class:"price-icon"},"⏱️",-1)),t[13]||(t[13]=(0,o.Lk)("div",{class:"price-title"},"每小时价格",-1)),(0,o.Lk)("div",g,"$"+(0,p.v_)(a.priceResult.hourly_price.toFixed(4)),1)])]})),_:1}),(0,o.bF)(u,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",v,[t[14]||(t[14]=(0,o.Lk)("div",{class:"price-icon"},"📅",-1)),t[15]||(t[15]=(0,o.Lk)("div",{class:"price-title"},"每月价格",-1)),(0,o.Lk)("div",_,"$"+(0,p.v_)(a.priceResult.monthly_price.toFixed(2)),1)])]})),_:1}),(0,o.bF)(u,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",L,[t[16]||(t[16]=(0,o.Lk)("div",{class:"price-icon"},"💰",-1)),t[17]||(t[17]=(0,o.Lk)("div",{class:"price-title"},"总价格",-1)),(0,o.Lk)("div",y,"$"+(0,p.v_)(a.priceResult.total_price.toFixed(2)),1),(0,o.Lk)("div",F,(0,p.v_)(a.form.duration)+"个月",1)])]})),_:1})]})),_:1}),"Reserved"===a.form.purchase_option?((0,o.uX)(),(0,o.CE)("div",w,t[18]||(t[18]=[(0,o.Lk)("i",{class:"el-icon-info"},null,-1),(0,o.eW)(" 与按需实例相比,预留实例可为您节省高达72%的成本。 ")]))):"Spot"===a.form.purchase_option?((0,o.uX)(),(0,o.CE)("div",x,t[19]||(t[19]=[(0,o.Lk)("i",{class:"el-icon-info"},null,-1),(0,o.eW)(" 与按需实例相比,Spot实例可为您节省高达90%的成本,适合灵活的工作负载。 ")]))):(0,o.Q3)("",!0)])):(0,o.Q3)("",!0)]})),_:1})])}var S=n(4048),V=n(8676),A=n(388),I=(n(2062),n(8111),n(1701),n(6099),n(7764),n(2953),n(4335)),W={apiBaseUrl:"http://api.your-domain.com",defaultRegion:"us-east-1",defaultOS:"Linux",defaultDiskSize:30};const E=W;var $=I.A.create({baseURL:E.apiBaseUrl,timeout:1e4,headers:{"Content-Type":"application/json",Accept:"application/json"}});$.interceptors.request.use((function(e){return e}),(function(e){return Promise.reject(e)})),$.interceptors.response.use((function(e){return e}),(function(e){return console.error("API请求失败:",e),Promise.reject(e)}));var R={getRegions:function(){var e=(0,A.A)((0,S.A)().mark((function e(){var t;return(0,S.A)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$.get("/api/regions");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:throw e.prev=7,e.t0=e["catch"](0),console.error("获取区域列表失败:",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));function t(){return e.apply(this,arguments)}return t}(),getInstanceTypes:function(){var e=(0,A.A)((0,S.A)().mark((function e(){var t;return(0,S.A)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$.get("/api/instance-types");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:throw e.prev=7,e.t0=e["catch"](0),console.error("获取实例类型列表失败:",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));function t(){return e.apply(this,arguments)}return t}(),searchInstances:function(){var e=(0,A.A)((0,S.A)().mark((function e(t){var n;return(0,S.A)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$.post("/api/search-instances",t);case 3:return n=e.sent,e.abrupt("return",n.data);case 7:throw e.prev=7,e.t0=e["catch"](0),console.error("搜索实例失败:",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));function t(t){return e.apply(this,arguments)}return t}(),calculatePrice:function(){var e=(0,A.A)((0,S.A)().mark((function e(t){var n;return(0,S.A)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$.post("/api/calculate-price",t);case 3:return n=e.sent,e.abrupt("return",n.data);case 7:throw e.prev=7,e.t0=e["catch"](0),console.error("计算价格失败:",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));function t(t){return e.apply(this,arguments)}return t}(),comparePrices:function(){var e=(0,A.A)((0,S.A)().mark((function e(t){var n;return(0,S.A)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$.post("/api/compare-prices",t);case 3:return n=e.sent,e.abrupt("return",n.data);case 7:throw e.prev=7,e.t0=e["catch"](0),console.error("比较价格失败:",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));function t(t){return e.apply(this,arguments)}return t}(),getBudgetEstimate:function(){var e=(0,A.A)((0,S.A)().mark((function e(t){var n;return(0,S.A)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$.post("/api/budget",t);case 3:return n=e.sent,e.abrupt("return",n.data);case 7:throw e.prev=7,e.t0=e["catch"](0),console.error("获取预算估算失败:",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));function t(t){return e.apply(this,arguments)}return t}()};const U=R,D={name:"PriceCalculator",data:function(){return{form:{instance_type:"",region:"",operating_system:"Linux",purchase_option:"OnDemand",duration:1},instanceTypes:[],regions:[],priceResult:null}},created:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n,r,o,a;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Promise.all([U.getInstanceTypes(),U.getRegions()]);case 3:n=t.sent,r=(0,V.A)(n,2),o=r[0],a=r[1],e.instanceTypes=o,e.regions=a.map((function(e){return e.code})),t.next=15;break;case 11:t.prev=11,t.t0=t["catch"](0),console.error("Error fetching data:",t.t0),e.$message.error("获取数据失败");case 15:case"end":return t.stop()}}),t,null,[[0,11]])})))()},methods:{calculatePrice:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,U.calculatePrice(e.form);case 3:e.priceResult=t.sent,t.next=10;break;case 6:t.prev=6,t.t0=t["catch"](0),console.error("Error calculating price:",t.t0),e.$message.error("计算价格失败");case 10:case"end":return t.stop()}}),t,null,[[0,6]])})))()},formatDuration:function(e){return 1===e?"1个月":12===e?"1年":36===e?"3年":"".concat(e,"个月")}}},T=(0,c.A)(D,[["render",C],["__scopeId","data-v-6e5933e6"]]),P=T;n(2010);var G={class:"price-comparison"},X={class:"form-container"},O={class:"configurations-container"},B={class:"config-header"},q={class:"comparison-actions"},z={key:0,class:"comparison-results animated fadeIn"},N={class:"chart-container"},j={ref:"priceChart",style:{height:"400px"}},Q={class:"config-number"},K={class:"option-with-icon"},J={class:"option-icon"},M={class:"option-with-icon"},Y={class:"option-icon"},H={class:"price-value"},Z={class:"price-value"},ee={class:"price-value highlight"};function te(e,t,n,r,a,l){var i=(0,o.g2)("el-button"),s=(0,o.g2)("el-option"),c=(0,o.g2)("el-select"),u=(0,o.g2)("el-form-item"),d=(0,o.g2)("el-col"),f=(0,o.g2)("el-row"),m=(0,o.g2)("el-slider"),k=(0,o.g2)("el-form"),b=(0,o.g2)("el-card"),h=(0,o.g2)("el-table-column"),g=(0,o.g2)("el-table");return(0,o.uX)(),(0,o.CE)("div",G,[(0,o.bF)(b,{class:"comparison-card"},{header:(0,o.k6)((function(){return t[0]||(t[0]=[(0,o.Lk)("div",{class:"card-header"},[(0,o.Lk)("span",null,[(0,o.Lk)("i",{class:"el-icon-data-analysis"}),(0,o.eW)(" EC2 价格对比")]),(0,o.Lk)("div",{class:"card-subtitle"},"比较不同配置的价格,做出最佳选择")],-1)])})),default:(0,o.k6)((function(){return[(0,o.Lk)("div",X,[(0,o.Lk)("div",O,[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.configurations,(function(e,n){return(0,o.uX)(),(0,o.CE)("div",{key:n,class:"configuration-item animated fadeIn"},[(0,o.bF)(b,{class:"config-card"},{header:(0,o.k6)((function(){return[(0,o.Lk)("div",B,[(0,o.Lk)("span",null,[t[1]||(t[1]=(0,o.Lk)("i",{class:"el-icon-s-platform"},null,-1)),(0,o.eW)(" 配置 #"+(0,p.v_)(n+1),1)]),(0,o.bF)(i,{type:"danger",size:"small",icon:"el-icon-delete",circle:"",onClick:function(e){return l.removeConfiguration(n)}},null,8,["onClick"])])]})),default:(0,o.k6)((function(){return[(0,o.bF)(k,{model:e,"label-width":"120px"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{label:"实例类型"},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{modelValue:e.instance_type,"onUpdate:modelValue":function(t){return e.instance_type=t},placeholder:"请选择实例类型",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.instanceTypes,(function(e){return(0,o.uX)(),(0,o.Wv)(s,{key:e,label:e,value:e},null,8,["label","value"])})),128))]})),_:2},1032,["modelValue","onUpdate:modelValue"])]})),_:2},1024)]})),_:2},1024),(0,o.bF)(d,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{label:"区域"},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{modelValue:e.region,"onUpdate:modelValue":function(t){return e.region=t},placeholder:"请选择区域",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.regions,(function(e){return(0,o.uX)(),(0,o.Wv)(s,{key:e.code,label:e.name,value:e.code},null,8,["label","value"])})),128))]})),_:2},1032,["modelValue","onUpdate:modelValue"])]})),_:2},1024)]})),_:2},1024)]})),_:2},1024),(0,o.bF)(f,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{label:"操作系统"},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{modelValue:e.operating_system,"onUpdate:modelValue":function(t){return e.operating_system=t},placeholder:"请选择操作系统",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"Linux",value:"Linux"},{default:(0,o.k6)((function(){return t[2]||(t[2]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"🐧"),(0,o.Lk)("span",null,"Linux")],-1)])})),_:1}),(0,o.bF)(s,{label:"Windows",value:"Windows"},{default:(0,o.k6)((function(){return t[3]||(t[3]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"🪟"),(0,o.Lk)("span",null,"Windows")],-1)])})),_:1})]})),_:2},1032,["modelValue","onUpdate:modelValue"])]})),_:2},1024)]})),_:2},1024),(0,o.bF)(d,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{label:"购买选项"},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{modelValue:e.purchase_option,"onUpdate:modelValue":function(t){return e.purchase_option=t},placeholder:"请选择购买选项",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"按需实例",value:"OnDemand"},{default:(0,o.k6)((function(){return t[4]||(t[4]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"⏱️"),(0,o.Lk)("span",null,"按需实例")],-1)])})),_:1}),(0,o.bF)(s,{label:"预留实例",value:"Reserved"},{default:(0,o.k6)((function(){return t[5]||(t[5]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"📅"),(0,o.Lk)("span",null,"预留实例")],-1)])})),_:1}),(0,o.bF)(s,{label:"Spot实例",value:"Spot"},{default:(0,o.k6)((function(){return t[6]||(t[6]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"💸"),(0,o.Lk)("span",null,"Spot实例")],-1)])})),_:1})]})),_:2},1032,["modelValue","onUpdate:modelValue"])]})),_:2},1024)]})),_:2},1024)]})),_:2},1024),(0,o.bF)(u,{label:"使用时长(月)"},{default:(0,o.k6)((function(){return[(0,o.bF)(m,{modelValue:e.duration,"onUpdate:modelValue":function(t){return e.duration=t},min:1,max:36,"format-tooltip":l.formatDuration,marks:{1:"1个月",12:"1年",36:"3年"},class:"duration-slider"},null,8,["modelValue","onUpdate:modelValue","format-tooltip"])]})),_:2},1024)]})),_:2},1032,["model"])]})),_:2},1024)])})),128))]),(0,o.Lk)("div",q,[(0,o.bF)(i,{type:"primary",icon:"el-icon-plus",onClick:l.addConfiguration,class:"action-button"},{default:(0,o.k6)((function(){return t[7]||(t[7]=[(0,o.eW)("添加配置")])})),_:1},8,["onClick"]),(0,o.bF)(i,{type:"success",icon:"el-icon-refresh",onClick:l.comparePrices,class:"action-button"},{default:(0,o.k6)((function(){return t[8]||(t[8]=[(0,o.eW)("比较价格")])})),_:1},8,["onClick"]),(0,o.bF)(i,{icon:"el-icon-download",onClick:l.exportResults,class:"action-button",disabled:!a.comparisonResults.length},{default:(0,o.k6)((function(){return t[9]||(t[9]=[(0,o.eW)("导出结果")])})),_:1},8,["onClick","disabled"])]),a.comparisonResults.length?((0,o.uX)(),(0,o.CE)("div",z,[t[10]||(t[10]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-data"}),(0,o.eW)(" 对比结果")],-1)),(0,o.Lk)("div",N,[(0,o.Lk)("div",j,null,512)]),(0,o.bF)(g,{data:a.comparisonResults,border:"",style:{width:"100%","margin-top":"20px"},stripe:!0,class:"result-table"},{default:(0,o.k6)((function(){return[(0,o.bF)(h,{label:"配置",width:"50"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Q,(0,p.v_)(e.$index+1),1)]})),_:1}),(0,o.bF)(h,{prop:"configuration.instance_type",label:"实例类型"}),(0,o.bF)(h,{prop:"configuration.region",label:"区域"},{default:(0,o.k6)((function(e){return[(0,o.eW)((0,p.v_)(l.getRegionName(e.row.configuration.region)),1)]})),_:1}),(0,o.bF)(h,{prop:"configuration.operating_system",label:"操作系统"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",K,[(0,o.Lk)("span",J,(0,p.v_)("Linux"===e.row.configuration.operating_system?"🐧":"🪟"),1),(0,o.Lk)("span",null,(0,p.v_)(e.row.configuration.operating_system),1)])]})),_:1}),(0,o.bF)(h,{prop:"configuration.purchase_option",label:"购买选项"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",M,[(0,o.Lk)("span",Y,(0,p.v_)("OnDemand"===e.row.configuration.purchase_option?"⏱️":"Reserved"===e.row.configuration.purchase_option?"📅":"💸"),1),(0,o.Lk)("span",null,(0,p.v_)(l.getPurchaseOptionLabel(e.row.configuration.purchase_option)),1)])]})),_:1}),(0,o.bF)(h,{prop:"price.hourly_price",label:"每小时价格"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",H," $"+(0,p.v_)(e.row.price.hourly_price.toFixed(4)),1)]})),_:1}),(0,o.bF)(h,{prop:"price.monthly_price",label:"每月价格"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Z," $"+(0,p.v_)(e.row.price.monthly_price.toFixed(2)),1)]})),_:1}),(0,o.bF)(h,{prop:"price.total_price",label:"总价格"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",ee," $"+(0,p.v_)(e.row.price.total_price.toFixed(2)),1)]})),_:1})]})),_:1},8,["data"])])):(0,o.Q3)("",!0)])]})),_:1})])}var ne=n(9258),re=(n(8706),n(113),n(8598),n(4114),n(4554),n(116),n(3296),n(7208),n(8408),n(4603),n(7566),n(8721),n(8605));const oe={name:"PriceComparison",data:function(){return{configurations:[],instanceTypes:[],regions:[],comparisonResults:[]}},created:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n,r,o,a;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Promise.all([U.getInstanceTypes(),U.getRegions()]);case 3:n=t.sent,r=(0,V.A)(n,2),o=r[0],a=r[1],e.instanceTypes=o,e.regions=a,e.addConfiguration(),t.next=16;break;case 12:t.prev=12,t.t0=t["catch"](0),console.error("Error fetching data:",t.t0),e.$message.error("获取数据失败");case 16:case"end":return t.stop()}}),t,null,[[0,12]])})))()},methods:{addConfiguration:function(){this.configurations.push({instance_type:"",region:"",operating_system:"Linux",purchase_option:"OnDemand",duration:1})},removeConfiguration:function(e){this.configurations.splice(e,1),0===this.configurations.length&&this.addConfiguration()},comparePrices:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,U.comparePrices({configurations:e.configurations});case 3:e.comparisonResults=t.sent,e.$nextTick((function(){e.updateChart()})),t.next=11;break;case 7:t.prev=7,t.t0=t["catch"](0),console.error("Error comparing prices:",t.t0),e.$message.error("比较价格失败");case 11:case"end":return t.stop()}}),t,null,[[0,7]])})))()},updateChart:function(){var e=this.$refs.priceChart,t=re.Ts(e),n={title:{text:"价格对比图表",left:"center",textStyle:{color:"#2c3e50"}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},legend:{data:["每小时价格","每月价格","总价格"],bottom:10},xAxis:{type:"category",data:this.comparisonResults.map((function(e,t){return"配置 ".concat(t+1)})),axisLine:{lineStyle:{color:"#7f8c8d"}},axisTick:{alignWithLabel:!0}},yAxis:{type:"value",name:"价格 ($)",nameTextStyle:{color:"#7f8c8d"},axisLine:{lineStyle:{color:"#7f8c8d"}},splitLine:{lineStyle:{color:"#f0f0f0"}}},series:[{name:"每小时价格",type:"bar",data:this.comparisonResults.map((function(e){return e.price.hourly_price})),itemStyle:{color:"#3498db"}},{name:"每月价格",type:"bar",data:this.comparisonResults.map((function(e){return e.price.monthly_price})),itemStyle:{color:"#f39c12"}},{name:"总价格",type:"bar",data:this.comparisonResults.map((function(e){return e.price.total_price})),itemStyle:{color:"#2ecc71"},label:{show:!0,position:"top",formatter:"{c}$",fontSize:12}}]};t.setOption(n),window.addEventListener("resize",(function(){t.resize()}))},exportResults:function(){if(this.comparisonResults.length){var e=this.generateCSV(),t=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=document.createElement("a");n.href=URL.createObjectURL(t),n.download="price-comparison.csv",n.click(),this.$message.success("导出成功")}else this.$message.warning("没有可导出的结果")},generateCSV:function(){var e=this,t=["实例类型","区域","操作系统","购买选项","每小时价格","每月价格","总价格"],n=this.comparisonResults.map((function(t){return[t.configuration.instance_type,t.configuration.region,t.configuration.operating_system,e.getPurchaseOptionLabel(t.configuration.purchase_option),t.price.hourly_price.toFixed(4),t.price.monthly_price.toFixed(2),t.price.total_price.toFixed(2)]}));return[t.join(",")].concat((0,ne.A)(n.map((function(e){return e.join(",")})))).join("\n")},formatDuration:function(e){return 1===e?"1个月":12===e?"1年":36===e?"3年":"".concat(e,"个月")},getPurchaseOptionLabel:function(e){switch(e){case"OnDemand":return"按需实例";case"Reserved":return"预留实例";case"Spot":return"Spot实例";default:return e}},getRegionName:function(e){var t=this.regions.find((function(t){return t.code===e}));return t?t.name:e}}},ae=(0,c.A)(oe,[["render",te],["__scopeId","data-v-0ce1aa60"]]),le=ae;var ie={class:"budget-estimator"},se={class:"form-container"},ce={key:0,class:"custom-duration"},ue={key:1,class:"preset-duration"},de={class:"form-actions"},fe={key:0,class:"budget-result animated fadeIn"},pe={class:"budget-card hourly"},me={class:"budget-amount"},ke={class:"budget-card monthly"},be={class:"budget-amount"},he={class:"budget-card yearly"},ge={class:"budget-amount"},ve={class:"budget-card total"},_e={class:"budget-amount"},Le={class:"budget-period"},ye={class:"chart-container"},Fe={ref:"budgetChart",style:{height:"400px"}},we={class:"budget-tips"},xe={key:0},Ce={key:1};function Se(e,t,n,r,a,l){var i=(0,o.g2)("el-option"),s=(0,o.g2)("el-select"),c=(0,o.g2)("el-form-item"),u=(0,o.g2)("el-col"),d=(0,o.g2)("el-row"),f=(0,o.g2)("el-divider"),m=(0,o.g2)("el-radio-button"),k=(0,o.g2)("el-radio-group"),b=(0,o.g2)("el-slider"),h=(0,o.g2)("el-radio"),g=(0,o.g2)("el-button"),v=(0,o.g2)("el-form"),_=(0,o.g2)("el-card");return(0,o.uX)(),(0,o.CE)("div",ie,[(0,o.bF)(_,{class:"estimator-card"},{header:(0,o.k6)((function(){return t[7]||(t[7]=[(0,o.Lk)("div",{class:"card-header"},[(0,o.Lk)("span",null,[(0,o.Lk)("i",{class:"el-icon-money"}),(0,o.eW)(" EC2 预算估算")]),(0,o.Lk)("div",{class:"card-subtitle"},"规划您的云计算花费,避免预算超支")],-1)])})),default:(0,o.k6)((function(){return[(0,o.Lk)("div",se,[(0,o.bF)(v,{model:a.form,"label-width":"120px"},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"实例类型"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.instance_type,"onUpdate:modelValue":t[0]||(t[0]=function(e){return a.form.instance_type=e}),placeholder:"请选择实例类型",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.instanceTypes,(function(e){return(0,o.uX)(),(0,o.Wv)(i,{key:e,label:e,value:e},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"区域"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.region,"onUpdate:modelValue":t[1]||(t[1]=function(e){return a.form.region=e}),placeholder:"请选择区域",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.regions,(function(e){return(0,o.uX)(),(0,o.Wv)(i,{key:e.code,label:e.name,value:e.code},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"操作系统"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.operating_system,"onUpdate:modelValue":t[2]||(t[2]=function(e){return a.form.operating_system=e}),placeholder:"请选择操作系统",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{label:"Linux",value:"Linux"},{default:(0,o.k6)((function(){return t[8]||(t[8]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"🐧"),(0,o.Lk)("span",null,"Linux")],-1)])})),_:1}),(0,o.bF)(i,{label:"Windows",value:"Windows"},{default:(0,o.k6)((function(){return t[9]||(t[9]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"🪟"),(0,o.Lk)("span",null,"Windows")],-1)])})),_:1})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(u,{md:12,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{label:"购买选项"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{modelValue:a.form.purchase_option,"onUpdate:modelValue":t[3]||(t[3]=function(e){return a.form.purchase_option=e}),placeholder:"请选择购买选项",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{label:"按需实例",value:"OnDemand"},{default:(0,o.k6)((function(){return t[10]||(t[10]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"⏱️"),(0,o.Lk)("span",null,"按需实例")],-1)])})),_:1}),(0,o.bF)(i,{label:"预留实例",value:"Reserved"},{default:(0,o.k6)((function(){return t[11]||(t[11]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"📅"),(0,o.Lk)("span",null,"预留实例")],-1)])})),_:1}),(0,o.bF)(i,{label:"Spot实例",value:"Spot"},{default:(0,o.k6)((function(){return t[12]||(t[12]=[(0,o.Lk)("div",{class:"option-with-icon"},[(0,o.Lk)("span",{class:"option-icon"},"💸"),(0,o.Lk)("span",null,"Spot实例")],-1)])})),_:1})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(f,{"content-position":"center"},{default:(0,o.k6)((function(){return t[13]||(t[13]=[(0,o.Lk)("i",{class:"el-icon-time"},null,-1),(0,o.eW)(" 使用时长设置 ")])})),_:1}),(0,o.bF)(c,null,{default:(0,o.k6)((function(){return[(0,o.bF)(k,{modelValue:a.form.duration_type,"onUpdate:modelValue":t[4]||(t[4]=function(e){return a.form.duration_type=e}),class:"duration-radio-group"},{default:(0,o.k6)((function(){return[(0,o.bF)(m,{label:"preset"},{default:(0,o.k6)((function(){return t[14]||(t[14]=[(0,o.Lk)("div",{class:"radio-content"},[(0,o.Lk)("i",{class:"el-icon-star-off"}),(0,o.Lk)("span",null,"预设时长")],-1)])})),_:1}),(0,o.bF)(m,{label:"custom"},{default:(0,o.k6)((function(){return t[15]||(t[15]=[(0,o.Lk)("div",{class:"radio-content"},[(0,o.Lk)("i",{class:"el-icon-edit"}),(0,o.Lk)("span",null,"自定义")],-1)])})),_:1})]})),_:1},8,["modelValue"])]})),_:1}),"custom"===a.form.duration_type?((0,o.uX)(),(0,o.CE)("div",ce,[(0,o.bF)(c,{label:"月数"},{default:(0,o.k6)((function(){return[(0,o.bF)(b,{modelValue:a.form.duration,"onUpdate:modelValue":t[5]||(t[5]=function(e){return a.form.duration=e}),min:1,max:36,"format-tooltip":l.formatDuration,marks:{1:"1个月",12:"1年",36:"3年"},class:"duration-slider"},null,8,["modelValue","format-tooltip"])]})),_:1})])):((0,o.uX)(),(0,o.CE)("div",ue,[(0,o.bF)(c,{label:"预设时长"},{default:(0,o.k6)((function(){return[(0,o.bF)(k,{modelValue:a.form.preset_duration,"onUpdate:modelValue":t[6]||(t[6]=function(e){return a.form.preset_duration=e}),class:"preset-radio-group"},{default:(0,o.k6)((function(){return[(0,o.bF)(h,{label:1},{default:(0,o.k6)((function(){return t[16]||(t[16]=[(0,o.Lk)("div",{class:"duration-option"},[(0,o.Lk)("span",{class:"duration-icon"},"1"),(0,o.Lk)("span",null,"1个月")],-1)])})),_:1}),(0,o.bF)(h,{label:3},{default:(0,o.k6)((function(){return t[17]||(t[17]=[(0,o.Lk)("div",{class:"duration-option"},[(0,o.Lk)("span",{class:"duration-icon"},"3"),(0,o.Lk)("span",null,"3个月")],-1)])})),_:1}),(0,o.bF)(h,{label:6},{default:(0,o.k6)((function(){return t[18]||(t[18]=[(0,o.Lk)("div",{class:"duration-option"},[(0,o.Lk)("span",{class:"duration-icon"},"6"),(0,o.Lk)("span",null,"6个月")],-1)])})),_:1}),(0,o.bF)(h,{label:12},{default:(0,o.k6)((function(){return t[19]||(t[19]=[(0,o.Lk)("div",{class:"duration-option"},[(0,o.Lk)("span",{class:"duration-icon"},"12"),(0,o.Lk)("span",null,"1年")],-1)])})),_:1}),(0,o.bF)(h,{label:36},{default:(0,o.k6)((function(){return t[20]||(t[20]=[(0,o.Lk)("div",{class:"duration-option"},[(0,o.Lk)("span",{class:"duration-icon"},"36"),(0,o.Lk)("span",null,"3年")],-1)])})),_:1})]})),_:1},8,["modelValue"])]})),_:1})])),(0,o.Lk)("div",de,[(0,o.bF)(g,{type:"primary",onClick:l.calculateBudget,icon:"el-icon-money",class:"calculate-button"},{default:(0,o.k6)((function(){return t[21]||(t[21]=[(0,o.eW)("计算预算")])})),_:1},8,["onClick"])])]})),_:1},8,["model"])]),a.budgetResult?((0,o.uX)(),(0,o.CE)("div",fe,[t[33]||(t[33]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-wallet"}),(0,o.eW)(" 预算估算结果")],-1)),(0,o.bF)(d,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{md:6,sm:12},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",pe,[t[22]||(t[22]=(0,o.Lk)("div",{class:"budget-icon"},"⏱️",-1)),t[23]||(t[23]=(0,o.Lk)("div",{class:"budget-title"},"每小时价格",-1)),(0,o.Lk)("div",me,"$"+(0,p.v_)(a.budgetResult.hourly_price.toFixed(4)),1)])]})),_:1}),(0,o.bF)(u,{md:6,sm:12},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",ke,[t[24]||(t[24]=(0,o.Lk)("div",{class:"budget-icon"},"📅",-1)),t[25]||(t[25]=(0,o.Lk)("div",{class:"budget-title"},"每月价格",-1)),(0,o.Lk)("div",be,"$"+(0,p.v_)(a.budgetResult.monthly_price.toFixed(2)),1)])]})),_:1}),(0,o.bF)(u,{md:6,sm:12},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",he,[t[26]||(t[26]=(0,o.Lk)("div",{class:"budget-icon"},"🗓️",-1)),t[27]||(t[27]=(0,o.Lk)("div",{class:"budget-title"},"年度价格",-1)),(0,o.Lk)("div",ge,"$"+(0,p.v_)((12*a.budgetResult.monthly_price).toFixed(2)),1)])]})),_:1}),(0,o.bF)(u,{md:6,sm:12},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",ve,[t[28]||(t[28]=(0,o.Lk)("div",{class:"budget-icon"},"💰",-1)),t[29]||(t[29]=(0,o.Lk)("div",{class:"budget-title"},"总价格",-1)),(0,o.Lk)("div",_e,"$"+(0,p.v_)(a.budgetResult.total_price.toFixed(2)),1),(0,o.Lk)("div",Le,(0,p.v_)(l.getDurationText()),1)])]})),_:1})]})),_:1}),(0,o.Lk)("div",ye,[(0,o.Lk)("div",Fe,null,512)]),(0,o.Lk)("div",we,[t[32]||(t[32]=(0,o.Lk)("h4",null,[(0,o.Lk)("i",{class:"el-icon-warning-outline"}),(0,o.eW)(" 预算提示")],-1)),(0,o.Lk)("ul",null,[t[30]||(t[30]=(0,o.Lk)("li",null,"以上价格仅包含EC2实例费用,不包含存储、数据传输等额外费用",-1)),t[31]||(t[31]=(0,o.Lk)("li",null,"实际账单可能因使用情况和AWS价格变动而有所不同",-1)),"Reserved"===a.form.purchase_option?((0,o.uX)(),(0,o.CE)("li",xe,"预留实例需要预付费用,但总体可节省高达72%的成本")):(0,o.Q3)("",!0),"Spot"===a.form.purchase_option?((0,o.uX)(),(0,o.CE)("li",Ce,"Spot实例价格可能随市场波动,但可节省高达90%的成本")):(0,o.Q3)("",!0)])])])):(0,o.Q3)("",!0)]})),_:1})])}var Ve=n(9201);n(3418);const Ae={name:"BudgetEstimator",data:function(){return{form:{instance_type:"",region:"",operating_system:"Linux",purchase_option:"OnDemand",duration_type:"preset",duration:1,preset_duration:1},instanceTypes:[],regions:[],budgetResult:null}},created:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n,r,o,a;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Promise.all([U.getInstanceTypes(),U.getRegions()]);case 3:n=t.sent,r=(0,V.A)(n,2),o=r[0],a=r[1],e.instanceTypes=o,e.regions=a,e.instanceTypes&&e.instanceTypes.length>0&&(e.form.instance_type=e.instanceTypes[0]),e.regions&&e.regions.length>0&&(e.form.region=e.regions[0].code),t.next=17;break;case 13:t.prev=13,t.t0=t["catch"](0),console.error("Error fetching data:",t.t0),e.$message.error("获取数据失败");case 17:case"end":return t.stop()}}),t,null,[[0,13]])})))()},methods:{calculateBudget:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,n="custom"===e.form.duration_type?e.form.duration:e.form.preset_duration,t.next=4,U.calculatePrice((0,Ve.A)((0,Ve.A)({},e.form),{},{duration:n}));case 4:e.budgetResult=t.sent,e.$nextTick((function(){e.updateChart()})),t.next=12;break;case 8:t.prev=8,t.t0=t["catch"](0),console.error("Error calculating budget:",t.t0),e.$message.error("计算预算失败");case 12:case"end":return t.stop()}}),t,null,[[0,8]])})))()},updateChart:function(){var e=this,t=this.$refs.budgetChart,n=re.Ts(t),r="custom"===this.form.duration_type?this.form.duration:this.form.preset_duration,o=Array.from({length:r},(function(t,n){return{month:"第".concat(n+1,"个月"),cost:e.budgetResult.monthly_price}})),a={title:{text:"月度成本趋势",left:"center",textStyle:{color:"#2c3e50"}},tooltip:{trigger:"axis",formatter:"{b}: ${c}"},xAxis:{type:"category",data:o.map((function(e){return e.month})),axisLine:{lineStyle:{color:"#7f8c8d"}}},yAxis:{type:"value",name:"成本 ($)",nameTextStyle:{color:"#7f8c8d"},axisLine:{lineStyle:{color:"#7f8c8d"}},splitLine:{lineStyle:{color:"#f0f0f0"}}},series:[{name:"月度成本",type:"bar",data:o.map((function(e){return e.cost})),itemStyle:{color:new re.fA.W4(0,0,0,1,[{offset:0,color:"#f39c12"},{offset:1,color:"#e67e22"}])},markLine:{data:[{type:"average",name:"平均值",lineStyle:{color:"#e74c3c"},label:{formatter:"平均月度成本: ${avg}",color:"#e74c3c"}}]}},{name:"累计成本",type:"line",smooth:!0,symbol:"circle",symbolSize:8,data:o.map((function(t,n){return e.budgetResult.monthly_price*(n+1)})),itemStyle:{color:"#3498db"},lineStyle:{width:3,color:new re.fA.W4(0,0,1,0,[{offset:0,color:"#3498db"},{offset:1,color:"#2980b9"}])}}]};n.setOption(a),window.addEventListener("resize",(function(){n.resize()}))},formatDuration:function(e){return 1===e?"1个月":12===e?"1年":36===e?"3年":"".concat(e,"个月")},getDurationText:function(){var e="custom"===this.form.duration_type?this.form.duration:this.form.preset_duration;return 1===e?"1个月":12===e?"1年":36===e?"3年":"".concat(e,"个月")},getRegionName:function(e){var t=this.regions.find((function(t){return t.code===e}));return t?t.name:e}}},Ie=(0,c.A)(Ae,[["render",Se],["__scopeId","data-v-34d8fb2a"]]),We=Ie;var Ee={class:"instance-search"},$e={class:"form-container"},Re={key:0,class:"loading-container"},Ue={key:1,class:"search-results animated fadeIn"},De={class:"instance-type"},Te={class:"spec-value"},Pe={class:"spec-value"},Ge={class:"spec-value"},Xe={class:"price-breakdown"},Oe={class:"price-item"},Be={class:"price-value"},qe={class:"price-item"},ze={class:"price-value"},Ne={class:"price-item total"},je={class:"price-value highlight"},Qe={class:"action-buttons-cell"},Ke={key:2,class:"no-results"},Je={key:3,class:"selected-instance animated fadeIn"},Me={class:"instance-info-item"},Ye={class:"info-value"},He={class:"instance-info-item"},Ze={class:"info-value"},et={class:"instance-info-item"},tt={class:"info-value"},nt={class:"instance-info-item"},rt={class:"info-value"},ot={class:"instance-info-item"},at={class:"info-value"},lt={class:"instance-info-item"},it={class:"info-value"},st={class:"price-info-item"},ct={class:"price-amount"},ut={class:"price-info-item"},dt={class:"price-amount"},ft={class:"price-note"},pt={class:"price-info-item total"},mt={class:"price-amount"},kt={class:"action-buttons"},bt={key:4,class:"comparison-section animated fadeIn"},ht={class:"quote-header"},gt={class:"quote-info"},vt={class:"info-table"},_t={class:"info-value"},Lt={class:"info-value"},yt={class:"info-value"},Ft={class:"price-value highlight"},wt={class:"price-value highlight"},xt={class:"quote-actions"},Ct={class:"summary-item"},St={class:"summary-value"},Vt={class:"summary-buttons"};function At(e,t,n,r,a,l){var i=(0,o.g2)("el-input-number"),s=(0,o.g2)("el-form-item"),c=(0,o.g2)("el-col"),u=(0,o.g2)("el-row"),d=(0,o.g2)("el-option"),f=(0,o.g2)("el-select"),m=(0,o.g2)("el-button"),k=(0,o.g2)("el-form"),b=(0,o.g2)("el-skeleton"),h=(0,o.g2)("el-tag"),g=(0,o.g2)("el-table-column"),v=(0,o.g2)("el-table"),_=(0,o.g2)("el-empty"),L=(0,o.g2)("el-divider"),y=(0,o.g2)("el-card"),F=(0,o.g2)("el-input");return(0,o.uX)(),(0,o.CE)("div",Ee,[(0,o.bF)(y,{class:"search-card"},{header:(0,o.k6)((function(){return t[9]||(t[9]=[(0,o.Lk)("div",{class:"card-header"},[(0,o.Lk)("span",null,[(0,o.Lk)("i",{class:"el-icon-search"}),(0,o.eW)(" EC2 实例配置搜索")]),(0,o.Lk)("div",{class:"card-subtitle"},"根据您的需求规格,找到最合适的实例类型")],-1)])})),default:(0,o.k6)((function(){return[(0,o.Lk)("div",$e,[(0,o.bF)(k,{model:a.form,"label-width":"120px"},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"CPU 核心数"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.cpu_cores,"onUpdate:modelValue":t[0]||(t[0]=function(e){return a.form.cpu_cores=e}),min:1,max:64,step:1,placeholder:"所需CPU核心数",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"内存(GB)"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.memory_gb,"onUpdate:modelValue":t[1]||(t[1]=function(e){return a.form.memory_gb=e}),min:.5,max:256,step:.5,placeholder:"所需内存容量(GB)",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"磁盘(GB)"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.disk_gb,"onUpdate:modelValue":t[2]||(t[2]=function(e){return a.form.disk_gb=e}),min:8,max:16e3,step:1,placeholder:"GP3卷存储容量(GB)",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"区域"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.region,"onUpdate:modelValue":t[3]||(t[3]=function(e){return a.form.region=e}),placeholder:"请选择区域",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.regions,(function(e){return(0,o.uX)(),(0,o.Wv)(d,{key:e.code,label:e.name,value:e.code},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"操作系统"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.operating_system,"onUpdate:modelValue":t[4]||(t[4]=function(e){return a.form.operating_system=e}),placeholder:"选择操作系统",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{label:"Linux",value:"Linux"}),(0,o.bF)(d,{label:"Windows",value:"Windows"})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"磁盘类型"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.disk_type,"onUpdate:modelValue":t[5]||(t[5]=function(e){return a.form.disk_type=e}),disabled:"",placeholder:"磁盘类型",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{label:"GP3 (通用SSD)",value:"gp3"})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24,class:"flexible-col"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,null,{default:(0,o.k6)((function(){return[(0,o.bF)(m,{type:"primary",onClick:l.searchInstances,icon:"el-icon-search",class:"search-button"},{default:(0,o.k6)((function(){return t[10]||(t[10]=[(0,o.eW)("搜索实例")])})),_:1},8,["onClick"])]})),_:1})]})),_:1})]})),_:1})]})),_:1},8,["model"])]),a.loading?((0,o.uX)(),(0,o.CE)("div",Re,[(0,o.bF)(b,{rows:5,animated:""})])):a.searchResults.length?((0,o.uX)(),(0,o.CE)("div",Ue,[t[19]||(t[19]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-data"}),(0,o.eW)(" 符合条件的实例")],-1)),(0,o.bF)(v,{data:a.searchResults,border:"",style:{width:"100%"},stripe:!0,class:"result-table"},{default:(0,o.k6)((function(){return[(0,o.bF)(g,{prop:"instance_type",label:"实例类型",width:"120"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",De,[(0,o.bF)(h,{type:"info"},{default:(0,o.k6)((function(){return[(0,o.eW)((0,p.v_)(e.row.instance_type),1)]})),_:2},1024)])]})),_:1}),(0,o.bF)(g,{prop:"description",label:"描述","min-width":"180"}),(0,o.bF)(g,{prop:"cpu",label:"CPU核心",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Te,[t[11]||(t[11]=(0,o.Lk)("i",{class:"el-icon-cpu"},null,-1)),(0,o.eW)(" "+(0,p.v_)(e.row.cpu),1)])]})),_:1}),(0,o.bF)(g,{prop:"memory",label:"内存(GB)",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Pe,[t[12]||(t[12]=(0,o.Lk)("i",{class:"el-icon-coin"},null,-1)),(0,o.eW)(" "+(0,p.v_)(e.row.memory),1)])]})),_:1}),(0,o.bF)(g,{prop:"disk_gb",label:"磁盘(GB)",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Ge,[t[13]||(t[13]=(0,o.Lk)("i",{class:"el-icon-folder"},null,-1)),(0,o.eW)(" "+(0,p.v_)(e.row.disk_gb),1)])]})),_:1}),(0,o.bF)(g,{label:"每月价格",width:"260"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Xe,[(0,o.Lk)("div",Oe,[t[14]||(t[14]=(0,o.Lk)("span",{class:"price-label"},"实例:",-1)),(0,o.Lk)("span",Be,"$"+(0,p.v_)(e.row.monthly_price.toFixed(2)),1)]),(0,o.Lk)("div",qe,[t[15]||(t[15]=(0,o.Lk)("span",{class:"price-label"},"磁盘:",-1)),(0,o.Lk)("span",ze,"$"+(0,p.v_)(e.row.disk_monthly_price.toFixed(2)),1)]),(0,o.Lk)("div",Ne,[t[16]||(t[16]=(0,o.Lk)("span",{class:"price-label"},"总计:",-1)),(0,o.Lk)("span",je,"$"+(0,p.v_)(e.row.total_monthly_price.toFixed(2)),1)])])]})),_:1}),(0,o.bF)(g,{label:"操作",width:"200",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Qe,[(0,o.bF)(m,{type:"primary",size:"small",onClick:function(t){return l.selectInstance(e.row)},icon:"el-icon-select"},{default:(0,o.k6)((function(){return t[17]||(t[17]=[(0,o.eW)(" 查看详情 ")])})),_:2},1032,["onClick"]),(0,o.bF)(m,{type:"success",size:"small",onClick:function(t){return l.addToComparison(e.row)},icon:"el-icon-plus"},{default:(0,o.k6)((function(){return t[18]||(t[18]=[(0,o.eW)(" 加入对比 ")])})),_:2},1032,["onClick"])])]})),_:1})]})),_:1},8,["data"])])):a.searched?((0,o.uX)(),(0,o.CE)("div",Ke,[(0,o.bF)(_,{description:"没有找到符合条件的实例,请尝试降低配置要求"})])):(0,o.Q3)("",!0),a.selectedInstance?((0,o.uX)(),(0,o.CE)("div",Je,[t[37]||(t[37]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-check"}),(0,o.eW)(" 已选择实例")],-1)),(0,o.bF)(y,{class:"instance-card"},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",Me,[t[20]||(t[20]=(0,o.Lk)("div",{class:"info-label"},"实例类型",-1)),(0,o.Lk)("div",Ye,(0,p.v_)(a.selectedInstance.instance_type),1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",He,[t[21]||(t[21]=(0,o.Lk)("div",{class:"info-label"},"CPU核心",-1)),(0,o.Lk)("div",Ze,(0,p.v_)(a.selectedInstance.cpu)+" 核",1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",et,[t[22]||(t[22]=(0,o.Lk)("div",{class:"info-label"},"内存",-1)),(0,o.Lk)("div",tt,(0,p.v_)(a.selectedInstance.memory)+" GB",1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",nt,[t[23]||(t[23]=(0,o.Lk)("div",{class:"info-label"},"磁盘",-1)),(0,o.Lk)("div",rt,(0,p.v_)(a.selectedInstance.disk_gb)+" GB (GP3)",1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",ot,[t[24]||(t[24]=(0,o.Lk)("div",{class:"info-label"},"区域",-1)),(0,o.Lk)("div",at,(0,p.v_)(l.getRegionName(a.form.region)),1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",lt,[t[25]||(t[25]=(0,o.Lk)("div",{class:"info-label"},"操作系统",-1)),(0,o.Lk)("div",it,(0,p.v_)(a.form.operating_system),1)])]})),_:1})]})),_:1}),(0,o.bF)(L,{"content-position":"center"},{default:(0,o.k6)((function(){return t[26]||(t[26]=[(0,o.eW)("价格信息")])})),_:1}),(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",st,[t[27]||(t[27]=(0,o.Lk)("div",{class:"price-icon"},"⏱️",-1)),t[28]||(t[28]=(0,o.Lk)("div",{class:"price-title"},"每小时价格",-1)),(0,o.Lk)("div",ct,"$"+(0,p.v_)(a.selectedInstance.hourly_price.toFixed(4)),1),t[29]||(t[29]=(0,o.Lk)("div",{class:"price-note"},"实例每小时费用",-1))])]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",ut,[t[30]||(t[30]=(0,o.Lk)("div",{class:"price-icon"},"💾",-1)),t[31]||(t[31]=(0,o.Lk)("div",{class:"price-title"},"存储价格",-1)),(0,o.Lk)("div",dt,"$"+(0,p.v_)((a.selectedInstance.disk_monthly_price/30).toFixed(4))+"/天",1),(0,o.Lk)("div",ft,(0,p.v_)(a.selectedInstance.disk_gb)+"GB GP3卷每天费用",1)])]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",pt,[t[32]||(t[32]=(0,o.Lk)("div",{class:"price-icon"},"💰",-1)),t[33]||(t[33]=(0,o.Lk)("div",{class:"price-title"},"每月总费用",-1)),(0,o.Lk)("div",mt,"$"+(0,p.v_)(a.selectedInstance.total_monthly_price.toFixed(2)),1),t[34]||(t[34]=(0,o.Lk)("div",{class:"price-note"},"预计30天使用总费用",-1))])]})),_:1})]})),_:1}),(0,o.Lk)("div",kt,[(0,o.bF)(m,{type:"success",icon:"el-icon-shopping-cart-full",onClick:t[6]||(t[6]=function(e){return l.addToComparison(a.selectedInstance)})},{default:(0,o.k6)((function(){return t[35]||(t[35]=[(0,o.eW)("添加到对比")])})),_:1}),(0,o.bF)(m,{type:"primary",icon:"el-icon-s-finance",onClick:l.goToCalculator},{default:(0,o.k6)((function(){return t[36]||(t[36]=[(0,o.eW)("详细价格计算")])})),_:1},8,["onClick"])])]})),_:1})])):(0,o.Q3)("",!0),a.comparisonList.length>0?((0,o.uX)(),(0,o.CE)("div",bt,[t[52]||(t[52]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-data"}),(0,o.eW)(" AWS亚马逊报价单")],-1)),(0,o.bF)(y,{class:"comparison-card"},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",ht,[t[45]||(t[45]=(0,o.Lk)("div",{class:"quote-title"},"AWS亚马逊报价单",-1)),(0,o.Lk)("div",gt,[(0,o.Lk)("table",vt,[(0,o.Lk)("tr",null,[t[38]||(t[38]=(0,o.Lk)("td",{class:"info-label"},"联系人:",-1)),(0,o.Lk)("td",_t,[(0,o.bF)(F,{modelValue:a.quoteInfo.contact,"onUpdate:modelValue":t[7]||(t[7]=function(e){return a.quoteInfo.contact=e}),placeholder:"请输入联系人"},null,8,["modelValue"])]),t[39]||(t[39]=(0,o.Lk)("td",null,null,-1)),t[40]||(t[40]=(0,o.Lk)("td",{class:"info-label"},"签发日期:",-1)),(0,o.Lk)("td",Lt,(0,p.v_)(l.getCurrentDate()),1)]),(0,o.Lk)("tr",null,[t[41]||(t[41]=(0,o.Lk)("td",{class:"info-label"},"电话:",-1)),(0,o.Lk)("td",yt,[(0,o.bF)(F,{modelValue:a.quoteInfo.phone,"onUpdate:modelValue":t[8]||(t[8]=function(e){return a.quoteInfo.phone=e}),placeholder:"请输入电话"},null,8,["modelValue"])]),t[42]||(t[42]=(0,o.Lk)("td",null,null,-1)),t[43]||(t[43]=(0,o.Lk)("td",{class:"info-label"},"电话:",-1)),t[44]||(t[44]=(0,o.Lk)("td",{class:"info-value"},null,-1))])])])]),(0,o.bF)(v,{data:a.comparisonList,border:"",style:{width:"100%"},stripe:!0,class:"comparison-table"},{default:(0,o.k6)((function(){return[(0,o.bF)(g,{label:"产品名称",width:"80",align:"center"},{default:(0,o.k6)((function(){return t[46]||(t[46]=[(0,o.Lk)("span",null,"EC2",-1)])})),_:1}),(0,o.bF)(g,{prop:"instance_type",label:"规格型号",width:"150",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",null,(0,p.v_)(l.formatSpecDescription(e.row)),1)]})),_:1}),(0,o.bF)(g,{label:"磁盘",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",null,(0,p.v_)(e.row.disk_gb)+"G GP3",1)]})),_:1}),(0,o.bF)(g,{label:"操作系统",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",null,(0,p.v_)(l.formatOS(e.row.operating_system)),1)]})),_:1}),(0,o.bF)(g,{label:"区域",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",null,(0,p.v_)(l.getShortRegionName(e.row.region)),1)]})),_:1}),(0,o.bF)(g,{label:"官方月付全额 美元USD",width:"180",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",Ft,"$"+(0,p.v_)(e.row.total_monthly_price.toFixed(2)),1)]})),_:1}),(0,o.bF)(g,{label:"官方年付全额 美元USD",width:"180",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",wt,"$"+(0,p.v_)((12*e.row.total_monthly_price).toFixed(2)),1)]})),_:1}),(0,o.bF)(g,{label:"操作",width:"80",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.bF)(m,{type:"danger",size:"mini",onClick:function(t){return l.removeFromComparison(e.$index)},icon:"el-icon-delete"},{default:(0,o.k6)((function(){return t[47]||(t[47]=[(0,o.eW)(" 移除 ")])})),_:2},1032,["onClick"])]})),_:1})]})),_:1},8,["data"]),t[51]||(t[51]=(0,o.Lk)("div",{class:"quote-notes"},[(0,o.Lk)("div",{class:"note-title"},"说明事项:"),(0,o.Lk)("div",{class:"note-items"},[(0,o.Lk)("div",{class:"note-item"},"1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 美国$0.12USD/GB")])],-1)),(0,o.Lk)("div",xt,[(0,o.Lk)("div",Ct,[t[48]||(t[48]=(0,o.Lk)("div",{class:"summary-label"},"对比实例数量:",-1)),(0,o.Lk)("div",St,(0,p.v_)(a.comparisonList.length),1)]),(0,o.Lk)("div",Vt,[(0,o.bF)(m,{type:"primary",icon:"el-icon-download",onClick:l.exportComparison},{default:(0,o.k6)((function(){return t[49]||(t[49]=[(0,o.eW)("导出报价单")])})),_:1},8,["onClick"]),(0,o.bF)(m,{type:"danger",icon:"el-icon-delete",onClick:l.clearComparison},{default:(0,o.k6)((function(){return t[50]||(t[50]=[(0,o.eW)("清空报价单")])})),_:1},8,["onClick"])])])]})),_:1})])):(0,o.Q3)("",!0)]})),_:1})])}n(6918),n(3771),n(1629),n(739),n(3288),n(3110),n(9432),n(7495),n(8781),n(1761),n(8156),n(6031);var It=n(1402),Wt=n.n(It),Et=n(6594);const $t={name:"InstanceSearch",data:function(){return{form:{cpu_cores:null,memory_gb:null,disk_gb:30,region:"us-east-1",disk_type:"gp3",operating_system:"Linux"},regions:[],searchResults:[],selectedInstance:null,comparisonList:[],loading:!1,searched:!1,quoteInfo:{contact:"林先生",phone:"18626324958"}}},created:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,U.getRegions();case 3:e.regions=t.sent,e.regions&&e.regions.length>0&&(e.form.region=e.regions[0].code),n=localStorage.getItem("instance_comparison"),n&&(e.comparisonList=JSON.parse(n)),t.next=13;break;case 9:t.prev=9,t.t0=t["catch"](0),console.error("Error fetching data:",t.t0),e.$message.error("获取数据失败");case 13:case"end":return t.stop()}}),t,null,[[0,9]])})))()},methods:{searchInstances:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.form.cpu_cores||e.form.memory_gb||e.form.disk_gb){t.next=3;break}return e.$message.warning("请至少指定一项配置要求"),t.abrupt("return");case 3:return e.loading=!0,t.prev=4,t.next=7,U.searchInstances({cpu_cores:e.form.cpu_cores,memory_gb:e.form.memory_gb,disk_gb:e.form.disk_gb,region:e.form.region,operating_system:e.form.operating_system});case 7:n=t.sent,e.searchResults=n.map((function(t){return(0,Ve.A)((0,Ve.A)({},t),{},{operating_system:e.form.operating_system,region:e.form.region})})),e.searched=!0,e.selectedInstance=null,0===e.searchResults.length&&e.$message.info("没有找到符合条件的实例"),t.next=18;break;case 14:t.prev=14,t.t0=t["catch"](4),console.error("Error searching instances:",t.t0),e.$message.error("搜索实例失败");case 18:return t.prev=18,e.loading=!1,t.finish(18);case 21:case"end":return t.stop()}}),t,null,[[4,14,18,21]])})))()},selectInstance:function(e){this.selectedInstance=e,setTimeout((function(){var e=document.querySelector(".selected-instance");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}),100)},addToComparison:function(e){var t=this;if(e){var n=this.comparisonList.find((function(n){return n.instance_type===e.instance_type&&n.region===t.form.region&&n.operating_system===t.form.operating_system}));if(n)this.$message.warning("该实例已在对比列表中");else{var r=(0,Ve.A)((0,Ve.A)({},e),{},{region:this.form.region,operating_system:this.form.operating_system});this.comparisonList.push(r),this.$message.success("已添加到对比列表"),localStorage.setItem("instance_comparison",JSON.stringify(this.comparisonList)),setTimeout((function(){var e=document.querySelector(".comparison-section");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}),100)}}},removeFromComparison:function(e){this.comparisonList.splice(e,1),localStorage.setItem("instance_comparison",JSON.stringify(this.comparisonList)),this.$message.success("已从对比列表中移除")},clearComparison:function(){this.comparisonList=[],localStorage.removeItem("instance_comparison"),this.$message.success("已清空对比列表")},exportComparison:function(){var e=this;if(0!==this.comparisonList.length){var t=Wt().utils.book_new(),n=[["AWS亚马逊报价单"]],r=[["联系人:",this.quoteInfo.contact,"","签发日期:",this.getCurrentDate()],["电话:",this.quoteInfo.phone,"","电话:",""]],o=["","","","","","",""],a=["产品名称","规格型号","磁盘","操作系统","区域","官方月付全额 美元USD","官方年付全额 美元USD"],l=this.comparisonList.map((function(t){return["EC2","".concat(t.cpu,"核").concat(t.memory,"G ").concat(t.instance_type),"".concat(t.disk_gb,"G GP3"),e.formatOS(t.operating_system),e.getShortRegionName(t.region),t.total_monthly_price.toFixed(2),(12*t.total_monthly_price).toFixed(2)]})),i=[o,["说明事项:"],["1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB"]],s=[].concat(n,r,[o,a],(0,ne.A)(l),i),c=Wt().utils.aoa_to_sheet(s),u=[{wch:15},{wch:25},{wch:15},{wch:15},{wch:15},{wch:25},{wch:25}];c["!cols"]=u;var d=Array(s.length).fill({hpt:25});d[0]={hpt:35},d[4]={hpt:30},c["!rows"]=d;var f=4,p=f+l.length+2;c["!merges"]=[{s:{r:0,c:0},e:{r:0,c:6}},{s:{r:p,c:0},e:{r:p,c:6}},{s:{r:p+1,c:0},e:{r:p+1,c:6}},{s:{r:p+2,c:0},e:{r:p+2,c:6}}];for(var m=p;m<p+3;m++){var k=Wt().utils.encode_cell({r:m,c:0});c[k]&&(c[k].s=(0,Ve.A)((0,Ve.A)({},c[k].s),{},{fill:{patternType:"solid",fgColor:{rgb:"FFFBEA"}},alignment:{horizontal:"left",vertical:"center"}}))}c["A1"].s={font:{sz:16,bold:!0,color:{rgb:"FFFFFF"}},alignment:{horizontal:"center",vertical:"center"},fill:{patternType:"solid",fgColor:{rgb:"4472C4"}},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}}};var b=["A","B","C","D","E","F","G"];b.forEach((function(e){var t="".concat(e).concat(f+1);c[t]||(c[t]={v:"",t:"s"}),c[t].s={font:{bold:!0},alignment:{horizontal:"center",vertical:"center"},fill:{patternType:"solid",fgColor:{rgb:"E0E0E0"}},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}}}}));for(var h=0;h<s.length;h++)for(var g=0;g<7;g++){var v=Wt().utils.encode_cell({r:h,c:g});c[v]||(c[v]={v:"",t:"s"}),c[v].s||(c[v].s={}),c[v].s.border={top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}},c[v].s.alignment={horizontal:"center",vertical:"center"}}Wt().utils.book_append_sheet(t,c,"AWS报价单");var _=Wt().write(t,{bookType:"xlsx",type:"array",bookSST:!0,cellStyles:!0}),L=new Blob([_],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});(0,Et.saveAs)(L,"AWS亚马逊报价单.xlsx"),this.$message.success("报价单已导出为Excel文件")}else this.$message.warning("报价单为空")},goToCalculator:function(){if(this.selectedInstance){var e={instance_type:this.selectedInstance.instance_type,region:this.form.region,disk_gb:this.form.disk_gb,operating_system:this.form.operating_system};localStorage.setItem("calculator_params",JSON.stringify(e)),this.$router.push("/")}},getRegionName:function(e){var t=this.regions.find((function(t){return t.code===e}));return t?t.name:e},getShortRegionName:function(e){var t=this.regions.find((function(t){return t.code===e}));if(!t)return e;var n=t.name.match(/\(([^)]+)\)/);return n?n[1]:t.name},getCurrentDate:function(){var e=new Date,t=e.getFullYear(),n=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0");return"".concat(t,"/").concat(n,"/").concat(r)},formatSpecDescription:function(e){return"".concat(e.cpu,"核").concat(e.memory,"G ").concat(e.instance_type)},formatOS:function(e){return"Linux"===e?"Linux":"Windows"===e?"Windows":e}}},Rt=(0,c.A)($t,[["render",At],["__scopeId","data-v-c3ac583c"]]),Ut=Rt;var Dt={class:"instance-search"},Tt={class:"form-container"},Pt={key:0,class:"loading-container"},Gt={key:1,class:"search-results animated fadeIn"},Xt={class:"instance-type"},Ot={class:"spec-value"},Bt={class:"spec-value"},qt={class:"spec-value"},zt={class:"price-breakdown"},Nt={class:"price-item"},jt={class:"price-value"},Qt={class:"price-item"},Kt={class:"price-value"},Jt={class:"price-item total"},Mt={class:"price-value highlight"},Yt={class:"action-buttons-cell"},Ht={key:2,class:"no-results"},Zt={key:3,class:"selected-instance animated fadeIn"},en={class:"instance-info-item"},tn={class:"info-value"},nn={class:"instance-info-item"},rn={class:"info-value"},on={class:"instance-info-item"},an={class:"info-value"},ln={class:"instance-info-item"},sn={class:"info-value"},cn={class:"instance-info-item"},un={class:"info-value"},dn={class:"instance-info-item"},fn={class:"info-value"},pn={class:"price-info-item"},mn={class:"price-amount"},kn={class:"price-info-item"},bn={class:"price-amount"},hn={class:"price-note"},gn={class:"price-info-item total"},vn={class:"price-amount"},_n={class:"action-buttons"},Ln={key:4,class:"comparison-section animated fadeIn"},yn={class:"quote-header"},Fn={class:"quote-info"},wn={class:"info-table"},xn={class:"info-value"},Cn={class:"info-value"},Sn={class:"info-value"},Vn={class:"price-value"},An={class:"price-value highlight"},In={class:"price-value"},Wn={class:"price-value highlight"},En={class:"quote-notes"},$n={class:"note-items"},Rn={class:"note-item"},Un={class:"note-item"},Dn={class:"quote-actions"},Tn={class:"summary-item"},Pn={class:"summary-value"},Gn={class:"summary-buttons"};function Xn(e,t,n,r,a,l){var i=(0,o.g2)("el-input-number"),s=(0,o.g2)("el-form-item"),c=(0,o.g2)("el-col"),u=(0,o.g2)("el-row"),d=(0,o.g2)("el-option"),f=(0,o.g2)("el-select"),m=(0,o.g2)("el-button"),k=(0,o.g2)("el-form"),b=(0,o.g2)("el-skeleton"),h=(0,o.g2)("el-tag"),g=(0,o.g2)("el-table-column"),v=(0,o.g2)("el-table"),_=(0,o.g2)("el-empty"),L=(0,o.g2)("el-divider"),y=(0,o.g2)("el-card"),F=(0,o.g2)("el-input");return(0,o.uX)(),(0,o.CE)("div",Dt,[(0,o.bF)(y,{class:"search-card"},{header:(0,o.k6)((function(){return t[11]||(t[11]=[(0,o.Lk)("div",{class:"card-header"},[(0,o.Lk)("span",null,[(0,o.Lk)("i",{class:"el-icon-search"}),(0,o.eW)(" EC2 实例配置搜索")]),(0,o.Lk)("div",{class:"card-subtitle"},"根据您的需求规格,找到最合适的实例类型")],-1)])})),default:(0,o.k6)((function(){return[(0,o.Lk)("div",Tt,[(0,o.bF)(k,{model:a.form,"label-width":"120px"},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"CPU 核心数"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.cpu_cores,"onUpdate:modelValue":t[0]||(t[0]=function(e){return a.form.cpu_cores=e}),min:1,max:64,step:1,placeholder:"所需CPU核心数",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"内存(GB)"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.memory_gb,"onUpdate:modelValue":t[1]||(t[1]=function(e){return a.form.memory_gb=e}),min:.5,max:256,step:.5,placeholder:"所需内存容量(GB)",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"磁盘(GB)"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.disk_gb,"onUpdate:modelValue":t[2]||(t[2]=function(e){return a.form.disk_gb=e}),min:8,max:16e3,step:1,placeholder:"GP3卷存储容量(GB)",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"区域"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.region,"onUpdate:modelValue":t[3]||(t[3]=function(e){return a.form.region=e}),placeholder:"请选择区域",class:"full-width"},{default:(0,o.k6)((function(){return[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(a.regions,(function(e){return(0,o.uX)(),(0,o.Wv)(d,{key:e.code,label:e.name,value:e.code},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"操作系统"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.operating_system,"onUpdate:modelValue":t[4]||(t[4]=function(e){return a.form.operating_system=e}),placeholder:"选择操作系统",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{label:"Linux",value:"Linux"}),(0,o.bF)(d,{label:"Windows",value:"Windows"})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"磁盘类型"},{default:(0,o.k6)((function(){return[(0,o.bF)(f,{modelValue:a.form.disk_type,"onUpdate:modelValue":t[5]||(t[5]=function(e){return a.form.disk_type=e}),disabled:"",placeholder:"磁盘类型",class:"full-width"},{default:(0,o.k6)((function(){return[(0,o.bF)(d,{label:"GP3 (通用SSD)",value:"gp3"})]})),_:1},8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24,class:"flexible-col"},{default:(0,o.k6)((function(){return[(0,o.bF)(s,null,{default:(0,o.k6)((function(){return[(0,o.bF)(m,{type:"primary",onClick:l.searchInstances,icon:"el-icon-search",class:"search-button"},{default:(0,o.k6)((function(){return t[12]||(t[12]=[(0,o.eW)("搜索实例")])})),_:1},8,["onClick"])]})),_:1})]})),_:1})]})),_:1}),(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"月度折扣"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.monthly_discount,"onUpdate:modelValue":t[6]||(t[6]=function(e){return a.form.monthly_discount=e}),min:0,max:1,step:.01,precision:2,placeholder:"月度折扣比例",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1}),(0,o.bF)(c,{md:6,sm:24},{default:(0,o.k6)((function(){return[(0,o.bF)(s,{label:"年度折扣"},{default:(0,o.k6)((function(){return[(0,o.bF)(i,{modelValue:a.form.yearly_discount,"onUpdate:modelValue":t[7]||(t[7]=function(e){return a.form.yearly_discount=e}),min:0,max:1,step:.01,precision:2,placeholder:"年度折扣比例",class:"full-width"},null,8,["modelValue"])]})),_:1})]})),_:1})]})),_:1})]})),_:1},8,["model"])]),a.loading?((0,o.uX)(),(0,o.CE)("div",Pt,[(0,o.bF)(b,{rows:5,animated:""})])):a.searchResults.length?((0,o.uX)(),(0,o.CE)("div",Gt,[t[21]||(t[21]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-data"}),(0,o.eW)(" 符合条件的实例")],-1)),(0,o.bF)(v,{data:a.searchResults,border:"",style:{width:"100%"},stripe:!0,class:"result-table"},{default:(0,o.k6)((function(){return[(0,o.bF)(g,{prop:"instance_type",label:"实例类型",width:"120"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Xt,[(0,o.bF)(h,{type:"info"},{default:(0,o.k6)((function(){return[(0,o.eW)((0,p.v_)(e.row.instance_type),1)]})),_:2},1024)])]})),_:1}),(0,o.bF)(g,{prop:"description",label:"描述","min-width":"180"}),(0,o.bF)(g,{prop:"cpu",label:"CPU核心",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Ot,[t[13]||(t[13]=(0,o.Lk)("i",{class:"el-icon-cpu"},null,-1)),(0,o.eW)(" "+(0,p.v_)(e.row.cpu),1)])]})),_:1}),(0,o.bF)(g,{prop:"memory",label:"内存(GB)",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Bt,[t[14]||(t[14]=(0,o.Lk)("i",{class:"el-icon-coin"},null,-1)),(0,o.eW)(" "+(0,p.v_)(e.row.memory),1)])]})),_:1}),(0,o.bF)(g,{prop:"disk_gb",label:"磁盘(GB)",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",qt,[t[15]||(t[15]=(0,o.Lk)("i",{class:"el-icon-folder"},null,-1)),(0,o.eW)(" "+(0,p.v_)(e.row.disk_gb),1)])]})),_:1}),(0,o.bF)(g,{label:"每月价格",width:"260"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",zt,[(0,o.Lk)("div",Nt,[t[16]||(t[16]=(0,o.Lk)("span",{class:"price-label"},"实例:",-1)),(0,o.Lk)("span",jt,"$"+(0,p.v_)(e.row.monthly_price.toFixed(2)),1)]),(0,o.Lk)("div",Qt,[t[17]||(t[17]=(0,o.Lk)("span",{class:"price-label"},"磁盘:",-1)),(0,o.Lk)("span",Kt,"$"+(0,p.v_)(e.row.disk_monthly_price.toFixed(2)),1)]),(0,o.Lk)("div",Jt,[t[18]||(t[18]=(0,o.Lk)("span",{class:"price-label"},"总计:",-1)),(0,o.Lk)("span",Mt,"$"+(0,p.v_)(e.row.total_monthly_price.toFixed(2)),1)])])]})),_:1}),(0,o.bF)(g,{label:"操作",width:"200",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",Yt,[(0,o.bF)(m,{type:"primary",size:"small",onClick:function(t){return l.selectInstance(e.row)},icon:"el-icon-select"},{default:(0,o.k6)((function(){return t[19]||(t[19]=[(0,o.eW)(" 查看详情 ")])})),_:2},1032,["onClick"]),(0,o.bF)(m,{type:"success",size:"small",onClick:function(t){return l.addToComparison(e.row)},icon:"el-icon-plus"},{default:(0,o.k6)((function(){return t[20]||(t[20]=[(0,o.eW)(" 加入对比 ")])})),_:2},1032,["onClick"])])]})),_:1})]})),_:1},8,["data"])])):a.searched?((0,o.uX)(),(0,o.CE)("div",Ht,[(0,o.bF)(_,{description:"没有找到符合条件的实例,请尝试降低配置要求"})])):(0,o.Q3)("",!0),a.selectedInstance?((0,o.uX)(),(0,o.CE)("div",Zt,[t[39]||(t[39]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-check"}),(0,o.eW)(" 已选择实例")],-1)),(0,o.bF)(y,{class:"instance-card"},{default:(0,o.k6)((function(){return[(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",en,[t[22]||(t[22]=(0,o.Lk)("div",{class:"info-label"},"实例类型",-1)),(0,o.Lk)("div",tn,(0,p.v_)(a.selectedInstance.instance_type),1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",nn,[t[23]||(t[23]=(0,o.Lk)("div",{class:"info-label"},"CPU核心",-1)),(0,o.Lk)("div",rn,(0,p.v_)(a.selectedInstance.cpu)+" 核",1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",on,[t[24]||(t[24]=(0,o.Lk)("div",{class:"info-label"},"内存",-1)),(0,o.Lk)("div",an,(0,p.v_)(a.selectedInstance.memory)+" GB",1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",ln,[t[25]||(t[25]=(0,o.Lk)("div",{class:"info-label"},"磁盘",-1)),(0,o.Lk)("div",sn,(0,p.v_)(a.selectedInstance.disk_gb)+" GB (GP3)",1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",cn,[t[26]||(t[26]=(0,o.Lk)("div",{class:"info-label"},"区域",-1)),(0,o.Lk)("div",un,(0,p.v_)(l.getRegionName(a.form.region)),1)])]})),_:1}),(0,o.bF)(c,{md:4,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",dn,[t[27]||(t[27]=(0,o.Lk)("div",{class:"info-label"},"操作系统",-1)),(0,o.Lk)("div",fn,(0,p.v_)(a.form.operating_system),1)])]})),_:1})]})),_:1}),(0,o.bF)(L,{"content-position":"center"},{default:(0,o.k6)((function(){return t[28]||(t[28]=[(0,o.eW)("价格信息")])})),_:1}),(0,o.bF)(u,{gutter:20},{default:(0,o.k6)((function(){return[(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",pn,[t[29]||(t[29]=(0,o.Lk)("div",{class:"price-icon"},"⏱️",-1)),t[30]||(t[30]=(0,o.Lk)("div",{class:"price-title"},"每小时价格",-1)),(0,o.Lk)("div",mn,"$"+(0,p.v_)(a.selectedInstance.hourly_price.toFixed(4)),1),t[31]||(t[31]=(0,o.Lk)("div",{class:"price-note"},"实例每小时费用",-1))])]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",kn,[t[32]||(t[32]=(0,o.Lk)("div",{class:"price-icon"},"💾",-1)),t[33]||(t[33]=(0,o.Lk)("div",{class:"price-title"},"存储价格",-1)),(0,o.Lk)("div",bn,"$"+(0,p.v_)((a.selectedInstance.disk_monthly_price/30).toFixed(4))+"/天",1),(0,o.Lk)("div",hn,(0,p.v_)(a.selectedInstance.disk_gb)+"GB GP3卷每天费用",1)])]})),_:1}),(0,o.bF)(c,{md:8,sm:24},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",gn,[t[34]||(t[34]=(0,o.Lk)("div",{class:"price-icon"},"💰",-1)),t[35]||(t[35]=(0,o.Lk)("div",{class:"price-title"},"每月总费用",-1)),(0,o.Lk)("div",vn,"$"+(0,p.v_)(a.selectedInstance.total_monthly_price.toFixed(2)),1),t[36]||(t[36]=(0,o.Lk)("div",{class:"price-note"},"预计30天使用总费用",-1))])]})),_:1})]})),_:1}),(0,o.Lk)("div",_n,[(0,o.bF)(m,{type:"success",icon:"el-icon-shopping-cart-full",onClick:t[8]||(t[8]=function(e){return l.addToComparison(a.selectedInstance)})},{default:(0,o.k6)((function(){return t[37]||(t[37]=[(0,o.eW)("添加到对比")])})),_:1}),(0,o.bF)(m,{type:"primary",icon:"el-icon-s-finance",onClick:l.goToCalculator},{default:(0,o.k6)((function(){return t[38]||(t[38]=[(0,o.eW)("详细价格计算")])})),_:1},8,["onClick"])])]})),_:1})])):(0,o.Q3)("",!0),a.comparisonList.length>0?((0,o.uX)(),(0,o.CE)("div",Ln,[t[55]||(t[55]=(0,o.Lk)("h3",null,[(0,o.Lk)("i",{class:"el-icon-s-data"}),(0,o.eW)(" AWS亚马逊报价单")],-1)),(0,o.bF)(y,{class:"comparison-card"},{default:(0,o.k6)((function(){return[(0,o.Lk)("div",yn,[t[47]||(t[47]=(0,o.Lk)("div",{class:"quote-title"},"AWS亚马逊报价单",-1)),(0,o.Lk)("div",Fn,[(0,o.Lk)("table",wn,[(0,o.Lk)("tr",null,[t[40]||(t[40]=(0,o.Lk)("td",{class:"info-label"},"联系人:",-1)),(0,o.Lk)("td",xn,[(0,o.bF)(F,{modelValue:a.quoteInfo.contact,"onUpdate:modelValue":t[9]||(t[9]=function(e){return a.quoteInfo.contact=e}),placeholder:"请输入联系人"},null,8,["modelValue"])]),t[41]||(t[41]=(0,o.Lk)("td",null,null,-1)),t[42]||(t[42]=(0,o.Lk)("td",{class:"info-label"},"签发日期:",-1)),(0,o.Lk)("td",Cn,(0,p.v_)(l.getCurrentDate()),1)]),(0,o.Lk)("tr",null,[t[43]||(t[43]=(0,o.Lk)("td",{class:"info-label"},"电话:",-1)),(0,o.Lk)("td",Sn,[(0,o.bF)(F,{modelValue:a.quoteInfo.phone,"onUpdate:modelValue":t[10]||(t[10]=function(e){return a.quoteInfo.phone=e}),placeholder:"请输入电话"},null,8,["modelValue"])]),t[44]||(t[44]=(0,o.Lk)("td",null,null,-1)),t[45]||(t[45]=(0,o.Lk)("td",{class:"info-label"},"电话:",-1)),t[46]||(t[46]=(0,o.Lk)("td",{class:"info-value"},null,-1))])])])]),(0,o.bF)(v,{data:a.comparisonList,border:"",style:{width:"100%"},stripe:!0,class:"comparison-table"},{default:(0,o.k6)((function(){return[(0,o.bF)(g,{label:"产品名称",width:"80",align:"center"},{default:(0,o.k6)((function(){return t[48]||(t[48]=[(0,o.Lk)("span",null,"EC2",-1)])})),_:1}),(0,o.bF)(g,{prop:"instance_type",label:"规格型号",width:"150",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("div",null,(0,p.v_)(l.formatSpecDescription(e.row)),1)]})),_:1}),(0,o.bF)(g,{label:"磁盘",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",null,(0,p.v_)(e.row.disk_gb)+"G GP3",1)]})),_:1}),(0,o.bF)(g,{label:"操作系统",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",null,(0,p.v_)(l.formatOS(e.row.operating_system)),1)]})),_:1}),(0,o.bF)(g,{label:"区域",width:"100",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",null,(0,p.v_)(l.getShortRegionName(e.row.region)),1)]})),_:1}),(0,o.bF)(g,{label:"官方月付全额",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",Vn,"$"+(0,p.v_)(e.row.total_monthly_price.toFixed(2)),1)]})),_:1}),(0,o.bF)(g,{label:"月付优惠价",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",An,"$"+(0,p.v_)((e.row.total_monthly_price*a.form.monthly_discount).toFixed(2)),1)]})),_:1}),(0,o.bF)(g,{label:"官方年付全额",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",In,"$"+(0,p.v_)((12*e.row.total_monthly_price).toFixed(2)),1)]})),_:1}),(0,o.bF)(g,{label:"年付优惠价",width:"120",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.Lk)("span",Wn,"$"+(0,p.v_)((12*e.row.total_monthly_price*a.form.yearly_discount).toFixed(2)),1)]})),_:1}),(0,o.bF)(g,{label:"操作",width:"80",align:"center"},{default:(0,o.k6)((function(e){return[(0,o.bF)(m,{type:"danger",size:"mini",onClick:function(t){return l.removeFromComparison(e.$index)},icon:"el-icon-delete"},{default:(0,o.k6)((function(){return t[49]||(t[49]=[(0,o.eW)(" 移除 ")])})),_:2},1032,["onClick"])]})),_:1})]})),_:1},8,["data"]),(0,o.Lk)("div",En,[t[51]||(t[51]=(0,o.Lk)("div",{class:"note-title"},"说明事项:",-1)),(0,o.Lk)("div",$n,[t[50]||(t[50]=(0,o.Lk)("div",{class:"note-item"},"1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB",-1)),(0,o.Lk)("div",Rn,"2. 月付按官网价 "+(0,p.v_)(l.formatDiscount(a.form.monthly_discount))+" 折",1),(0,o.Lk)("div",Un,"3. 年付按官网价 "+(0,p.v_)(l.formatDiscount(a.form.yearly_discount))+" 折",1)])]),(0,o.Lk)("div",Dn,[(0,o.Lk)("div",Tn,[t[52]||(t[52]=(0,o.Lk)("div",{class:"summary-label"},"对比实例数量:",-1)),(0,o.Lk)("div",Pn,(0,p.v_)(a.comparisonList.length),1)]),(0,o.Lk)("div",Gn,[(0,o.bF)(m,{type:"primary",icon:"el-icon-download",onClick:l.exportComparison},{default:(0,o.k6)((function(){return t[53]||(t[53]=[(0,o.eW)("导出报价单")])})),_:1},8,["onClick"]),(0,o.bF)(m,{type:"danger",icon:"el-icon-delete",onClick:l.clearComparison},{default:(0,o.k6)((function(){return t[54]||(t[54]=[(0,o.eW)("清空报价单")])})),_:1},8,["onClick"])])])]})),_:1})])):(0,o.Q3)("",!0)]})),_:1})])}const On={name:"InstanceSearch",data:function(){return{form:{cpu_cores:null,memory_gb:null,disk_gb:30,region:"us-east-1",disk_type:"gp3",operating_system:"Linux",monthly_discount:.8,yearly_discount:.6},regions:[],searchResults:[],selectedInstance:null,comparisonList:[],loading:!1,searched:!1,quoteInfo:{contact:"林先生",phone:"18626324958"}}},created:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,U.getRegions();case 3:e.regions=t.sent,e.regions&&e.regions.length>0&&(e.form.region=e.regions[0].code),n=localStorage.getItem("instance_comparison"),n&&(e.comparisonList=JSON.parse(n)),t.next=13;break;case 9:t.prev=9,t.t0=t["catch"](0),console.error("Error fetching data:",t.t0),e.$message.error("获取数据失败");case 13:case"end":return t.stop()}}),t,null,[[0,9]])})))()},methods:{searchInstances:function(){var e=this;return(0,A.A)((0,S.A)().mark((function t(){var n;return(0,S.A)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.form.cpu_cores||e.form.memory_gb||e.form.disk_gb){t.next=3;break}return e.$message.warning("请至少指定一项配置要求"),t.abrupt("return");case 3:return e.loading=!0,t.prev=4,t.next=7,U.searchInstances({cpu_cores:e.form.cpu_cores,memory_gb:e.form.memory_gb,disk_gb:e.form.disk_gb,region:e.form.region,operating_system:e.form.operating_system});case 7:n=t.sent,e.searchResults=n.map((function(t){return(0,Ve.A)((0,Ve.A)({},t),{},{operating_system:e.form.operating_system,region:e.form.region})})),e.searched=!0,e.selectedInstance=null,0===e.searchResults.length&&e.$message.info("没有找到符合条件的实例"),t.next=18;break;case 14:t.prev=14,t.t0=t["catch"](4),console.error("Error searching instances:",t.t0),e.$message.error("搜索实例失败");case 18:return t.prev=18,e.loading=!1,t.finish(18);case 21:case"end":return t.stop()}}),t,null,[[4,14,18,21]])})))()},selectInstance:function(e){this.selectedInstance=e,setTimeout((function(){var e=document.querySelector(".selected-instance");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}),100)},addToComparison:function(e){var t=this;if(e){var n=this.comparisonList.find((function(n){return n.instance_type===e.instance_type&&n.region===t.form.region&&n.operating_system===t.form.operating_system}));if(n)this.$message.warning("该实例已在对比列表中");else{var r=(0,Ve.A)((0,Ve.A)({},e),{},{region:this.form.region,operating_system:this.form.operating_system});this.comparisonList.push(r),this.$message.success("已添加到对比列表"),localStorage.setItem("instance_comparison",JSON.stringify(this.comparisonList)),setTimeout((function(){var e=document.querySelector(".comparison-section");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}),100)}}},removeFromComparison:function(e){this.comparisonList.splice(e,1),localStorage.setItem("instance_comparison",JSON.stringify(this.comparisonList)),this.$message.success("已从对比列表中移除")},clearComparison:function(){this.comparisonList=[],localStorage.removeItem("instance_comparison"),this.$message.success("已清空对比列表")},exportComparison:function(){var e=this;if(0!==this.comparisonList.length){var t=Wt().utils.book_new(),n=[["AWS亚马逊报价单"]],r=[["联系人:",this.quoteInfo.contact,"","签发日期:",this.getCurrentDate()],["电话:",this.quoteInfo.phone,"","电话:",""]],o=["","","","","","","","",""],a=["产品名称","规格型号","磁盘","操作系统","区域","官方月付全额 美元USD","月付优惠价 美元USD","官方年付全额 美元USD","年付优惠价 美元USD"],l=this.comparisonList.map((function(t){var n=t.total_monthly_price,r=n*e.form.monthly_discount,o=12*n,a=o*e.form.yearly_discount;return["EC2","".concat(t.cpu,"核").concat(t.memory,"G ").concat(t.instance_type),"".concat(t.disk_gb,"G GP3"),e.formatOS(t.operating_system),e.getShortRegionName(t.region),n.toFixed(2),r.toFixed(2),o.toFixed(2),a.toFixed(2)]})),i=[o,["说明事项:"],["1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB"],["2. 月付按官网价 ".concat(this.formatDiscount(this.form.monthly_discount)," 折")],["3. 年付按官网价 ".concat(this.formatDiscount(this.form.yearly_discount)," 折")]],s=[].concat(n,r,[o,a],(0,ne.A)(l),i),c=Wt().utils.aoa_to_sheet(s),u=[{wch:15},{wch:25},{wch:15},{wch:15},{wch:15},{wch:25},{wch:25},{wch:25},{wch:25}];c["!cols"]=u;var d=Array(s.length).fill({hpt:25});d[0]={hpt:35},d[4]={hpt:30},c["!rows"]=d;var f=4,p=f+l.length+2;c["!merges"]=[{s:{r:0,c:0},e:{r:0,c:8}},{s:{r:p,c:0},e:{r:p,c:8}},{s:{r:p+1,c:0},e:{r:p+1,c:8}},{s:{r:p+2,c:0},e:{r:p+2,c:8}},{s:{r:p+3,c:0},e:{r:p+3,c:8}},{s:{r:p+4,c:0},e:{r:p+4,c:8}}];for(var m=p;m<p+5;m++){var k=Wt().utils.encode_cell({r:m,c:0});c[k]||(c[k]={v:"",t:"s"}),c[k].s={font:{sz:11},fill:{patternType:"solid",fgColor:{rgb:"FFFBEA"}},alignment:{horizontal:"left",vertical:"center"},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}}}}c["A1"].s={font:{sz:16,bold:!0,color:{rgb:"FFFFFF"}},alignment:{horizontal:"center",vertical:"center"},fill:{patternType:"solid",fgColor:{rgb:"4472C4"}},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}}};var b=["A","B","C","D","E","F","G","H","I"];b.forEach((function(e){var t="".concat(e).concat(f+1);c[t]||(c[t]={v:"",t:"s"}),c[t].s={font:{bold:!0},alignment:{horizontal:"center",vertical:"center"},fill:{patternType:"solid",fgColor:{rgb:"E0E0E0"}},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}}}}));for(var h=0;h<s.length;h++)for(var g=0;g<9;g++){var v=Wt().utils.encode_cell({r:h,c:g});c[v]||(c[v]={v:"",t:"s"}),c[v].s||(c[v].s={}),c[v].s.border={top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}},c[v].s.alignment={horizontal:"center",vertical:"center"}}for(var _={numFmt:"0.00",font:{color:{rgb:"1F7B69"}},alignment:{horizontal:"center",vertical:"center"},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}}},L=f+1;L<f+1+l.length;L++)for(var y=5;y<=8;y++){var F=Wt().utils.encode_cell({r:L,c:y});c[F]&&(c[F].s=_)}Wt().utils.book_append_sheet(t,c,"AWS报价单");var w=Wt().write(t,{bookType:"xlsx",type:"array",bookSST:!0,cellStyles:!0}),x=new Blob([w],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});(0,Et.saveAs)(x,"AWS亚马逊报价单.xlsx"),this.$message.success("报价单已导出为Excel文件")}else this.$message.warning("报价单为空")},goToCalculator:function(){if(this.selectedInstance){var e={instance_type:this.selectedInstance.instance_type,region:this.form.region,disk_gb:this.form.disk_gb,operating_system:this.form.operating_system};localStorage.setItem("calculator_params",JSON.stringify(e)),this.$router.push("/")}},getRegionName:function(e){var t=this.regions.find((function(t){return t.code===e}));return t?t.name:e},getShortRegionName:function(e){var t=this.regions.find((function(t){return t.code===e}));if(!t)return e;var n=t.name.match(/\(([^)]+)\)/);return n?n[1]:t.name},getCurrentDate:function(){var e=new Date,t=e.getFullYear(),n=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0");return"".concat(t,"/").concat(n,"/").concat(r)},formatSpecDescription:function(e){return"".concat(e.cpu,"核").concat(e.memory,"G ").concat(e.instance_type)},formatOS:function(e){return"Linux"===e?"Linux":"Windows"===e?"Windows":e},calculateDiscountedPrice:function(e,t){return e*t},formatDiscount:function(e){return null===e||void 0===e?"100":(10*e).toFixed(1)}}},Bn=(0,c.A)(On,[["render",Xn],["__scopeId","data-v-6eca8932"]]),qn=Bn;var zn=[{path:"/",name:"PriceCalculator",component:P},{path:"/compare",name:"PriceComparison",component:le},{path:"/budget",name:"BudgetEstimator",component:We},{path:"/awsSearch",name:"InstanceSearch",component:Ut},{path:"/awsSearchDiscount",name:"AwsSearchDiscount",component:qn}],Nn=(0,f.aE)({history:(0,f.LA)("/"),routes:zn});const jn=Nn;var Qn=n(6229),Kn=(n(4188),(0,r.Ef)(d));Kn.use(Qn.A),Kn.use(jn),Kn.config.globalProperties.$config=E,Kn.mount("#app")},1581:()=>{},1976:()=>{}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.m=e,(()=>{var e=[];n.O=(t,r,o,a)=>{if(!r){var l=1/0;for(u=0;u<e.length;u++){for(var[r,o,a]=e[u],i=!0,s=0;s<r.length;s++)(!1&a||l>=a)&&Object.keys(n.O).every((e=>n.O[e](r[s])))?r.splice(s--,1):(i=!1,a<l&&(l=a));if(i){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[r,o,a]}})(),(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e["default"]:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),(()=>{var e={524:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,a,[l,i,s]=r,c=0;if(l.some((t=>0!==e[t]))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(s)var u=s(n)}for(t&&t(r);c<l.length;c++)a=l[c],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(u)},r=self["webpackChunkaws_ec2_price_calculator"]=self["webpackChunkaws_ec2_price_calculator"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var r=n.O(void 0,[504],(()=>n(870)));r=n.O(r)})();
|
||
//# sourceMappingURL=app.13e0a1ea.js.map
|