Merge branch 'develop' into warunee-dev

This commit is contained in:
Warunee Tamkoo 2023-07-25 11:05:18 +07:00
commit 69d130bdd8
6 changed files with 73 additions and 61 deletions

View file

@ -485,7 +485,7 @@ const OriginalDataFetch = async () => {
//
const redirectToPage = (id?: number) => {
router.push(`/retirement/dismiss-order/add`);
router.push(`/dismiss-order/addorder`);
};
const clickDelete = (id: string) => {

View file

@ -32,7 +32,7 @@ export default [
},
},
{
path: "/retirement/list/:id",
path: "/retirement/list/:id/:year",
name: "retirement/list/id",
component: Listretirement,
meta: {
@ -92,7 +92,7 @@ export default [
},
},
{
path: "retirement/dismiss-order/add",
path: "/dismiss-order/addorder",
name: "dismiss-order-add",
component: addOrder,
meta: {

View file

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