Merge branch 'develop' into working / ปรับ ui เกษียณ

This commit is contained in:
Tanyalak 2023-07-27 18:14:09 +07:00
commit fef791f4b8
81 changed files with 20864 additions and 2272 deletions

View file

@ -1,13 +1,31 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const {} = mixin;
const { messageError, success, showLoader, hideLoader } = mixin;
const route = useRoute();
const type_params = route.params.type;
const id = route.params.id;
const props = defineProps({
retireld: String,
listId: String,
UpdateListId: {
type: Function,
default: () => console.log("UpdateListId"),
},
});
const modal = ref<boolean>(false);
const retireld = ref<any>();
const type = ref<any>();
const listId = ref(props.listId);
const columns = ref<any["columns"]>([
{
@ -39,10 +57,10 @@ const columns = ref<any["columns"]>([
align: "left",
},
{
name: "affiliation",
name: "organizationOrganization",
required: true,
label: "สังกัด",
field: "affiliation",
field: "organizationOrganization",
align: "left",
},
{
@ -54,51 +72,125 @@ 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>("");
const clickAdd = () => {
watch(modal, () => {
// console.log(props);
if (modal.value === true) {
retireld.value = props.retireld;
if (type_params === "officer") {
type.value = type_params;
} else type.value = "all";
fecthlistRetire();
}
});
const updateListData = (retireld: string, pId: string) => {
props.UpdateListId(retireld, pId);
};
const fecthlistRetire = async () => {
showLoader();
await http
.get(config.API.profileOrganizRoot)
.then((res) => {
const id = res.data.result[0].id;
// console.log(id);
if (id !== "") {
findlist(id);
}
})
.catch((e) => {
messageError($q, e);
});
};
const findlist = async (id: string) => {
let data = [{}];
if (type.value === "officer") {
data = [{ criteriaType: "is_retire", criteriaValue: "false" }];
} else if (type.value === "all") {
// console.log("all");
data = [
{ criteriaType: "is_retire", criteriaValue: "false" },
{ criteriaType: "employee_class", criteriaValue: "perm" },
];
}
// console.log(data);
await http
.post(config.API.profileSearchNewOcIdType(id, type.value), {
criterias: data,
})
.then((res) => {
// console.log(res.data.result);
rows.value = res.data.result.map((e: any) => ({
id: e.id,
fullname: e.fullname,
position: e.position,
level: e.positionEmployeeLevel,
organizationOrganization: e.oc,
}));
})
.catch((e) => {
console.log(e);
})
.finally(() => {
hideLoader();
});
};
const clickAdd = (props: any) => {
// console.log("props===>",props.row.id)
if (retireld.value == undefined) {
retireld.value = id;
}
let data: any = props.row.id;
console.log("retireld & profileId",retireld.value, data);
$q.dialog({
title: "ยืนยันการเพิ่มข้อมูล",
message: "ต้องการเพิ่มข้อมูลนี้ใช่หรือไม่?",
@ -109,7 +201,20 @@ const clickAdd = () => {
persistent: true,
})
.onOk(async () => {
console.log("เพิ่มข้อมูล");
// console.log("");
await http
.put(config.API.profileRetire(retireld.value), { profileId: data })
.then((res) => {
success($q, "เพิ่มข้อมูลสำเร็จ");
updateListData(retireld.value, data);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
// fecthlistRetire();
modal.value = false;
});
})
.onCancel(() => {})
.onDismiss(() => {});
@ -135,7 +240,9 @@ const paginationLabel = (start: number, end: number, total: number) => {
icon="mdi-plus"
size="md"
@click="modal = true"
></q-btn>
>
<q-tooltip>เพมรายช</q-tooltip></q-btn
>
<q-dialog v-model="modal">
<q-card style="width: 850px; max-width: 80vw" class="q-px-sm q-pb-md">
@ -194,6 +301,9 @@ const paginationLabel = (start: number, end: number, total: number) => {
<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="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
@ -201,16 +311,17 @@ 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>
<q-btn
outline
:props="props"
label="เพิ่ม"
class="text-teal-5"
@click="clickAdd"
@click="clickAdd(props)"
/>
</q-td>
</q-tr>

View file

@ -1,31 +1,110 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted, computed, watch } from "vue";
import AddList from "../ListRetirement/AddList.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRouter } from "vue-router";
const router = useRouter();
const route = useRoute();
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const {} = mixin;
const { showLoader, hideLoader, messageError, success } = mixin;
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>();
const profileId = ref<string>("");
onMounted(() => {
// console.log(route.params);
if (retireld_params === undefined) {
fecthlistprofile(type_params, year_params);
} 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);
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,
}));
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const fecthlist = async (id: any) => {
showLoader();
await http
.get(config.API.listRetire(id))
.then((res: any) => {
// 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,
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 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",
},
{
/* {
name: "fixname",
align: "left",
label: "คำนำหน้านาม",
field: "fixname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
}, */
{
name: "name",
align: "left",
@ -35,10 +114,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",
},
@ -52,11 +131,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",
},
@ -104,6 +183,12 @@ const columns = ref<any["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "note",
align: "left",
label: "",
field: "",
},
{
name: "button",
align: "left",
@ -112,59 +197,62 @@ 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",
"govOffice",
"bureau",
"note",
"button",
]);
const filter = ref<string>("");
const clickDelete = () => {
const clickDelete = (prop: any) => {
// console.log(prop.id);
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
@ -175,7 +263,19 @@ const clickDelete = () => {
persistent: true,
})
.onOk(async () => {
console.log("ลบข้อมูล");
await http
.delete(config.API.profileRetire(prop.id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (retireld_params === undefined) {
fecthlistprofile(type_params, year_params);
} else fecthlist(retireld_params);
});
})
.onCancel(() => {})
.onDismiss(() => {});
@ -183,6 +283,105 @@ const clickDelete = () => {
const backHistory = () => {
window.history.back();
};
const fetchReason = async (val: string) => {
await http
.get(config.API.reasonId(val))
.then((res: any) => {
// console.log(res.data.result);
note.value = res.data.result.reason;
retireProfileId.value = res.data.result.id;
})
.catch((e: any) => {
messageError($q, e);
});
};
const saveNote = () => {
$q.dialog({
title: "ยืนยันการบันทึกข้อมูลข้อมูล",
message: "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
// console.log("");
await http
.post(config.API.createnote(), {
retireProfileId: retireProfileId.value,
reason: note.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthlist(retireld_params);
modalNote.value = false;
});
})
.onCancel(() => {})
.onDismiss(() => {});
};
const visibleNote = computed(() => {
if (note.value === "" || note.value === undefined) {
return true;
}
});
const UpdateListId = (retireld: string, pId: string) => {
profileId.value = pId
fecthlist(retireld)
console.log("profileId",profileId.value);
};
// 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 classrow = (prop: any) => {
// if (profileId.value!=='' && prop.profileId === profileId.value) {
// return "color: #26a69a;";
// } else return "";
// };
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "order",
descending: false,
page: 1,
rowsPerPage: 10,
});
const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
</script>
<template>
@ -201,8 +400,38 @@ const backHistory = () => {
</div>
<div>
<q-card class="col-12 q-pa-md">
<q-toolbar>
<AddList />
<div class="row col-12 q-pb-sm">
<AddList
:retireld="retireld"
:profile-id="profileId"
:UpdateListId="UpdateListId"
/>
<!-- <q-btn flat round color="blue-12" icon="save" @click="saveList">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn> -->
<q-btn color="primary" flat round icon="download">
<q-menu>
<q-list style="min-width: 100px">
<q-item clickable>
<q-item-section avatar>
<q-icon color="red" name="mdi-file-pdf" />
</q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item clickable>
<q-item-section avatar>
<q-icon color="green" name="mdi-file-excel" />
</q-item-section>
<q-item-section>ไฟล .xls</q-item-section>
</q-item>
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
<q-btn flat round color="light-blue" icon="upload">
<q-tooltip>พโหลดไฟล</q-tooltip>
</q-btn>
<q-space />
<q-tabs shrink>
<q-input
@ -235,20 +464,22 @@ const backHistory = () => {
class="gt-xs q-ml-sm"
/>
</q-tabs>
</q-toolbar>
</div>
<div class="q-pa-md">
<div>
<q-table
flat
dense
bordered
:rows="rows"
:columns="columns"
row-key="name"
class="custom-header-table"
hide-bottom
:filter="filter"
:visible-columns="visibleColumns"
no-data-label="ไม่มีข้อมูล"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
@ -263,16 +494,22 @@ const backHistory = () => {
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>{{ props.rowIndex + 1 }}</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-tr
:props="props"
class="cursor-pointer"
:style="props.row.profileId === profileId && 'color: #26a69a;'"
>
<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.fixname + props.row.name }}</q-td>
<q-td class="table_ellipsis" 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
@ -286,30 +523,102 @@ const backHistory = () => {
<q-td key="govOffice" :props="props">{{
props.row.govOffice
}}</q-td>
<q-td key="bureau" :props="props">{{ props.row.bureau }}</q-td>
<q-td class="table_ellipsis" key="bureau" :props="props">{{ props.row.bureau }}</q-td>
<q-td>
<!-- <q-btn
:props="props"
flat
round
class="text-teal-5"
icon="mdi-note"
dense
v-if="retireld_params !== undefined"
@click="
fetchReason(props.row.id), (modalNote = true), (note = '')
"
>
<q-tooltip>โน</q-tooltip></q-btn
> -->
<q-btn
flat
round
color="blue"
dense
icon="mdi-file-account"
@click="router.push(`/registry/${props.row.profileId}`)"
>
<q-tooltip>อมลทะเบยนประว</q-tooltip>
</q-btn>
</q-td>
<q-td>
<q-btn
flat
round
class="text-red-14"
icon="mdi-delete"
size="md"
@click="clickDelete"
/>
<q-btn
flat
round
class="text-teal-5"
icon="mdi-eye"
size="md"
/>
dense
@click="clickDelete(props.row)"
><q-tooltip>ลบขอม</q-tooltip></q-btn
>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</div>
</q-card>
</div>
<!-- note -->
<q-dialog v-model="modalNote">
<q-card style="width: 700px; max-width: 80vw">
<q-card-section class="q-pt-none">
<q-toolbar class="q-py-md">
<q-toolbar-title class="header-text text-weight-bolder"
>กรอกเหตผล
</q-toolbar-title>
<q-btn
icon="close"
unelevated
round
dense
@click="modalNote = false"
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>
</q-card-section>
<q-card-section class="q-pt-none">
<q-input
outlined
dense
lazy-rules
v-model="note"
:rules="[(val) => !!val || 'กรุณากรอกเหตุผล']"
:label="`${'กรอกเหตุผล'}`"
type="textarea"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn
label="บักทึก"
color="secondary"
@click="saveNote"
:disable="visibleNote"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style lang="scss" scope>
@ -339,4 +648,7 @@ const backHistory = () => {
top: 0;
}
}
.q-btn-dropdown__arrow {
display: none;
}
</style>