hrms-mgt/src/modules/07_insignia/components/2_Manage/Tab1.vue

1061 lines
38 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import { onMounted, ref, computed, reactive } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, QForm } from "quasar";
2023-08-17 09:58:09 +07:00
import type { QTableProps } from "quasar";
2023-08-21 11:55:57 +07:00
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
2023-09-08 13:21:07 +07:00
import { useroleUserDataStore } from "@/stores/roleUser";
2023-08-21 11:55:57 +07:00
import http from "@/plugins/http";
import config from "@/app.config";
import { useRouter } from "vue-router";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import DialogInformation from "@/components/Dialogs/Information.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import btnDownloadFile from "./downloadFile.vue";
const myForm = ref<QForm>();
const router = useRouter();
const mixin = useCounterMixin();
const {
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
dialogMessageNotify,
} = mixin;
const $q = useQuasar();
2023-08-21 11:55:57 +07:00
const DataStore = useInsigniaDataStore();
2023-09-08 13:21:07 +07:00
const roleDataStore = useroleUserDataStore();
const modelPopupReject = ref<boolean>(false);
const modelPopupDelete = ref<boolean>(false);
2023-08-21 16:31:28 +07:00
const modalAdd = ref<boolean>(false);
const modalEdit = ref<boolean>(false);
const rowid = ref<string>("");
2023-08-21 16:31:28 +07:00
const organization = ref<string>("");
// หมายเหตุ
const dialogNote = ref<boolean>(false);
const dialogTitle = ref<string>("");
const dialogDesc = ref<string>("");
const typeinsigniaOptions = ref<any>(DataStore.typeinsigniaOptions);
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
// แจ้งเตือน
const dialogWarn = ref<boolean>(false);
const checkboxData = ref<any>([]);
2023-08-21 16:31:28 +07:00
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const filterOrganizationOP = ref<any>([]);
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"name",
"employeeType",
"position",
"level",
"salary",
"insigniaType",
"insigniaSend",
"insigniaLevel",
"dateSend",
"note",
"warn",
]);
// หัวตาราง
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "employeeType",
align: "left",
label: "สถานภาพ",
sortable: true,
field: "employeeType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "level",
align: "left",
label: "อันดับ/ระดับ",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "salary",
align: "left",
label: "เงินเดือน",
sortable: true,
field: "salary",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "insigniaType",
align: "left",
label: "ประเภทเครื่องราชฯ ปัจจุบัน",
sortable: true,
field: "insigniaType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "insigniaSend",
align: "left",
label: "ประเภทเครื่องราชฯ ที่ยื่นขอ",
sortable: true,
field: "insigniaSend",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "insigniaLevel",
align: "left",
label: "ชั้นเครื่องราชฯ",
sortable: true,
field: "insigniaLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateSend",
align: "left",
label: "วันที่ยื่นขอ",
sortable: true,
field: "dateSend",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "note",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "warn",
align: "left",
label: "แจ้งเตือน",
sortable: true,
field: "",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
2023-08-21 16:31:28 +07:00
const columns2 = ref<QTableProps["columns"]>([
{
name: "index",
required: true,
label: "ลำดับ",
field: "index",
align: "left",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
2023-08-21 16:31:28 +07:00
},
{
name: "citizenId",
2023-08-21 16:31:28 +07:00
required: true,
label: "เลขประจำตัวประชาชน",
field: "citizenId",
2023-08-21 16:31:28 +07:00
align: "left",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
2023-08-21 16:31:28 +07:00
},
{
name: "fullname",
2023-08-21 16:31:28 +07:00
required: true,
label: "ชื่อ-นามสกุล",
field: "fullname",
2023-08-21 16:31:28 +07:00
align: "left",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
2023-08-21 16:31:28 +07:00
},
// {
// name: "position",
// required: true,
// label: "หมายเหตุ",
// field: "position",
// align: "left",
// },
// {
// name: "level",
// required: true,
// label: "แจ้งเตื่อน",
// field: "level",
// align: "left",
// },
// {
// name: "organizationOrganization",
// required: true,
// label: "สังกัด",
// field: "organizationOrganization",
// align: "left",
// },
2023-08-21 16:31:28 +07:00
]);
2023-08-21 16:31:28 +07:00
const rows2 = ref<any[]>([]);
2023-08-17 09:58:09 +07:00
const person = ref<any>([]);
2023-08-21 11:55:57 +07:00
const props = defineProps({
tab: {
type: String,
},
roundId: {
type: String,
},
2023-08-21 16:31:28 +07:00
fecthInsigniaAll: {
type: Function,
},
fecthInsigniaByOc: {
type: Function,
},
roundName: {
type: String,
},
requestStatus: {
type: String,
},
2023-09-18 16:08:05 +07:00
fecthStat: {
type: Function,
},
2023-08-21 11:55:57 +07:00
});
2023-08-21 11:55:57 +07:00
onMounted(async () => {
organization.value = await (DataStore.agency != null
? DataStore.agency
: DataStore.typeOc);
organizationOptions.value = await DataStore.optionsTypeOc;
2023-08-21 16:31:28 +07:00
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
2023-08-21 16:31:28 +07:00
}
}
filterOrganizationOP.value = organizationOptions.value;
2023-08-21 11:55:57 +07:00
});
2023-09-19 14:58:16 +07:00
// เช็คสถานนะแสดงปุ่มเพิ่ม
const checkStatus = computed(() => {
if (
2023-09-08 13:21:07 +07:00
roleDataStore.insignia1Role &&
(DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4")
) {
return true;
} else return false;
});
// เลือกหน่วยงาน
2023-08-21 16:31:28 +07:00
const changtypeOc = () => {
if (organization.value !== null) {
props.fecthInsigniaByOc?.(
2023-08-21 16:31:28 +07:00
props.roundId,
organization.value,
"officer",
props.tab
);
}
DataStore.typeOc = organization.value;
2023-08-21 16:31:28 +07:00
};
2023-09-19 14:58:16 +07:00
// เพิ่มราชชื่อ
const clickmodalAdd = async () => {
2023-09-21 12:07:12 +07:00
let ocId = DataStore.typeOc ? DataStore.typeOc : DataStore.agency;
2023-08-21 16:31:28 +07:00
showLoader();
await fecthInsignia();
await fecthlistperson(ocId);
clearForm();
2023-08-21 16:31:28 +07:00
};
2023-09-19 14:58:16 +07:00
// เรียกรายชื่อข้าราชการตามหน่วยงานที่จะเพิ่ม
2023-08-21 16:31:28 +07:00
const fecthlistperson = async (id: string) => {
let data = [{}];
data = [
{
criteriaType: "is_retire",
criteriaValue: "false",
},
{
criteriaType: "is_probation",
criteriaValue: "false",
},
];
await http
.post(config.API.profileSearchNewOcIdType(id, "officer"), {
criterias: data,
})
.then((res) => {
let data = res.data.result.map((e: any) => ({
2023-08-21 16:31:28 +07:00
id: e.id,
citizenId: e.citizenId,
2023-08-21 16:31:28 +07:00
fullname: e.fullname == null ? "-" : e.fullname,
position: e.position == null ? "-" : e.position,
level: e.positionEmployeeLevel == null ? "-" : e.positionEmployeeLevel,
organizationOrganization: e.oc == null ? "-" : e.oc,
}));
modalAdd.value = true;
2023-09-19 14:58:16 +07:00
rows2.value = data;
2023-08-21 16:31:28 +07:00
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
2023-09-19 14:58:16 +07:00
// ยืนยันการเพิ่มราชชื่อ
const clickAdd = async () => {
dataPerson.id
? await myForm.value!.validate().then((result: boolean) => {
if (result) {
dialogConfirm(
$q,
async () => {
await addlistperson(dataPerson.id);
},
"ยืนยันการเพิ่มรายชื่อคนที่ยื่นขอพระราชทานเครื่องราชฯ",
"ต้องการยืนยันการเพิ่มรายชื่อคนที่ยื่นขอพระราชทานเครื่องราชฯ นี้หรือไม่?"
);
}
})
: dialogMessageNotify($q, "กรุณาเลือกราชชื่อที่ต้องการเพิ่ม");
2023-08-21 16:31:28 +07:00
};
2023-09-19 14:58:16 +07:00
//เพิ่มราชชื่อข้าราชการ
2023-08-21 16:31:28 +07:00
const addlistperson = async (id: string) => {
showLoader();
let data = {
profileId: id,
insigniaId: insigniaType.value,
2023-08-21 16:31:28 +07:00
insigniaPeriodId: props.roundId,
reason: reason.value,
2023-08-21 16:31:28 +07:00
};
await http
.post(config.API.insigniaCreate(), data)
.then(() => {
success($q, "เพิ่มรายชื่อสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
modalAdd.value = false;
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
hideLoader();
});
2023-08-21 11:55:57 +07:00
};
2023-09-19 14:58:16 +07:00
// เปิด POP แก้ไขเครื่องราชฯ
const clickmodalEdit = (props: any) => {
insignia.value = props.insigniaSend;
person.value = props;
modalEdit.value = true;
fecthInsignia();
};
2023-09-19 14:58:16 +07:00
// downloadfile รายชื่อข้าราชการสามัญฯ
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
2023-09-19 14:58:16 +07:00
// เรียก file รายชื่อข้าราชการสามัญฯ
const downloadFileexcel = async () => {
const findInsigniaId = DataStore.dataInsigniaType.find(
(e: any) => e.name == DataStore.typeinsignia
);
showLoader();
await http
.put(config.API.insigniaDowanload(DataStore.requestId), {
profileType:
DataStore.employeeClass == "all" ? null : DataStore.employeeClass,
InsigniaId: DataStore.typeinsignia == "all" ? null : findInsigniaId.id,
}, { responseType: "blob" })
.then(async (res) => {
await downloadFile(
res,
`รายชื่อข้าราชการสามัญฯ ${props.roundName}.xlsx`
);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
};
2023-09-19 14:58:16 +07:00
// ยืนยันการแก้ไขเครื่องราช
const clickSave = () => {
2023-08-21 16:31:28 +07:00
dialogConfirm(
$q,
async () => {
await listEdit(person.value.id);
2023-08-21 16:31:28 +07:00
},
"ยืนยันการแก้ไขเครื่องราชฯ ที่ยื่นขอ",
"ต้องการยืนยันการแก้ไขเครื่องราชฯ ที่ยื่นขอนี้หรือไม่ ?"
);
};
2023-09-19 14:58:16 +07:00
// แก้ไขเครื่องราช API
const listEdit = async (profileId: string) => {
let data: any = {
insigniaId: insignia.value,
};
2023-08-21 16:31:28 +07:00
await http
.put(config.API.insigniaEdit(profileId), data)
2023-08-21 16:31:28 +07:00
.then(() => {
success($q, "แก้ไขเครื่องราชฯ ที่ยื่นขอสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
modalEdit.value = false;
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
2023-08-21 16:31:28 +07:00
});
};
2023-09-19 14:58:16 +07:00
//เปิด POPUP ไม่ยืนขอ
const clickReject = (id: string) => {
modelPopupReject.value = true;
rowid.value = id;
};
2023-09-19 14:58:16 +07:00
// ปิด POPUP ไม่ยืนขอ
const closemodelPopupReject = () => {
modelPopupReject.value = false;
};
// ยืนยัน การไม่ยืนขอ
const savaReasonReject = (reason: string) => {
2023-09-21 12:07:12 +07:00
dialogConfirm($q, async () => {
await listreject(rowid.value, reason);
if (props.fecthStat) {
await props.fecthStat(DataStore.roundId);
}
});
2023-08-21 16:31:28 +07:00
};
2023-09-19 14:58:16 +07:00
// ยืนยัน การไม่ยืนขอ API
const listreject = async (profileId: string, reason: string) => {
2023-08-21 16:31:28 +07:00
await http
.put(config.API.insigniaReject(profileId), { reason: reason })
2023-08-21 16:31:28 +07:00
.then(() => {
success($q, "ย้ายข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
await closemodelPopupReject();
2023-08-21 16:31:28 +07:00
});
};
2023-09-19 14:58:16 +07:00
//เปิด POPUP คนที่ถูกลบ
const clickDelete = (id: string) => {
modelPopupDelete.value = true;
rowid.value = id;
};
2023-09-19 14:58:16 +07:00
// ปิด POPUP คนที่ถูกลบ
const closemodelPopupDelete = () => {
modelPopupDelete.value = false;
};
2023-09-19 14:58:16 +07:00
// ยืนยัน การลบคนที่ถูกลบ
const savaReasonDelete = (reason: string) => {
dialogConfirm(
2023-08-21 16:31:28 +07:00
$q,
async () => {
await listdelete(rowid.value, reason);
2023-09-18 16:08:05 +07:00
if (props.fecthStat) {
await props.fecthStat(DataStore.roundId);
}
2023-08-21 16:31:28 +07:00
},
"ยืนยันการลบออกข้ออมูล",
"ต้องการยืนยันการลบข้อมูลนี้หรือไม่ ?"
);
};
2023-09-19 14:58:16 +07:00
// ยืนยัน คนที่ถูกลบ API
const listdelete = async (id: string, reason: string) => {
2023-08-21 16:31:28 +07:00
await http
.put(config.API.insigniaDelete(id), { reason: reason })
2023-08-21 16:31:28 +07:00
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
await closemodelPopupDelete();
2023-08-21 16:31:28 +07:00
});
};
const dataPerson = reactive({
id: "",
position: "",
organizationOrganization: "",
level: "",
});
const reason = ref<string>("");
2023-09-24 09:14:17 +07:00
const selectPerson = (person: any) => {
dataPerson.id = person.id;
dataPerson.position = person.position;
dataPerson.organizationOrganization = person.organizationOrganization;
dataPerson.level = person.level;
};
const clearForm = () => {
2023-09-22 16:10:28 +07:00
filterKeyword2.value = "";
dataPerson.id = "";
dataPerson.position = "";
dataPerson.organizationOrganization = "";
dataPerson.level = "";
reason.value = "";
insigniaType.value = "";
};
const insignia = ref<string>("");
const insigniaOptions = ref<any>([]);
const insigniaType = ref<string>("");
2023-09-19 14:58:16 +07:00
// เรียกประเภทเครื่องราชฯ
const fecthInsignia = async () => {
await http
.get(config.API.insignia)
.then((res) => {
insigniaOptions.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
});
};
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
const filterKeyword = ref<string>("");
2023-08-21 16:31:28 +07:00
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
filterKeyword.value = "";
2023-08-21 16:31:28 +07:00
filterKeyword2.value = "";
filterRef.value.focus();
};
const pagination = ref({
sortBy: "name",
descending: false,
page: 1,
rowsPerPage: 10,
});
2023-08-21 16:31:28 +07:00
const pagination2 = ref({
sortBy: "fullname",
2023-08-21 16:31:28 +07:00
descending: false,
page: 1,
rowsPerPage: 10,
});
const paging = ref<boolean>(true);
2023-08-21 16:31:28 +07:00
const paging2 = ref<boolean>(true);
const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
const paginationLabel2 = (start: number, end: number, total: number) => {
2023-08-21 16:31:28 +07:00
if (paging2.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
const closeModalEdit = () => {
modalEdit.value = false;
};
// เปิด popup หมายเหตุ
const clickShowreson = (name: string, requestNote: string) => {
dialogTitle.value = "หมายเหตุ" + name;
dialogDesc.value = requestNote;
dialogNote.value = true;
};
// ปิด popup หมายเหตุ
const clickCloseReson = () => {
dialogNote.value = false;
};
const clickShowWarn = (
markDiscipline: boolean,
markLeave: boolean,
markRate: boolean
) => {
checkboxData.value = [
{ id: 1, name: "มีโทษทางวินัย", val: markDiscipline },
{
id: 2,
name: "ไม่ได้เลื่อนเงินเดือน/ไม่ได้เลื่อนขั้น เนื่องจากลาเกิน",
val: markLeave,
},
{
id: 3,
name: "ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี ต่ำกว่าระดับดี (น้อยกว่าร้อยละ 70)",
val: markRate,
},
];
dialogWarn.value = true;
};
const filterSelector = (val: any, update: Function, name: any) => {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "";
employeeClassOps.value = DataStore.employeeClassOps.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterOrganizationOP") {
filterOrganizationOP.value = organizationOptions.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
};
const clearInsigniaFilters = (name: string) => {
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
};
</script>
<template>
<div class="col-12 row q-pa-md">
<div class="row col-12">
<div class="row col-12 q-col-gutter-sm">
<q-select class="col-4" v-if="roleDataStore.adminRole" v-model="organization" label="หน่วยงาน" dense emit-value
map-options :options="filterOrganizationOP" option-value="id" option-label="name" lazy-rules use-input
hide-bottom-space :readonly="false" :borderless="false" :outlined="true" :hide-dropdown-icon="false"
style="min-width: 150px" @update:model-value="changtypeOc" @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'filterOrganizationOP'
)" />
<q-select class="col-1" v-model="DataStore.typeinsignia" label="ประเภทเครื่องราชฯ ที่ยืนขอ" dense emit-value
map-options :options="typeinsigniaOptions" option-value="id" option-label="name" lazy-rules hide-bottom-space
use-input :readonly="false" :borderless="false" :outlined="true" :hide-dropdown-icon="false"
style="min-width: 180px" @update:model-value="
2023-09-07 09:33:04 +07:00
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
" @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'typeinsigniaOptions'
)">
<template v-if="DataStore.typeinsignia !== 'all'" v-slot:append>
<q-icon name="cancel" @click.stop.prevent="
clearInsigniaFilters('typeinsigniaOptions'),
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
" class="cursor-pointer" />
</template>
2023-10-09 09:42:55 +07:00
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
<div>
<q-select class="col-2" v-model="DataStore.employeeClass" dense outlined lazy-rules hide-bottom-space
:label="`${'สถานภาพ'}`" emit-value use-input map-options option-label="name" :options="employeeClassOps"
option-value="id" :readonly="false" :borderless="false" style="min-width: 150px" @update:model-value="
2023-09-07 09:33:04 +07:00
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
" @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'employeeClassOps'
)">
<template v-if="DataStore.employeeClass !== 'all'" v-slot:append>
<q-icon name="cancel" @click.stop.prevent="
clearInsigniaFilters('employeeClassOps'),
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
" class="cursor-pointer" />
</template>
2023-10-09 09:42:55 +07:00
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div>
<q-btn size="md" icon="mdi-download" flat round color="primary" @click="downloadFileexcel">
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn size="12px" flat round color="add" icon="mdi-plus" @click="clickmodalAdd" v-if="(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
roleDataStore.adminRole) ||
checkStatus == true
">
<q-tooltip>เพ</q-tooltip>
</q-btn>
</div>
<q-space />
<q-input class="col-xs-12 col-sm-3 col-md-2" standout dense v-model="filterKeyword" ref="filterRef" outlined
debounce="300" placeholder="ค้นหา">
<template v-slot:append>
<q-icon v-if="filterKeyword == ''" name="search" />
<q-icon v-if="filterKeyword !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
</template>
</q-input>
<q-select v-model="visibleColumns" multiple outlined dense options-dense :display-value="$q.lang.table.columns"
emit-value map-options :options="columns" option-value="name" options-cover style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2" />
</div>
<div class="col-12 q-pt-sm">
<q-table ref="table" :columns="columns" :rows="DataStore.rows" :filter="filterKeyword" row-key="name" flat
bordered :paging="true" dense class="custom-header-table" :visible-columns="visibleColumns"
:pagination-label="paginationLabel" v-model:pagination="pagination">
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th></q-th>
<q-th auto-width v-if="(DataStore.isLock == false &&
DataStore.requestStatus == 'st5') ||
checkStatus == true
" />
<q-th v-else></q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer" @click.stop="nextPage(props.row.profileId)">
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props">
{{ props.row.citizenId }}
</q-td>
<q-td key="name" :props="props">
{{ props.row.name }}
</q-td>
<q-td key="employeeType" :props="props">
{{ props.row.employeeType }}
</q-td>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="level" :props="props">
{{ props.row.level }}
</q-td>
<q-td key="salary" :props="props">
{{ Number(props.row.salary).toLocaleString() }}
</q-td>
<q-td key="insigniaType" :props="props">
{{ props.row.insigniaType }}
</q-td>
<q-td key="insigniaSend" :props="props">
{{ props.row.insigniaSend }}
</q-td>
<q-td key="insigniaLevel" :props="props">
{{ props.row.insigniaLevel }}
</q-td>
<q-td key="dateSend" :props="props">
{{ props.row.dateSend }}
</q-td>
<q-td key="note" class="text-center">
<q-btn v-if="props.row.reason" icon="mdi-information-outline" size="12px" color="blue" flat round dense
@click.stop="clickShowreson(props.row.name, props.row.reason)">
<q-tooltip>หมายเหต</q-tooltip>
</q-btn>
</q-td>
<q-td key="warn" class="text-center" v-if="props.row.statusMark">
<q-btn icon="mdi-information-outline" size="12px" color="red" flat round dense @click.stop="
clickShowWarn(
props.row.markDiscipline,
props.row.markLeave,
props.row.markRate
)
">
<q-tooltip>แจงเตอน</q-tooltip></q-btn>
</q-td>
<q-td v-else auto-width></q-td>
2023-09-19 14:58:16 +07:00
<q-td v-close-popup auto-width v-if="(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
roleDataStore.adminRole) ||
checkStatus == true
">
<q-btn v-if="roleDataStore.adminRole ||
(roleDataStore.insignia1Role &&
(requestStatus == 'st1' || requestStatus == 'st4'))
" icon="mdi-dots-vertical" size="12px" color="grey-7" flat round dense @click.stop>
<q-menu transition-show="jump-down" transition-hide="jump-up">
2023-08-21 16:31:28 +07:00
<q-list dense style="min-width: 250px">
<q-item clickable @click.stop="clickmodalEdit(props.row)" v-close-popup>
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
2023-08-21 16:31:28 +07:00
<q-tooltip>แกไขเครองราชฯ นขอ</q-tooltip>
<q-icon color="primary" size="xs" name="mdi-pencil" />
</q-item-section>
<q-item-section>แกไขเครองราชฯ นขอ</q-item-section>
2023-08-21 16:31:28 +07:00
</q-item>
<q-item clickable @click.stop="clickReject(props.row.id)" v-close-popup>
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
2023-08-17 09:58:09 +07:00
<q-tooltip>ไมนขอ</q-tooltip>
<q-icon color="blue" size="xs" name="mdi-alert-circle-outline" />
</q-item-section>
2023-08-17 09:58:09 +07:00
<q-item-section>ไมนขอ</q-item-section>
</q-item>
<q-item clickable @click.stop="clickDelete(props.row.id)" v-close-popup>
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
2023-08-17 09:58:09 +07:00
<q-tooltip>ลบออก</q-tooltip>
<q-icon color="red" size="xs" name="mdi-delete" />
</q-item-section>
2023-08-17 09:58:09 +07:00
<q-item-section>ลบออก</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-td>
<q-td v-else auto-width></q-td>
<q-td auto-width v-if="props.row.insigniaSend == 'เหรียญจักรพรรดิมาลา'">
<btnDownloadFile :profileId="props.row.profileId" :round="DataStore.roundId"
:optionRound="DataStore.optionRound" />
2023-09-19 14:58:16 +07:00
</q-td>
<q-td v-else auto-width></q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination v-model="pagination.page" active-color="primary" color="primary" :max="scope.pagesNumber"
:max-pages="5" size="sm" boundary-links direction-links></q-pagination>
</template>
</q-table>
</div>
</div>
</div>
2023-08-21 16:31:28 +07:00
<!-- add -->
<q-dialog v-model="modalAdd">
<q-card style="width: 800px; max-width: 80vw">
2023-08-21 16:31:28 +07:00
<q-toolbar class="q-py-md">
<q-toolbar-title class="text-h6">เพมรายช </q-toolbar-title>
<q-btn icon="close" unelevated round dense @click="modalAdd = false"
style="color: #ff8080; background-color: #ffdede" />
2023-08-21 16:31:28 +07:00
</q-toolbar>
<q-separator />
<q-card-section class="q-pa-sm bg-grey-1">
<div class="row col-12 q-col-gutter-sm">
<div class="col-xs-12 col-sm-7">
<q-card flat bordered class="fit q-pa-sm">
<q-toolbar style="padding: 0">
<q-space />
<q-input borderless outlined dense debounce="300" placeholder="ค้นหา" v-model="filterKeyword2">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</q-toolbar>
<q-table flat bordered dense :rows="rows2" :columns="columns2" :filter="filterKeyword2" row-key="fullname"
class="custom-header-table" :pagination-label="paginationLabel2" v-model:pagination="pagination2">
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer" :class="{ 'text-primary': props.row.id === dataPerson.id }"
@click="selectPerson(props.row)">
<q-td style="width: 75px">{{ props.rowIndex + 1 }}</q-td>
<q-td style="width: 250px" key="citizenId" :props="props">
{{ props.row.citizenId }}
</q-td>
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination v-model="pagination2.page" color="primary" :max="scope.pagesNumber" :max-pages="5"
size="sm" boundary-links direction-links></q-pagination>
</template>
</q-table>
</q-card>
</div>
<div class="col-xs-12 col-sm-5">
<q-card flat bordered class="fit q-pa-sm">
<q-form ref="myForm">
<div class="q-pa-md">
<div class="row q-gutter-sm">
<div class="col-12">
<q-input borderless outlined dense label="ตำแหน่งในสายงาน" placeholder="ตำแหน่งในสายงาน"
v-model="dataPerson.position" readonly />
</div>
<div class="col-12">
<q-input borderless outlined dense label="สังกัด" placeholder="สังกัด"
v-model="dataPerson.organizationOrganization" readonly />
</div>
<div class="col-12">
<q-input borderless outlined dense label="ระดับ" placeholder="ระดับ " v-model="dataPerson.level"
readonly />
</div>
<div class="col-12">
<q-select v-model="insigniaType" label="ประเภทเครื่องราชฯ" dense emit-value map-options
:options="insigniaOptions" option-value="id" option-label="name" lazy-rules hide-bottom-space
:readonly="false" :borderless="false" :outlined="true" :hide-dropdown-icon="false" :rules="[
(val) => !!val || `กรุณาเลือกประเภทเครื่องราช`,
]" />
</div>
<div class="col-12">
<q-input type="textarea" class="full-width inputgreen cursor-pointer" hide-bottom-space outlined
dense lazy-rules :rules="[(val) => !!val || `กรุณากรอกหมายเหตุ`]" v-model="reason"
:label="`หมายเหตุ`" />
</div>
</div>
</div>
</q-form>
</q-card>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn dense unelevated label="บันทึก" color="public" @click="clickAdd">
<q-tooltip>นท</q-tooltip>
</q-btn>
</q-card-actions>
2023-08-21 16:31:28 +07:00
</q-card>
</q-dialog>
<!-- Edit -->
<q-dialog v-model="modalEdit" persistent>
<q-card style="width: 450px; max-width: 80vw">
<q-form ref="myForm">
<DialogHeader tittle="แก้ไขเครื่องราชฯ ที่ยื่นขอ" :close="closeModalEdit" />
<q-separator />
<q-card-section class="q-pa-sm bg-grey-1">
<div class="row col-12 q-py-md">
<q-select v-model="insignia" label="ชื่อเครื่องราชฯ" dense emit-value map-options :options="insigniaOptions"
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
:outlined="true" :hide-dropdown-icon="false" style="width: 100%" />
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn dense unelevated label="บันทึก" color="public" @click="clickSave" class="q-px-md">
<!-- icon="mdi-content-save-outline" -->
<q-tooltip>นท</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
2023-09-19 14:58:16 +07:00
<!-- popup เหตผลไมนขอ -->
<DialogPopupReason :modal="modelPopupReject" title="เหตุผลการไม่ยื่นขอ" label="หมายเหตุ"
:click-close="closemodelPopupReject" :savaForm="savaReasonReject" />
2023-09-19 14:58:16 +07:00
<!-- เหตผลทลบออก -->
<DialogPopupReason :modal="modelPopupDelete" title="เหตุผลการลบออก" label="หมายเหตุ"
:click-close="closemodelPopupDelete" :savaForm="savaReasonDelete" />
<!-- หมายเหต -->
<DialogInformation :modal="dialogNote" :title="dialogTitle" :desc="dialogDesc" :click-close="clickCloseReson" />
<!-- แจงเตอน -->
<q-dialog v-model="dialogWarn">
<q-card style="width: 800px; max-width: 80vw">
<q-toolbar class="q-py-md">
<q-toolbar-title class="text-h6">แจงเตอน </q-toolbar-title>
<q-btn icon="close" unelevated round dense v-close-popup style="color: #ff8080; background-color: #ffdede" />
</q-toolbar>
<q-separator />
<div class="q-pa-md">
<div class="q-gutter-sm">
<q-item tag="label" v-ripple v-for="list in checkboxData" :key="list.id">
<q-item-section avatar>
<q-checkbox v-model="list.val" :val="`${list.id}`" color="teal" disable />
<!-- <q-radio v-model="checkboxList" :val="list.id" color="teal" /> -->
</q-item-section>
<q-item-section>
<q-item-label>{{ list.name }}</q-item-label>
</q-item-section>
</q-item>
</div>
</div>
</q-card>
</q-dialog>
</template>