import{d as M,r as v,c as T,a as A,b as L}from"./index-c87bcfde-1782468512657v=1.0.0.js";import{u as b}from"./keepAlive-a871c896-1782468512657v=1.0.0.js";import{E as h}from"./eleVendor-12a75a9a-1782468512657v=1.0.0.js";import{c as y,r as d}from"./vendor-27e23c1b-1782468512657v=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};
