Files
geMoldInsight/static/assets/index-SE6ZBOjs.js
T

3 lines
110 KiB
JavaScript
Raw Normal View History

2026-06-01 14:52:47 +08:00
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomeView-BwXW4Tu5.js","assets/HomeView-BRIIE-vf.css","assets/LoginView-BgKddIol.js","assets/LoginView--ukxbAHo.css","assets/UsersView-BB1rRbK5.js","assets/utils-COFIQvWo.js","assets/MoldInsightView-BDLMEGmW.js","assets/ResultView-CLqagVER.js","assets/InventoryView-Gnd1z3-y.js","assets/InventoryView-B0k6FNvT.css"])))=>i.map(i=>d[i]);
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var t={},n=[],r=()=>{},i=()=>!1,a=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),o=e=>e.startsWith(`onUpdate:`),s=Object.assign,c=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},l=Object.prototype.hasOwnProperty,u=(e,t)=>l.call(e,t),d=Array.isArray,f=e=>x(e)===`[object Map]`,p=e=>x(e)===`[object Set]`,m=e=>x(e)===`[object Date]`,h=e=>typeof e==`function`,g=e=>typeof e==`string`,_=e=>typeof e==`symbol`,v=e=>typeof e==`object`&&!!e,y=e=>(v(e)||h(e))&&h(e.then)&&h(e.catch),b=Object.prototype.toString,x=e=>b.call(e),S=e=>x(e).slice(8,-1),C=e=>x(e)===`[object Object]`,w=e=>g(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,T=e(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,E=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),ne=/\B([A-Z])/g,D=ee(e=>e.replace(ne,`-$1`).toLowerCase()),re=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),ie=ee(e=>e?`on${re(e)}`:``),O=(e,t)=>!Object.is(e,t),ae=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},k=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},oe=e=>{let t=parseFloat(e);return isNaN(t)?e:t},se=e=>{let t=g(e)?Number(e):NaN;return isNaN(t)?e:t},ce,le=()=>ce||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function ue(e){if(d(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=g(r)?me(r):ue(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(g(e)||v(e))return e}var de=/;(?![^(]*\))/g,fe=/:([^]+)/,pe=/\/\*[^]*?\*\//g;function me(e){let t={};return e.replace(pe,``).split(de).forEach(e=>{if(e){let n=e.split(fe);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function he(e){let t=``;if(g(e))t=e;else if(d(e))for(let n=0;n<e.length;n++){let r=he(e[n]);r&&(t+=r+` `)}else if(v(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var ge=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,_e=e(ge);ge+``;function ve(e){return!!e||e===``}function ye(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=be(e[r],t[r]);return n}function be(e,t){if(e===t)return!0;let n=m(e),r=m(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=_(e),r=_(t),n||r)return e===t;if(n=d(e),r=d(t),n||r)return n&&r?ye(e,t):!1;if(n=v(e),r=v(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),i=t.hasOwnProperty(n);if(r&&!i||!r&&i||!be(e[n],t[n]))return!1}}return String(e)===String(t)}function xe(e,t){return e.findIndex(e=>be(e,t))}var Se=e=>!!(e&&e.__v_isRef===!0),Ce=e=>g(e)?e:e==null?``:d(e)||v(e)&&(e.toString===b||!h(e.toString))?Se(e)?Ce(e.value):JSON.stringify(e,we,2):String(e),we=(e,t)=>Se(t)?we(e,t.value):f(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Te(t,r)+` =>`]=n,e),{})}:p(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Te(e))}:_(t)?Te(t):v(t)&&!d(t)&&!C(t)?String(t):t,Te=(e,t=``)=>_(e)?`Symbol(${e.description??t})`:e,A,Ee=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&A&&(A.active?(this.parent=A,this.inde
2026-05-29 17:30:26 +08:00
`):`请求校验失败`}return typeof t.detail==`object`?JSON.stringify(t.detail):String(t.detail)}return t?.message?String(t.message):`请求失败`}let t=(await e.text().catch(()=>``)||``).trim();return t?t.length>200?t.slice(0,200)+`...`:t:`请求失败`}catch{return`请求失败`}}async function pu(e,t={}){let n=ou(),r={"Content-Type":`application/json`,...t.headers||{}};n.token&&(r.Authorization=`Bearer ${n.token}`);let i=await fetch(e,{...t,headers:r});if(i.status===401)throw n.user=null,n.token=null,localStorage.removeItem(`token`),localStorage.removeItem(`user`),Error(`登录已过期,请重新登录`);if(!i.ok){let e=await fu(i);throw Error(e)}return i.json()}function mu(e,t){let n=ou();n.token=e,n.user=t,localStorage.setItem(`token`,e),localStorage.setItem(`user`,JSON.stringify(t))}function hu(){let e=ou();e.token=null,e.user=null,localStorage.removeItem(`token`),localStorage.removeItem(`user`)}function gu(){let e=ou(),t=localStorage.getItem(`token`),n=localStorage.getItem(`user`);if(t&&n)try{e.token=t,e.user=JSON.parse(n)}catch{hu()}e.initialized=!0}var _u=0,vu=new Map;function yu(e,t=`info`){let n=`${t}:${e}`,r=Date.now();if(r-(vu.get(n)||0)<2500)return;vu.set(n,r);let i=ou(),a=++_u,o={id:a,message:e,type:t,timestamp:new Date,visible:!0};i.notifications.push(o),setTimeout(()=>{let e=i.notifications.find(e=>e.id===a);e&&(e.visible=!1,setTimeout(()=>{i.dismissNotification(a)},300))},5e3)}function bu(e,t=``){console.error(`API错误 [${t}]:`,e);let n=e instanceof Error?e.message:`请求失败,请稍后重试`;return yu(n,`error`),n}var xu={class:`app-container`},Su={key:0,class:`notification-container`},Cu={class:`notification-icon`},wu={class:`notification-content`},Tu={class:`notification-message`},Eu=[`onClick`],Du={class:`app-header`},Ou={class:`header-content`},ku={key:0,class:`nav-menu`},Au={class:`user-section`},ju={class:`user-info`},Mu={class:`user-avatar`},Nu={class:`user-name`},Pu={class:`main-content`},Fu=or({__name:`App`,setup(e){let t=au(),n=iu(),r=ou(),i=Y(()=>{let e=[{path:`/`,label:`首页`,icon:`⌂`},{path:`/inventory`,label:`进销存`,icon:`⊞`},{path:`/moldinsight`,label:`MoldInsight`,icon:`◈`}];return r.user?.is_superuser&&e.push({path:`/users`,label:`用户管理`,icon:`👤`}),e}),a=e=>e===`/`?t.path===`/`:t.path.startsWith(e),o=async()=>{try{await pu(`/api/auth/logout`,{method:`POST`})}catch{}hu(),yu(`已退出登录`,`success`),n.push(`/login`)},s=e=>{let t=r.notifications.find(t=>t.id===e);t&&(t.visible=!1,setTimeout(()=>{r.dismissNotification(e)},300))};return xr(()=>{gu()}),(e,t)=>{let c=jr(`router-link`),l=jr(`router-view`);return Zi(),na(`div`,xu,[I(r).notifications.length>0?(Zi(),na(`div`,Su,[q(Qo,{name:`notification`},{default:Nn(()=>[(Zi(!0),na(U,null,Ir(I(r).notifications,e=>(Zi(),na(`div`,{key:e.id,class:he([`notification`,`notification-`+e.type])},[K(`div`,Cu,Ce(e.type===`success`?`✓`:e.type===`error`?`✕`:e.type===`warning`?`!`:`i`),1),K(`div`,wu,[K(`div`,Tu,Ce(e.message),1)]),K(`button`,{class:`notification-close`,onClick:t=>s(e.id)},`×`,8,Eu)],2))),128))]),_:1})])):pa(``,!0),K(`header`,Du,[K(`div`,Ou,[K(`div`,{class:`logo`,onClick:t[0]||=e=>I(n).push(`/`)},[...t[1]||=[K(`div`,{class:`logo-icon`},`G`,-1),K(`div`,null,[K(`div`,{class:`logo-text`},`Gemold`),K(`div`,{class:`logo-subtitle`},`模具制造管理系统`)],-1)]]),I(r).user?(Zi(),na(`nav`,ku,[(Zi(!0),na(U,null,Ir(i.value,e=>(Zi(),ra(c,{key:e.path,to:e.path,class:he([`nav-item`,{active:a(e.path)}])},{default:Nn(()=>[da(Ce(e.label),1)]),_:2},1032,[`to`,`class`]))),128))])):pa(``,!0),K(`div`,Au,[I(r).user?(Zi(),na(U,{key:0},[K(`div`,ju,[K(`div`,Mu,Ce((I(r).user.full_name||I(r).user.username).charAt(0).toUpperCase()),1),K(`span`,Nu,Ce(I(r).user.full_name||I(r).user.username),1)]),K(`button`,{class:`btn btn-secondary`,onClick:o},`退出`)],64)):(Zi(),ra(c,{key:1,to:`/login`,class:`btn btn-primary`},{default:Nn(()=>[...t[2]||=[da(`登录`,-1)]]),_:1}))])])]),K(`main`,Pu,[q(l,null,{default:Nn(({Component:e})=>[q(to,{name:`fade`,mode:`out-in`},{default:Nn(()=>[(Zi(),ra(Nr(e)))]),_:2},1024)]),_:1})]),t[3]||=K(`f