p-3935e744.js 1.4 KB
Newer Older
1
import{i as t,n as s,b as n,G as e}from"./p-8d47f7b8.js";class o extends class{constructor(){this.cacheMap=new Map,this.typeData={}}async getConfigJson(e){if(t(this.typeData)&&await this.getTypeData(),e)try{const t=e.cls;if(this.cacheMap.has(t))return this.cacheMap.get(t);const o=this.typeData[t],c=[];if(s(o))for(let t=0;t<o.length;t++){const n=o[t];if(s(n)){const t=await this.fetchJson(`./assets/json/model-config/${encodeURIComponent(n)}.json`);s(t)&&t.forEach((t=>{const n=c.findIndex((s=>s.group===t.group));if(s(t.methods))if(n>=0){const s=c[n];t.methods.forEach((t=>{s.methods.findIndex((s=>s.name===t.name))>=0?Object.assign(s.methods[n],t):s.methods.push(t)}))}else c.push(t)}))}}return s(c)?(this.cacheMap.set(t,c),c.forEach((t=>{t.methods=n(t.methods,"order")})),n(c,"order")):[]}catch(t){console.log("模型类型计算显示配置失败!",t)}return null}async getTypeData(){const t=await this.fetchJson("./assets/json/modelints.json");t&&(this.typeData=t)}async fetchJson(t){try{const s=await fetch(t);return await s.json()||[]}catch(t){console.error("获取配置JSON失败!",t)}}}{constructor(){if(o.instance)return o.instance;super()}static getInstance(){return this.instance}}o.instance=new o;const c=o.getInstance();class i{constructor(){if(this.store=e.getInstance(),i.instance)return i.instance}get modelService(){return this.store.data.modelService}static getInstance(){return this.instance}}i.instance=new i;export{i as A,c as m}