no message

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-07-25 14:11:16 +07:00
parent a24e2298c0
commit 00f81dba34
6 changed files with 274 additions and 206 deletions

View file

@ -3,12 +3,12 @@ const retirement = `${env.API_URI}/retirement`
export default {
profile: (type: string, year: number) => `${retirement}/profile/${type}/${year}`,
profile: (type: string, year: string) => `${retirement}/profile/${type}/${year}`,
profileRetire: (retireId: string) => `${retirement}/profile/${retireId}`,
listRetire: (retireId: string) => `${retirement}/${retireId}`,
createnote: () => `${retirement}/reason/`,
createnote: () => `${retirement}/reason`,
reasonId: (retireId:string) => `${retirement}/reason/${retireId}`,
retirement:(type:string,year:number) => `${retirement}/${type}/${year}`
retirement:(type:string,year:string) => `${retirement}/${type}/${year}`

View file

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

View file

@ -9,14 +9,19 @@ const $q = useQuasar(); //ใช้ noti quasar
const mixin = useCounterMixin();
const { messageError, success } = mixin;
const props = defineProps({
retireld: String,
});
const modal = ref<boolean>(false);
const retireld = ref<any>();
const columns = ref<any["columns"]>([
{
name: "index",
name: "order",
required: true,
label: "ลำดับ",
field: "index",
field: "order",
align: "left",
},
{
@ -41,10 +46,10 @@ const columns = ref<any["columns"]>([
align: "left",
},
{
name: "affiliation",
name: "organizationOrganization",
required: true,
label: "สังกัด",
field: "affiliation",
field: "organizationOrganization",
align: "left",
},
{
@ -56,64 +61,72 @@ const columns = ref<any["columns"]>([
},
]);
const rows = ref<any>([
{
fullname: "นายใจดี ยอดใจ",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
{
fullname: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
{
fullname: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
{
fullname: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
{
fullname: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
{
fullname: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
{
fullname: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฎิบัติการ",
affiliation: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
},
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
// {
// fullname: " ",
// position: "",
// level: "",
// affiliation: " ",
// },
]);
const filter = ref<string>("");
watch(modal, () => {
if (modal.value === true) {
fecthlistRetire();
retireld.value = props.retireld;
fecthlistRetire(retireld.value);
}
});
const fecthlistRetire= async () => {
await http
.get(config.API.listRetire("1234"))
.then((res) => {
console.log(res);
})
.catch((e) => {
messageError($q, e);
});
const fecthlistRetire = async (retireld: any) => {
// await http
// .get(config.API.listRetire(retireld))
// .then((res) => {
// console.log(res);
// rows.value = res.data.result.map((e: any) => ({
// order: e.order,
// fullname: e.fullName,
// position: e.position,
// level: e.positionEmployeeLevel,
// organizationOrganization: e.organizationOrganization,
// }));
// })
// .catch((e) => {
// messageError($q, e);
// });
};
const clickAdd = () => {
$q.dialog({
@ -223,7 +236,10 @@ const paginationLabel = (start: number, end: number, total: number) => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>{{ props.rowIndex + 1 }}</q-td>
<!-- <q-td>{{ props.rowIndex + 1 }}</q-td> -->
<q-td key="order" :props="props">
{{ props.row.order }}
</q-td>
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
@ -231,8 +247,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
{{ props.row.position }}
</q-td>
<q-td key="level" :props="props">{{ props.row.level }}</q-td>
<q-td key="affiliation" :props="props">
{{ props.row.affiliation }}
<q-td key="organizationOrganization" :props="props">
{{ props.row.organizationOrganization }}
</q-td>
<q-td>

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, computed, watch } from "vue";
import { ref, onMounted, computed } from "vue";
import AddList from "../ListRetirement/AddList.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
@ -11,21 +11,69 @@ const route = useRoute();
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, success } = mixin;
const no = route.params.id;
const type_params = route.params.type;
const year_params = route.params.year;
const retireld_params = route.params.id;
const modalNote = ref<boolean>(false);
const note = ref<string>("");
const retireProfileId = ref<string>("");
const retireld = ref<string>();
onMounted(() => {
console.log(no);
fecthlist();
console.log(visibleNote.value);
console.log(route.params.id);
if (route.params.id === undefined) {
fecthlistprofile(type_params, year_params);
} else fecthlist(retireld_params);
});
const fecthlist = async () => {
const fecthlistprofile = async (type: any, year: any) => {
showLoader();
await http
.get(config.API.profile("emplayee", 2023))
.get(config.API.profile(type, year))
.then((res: any) => {
console.log(res);
retireld.value = res.data.result.id;
rows.value = res.data.result.profile.map((e: any) => ({
id: e.id,
order: e.order,
fixname: e.prefix,
name: e.fullName,
organizationOrganization: e.organizationOrganization,
positionType: e.positionType,
position: e.position,
positionNumber: e.posNoEmployee,
positionLavel: e.positionEmployeeLevel,
bureau: e.oc,
}));
console.log(rows.value);
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const fecthlist = async (id: any) => {
showLoader();
await http
.get(config.API.listRetire(id))
.then((res: any) => {
console.log(res);
retireld.value = res.data.result.id;
rows.value = res.data.result.map((e: any) => ({
id: e.id,
order: e.order,
fixname: e.prefix,
name: e.fullName,
organizationOrganization: e.organizationOrganization,
positionType: e.positionType,
position: e.position,
positionNumber: e.posNoEmployee,
positionLavel: e.positionEmployeeLevel,
bureau: e.oc,
}));
console.log(rows.value);
})
.catch((e: any) => {
messageError($q, e);
@ -36,10 +84,10 @@ const fecthlist = async () => {
};
const columns = ref<any["columns"]>([
{
name: "index",
name: "order",
required: true,
label: "ลำดับ",
field: "index",
field: "order",
align: "left",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -61,10 +109,10 @@ const columns = ref<any["columns"]>([
style: "font-size: 14px",
},
{
name: "brand",
name: "organizationOrganization",
align: "left",
label: "สังกัด",
field: "brand",
field: "organizationOrganization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -78,11 +126,11 @@ const columns = ref<any["columns"]>([
style: "font-size: 14px",
},
{
name: "positionManager",
name: "position",
align: "left",
label: "ตำแหน่ง ",
sublabel: "ทางการบริหาร",
field: "positionManager",
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -144,49 +192,50 @@ const columns = ref<any["columns"]>([
},
]);
const rows = ref<any>([
{
fixname: "นางสาว",
name: "รัชภรณ์ ภัคดี",
brand: "ฝ่ายบริหารทั่วไป",
positionType: "บริหาร",
positionManager: "จัดการทั่วไป",
positionLavel: "ชำนาญการ",
positionNumber: "กบห.2",
govGroup: "ฝ่ายบริหารทั่วไป",
govOffice: "ฝ่ายบริหารทั่วไป",
bureau: "บริหาร",
},
{
fixname: "นางสาว",
name: "รัชภรณ์ ภัคดี",
brand: "ฝ่ายบริหารทั่วไป",
positionType: "บริหาร",
positionManager: "จัดการทั่วไป",
positionLavel: "ชำนาญการ",
positionNumber: "กบห.2",
govGroup: "ฝ่ายบริหารทั่วไป",
govOffice: "ฝ่ายบริหารทั่วไป",
bureau: "บริหาร",
},
{
fixname: "นางสาว",
name: "รัชภรณ์ ภัคดี",
brand: "ฝ่ายบริหารทั่วไป",
positionType: "บริหาร",
positionManager: "จัดการทั่วไป",
positionLavel: "ชำนาญการ",
positionNumber: "กบห.2",
govGroup: "ฝ่ายบริหารทั่วไป",
govOffice: "ฝ่ายบริหารทั่วไป",
bureau: "บริหาร",
},
// {
// fixname: "",
// name: " ",
// brand: "",
// positionType: "",
// positionManager: "",
// positionLavel: "",
// positionNumber: ".2",
// govGroup: "",
// govOffice: "",
// bureau: "",
// },
// {
// fixname: "",
// name: " ",
// brand: "",
// positionType: "",
// positionManager: "",
// positionLavel: "",
// positionNumber: ".2",
// govGroup: "",
// govOffice: "",
// bureau: "",
// },
// {
// fixname: "",
// name: " ",
// brand: "",
// positionType: "",
// positionManager: "",
// positionLavel: "",
// positionNumber: ".2",
// govGroup: "",
// govOffice: "",
// bureau: "",
// },
]);
const visibleColumns = ref<any>([
"order",
"fixname",
"name",
"brand",
"organizationOrganization",
"positionType",
"positionManager",
"position",
"positionLavel",
"positionNumber",
"govGroup",
@ -198,7 +247,7 @@ const visibleColumns = ref<any>([
const filter = ref<string>("");
const clickDelete = (prop: any) => {
// console.log(prop);
console.log(prop.id);
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
@ -210,7 +259,7 @@ const clickDelete = (prop: any) => {
})
.onOk(async () => {
await http
.delete(config.API.profileRetire("123"))
.delete(config.API.profileRetire(prop.id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
@ -218,7 +267,9 @@ const clickDelete = (prop: any) => {
messageError($q, e);
})
.finally(() => {
fecthlist();
if (route.params.id === undefined) {
fecthlistprofile(type_params, year_params);
} else fecthlist(retireld_params);
});
})
.onCancel(() => {})
@ -227,26 +278,21 @@ const clickDelete = (prop: any) => {
const backHistory = () => {
window.history.back();
};
watch(modalNote, () => {
if (modalNote.value === true) {
fetchReason();
}
});
const fetchReason = async () => {
const fetchReason = async (val: string) => {
await http
.get(config.API.reasonId("123"))
.get(config.API.reasonId(val))
.then((res: any) => {
console.log(res);
console.log(res.data.result);
note.value = res.data.result.reason;
retireProfileId.value = res.data.result.id;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const saveNote = () => {
console.log(note.value);
$q.dialog({
title: "ยืนยันการบันทึกข้อมูลข้อมูล",
message: "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่?",
@ -259,15 +305,19 @@ const saveNote = () => {
.onOk(async () => {
console.log("บันทึกข้อมูล");
await http
.post(config.API.createnote(), note.value)
.post(config.API.createnote(), {
retireProfileId: retireProfileId.value,
reason: note.value,
})
.then(() => {
success($q, "บันทึกข้อมูล");
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthlist();
fecthlist(retireld_params);
modalNote.value = false;
});
})
.onCancel(() => {})
@ -278,33 +328,33 @@ const visibleNote = computed(() => {
return true;
}
});
const saveList = () => {
$q.dialog({
title: "ยืนยันกาบันทึกข้อมูล",
message: "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
const retireld = "1233444";
await http
.post(config.API.listRetire("123"), { retireld: retireld })
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthlist();
});
})
.onCancel(() => {})
.onDismiss(() => {});
};
// const saveList = () => {
// $q.dialog({
// title: "",
// message: "?",
// cancel: {
// flat: true,
// color: "negative",
// },
// persistent: true,
// })
// .onOk(async () => {
// const retireld = "1233444";
// await http
// .post(config.API.listRetire("123"), { retireld: retireld })
// .then(() => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// fecthlist();
// });
// })
// .onCancel(() => {})
// .onDismiss(() => {});
// };
</script>
<template>
@ -324,10 +374,10 @@ const saveList = () => {
<div>
<q-card class="col-12 q-pa-md">
<q-toolbar>
<AddList />
<q-btn flat round color="blue-12" icon="save" @click="saveList">
<AddList :retireld="retireld" />
<!-- <q-btn flat round color="blue-12" icon="save" @click="saveList">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-btn> -->
<q-btn color="primary" flat round icon="download">
<q-menu>
<q-list style="min-width: 100px">
@ -412,15 +462,17 @@ const saveList = () => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>{{ props.rowIndex + 1 }}</q-td>
<q-td key="order" :props="props">{{ props.row.order }}</q-td>
<q-td key="fixname" :props="props">{{ props.row.fixname }}</q-td>
<q-td key="name" :props="props">{{ props.row.name }}</q-td>
<q-td key="brand" :props="props">{{ props.row.brand }}</q-td>
<q-td key="organizationOrganization" :props="props">{{
props.row.organizationOrganization
}}</q-td>
<q-td key="positionType" :props="props">{{
props.row.positionType
}}</q-td>
<q-td key="positionManager" :props="props">{{
props.row.positionManager
<q-td key="position" :props="props">{{
props.row.position
}}</q-td>
<q-td key="positionLavel" :props="props">{{
props.row.positionLavel
@ -443,8 +495,10 @@ const saveList = () => {
class="text-teal-5"
icon="mdi-note"
size="md"
v-if="no !== undefined"
@click="(modalNote = true), (note = '')"
v-if="retireld_params !== undefined"
@click="
fetchReason(props.row.id), (modalNote = true), (note = '')
"
>
<q-tooltip>โน</q-tooltip></q-btn
>

View file

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

View file

@ -51,7 +51,7 @@
color="add"
icon="mdi-plus"
>
<q-tooltip>เพทดลองปฏหนาทราชการ</q-tooltip>
<q-tooltip>เพ</q-tooltip>
</q-btn>
<!-- <q-menu>
<q-list style="min-width: 100px">
@ -178,7 +178,7 @@
</template>
<script setup lang="ts">
import { onMounted, ref, useAttrs, reactive,watch } from "vue";
import { onMounted, ref, useAttrs, reactive, watch } from "vue";
import type { QTableProps } from "quasar";
import type {
FormMainProbation,
@ -243,18 +243,19 @@ const currentYear = new Date().getFullYear();
const rows = ref<resMain[]>([]);
const tab = ref<any>("officer");
const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]);
const getYear = () => {
const getYear = () => {
yearOptions.length = 0;
yearOptions.push(currentYear+543);
yearOptions.push(currentYear + 543);
console.log(yearOptions);
get(type.value, currentYear);
fiscalyear.value = currentYear+543;
fiscalyear.value = currentYear + 543;
};
const get = async (type: string, year: number) => {
const get = async (type: string, year: string) => {
await http
.get(config.API.retirement(type, year))
.then((res) => {
console.log(res);
rows.value = [];
let data = res.data.result;
rows.value = data.map((items: resMain) => ({
@ -265,9 +266,7 @@ const get = async (type: string, year: number) => {
total: items.total,
}));
})
.catch((e) => {
})
.catch((e) => {})
.finally(() => {
hideLoader();
});
@ -345,24 +344,24 @@ const rows2 = ref<FormMainProbation2[]>([
},
]);
const clickDelete = (id: string) => {
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {})
.onCancel(() => {})
.onDismiss(() => {});
};
// const clickDelete = (id: string) => {
// $q.dialog({
// title: "",
// message: "?",
// cancel: {
// flat: true,
// color: "negative",
// },
// persistent: true,
// })
// .onOk(async () => {})
// .onCancel(() => {})
// .onDismiss(() => {});
// };
const clickAdd = () => {
// modal.value = true;
router.push("/retirement/list");
router.push(`/retirement/list/${type.value}/${currentYear}`);
};
const clickClose = async () => {
modal.value = false;
@ -396,16 +395,15 @@ const paginationLabel = (start: string, end: string, total: string) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
const nextPage = () => {
router.push(`/retirement/list/${type.value}/${currentYear}`);
const nextPage = (prop: any) => {
console.log(prop.id);
router.push(`/retirement/list/${prop.id}`);
};
watch(type,()=>{
console.log(type.value)
get(type.value,currentYear)
console.log("🚀 ~ file: Main.vue:417 ~ watch ~ fiscalyear:",typeof fiscalyear.value)
})
watch(type, () => {
get(type.value, currentYear);
});
</script>
<style lang="scss" scope>