หน้าเเรกประกาศเกษียณ
This commit is contained in:
parent
cf0fad18ef
commit
b40bd12492
2 changed files with 31 additions and 9 deletions
|
|
@ -2,5 +2,5 @@ import env from "../index";
|
|||
const retirement = `${env.API_RETIREMENT_URI}/retirement`
|
||||
|
||||
export default {
|
||||
retirement:(type:string) => `${retirement}/${type}/2023`
|
||||
retirement:(type:string,year:number) => `${retirement}/${type}/${year}`
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
indicator-color="primary"
|
||||
align="left"
|
||||
>
|
||||
<q-tab name="samun" label="ขรก.กทม.สามัญ" @click="get('officer')"/>
|
||||
<q-tab name="employee" label="ลูกจ้างประจำ" @click="get('employee')"/>
|
||||
<q-tab name="samun" label="ขรก.กทม.สามัญ" @click="getYear('officer')"/>
|
||||
<q-tab name="employee" label="ลูกจ้างประจำ" @click="getYear('employee')"/>
|
||||
</q-tabs>
|
||||
</div>
|
||||
<q-separator />
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
dense
|
||||
emit-value
|
||||
map-options
|
||||
:options="fiscalyearOP"
|
||||
:options="yearOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
lazy-rules
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, useAttrs } from "vue";
|
||||
import { onMounted, ref, useAttrs ,reactive} from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
FormMainProbation,
|
||||
|
|
@ -187,6 +187,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin"
|
||||
import type { resMain } from '@/modules/06_retirement/interface/response/Main'
|
||||
const yearOptions = reactive<any[]>([]);
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
const { messageError ,date2Thai,showLoader,hideLoader} = mixin
|
||||
|
|
@ -200,6 +201,7 @@ const pagination = ref({
|
|||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const type = ref<string>('employee')
|
||||
const visibleColumns = ref<string[]>(["no", "Date", "retireNumber"]); //ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||
|
||||
// หัวตาราง
|
||||
|
|
@ -234,16 +236,35 @@ const columns = ref<QTableProps["columns"]>([
|
|||
]);
|
||||
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
|
||||
|
||||
const rows = ref<resMain[]>([]);
|
||||
const tab = ref<any>("samun");
|
||||
const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]);
|
||||
const get = async(type:string) =>{
|
||||
const getYear = async(type:string) =>{
|
||||
|
||||
await http
|
||||
.get(config.API.yearOptions())
|
||||
.then((res)=>{
|
||||
yearOptions.length = 0;
|
||||
const response = res.data.result;
|
||||
yearOptions.push(...response);
|
||||
|
||||
console.log(yearOptions)
|
||||
const maxNumber = yearOptions.reduce((max: any, e: any) => {
|
||||
return e.id > max ? e.id : max;
|
||||
}, "");
|
||||
console.log(maxNumber)
|
||||
get(type,maxNumber)
|
||||
})
|
||||
}
|
||||
const get = async(type:string,year:number) =>{
|
||||
|
||||
await http
|
||||
.get(config.API.retirement(type))
|
||||
.get(config.API.retirement(type,year))
|
||||
.then((res)=>{
|
||||
rows.value =[]
|
||||
let data = res.data.result
|
||||
console.log(data)
|
||||
rows.value = data.map((items:resMain) =>({
|
||||
id:items.id,
|
||||
Date:date2Thai(items.createdAt),
|
||||
|
|
@ -261,7 +282,8 @@ const get = async(type:string) =>{
|
|||
|
||||
}
|
||||
onMounted(()=>{
|
||||
get
|
||||
// get
|
||||
getYear()
|
||||
})
|
||||
// หัวตาราง2
|
||||
const columns2 = ref<QTableProps["columns"]>([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue