import{r as _,O as h}from"./index.ad3efb29.js";import{d as O,r as V,Z as g,j as U,ai as d,o as j,c as k,U as l,O as i,u as a,S as C}from"./vue.adf17aba.js";import{_ as I}from"./_plugin-vue_export-helper.c27b6911.js";function E(o){return _({url:"/api/system/column/",method:"get",params:o})}function L(o){return _({url:"/api/system/column/auto_match_fields/",method:"post",data:o})}function S(o){return _({url:"/api/system/column/",method:"post",data:o})}function P(o){return _({url:`/api/system/column/${o}/`,method:"delete"})}function M(o){return _({url:`/api/system/column/${o.id}/`,method:"put",data:o})}const N={class:"columns-form-com"},R=O({__name:"index",props:{currentInfo:{type:Object,required:!0,default:()=>{}},initFormData:{type:Object,default:()=>{}}},emits:["drawerClose"],setup(o,{emit:D}){const n=o,v=D,f=V(),F=g({field_name:[{required:!0,message:"请输入字段名！",trigger:"blur"}],title:[{required:!0,message:"请输入列名！",trigger:"blur"}]});let e=g({field_name:"",title:"",is_create:!0,is_update:!0,is_query:!0}),c=V(!1);const x=()=>{var s,t;(s=n.initFormData)!=null&&s.id&&(e.id=((t=n.initFormData)==null?void 0:t.id)||"",e.field_name=n.initFormData.field_name||"",e.title=n.initFormData.title||"",e.is_create=!!n.initFormData.is_create,e.is_update=!!n.initFormData.is_update,e.is_query=!!n.initFormData.is_query)},q=()=>{var s;(s=f.value)==null||s.validate(async t=>{if(t)try{c.value=!0;let u;e.id?u=await M({...e,...n.currentInfo}):u=await S({...e,...n.currentInfo}),(u==null?void 0:u.code)===2e3&&(h(u.msg),y("submit"))}finally{c.value=!1}})},y=(s="")=>{var t;v("drawerClose",s),(t=f.value)==null||t.resetFields()};return U(()=>{x()}),(s,t)=>{const u=d("el-input"),m=d("el-form-item"),p=d("el-switch"),b=d("el-button"),w=d("el-form");return j(),k("div",N,[l(w,{ref_key:"formRef",ref:f,model:a(e),rules:F,"label-width":"80px"},{default:i(()=>[l(m,{label:"字段名",prop:"field_name"},{default:i(()=>[l(u,{modelValue:a(e).field_name,"onUpdate:modelValue":t[0]||(t[0]=r=>a(e).field_name=r),placeholder:"请输入字段名"},null,8,["modelValue"])]),_:1}),l(m,{label:"列名",prop:"title"},{default:i(()=>[l(u,{modelValue:a(e).title,"onUpdate:modelValue":t[1]||(t[1]=r=>a(e).title=r),placeholder:"请输入列名"},null,8,["modelValue"])]),_:1}),l(m,{label:"创建显示"},{default:i(()=>[l(p,{modelValue:a(e).is_create,"onUpdate:modelValue":t[2]||(t[2]=r=>a(e).is_create=r)},null,8,["modelValue"])]),_:1}),l(m,{label:"编辑显示"},{default:i(()=>[l(p,{modelValue:a(e).is_update,"onUpdate:modelValue":t[3]||(t[3]=r=>a(e).is_update=r)},null,8,["modelValue"])]),_:1}),l(m,{label:"查询显示"},{default:i(()=>[l(p,{modelValue:a(e).is_query,"onUpdate:modelValue":t[4]||(t[4]=r=>a(e).is_query=r)},null,8,["modelValue"])]),_:1}),l(m,null,{default:i(()=>[l(b,{type:"primary",onClick:q,loading:a(c)},{default:i(()=>[C(" 确定 ")]),_:1},8,["loading"]),l(b,{onClick:y},{default:i(()=>[C("取消")]),_:1})]),_:1})]),_:1},8,["model","rules"])])}}});const B=I(R,[["__scopeId","data-v-7c3f6e9f"]]),Z=Object.freeze(Object.defineProperty({__proto__:null,default:B},Symbol.toStringTag,{value:"Module"}));export{B as C,L as a,P as d,E as g,Z as i};
