Merge branch 'nice_dev' into develop
This commit is contained in:
commit
80d48c9f1b
6 changed files with 156 additions and 84 deletions
|
|
@ -2,5 +2,6 @@ import env from "../index";
|
||||||
const development = `${env.API_URI}/development`;
|
const development = `${env.API_URI}/development`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
development,
|
/** รายการโครงการ*/
|
||||||
|
developmentMain: `${development}/main`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,18 @@ interface DataOptionCheckBox {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { DataOption, DataOptionCheckBox };
|
interface ItemsMenu {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
icon: string;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NewPagination {
|
||||||
|
descending: boolean;
|
||||||
|
page: number;
|
||||||
|
rowsPerPage: number;
|
||||||
|
sortBy: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { DataOption, DataOptionCheckBox, ItemsMenu, NewPagination };
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
interface FormQueryProject {
|
interface FormQueryListProject {
|
||||||
year: number;
|
year: number;
|
||||||
|
page: number;
|
||||||
|
pageSize: number;
|
||||||
keyword: string;
|
keyword: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,47 +47,47 @@ interface FormFollowOther {
|
||||||
address: string;
|
address: string;
|
||||||
province: string;
|
province: string;
|
||||||
budget: string;
|
budget: string;
|
||||||
accept: number|null;
|
accept: number | null;
|
||||||
receive: number|null;
|
receive: number | null;
|
||||||
approved: number|null;
|
approved: number | null;
|
||||||
budgetPay: number|null;
|
budgetPay: number | null;
|
||||||
issues:string
|
issues: string;
|
||||||
chance:string
|
chance: string;
|
||||||
effects:string
|
effects: string;
|
||||||
riskLevel:string
|
riskLevel: string;
|
||||||
riskManagement:string
|
riskManagement: string;
|
||||||
benefits:string
|
benefits: string;
|
||||||
topicsIssues:string
|
topicsIssues: string;
|
||||||
trainingStudy:string
|
trainingStudy: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormAddHistory{
|
interface FormAddHistory {
|
||||||
citizenId:string
|
citizenId: string;
|
||||||
name:string
|
name: string;
|
||||||
position:string
|
position: string;
|
||||||
type:string
|
type: string;
|
||||||
level:string
|
level: string;
|
||||||
positionSide:string
|
positionSide: string;
|
||||||
oc:string
|
oc: string;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormAddHistoryProject{
|
interface FormAddHistoryProject {
|
||||||
project:string
|
project: string;
|
||||||
year:string
|
year: string;
|
||||||
trainingStart:string
|
trainingStart: string;
|
||||||
trainingEnd:string
|
trainingEnd: string;
|
||||||
totalTraining:string
|
totalTraining: string;
|
||||||
location:string
|
location: string;
|
||||||
topic:string
|
topic: string;
|
||||||
studyStart:string
|
studyStart: string;
|
||||||
studyEnd:string
|
studyEnd: string;
|
||||||
organizingTraining:string
|
organizingTraining: string;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
FormQueryProject,
|
FormQueryListProject,
|
||||||
FormBasicinfo,
|
FormBasicinfo,
|
||||||
FormGroupTarget,
|
FormGroupTarget,
|
||||||
FormGroupRelate,
|
FormGroupRelate,
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,10 @@ interface ResLevel {
|
||||||
posLevelAuthority: string;
|
posLevelAuthority: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { ResGroup, ResLevel };
|
interface ResListProject {
|
||||||
|
id: string;
|
||||||
|
projectName: string;
|
||||||
|
year: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { ResGroup, ResLevel, ResListProject };
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,16 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { reactive } from "vue";
|
import { ref } from "vue";
|
||||||
import { ref } from 'vue'
|
|
||||||
import type { FormQueryProject } from "@/modules/15_development/interface/request/Main";
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
// store
|
// store
|
||||||
export const useDevelopmentDataStore = defineStore(
|
export const useDevelopmentDataStore = defineStore(
|
||||||
"developmentDataStore",
|
"developmentDataStore",
|
||||||
() => {
|
() => {
|
||||||
const formFilter = reactive<FormQueryProject>({
|
|
||||||
year: new Date().getFullYear(),
|
|
||||||
keyword: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const visibleColumns = ref<string[]>([]);
|
const visibleColumns = ref<string[]>([]);
|
||||||
const columns = ref<QTableProps["columns"]>([]);
|
const columns = ref<QTableProps["columns"]>([]);
|
||||||
const rows = ref<any[]>([])
|
const rows = ref<any[]>([]);
|
||||||
return {
|
return {
|
||||||
formFilter,
|
|
||||||
visibleColumns,
|
visibleColumns,
|
||||||
columns,
|
columns,
|
||||||
rows,
|
rows,
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,27 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted, reactive, watch } from "vue";
|
||||||
import { useQuasar, type QTableProps } from "quasar";
|
import { useQuasar, type QTableProps } from "quasar";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
/**importType*/
|
||||||
|
import type {
|
||||||
|
ItemsMenu,
|
||||||
|
NewPagination,
|
||||||
|
} from "@/modules/15_development/interface/index/Main";
|
||||||
|
import type { FormQueryListProject } from "@/modules/15_development/interface/request/Main";
|
||||||
|
import type { ResListProject } from "@/modules/15_development/interface/response/Main";
|
||||||
|
|
||||||
/** importStore*/
|
/** importStore*/
|
||||||
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
/** use*/
|
/** use*/
|
||||||
const store = useDevelopmentDataStore();
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { showLoader, hideLoader } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
|
||||||
/** หัวตาราง */
|
/** หัวตาราง */
|
||||||
const rows = ref<any>([]);
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "year",
|
name: "year",
|
||||||
|
|
@ -23,16 +30,17 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "year",
|
field: "year",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px ;width: 10%",
|
||||||
|
format: (val) => val + 543,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "projectName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อโครงการ/กิจกรรม/หลักสูตร",
|
label: "ชื่อโครงการ/กิจกรรม/หลักสูตร",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "name",
|
field: "projectName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px;width: 45%",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -42,12 +50,13 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "org",
|
field: "org",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px ;width: 45%",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const visibleColumns = ref<string[]>(["year", "name", "org"]);
|
const visibleColumns = ref<string[]>(["year", "projectName", "org"]);
|
||||||
|
|
||||||
const itemDownload = ref<any>([
|
/** เมนูดาวน์โหลด*/
|
||||||
|
const itemDownload = ref<ItemsMenu[]>([
|
||||||
{
|
{
|
||||||
label: "ดาวน์โหลด 1",
|
label: "ดาวน์โหลด 1",
|
||||||
value: "",
|
value: "",
|
||||||
|
|
@ -68,32 +77,63 @@ const itemDownload = ref<any>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/** formQuery*/
|
||||||
|
const formQuery = reactive<FormQueryListProject>({
|
||||||
|
year: new Date().getFullYear(),
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
keyword: "",
|
||||||
|
});
|
||||||
|
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||||
|
const rows = ref<ResListProject[]>([]); // ข้อมูลรายการ
|
||||||
|
|
||||||
|
/** funciton fetch รายการโครงการ*/
|
||||||
function fetchListProject() {
|
function fetchListProject() {
|
||||||
showLoader();
|
showLoader();
|
||||||
const data = [
|
http
|
||||||
{
|
.get(
|
||||||
id: "1",
|
config.API.developmentMain +
|
||||||
year: 2567,
|
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&year=${formQuery.year}`
|
||||||
name: "โครงการฝึกอบรมสำนักงานข้าราชการ",
|
)
|
||||||
org: "สำนักงานข้าราชการ/กองบริหารทั่วไป/กลุ่มงานช่วยนักบริหาร",
|
.then((res) => {
|
||||||
},
|
const data = res.data.result.data;
|
||||||
{
|
totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
||||||
id: "2",
|
rows.value = data;
|
||||||
year: 2567,
|
})
|
||||||
name: "โครงการฝึกอบรม",
|
.catch((err) => {
|
||||||
org: "สำนักงานข้าราชการ/กองบริหารทั่วไป/กลุ่มงานช่วยนักบริหาร",
|
messageError($q, err);
|
||||||
},
|
})
|
||||||
];
|
.finally(() => {
|
||||||
rows.value = data;
|
hideLoader();
|
||||||
setTimeout(() => {
|
});
|
||||||
hideLoader();
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* funciotn redirect to page เพิ่มหริอแก้ไข รายการโครงการ
|
||||||
|
* @param status สถานะแก่ไข
|
||||||
|
* @param id รายการโครงการ
|
||||||
|
*/
|
||||||
function onClickAddOrView(status: boolean = false, id: string = "") {
|
function onClickAddOrView(status: boolean = false, id: string = "") {
|
||||||
status ? router.push(`development/${id}`) : router.push("development/add");
|
status ? router.push(`development/${id}`) : router.push("development/add");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function updatePagination
|
||||||
|
* @param newPagination ข้อมูล Pagination ใหม่
|
||||||
|
*/
|
||||||
|
function updatePagination(newPagination: NewPagination) {
|
||||||
|
formQuery.page = 1;
|
||||||
|
formQuery.pageSize = newPagination.rowsPerPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
||||||
|
watch(
|
||||||
|
() => formQuery.pageSize,
|
||||||
|
() => {
|
||||||
|
fetchListProject();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchListProject();
|
fetchListProject();
|
||||||
});
|
});
|
||||||
|
|
@ -107,11 +147,12 @@ onMounted(() => {
|
||||||
<q-toolbar style="padding: 0px">
|
<q-toolbar style="padding: 0px">
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="store.formFilter.year"
|
v-model="formQuery.year"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
|
@update:model-value="fetchListProject"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -122,7 +163,7 @@ onMounted(() => {
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
outlined
|
outlined
|
||||||
:model-value="Number(store.formFilter.year) + 543"
|
:model-value="Number(formQuery.year) + 543"
|
||||||
:label="`${'ปีงบประมาณ'}`"
|
:label="`${'ปีงบประมาณ'}`"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
|
|
@ -172,19 +213,19 @@ onMounted(() => {
|
||||||
<q-input
|
<q-input
|
||||||
standout
|
standout
|
||||||
dense
|
dense
|
||||||
v-model="store.formFilter.keyword"
|
v-model="formQuery.keyword"
|
||||||
ref="filterRef"
|
ref="filterRef"
|
||||||
outlined
|
outlined
|
||||||
debounce="300"
|
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
|
@keyup.enter="fetchListProject"
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<q-icon v-if="store.formFilter.keyword == ''" name="search" />
|
<q-icon v-if="formQuery.keyword == ''" name="search" />
|
||||||
<q-icon
|
<q-icon
|
||||||
v-if="store.formFilter.keyword !== ''"
|
v-if="formQuery.keyword !== ''"
|
||||||
name="clear"
|
name="clear"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click="store.formFilter.keyword = ''"
|
@click="(formQuery.keyword = ''), fetchListProject()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
@ -212,12 +253,14 @@ onMounted(() => {
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
row-key="subject"
|
row-key="id"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
dense
|
dense
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
|
@update:pagination="updatePagination"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
@ -240,6 +283,19 @@ onMounted(() => {
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:pagination="scope">
|
||||||
|
<q-pagination
|
||||||
|
v-model="formQuery.page"
|
||||||
|
active-color="primary"
|
||||||
|
color="dark"
|
||||||
|
:max="Number(totalList)"
|
||||||
|
size="sm"
|
||||||
|
boundary-links
|
||||||
|
direction-links
|
||||||
|
:max-pages="5"
|
||||||
|
@update:model-value="fetchListProject"
|
||||||
|
></q-pagination>
|
||||||
|
</template>
|
||||||
</d-table>
|
</d-table>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue