2025-12-29 10:29:01 +08:00
|
|
|
<script setup lang="ts">
|
2025-12-30 15:51:25 +08:00
|
|
|
import { ref, computed, reactive } from 'vue';
|
2025-12-29 10:29:01 +08:00
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
|
|
import { message } from 'ant-design-vue';
|
2026-01-12 17:28:57 +08:00
|
|
|
import { listStorageLocation } from '@/api/traceOrderManage/location';
|
2026-01-14 09:21:15 +08:00
|
|
|
import { completeStation, isLastStation as getIsLastStation } from '@/api/traceOrderManage/station';
|
2026-01-12 17:17:58 +08:00
|
|
|
import { useTraceOrderStore } from '@/store';
|
2025-12-29 10:29:01 +08:00
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
2026-01-12 17:17:58 +08:00
|
|
|
const traceOrderStore = useTraceOrderStore();
|
2025-12-30 15:51:25 +08:00
|
|
|
|
2025-12-29 10:29:01 +08:00
|
|
|
const menuItems = [
|
|
|
|
|
{ label: '主材报工', key: 'JobReport', progress: 30 },
|
|
|
|
|
{ label: '工序参数', key: 'ParameterConfiguration', progress: 80 },
|
|
|
|
|
{ label: '流转指引', key: 'ProcessGuidance', progress: 80 },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const activeKey = computed(() => route.name as string);
|
|
|
|
|
|
|
|
|
|
const handleMenuClick = (name: string) => {
|
|
|
|
|
router.push({ name });
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-30 15:51:25 +08:00
|
|
|
const locationOptions = ref<any>([]);
|
|
|
|
|
const fetchLocationList = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const { rows } = await listStorageLocation({});
|
|
|
|
|
locationOptions.value = rows;
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
message.error(error.message || '获取库位列表失败');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const openSelectLocation = ref(false);
|
2026-01-14 09:21:15 +08:00
|
|
|
const handleOutfeed = async () => {
|
|
|
|
|
// 判断是否为末站点
|
|
|
|
|
const { data: isLastStation } = await getIsLastStation(traceOrderStore.currentStationId);
|
|
|
|
|
if (isLastStation || outfeedChildRef.value?.totals.ngNum) {
|
|
|
|
|
fetchLocationList();
|
|
|
|
|
openSelectLocation.value = true;
|
|
|
|
|
} else {
|
|
|
|
|
submitOutfeed();
|
|
|
|
|
}
|
2025-12-30 15:51:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const storage = reactive({});
|
|
|
|
|
const handleChangeLocation = (value: any, option: any) => {
|
|
|
|
|
Object.assign(storage, option);
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-14 09:21:15 +08:00
|
|
|
const closeOutfeed = () => {
|
|
|
|
|
openSelectLocation.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-29 10:29:01 +08:00
|
|
|
// 确认出站
|
|
|
|
|
const outfeeding = ref(false);
|
2026-01-14 09:21:15 +08:00
|
|
|
const submitOutfeed = async () => {
|
2025-12-29 10:29:01 +08:00
|
|
|
outfeeding.value = true;
|
|
|
|
|
try {
|
2026-01-12 17:17:58 +08:00
|
|
|
await completeStation(traceOrderStore.currentStationId, storage);
|
2025-12-30 15:51:25 +08:00
|
|
|
openSelectLocation.value = false;
|
|
|
|
|
message.success('出站成功');
|
2026-01-12 17:29:19 +08:00
|
|
|
traceOrderStore.fetchStationInfo();
|
|
|
|
|
traceOrderStore.fetchStationList();
|
2026-01-12 17:28:57 +08:00
|
|
|
router.push({ name: 'TraceOrderManage' });
|
2025-12-29 10:29:01 +08:00
|
|
|
} catch (error: any) {
|
|
|
|
|
message.error(error.message || '出站失败');
|
|
|
|
|
} finally {
|
|
|
|
|
outfeeding.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const outfeedChildRef = ref<any>(null);
|
|
|
|
|
|
|
|
|
|
/** 父组件对外暴露的方法 */
|
|
|
|
|
function renderTableHeight() {
|
|
|
|
|
outfeedChildRef.value?.renderTableHeight();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
renderTableHeight
|
|
|
|
|
});
|
2025-12-30 15:51:25 +08:00
|
|
|
|
|
|
|
|
fetchLocationList();
|
2025-12-29 10:29:01 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<a-spin :spinning="outfeeding">
|
|
|
|
|
<a-row class="outfeed-layout">
|
|
|
|
|
<a-col :span="20" class="content-wrapper">
|
|
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
|
<component :is="Component" ref="outfeedChildRef" />
|
|
|
|
|
</router-view>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :span="4" class="menu-wrapper">
|
|
|
|
|
<div class="menu-list">
|
|
|
|
|
<span class="outfeed-title">出站</span>
|
|
|
|
|
<div v-for="item in menuItems" :key="item.key" class="menu-item" :class="{ active: activeKey === item.key }"
|
|
|
|
|
@click="handleMenuClick(item.key)">
|
|
|
|
|
<div class="menu-content">
|
|
|
|
|
<span class="menu-title">{{ item.label }}</span>
|
|
|
|
|
<a-progress :percent="item.progress" :show-info="false" size="small"
|
|
|
|
|
:stroke-color="activeKey === item.key ? '#1890ff' : undefined" class="menu-progress" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-14 09:21:15 +08:00
|
|
|
<a-button type="primary" size="large" @click="handleOutfeed">确认出站</a-button>
|
2025-12-29 10:29:01 +08:00
|
|
|
</div>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
2025-12-30 15:51:25 +08:00
|
|
|
|
2026-01-14 09:21:15 +08:00
|
|
|
<a-modal title="选择出站库位" :open="openSelectLocation" @ok="submitOutfeed" @cancel="closeOutfeed">
|
2025-12-30 15:51:25 +08:00
|
|
|
<a-select style="width: 100%" @change="handleChangeLocation" :options="locationOptions" :fieldNames="{ label: 'storageLocationCode', value: 'id' }" />
|
|
|
|
|
</a-modal>
|
2025-12-29 10:29:01 +08:00
|
|
|
</a-spin>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.outfeed-layout {
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-list {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.outfeed-title {
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
border-bottom: 1px solid #c9c9c9;
|
|
|
|
|
padding: 0 0 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item {
|
|
|
|
|
flex: 1;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 1vh 1vw;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
border: 1px solid #f0f0f0;
|
|
|
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
|
|
|
|
|
position: relative;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
background: #e6f7ff;
|
|
|
|
|
border-color: #1890ff;
|
|
|
|
|
|
|
|
|
|
.menu-title {
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
border-color: #47a5fd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-content {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-title {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #333;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-progress {
|
|
|
|
|
margin-bottom: 0 !important;
|
|
|
|
|
|
|
|
|
|
:deep(.ant-progress-bg) {
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-wrapper {
|
|
|
|
|
padding: 12px;
|
|
|
|
|
border-radius: 7px;
|
|
|
|
|
background-color: #f3f3f3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content-wrapper {
|
|
|
|
|
height: 100%;
|
|
|
|
|
padding: 12px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|