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