diff --git a/src/store/job.ts b/src/store/job.ts index 0cabfcc..c483dfc 100644 --- a/src/store/job.ts +++ b/src/store/job.ts @@ -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({}); + 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, }; }); diff --git a/src/views/pwoManage/index.vue b/src/views/pwoManage/index.vue index 13673a5..b4a42a7 100644 --- a/src/views/pwoManage/index.vue +++ b/src/views/pwoManage/index.vue @@ -1,5 +1,5 @@