@@ -81,7 +75,7 @@
| {{ row.projectCode }} |
{{ row.productionCode }} |
{{ row.productionName }} |
- {{ row.specification }} |
+ {{ row.specification }} |
{{ row.productionSn }} |
{{ row.partSn }} |
@@ -99,25 +93,14 @@
-
+
@@ -125,11 +108,11 @@
追溯码
- {{ currentTraceData.traceCode }}
+ {{ currentTraceData.partSn }}
总成码
- {{ currentTraceData.assemblyCode }}
+ {{ currentTraceData.productionSn }}
@@ -139,7 +122,8 @@
状态
- {{ currentTraceData.status }}
+ {{ currentTraceData.status
+ }}
@@ -149,7 +133,8 @@
-
+
@@ -157,7 +142,7 @@
| 子零件名称 |
规格 |
子零件编码 |
- 返工状态 |
+ 记录类型 |
创建时间 |
@@ -179,30 +164,110 @@
暂无子零件记录
-
+
-
+
+
+
+
+ | 记录类型 |
+ 测试结果 |
+ 正向最大扭矩 |
+ 负向最大扭矩 |
+ 扭矩最大值上限 |
+ 扭矩最大值下限 |
+ 扭矩最小值上限 |
+ 扭矩最小值下限 |
+
+
+
+
+ |
+
+ {{ record.isBack === 0 ? '正常' : '返工' }}
+
+ |
+
+
+ {{ record.value01 === "0" ? 'OK' : 'NG' }}
+
+ |
+ {{ record.value02 || '-' }} |
+ {{ record.value03 || '-' }} |
+ {{ record.value04 || '-' }} |
+ {{ record.value05 || '-' }} |
+ {{ record.value06 || '-' }} |
+ {{ record.value07 || '-' }} |
+
+
+
+
+ 暂无折叠检验记录
+
+
+
+
+
+
+
- 暂无折叠检验记录
-
-
-
-
-
-
-
-
- | 返工状态 |
- value01 |
- value02 |
- value03 |
- value04 |
- value05 |
- value06 |
- value07 |
- value08 |
- value09 |
- value10 |
-
-
-
-
- | {{ record.isBack === '0'?'正常':'返工' }} |
- {{ record.value01 || '-' }} |
- {{ record.value02 || '-' }} |
- {{ record.value03 || '-' }} |
- {{ record.value04 || '-' }} |
- {{ record.value05 || '-' }} |
- {{ record.value06 || '-' }} |
- {{ record.value07 || '-' }} |
- {{ record.value08 || '-' }} |
- {{ record.value09 || '-' }} |
- {{ record.value10 || '-' }} |
-
-
-
-
- 暂无终检台检验记录
-
-
+
+ 暂无终检台检验记录
+
+
+
+
+
+
+
+
+ | 记录类型 |
+ 结果 |
+ 扭矩 |
+ 角度 |
+
+
+
+
+ |
+
+ {{ record.isBack === 0 ? '正常' : '返工' }}
+
+ |
+
+
+ {{ record.value01 === "0" ? 'OK' : 'NG' }}
+
+ |
+ {{ record.value02 || '-' }} |
+ {{ record.value03 || '-' }} |
+
+
+
+
+ 暂无打螺丝检验记录
+
+
@@ -293,7 +382,7 @@ interface SubPartScanRecord {
// 定义质量检验记录接口
interface QualityInspectionRecord {
qcType: string;
- isBack: string;
+ isBack: number;
value01?: string;
value02?: string;
value03?: string;
@@ -334,19 +423,17 @@ interface QualityInspectionRecord {
value38?: string;
value39?: string;
value40?: string;
- [key: string]: string | undefined;
+ [key: string]: string | number | undefined;
}
// 定义追溯数据接口
interface TraceData {
- traceCode: string;
- assemblyCode: string;
+ partSn: string;
+ productionSn: string;
projectCode: string;
subPartScanCode: string;
productCode: string;
productionCode: string;
- productionSn: string;
- partSn: string;
productName: string;
productionName: string;
specification: string;
@@ -368,8 +455,8 @@ interface TraceData {
// 搜索表单数据
const searchForm = reactive({
- traceCode: '',
- assemblyCode: '',
+ partSn: '',
+ productionSn: '',
projectCode: '',
subPartScanCode: '',
dateRange: null as [string, string] | null
@@ -396,7 +483,7 @@ const getQualityRecordsByType = (type: string) => {
if (!currentTraceData.value?.qualityInspectionRecords) {
return [];
}
- return currentTraceData.value.qualityInspectionRecords.filter(record =>
+ return currentTraceData.value.qualityInspectionRecords.filter(record =>
record.qcType === type
);
};
@@ -408,6 +495,24 @@ onMounted(() => {
loadTraceData();
});
+// 通用的数据映射函数
+function mapTraceDataItem(item) {
+ return {
+ id: item.id,
+ projectCode: item.projectCode,
+ productionSn: item.productionSn || '',
+ partSn: item.partSn || '',
+ productName: item.productName || item.specification || '未命名产品',
+ productionName: item.productionName || '未命名产品',
+ specification: item.specification || '',
+ productCode: item.productCode || '',
+ productionCode: item.productionCode || '',
+ createTime: item.createTime || '',
+ result: '合格', // 结果字段,默认显示合格
+ status: '合格' // 状态字段,用于样式判断
+ };
+}
+
// 加载追溯数据
async function loadTraceData() {
loading.value = true;
@@ -415,8 +520,8 @@ async function loadTraceData() {
const params = {
pageNum: pagination.currentPage,
pageSize: pagination.pageSize,
- ...(searchForm.traceCode && { traceCode: searchForm.traceCode }),
- ...(searchForm.assemblyCode && { assemblyCode: searchForm.assemblyCode }),
+ ...(searchForm.partSn && { partSn: searchForm.partSn }),
+ ...(searchForm.productionSn && { productionSn: searchForm.productionSn }),
...(searchForm.projectCode && { projectCode: searchForm.projectCode }),
...(searchForm.subPartScanCode && { subPartScanCode: searchForm.subPartScanCode }),
...(searchForm.dateRange && searchForm.dateRange.length === 2 && {
@@ -424,45 +529,11 @@ async function loadTraceData() {
endTime: dayjs(searchForm.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
})
};
-
+
const response = await getPartSnList(params);
if (response.code === 200) {
- // 映射API返回字段到我们的TraceData结构
const resultData = response.data?.result || [];
- traceDataList.value = resultData.map(item => ({
- // 直接映射的字段
- id: item.id,
- projectCode: item.projectCode,
- // 映射并重命名的字段
- assemblyCode: item.productionCode || '',
- traceCode: item.partSn || '',
- productionTime: item.createTime || '',
- productName: item.productName || '未命名产品',
- productionName: item.productionName || '未命名产品',
- specification: item.specification || '',
- // 表格中使用的新字段
- productCode: item.productCode || '',
- productionCode: item.productionCode || '',
- productionSn: item.productionSn || '',
- partSn: item.partSn || '',
- createTime: item.createTime || '',
- result: '合格', // 结果字段,默认显示合格
- // 设置默认值的字段
- subPartScanCode: '',
- batchNumber: '',
- productionLine: '',
- operator: '',
- operatorId: '',
- inspectionTime: '',
- status: '合格', // 状态字段,默认显示合格
- inspector: '',
- remark: '',
- processSteps: [],
- subPartScanRecords: [],
- qualityInspectionRecords: []
- }));
-
- // 更新分页信息
+ traceDataList.value = resultData.map(mapTraceDataItem);
pagination.total = response.data?.totalNum || 0;
} else {
ElMessage.error(response.msg || '获取数据失败');
@@ -486,8 +557,8 @@ async function handleSearch() {
const params = {
pageNum: 1,
pageSize: pagination.pageSize,
- ...(searchForm.traceCode && { traceCode: searchForm.traceCode }),
- ...(searchForm.assemblyCode && { assemblyCode: searchForm.assemblyCode }),
+ ...(searchForm.partSn && { partSn: searchForm.partSn }),
+ ...(searchForm.productionSn && { productionSn: searchForm.productionSn }),
...(searchForm.projectCode && { projectCode: searchForm.projectCode }),
...(searchForm.subPartScanCode && { subPartScanCode: searchForm.subPartScanCode }),
...(searchForm.dateRange && searchForm.dateRange.length === 2 && {
@@ -495,48 +566,14 @@ async function handleSearch() {
endTime: dayjs(searchForm.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
})
};
-
+
const response = await getPartSnList(params);
if (response.code === 200) {
- // 映射API返回字段到我们的TraceData结构
const resultData = response.data?.result || [];
- traceDataList.value = resultData.map(item => ({
- // 直接映射的字段
- id: item.id,
- projectCode: item.projectCode,
- // 映射并重命名的字段
- assemblyCode: item.productionCode || '',
- traceCode: item.partSn || '',
- productionTime: item.createTime || '',
- productName: item.specification || '未命名产品',
- productionName: item.productionName || '未命名产品',
- specification: item.specification || '',
- // 表格中使用的新字段
- productCode: item.productCode || '',
- productionCode: item.productionCode || '',
- productionSn: item.productionSn || '',
- partSn: item.partSn || '',
- createTime: item.createTime || '',
- result: '合格', // 结果字段,默认显示合格
- // 设置默认值的字段
- subPartScanCode: '',
- batchNumber: '',
- productionLine: '',
- operator: '',
- operatorId: '',
- inspectionTime: '',
- status: '合格', // 状态字段,默认显示合格
- inspector: '',
- remark: '',
- processSteps: [],
- subPartScanRecords: [],
- qualityInspectionRecords: []
- }));
-
- // 更新分页信息
+ traceDataList.value = resultData.map(mapTraceDataItem);
pagination.total = response.data?.totalNum || 0;
pagination.currentPage = 1; // 重置到第一页
-
+
if (traceDataList.value.length === 0) {
ElMessage.info('未找到匹配的数据');
}
@@ -557,15 +594,15 @@ async function handleSearch() {
// 处理重置
function handleReset() {
- searchForm.traceCode = '';
- searchForm.assemblyCode = '';
+ searchForm.partSn = '';
+ searchForm.productionSn = '';
searchForm.projectCode = '';
searchForm.subPartScanCode = '';
searchForm.dateRange = null;
-
+
// 重置分页
pagination.currentPage = 1;
-
+
// 重新加载所有数据
loadTraceData();
}
@@ -591,42 +628,55 @@ async function handleViewDetail(row) {
subPartScanRecords: [], // 初始化空数组
qualityInspectionRecords: [] // 初始化空数组
};
-
+
try {
// 获取子零件扫码数据(如果需要)
const subPartResponse = await getSnSubScanList({ partSn: row.partSn });
- if (subPartResponse && Array.isArray(subPartResponse.data)) {
- mergedData.subPartScanRecords = subPartResponse.data;
+ if (subPartResponse?.code === 200 && Array.isArray(subPartResponse.data?.result)) {
+ mergedData.subPartScanRecords = subPartResponse.data.result || [];
}
} catch (error) {
console.warn('获取子零件数据失败:', error);
}
-
+
try {
// 获取折叠检验数据
const foldResponse = await getSnQcRecordList({ partSn: row.partSn, qcType: 'zd' });
- if (foldResponse?.code === 200 && Array.isArray(foldResponse.data)) {
- mergedData.qualityInspectionRecords = mergedData.qualityInspectionRecords.concat(
- foldResponse.data.map(item => ({ ...item, qcType: '折叠' }))
- );
+ if (foldResponse?.code === 200 && Array.isArray(foldResponse.data?.result)) {
+ // 为折叠检验数据添加qcType标识
+ const foldRecords = foldResponse.data.result.map(item => ({ ...item, qcType: 'zd' }));
+ mergedData.qualityInspectionRecords = [...mergedData.qualityInspectionRecords, ...foldRecords];
}
} catch (error) {
console.warn('获取折叠检验数据失败:', error);
}
-
+
try {
// 获取终检数据
const finalResponse = await getSnQcRecordList({ partSn: row.partSn, qcType: 'eol' });
- if (finalResponse?.code === 200 && Array.isArray(finalResponse.data)) {
- mergedData.qualityInspectionRecords = mergedData.qualityInspectionRecords.concat(
- finalResponse.data.map(item => ({ ...item, qcType: 'eol' }))
- );
+ if (finalResponse?.code === 200 && Array.isArray(finalResponse.data?.result)) {
+ // 为终检数据添加qcType标识
+ const finalRecords = finalResponse.data.result.map(item => ({ ...item, qcType: 'eol' }));
+ mergedData.qualityInspectionRecords = [...mergedData.qualityInspectionRecords, ...finalRecords];
}
} catch (error) {
console.warn('获取终检数据失败:', error);
}
-
+
+ try {
+ // 获取打螺丝数据
+ const dlsResponse = await getSnQcRecordList({ partSn: row.partSn, qcType: 'dls' });
+ if (dlsResponse?.code === 200 && Array.isArray(dlsResponse.data?.result)) {
+ // 为打螺丝数据添加qcType标识
+ const dlsRecords = dlsResponse.data.result.map(item => ({ ...item, qcType: 'dls' }));
+ mergedData.qualityInspectionRecords = [...mergedData.qualityInspectionRecords, ...dlsRecords];
+ }
+ } catch (error) {
+ console.warn('获取打螺丝数据失败:', error);
+ }
+
currentTraceData.value = mergedData;
+ console.log('mergedData', mergedData);
detailDialogVisible.value = true;
}
@@ -651,6 +701,7 @@ function handleRowClick(row, event) {
.trace-header {
margin-bottom: 20px;
+
h1 {
color: #ffffff;
font-size: 24px;
@@ -664,6 +715,7 @@ function handleRowClick(row, event) {
border-radius: 8px;
margin-bottom: 20px;
border: 1px solid #ffffff;
+
.form-actions {
display: flex;
justify-content: flex-end;
@@ -684,7 +736,8 @@ function handleRowClick(row, event) {
width: 100%;
border-collapse: collapse;
background-color: #2c3e50;
- table-layout: auto; /* 使用自动布局让内容决定列宽 */
+ table-layout: auto;
+ /* 使用自动布局让内容决定列宽 */
}
.native-table thead {
@@ -700,8 +753,10 @@ function handleRowClick(row, event) {
color: #ffffff !important;
font-weight: 500;
line-height: 1.5;
- white-space: normal; /* 允许内容换行 */
- word-break: break-word; /* 长单词换行 */
+ white-space: normal;
+ /* 允许内容换行 */
+ word-break: break-word;
+ /* 长单词换行 */
}
.native-table th {
@@ -739,7 +794,9 @@ function handleRowClick(row, event) {
}
@keyframes spin {
- to { transform: rotate(360deg); }
+ to {
+ transform: rotate(360deg);
+ }
}
/* 状态标签 */
@@ -834,6 +891,7 @@ function handleRowClick(row, event) {
/* 工序步骤时间线 */
.process-steps {
margin-top: 20px;
+
h3 {
margin-bottom: 15px;
color: #ffffff;
@@ -906,15 +964,17 @@ function handleRowClick(row, event) {
/* 详情页标签页样式 - 修复边框对齐问题 */
:deep(.el-tabs) {
.el-tabs__header {
- margin-bottom: 0; /* 移除底部边距 */
+ margin-bottom: 0;
+ /* 移除底部边距 */
border-bottom: 1px solid #4a90e2;
}
-
+
.el-tabs__nav {
height: 48px;
- margin-bottom: -1px; /* 负margin解决边框重叠问题 */
+ margin-bottom: -1px;
+ /* 负margin解决边框重叠问题 */
}
-
+
.el-tabs__item {
color: #90a4ae;
font-size: 16px;
@@ -928,23 +988,24 @@ function handleRowClick(row, event) {
border-bottom: none;
transition: all 0.3s ease;
}
-
+
.el-tabs__item:hover {
color: #4a90e2;
background-color: rgba(74, 144, 226, 0.1);
}
-
+
.el-tabs__item.is-active {
color: #ffffff;
background-color: #2c3e50;
border-color: #4a90e2;
font-weight: 600;
}
-
+
.el-tabs__active-bar {
- display: none; /* 隐藏默认下划线 */
+ display: none;
+ /* 隐藏默认下划线 */
}
-
+
.el-tabs__content {
padding: 20px;
border: 1px solid #4a90e2;
@@ -977,7 +1038,8 @@ function handleRowClick(row, event) {
:deep(.el-dialog__body) {
background-color: #2c3e50;
color: #ffffff;
- padding: 0; /* 移除body内边距,避免与内容区域重复 */
+ padding: 0;
+ /* 移除body内边距,避免与内容区域重复 */
}
:deep(.el-dialog__footer) {
@@ -1293,6 +1355,79 @@ h3 {
overflow-x: auto;
}
+/* 横向滚动容器样式 */
+.scrollable-table-wrapper {
+ width: 100%;
+ overflow-x: auto;
+ margin-bottom: 16px;
+ /* 添加滚动条样式 */
+ scrollbar-width: thin;
+ scrollbar-color: #4a90e2 #1e293b;
+}
+
+/* 自定义滚动条 - Webkit浏览器 */
+.scrollable-table-wrapper::-webkit-scrollbar {
+ height: 8px;
+}
+
+.scrollable-table-wrapper::-webkit-scrollbar-track {
+ background: #1e293b;
+ border-radius: 4px;
+}
+
+.scrollable-table-wrapper::-webkit-scrollbar-thumb {
+ background: #4a90e2;
+ border-radius: 4px;
+}
+
+.scrollable-table-wrapper::-webkit-scrollbar-thumb:hover {
+ background: #5ba2f2;
+}
+
+/* 质量表格样式 */
+.quality-table {
+ width: 100%;
+ border-collapse: collapse;
+ background-color: #2c3e50;
+ table-layout: auto;
+}
+
+.quality-table thead {
+ background-color: #34495e;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.quality-table th,
+.quality-table td {
+ padding: 12px 10px;
+ text-align: left;
+ vertical-align: middle;
+ border: 1px solid #ffffff;
+ color: #ffffff !important;
+ font-weight: 500;
+ line-height: 1.5;
+ white-space: nowrap;
+ /* 保持内容不换行以便横向滚动 */
+ min-width: 100px;
+}
+
+.quality-table th {
+ font-weight: 600;
+ color: #ffffff;
+ background-color: #34495e;
+}
+
+.quality-table tbody tr {
+ height: 48px;
+}
+
+.quality-table tbody tr:hover {
+ background-color: #34495e !important;
+ cursor: pointer;
+}
+
.no-data {
text-align: center;
padding: 40px 20px;
|