แก้ ที่อยู่ รับโอน component ทะเบียนบ้างส่วนประวัติ

This commit is contained in:
Thanit Konmek 2023-08-03 14:49:17 +07:00
parent e64b68c017
commit 8c1a5d9b23
17 changed files with 5864 additions and 25 deletions

View file

@ -0,0 +1,70 @@
import { ref } from "vue";
import { defineStore } from "pinia";
import type { Profile } from "@/components/information/interface/store/main";
export const useComponentProfileDataStore = defineStore(
"componentProfile",
() => {
const profile = "profile";
const birthDate = ref<Date>(new Date());
const retireText = ref<string | null>(null);
const profileData = ref<Profile>({
main: { columns: [] },
education: { columns: [] },
oldName: { columns: [] },
certicate: { columns: [] },
train: { columns: [] },
insignia: { columns: [] },
coined: { columns: [] },
assessment: { columns: [] },
salary: { columns: [] },
discipline: { columns: [] },
leave: { columns: [] },
talent: { columns: [] },
work: { columns: [] },
record: { columns: [] },
other: { columns: [] },
document: { columns: [] },
});
const changeRetireText = (val: string | null) => {
retireText.value = val;
};
const changeBirth = (val: Date) => {
birthDate.value = val;
};
const changeProfileColumns = (system: String, val: String[]) => {
if (system == "main") profileData.value.main.columns = val;
if (system == "education") profileData.value.education.columns = val;
if (system == "oldName") profileData.value.oldName.columns = val;
if (system == "certicate") profileData.value.certicate.columns = val;
if (system == "train") profileData.value.train.columns = val;
if (system == "insignia") profileData.value.insignia.columns = val;
if (system == "coined") profileData.value.coined.columns = val;
if (system == "assessment") profileData.value.assessment.columns = val;
if (system == "salary") profileData.value.salary.columns = val;
if (system == "discipline") profileData.value.discipline.columns = val;
if (system == "leave") profileData.value.leave.columns = val;
if (system == "talent") profileData.value.talent.columns = val;
if (system == "work") profileData.value.work.columns = val;
if (system == "record") profileData.value.record.columns = val;
if (system == "other") profileData.value.other.columns = val;
if (system == "document") profileData.value.document.columns = val;
localStorage.setItem(profile, JSON.stringify(profileData.value));
};
if (localStorage.getItem(profile) !== null) {
profileData.value = JSON.parse(localStorage.getItem(profile) || "{}");
}
return {
profileData,
changeProfileColumns,
birthDate,
changeBirth,
retireText,
changeRetireText,
};
}
);