Compare commits
3 Commits
ac35b819a7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f3ed5fe3c | ||
|
|
9f7ba7b18f | ||
|
|
e80b9c95dc |
@@ -1,6 +1,6 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { getToken } from '@/utils/auth';
|
import { getToken, removeToken } from '@/utils/auth';
|
||||||
import { Modal, notification } from 'ant-design-vue';
|
import { Modal, notification } from 'ant-design-vue';
|
||||||
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
||||||
import type { ApiResponse } from "@/api/common/model";
|
import type { ApiResponse } from "@/api/common/model";
|
||||||
@@ -52,7 +52,8 @@ service.interceptors.response.use(
|
|||||||
title: "系统提示",
|
title: "系统提示",
|
||||||
content: "登录状态已过期,请重新登录",
|
content: "登录状态已过期,请重新登录",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
router.push("/login");
|
removeToken();
|
||||||
|
router.replace('/login');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return Promise.reject(data);
|
return Promise.reject(data);
|
||||||
|
|||||||
32
src/utils/table.ts
Normal file
32
src/utils/table.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* 计算字符串“字数”
|
||||||
|
* 中文 / 全角字符:1
|
||||||
|
* 英文 / 数字 / 半角符号:0.5
|
||||||
|
*/
|
||||||
|
export function calcTextLength(text: string): number {
|
||||||
|
let length = 0;
|
||||||
|
|
||||||
|
for (const char of text) {
|
||||||
|
// charCode > 255 基本可以认为是中文或全角字符
|
||||||
|
if (char.charCodeAt(0) > 255) {
|
||||||
|
length += 1;
|
||||||
|
} else {
|
||||||
|
length += 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文本计算列宽
|
||||||
|
*/
|
||||||
|
export function calcColumnWidth(
|
||||||
|
text: string,
|
||||||
|
unitWidth = 24,
|
||||||
|
minWidth = 50,
|
||||||
|
maxWidth = 150
|
||||||
|
) {
|
||||||
|
const width = calcTextLength(text) * unitWidth;
|
||||||
|
return Math.min(Math.max(width, minWidth), maxWidth);
|
||||||
|
}
|
||||||
@@ -20,20 +20,26 @@ const ACTION_COLUMN: TableColumnType = {
|
|||||||
|
|
||||||
// 使用 Record 类型确保键值对的安全性
|
// 使用 Record 类型确保键值对的安全性
|
||||||
export const fields: Record<string, string> = {
|
export const fields: Record<string, string> = {
|
||||||
productStatus: "产品状态",
|
flag: "标志位",
|
||||||
goodFlag: "良品标记",
|
processFlag: "加工标志",
|
||||||
processMemory: "加工记忆",
|
qualifiedFlag: "良品标志",
|
||||||
functionSw: "功能SW",
|
barcode: "二维码",
|
||||||
axisNumber: "轴号",
|
pressure1: "压力1",
|
||||||
plugTerminalPressure: "插端子压力值",
|
height1: "高度1",
|
||||||
plugTerminalHeight: "插端子高度值",
|
value19Dcr: "数値19#Dcr",
|
||||||
resistance: "电阻值",
|
value39LcrLs: "数値39#LcrLs",
|
||||||
inductorLs: "电感LS值",
|
value49LcrQ: "数値49#LcrQ",
|
||||||
inductorQ: "电感Q值",
|
value79IrR: "数値79#IrR",
|
||||||
pressureResistanceR: "耐压R值",
|
value89IrI: "数値89#IrI",
|
||||||
pressureResistanceI: "耐压I值",
|
skeletonCcdCheck: "骨架Ccd检查结果",
|
||||||
visualResult: "视觉结果",
|
assemblyCcdCheck: "组立Ccd检查结果",
|
||||||
|
reserve1: "补充字段1",
|
||||||
|
reserve2: "补充字段2",
|
||||||
|
recordTime: "记录数据的时间",
|
||||||
createTime: "创建时间",
|
createTime: "创建时间",
|
||||||
|
createBy: "创建人",
|
||||||
|
updateTime: "修改时间",
|
||||||
|
updateBy: "修改人",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// 导出完整的列配置
|
// 导出完整的列配置
|
||||||
|
|||||||
@@ -39,37 +39,12 @@
|
|||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
<div class="table-section">
|
<div class="table-section">
|
||||||
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
||||||
@change="handleTableChange" row-key="id" size="middle" :scroll="{ x: 1200 }">
|
@change="handleTableChange" row-key="id" size="middle" table-layout="fixed" :scroll="{ x: 'max-content'}">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
||||||
<template v-else-if="column.key === 'createTime'">
|
<template v-else-if="['createTime', 'updateTime', 'recordTime'].includes(column.key as string)">
|
||||||
<span>{{ formatDateTime(record.createTime) }}</span>
|
<span>{{ formatDateTime(record[column.key as string]) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<!-- <template v-else-if="column.key === 'productStatus'">
|
|
||||||
<a-tag :color="record.productStatus === 1 ? 'success' : 'default'">
|
|
||||||
{{ record.productStatus === 1 ? '有' : '无' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="column.key === 'goodFlag'">
|
|
||||||
<a-tag :color="record.goodFlag === 1 ? 'success' : 'error'">
|
|
||||||
{{ record.goodFlag === 1 ? '良品' : '不良品' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="column.key === 'processMemory'">
|
|
||||||
<a-tag :color="record.processMemory === 1 ? 'success' : 'default'">
|
|
||||||
{{ record.processMemory === 1 ? '已加工' : '未开工' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="column.key === 'functionSw'">
|
|
||||||
<a-tag :color="record.functionSw === 1 ? 'success' : 'default'">
|
|
||||||
{{ record.functionSw === 1 ? '有效' : '无效' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="column.key === 'visualResult'">
|
|
||||||
<a-tag :color="record.visualResult === 1 ? 'success' : 'error'">
|
|
||||||
{{ record.visualResult === 1 ? 'OK' : 'NG' }}
|
|
||||||
</a-tag>
|
|
||||||
</template> -->
|
|
||||||
<template v-else-if="column.key === 'action'">
|
<template v-else-if="column.key === 'action'">
|
||||||
<a-button type="link" size="small" @click="handleView(record as L1Data)">
|
<a-button type="link" size="small" @click="handleView(record as L1Data)">
|
||||||
查看详情
|
查看详情
|
||||||
@@ -91,34 +66,9 @@
|
|||||||
:key="key"
|
:key="key"
|
||||||
:label="columns.find((col) => col.key === key)?.title || key"
|
:label="columns.find((col) => col.key === key)?.title || key"
|
||||||
>
|
>
|
||||||
<template v-if="key === 'createTime'">
|
<template v-if="['createTime', 'updateTime', 'recordTime'].includes(key)">
|
||||||
{{ formatDateTime(value) }}
|
<span>{{ formatDateTime(value) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<!-- <template v-else-if="key === 'productStatus'">
|
|
||||||
<a-tag :color="selectedRecord.productStatus === 1 ? 'success' : 'default'">
|
|
||||||
{{ selectedRecord.productStatus === 1 ? '有' : '无' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="key === 'goodFlag'">
|
|
||||||
<a-tag :color="selectedRecord.goodFlag === 1 ? 'success' : 'error'">
|
|
||||||
{{ selectedRecord.goodFlag === 1 ? '良品' : '不良品' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="key === 'processMemory'">
|
|
||||||
<a-tag :color="selectedRecord.processMemory === 1 ? 'success' : 'default'">
|
|
||||||
{{ selectedRecord.processMemory === 1 ? '已加工' : '未开工' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="key === 'functionSw'">
|
|
||||||
<a-tag :color="selectedRecord.functionSw === 1 ? 'success' : 'default'">
|
|
||||||
{{ selectedRecord.functionSw === 1 ? '有效' : '无效' }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="key === 'visualResult'">
|
|
||||||
<a-tag :color="selectedRecord.visualResult === 1 ? 'success' : 'error'">
|
|
||||||
{{ selectedRecord.visualResult === 1 ? 'OK' : 'NG' }}
|
|
||||||
</a-tag>
|
|
||||||
</template> -->
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
{{ value }}
|
{{ value }}
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,58 +1,67 @@
|
|||||||
export interface L1Data {
|
export interface L1Data {
|
||||||
/** 加工信息ID */
|
/** 主键 */
|
||||||
processInfoId: number;
|
id: number;
|
||||||
|
|
||||||
/** 产品状态: 0-无, 1-有 */
|
/** 标志位 */
|
||||||
productStatus: 0 | 1;
|
flag: number;
|
||||||
|
|
||||||
/** 良品标记: 0-不良品, 1-良品 */
|
/** 加工标志 */
|
||||||
goodFlag: 0 | 1;
|
processFlag: number;
|
||||||
|
|
||||||
/** 加工记忆: 0-未开工, 1-已加工 */
|
/** 良品标志 */
|
||||||
processMemory: 0 | 1;
|
qualifiedFlag: number;
|
||||||
|
|
||||||
/** 功能SW: 0-无效, 1-有效 */
|
/** 二维码 */
|
||||||
functionSw: 0 | 1;
|
barcode: string;
|
||||||
|
|
||||||
/** 轴号 */
|
/** 压力1 */
|
||||||
axisNumber: number;
|
pressure1: number;
|
||||||
|
|
||||||
/** 上骨架时间: 年, 00~99 */
|
/** 高度1 */
|
||||||
loadSkeletonYear: number;
|
height1: number;
|
||||||
|
|
||||||
/** 上骨架时间: 月日, 0101~1231 */
|
/** 数値19#DCR */
|
||||||
loadSkeletonMonthDay: number;
|
value19Dcr: number;
|
||||||
|
|
||||||
/** 上骨架时间: 时分, 0000~2459 */
|
/** 数値39#LCR LS */
|
||||||
loadSkeletonHourMin: number;
|
value39LcrLs: number;
|
||||||
|
|
||||||
/** 上骨架时间: 秒, 00~59 */
|
/** 数値49#LCR Q */
|
||||||
loadSkeletonSecond: number;
|
value49LcrQ: number;
|
||||||
|
|
||||||
/** 插端子压力值 */
|
/** 数値79#IR R */
|
||||||
plugTerminalPressure: number;
|
value79IrR: number;
|
||||||
|
|
||||||
/** 插端子高度值 */
|
/** 数値89#IR I */
|
||||||
plugTerminalHeight: number;
|
value89IrI: number;
|
||||||
|
|
||||||
/** 电阻值 */
|
/** 骨架CCD检查结果 */
|
||||||
resistance: number;
|
skeletonCcdCheck: number;
|
||||||
|
|
||||||
/** 电感LS值 */
|
/** 组立CCD检查结果 */
|
||||||
inductorLs: number;
|
assemblyCcdCheck: number;
|
||||||
|
|
||||||
/** 电感Q值 */
|
/** 补充字段1 */
|
||||||
inductorQ: number;
|
reserve1: string;
|
||||||
|
|
||||||
/** 耐压R值 */
|
/** 补充字段2 */
|
||||||
pressureResistanceR: number;
|
reserve2: string;
|
||||||
|
|
||||||
/** 耐压I值 */
|
/** 记录数据的时间 */
|
||||||
pressureResistanceI: number;
|
recordTime: string;
|
||||||
|
|
||||||
/** 视觉结果: 0-NG, 1-OK */
|
/** 逻辑删除 */
|
||||||
visualResult: 0 | 1;
|
DelFlag: number;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
createTime: string; // ISO 8601 格式,如 "2025-09-23T12:34:56"
|
createTime: string;
|
||||||
}
|
|
||||||
|
/** 创建人 */
|
||||||
|
createBy: string;
|
||||||
|
|
||||||
|
/** 修改时间 */
|
||||||
|
updateTime: string;
|
||||||
|
|
||||||
|
/** 修改人 */
|
||||||
|
updateBy: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
<div class="table-section">
|
<div class="table-section">
|
||||||
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
||||||
@change="handleTableChange" row-key="alarmId" size="middle" :scroll="{ x: 1200 }">
|
@change="handleTableChange" row-key="alarmId" size="middle" :scroll="{ x: 'max-content'}">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
||||||
<template v-else-if="['alarmDatetime', 'updateTime', 'createTime'].includes(column.key as string)">
|
<template v-else-if="['alarmDatetime', 'updateTime', 'createTime'].includes(column.key as string)">
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
<div class="table-section">
|
<div class="table-section">
|
||||||
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
||||||
@change="handleTableChange" row-key="id" size="middle" :scroll="{ x: 1200 }">
|
@change="handleTableChange" row-key="id" size="middle" :scroll="{ x: 'max-content'}">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
||||||
<template v-else-if="column.key === 'createTime'">
|
<template v-else-if="column.key === 'createTime'">
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
<div class="table-section">
|
<div class="table-section">
|
||||||
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
||||||
@change="handleTableChange" row-key="id" size="middle" :scroll="{ x: 1200 }">
|
@change="handleTableChange" row-key="id" size="middle" :scroll="{ x: 'max-content'}">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
||||||
<template v-if="column.key === 'createTime'">
|
<template v-if="column.key === 'createTime'">
|
||||||
|
|||||||
Reference in New Issue
Block a user