优化工单管理主界面架构

This commit is contained in:
tao
2025-12-29 09:02:46 +08:00
parent d7e6889339
commit 40c5141385
2 changed files with 156 additions and 122 deletions

View File

@@ -1,10 +1,10 @@
<script setup lang="ts">
import { ref, reactive, onMounted, watch } from 'vue';
import { useRoute } from 'vue-router';
import { ref, onMounted, watch } from 'vue';
import { useRouter } from 'vue-router';
import { message } from 'ant-design-vue';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { listStation } from '@/api/station';
import { usePwoStore } from '@/store';
import { listStation } from '@/api/pwoManage/station';
import { usePwoStore, useJobStore } from '@/store';
interface TableItem {
key: string;
@@ -17,8 +17,9 @@ interface TableItem {
[key: string]: any;
}
const route = useRoute();
const router = useRouter();
const pwoStore = usePwoStore();
const jobStore = useJobStore();
const tableData = ref<TableItem[]>([]);
const columns = [
@@ -28,7 +29,7 @@ const columns = [
{ title: '合格数量', dataIndex: 'okQty', key: 'okQty', align: 'center' },
{ title: '报废数量', dataIndex: 'ngQty', key: 'ngQty', align: 'center' },
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center' },
{ title: '操作', key: 'action', align: 'center', width: 120 },
{ title: '操作', key: 'action', align: 'center' },
];
const loadingStations = ref(false);
@@ -50,30 +51,29 @@ const fetchStations = async (traceOrderCode: string) => {
}
};
const handleSubmit = (record: TableItem) => {
message.success(`提交了序号: ${record.index}`);
const handleInfeed = (record: any) => {
jobStore.setInfo(record);
router.push({ name: 'Infeed' });
};
onMounted(() => {
const traceOrderCode = route.query.traceOrderCode as string;
if (traceOrderCode) {
fetchStations(traceOrderCode);
}
});
const handleOutfeed = () => {
router.push({ name: 'Outfeed' });
};
watch(
() => route.query.t,
() => pwoStore.pwoInfo.code,
(val) => {
if (val) {
fetchStations(route.query.traceOrderCode as string);
fetchStations(val);
}
}
);
},
{ immediate: true }
)
function rowClick(record: TableItem) {
return {
onClick: () => {
pwoStore.setCurrentJob(record);
jobStore.setInfo(record);
},
};
}
@@ -88,14 +88,16 @@ function rowClick(record: TableItem) {
:loading="loadingStations"
bordered
sticky
size="middle"
rowKey="key"
class="custom-table"
:customRow="rowClick"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-button type="primary" @click="handleSubmit(record as TableItem)">进入</a-button>
<a-space>
<a-button size="large" type="primary" @click="handleInfeed(record)">进站</a-button>
<a-button size="large" type="primary" danger @click="handleOutfeed">出站</a-button>
</a-space>
</template>
</template>
</a-table>