import{b as N,c as R}from"./api.B-Wg7SIJ.js";import{u as B}from"./useResponse.DqThFJSa.js";import{X as y}from"./index.fM6cvGYs.js";import{h as U}from"./elementPlus.CXoFsoPv.js";import{d as E,aJ as L,aI as $,aK as z,r as V,j as F,ai as p,o as i,c as v,U as x,O as a,a as c,S as J,T as h,u as I,F as M,a8 as T,M as k,R as P,J as X}from"./vue.1RczIYhx.js";import{_ as q}from"./_plugin-vue_export-helper.DlAUqK2U.js";const G={class:"drawer-container"},H={class:"m-4"},Q={style:{"white-space":"nowrap"}},W=E({__name:"ShowSkuDrawer",props:L({skuData:Object,rowData:Object},{modelValue:{default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(b){const O=$("showSkuDrawer"),g=z(b,"modelValue"),j=b,{skuData:n,rowData:m}=j,S=V({}),D=V([]);async function A(){const l=await B(N,{key:"power"});(!l||l.data.total===0)&&U({type:"warning",message:"警告：未找到产品属性：power(电源规格)！请在产品属性中定义标识为power的电源规格属性！"});const t=l.data[0].attr_dict;t.unshift({label:"无",value:""}),D.value=t}async function C(){var f;const l=await B(R,m.kind.id),t=y.groupBy(l.data.RelatedAttrs,"section"),w=y.sortBy(Object.keys(t),e=>e),d=[];for(const e of w){const u=y.sortBy(t[e],"order");let s=[];n&&(s=n[`section${e}`]||[]);const o=[];for(const r of u){const _=r.attr_dict.find(K=>s.includes(K.id));_&&o.push({label:r.attr.name,value:_.label,description:r.description})}d.push({section:"第"+e+"部分",attrItems:o})}if(n.optional){const e=[],u=n.optional.powerType,s=(f=D.value.find(_=>_.value===u))==null?void 0:f.label;e.push({label:"电源",value:s});const o=n.optional.version,r=n.optional.versionType;e.push({label:"版本",value:r==null?"无":`${r}${o}`}),e.push({label:"版本特征",value:m.version_feature===""?"无":m.version_feature}),e.length>0&&d.push({section:"可选部分",attrItems:e})}S.value=d}return F(()=>{A(),C()}),(l,t)=>{const w=p("el-check-tag"),d=p("el-tooltip"),f=p("el-descriptions-item"),e=p("el-descriptions"),u=p("el-drawer");return i(),v("div",G,[x(u,{ref_key:"showSkuDrawer",ref:O,modelValue:g.value,"onUpdate:modelValue":t[0]||(t[0]=s=>g.value=s),style:{width:"40%"},"show-close":!1},{title:a(()=>[c("div",null,[t[1]||(t[1]=c("span",{style:{"font-size":"16px","font-weight":"bold"}},"当前SKU:",-1)),x(w,{checked:"",style:{"pointer-events":"none","margin-left":"5px"}},{default:a(()=>[J(h(I(m).sku),1)]),_:1})])]),default:a(()=>[c("div",H,[(i(!0),v(M,null,T(I(S),s=>(i(),k(e,{title:s.section,border:"",style:{"margin-bottom":"40px"}},{default:a(()=>[(i(!0),v(M,null,T(s.attrItems,o=>(i(),k(f,{"label-class-name":"my-label"},{label:a(()=>[c("div",Q,h(o.label),1),o.description?(i(),k(d,{key:0,content:o.description,effect:"dark",placement:"top-start"},{default:a(()=>t[2]||(t[2]=[c("i",{class:"el-icon-question"},null,-1)])),_:2},1032,["content"])):P("",!0)]),default:a(()=>[c("div",{style:X({whiteSpace:o.label!=="版本特征"?"nowrap":"normal"}),class:"my-value"},h(o.value),5)]),_:2},1024))),256))]),_:2},1032,["title"]))),256))])]),_:1},8,["modelValue"])])}}}),ae=q(W,[["__scopeId","data-v-b77942a5"]]);export{ae as default};
