解耦工单和作业状态

This commit is contained in:
tao
2025-12-29 08:59:29 +08:00
parent 4cf0b80f8f
commit b7584a01ee
3 changed files with 42 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
export * from './auth'; export * from './auth';
export * from './user'; export * from './user';
export * from './pwo'; export * from './pwo';
export * from './job';

20
src/store/job.ts Normal file
View File

@@ -0,0 +1,20 @@
import { defineStore } from "pinia";
import { reactive } from "vue";
export const useJobStore = defineStore("job", () => {
const jobInfo = reactive<any>({});
function setInfo(job: any) {
Object.assign(jobInfo, job);
}
function resetInfo() {
Object.assign(jobInfo, {});
}
return {
jobInfo,
setInfo,
resetInfo,
};
});

View File

@@ -1,28 +1,31 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { ref, reactive } from "vue"; import { reactive } from "vue";
import { message } from "ant-design-vue";
export interface PwoInfo {
code: string;
id: string | number;
orderType: string;
[key: string]: any;
}
export const usePwoStore = defineStore("pwo", () => { export const usePwoStore = defineStore("pwo", () => {
const code = ref(''); const pwoInfo = reactive<PwoInfo>({
const currentJob = ref({}); code: "",
id: "",
orderType: "",
});
function setCode(traceOrderCode: string) { function setInfo(info: PwoInfo) {
code.value = traceOrderCode; Object.assign(pwoInfo, info);
} }
function setCurrentJob(job: any) { function resetInfo() {
currentJob.value = job; Object.assign(pwoInfo, {});
}
function getCurrentJob() {
return currentJob.value;
} }
return { return {
code, pwoInfo,
currentJob, setInfo,
setCode, resetInfo,
setCurrentJob, };
getCurrentJob,
}
}); });