import{f as r}from"./index.0abf9e5c.js";import{a as i,b as g,c as o}from"./wx_oa.5b68b7b6.js";import{s as d,r as c,a0 as h}from"./@vue.cab01781.js";const s=d(),a=c([]),n=c(0),w=h({name:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:["blur","change"]},{min:1,max:12,message:"\u957F\u5EA6\u9650\u523612\u4E2A\u5B57\u7B26",trigger:["blur","change"]}],menuType:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:["blur","change"]}],visitType:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:["blur","change"]}],url:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:["blur","change"]},{pattern:/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/,message:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u7F51\u5740\u94FE\u63A5",trigger:["blur","change"]}],appId:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:["blur","change"]}],pagePath:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:["blur","change"]}]}),S=l=>(l&&(s.value=l),{menuList:a,menuIndex:n,handleAddMenu:()=>{a.value.push({name:"\u83DC\u5355\u540D\u79F0",menuType:1,visitType:"view",url:"",appId:"",pagePath:"",subButtons:[]})},handleAddSubMenu:e=>{const u=n.value;if(a.value[u].subButtons.length>=5){r.msgError("\u5DF2\u6DFB\u52A0\u4E0A\u9650\uFF5E");return}a.value[u].subButtons.push(e)},handleEditSubMenu:(e,u)=>{const t=n.value;a.value[t].subButtons[u]=e},handleDelMenu:e=>{a.value.splice(e,1)},handleDelSubMenu:(e,u)=>{a.value[e].subButtons.splice(u,1)},getOaMenuFunc:async()=>{try{a.value=await i()}catch(e){console.log("\u83B7\u53D6\u83DC\u5355=>",e)}},handleSave:async()=>{const e=s.value.value;for(let u=0;u<e.length;u++)try{await e[u].menuFormRef.validate()}catch{n.value=u;return}await g(a.value),r.msgSuccess("\u4FDD\u5B58\u6210\u529F")},handlePublish:async()=>{const e=s.value.value;for(let u=0;u<e.length;u++)try{await e[u].menuFormRef.validate()}catch{n.value=u;return}await o(a.value),r.msgSuccess("\u53D1\u5E03\u6210\u529F")}});export{w as r,S as u};
