新增质检看板

This commit is contained in:
杨学谦 2025-12-09 11:13:23 +08:00
parent 5293f68ae4
commit 2550458b0f
3 changed files with 416 additions and 0 deletions

View File

@ -0,0 +1,150 @@
<template>
<div>
<DataTable :columns="columns" :data="rows" />
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import DataTable from '../components/DataTable.vue';
//
const columns = [
{ key: 'vehicleId', title: '托盘号' },
{ key: 'matNo', title: '物料号' },
{ key: 'inspectStatus', title: '是否质检' },
{ key: 'inspectCode', title: '质检结果' },
];
const rows = ref([]);
let timer = null;
//
async function getContainerNos() {
try {
// 106
const response106 = await fetch('http://172.18.222.253:9980/api/upper/pub/getStandCode?standId=106');
const data106 = await response106.json();
const containerNo106 = data106.returnData || '';
// 108
const response108 = await fetch('http://172.18.222.253:9980/api/upper/pub/getStandCode?standId=108');
const data108 = await response108.json();
const containerNo108 = data108.returnData || '';
return [containerNo106, containerNo108].filter(no => no !== '');
} catch (error) {
console.error('获取托盘号失败:', error);
return [];
}
}
//
async function getQualityData(containerNos) {
const qualityData = [];
for (const containerNo of containerNos) {
try {
// EWM
const response = await fetch('http://your-ewm-api-endpoint/data', { // API
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('asrs:mom@123456') // Basic Auth
},
body: JSON.stringify({ containerNo })
});
if (response.ok) {
const data = await response.json();
//
if (data.grInfoList && Array.isArray(data.grInfoList)) {
data.grInfoList.forEach(item => {
qualityData.push({
vehicleId: data.containerNo,
matNo: item.matNo,
inspectStatus: item.inspectStatus ? '是' : '否',
inspectCode: item.inspectStatus ? (item.firstDemo ? '首样合格' : '质检合格') : '未质检'
});
});
}
}
} catch (error) {
console.error(`获取托盘${containerNo}的质检数据失败:`, error);
}
}
return qualityData;
}
async function load() {
try {
//
const containerNos = await getContainerNos();
if (containerNos.length > 0) {
//
const qualityData = await getQualityData(containerNos);
rows.value = qualityData;
} else {
rows.value = [];
}
} catch (error) {
console.error('加载质检数据失败:', error);
rows.value = [];
}
}
onMounted(() => {
load();
timer = setInterval(load, 5000);
});
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<style scoped>
.title-center {
text-align: center;
}
/* 增大表格整体字体 */
:deep(.table-wrapper) {
font-size: 40px;
}
:deep(thead th) {
font-size: 40px; /* 表头字体稍大 */
}
:deep(tbody td) {
font-size: 40px; /* 表格内容字体 */
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
}
/* 设置第一列料箱号宽度为30% */
:deep(th:nth-child(1)),
:deep(td:nth-child(1)) {
width: 40%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 20%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 15%;
}
/* 设置第四列(优先级)宽度 */
:deep(th:nth-child(4)),
:deep(td:nth-child(4)) {
width: 25%;
}
</style>

View File

