import{c as M,r as h}from"./vendor-6ae0c374-1783405707921v=1.0.0.js";import{d as v,r as T,c as A,a as L,b as y}from"./index-71d7b18c-1783405707921v=1.0.0.js";import{u as b}from"./keepAlive-6cb682d1-1783405707921v=1.0.0.js";import{E as d}from"./eleVendor-d42abce8-1783405707921v=1.0.0.js";const m=b(),S=v({id:"TabsState",state:()=>({tabsMenuList:[]}),actions:{async addTabs(e){e.path.indexOf("id=")==-1&&e.title==="\u8BE6\u60C5"&&(e.title="\u65B0\u589E"),this.tabsMenuList.every(t=>t.path!==e.path)&&this.tabsMenuList.push(e),!m.keepAliveName.includes(e.name)&&e.isKeepAlive&&m.addKeepAliveName(e.name)},async removeTabs(e,t=!0){const s=this.tabsMenuList;t&&s.forEach((i,o)=>{if(i.path!==e)return;const l=s[o+1]||s[o-1];!l||T.push(l.path)}),this.tabsMenuList=s.filter(i=>i.path!==e)},async closeMultipleTab(e){this.tabsMenuList=this.tabsMenuList.filter(t=>t.path===e||!t.close),this.tabsMenuList},async setTabs(e){this.tabsMenuList=e},async setTabsTitle(e){const t=location.hash.substring(1);this.tabsMenuList.forEach(s=>{s.path==t&&(s.title=e)})}}}),N=()=>{const e=A(),t=M(()=>e.companyAreaId),s=h(!1),i=h(),o=L(),l=y(),c=S(),p=b();return{BaseCompanyAreaId:t,closeCurrent:(a,u)=>{if(a){c.removeTabs(a),p.removeKeepAliveName(u);return}o.meta.isAffix||(c.removeTabs(o.fullPath),p.removeKeepAliveName(o.name),l.back())},ruleFormRef:i,setTitle:a=>{c.setTabsTitle(a)},addMethod:(a,u,f="\u65B0\u589E\u6210\u529F")=>{if(!s.value)return new Promise(async n=>{let r=await a(u);r.code==200?(d.success(f),n({flag:!0,...r})):n({flag:!1,...r}),s.value=!1})},updateMethod:(a,u,f="\u66F4\u65B0\u6210\u529F")=>{if(!s.value)return new Promise(async n=>{let r=await a(u);r.code==200?(d.success(f),n({flag:!0,...r})):n({flag:!1,...r}),s.value=!1})},loading:s}};export{N as u};
