diff --git a/src/modules/06_retirement/storeRetirement.ts b/src/modules/06_retirement/storeRetirement.ts new file mode 100644 index 000000000..b91a41152 --- /dev/null +++ b/src/modules/06_retirement/storeRetirement.ts @@ -0,0 +1,14 @@ +import { defineStore } from "pinia"; +import { ref } from 'vue' +export const useDataStoreRetirement = defineStore("retirementDatastore", () => { + const tab = ref("officer"); + const type = ref("officer"); + const clickTab = (role:string) => { + type.value = role + } + return { + tab, + type, + clickTab + }; +}); diff --git a/src/modules/06_retirement/views/Main.vue b/src/modules/06_retirement/views/Main.vue index a87936c63..eebf73036 100644 --- a/src/modules/06_retirement/views/Main.vue +++ b/src/modules/06_retirement/views/Main.vue @@ -13,12 +13,9 @@ indicator-color="primary" align="left" > - - + + + @@ -287,8 +284,12 @@ import { useRouter } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; +import { useDataStoreRetirement } from '@/modules/06_retirement/storeRetirement' import type { resMain } from "@/modules/06_retirement/interface/response/Main"; - +import { storeToRefs } from "pinia"; +const useStoreRetire = useDataStoreRetirement() +const { clickTab} = useStoreRetire +const { tab , type} = storeToRefs(useDataStoreRetirement()) const mixin = useCounterMixin(); const { messageError, date2Thai, showLoader, hideLoader, dialogConfirm } = mixin; @@ -306,7 +307,7 @@ const pagination = ref({ const actionOption = ref([]); const action = ref(""); -const type = ref("officer"); + const visibleColumns = ref([ "no", "Date", @@ -353,13 +354,10 @@ const columns = ref([ // ข้อมูลตาราง (จำลอง) const currentYear = new Date().getFullYear(); const rows = ref([]); -const tab = ref("officer"); const visibleColumns2 = ref(["no", "name", "retireNumber"]); const yearOptions = reactive([]); const filteryear = () => { - // console.log(yearOptions); yearOptions.push({ id: currentYear, name: currentYear + 543 }); - // console.log(yearOptions[0].id); fiscalyear.value = yearOptions[0].id; fetchRetirement(type.value, currentYear); }; @@ -369,7 +367,6 @@ const fetchRetirement = async (type: string, year: any) => { await http .get(config.API.retirement(type, year)) .then((res) => { - // console.log(res); rows.value = []; let data = res.data.result; rows.value = data.map((items: any) => ({ @@ -483,12 +480,11 @@ const rows2 = ref([ // }; const clickAdd = () => { - console.log(rows.value.length, type.value); if (rows.value.length == 0) { dialogConfirm( $q, async () => { - let data = { type: type.value, year: currentYear }; + let data = { type: type, year: currentYear }; await cerateRetirement(data); }, "ยืนยันการเพิ่มข้อมูลประกาศเกษียณ", @@ -517,7 +513,7 @@ const clickSelect = async (action: string) => { $q, async () => { let data = { - type: type.value, + type: type, year: currentYear, retireHistoryId: action, option: radio.value, @@ -534,7 +530,6 @@ const checkjson = ref(); const checkststus = (data: any) => { let jsonfasle = data.find((e: any) => e.document == false); - // console.log(jsonfasle) if (jsonfasle) { checkjson.value = true; @@ -570,7 +565,6 @@ const paginationLabel = (start: string, end: string, total: string) => { else return start + "-" + end + " ใน " + total; }; const nextPage = (prop: any) => { - // console.log(prop.id); router.push(`/retirement/${prop.id}`); }; @@ -579,7 +573,6 @@ watch(type, () => { fetchRetirement(type.value, currentYear); }); const typeReportChangeName = (val: string) => { - // console.log(val); switch (val) { case "EDIT": return "ประกาศแก้ไขเกษียณ";