Files
Migu2.0/MiGu.Server/wwwroot/assets/OpsConfigView-CyPTl7WY.js
T

2 lines
7.6 KiB
JavaScript
Raw Normal View History

import{aG as te,b4 as oe,aA as h,bH as n,br as P,b7 as u,aF as s,N as le,H as ae,aE as b,O as ne,S as se,bI as B,aC as C,E as ie,x as re,ah as E,bh as T,y as ue,az as ce,v as me,u as de,bo as D,bz as fe,aB as pe,by as ve,e as _e,bn as $,bf as S,X as j,aj as ye}from"./index-CC_hCGHZ.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{C as he,n as w,c as be,d as ge,s as W,l as ke}from"./ConfigPageBase-B4fOVsSK.js";import{r as Ce}from"./reflection-CTDOoTn5.js";import{f as Ve}from"./monitorConfigCache-B5CZXjjB.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./PermissionGuard-DxbOGfWF.js";/* empty css */function Ne(V,m,d){if(!V)return[];const g=V[m]??V[d];if(g?.length)return[...g];for(const[c,f]of Object.entries(V))if(f?.length){if(c===m||c===d)return[...f];if(m.endsWith("."+c)||c.endsWith("."+d))return[...f];if(m.endsWith("."+d)&&(c===d||c.endsWith("."+d)))return[...f]}return[]}const xe={class:"monitor-section"},Ae={key:0,class:"muted empty-hint"},G="simple-platform-methods-by-type-car-v1",Se=500,Ee=te({__name:"OpsConfigView",setup(V){const m=$([]),d=$([]),g=$([]),c=S(!1),f=S(!1),U=S([]),N=S(null),x=S(!1);let _=null,k=null;function M(l){k=l,_&&clearTimeout(_),_=setTimeout(()=>{O()},Se)}async function O(){if(_=null,x.value){_=setTimeout(()=>{O()},200);return}const l=k;if(k=null,!!l){x.value=!0;try{const e=await W(l,{cachedRoot:N.value});N.value=e,j.success({message:"地图监控配置已自动保存",duration:1200,grouping:!0})}catch(e){j.error(`地图监控配置自动保存失败:${e instanceof Error?e.message:String(e)}`)}finally{x.value=!1,k&&M(k)}}}oe(()=>{_&&(clearTimeout(_),_=null),k&&!x.value&&O()});async function J(l,e){c.value=!0,f.value=!0;try{const t=await Ve(),[{config:i,cache:r},p]=await Promise.all([ke(l,t),L()]);N.value=r,d.value=z(t.available.site.methods),g.value=z(t.available.track.methods),e(i)}catch{e(w(l)),d.value=[],g.value=[],await L()}finally{c.value=!1,f.value=!1}}async function Y(l){N.value=await W(l,{cachedRoot:N.value})}async function L(){try{const l=sessionStorage.getItem(G);if(l){const e=JSON.parse(l);if(Array.isArray(e)&&e.length){m.value=e;return}}}catch{}try{const e=(await Ce.listMethodsByType("car")).map(t=>({typeKey:t.fullTypeName??t.typeName,shortTypeName:t.typeName,title:`${t.typeLabel??t.typeName} / ${t.fullTypeName??t.typeName} [${t.assemblyName}]`,methods:t.methods.map(i=>({methodName:i.methodName,label:i.label||i.methodName})).filter(i=>!!i.methodName)})).filter(t=>t.methods.length>0).sort((t,i)=>t.title.localeCompare(i.title));m.value=e;try{sessionStorage.setItem(G,JSON.stringify(e))}catch{}}catch{m.value=[]}}function z(l){return l?.length?l.map(e=>({methodName:e,label:e})):[]}function K(l){return l.monitor??ge()}function F(l,e){const t=K(l).carActionByType;return Ne(t,e.typeKey,e.shortTypeName)}function X(l,e){const t=F(l,e).slice().sort().join("\0");return`${e.typeKey}\0${t}`}function I(l,e,t,i,r){const p=K(e),v={...e,monitor:{...p,[t]:{...p[t],[i]:[...r]}}};l(v),M(v)}function q(l,e,t,i){const r=K(e),p=be(r.carActionByType);p[t.typeKey]=[...i],t.shortTypeName!==t.typeKey&&delete p[t.shortTypeName];const v={...e,monitor:{...r,carActionByType:p}};l(v),M(v)}return(l,e)=>{const t=ae,i=se,r=ne,p=ie,v=de,R=me,Q=ue,Z=re,ee=le,H=ve;return u(),h(he,{section:"ops",title:"运营维护",description:"调度回放、日志管理、版本维护(OpsConfig",defaults:P(_e),"normalize-payload":P(w),"after-load":J,"before-save":Y},{default:n(({payload:a,update:y})=>[s(ee,{"label-width":"200px",model:a},{default:n(()=>[s(t,{"content-position":"left"},{default:n(()=>[...e[1]||(e[1]=[b("调度回放",-1)])]),_:1}),s(r,{label:"保留时长 (天)"},{default:n(()=>[s(i,{"model-value":a.playback.retentionDays