import{d as C,r as p,G as c,g as r,z as h,k as z,w as a,e as o,t as f}from"./index-CUnFTKV2.js";const R=C({__name:"AdvertTypeForm",props:{modelValue:{}},emits:["update:modelValue","submit","cancel"],setup(_,{expose:v,emit:V}){const m=_,s=V,n=p(),t=p({name:m.modelValue.name,sort:m.modelValue.sort});c(()=>m.modelValue,e=>{t.value={...e}},{deep:!0}),c(t,e=>{s("update:modelValue",e)},{deep:!0});const b={name:[{required:!0,message:"请输入类型名称",trigger:"blur"},{min:1,max:20,message:"名称长度在1-20个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序值",trigger:"blur"}]},g=async()=>{if(n.value)try{await n.value.validate(),s("submit")}catch{}},x=()=>{s("cancel")};return v({validate:()=>{var e;return(e=n.value)==null?void 0:e.validate()},resetFields:()=>{var e;return(e=n.value)==null?void 0:e.resetFields()}}),(e,l)=>{const w=r("el-input"),u=r("el-form-item"),y=r("el-input-number"),i=r("el-button"),k=r("el-form");return z(),h(k,{ref_key:"formRef",ref:n,model:t.value,rules:b,"label-width":"80px",inline:""},{default:a(()=>[o(u,{label:"类型名称",prop:"name"},{default:a(()=>[o(w,{modelValue:t.value.name,"onUpdate:modelValue":l[0]||(l[0]=d=>t.value.name=d),placeholder:"请输入类型名称",maxlength:"20","show-word-limit":"",style:{width:"200px"}},null,8,["modelValue"])]),_:1}),o(u,{label:"排序值",prop:"sort"},{default:a(()=>[o(y,{modelValue:t.value.sort,"onUpdate:modelValue":l[1]||(l[1]=d=>t.value.sort=d),min:0,max:9999,"controls-position":"right",style:{width:"120px"}},null,8,["modelValue"])]),_:1}),o(u,null,{default:a(()=>[o(i,{type:"primary",size:"small",onClick:g},{default:a(()=>[...l[2]||(l[2]=[f(" 确定 ",-1)])]),_:1}),o(i,{size:"small",onClick:x},{default:a(()=>[...l[3]||(l[3]=[f(" 取消 ",-1)])]),_:1})]),_:1})]),_:1},8,["model"])}}});export{R as _};
