no message

This commit is contained in:
setthawutttty 2023-07-25 10:54:15 +07:00
parent 576dbf9fbe
commit c28de1d33c
2 changed files with 53 additions and 55 deletions

View file

@ -32,7 +32,7 @@ export default [
}, },
}, },
{ {
path: "/retirement/list/:id", path: "/retirement/list/:id/:year",
name: "retirement/list/id", name: "retirement/list/id",
component: Listretirement, component: Listretirement,
meta: { meta: {

View file

@ -13,8 +13,12 @@
indicator-color="primary" indicator-color="primary"
align="left" align="left"
> >
<q-tab name="samun" label="ขรก.กทม.สามัญ" @click="getYear('officer')"/> <q-tab name="officer" label="ขรก.กทม.สามัญ" @click="type = 'officer'" />
<q-tab name="employee" label="ลูกจ้างประจำ" @click="getYear('employee')"/> <q-tab
name="employee"
label="ลูกจ้างประจำ"
@click="type = 'employee'"
/>
</q-tabs> </q-tabs>
</div> </div>
<q-separator /> <q-separator />
@ -37,7 +41,6 @@
:outlined="true" :outlined="true"
:hide-dropdown-icon="false" :hide-dropdown-icon="false"
style="min-width: 150px" style="min-width: 150px"
/> />
<div> <div>
<q-btn <q-btn
@ -175,7 +178,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, useAttrs ,reactive} from "vue"; import { onMounted, ref, useAttrs, reactive,watch } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
FormMainProbation, FormMainProbation,
@ -185,12 +188,12 @@ import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin" import { useCounterMixin } from "@/stores/mixin";
import type { resMain } from '@/modules/06_retirement/interface/response/Main' import type { resMain } from "@/modules/06_retirement/interface/response/Main";
const yearOptions = reactive<any[]>([]); const yearOptions = reactive<any[]>([]);
const mixin = useCounterMixin() const mixin = useCounterMixin();
const { messageError ,date2Thai,showLoader,hideLoader} = mixin const { messageError, date2Thai, showLoader, hideLoader } = mixin;
const router = useRouter(); const router = useRouter();
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
@ -201,7 +204,7 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
const type = ref<string>('employee') const type = ref<string>("officer");
const visibleColumns = ref<string[]>(["no", "Date", "retireNumber"]); // const visibleColumns = ref<string[]>(["no", "Date", "retireNumber"]); //
// //
@ -236,55 +239,42 @@ const columns = ref<QTableProps["columns"]>([
]); ]);
// () // ()
const currentYear = new Date().getFullYear();
const rows = ref<resMain[]>([]); const rows = ref<resMain[]>([]);
const tab = ref<any>("samun"); const tab = ref<any>("officer");
const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]); const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]);
const getYear = async(type:string) =>{ const getYear = () => {
yearOptions.length = 0;
await http yearOptions.push(currentYear+543);
.get(config.API.yearOptions()) console.log(yearOptions);
.then((res)=>{ get(type.value, currentYear);
yearOptions.length = 0; fiscalyear.value = currentYear+543;
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) =>{
};
const get = async (type: string, year: number) => {
await http await http
.get(config.API.retirement(type,year)) .get(config.API.retirement(type, year))
.then((res)=>{ .then((res) => {
rows.value =[] rows.value = [];
let data = res.data.result let data = res.data.result;
rows.value = data.map((items:resMain) =>({ rows.value = data.map((items: resMain) => ({
id:items.id, id: items.id,
Date:date2Thai(items.createdAt), Date: date2Thai(items.createdAt),
year:items.year, year: items.year,
retireNumber:items.round, retireNumber: items.round,
total:items.total total: items.total,
})) }));
})
}).catch((e) => { .catch((e) => {
messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader() hideLoader();
}); });
};
} onMounted(() => {
onMounted(()=>{ getYear();
// get });
getYear()
})
// 2 // 2
const columns2 = ref<QTableProps["columns"]>([ const columns2 = ref<QTableProps["columns"]>([
{ {
@ -377,12 +367,13 @@ const clickAdd = () => {
const clickClose = async () => { const clickClose = async () => {
modal.value = false; modal.value = false;
}; };
const fiscalyear = ref(["2566"]); const fiscalyear = ref<number>();
const fiscalyearOP = ref<any>([ const fiscalyearOP = ref<any>([
{ id: 1, name: "ทั้งหมด" }, { id: 1, name: "ทั้งหมด" },
{ id: 2, name: "2565" }, { id: 2, name: "2565" },
{ id: 3, name: "2565" }, { id: 3, name: "2565" },
]); ]);
// //
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
@ -405,9 +396,16 @@ const paginationLabel = (start: string, end: string, total: string) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total; if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total;
}; };
const nextPage = (val: any) => { const nextPage = () => {
router.push(`/retirement/list/${val.no}`); router.push(`/retirement/list/${type.value}/${currentYear}`);
}; };
watch(type,()=>{
console.log(type.value)
get(type.value,currentYear)
console.log("🚀 ~ file: Main.vue:417 ~ watch ~ fiscalyear:",typeof fiscalyear.value)
})
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>