@ -0,0 +1,133 @@
<template>
<div>
<DataTable :columns="columns" :data="rows" />
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import DataTable from '../components/DataTable.vue';
//
const columns = [
{ key: 'vehicleId', title: '托盘号' },
{ key: 'matNo', title: '物料号' },
{ key: 'inspectStatus', title: '是否质检' },
{ key: 'inspectCode', title: '质检结果' },
];
const rows = ref([]);
let timer = null;
//
async function getContainerNos() {
try {
// 114
const response114 = await fetch('http://172.18.222.253:9980/api/upper/pub/getStandCode?standId=114');
const data114 = await response114.json();
const containerNo114 = data114.returnData || '';
// 116
const response116 = await fetch('http://172.18.222.253:9980/api/upper/pub/getStandCode?standId=116');
const data116 = await response116.json();
const containerNo116 = data116.returnData || '';
return [containerNo114, containerNo116].filter(no => no !== '');
} catch (error) {
console.error('获取托盘号失败:', error);
return [];
}
}
//
async function getQualityData(containerNos) {
const qualityData = [];
for (const containerNo of containerNos) {
try {
//
qualityData.push({
vehicleId: containerNo,
matNo: 'MAT-' + Math.floor(Math.random() * 10000),
inspectStatus: Math.random() > 0.5 ? '是' : '否',
inspectCode: Math.random() > 0.5 ? '合格' : '不合格'
});
} catch (error) {
console.error(`处理托盘${containerNo}数据失败:`, error);
}
}
return qualityData;
}
async function load() {
try {
//
const containerNos = await getContainerNos();
if (containerNos.length > 0) {
//
const qualityData = await getQualityData(containerNos);
rows.value = qualityData;
} else {
rows.value = [];
}
} catch (error) {
console.error('加载质检数据失败:', error);
rows.value = [];
}
}
onMounted(() => {
load();
timer = setInterval(load, 5000);
});
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<style scoped>
.title-center {
text-align: center;
}
/* 增大表格整体字体 */
:deep(.table-wrapper) {
font-size: 40px;
}
:deep(thead th) {
font-size: 40px; /* 表头字体稍大 */
}
:deep(tbody td) {
font-size: 40px; /* 表格内容字体 */
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
}
/* 设置第一列料箱号宽度为30% */
:deep(th:nth-child(1)),
:deep(td:nth-child(1)) {
width: 40%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 20%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 15%;
}
/* 设置第四列(优先级)宽度 */
:deep(th:nth-child(4)),
:deep(td:nth-child(4)) {
width: 25%;
}
</style>

View File

@ -0,0 +1,133 @@
<template>
<div>
<DataTable :columns="columns" :data="rows" />
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import DataTable from '../components/DataTable.vue';
//
const columns = [
{ key: 'vehicleId', title: '托盘号' },
{ key: 'matNo', title: '物料号' },
{ key: 'inspectStatus', title: '是否质检' },
{ key: 'inspectCode', title: '质检结果' },
];
const rows = ref([]);
let timer = null;
//
async function getContainerNos() {
try {
// 114
const response114 = await fetch('http://172.18.222.253:9980/api/upper/pub/getStandCode?standId=122');
const data114 = await response114.json();
const containerNo114 = data114.returnData || '';
// 116
const response116 = await fetch('http://172.18.222.253:9980/api/upper/pub/getStandCode?standId=124');
const data116 = await response116.json();
const containerNo116 = data116.returnData || '';
return [containerNo114, containerNo116].filter(no => no !== '');
} catch (error) {
console.error('获取托盘号失败:', error);
return [];
}
}
//
async function getQualityData(containerNos) {
const qualityData = [];
for (const containerNo of containerNos) {
try {
//
qualityData.push({
vehicleId: containerNo,
matNo: 'MAT-' + Math.floor(Math.random() * 10000),
inspectStatus: Math.random() > 0.5 ? '是' : '否',
inspectCode: Math.random() > 0.5 ? '合格' : '不合格'
});
} catch (error) {
console.error(`处理托盘${containerNo}数据失败:`, error);
}
}
return qualityData;
}
async function load() {
try {
//
const containerNos = await getContainerNos();
if (containerNos.length > 0) {
//
const qualityData = await getQualityData(containerNos);
rows.value = qualityData;
} else {
rows.value = [];
}
} catch (error) {
console.error('加载质检数据失败:', error);
rows.value = [];
}
}
onMounted(() => {
load();
timer = setInterval(load, 5000);
});
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<style scoped>
.title-center {
text-align: center;
}
/* 增大表格整体字体 */
:deep(.table-wrapper) {
font-size: 40px;
}
:deep(thead th) {
font-size: 40px; /* 表头字体稍大 */
}
:deep(tbody td) {
font-size: 40px; /* 表格内容字体 */
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
}
/* 设置第一列料箱号宽度为30% */
:deep(th:nth-child(1)),
:deep(td:nth-child(1)) {
width: 40%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 20%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 15%;
}
/* 设置第四列(优先级)宽度 */
:deep(th:nth-child(4)),
:deep(td:nth-child(4)) {
width: 25%;
}
</style>