import{u as R}from"./useResponse.DqThFJSa.js";import{c as B}from"./api.CUqZ8T2Z.js";import{F as U,G as N,h as g}from"./elementPlus.CXoFsoPv.js";import{d as O,aJ as T,r as b,aI as q,aK as G,Z as V,ai as t,o as I,M as J,O as a,U as s,S as v,u as o}from"./vue.1RczIYhx.js";const $=O({__name:"CreateDialog",props:{modelValue:{default:!1},modelModifiers:{}},emits:T(["refresh"],["update:modelValue"]),setup(y,{emit:k}){const m=b(!1),c=q("createDialog"),i=G(y,"modelValue"),C=k,d=b(),r=V({brand:""}),F=V({brand:[{required:!0,message:"请输入品牌名称",trigger:"blur"}]}),w=async l=>{l&&await l.validate(async(e,f)=>{if(e){const u={brand_name:r.brand};(await R(B,u,m)).code===2e3&&(g.success({message:"创建成功",plain:!0,icon:"CirclePlus"}),i.value=!1,C("refresh"))}else g.error("创建失败，请检查表单")})};function x(){D(d.value),c.value.visible=!1}const D=l=>{l&&l.resetFields()};return(l,e)=>{const f=t("el-input"),u=t("el-form-item"),p=t("el-form"),_=t("el-button"),M=t("el-dialog");return I(),J(M,{ref_key:"createDialog",ref:c,modelValue:i.value,"onUpdate:modelValue":e[2]||(e[2]=n=>i.value=n),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"产品品牌 - 创建 ",style:{width:"30%"}},{footer:a(()=>[s(_,{icon:o(U),onClick:x},{default:a(()=>e[3]||(e[3]=[v("取 消")])),_:1},8,["icon"]),s(_,{icon:o(N),loading:o(m),type:"primary",onClick:e[1]||(e[1]=n=>w(o(d)))},{default:a(()=>e[4]||(e[4]=[v("确 定")])),_:1},8,["icon","loading"])]),default:a(()=>[s(p,{ref_key:"ruleFormRef",ref:d,model:o(r),rules:o(F),class:"mx-2.5 mt-5","label-width":"auto","status-icon":""},{default:a(()=>[s(u,{class:"font-medium",label:"品牌名称",prop:"brand"},{default:a(()=>[s(f,{modelValue:o(r).brand,"onUpdate:modelValue":e[0]||(e[0]=n=>o(r).brand=n),placeholder:"请输入品牌名称",style:{width:"328px"}},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});export{$ as _};
