增加出站功能

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,11 +1,16 @@
<script setup lang="ts">
import { ref, computed } from 'vue';
import { ref, computed, reactive } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { message } from 'ant-design-vue';
import { listStorageLocation } from '@/api/pwoManage/location';
import { completeStation } from '@/api/pwoManage/station';
import { useJobStore } from '@/store';
const router = useRouter();
const route = useRoute();
const jobStore = useJobStore();
const menuItems = [
{ label: '主材报工', key: 'JobReport', progress: 30 },
{ label: '工序参数', key: 'ParameterConfiguration', progress: 80 },
@@ -18,12 +23,35 @@ const handleMenuClick = (name: string) => {
router.push({ name });
};
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);
const handleSelectLocation = () => {
fetchLocationList();
openSelectLocation.value = true;
};
const storage = reactive({});
const handleChangeLocation = (value: any, option: any) => {
Object.assign(storage, option);
};
// 确认出站
const outfeeding = ref(false);
const handleOutfeed = async () => {
outfeeding.value = true;
try {
router.push({ name: 'JobReport' });
await completeStation(jobStore.jobInfo.id, storage);
openSelectLocation.value = false;
message.success('出站成功');
} catch (error: any) {
message.error(error.message || '出站失败');
} finally {
@@ -41,6 +69,8 @@ function renderTableHeight() {
defineExpose({
renderTableHeight
});
fetchLocationList();
</script>
<template>
@@ -62,10 +92,14 @@ defineExpose({
:stroke-color="activeKey === item.key ? '#1890ff' : undefined" class="menu-progress" />
</div>
</div>
<a-button type="primary" size="large" @click="handleOutfeed">确认出站</a-button>
<a-button type="primary" size="large" @click="handleSelectLocation">确认出站</a-button>
</div>
</a-col>
</a-row>
<a-modal title="选择出站库位" :open="openSelectLocation" @ok="handleOutfeed" @cancel="openSelectLocation = false">
<a-select style="width: 100%" @change="handleChangeLocation" :options="locationOptions" :fieldNames="{ label: 'storageLocationCode', value: 'id' }" />
</a-modal>
</a-spin>
</template>