import{d as M,r as v,a as T,b as A,c as L}from"./index-5a47c360-1785478469326v=1.0.0.js";import{u as b}from"./keepAlive-4a384a77-1785478469326v=1.0.0.js";import{E as h}from"./eleVendor-bc05bc4d-1785478469326v=1.0.0.js";import{c as y,r as d}from"./vendor-46662d77-1785478469326v=1.0.0.js";const m=b(),S=M({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||v.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=T(),t=y(()=>e.companyAreaId),s=d(!1),i=d(),o=A(),l=L(),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?(h.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?(h.success(f),n({flag:!0,...r})):n({flag:!1,...r}),s.value=!1})},loading:s}};export{N as u};
