import{d as M,c as v,e as T,a as A,u as L}from"./index-f6f689f9-1782572373740v=1.0.0.js";import{u as b}from"./keepAlive-0ac97bbd-1782572373740v=1.0.0.js";import{E as h}from"./eleVendor-48a7d3b8-1782572373740v=1.0.0.js";import{c as y,r as d}from"./vendor-866bb149-1782572373740v=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((u,o)=>{if(u.path!==e)return;const l=s[o+1]||s[o-1];!l||v.push(l.path)}),this.tabsMenuList=s.filter(u=>u.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),u=d(),o=A(),l=L(),c=S(),p=b();return{BaseCompanyAreaId:t,closeCurrent:(a,i)=>{if(a){c.removeTabs(a),p.removeKeepAliveName(i);return}o.meta.isAffix||(c.removeTabs(o.fullPath),p.removeKeepAliveName(o.name),l.back())},ruleFormRef:u,setTitle:a=>{c.setTabsTitle(a)},addMethod:(a,i,f="\u65B0\u589E\u6210\u529F")=>{if(!s.value)return new Promise(async n=>{let r=await a(i);r.code==200?(h.success(f),n({flag:!0,...r})):n({flag:!1,...r}),s.value=!1})},updateMethod:(a,i,f="\u66F4\u65B0\u6210\u529F")=>{if(!s.value)return new Promise(async n=>{let r=await a(i);r.code==200?(h.success(f),n({flag:!0,...r})):n({flag:!1,...r}),s.value=!1})},loading:s}};export{N as u};
