From 18a151716e524f713e6ff70613f8c322ab2d676a Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Thu, 4 Apr 2024 14:20:39 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A5=E0=B8=9A=20store=20=E0=B8=AD=E0=B8=AD?= =?UTF-8?q?=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/history/AddPage.vue | 135 ++---------------- .../components/history/DialogGov.vue | 84 +++++++++-- .../components/history/DialogProject.vue | 57 ++++++-- .../components/historyEmployee/AddPage.vue | 128 ++--------------- .../components/historyEmployee/DialogGov.vue | 111 ++++++++------ .../historyEmployee/DialogProject.vue | 70 ++++++--- .../15_development/store/developmentStore.ts | 2 + .../store/developmentStoreHistory.ts | 22 --- .../15_development/views/EmployeeHistory.vue | 8 +- src/modules/15_development/views/History.vue | 8 +- 10 files changed, 269 insertions(+), 356 deletions(-) delete mode 100644 src/modules/15_development/store/developmentStoreHistory.ts diff --git a/src/modules/15_development/components/history/AddPage.vue b/src/modules/15_development/components/history/AddPage.vue index aaeb99267..dde036663 100644 --- a/src/modules/15_development/components/history/AddPage.vue +++ b/src/modules/15_development/components/history/AddPage.vue @@ -5,7 +5,7 @@ import type { FormAddHistory, FormAddHistoryProject, } from "@/modules/15_development/interface/request/Main"; -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; @@ -23,7 +23,7 @@ const id = ref(route.params.id as string); const $q = useQuasar(); const mixin = useCounterMixin(); const { dialogConfirm, showLoader, hideLoader, messageError,date2Thai } = mixin; -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const modalDialogGov = ref(false); const modalDialogProject = ref(false); @@ -89,131 +89,12 @@ const fieldLabelsProject = { organizingTraining: "หน่วยงานที่รับผิดชอบจัดการอบรม", }; -const visibleColumnsGov = ref([ - "citizenId", - "name", - "position", - "type", - "level", - "positionSide", -]); - -const visibleColumnsProject = ref([ - "project", - "year", - "organizingTraining", -]); - -const columnsGov = ref([ - { - name: "citizenId", - align: "left", - label: "เลขประจำตัวประชาชน", - sortable: true, - field: "citizenId", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "name", - align: "left", - label: "ชื่อ - นามสกุล", - sortable: true, - field: "name", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - - { - name: "position", - align: "left", - label: "ตําแหน่ง", - sortable: true, - field: "position", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "type", - align: "left", - label: "ประเภทตำแหน่ง", - sortable: true, - field: "type", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "level", - align: "left", - label: "ระดับตำแหน่ง", - sortable: true, - field: "level", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "positionSide", - align: "left", - label: "ตําแหน่งทางการบริหาร", - sortable: true, - field: "positionSide", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, -]); - -const columnsProject = ref([ - { - name: "project", - align: "left", - label: "ชื่อโครงการ/กิจกรรม/หลักสูตร", - sortable: true, - field: "project", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "year", - align: "left", - label: "ปีงบประมาณ", - sortable: true, - field: "year", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - - { - name: "organizingTraining", - align: "left", - label: "หน่วยงานที่รับผิดชอบ", - sortable: true, - field: "organizingTraining", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, -]); - -/** เปิด dialog ข้าราชการ*/ -function openDialogGov() { - store.columns = columnsGov.value; - store.visibleColumns = visibleColumnsGov.value; - modalDialogGov.value = true; -} - -/** เปิด dialog โครงการ */ -function openDialogProject() { - store.columns = columnsProject.value; - store.visibleColumns = visibleColumnsProject.value; - - modalDialogProject.value = true; -} - function getClass() { return "inputgreen"; } /** save */ function onSubmit() { - const url = store.status + const url = store.statusEdit ? config.API.developmentHistoryList('officer')+`${id.value}` : config.API.developmentHistoryAdd('officer') @@ -234,7 +115,7 @@ function onSubmit() { } dialogConfirm($q,()=>{ showLoader() - http[store.status ? 'put':'post'](url,body) + http[store.statusEdit ? 'put':'post'](url,body) .then((res)=>{ console.log(res) router.push(`/development/history`) @@ -282,7 +163,7 @@ function getDataEdit(){ } onMounted(()=>{ - if(store.status == true){ + if(store.statusEdit == true){ console.log(1) // getDataEdit() } @@ -300,7 +181,7 @@ onMounted(()=>{ class="q-mr-sm" @click="router.go(-1)" /> - {{ store.status ? `แก้ไขประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`:`เพิ่มประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`}}{{ store.statusEdit ? `แก้ไขประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`:`เพิ่มประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`}} @@ -316,7 +197,7 @@ onMounted(()=>{ color="teal" label="เลือกข้าราชการฯ" icon="add" - @click="openDialogGov()" + @click="modalDialogGov = true" />
@@ -366,7 +247,7 @@ onMounted(()=>{ color="teal" label="เลือกโครงการ" icon="add" - @click="openDialogProject()" + @click="modalDialogProject = true;" />
diff --git a/src/modules/15_development/components/history/DialogGov.vue b/src/modules/15_development/components/history/DialogGov.vue index 663b87d3b..839952fc3 100644 --- a/src/modules/15_development/components/history/DialogGov.vue +++ b/src/modules/15_development/components/history/DialogGov.vue @@ -2,15 +2,15 @@ import { ref, watch, computed,reactive } from "vue"; import Header from "@/components/DialogHeader.vue"; import type { DataOption,FormFilter,NewPagination } from "@/modules/15_development/interface/index/Main"; -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; -import { useQuasar } from "quasar"; +import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; - +const rows = ref([]) const props = defineProps({ upDate: { type: Function }, }); @@ -45,7 +45,7 @@ const { showLoader, hideLoader, } = mixin; -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const modal = defineModel("modal", { required: true }); @@ -67,6 +67,72 @@ const govOp = ref([ }, ]); +const visibleColumns = ref([ + "citizenId", + "name", + "position", + "type", + "level", + "positionSide", +]); +const columns = ref([ + { + name: "citizenId", + align: "left", + label: "เลขประจำตัวประชาชน", + sortable: true, + field: "citizenId", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "name", + align: "left", + label: "ชื่อ - นามสกุล", + sortable: true, + field: "name", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "position", + align: "left", + label: "ตําแหน่ง", + sortable: true, + field: "position", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "type", + align: "left", + label: "ประเภทตำแหน่ง", + sortable: true, + field: "type", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "level", + align: "left", + label: "ระดับตำแหน่ง", + sortable: true, + field: "level", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "positionSide", + align: "left", + label: "ตําแหน่งทางการบริหาร", + sortable: true, + field: "positionSide", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + /** save ข้อมูล */ function onSubmit() { if (selected.value?.length == 0) { @@ -99,7 +165,7 @@ function onSubmit() { /** ปิด dialog */ function closeDialog() { modal.value = false; - store.rows = []; + rows.value = []; selected.value = []; } @@ -119,7 +185,7 @@ function searchFilter() { console.log(res.data.result.data); const data = res.data.result.data; maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); - store.rows = data.map((item: any) => ({ + rows.value = data.map((item: any) => ({ id:item.id ? item.id : null, name: item.firstName ? `${item.prefix}${item.firstName} ${item.lastName}` : null, prefix:item.prefix ? item.prefix : null, @@ -213,14 +279,14 @@ watch( v-model:selected="selected" for="table" ref="table" - :columns="store.columns" - :rows="store.rows" + :columns="columns" + :rows="rows" row-key="id" flat bordered dense class="custom-header-table" - :visible-columns="store.visibleColumns" + :visible-columns="visibleColumns" v-model:pagination="pagination" :rows-per-page-options="[20, 25, 50, 100]" @update:pagination="updatePageSize" diff --git a/src/modules/15_development/components/history/DialogProject.vue b/src/modules/15_development/components/history/DialogProject.vue index a5e8e820a..f65460206 100644 --- a/src/modules/15_development/components/history/DialogProject.vue +++ b/src/modules/15_development/components/history/DialogProject.vue @@ -6,13 +6,15 @@ import type { FormFilter, NewPagination, } from "@/modules/15_development/interface/index/Main"; -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; -import { useQuasar } from "quasar"; +import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; +const rows = ref([]) + const props = defineProps({ upDate: { type: Function }, }); @@ -27,7 +29,7 @@ const { showLoader, hideLoader, } = mixin; -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const modal = defineModel("modal", { required: true }); @@ -70,6 +72,45 @@ const projectOp = ref([ // }, ]); +const visibleColumns = ref([ + "project", + "year", + "organizingTraining", +]); + + + +const columns = ref([ + { + name: "project", + align: "left", + label: "ชื่อโครงการ/กิจกรรม/หลักสูตร", + sortable: true, + field: "project", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "year", + align: "left", + label: "ปีงบประมาณ", + sortable: true, + field: "year", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "organizingTraining", + align: "left", + label: "หน่วยงานที่รับผิดชอบ", + sortable: true, + field: "organizingTraining", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + /** save ข้อมูล */ function onSubmit() { if (selected.value?.length == 0) { @@ -96,7 +137,7 @@ function onSubmit() { /** ปิด dialog */ function closeDialog() { modal.value = false; - store.rows = []; + rows.value = []; selected.value = []; } @@ -118,7 +159,7 @@ function searchFilter() { .then((res) => { const data = res.data.result.data; maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); - store.rows = data.map((item: any) => ({ + rows.value = data.map((item: any) => ({ id: item.id ? item.id : null, year: item.year ? item.year : null, project: item.projectName ? item.projectName : null, @@ -244,14 +285,14 @@ watch( v-model:selected="selected" for="table" ref="table" - :columns="store.columns" - :rows="store.rows" + :columns="columns" + :rows="rows" row-key="id" flat bordered dense class="custom-header-table" - :visible-columns="store.visibleColumns" + :visible-columns="visibleColumns" v-model:pagination="pagination" :rows-per-page-options="[20, 25, 50, 100]" @update:pagination="updatePageSize" diff --git a/src/modules/15_development/components/historyEmployee/AddPage.vue b/src/modules/15_development/components/historyEmployee/AddPage.vue index c981d1f75..a1cc81e69 100644 --- a/src/modules/15_development/components/historyEmployee/AddPage.vue +++ b/src/modules/15_development/components/historyEmployee/AddPage.vue @@ -5,7 +5,7 @@ import type { FormAddHistoryEmployee, FormAddHistoryProject, } from "@/modules/15_development/interface/request/Main"; -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; @@ -24,7 +24,7 @@ const $q = useQuasar(); const mixin = useCounterMixin(); const { dialogConfirm, showLoader, hideLoader, messageError, date2Thai } = mixin; -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const modalDialogGov = ref(false); const modalDialogProject = ref(false); @@ -88,122 +88,12 @@ const fieldLabelsProject = { organizingTraining: "หน่วยงานที่รับผิดชอบจัดการอบรม", }; -const visibleColumnsGov = ref([ - "citizenId", - "name", - "position", - "type", - "level", - "positionSide", -]); - -const visibleColumnsProject = ref([ - "project", - "year", - "organizingTraining", -]); - -const columnsGov = ref([ - { - name: "citizenId", - align: "left", - label: "เลขประจำตัวประชาชน", - sortable: true, - field: "citizenId", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "name", - align: "left", - label: "ชื่อ - นามสกุล", - sortable: true, - field: "name", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - - { - name: "position", - align: "left", - label: "ตําแหน่ง", - sortable: true, - field: "position", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "type", - align: "left", - label: "กลุ่มงาน", - sortable: true, - field: "type", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "level", - align: "left", - label: "ระดับชั้นงาน", - sortable: true, - field: "level", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, -]); - -const columnsProject = ref([ - { - name: "project", - align: "left", - label: "ชื่อโครงการ/กิจกรรม/หลักสูตร", - sortable: true, - field: "project", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "year", - align: "left", - label: "ปีงบประมาณ", - sortable: true, - field: "year", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - - { - name: "organizingTraining", - align: "left", - label: "หน่วยงานที่รับผิดชอบ", - sortable: true, - field: "organizingTraining", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, -]); - -/** เปิด dialog ข้าราชการ*/ -function openDialogGov() { - store.columns = columnsGov.value; - store.visibleColumns = visibleColumnsGov.value; - modalDialogGov.value = true; -} - -/** เปิด dialog โครงการ */ -function openDialogProject() { - store.columns = columnsProject.value; - store.visibleColumns = visibleColumnsProject.value; - - modalDialogProject.value = true; -} - function getClass() { return "inputgreen"; } /** save */ function onSubmit() { - const url = store.status + const url = store.statusEdit ? config.API.developmentHistoryList("employee") + `${id.value}` : config.API.developmentHistoryAdd("employee"); @@ -214,7 +104,7 @@ function onSubmit() { lastName: formMain.lastName, citizenId: formMain.citizenId, position: formMain.position, - // posExecutive:formMain.positionSide, + posExecutive:null, posLevelId: formMain.posLevelId, posTypeId: formMain.posTypeId, @@ -224,7 +114,7 @@ function onSubmit() { }; dialogConfirm($q, () => { showLoader(); - http[store.status ? "put" : "post"](url, body) + http[store.statusEdit ? "put" : "post"](url, body) .then((res) => { console.log(res); router.push(`/development/history`); @@ -274,7 +164,7 @@ function getDataEdit() { } onMounted(() => { - if (store.status == true) { + if (store.statusEdit == true) { console.log(1); // getDataEdit() } @@ -293,7 +183,7 @@ onMounted(() => { @click="router.go(-1)" /> {{ - store.status + store.statusEdit ? `แก้ไขประวัติฝึกอบรม/ดูงานลูกจ้าง` : `เพิ่มประวัติฝึกอบรม/ดูงานลูกจ้าง` }} @@ -311,7 +201,7 @@ onMounted(() => { color="teal" label="เลือกลูกจ้าง" icon="add" - @click="openDialogGov()" + @click="modalDialogGov = true" />
@@ -361,7 +251,7 @@ onMounted(() => { color="teal" label="เลือกโครงการ" icon="add" - @click="openDialogProject()" + @click="modalDialogProject = true" />
diff --git a/src/modules/15_development/components/historyEmployee/DialogGov.vue b/src/modules/15_development/components/historyEmployee/DialogGov.vue index dc7b1e1fa..3be849189 100644 --- a/src/modules/15_development/components/historyEmployee/DialogGov.vue +++ b/src/modules/15_development/components/historyEmployee/DialogGov.vue @@ -2,15 +2,15 @@ import { ref, watch, computed,reactive } from "vue"; import Header from "@/components/DialogHeader.vue"; import type { DataOption,FormFilter,NewPagination } from "@/modules/15_development/interface/index/Main"; -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; -import { useQuasar } from "quasar"; +import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; - +const rows = ref([]) const props = defineProps({ upDate: { type: Function }, }); @@ -45,7 +45,7 @@ const { showLoader, hideLoader, } = mixin; -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const modal = defineModel("modal", { required: true }); @@ -67,6 +67,63 @@ const govOp = ref([ }, ]); +const visibleColumns = ref([ + "citizenId", + "name", + "position", + "type", + "level", + "positionSide", +]); +const columns = ref([ + { + name: "citizenId", + align: "left", + label: "เลขประจำตัวประชาชน", + sortable: true, + field: "citizenId", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "name", + align: "left", + label: "ชื่อ - นามสกุล", + sortable: true, + field: "name", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "position", + align: "left", + label: "ตําแหน่ง", + sortable: true, + field: "position", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "type", + align: "left", + label: "กลุ่มงาน", + sortable: true, + field: "type", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "level", + align: "left", + label: "ระดับชั้นงาน", + sortable: true, + field: "level", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + /** save ข้อมูล */ function onSubmit() { if (selected.value?.length == 0) { @@ -99,7 +156,7 @@ function onSubmit() { /** ปิด dialog */ function closeDialog() { modal.value = false; - store.rows = []; + rows.value = []; selected.value = []; } @@ -120,7 +177,7 @@ function searchFilter() { .then((res) => { const data = res.data.result.data; maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); - store.rows = data.map((item: any) => ({ + rows.value = data.map((item: any) => ({ id:item.id ? item.id:null, prefix:item.prefix ? item.prefix:null, rank:item.rank ? item.rank:null, @@ -145,42 +202,6 @@ function searchFilter() { }); } -// function searchFilter() { -// showLoader(); -// http -// .get( -// config.API.registryNew + -// `?page=${formFilter.page}&pageSize=${formFilter.pageSize}&searchField=${search.value}&searchKeyword=${inputSearch.value}` -// ) -// .then((res) => { -// console.log(res.data.result.data); -// const data = res.data.result.data; -// maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); -// store.rows = data.map((item: any) => ({ -// id:item.id ? item.id : null, -// name: item.firstName ? `${item.prefix}${item.firstName} ${item.lastName}` : null, -// prefix:item.prefix ? item.prefix : null, -// rank:item.rank ? item.rank : null, -// firstName:item.firstName ? item.firstName : null, -// lastName:item.lastName ? item.lastName : null, -// citizenId:item.citizenId ? item.citizenId : null, -// level:item.posLevel ? item.posLevel : null, -// type:item.posType ? item.posType : null, -// posLevelId:item.posLevelId ? item.posLevelId : null, -// posTypeId:item.posTypeId ? item.posTypeId : null, -// position:item.position ? item.position : null, -// positionSide:item.posExecutive ? item.posExecutive : null, -// posNo:item.posNo ? item.posNo : null, -// })); -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// hideLoader(); -// }); -// } - function updatePage(val:number){ formFilter.page = val; searchFilter(); @@ -250,14 +271,14 @@ watch( v-model:selected="selected" for="table" ref="table" - :columns="store.columns" - :rows="store.rows" + :columns="columns" + :rows="rows" row-key="id" flat bordered dense class="custom-header-table" - :visible-columns="store.visibleColumns" + :visible-columns="visibleColumns" v-model:pagination="pagination" :rows-per-page-options="[20, 25, 50, 100]" @update:pagination="updatePageSize" diff --git a/src/modules/15_development/components/historyEmployee/DialogProject.vue b/src/modules/15_development/components/historyEmployee/DialogProject.vue index c77c287f0..8d2403daa 100644 --- a/src/modules/15_development/components/historyEmployee/DialogProject.vue +++ b/src/modules/15_development/components/historyEmployee/DialogProject.vue @@ -6,13 +6,14 @@ import type { FormFilter, NewPagination, } from "@/modules/15_development/interface/index/Main"; -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; -import { useQuasar } from "quasar"; +import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; +const rows = ref([]); const props = defineProps({ upDate: { type: Function }, }); @@ -27,7 +28,7 @@ const { showLoader, hideLoader, } = mixin; -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const modal = defineModel("modal", { required: true }); @@ -70,6 +71,39 @@ const projectOp = ref([ // }, ]); +const visibleColumns = ref(["project", "year", "organizingTraining"]); + +const columns = ref([ + { + name: "project", + align: "left", + label: "ชื่อโครงการ/กิจกรรม/หลักสูตร", + sortable: true, + field: "project", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "year", + align: "left", + label: "ปีงบประมาณ", + sortable: true, + field: "year", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "organizingTraining", + align: "left", + label: "หน่วยงานที่รับผิดชอบ", + sortable: true, + field: "organizingTraining", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + /** save ข้อมูล */ function onSubmit() { if (selected.value?.length == 0) { @@ -78,16 +112,16 @@ function onSubmit() { dialogConfirm($q, () => { const data = selected.value[0]; const body = { - id:data.id, - year:data.year, - project:data.project, - dateStart:data.dateStart, - dateEnd:data.dateEnd, - totalDate:data.totalDate, - addressAcademic:data.addressAcademic, - topicAcademic:data.topicAcademic, + id: data.id, + year: data.year, + project: data.project, + dateStart: data.dateStart, + dateEnd: data.dateEnd, + totalDate: data.totalDate, + addressAcademic: data.addressAcademic, + topicAcademic: data.topicAcademic, }; - props.upDate?.(body) + props.upDate?.(body); closeDialog(); }); } @@ -96,7 +130,7 @@ function onSubmit() { /** ปิด dialog */ function closeDialog() { modal.value = false; - store.rows = []; + rows.value = []; selected.value = []; } @@ -117,7 +151,7 @@ function searchFilter() { .then((res) => { const data = res.data.result.data; maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); - store.rows = data.map((item: any) => ({ + rows.value = data.map((item: any) => ({ id: item.id ? item.id : null, year: item.year ? item.year : null, project: item.projectName ? item.projectName : null, @@ -136,7 +170,7 @@ function searchFilter() { }); } -function updatePage(val:number){ +function updatePage(val: number) { formFilter.page = val; searchFilter(); } @@ -243,14 +277,14 @@ watch( v-model:selected="selected" for="table" ref="table" - :columns="store.columns" - :rows="store.rows" + :columns="columns" + :rows="rows" row-key="id" flat bordered dense class="custom-header-table" - :visible-columns="store.visibleColumns" + :visible-columns="visibleColumns" v-model:pagination="pagination" :rows-per-page-options="[20, 25, 50, 100]" @update:pagination="updatePageSize" diff --git a/src/modules/15_development/store/developmentStore.ts b/src/modules/15_development/store/developmentStore.ts index 3db675066..a47b307d6 100644 --- a/src/modules/15_development/store/developmentStore.ts +++ b/src/modules/15_development/store/developmentStore.ts @@ -8,6 +8,7 @@ import type { FormAddProject } from "@/modules/15_development/interface/request/ export const useDevelopmentDataStore = defineStore( "developmentDataStore", () => { + const statusEdit = ref(false) const formAddProject = reactive({ year: new Date().getFullYear(), //ปีงบประมาณ* projectName: "", //ชื่อโครงการ/กิจกรรม/หลักสูตร* @@ -142,6 +143,7 @@ export const useDevelopmentDataStore = defineStore( visibleColumns, columns, rows, + statusEdit, }; } ); diff --git a/src/modules/15_development/store/developmentStoreHistory.ts b/src/modules/15_development/store/developmentStoreHistory.ts deleted file mode 100644 index b58c75b65..000000000 --- a/src/modules/15_development/store/developmentStoreHistory.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { defineStore } from "pinia"; -import { reactive } from "vue"; -import { ref } from 'vue' -import type { QTableProps } from "quasar"; - -// store -export const useDevelopmentDataStoreHistory = defineStore( - "developmentDataStoreHistory", - () => { - const visibleColumns = ref([]); - const columns = ref([]); - const rows = ref([]) - - const status = ref(false) - return { - visibleColumns, - columns, - rows, - status, - }; - } -); diff --git a/src/modules/15_development/views/EmployeeHistory.vue b/src/modules/15_development/views/EmployeeHistory.vue index cd8997179..e1f2243a0 100644 --- a/src/modules/15_development/views/EmployeeHistory.vue +++ b/src/modules/15_development/views/EmployeeHistory.vue @@ -10,7 +10,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; /** importStore*/ -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; import { useRoute, useRouter } from "vue-router"; @@ -36,7 +36,7 @@ const formFilter = reactive({ /** use*/ const router = useRouter(); -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const $q = useQuasar(); const { showLoader, hideLoader, messageError } = useCounterMixin(); @@ -126,13 +126,13 @@ const columns = ref([ ]); function onAdd() { - store.status = false; + store.statusEdit = false; router.push(`/development/employee-history/add`); } function onDownload() {} function onEdit(id: string) { - store.status = true; + store.statusEdit = true; router.push(`/development/employee-history/${id}`); } diff --git a/src/modules/15_development/views/History.vue b/src/modules/15_development/views/History.vue index 9b572a66e..4fbe02eb2 100644 --- a/src/modules/15_development/views/History.vue +++ b/src/modules/15_development/views/History.vue @@ -10,7 +10,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; /** importStore*/ -import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory"; +import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; import { useRoute, useRouter } from "vue-router"; @@ -36,7 +36,7 @@ const formFilter = reactive({ /** use*/ const router = useRouter(); -const store = useDevelopmentDataStoreHistory(); +const store = useDevelopmentDataStore(); const $q = useQuasar(); const { showLoader, hideLoader, messageError } = useCounterMixin(); @@ -135,13 +135,13 @@ const columns = ref([ ]); function onAdd() { - store.status = false; + store.statusEdit = false; router.push(`/development/history/add`); } function onDownload() {} function onEdit(id: string) { - store.status = true; + store.statusEdit = true; router.push(`/development/history/${id}`); }