import{aC as f,a2 as j,_ as q,d as A,v as z,w as d,ad as V,z as N,y as I,r as o,al as U,H as L,o as k,G as x,C as l,l as u,M as C,a as P,au as M}from"./index.1d5f2f42.js";const{VITE_PROXY_DOMAIN_REAL:W,VITE_PROXY_USER_REAL:X}=j(),_=X+"/admin/action/",Y=e=>f.request("post",`${_}create`,{data:e}),Z=(e={})=>f.request("post",`${_}list`,{data:e}),G=e=>f.request("post",`${_}save`,{data:e}),ee=e=>f.request("post",`${_}status`,{data:e}),te=e=>f.request("post",`${_}/delete`,{data:e}),H=A({__name:"addEdit",props:{itemId:{type:String,default:""},showModel:{type:Boolean,default:!1},isDetails:{type:String,default:"add"},sitem:{type:Object}},emits:["cancel","refresh"],setup(e,{emit:b}){const h=e,{logout:O}=z(),B=d("default"),g=d(),n=d(!1),s=d("add"),a=V({...{id:"",action_name:""}}),R=V({action_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u529F\u80FD\u6743\u9650\u540D\u79F0",trigger:"blur"}]}),S=async p=>{if(!p)return;const{id:t,...r}=Object.assign({},a);await p.validate(async(m,w)=>{if(m){const y=Object.assign({},a),{code:i,message:D}=s.value==="add"?await Y(r):await G(y);v.value=!1,i===1?(M.success(c.value+"\u6210\u529F\uFF01"),n.value=!1,b("refresh")):i>100&&i<140?(n.value=!1,O()):M.error(D)}})},E=()=>{n.value=!1,v.value=!1,b("cancel")},v=d(!1),c=d("");return N(()=>h.showModel,()=>{const{showModel:p,isDetails:t,sitem:r}=h;s.value=t,s.value==="add"?c.value="\u65B0\u5EFA\u529F\u80FD\u6743\u9650":s.value==="view"?c.value="\u529F\u80FD\u6743\u9650\u8BE6\u60C5":c.value="\u4FEE\u6539\u529F\u80FD\u6743\u9650",n.value=p,a.action_name=r.action_name,a.id=r.id,I(()=>Object.keys(a).forEach(m=>g.value.clearValidate(m)))}),(p,t)=>{const r=o("el-input"),m=o("el-form-item"),w=o("el-col"),y=o("el-row"),i=o("el-button"),D=o("el-form"),T=o("el-dialog"),$=U("loading");return L((k(),x(T,{"close-on-click-modal":!1,"close-on-press-escape":!1,modelValue:n.value,"onUpdate:modelValue":t[2]||(t[2]=F=>n.value=F),"append-to-body":"",width:"900px",center:"",title:c.value,onClose:E},{default:l(()=>[u(D,{ref_key:"ruleFormRef",ref:g,model:a,rules:R,"label-width":"90px",class:"demo-ruleForm",size:B.value,"status-icon":""},{default:l(()=>[u(y,null,{default:l(()=>[u(w,{span:24},{default:l(()=>[u(m,{label:"\u540D\u79F0",prop:"nickname"},{default:l(()=>[u(r,{modelValue:a.action_name,"onUpdate:modelValue":t[0]||(t[0]=F=>a.action_name=F),placeholder:"\u529F\u80FD\u6743\u9650\u540D\u79F0",disabled:s.value==="view"},null,8,["modelValue","disabled"])]),_:1})]),_:1})]),_:1}),u(w,{span:24,class:"clear"},{default:l(()=>[s.value==="add"||s.value==="edit"?(k(),x(i,{key:0,type:"primary",class:"fr",loading:v.value,style:{margin:"0 0 0 16px"},onClick:t[1]||(t[1]=F=>S(g.value))},{default:l(()=>[C("\u4FDD\u5B58")]),_:1},8,["loading"])):P("v-if",!0),u(i,{class:"fr",style:{margin:"0 0 0 16px"},onClick:E},{default:l(()=>[C("\u5173\u95ED")]),_:1})]),_:1})]),_:1},8,["model","rules","size"])]),_:1},8,["modelValue","title"])),[[$,v.value]])}}});var J=q(H,[["__file","D:/work/rep-v3/report-v3/src/views/system/action/addEdit.vue"]]),ae=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"}));export{J as a,te as b,Z as c,ae as d,ee as h};
