ลบ store ออก

This commit is contained in:
STW_TTTY\stwtt 2024-04-04 14:20:39 +07:00
parent 55ce294f79
commit 18a151716e
10 changed files with 269 additions and 356 deletions

View file

@ -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<string>(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<boolean>(false);
const modalDialogProject = ref<boolean>(false);
@ -89,131 +89,12 @@ const fieldLabelsProject = {
organizingTraining: "หน่วยงานที่รับผิดชอบจัดการอบรม",
};
const visibleColumnsGov = ref<string[]>([
"citizenId",
"name",
"position",
"type",
"level",
"positionSide",
]);
const visibleColumnsProject = ref<string[]>([
"project",
"year",
"organizingTraining",
]);
const columnsGov = ref<QTableProps["columns"]>([
{
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<QTableProps["columns"]>([
{
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)"
/>
<span>{{ store.status ? `แก้ไขประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`:`เพิ่มประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`}}</span
<span>{{ store.statusEdit ? `แก้ไขประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`:`เพิ่มประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ`}}</span
>
</div>
<q-card flat bordered>
@ -316,7 +197,7 @@ onMounted(()=>{
color="teal"
label="เลือกข้าราชการฯ"
icon="add"
@click="openDialogGov()"
@click="modalDialogGov = true"
/>
</div>
<div class="col-12"><q-separator /></div>
@ -366,7 +247,7 @@ onMounted(()=>{
color="teal"
label="เลือกโครงการ"
icon="add"
@click="openDialogProject()"
@click="modalDialogProject = true;"
/>
</div>
<div class="col-12"><q-separator /></div>

View file

@ -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<any[]>([])
const props = defineProps({
upDate: { type: Function },
});
@ -45,7 +45,7 @@ const {
showLoader,
hideLoader,
} = mixin;
const store = useDevelopmentDataStoreHistory();
const store = useDevelopmentDataStore();
const modal = defineModel<boolean>("modal", { required: true });
@ -67,6 +67,72 @@ const govOp = ref<DataOption[]>([
},
]);
const visibleColumns = ref<string[]>([
"citizenId",
"name",
"position",
"type",
"level",
"positionSide",
]);
const columns = ref<QTableProps["columns"]>([
{
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"

View file

@ -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<any[]>([])
const props = defineProps({
upDate: { type: Function },
});
@ -27,7 +29,7 @@ const {
showLoader,
hideLoader,
} = mixin;
const store = useDevelopmentDataStoreHistory();
const store = useDevelopmentDataStore();
const modal = defineModel<boolean>("modal", { required: true });
@ -70,6 +72,45 @@ const projectOp = ref<DataOption[]>([
// },
]);
const visibleColumns = ref<string[]>([
"project",
"year",
"organizingTraining",
]);
const columns = ref<QTableProps["columns"]>([
{
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"