diff --git a/components.d.ts b/components.d.ts index 07ba1be..76bd6ba 100644 --- a/components.d.ts +++ b/components.d.ts @@ -31,6 +31,7 @@ declare module 'vue' { ExecutionResult: typeof import('./src/components/common/ExecutionResult/index.vue')['default'] ILucideActivity: typeof import('~icons/lucide/activity')['default'] ILucideCamera: typeof import('~icons/lucide/camera')['default'] + ILucideCircleX: typeof import('~icons/lucide/circle-x')['default'] ILucideCpu: typeof import('~icons/lucide/cpu')['default'] ILucideDatabase: typeof import('~icons/lucide/database')['default'] ILucideEdit: typeof import('~icons/lucide/edit')['default'] diff --git a/package-lock.json b/package-lock.json index 763f4c0..077dc0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "rd_mes_front_hmi", - "version": "0.0.0", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rd_mes_front_hmi", - "version": "0.0.0", + "version": "0.0.1", "dependencies": { "ant-design-vue": "^4.2.6", "axios": "^1.10.0", + "file-saver": "^2.0.5", "pinia": "^3.0.3", "unplugin-vue-components": "^28.7.0", "vue": "^3.5.13", @@ -18,6 +19,7 @@ "devDependencies": { "@iconify-json/lucide": "^1.2.66", "@types/event-source-polyfill": "^1.0.5", + "@types/file-saver": "^2.0.7", "@types/js-cookie": "^3.0.6", "@types/node": "^24.0.3", "@vitejs/plugin-vue": "^5.2.3", @@ -935,6 +937,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/file-saver": { + "version": "2.0.7", + "resolved": "https://registry.npmmirror.com/@types/file-saver/-/file-saver-2.0.7.tgz", + "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/js-cookie": { "version": "3.0.6", "resolved": "https://registry.npmmirror.com/@types/js-cookie/-/js-cookie-3.0.6.tgz", @@ -1644,6 +1653,12 @@ } } }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==", + "license": "MIT" + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz", diff --git a/package.json b/package.json index ddf61fd..7280903 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "ant-design-vue": "^4.2.6", "axios": "^1.10.0", + "file-saver": "^2.0.5", "pinia": "^3.0.3", "unplugin-vue-components": "^28.7.0", "vue": "^3.5.13", @@ -19,6 +20,7 @@ "devDependencies": { "@iconify-json/lucide": "^1.2.66", "@types/event-source-polyfill": "^1.0.5", + "@types/file-saver": "^2.0.7", "@types/js-cookie": "^3.0.6", "@types/node": "^24.0.3", "@vitejs/plugin-vue": "^5.2.3", diff --git a/src/api/common/model.d.ts b/src/api/common/model.d.ts index 6b23e40..5225036 100644 --- a/src/api/common/model.d.ts +++ b/src/api/common/model.d.ts @@ -4,4 +4,5 @@ export interface ApiResponse { data?: T; rows?: T[]; total?: number; + token?: string; } diff --git a/src/api/line1/data/index.ts b/src/api/line1/data/index.ts new file mode 100644 index 0000000..b5680a7 --- /dev/null +++ b/src/api/line1/data/index.ts @@ -0,0 +1,30 @@ +import request from '@/api/request'; +import type { ExportParams, QueryParams } from "./model"; + +// 获取 L1 数据 +export function getL1Data(params: QueryParams) { + return request({ + url: "/jinghua/l1OneData/list", + method: "get", + params, + }); +} + +// 获取 报警记录 数据 +export function getAlarmRecords(params: QueryParams) { + return request({ + url: '/jinghua/alarmRecord/list', + method: 'get', + params + }) +} + +// 导出数据 +export function exportData(data: ExportParams) { + return request({ + url: "/jinghua/l1OneData/export", + method: "post", + data, + responseType: "blob", + }); +} diff --git a/src/api/line1/data/model.d.ts b/src/api/line1/data/model.d.ts new file mode 100644 index 0000000..c21e6d9 --- /dev/null +++ b/src/api/line1/data/model.d.ts @@ -0,0 +1,14 @@ +export interface QueryParams { + pageNum?: number; + pageSize?: number; + orderByColumn?: string; + isAsc?: string; + qrCode?: string; + createTimeBegin?: string; + createTimeEnd?: string; +} + +export interface ExportParams { + createTimeBegin?: string; + createTimeEnd?: string; +} diff --git a/src/api/data/index.ts b/src/api/line2/data/index.ts similarity index 93% rename from src/api/data/index.ts rename to src/api/line2/data/index.ts index 87f75d0..0cc62b5 100644 --- a/src/api/data/index.ts +++ b/src/api/line2/data/index.ts @@ -1,4 +1,4 @@ -import request from '../request'; +import request from '@/api/request'; import type { QueryParams } from './model'; // 获取 L1 数据 diff --git a/src/api/data/model.d.ts b/src/api/line2/data/model.d.ts similarity index 100% rename from src/api/data/model.d.ts rename to src/api/line2/data/model.d.ts diff --git a/src/api/request.ts b/src/api/request.ts index a960bbc..4fb2296 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import router from '@/router'; import { getToken } from '@/utils/auth'; import { Modal, notification } from 'ant-design-vue'; -import type { AxiosRequestConfig } from "axios"; +import type { AxiosInstance, AxiosRequestConfig } from "axios"; import type { ApiResponse } from "@/api/common/model"; const errCodeMap: { [key: string]: string } = { @@ -12,7 +12,7 @@ const errCodeMap: { [key: string]: string } = { }; // 创建axios实例 -const service = axios.create({ +const service: AxiosInstance = axios.create({ baseURL: import.meta.env.VITE_APP_BASE_API, timeout: 10000, }); @@ -37,33 +37,38 @@ service.interceptors.request.use( // 响应拦截器 service.interceptors.response.use( response => { - // console.log(response); + if (response.config.responseType === "blob") { + return response.data; + } + const code = response.data.code || 200; const data = response.data; switch (code) { case 200: - return data ?? response; + return data; case 401: Modal.error({ - title: '系统提示', - content: '登录状态已过期,请重新登录', + title: "系统提示", + content: "登录状态已过期,请重新登录", onOk: () => { - router.push('/login') - } - }) + router.push("/login"); + }, + }); return Promise.reject(data); default: - const errMsg = errCodeMap[code] || data.msg || errCodeMap['default']; notification.error({ - message: '请求错误', - description: errMsg, + message: "请求错误", + description: errCodeMap[code] || data?.msg || errCodeMap.default, }); return Promise.reject(data); } }, - error => { - error.message = error.code === "ECONNABORTED" ? '请求超时,请稍后重试' : error.message; + (error) => { + error.message = + error.code === "ECONNABORTED" + ? "请求超时,请稍后重试" + : error.message || "网络异常"; // 网络/服务器错误统一处理 notification.error({ @@ -80,4 +85,3 @@ function request(config: AxiosRequestConfig): Promise> { } export default request; -// export default service; \ No newline at end of file diff --git a/src/components/LmsStatus/data.ts b/src/components/LmsStatus/data.ts new file mode 100644 index 0000000..4eba110 --- /dev/null +++ b/src/components/LmsStatus/data.ts @@ -0,0 +1,11 @@ +export const actions = { + 'line2': [ + { title: "L1 数据", path: "/line2/L1-data" }, + { title: "L4 数据", path: "/line2/L4-data" }, + { title: "报警记录", path: "/line2/alarm-records" }, + ], + 'line1': [ + { title: "L1 数据", path: "/line1/L1-data" }, + { title: "报警记录", path: "/line1/alarm-records" }, + ], +}; diff --git a/src/components/LmsStatus/index.vue b/src/components/LmsStatus/index.vue index b87b7fe..9599951 100644 --- a/src/components/LmsStatus/index.vue +++ b/src/components/LmsStatus/index.vue @@ -20,9 +20,7 @@
- L1 数据 - L4 数据 - 报警记录 + {{ act.title }}
@@ -33,6 +31,14 @@ import { useRouter } from 'vue-router'; import { useDialog } from '@/utils/useDialog'; import { fetchLmsWorkMode, updateLmsWorkMode } from '@/api/lms'; import { message } from 'ant-design-vue'; +import { actions } from './data'; + +const props = defineProps({ + type: { + type: String, + required: true + } +}) // useDialog管理弹窗状态 const { visible: dialogVisible, show, hide } = useDialog(); @@ -77,8 +83,8 @@ async function initLmsStatus() { const router = useRouter(); -function redirectTo(type: string) { - router.push(`/${type}`); +function redirectTo(path: string) { + router.push(path); } // 初始化 LMS 状态 diff --git a/src/components/MesStatus/index.vue b/src/components/MesStatus/index.vue index ad54277..76948ef 100644 --- a/src/components/MesStatus/index.vue +++ b/src/components/MesStatus/index.vue @@ -19,6 +19,9 @@ + + diff --git a/src/views/L1-data-list/types.ts b/src/views/Line1/L1-data-list/types.ts similarity index 100% rename from src/views/L1-data-list/types.ts rename to src/views/Line1/L1-data-list/types.ts diff --git a/src/views/L4-data-list/data.ts b/src/views/Line1/L4-data-list/data.ts similarity index 100% rename from src/views/L4-data-list/data.ts rename to src/views/Line1/L4-data-list/data.ts diff --git a/src/views/L4-data-list/index.vue b/src/views/Line1/L4-data-list/index.vue similarity index 100% rename from src/views/L4-data-list/index.vue rename to src/views/Line1/L4-data-list/index.vue diff --git a/src/views/L4-data-list/types.ts b/src/views/Line1/L4-data-list/types.ts similarity index 100% rename from src/views/L4-data-list/types.ts rename to src/views/Line1/L4-data-list/types.ts diff --git a/src/views/alarm-records/data.ts b/src/views/Line1/alarm-records/data.ts similarity index 100% rename from src/views/alarm-records/data.ts rename to src/views/Line1/alarm-records/data.ts diff --git a/src/views/alarm-records/index.vue b/src/views/Line1/alarm-records/index.vue similarity index 100% rename from src/views/alarm-records/index.vue rename to src/views/Line1/alarm-records/index.vue diff --git a/src/views/alarm-records/types.ts b/src/views/Line1/alarm-records/types.ts similarity index 100% rename from src/views/alarm-records/types.ts rename to src/views/Line1/alarm-records/types.ts diff --git a/src/views/lms/index.vue b/src/views/Line1/index.vue similarity index 99% rename from src/views/lms/index.vue rename to src/views/Line1/index.vue index cbb958d..f626e44 100644 --- a/src/views/lms/index.vue +++ b/src/views/Line1/index.vue @@ -1,5 +1,5 @@ + + + + \ No newline at end of file diff --git a/src/views/Line2/L4-data-list/types.ts b/src/views/Line2/L4-data-list/types.ts new file mode 100644 index 0000000..7de23d3 --- /dev/null +++ b/src/views/Line2/L4-data-list/types.ts @@ -0,0 +1,106 @@ +export interface L4Data { + /** 加工信息ID */ + processInfoId: number; + + /** PLT No */ + pltNo: number; + + /** 加工F1, 0:未加工 */ + processF1: 0 | 1; + + /** 加工F2, 1:已加工 */ + processF2: 0 | 1; + + /** 良品F1, 0:不良品 */ + goodProductF1: 0 | 1; + + /** 良品F2, 1:良品 */ + goodProductF2: 0 | 1; + + /** + * 电气检测结果 + * 0-DCR不良, 1-LCR不良, 3-IR不良, 7-良品 + */ + electricalResult: 0 | 1 | 3 | 7; + + /** 印字检测结果, 0-良品, 1-不良品 */ + engraveResult: 0 | 1; + + /** 二维码 */ + qrCode: string; + + /** 二维码等级 */ + qrCodeLevel: string; + + /** 压力1_5#_铆接 */ + pressure15Riveting: number; + + /** 高度1_5#_铆接 */ + height15Riveting: number; + + /** 压力2_5#_磁石1 */ + pressure25Magnet1: number; + + /** 高度2_5#_磁石1 */ + height25Magnet1: number; + + /** 压力3_6#_磁石2 */ + pressure36Magnet2: number; + + /** 高度3_6#_磁石2 */ + height36Magnet2: number; + + /** 扭矩4_7#_轴旋入 */ + torque47AxisInsert: number; + + /** 高度4_7#_轴旋入 */ + height47AxisInsert: number; + + /** 压力5_8#_下壳装入 */ + pressure58LowerCase: number; + + /** 高度5_8#_下壳装入 */ + height58LowerCase: number; + + /** 压力6_9#_上壳装入 */ + pressure69UpperCase: number; + + /** 高度6_9#_上壳装入 */ + height69UpperCase: number; + + /** 高度7_9#_高度检测 */ + height79HeightCheck: number; + + /** 压力7_9#_激光 */ + pressure79Laser: number; + + /** 高度8_9#_激光 */ + height89Laser: number; + + /** 数値1_9#_DCR(上) */ + value19DcrUpper: number; + + /** 数値2_9#_DCR(下) */ + value29DcrLower: number; + + /** 数値3_9#_LCR(上)LS */ + value39LcrUpperLs: number; + + /** 数値4_9#_LCR(下)Q */ + value49LcrLowerQ: number; + + /** 数値5_9#_LCR(下)LS */ + value59LcrLowerLs: number; + + /** 数値6_9#_LCR(下)Q */ + value69LcrLowerQ: number; + + /** 数値7_9#_IR R */ + value79IrR: number; + + /** 数値8_9#_IR I */ + value89IrI: number; + + /** 创建时间 (ISO 8601) */ + createTime: string; +} \ No newline at end of file diff --git a/src/views/index.vue b/src/views/Line2/index.vue similarity index 99% rename from src/views/index.vue rename to src/views/Line2/index.vue index a77fb73..7f5b7a4 100644 --- a/src/views/index.vue +++ b/src/views/Line2/index.vue @@ -1,5 +1,5 @@ @@ -317,7 +310,7 @@ onBeforeUnmount(() => { /> - +