import{ak as f,al as M,a as P,r as u,W as Y,b as C,a7 as H,Z as W,c as V,j as E,h as o,f as n,u as b,x as k,l as X,am as Z}from"./index.4d061c66.js";import{r as x}from"./responseHandle.fe68d5aa.js";import{u as z}from"./useNav.5e73c372.js";import"./remote-select.36ee67a3.js";import{_ as G,a as J}from"./Card.vue_vue_type_script_setup_true_lang.27e443dd.js";const{VITE_PROXY_DOMAIN_REAL:v}=M();async function K(a={}){return f.request("post",`${v}admin/groupAdd`,{data:a})}async function ne(a={}){return f.request("post",`${v}admin/groupList`,{data:a})}async function Q(a={}){return f.request("post",`${v}admin/groupRead`,{data:a})}async function ee(a={}){return f.request("post",`${v}admin/groupEdit`,{data:a})}async function se(a={}){return f.request("post",`${v}admin/groupChange`,{data:a})}async function re(a={}){return f.request("post",`${v}admin/groupDelete`,{data:a})}const de=P({__name:"edit-dialog",emits:["reload"],setup(a,{expose:R,emit:$}){const h=u(null),y=u(null),{logout:B}=z(),_=u(!1),q=u(""),i=u("create"),w=u(null),s=u(!1),g=u(""),A=u(""),F=u(""),D={company_id:"",card_id:"",id:""},t=u({...D}),S=Y({company_id:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u516C\u53F8"}],card_id:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u5361\u7C7B\u578B"}]}),j=async()=>{const{code:c,data:e,message:d}=await Q({id:F.value});x({code:c,message:d,logout:B,handler:()=>{Object.keys(t.value).forEach(p=>{t.value[p]=e[p]?e[p]+"":""});const{combination:l}=e,r=l.split("_");h.value&&r.length===2&&h.value.initalData({title:r[0]}),y.value&&r.length===2&&y.value.initalData({title:r[1]})}})};async function N(c,e,d){switch(F.value=e,s.value=!0,A.value="",q.value="",Object.keys(t.value).forEach(l=>{t.value[l]=D[l]}),i.value=d,i.value){case"create":g.value="\u65B0\u5EFA\u516C\u53F8\u5361\u7C7B\u578B";break;case"edit":g.value="\u7F16\u8F91\u516C\u53F8\u5361\u7C7B\u578B";break;case"view":g.value="\u516C\u53F8\u5361\u7C7B\u578B\u8BE6\u60C5";break;default:g.value="\u65B0\u5EFA\u516C\u53F8\u5361\u7C7B\u578B"}_.value=!0,i.value!=="create"&&await j(),s.value=!1}function U(){return{data:{...t.value},api:ee}}function O(){return{data:{...t.value},api:K}}function T(){w.value.validate(async c=>{if(c){if(s.value)return;s.value=!0;const e=i.value==="create"?O:U;s.value=!0;const{api:d,data:l}=e(),{message:r,code:p}=await d(l);s.value=!1,x({code:p,message:r,logout:B,handler:()=>{_.value=!1,$("reload")}})}})}return R({show:N}),(c,e)=>{const d=C("el-form-item"),l=C("el-col"),r=C("el-button"),p=C("el-row"),L=C("el-dialog"),I=H("loading");return W((V(),E(L,{modelValue:_.value,"onUpdate:modelValue":e[3]||(e[3]=m=>_.value=m),"close-on-press-escape":!1,center:"","append-to-body":"","destroy-on-close":"",width:"650px",title:g.value},{default:o(()=>[n(b(Z),{ref_key:"formRef",ref:w,model:t.value,rules:S,"label-width":"100px",style:{"margin-top":"-10px"},class:"demo-ruleForm","status-icon":""},{default:o(()=>[n(p,null,{default:o(()=>[n(l,{span:24},{default:o(()=>[n(d,{label:"\u516C\u53F8",prop:"company_id"},{default:o(()=>[n(b(G),{ref_key:"remoteCompanySelectRef",ref:h,modelValue:t.value.company_id,"onUpdate:modelValue":e[0]||(e[0]=m=>t.value.company_id=m),disabled:i.value==="view",showDisabled:!0,placeholder:"\u516C\u53F8"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),n(l,{span:24},{default:o(()=>[n(d,{label:"\u5361\u7C7B\u578B",prop:"card_id"},{default:o(()=>[n(b(J),{ref_key:"remoteCardSelectRef",ref:y,modelValue:t.value.card_id,"onUpdate:modelValue":e[1]||(e[1]=m=>t.value.card_id=m),disabled:i.value==="view",showDisabled:!0,placeholder:"\u5361\u7C7B\u578B"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),n(l,{span:24,class:"flex justify-end"},{default:o(()=>[i.value!=="view"?(V(),E(r,{key:0,loading:s.value,disabled:s.value,type:"primary",onClick:T},{default:o(()=>[k("\u4FDD\u5B58")]),_:1},8,["loading","disabled"])):X("",!0),n(r,{onClick:e[2]||(e[2]=m=>_.value=!1)},{default:o(()=>[k("\u53D6\u6D88")]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])),[[I,s.value]])}}});export{de as _,se as a,re as b,ne as h};
