Dashboard 移除 CNC/清洗机等不存在设备,改为纯装配线看板(扫码枪+拧紧枪+人工);JWT/内部token统一为 Hardman_2026 写入各 etc/*.yaml,MES 建表 DSN 改读 yaml;event_log 增加 workOrderNo/operator,BOM/备料/PLC下发/拧紧/扫码报工/半成品/AGV 全链路埋点,日志页支持工单号/操作人筛选;MES/WMS 日志按天存储(dailyWriter),WMS SetWriter 用 logx.NewWriter 适配
36 lines
821 B
TypeScript
36 lines
821 B
TypeScript
import axios from 'axios';
|
||
|
||
// MES(B) 内部 API:X-API-TOKEN 写死 token(值与 MES etc 配置 Internal.Token 一致)
|
||
export const MES_TOKEN =
|
||
(import.meta as any).env?.VITE_MES_TOKEN || 'Hardman_2026';
|
||
|
||
const api = axios.create({
|
||
baseURL: '/api/v1/dashboard',
|
||
timeout: 10000,
|
||
});
|
||
|
||
api.interceptors.response.use(
|
||
(res) => res,
|
||
(err) => {
|
||
console.error(`[API] ${err.message}`);
|
||
return Promise.reject(err);
|
||
},
|
||
);
|
||
|
||
// 走 MES 内部接口(经 vite proxy 或 nginx 反代到 MES :8888)
|
||
const mesApi = axios.create({
|
||
baseURL: '/api/internal',
|
||
timeout: 10000,
|
||
headers: { 'X-API-TOKEN': MES_TOKEN },
|
||
});
|
||
|
||
mesApi.interceptors.response.use(
|
||
(res) => res,
|
||
(err) => {
|
||
console.error(`[MES API] ${err.message}`);
|
||
return Promise.reject(err);
|
||
},
|
||
);
|
||
|
||
export { api as default, mesApi };
|