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

@ -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
>