增加出站功能

This commit is contained in:
tao
2025-12-30 15:51:25 +08:00
parent 7b36211f04
commit f724b40e24
4 changed files with 67 additions and 41 deletions

View File

@@ -1,9 +1,13 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue';
import { ref, onMounted, computed, getCurrentInstance } from 'vue';
import { message } from 'ant-design-vue';
import { useJobStore } from '@/store';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { delay } from '@/utils/mock';
import { listMainMaterialEntryLog } from '@/api/pwoManage/primaryMaterial'
import { listMainMaterialOutboundLog } from '@/api/pwoManage/primaryMaterial';
const { proxy } = getCurrentInstance() as any
const { main_material_ok_level, main_material_ng_level } = proxy.useDict("main_material_ok_level", "main_material_ng_level")
const jobStore = useJobStore();
@@ -20,11 +24,12 @@ const primaryMaterialColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: 'Wafer ID', dataIndex: 'waferCode', key: 'waferCode', align: 'center' },
{ title: 'Die ID', dataIndex: 'dieCode', key: 'dieCode', align: 'center' },
{ title: '结果', dataIndex: 'result', key: 'result', filters: [{ text: 'OK', value: 'OK', }, { text: 'NG', value: 'NG', }], onFilter: (value: string, record: any) => record.result.indexOf(value) === 0, align: 'center' },
{ title: '质量等级', dataIndex: 'qualityLevel', key: 'qualityLevel', filters: [{ text: 'A', value: 'A', }, { text: 'B', value: 'B', }], onFilter: (value: string, record: any) => record.qualityLevel.indexOf(value) === 0, align: 'center' },
{ title: '结果', dataIndex: 'result', key: 'result', align: 'center' },
{ title: '质量等级', dataIndex: 'qualityLevel', key: 'qualityLevel' },
{ title: '操作', key: 'action', align: 'center', width: 120 },
];
// 总计数据
const totals = computed(() => {
let okNum = 0;
let ngNum = 0;
@@ -43,15 +48,11 @@ const primaryMaterialTableData = ref<PrimaryMaterialTableItem[]>([]);
const loadingPrimaryMaterialList = ref(false);
const fetchPrimaryMaterialList = async () => {
// const stationId = jobStore.jobInfo.id;
// if (!stationId) return;
const stationId = jobStore.jobInfo.id;
if (!stationId) return;
loadingPrimaryMaterialList.value = true;
try {
const rows = await delay(1000, [
{ key: '1', waferCode: 'WF-20250401-0001', dieCode: 'DIE-20250401-0001', result: 'OK', qualityLevel: 'A' },
{ key: '2', waferCode: 'WF-20250401-0001', dieCode: 'DIE-20250401-0001', result: 'NG', qualityLevel: 'A' },
{ key: '3', waferCode: 'WF-20250401-0001', dieCode: 'DIE-20250401-0001', result: 'OK', qualityLevel: 'B' }
]);
const { rows } = await listMainMaterialEntryLog({ stationId });
primaryMaterialTableData.value = rows;
} catch (error: any) {
message.error(error.message || '查询治具列表失败');
@@ -83,7 +84,7 @@ fetchPrimaryMaterialList()
<template>
<div class="equipment__container">
<div class="main-title">主材报工</div>
<Title name="主材报工" showRefresh @refresh="fetchPrimaryMaterialList" />
<div class="table-wrapper" ref="customTable">
<a-table :dataSource="primaryMaterialTableData" :columns="primaryMaterialColumns as ColumnsType<PrimaryMaterialTableItem>"
:pagination="false" bordered sticky size="middle" :scroll="{ y: tableHeight }"
@@ -91,12 +92,14 @@ fetchPrimaryMaterialList()
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'result'">
<a-switch v-model:checked="record.result" checked-children="OK" checkedValue="OK" un-checked-children="NG" unCheckedValue="NG" />
<a-switch v-model:checked="record.result" checked-children="NG" checkedValue="NG" un-checked-children="OK" unCheckedValue="OK" />
</template>
<template v-if="column.key === 'qualityLevel'">
<a-select v-model:value="record.qualityLevel" style="width: 80%">
<a-select-option value="A">A</a-select-option>
<a-select-option value="B">B</a-select-option>
<a-select v-model:value="record.qualityLevel" style="width: 80%" v-if="record.result === 'OK'">
<a-select-option v-for="dict in main_material_ok_level" :value="dict.value">{{ dict.label }}</a-select-option>
</a-select>
<a-select v-model:value="record.qualityLevel" style="width: 80%" v-else>
<a-select-option v-for="dict in main_material_ng_level" :value="dict.value">{{ dict.label }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'action'">
@@ -145,29 +148,21 @@ fetchPrimaryMaterialList()
}
}
.main-title {
font-size: 20px;
font-weight: 600;
border-bottom: 1px solid #c9c9c9;
padding: 0 0 8px;
}
.table-wrapper {
height: 100%;
overflow: auto;
}
::v-deep(.ant-switch) {
background-color: #ff0000;
background-color: #04d903;
&:hover {
background-color: #ff2525;
background-color: #02eb02;
}
&.ant-switch-checked {
background-color: #04d903;
background-color: #ff0000;
&:hover {
background-color: #02eb02;
background-color: #ff2525;
}
}
}