完善治具进站
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted, reactive } from 'vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
|
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
|
||||||
import { listMaskCombination, listCombinationAssignMask } from "@/api/pwoManage/maskCombination";
|
import { listMaskCombination } from "@/api/pwoManage/maskCombination";
|
||||||
|
import { listStationBindMask, bindMaskCombinationToStations, unbindStationMask } from "@/api/pwoManage/mask";
|
||||||
|
import { usePwoStore } from '@/store';
|
||||||
|
|
||||||
|
const pwoStore = usePwoStore();
|
||||||
|
|
||||||
interface MaskTableItem {
|
interface MaskTableItem {
|
||||||
key: string;
|
key: string;
|
||||||
@@ -27,6 +31,7 @@ const maskColumns = [
|
|||||||
{ title: '工序名称', dataIndex: 'operationTitle', key: 'operationTitle', align: 'center' },
|
{ title: '工序名称', dataIndex: 'operationTitle', key: 'operationTitle', align: 'center' },
|
||||||
{ title: '治具编码', dataIndex: 'maskCode', key: 'maskCode', align: 'center' },
|
{ title: '治具编码', dataIndex: 'maskCode', key: 'maskCode', align: 'center' },
|
||||||
{ title: '治具名称', dataIndex: 'maskName', key: 'maskName', align: 'center' },
|
{ title: '治具名称', dataIndex: 'maskName', key: 'maskName', align: 'center' },
|
||||||
|
{ title: '操作', dataIndex: 'action', key: 'action', align: 'center' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 治具表格
|
// 治具表格
|
||||||
@@ -53,28 +58,56 @@ const fetchCombinationList = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingCombination = ref(new Set())
|
|
||||||
const handleBind = async (id: number) => {
|
const handleBind = async (id: number) => {
|
||||||
const { rows } = await listCombinationAssignMask(id, {
|
try {
|
||||||
maskStatus: "AVAILABLE",
|
await bindMaskCombinationToStations({
|
||||||
orderByColumn: 'id',
|
lotTraceOrderId: pwoStore.pwoInfo.id,
|
||||||
orderBy: 'desc',
|
maskCombinationId: id
|
||||||
})
|
});
|
||||||
|
message.success('绑定成功');
|
||||||
|
fetchBoundMaskList();
|
||||||
|
openMaskModal.value = false;
|
||||||
|
} catch (error: any) {
|
||||||
|
message.error(`绑定失败: ${ error.message }`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const newCombination = rows.filter(item => !existingCombination.value.has(item.id))
|
const handleUnbind = async (id: number) => {
|
||||||
newCombination.forEach(item => {
|
try {
|
||||||
maskTableData.value.push({
|
await unbindStationMask(id);
|
||||||
key: item.id,
|
message.success('解绑成功');
|
||||||
operationCode: item.operationCode,
|
fetchBoundMaskList();
|
||||||
operationTitle: item.operationTitle,
|
openMaskModal.value = false;
|
||||||
maskCode: item.maskCode,
|
} catch (error: any) {
|
||||||
maskName: item.maskName
|
message.error(`解绑失败: ${ error.message }`);
|
||||||
})
|
}
|
||||||
existingCombination.value.add(item.id)
|
}
|
||||||
})
|
|
||||||
|
|
||||||
message.success('绑定成功')
|
// 获取已绑定的治具列表
|
||||||
openMaskModal.value = false
|
const loadingMask = ref(false);
|
||||||
|
const fetchBoundMaskList = async () => {
|
||||||
|
const traceOrderId = pwoStore.pwoInfo.id;
|
||||||
|
if (!traceOrderId) return;
|
||||||
|
loadingMask.value = true;
|
||||||
|
try {
|
||||||
|
const { rows, total } = await listStationBindMask({ traceOrderId })
|
||||||
|
if (total as number <= 0) return;
|
||||||
|
maskTableData.value = rows;
|
||||||
|
} catch (error: any) {
|
||||||
|
message.error(error.message || '查询治具列表失败');
|
||||||
|
} finally {
|
||||||
|
loadingMask.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const inspectingMask = reactive({
|
||||||
|
maskCode: '',
|
||||||
|
maskName: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const rowClick = (record: MaskTableItem) => {
|
||||||
|
inspectingMask.maskCode = record.maskCode;
|
||||||
|
inspectingMask.maskName = record.maskName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算表格高度
|
// 计算表格高度
|
||||||
@@ -96,6 +129,7 @@ defineExpose({
|
|||||||
});
|
});
|
||||||
|
|
||||||
fetchCombinationList()
|
fetchCombinationList()
|
||||||
|
fetchBoundMaskList()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -103,12 +137,18 @@ fetchCombinationList()
|
|||||||
<a-row class="main-content" :gutter="24">
|
<a-row class="main-content" :gutter="24">
|
||||||
<a-col :span="14" class="mask-item__container">
|
<a-col :span="14" class="mask-item__container">
|
||||||
<div class="main-title">治具组合信息</div>
|
<div class="main-title">治具组合信息</div>
|
||||||
|
<a-space>
|
||||||
<a-button size="large" @click="() => openMaskModal = true">绑定治具组合</a-button>
|
<a-button size="large" @click="() => openMaskModal = true">绑定治具组合</a-button>
|
||||||
|
<a-button size="large" @click="fetchBoundMaskList">刷新</a-button>
|
||||||
|
</a-space>
|
||||||
<div class="table-wrapper" ref="customTable">
|
<div class="table-wrapper" ref="customTable">
|
||||||
<a-table :dataSource="maskTableData" :columns="maskColumns as ColumnsType<MaskTableItem>"
|
<a-table :dataSource="maskTableData" :columns="maskColumns as ColumnsType<MaskTableItem>"
|
||||||
:pagination="false" bordered sticky size="middle" :scroll="{ y: tableHeight }">
|
:pagination="false" bordered sticky size="middle" :scroll="{ y: tableHeight }" :loading="loadingMask">
|
||||||
<template #bodyCell="{ column, index }">
|
<template #bodyCell="{ column, index, record }">
|
||||||
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-button @click="handleUnbind(record.id)">解绑</a-button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</div>
|
</div>
|
||||||
@@ -125,18 +165,18 @@ fetchCombinationList()
|
|||||||
</a-row>
|
</a-row>
|
||||||
<div class="table-wrapper">
|
<div class="table-wrapper">
|
||||||
<a-descriptions bordered :column="1">
|
<a-descriptions bordered :column="1">
|
||||||
<a-descriptions-item label="治具编码">Cloud Database</a-descriptions-item>
|
<a-descriptions-item label="治具编码"></a-descriptions-item>
|
||||||
<a-descriptions-item label="治具名称">Prepaid</a-descriptions-item>
|
<a-descriptions-item label="治具名称"></a-descriptions-item>
|
||||||
<a-descriptions-item label="治具组合">YES</a-descriptions-item>
|
<a-descriptions-item label="治具组合"></a-descriptions-item>
|
||||||
<a-descriptions-item label="标准使用次数">YES</a-descriptions-item>
|
<a-descriptions-item label="标准使用次数"></a-descriptions-item>
|
||||||
<a-descriptions-item label="当前使用次数">YES</a-descriptions-item>
|
<a-descriptions-item label="当前使用次数"></a-descriptions-item>
|
||||||
<a-descriptions-item label="关联工序">YES</a-descriptions-item>
|
<a-descriptions-item label="关联工序"></a-descriptions-item>
|
||||||
</a-descriptions>
|
</a-descriptions>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-modal v-model:open="openMaskModal" title="绑定治具组合" width="50vw" :bodyStyle="{ padding: '20px 0' }">
|
<a-modal v-model:open="openMaskModal" title="绑定治具组合" width="50vw" :bodyStyle="{ padding: '20px 0' }" :footer="null">
|
||||||
<a-table :dataSource="maskCombinationTableData" :columns="maskCombinationColumns as ColumnsType<MaskCombinationItem>"
|
<a-table :dataSource="maskCombinationTableData" :columns="maskCombinationColumns as ColumnsType<MaskCombinationItem>"
|
||||||
:pagination="false" bordered sticky :scroll="{ y: tableHeight }">
|
:pagination="false" bordered sticky :scroll="{ y: tableHeight }">
|
||||||
<template #bodyCell="{ column, index, record }">
|
<template #bodyCell="{ column, index, record }">
|
||||||
|
|||||||
Reference in New Issue
Block a user