import{d as z,r as v,O as W,f as X,q as Y,N as n,a1 as H,y as B,h as r,c as m,a as o,t as c,u as s,e as t,w as a,I as f,F as P,G as R,R as D,i as G,W as J,X as K,V as M,a2 as Q,aB as Z,cO as ee,Y as oe,E as le,$ as ae,a0 as se,p as te,g as re,_ as de}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css */import{p as ne,q as ce,r as ue}from"./site-ac963391.js";import{g as ie}from"./addon-8fbd8692.js";const j=h=>(te("data-v-b8eed67a"),h=h(),re(),h),pe={class:"main-container mb-80"},_e={class:"detail-head !mb-[10px]"},me=j(()=>o("span",{class:"iconfont iconxiangzuojiantou !text-xs"},null,-1)),fe={class:"ml-[1px]"},ve=j(()=>o("span",{class:"adorn"},"|",-1)),he={class:"right"},ge={key:0,class:"text-gray-400"},xe={class:"w-full"},be={class:"flex"},ye={class:"w-[60px] h-[60px] mr-[10px] rounded-md overflow-hidden"},we={class:"image-error"},ke={class:"flex-1 w-0 flex flex-col justify-center"},Ve={class:"font-bold truncate"},Ee=["title"],Ie={key:0,class:"text-gray-400"},Ce={class:"w-full"},Le={class:"flex"},Ne={class:"w-[60px] h-[60px] mr-[10px] rounded-md overflow-hidden"},Se={class:"image-error"},qe={class:"flex-1 w-0 flex flex-col justify-center"},Be={class:"font-bold truncate"},Pe=["title"],Re={class:"fixed-footer-wrap"},De={class:"fixed-footer"},Ge=z({__name:"group_edit",setup(h){const x=v(!0),b=v([]),y=v([]),w=W(),A=X(),F=w.meta.title,g=v(!1),d=v({group_id:0,group_name:"",group_desc:"",app:[],addon:[]});w.query.id?ne(w.query.id).then(({data:u})=>{d.value=u,x.value=!1}).catch():x.value=!1;const k=()=>{A.push("/admin/site/group")};ie().then(({data:u})=>{const l=[],p=[];Object.keys(u).forEach(_=>{const i=u[_];i.type=="addon"?p.push(i):l.push(i)}),b.value=l,y.value=p}).catch();const E=v(),U=Y(()=>({group_name:[{required:!0,message:n("groupNamePlaceholder"),trigger:"blur"}],app:[{required:!0,message:n("mainAppPlaceholder"),trigger:"blur"}]})),O=async u=>{if(g.value||!u)return;const l=d.value.group_id?ce:ue;await u.validate(async p=>{p&&(g.value=!0,l(d.value).then(_=>{setTimeout(()=>{k()},1e3)}).catch(()=>{g.value=!1}))})};return(u,l)=>{const p=J,_=K,i=M,I=H("icon-picture"),C=Q,L=Z,N=ee,T=oe,S=le,$=ae,q=se;return B((r(),m("div",pe,[o("div",_e,[o("div",{class:"left",onClick:k},[me,o("span",fe,c(s(n)("returnToPreviousPage")),1)]),ve,o("span",he,c(s(F)),1)]),t($,{class:"box-card !border-none",shadow:"never"},{default:a(()=>[t(T,{model:d.value,"label-width":"110px",ref_key:"formRef",ref:E,rules:s(U),class:"page-form"},{default:a(()=>[t(_,{label:s(n)("groupName"),prop:"group_name"},{default:a(()=>[t(p,{modelValue:d.value.group_name,"onUpdate:modelValue":l[0]||(l[0]=e=>d.value.group_name=e),placeholder:s(n)("groupNamePlaceholder"),clearable:"",disabled:d.value.uid,class:"input-width",maxlength:"20","show-word-limit":!0},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),t(_,{label:s(n)("groupDesc"),prop:"group_desc"},{default:a(()=>[t(p,{modelValue:d.value.group_desc,"onUpdate:modelValue":l[1]||(l[1]=e=>d.value.group_desc=e),type:"textarea",rows:"4",clearable:"",placeholder:s(n)("groupDescPlaceholder"),class:"input-width",maxlength:"100"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(_,{label:s(n)("mainApp"),prop:"app"},{default:a(()=>[b.value.length?(r(),f(N,{key:1,modelValue:d.value.app,"onUpdate:modelValue":l[2]||(l[2]=e=>d.value.app=e),class:"flex flex-wrap w-full"},{default:a(()=>[(r(!0),m(P,null,R(b.value,(e,V)=>(r(),m("div",{class:"flex w-[300px]",key:V},[t(L,{label:e.key,name:"",class:"w-full !h-auto border border-solid p-[10px] !mr-[10px] !mb-[10px] rounded-md"},{default:a(()=>[o("div",xe,[o("div",be,[o("div",ye,[e.cover?(r(),f(i,{key:0,src:s(D)(e.cover),class:"w-full h-full"},null,8,["src"])):(r(),f(i,{key:1,class:"w-full h-full"},{error:a(()=>[o("div",we,[t(C,null,{default:a(()=>[t(I)]),_:1})])]),_:1}))]),o("div",ke,[o("div",Ve,c(e.title),1),o("div",{class:"text-gray-400 mt-[10px] truncate",title:e.desc},c(e.desc),9,Ee)])])])]),_:2},1032,["label"])]))),128))]),_:1},8,["modelValue"])):(r(),m("div",ge,c(s(n)("appListEmpty")),1))]),_:1},8,["label"]),t(_,{label:s(n)("containAddon")},{default:a(()=>[y.value.length?(r(),f(N,{key:1,modelValue:d.value.addon,"onUpdate:modelValue":l[3]||(l[3]=e=>d.value.addon=e),class:"flex flex-wrap w-full"},{default:a(()=>[(r(!0),m(P,null,R(y.value,(e,V)=>(r(),m("div",{class:"flex w-[300px]",key:V},[t(L,{label:e.key,name:"",class:"w-full !h-auto border border-solid p-[10px] !mr-[10px] !mb-[10px] rounded-md"},{default:a(()=>[o("div",Ce,[o("div",Le,[o("div",Ne,[e.cover?(r(),f(i,{key:0,src:s(D)(e.cover),class:"w-full h-full"},null,8,["src"])):(r(),f(i,{key:1,class:"w-full h-full"},{error:a(()=>[o("div",Se,[t(C,null,{default:a(()=>[t(I)]),_:1})])]),_:1}))]),o("div",qe,[o("div",Be,c(e.title),1),o("div",{class:"text-gray-400 mt-[10px] truncate",title:e.desc},c(e.desc),9,Pe)])])])]),_:2},1032,["label"])]))),128))]),_:1},8,["modelValue"])):(r(),m("div",Ie,c(s(n)("appListEmpty")),1))]),_:1},8,["label"])]),_:1},8,["model","rules"]),o("div",Re,[o("div",De,[B((r(),f(S,{type:"primary",onClick:l[4]||(l[4]=e=>O(E.value))},{default:a(()=>[G(c(s(n)("save")),1)]),_:1})),[[q,g.value]]),t(S,{onClick:l[5]||(l[5]=e=>k())},{default:a(()=>[G(c(s(n)("cancel")),1)]),_:1})])])]),_:1})])),[[q,x.value]])}}});const Me=de(Ge,[["__scopeId","data-v-b8eed67a"]]);export{Me as default};