update เกษียณ + ปิด route หน้ารายละเอียดถึงแก่กรรม
This commit is contained in:
parent
d08b3625f3
commit
97b5e63813
4 changed files with 36 additions and 39 deletions
|
|
@ -16,7 +16,10 @@ const id = route.params.id;
|
|||
const props = defineProps({
|
||||
retireld: String,
|
||||
listId: String,
|
||||
UpdateListId: Function,
|
||||
UpdateListId: {
|
||||
type: Function,
|
||||
default: () => console.log("UpdateListId"),
|
||||
},
|
||||
});
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
|
|
@ -125,11 +128,8 @@ watch(modal, () => {
|
|||
fecthlistRetire();
|
||||
}
|
||||
});
|
||||
const updateListId = (val: any) => {
|
||||
listId.value = val;
|
||||
if (props.UpdateListId) {
|
||||
props.UpdateListId(listId.value);
|
||||
}
|
||||
const updateListData = (retireld: string, pId: string) => {
|
||||
props.UpdateListId(retireld, pId);
|
||||
};
|
||||
const fecthlistRetire = async () => {
|
||||
showLoader();
|
||||
|
|
@ -199,12 +199,12 @@ const clickAdd = (props: any) => {
|
|||
persistent: true,
|
||||
})
|
||||
.onOk(async () => {
|
||||
console.log("เพิ่มข้อมูล");
|
||||
// console.log("เพิ่มข้อมูล");
|
||||
await http
|
||||
.put(config.API.profileRetire(retireld.value), { profileId: data })
|
||||
.then((res) => {
|
||||
success($q, "เพิ่มข้อมูลสำเร็จ");
|
||||
updateListId(data);
|
||||
updateListData(retireld.value, data);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
|
|||
|
|
@ -19,23 +19,23 @@ const modalNote = ref<boolean>(false);
|
|||
const note = ref<string>("");
|
||||
const retireProfileId = ref<string>("");
|
||||
const retireld = ref<string>();
|
||||
const listId = ref<string>("");
|
||||
const profileId = ref<string>("");
|
||||
|
||||
onMounted(() => {
|
||||
console.log(route.params);
|
||||
if (route.params.id === undefined) {
|
||||
// console.log(route.params);
|
||||
if (retireld_params === undefined) {
|
||||
fecthlistprofile(type_params, year_params);
|
||||
}
|
||||
if (route.params.id !== undefined) {
|
||||
} else {
|
||||
fecthlist(retireld_params);
|
||||
}
|
||||
});
|
||||
|
||||
const fecthlistprofile = async (type: any, year: any) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profile(type, year))
|
||||
.then((res: any) => {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
retireld.value = res.data.result.id;
|
||||
rows.value = res.data.result.profile.map((e: any) => ({
|
||||
id: e.id,
|
||||
|
|
@ -62,10 +62,11 @@ const fecthlist = async (id: any) => {
|
|||
await http
|
||||
.get(config.API.listRetire(id))
|
||||
.then((res: any) => {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
retireld.value = res.data.result.id;
|
||||
rows.value = res.data.result.map((e: any) => ({
|
||||
id: e.id,
|
||||
profileId: e.profileId,
|
||||
order: e.order,
|
||||
fixname: e.prefix,
|
||||
name: e.fullName,
|
||||
|
|
@ -76,7 +77,7 @@ const fecthlist = async (id: any) => {
|
|||
positionLavel: e.positionEmployeeLevel,
|
||||
bureau: e.oc,
|
||||
}));
|
||||
console.log(rows.value);
|
||||
// console.log(rows.value);
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -250,7 +251,7 @@ const visibleColumns = ref<any>([
|
|||
const filter = ref<string>("");
|
||||
|
||||
const clickDelete = (prop: any) => {
|
||||
console.log(prop.id);
|
||||
// console.log(prop.id);
|
||||
$q.dialog({
|
||||
title: "ยืนยันการลบข้อมูล",
|
||||
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
|
||||
|
|
@ -270,7 +271,7 @@ const clickDelete = (prop: any) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
if (route.params.id === undefined) {
|
||||
if (retireld_params === undefined) {
|
||||
fecthlistprofile(type_params, year_params);
|
||||
} else fecthlist(retireld_params);
|
||||
});
|
||||
|
|
@ -285,7 +286,7 @@ const fetchReason = async (val: string) => {
|
|||
await http
|
||||
.get(config.API.reasonId(val))
|
||||
.then((res: any) => {
|
||||
console.log(res.data.result);
|
||||
// console.log(res.data.result);
|
||||
|
||||
note.value = res.data.result.reason;
|
||||
retireProfileId.value = res.data.result.id;
|
||||
|
|
@ -305,7 +306,7 @@ const saveNote = () => {
|
|||
persistent: true,
|
||||
})
|
||||
.onOk(async () => {
|
||||
console.log("บันทึกข้อมูล");
|
||||
// console.log("บันทึกข้อมูล");
|
||||
await http
|
||||
.post(config.API.createnote(), {
|
||||
retireProfileId: retireProfileId.value,
|
||||
|
|
@ -330,13 +331,10 @@ const visibleNote = computed(() => {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
watch(listId, () => {
|
||||
if (route.params.id === undefined) {
|
||||
fecthlistprofile(type_params, year_params);
|
||||
} else fecthlist(retireld_params);
|
||||
});
|
||||
const UpdateListId = (newListId: string) => {
|
||||
listId.value = newListId;
|
||||
|
||||
const UpdateListId = async (retireld: string, pId: string) => {
|
||||
profileId.value = pId
|
||||
await fecthlist(retireld)
|
||||
};
|
||||
// const saveList = () => {
|
||||
// $q.dialog({
|
||||
|
|
@ -366,14 +364,13 @@ const UpdateListId = (newListId: string) => {
|
|||
// .onDismiss(() => {});
|
||||
// };
|
||||
const classrow = (prop: any) => {
|
||||
console.log(prop.id);
|
||||
if (prop.id === listId.value) {
|
||||
return "color: #26a69a ";
|
||||
if (prop.profileId === profileId.value) {
|
||||
return "color: #26a69a; border: 1px solid #26a69a;";
|
||||
} else return "";
|
||||
};
|
||||
const paging = ref<boolean>(true);
|
||||
const pagination = ref({
|
||||
sortBy: "fullname",
|
||||
sortBy: "order",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
|
|
@ -403,8 +400,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
<q-toolbar>
|
||||
<AddList
|
||||
:retireld="retireld"
|
||||
:listId="listId"
|
||||
:UpdateListId="UpdateListId"
|
||||
:profile-id="profileId"
|
||||
:update-list-id="UpdateListId"
|
||||
/>
|
||||
<!-- <q-btn flat round color="blue-12" icon="save" @click="saveList">
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { ref } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
const router = useRouter();
|
||||
// const router = useRouter();
|
||||
const pagination = ref({
|
||||
sortBy: "desc",
|
||||
descending: false,
|
||||
|
|
@ -187,7 +187,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer" @click=" router.push(`/retirement/resign/${props.rowIndex + 1}`)">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<!-- <q-td key="no" :props="props">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</q-td> -->
|
||||
|
|
|
|||
|
|
@ -246,15 +246,15 @@ const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]);
|
|||
const getYear = () => {
|
||||
yearOptions.length = 0;
|
||||
yearOptions.push(currentYear + 543);
|
||||
console.log(yearOptions);
|
||||
// console.log(yearOptions);
|
||||
get(type.value, currentYear);
|
||||
fiscalyear.value = currentYear + 543;
|
||||
};
|
||||
const get = async (type: string, year: string) => {
|
||||
const get = async (type: string, year: any) => {
|
||||
await http
|
||||
.get(config.API.retirement(type, year))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
|
||||
rows.value = [];
|
||||
let data = res.data.result;
|
||||
|
|
@ -410,7 +410,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
|
|||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
const nextPage = (prop: any) => {
|
||||
console.log(prop.id);
|
||||
// console.log(prop.id);
|
||||
|
||||
router.push(`/retirement/listretire/${prop.id}/${type.value}`);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue