import{_ as O,b as G,a as J,u as L,r as _,ah as T,o as h,y as V,q as o,v as g,p as a,P as m,x as v,n,C as z,c as W,F as H,A as K,s as Q,eU as X,eV as Y,eW as Z,cx as j,j as ee,k as te,l as le,c5 as oe,c0 as ae,m as ne,bv as re,a0 as se,a1 as ue,D as de}from"./index.8d733f79.js";import{E as pe}from"./el-progress.ee3fa77d.js";import{E as ie}from"./el-input-number.60463ef8.js";import"./index.28f6da25.js";const me=""+new URL("defaultAppIcon.233541d3.png",import.meta.url).href;const ce=c=>(se("data-v-d112e006"),c=c(),ue(),c),fe=["src"],ge={style:{"margin-left":"20px"}},_e=ce(()=>g("div",{style:{"line-height":"18px","margin-top":"10px"}},"\u6CE8\uFF1A\u683C\u5F0F\uFF1AJPG\\JPEG\\PNG\u3001\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A56*56px\u3001\u5927\u5C0F\uFF1A\u4E0D\u8D85\u8FC71M",-1)),he={class:"dialog-footer"},ve={__name:"addAppMenu",emits:["refresh"],setup(c,{expose:E,emit:$}){const{t:i,locale:Ie}=G(),{proxy:u}=de();J(),L();const d=_(!1),I=_(""),b=_([{label:"\u663E\u793A",value:!1},{label:"\u9690\u85CF",value:!0}]),y={title:"",sort:null,path:"",icon:"",hidden:!1},t=T({...y}),w={title:[{required:!0,message:i("menuNameP"),trigger:"blur"}],sort:[{required:!0,message:i("menuSortP"),trigger:"blur"}],path:[{required:!0,message:i("urlP"),trigger:"blur"}]},U="./",x=e=>`${U}/equipment-web/file/downloadImage?fileId=${e}`;function S(e){console.log(222,e),d.value=!0,I.value=e!=null&&e.menuId?i("edit"):i("add"),e&&(Object.keys(t).forEach(l=>{t[l]=e[l]}),t.icon=e.meta.icon),t.menuId=(e==null?void 0:e.menuId)||null}const M=()=>{u.$refs.formRef.validate((e,l)=>{if(e){if(!X(t.path)){u.$modal.msgError("\u8BF7\u8F93\u5165\u5F00\u5934\u4E3Ahttp://\u6216https://\u7684\u7F51\u9875\u5730\u5740");return}(t.menuId?Y:Z)(t).then(s=>{u.$modal.msgSuccess(s.msg),d.value=!1,$("refresh")})}else console.log("error submit!",l)})},N=()=>{const e=JSON.parse(JSON.stringify(y));Object.assign(t,{...e}),setTimeout(()=>{u.$refs.formRef.clearValidate()},0)},P=e=>e.size/1024/1024>1?(u.$modal.msgError("\u56FE\u6807\u5927\u5C0F\u4E0D\u8D85\u8FC71M"),!1):e.type!=="image/png"&&e.type!=="image/jpg"&&e.type!=="image/jpeg"?(u.$modal.msgError("\u56FE\u7247\u683C\u5F0F\u9519\u8BEF\uFF0C\u4EC5\u652F\u6301jpg\u3001jpeg\u3001png\u683C\u5F0F\u7684\u56FE\u7247"),!1):!0,R=e=>{const l=e.file,p=new FormData;p.append("file",l),j(p).then(s=>{s.data&&(t.icon=s.data)})},k=()=>{t.icon=""};return E({showDialog:S}),(e,l)=>{const p=ee,s=te,C=ie,f=le,D=pe,F=oe,q=ae,A=ne,B=re;return h(),V(B,{title:n(I),modelValue:n(d),"onUpdate:modelValue":l[6]||(l[6]=r=>Q(d)?d.value=r:null),width:"500px","align-center":!0,onClosed:N},{footer:o(()=>[g("div",he,[a(f,{onClick:l[5]||(l[5]=r=>d.value=!1)},{default:o(()=>[m(v(e.$t("cancel")),1)]),_:1}),a(f,{type:"primary",onClick:M},{default:o(()=>[m(v(e.$t("confirm")),1)]),_:1})])]),default:o(()=>[a(A,{ref:"formRef",model:n(t),rules:w,"label-width":"100"},{default:o(()=>[a(s,{label:e.$t("menuName"),prop:"title"},{default:o(()=>[a(p,{modelValue:n(t).title,"onUpdate:modelValue":l[0]||(l[0]=r=>n(t).title=r),placeholder:e.$t("menuNameP"),maxlength:"10"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(s,{label:e.$t("menuSort"),prop:"sort"},{default:o(()=>[a(C,{class:"input-number",modelValue:n(t).sort,"onUpdate:modelValue":l[1]||(l[1]=r=>n(t).sort=r),placeholder:e.$t("menuSortP"),onMousewheel:l[2]||(l[2]=z(()=>{},["prevent"])),max:99,min:0,precision:0,controls:!1},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(s,{label:e.$t("url"),prop:"path"},{default:o(()=>[a(p,{modelValue:n(t).path,"onUpdate:modelValue":l[3]||(l[3]=r=>n(t).path=r),placeholder:e.$t("urlP"),maxlength:"1000"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(s,{label:"\u4E0A\u4F20\u56FE\u6807",prop:"icon"},{default:o(()=>[g("img",{src:n(t).icon?x(n(t).icon):n(me),style:{width:"56px",height:"56px"}},null,8,fe),g("div",ge,[a(D,{ref:"uploadIconRef",accept:".jpg,.png,.jpeg",action:"#","before-upload":P,"http-request":R,style:{"margin-bottom":"10px"}},{default:o(()=>[a(f,{type:"primary"},{default:o(()=>[m("\u4E0A\u4F20\u83DC\u5355logo")]),_:1})]),_:1},512),a(f,{type:"primary",onClick:k},{default:o(()=>[m("\u6E05\u9664\u6062\u590D\u9ED8\u8BA4")]),_:1})]),_e]),_:1}),a(s,{label:e.$t("isVisible"),prop:"hidden"},{default:o(()=>[a(q,{modelValue:n(t).hidden,"onUpdate:modelValue":l[4]||(l[4]=r=>n(t).hidden=r)},{default:o(()=>[(h(!0),W(H,null,K(n(b),r=>(h(),V(F,{key:r.value,value:r.value},{default:o(()=>[m(v(r.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"])}}},be=O(ve,[["__scopeId","data-v-d112e006"]]);export{be as default};
