解耦工单和作业状态

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 './user';
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 { 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<PwoInfo>({
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,
};
});