import{G as A,A as B}from"./api.BV8EW7D6.js";import{s as F}from"./index.lP_uh0LI.js";import{d as N}from"./dictionary.D0i47SYU.js";import{d as G,r as k,c as M,a as _,i as T,o as $,b as s,e as b,f as n,g as o,w as r,h as y,j as z,u as t,F as V,k as c,l as P}from"./vue.BxlDVA1H.js";const S={style:{padding:"20px"}},I=G({__name:"addContent",setup(Z){let a=k({parent:null,title:null,key:null,form_item_type:"",rule:null,placeholder:null});const U=M(()=>N("config_form_type").filter(d=>[8,13,14].indexOf(d.value)===-1)),g=_();_();const x=k({parent:[{required:!0,message:"请选择"}],title:[{required:!0,message:"请输入"}],key:[{required:!0,message:"请输入"},{pattern:/^[A-Za-z0-9_]+$/,message:"请输入数字、字母或下划线"}],form_item_type:[{required:!0,message:"请输入"}]});let v=_([]),q=_([{label:"必填项",value:'{"required": true, "message": "必填项不能为空"}'},{label:"邮箱",value:'{ "type": "email", "message": "请输入正确的邮箱地址"}'},{label:"URL地址",value:'{ "type": "url", "message": "请输入正确的URL地址"}'}]);const w=()=>{A({parent__isnull:!0,limit:999}).then(d=>{v.value=d.data})},C=T("refreshView"),O=async d=>{d&&await d.validate((l,m)=>{l?B(a).then(p=>{p.code==2e3&&(F("新增成功"),C())}):console.log("error submit!",m)})};return $(()=>{w()}),(d,l)=>{const m=s("el-option"),p=s("el-select"),u=s("el-form-item"),f=s("el-input"),L=s("el-input-number"),R=s("el-button"),j=s("el-form");return n(),b("div",S,[o(j,{ref_key:"formRef",ref:g,model:t(a),rules:x,"label-width":"80px"},{default:r(()=>[o(u,{label:"所属分组",prop:"parent"},{default:r(()=>[o(p,{modelValue:t(a).parent,"onUpdate:modelValue":l[0]||(l[0]=e=>t(a).parent=e),placeholder:"请选择分组",clearable:""},{default:r(()=>[(n(!0),b(V,null,c(t(v),(e,i)=>(n(),y(m,{label:e.title,value:e.id,key:i},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(u,{label:"标题",prop:"title"},{default:r(()=>[o(f,{modelValue:t(a).title,"onUpdate:modelValue":l[1]||(l[1]=e=>t(a).title=e),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1}),o(u,{label:"key值",prop:"key"},{default:r(()=>[o(f,{modelValue:t(a).key,"onUpdate:modelValue":l[2]||(l[2]=e=>t(a).key=e),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1}),o(u,{label:"表单类型",prop:"form_item_type"},{default:r(()=>[o(p,{modelValue:t(a).form_item_type,"onUpdate:modelValue":l[3]||(l[3]=e=>t(a).form_item_type=e),placeholder:"请选择",clearable:""},{default:r(()=>[(n(!0),b(V,null,c(U.value,(e,i)=>(n(),y(m,{label:e.label,value:e.value,key:i},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),[4,5,6].indexOf(t(a).form_item_type)>-1?(n(),y(u,{key:0,label:"字典key",prop:"setting",rules:[{required:!0,message:"不能为空"}]},{default:r(()=>[o(f,{modelValue:t(a).setting,"onUpdate:modelValue":l[4]||(l[4]=e=>t(a).setting=e),placeholder:"请输入dictionary中key值",clearable:""},null,8,["modelValue"])]),_:1})):z("",!0),o(u,{label:"校验规则"},{default:r(()=>[o(p,{modelValue:t(a).rule,"onUpdate:modelValue":l[5]||(l[5]=e=>t(a).rule=e),multiple:"",placeholder:"请选择(可多选)",clearable:""},{default:r(()=>[(n(!0),b(V,null,c(t(q),(e,i)=>(n(),y(m,{label:e.label,value:e.value,key:i},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(u,{label:"提示信息",prop:"placeholder"},{default:r(()=>[o(f,{modelValue:t(a).placeholder,"onUpdate:modelValue":l[6]||(l[6]=e=>t(a).placeholder=e),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1}),o(u,{label:"排序",prop:"sort"},{default:r(()=>[o(L,{modelValue:t(a).sort,"onUpdate:modelValue":l[7]||(l[7]=e=>t(a).sort=e),min:0,max:99},null,8,["modelValue"])]),_:1}),o(u,null,{default:r(()=>[o(R,{type:"primary",onClick:l[8]||(l[8]=e=>O(g.value))},{default:r(()=>l[9]||(l[9]=[P("立即创建")])),_:1,__:[9]})]),_:1})]),_:1},8,["model","rules"])])}}});export{I as _};
