import{F as L,G as S,h as T}from"./elementPlus.CXoFsoPv.js";import{u as y}from"./useResponse.DqThFJSa.js";import{a as z,b as G}from"./api.D_N-7qEU.js";import{d as J,aJ as w,r as f,aK as K,aI as Z,Z as x,E as $,ai as i,o as p,c as M,U as t,O as n,u as o,F as D,a8 as H,M as P,a as Q,S as F}from"./vue.1RczIYhx.js";import{_ as W}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./index.fM6cvGYs.js";const X={class:"drawer-container"},Y={class:"flex flex-1 justify-end"},h=J({__name:"AttributeManageEdit",props:w({rowData:Object},{modelValue:{default:!1},modelModifiers:{}}),emits:w(["refresh"],["update:modelValue"]),setup(_,{emit:O}){const b=f(!1),c=K(_,"modelValue"),v=Z("editDrawer"),C=_,{rowData:l}=C,A=O,V=f(),s=x({section:l==null?void 0:l.section.toString(),name:l==null?void 0:l.attr.id,order:l==null?void 0:l.order}),B=x({section:[{required:!0,trigger:"blur"}],name:[{required:!0,trigger:"blur"}]}),E=async u=>{u&&await u.validate(async(e,d)=>{if(e){const m={attr:s.name,id:l.id,kind:l.kind.id,order:s.order,section:Number(s.section),status:l.status};try{const r=await y(G,m,b);r&&r.code==2e3&&(c.value=!1,T.success({message:"编辑成功",plain:!0,icon:"Operation"}),A("refresh"))}catch(r){console.error("Error==>",r)}}else console.log("error submit!",d)})},g=f([]);$(()=>{U()});function R(){v.value.handleClose()}async function U(){const u=await y(z,{limit:100});g.value=u.data}return(u,e)=>{const d=i("el-option"),m=i("el-select"),r=i("el-form-item"),N=i("el-input-number"),q=i("el-divider"),k=i("el-button"),j=i("el-form"),I=i("el-drawer");return p(),M("div",X,[t(I,{ref_key:"editDrawer",ref:v,modelValue:c.value,"onUpdate:modelValue":e[4]||(e[4]=a=>c.value=a),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"产品种类- 编辑 ",size:"25%"},{default:n(()=>[t(j,{ref_key:"ruleFormRef",ref:V,model:o(s),rules:o(B),class:"mx-2.5 mt-7","label-position":"top","label-width":"auto","status-icon":""},{default:n(()=>[t(r,{class:"font-medium",label:"位 置",prop:"section"},{default:n(()=>[t(m,{modelValue:o(s).section,"onUpdate:modelValue":e[0]||(e[0]=a=>o(s).section=a)},{default:n(()=>[t(d,{label:"第1部分",value:"1"}),t(d,{label:"第2部分",value:"2"}),t(d,{label:"第3部分",value:"3"})]),_:1},8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"属 性",prop:"name"},{default:n(()=>[t(m,{modelValue:o(s).name,"onUpdate:modelValue":e[1]||(e[1]=a=>o(s).name=a)},{default:n(()=>[(p(!0),M(D,null,H(o(g),a=>(p(),P(d,{key:a.id,label:a.name,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"顺 序",prop:"order"},{default:n(()=>[t(N,{modelValue:o(s).order,"onUpdate:modelValue":e[2]||(e[2]=a=>o(s).order=a)},null,8,["modelValue"])]),_:1}),t(r,null,{default:n(()=>[t(q),Q("div",Y,[t(k,{icon:o(L),onClick:R},{default:n(()=>e[5]||(e[5]=[F("取 消")])),_:1},8,["icon"]),t(k,{icon:o(S),loading:o(b),type:"primary",onClick:e[3]||(e[3]=a=>E(o(V)))},{default:n(()=>e[6]||(e[6]=[F(" 确 定 ")])),_:1},8,["icon","loading"])])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])])}}}),ne=W(h,[["__scopeId","data-v-f8f7b65d"]]);export{ne as default};
