diff --git a/src/store/index.ts b/src/store/index.ts index c6c9473..22c1ecb 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,3 +1,4 @@ export * from './auth'; export * from './user'; export * from './pwo'; +export * from './job'; diff --git a/src/store/job.ts b/src/store/job.ts new file mode 100644 index 0000000..0cabfcc --- /dev/null +++ b/src/store/job.ts @@ -0,0 +1,20 @@ +import { defineStore } from "pinia"; +import { reactive } from "vue"; + +export const useJobStore = defineStore("job", () => { + const jobInfo = reactive({}); + + function setInfo(job: any) { + Object.assign(jobInfo, job); + } + + function resetInfo() { + Object.assign(jobInfo, {}); + } + + return { + jobInfo, + setInfo, + resetInfo, + }; +}); diff --git a/src/store/pwo.ts b/src/store/pwo.ts index 5d7886c..47890b6 100644 --- a/src/store/pwo.ts +++ b/src/store/pwo.ts @@ -1,28 +1,31 @@ import { defineStore } from "pinia"; -import { ref, reactive } from "vue"; -import { message } from "ant-design-vue"; +import { reactive } from "vue"; + +export interface PwoInfo { + code: string; + id: string | number; + orderType: string; + [key: string]: any; +} export const usePwoStore = defineStore("pwo", () => { - const code = ref(''); - const currentJob = ref({}); + const pwoInfo = reactive({ + code: "", + id: "", + orderType: "", + }); - function setCode(traceOrderCode: string) { - code.value = traceOrderCode; + function setInfo(info: PwoInfo) { + Object.assign(pwoInfo, info); } - function setCurrentJob(job: any) { - currentJob.value = job; - } - - function getCurrentJob() { - return currentJob.value; + function resetInfo() { + Object.assign(pwoInfo, {}); } return { - code, - currentJob, - setCode, - setCurrentJob, - getCurrentJob, - } + pwoInfo, + setInfo, + resetInfo, + }; });