2024-03-07 13:46:12 +07:00
|
|
|
import { defineStore } from "pinia";
|
2024-08-13 18:05:23 +07:00
|
|
|
import { ref, reactive } from "vue";
|
2024-03-07 13:46:12 +07:00
|
|
|
|
2024-08-01 12:12:28 +07:00
|
|
|
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
2024-03-07 13:46:12 +07:00
|
|
|
import type {
|
|
|
|
|
DataType,
|
|
|
|
|
DataLevel,
|
2024-08-01 12:12:28 +07:00
|
|
|
} from "@/modules/04_registryPerson/interface/response/Main";
|
2024-08-13 18:05:23 +07:00
|
|
|
import type { FormFilter } from "@/modules/04_registryPerson/interface/request/Main";
|
2024-03-07 13:46:12 +07:00
|
|
|
|
|
|
|
|
export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
2024-03-08 10:49:49 +07:00
|
|
|
const searchTypeOption = ref<DataOption[]>([
|
|
|
|
|
{ id: "fullName", name: "ชื่อ-นามสกุล" },
|
|
|
|
|
{ id: "citizenId", name: "เลขประจำตัวประชาชน" },
|
2024-06-13 16:44:41 +07:00
|
|
|
{ id: "position", name: "ตำแหน่งในสายงาน" },
|
2024-08-13 18:05:23 +07:00
|
|
|
{ id: "posNo", name: "ตำแหน่งเลขที่" },
|
2024-03-08 10:49:49 +07:00
|
|
|
]);
|
|
|
|
|
const employeeClassOps = ref<DataOption[]>([
|
|
|
|
|
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
|
|
|
|
|
{ id: "perm", name: "ลูกจ้างประจำ" },
|
2024-06-05 11:21:58 +07:00
|
|
|
// { id: "temp", name: "ลูกจ้างชั่วคราว" },
|
2024-03-08 10:49:49 +07:00
|
|
|
]);
|
2025-02-19 13:10:35 +07:00
|
|
|
const citizenId = ref<string>("");
|
2024-03-08 10:49:49 +07:00
|
|
|
const posTypeOps = ref<DataOption[]>([]);
|
|
|
|
|
const posTypeMain = ref<DataType[]>([]);
|
|
|
|
|
const posLevelOps = ref<DataOption[]>([]);
|
|
|
|
|
const yearOps = ref<DataOption[]>([]);
|
2024-06-24 17:54:53 +07:00
|
|
|
const mode = ref<string>("table");
|
2024-10-29 14:41:01 +07:00
|
|
|
const isLeave = ref<boolean>(false);
|
|
|
|
|
const tabs = ref<string>("Main");
|
|
|
|
|
const tabsManu = ref<DataOption[]>([
|
|
|
|
|
{ name: "ข้อมูลส่วนตัว", id: "Main" },
|
|
|
|
|
{ name: "ข้อมูลการพัฒนารายบุคคล (IDP)", id: "IDP" },
|
|
|
|
|
]);
|
2024-03-07 13:46:12 +07:00
|
|
|
function fetchType(data: DataType[]) {
|
2024-03-08 10:49:49 +07:00
|
|
|
posTypeMain.value = data;
|
2024-11-22 18:04:12 +07:00
|
|
|
|
2024-03-07 13:46:12 +07:00
|
|
|
const list: DataOption[] = data.map((e: DataType) => ({
|
|
|
|
|
id: e.id,
|
|
|
|
|
name: e.posTypeName,
|
|
|
|
|
}));
|
2024-03-08 10:49:49 +07:00
|
|
|
posTypeOps.value = list;
|
2024-03-07 13:46:12 +07:00
|
|
|
}
|
2024-11-22 18:04:12 +07:00
|
|
|
function fetchLevel(data: DataLevel[], shortName: string = "") {
|
2024-03-07 13:46:12 +07:00
|
|
|
const list: DataOption[] = data.map((e: DataLevel) => ({
|
|
|
|
|
id: e.id,
|
2024-11-29 10:11:38 +07:00
|
|
|
name: shortName ? `${shortName} ${e.posLevelName}` : e.posLevelName,
|
2024-03-07 13:46:12 +07:00
|
|
|
}));
|
2024-05-17 15:50:22 +07:00
|
|
|
const seen = new Set();
|
|
|
|
|
posLevelOps.value = list.filter((item: DataOption) => {
|
|
|
|
|
if (seen.has(item.name)) {
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
seen.add(item.name);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-03-07 13:46:12 +07:00
|
|
|
}
|
2024-08-13 18:05:23 +07:00
|
|
|
|
|
|
|
|
const formFilter = reactive<FormFilter>({
|
|
|
|
|
page: 1,
|
|
|
|
|
pageSize: 12,
|
|
|
|
|
keyword: "",
|
|
|
|
|
type: "officer",
|
|
|
|
|
posType: "",
|
|
|
|
|
posLevel: "",
|
|
|
|
|
retireYear: "",
|
|
|
|
|
rangeYear: { min: 0, max: 60 },
|
|
|
|
|
isShowRetire: false,
|
|
|
|
|
isProbation: false,
|
2024-09-04 12:21:51 +07:00
|
|
|
isAll: true,
|
2024-09-04 14:37:39 +07:00
|
|
|
nodeId: null,
|
|
|
|
|
node: null,
|
2024-09-05 10:07:52 +07:00
|
|
|
searchType: "fullName",
|
2025-01-31 11:30:24 +07:00
|
|
|
retireType: null,
|
2025-02-19 13:10:35 +07:00
|
|
|
dateAppoint: "",
|
2024-08-13 18:05:23 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const labelOption = reactive({
|
|
|
|
|
type: "ข้าราชการ กทม.สามัญ",
|
|
|
|
|
posType: "ทั้งหมด",
|
|
|
|
|
posLevel: "ทั้งหมด",
|
|
|
|
|
retireYear: "",
|
2024-08-14 16:09:05 +07:00
|
|
|
node: "เลือกหน่วยงาน",
|
2025-01-31 11:30:24 +07:00
|
|
|
retireType: "ทั้งหมด",
|
2025-02-20 13:33:26 +07:00
|
|
|
sortName: "ลำดับการแสดงผล",
|
2024-08-13 18:05:23 +07:00
|
|
|
});
|
|
|
|
|
|
2025-01-30 17:07:04 +07:00
|
|
|
function convertTypeRetired(val: string) {
|
|
|
|
|
const newVal = val?.toLocaleUpperCase();
|
|
|
|
|
switch (newVal) {
|
|
|
|
|
case "RETIRE":
|
|
|
|
|
return "เกษียณ ";
|
|
|
|
|
case "RETIRE_RESIGN":
|
|
|
|
|
return "ลาออก ";
|
|
|
|
|
case "RETIRE_DECEASED":
|
|
|
|
|
return "ถึงแก่กรรม ";
|
|
|
|
|
case "RETIRE_OUT":
|
|
|
|
|
return "ให้ออกจากราชการ ";
|
|
|
|
|
case "DISCIPLINE_RESULT_REMOVE":
|
|
|
|
|
return "ปลดออกจากราชการ ";
|
|
|
|
|
case "DISCIPLINE_RESULT_DISMISS":
|
|
|
|
|
return "ไล่ออกจากราชการ ";
|
|
|
|
|
case "DISCIPLINE_SUSPEND":
|
|
|
|
|
return "ถูกพักจากราชการ ";
|
|
|
|
|
case "PROBATION_REPORT":
|
|
|
|
|
return "ไม่ผ่านทดลองงาน ";
|
|
|
|
|
case "PLACEMENT_TRANSFER":
|
|
|
|
|
return "โอนออก ";
|
|
|
|
|
case "RETIRE_RESIGN_EMP":
|
2025-02-20 16:30:52 +07:00
|
|
|
return "ลาออก(ลูกจ้าง)";
|
|
|
|
|
case "RETIRE_OUT_EMP":
|
2025-01-31 11:30:24 +07:00
|
|
|
return "ให้ออกจากราชการ(ลูกจ้าง)";
|
2025-01-30 17:07:04 +07:00
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-31 11:30:24 +07:00
|
|
|
const retireTypeOps = ref<DataOption[]>([
|
|
|
|
|
{ id: "RETIRE", name: "เกษียณ" },
|
|
|
|
|
{ id: "RETIRE_RESIGN", name: "ลาออก" },
|
|
|
|
|
{ id: "RETIRE_DECEASED", name: "ถึงแก่กรรม" },
|
|
|
|
|
{ id: "RETIRE_OUT", name: "ให้ออกจากราชการ" },
|
|
|
|
|
{ id: "DISCIPLINE_RESULT_REMOVE", name: "ปลดออกจากราชการ" },
|
|
|
|
|
{ id: "DISCIPLINE_RESULT_DISMISS", name: "ไล่ออกจากราชการ" },
|
|
|
|
|
{ id: "DISCIPLINE_SUSPEND", name: "ถูกพักจากราชการ" },
|
|
|
|
|
{ id: "PROBATION_REPORT", name: "ไม่ผ่านทดลองงาน" },
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const retireTypeEmpOps = ref<DataOption[]>([
|
|
|
|
|
{ id: "RETIRE", name: "เกษียณ" },
|
2025-02-20 16:30:52 +07:00
|
|
|
{ id: "RETIRE_RESIGN_EMP", name: "ลาออก" },
|
2025-01-31 11:30:24 +07:00
|
|
|
{ id: "RETIRE_DECEASED", name: "ถึงแก่กรรม" },
|
2025-02-20 16:30:52 +07:00
|
|
|
{ id: "RETIRE_OUT_EMP", name: "ให้ออกจากราชการ" },
|
2025-01-31 11:30:24 +07:00
|
|
|
]);
|
|
|
|
|
|
2025-02-19 13:10:35 +07:00
|
|
|
const displayOrderOps = ref<DataOption[]>([
|
2025-02-19 17:39:45 +07:00
|
|
|
{ id: "DESC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (ล่าสุด-เก่า)" },
|
|
|
|
|
{ id: "ASC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (เก่า-ล่าสุด)" },
|
2025-02-19 13:10:35 +07:00
|
|
|
]);
|
|
|
|
|
|
2024-03-07 13:46:12 +07:00
|
|
|
return {
|
|
|
|
|
fetchType,
|
|
|
|
|
fetchLevel,
|
2024-03-08 10:49:49 +07:00
|
|
|
posTypeMain,
|
|
|
|
|
searchTypeOption,
|
|
|
|
|
employeeClassOps,
|
|
|
|
|
posTypeOps,
|
|
|
|
|
posLevelOps,
|
|
|
|
|
yearOps,
|
|
|
|
|
mode,
|
2024-08-13 18:05:23 +07:00
|
|
|
formFilter,
|
|
|
|
|
labelOption,
|
2024-10-29 14:41:01 +07:00
|
|
|
isLeave,
|
|
|
|
|
tabs,
|
|
|
|
|
tabsManu,
|
2025-01-30 17:07:04 +07:00
|
|
|
convertTypeRetired,
|
2025-01-31 11:30:24 +07:00
|
|
|
retireTypeOps,
|
|
|
|
|
retireTypeEmpOps,
|
2025-02-19 13:10:35 +07:00
|
|
|
citizenId,
|
|
|
|
|
displayOrderOps,
|
2024-03-07 13:46:12 +07:00
|
|
|
};
|
|
|
|
|
});
|