增加刷新作业信息功能
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { reactive } from "vue";
|
||||
import { ref, reactive } from "vue";
|
||||
import { getStation } from "@/api/pwoManage/station";
|
||||
|
||||
export const useJobStore = defineStore("job", () => {
|
||||
const jobInfo = reactive<any>({});
|
||||
const loadingJobInfo = ref(false);
|
||||
|
||||
function setInfo(job: any) {
|
||||
Object.assign(jobInfo, job);
|
||||
@@ -12,9 +14,23 @@ export const useJobStore = defineStore("job", () => {
|
||||
Object.assign(jobInfo, {});
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
loadingJobInfo.value = true;
|
||||
try {
|
||||
const { data } = await getStation(jobInfo.id);
|
||||
Object.assign(jobInfo, data);
|
||||
} catch (error: any) {
|
||||
console.log(error.message);
|
||||
} finally {
|
||||
loadingJobInfo.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
jobInfo,
|
||||
loadingJobInfo,
|
||||
setInfo,
|
||||
resetInfo,
|
||||
refresh,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch, getCurrentInstance } from 'vue';
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { message } from 'ant-design-vue';
|
||||
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
|
||||
@@ -36,10 +36,10 @@ const columns = [
|
||||
];
|
||||
|
||||
const loadingStations = ref(false);
|
||||
const fetchStations = async (traceOrderCode: string) => {
|
||||
const fetchStations = async () => {
|
||||
try {
|
||||
loadingStations.value = true;
|
||||
const res = await listStation({ traceOrderCode });
|
||||
const res = await listStation({ traceOrderCode: pwoStore.pwoInfo.code });
|
||||
tableData.value = (res.rows || []).map((item: any, idx: number) => {
|
||||
return {
|
||||
key: String(item.id ?? idx),
|
||||
@@ -63,16 +63,6 @@ const handleOutfeed = () => {
|
||||
router.push({ name: 'Outfeed' });
|
||||
};
|
||||
|
||||
watch(
|
||||
() => pwoStore.pwoInfo.code,
|
||||
(val) => {
|
||||
if (val) {
|
||||
fetchStations(val);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
function rowClick(record: TableItem) {
|
||||
return {
|
||||
onClick: () => {
|
||||
@@ -80,6 +70,10 @@ function rowClick(record: TableItem) {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
fetchStations
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -111,6 +111,7 @@ const handleChange = async (value: string, option: LotTraceOrderData) => {
|
||||
Object.assign(workOrderInfo, data);
|
||||
pwoStore.setInfo(data);
|
||||
jobStore.resetInfo();
|
||||
infeedRef.value?.fetchStations();
|
||||
} catch (error: any) {
|
||||
message.error(error.message || '获取工单信息失败');
|
||||
} finally {
|
||||
@@ -126,6 +127,7 @@ const handleRefresh = async () => {
|
||||
const { data } = await getLotTraceOrder(workOrderInfo.id)
|
||||
Object.assign(workOrderInfo, data);
|
||||
pwoStore.setInfo(data);
|
||||
infeedRef.value?.fetchStations();
|
||||
} catch (error: any) {
|
||||
message.error(error.message || '刷新工单信息失败');
|
||||
} finally {
|
||||
@@ -230,35 +232,40 @@ onUnmounted(() => {
|
||||
|
||||
<!-- Process Info -->
|
||||
<a-col :span="8">
|
||||
<a-card title="工序信息" class="info-card" :bordered="false">
|
||||
<a-form :model="processInfo" :colon="false" v-show="!collapsed">
|
||||
<a-form-item label="工序名称">
|
||||
<a-input v-model:value="processInfo.operationTitle" readonly>
|
||||
<template #suffix>
|
||||
<a-button @click="handleCopy(processInfo.operationTitle)" size="small">
|
||||
<template #icon><i-lucide-copy /></template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="工序状态">
|
||||
<a-input readonly>
|
||||
<template #prefix>
|
||||
<DictTag :options="mes_station_status" :value="processInfo.status" size="medium" />
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="作业编码">
|
||||
<a-input v-model:value="processInfo.code" readonly>
|
||||
<template #suffix>
|
||||
<a-button @click="handleCopy(processInfo.code)" size="small">
|
||||
<template #icon><i-lucide-copy /></template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
<a-spin :spinning="jobStore.loadingJobInfo">
|
||||
<a-card title="工序信息" class="info-card" :bordered="false">
|
||||
<a-form :model="processInfo" :colon="false" v-show="!collapsed">
|
||||
<a-form-item label="工序名称">
|
||||
<a-input v-model:value="processInfo.operationTitle" readonly>
|
||||
<template #suffix>
|
||||
<a-button @click="handleCopy(processInfo.operationTitle)" size="small">
|
||||
<template #icon><i-lucide-copy /></template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="工序状态">
|
||||
<a-input readonly>
|
||||
<template #prefix>
|
||||
<DictTag :options="mes_station_status" :value="processInfo.status" size="medium" />
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="作业编码">
|
||||
<a-input v-model:value="processInfo.code" readonly>
|
||||
<template #suffix>
|
||||
<a-button @click="handleCopy(processInfo.code)" size="small">
|
||||
<template #icon><i-lucide-copy /></template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<template #extra>
|
||||
<a-button @click="jobStore.refresh"><template #icon><i-lucide-rotate-cw /></template></a-button>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</a-col>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
|
||||
Reference in New Issue
Block a user