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