Compare commits
No commits in common. "dev" and "v1.1.13" have entirely different histories.
145 changed files with 1003 additions and 4844 deletions
|
|
@ -30,13 +30,11 @@
|
||||||
"axios": "^1.6.7",
|
"axios": "^1.6.7",
|
||||||
"bma-org-chart": "^0.0.8",
|
"bma-org-chart": "^0.0.8",
|
||||||
"esri-loader": "^3.7.0",
|
"esri-loader": "^3.7.0",
|
||||||
"exceljs": "^4.4.0",
|
|
||||||
"html-to-image": "^1.11.13",
|
"html-to-image": "^1.11.13",
|
||||||
"keycloak-js": "^20.0.2",
|
"keycloak-js": "^20.0.2",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"pinia": "^2.0.29",
|
"pinia": "^2.0.29",
|
||||||
"pinia-plugin-persistedstate": "^3.2.3",
|
|
||||||
"quasar": "^2.11.1",
|
"quasar": "^2.11.1",
|
||||||
"socket.io-client": "^4.7.4",
|
"socket.io-client": "^4.7.4",
|
||||||
"structure-chart": "^0.0.9",
|
"structure-chart": "^0.0.9",
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -192,9 +192,6 @@ export default {
|
||||||
`${orgProfile}/keycloak/permissionProfile/${rootId}`,
|
`${orgProfile}/keycloak/permissionProfile/${rootId}`,
|
||||||
profileidPosition: (type: string) =>
|
profileidPosition: (type: string) =>
|
||||||
`${orgProfile}${type}/profileid/position`,
|
`${orgProfile}${type}/profileid/position`,
|
||||||
uploadProfile: (type: string, id: string) =>
|
|
||||||
`${organization}/upload/${type}-profileSalaryTemp/${id}`,
|
|
||||||
sortOrderByDate: `${orgProfile}/salaryTemp/sort-order`,
|
|
||||||
|
|
||||||
workflowCommanderOperate: `${workflow}/commander/operate`,
|
workflowCommanderOperate: `${workflow}/commander/operate`,
|
||||||
workflowCommanderSign: `${workflow}/commander/sign`,
|
workflowCommanderSign: `${workflow}/commander/sign`,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ export default {
|
||||||
placementDefermentInfo: (id: string) => `${placement}/pass/deferment/${id}`,
|
placementDefermentInfo: (id: string) => `${placement}/pass/deferment/${id}`,
|
||||||
placementDisclaimInfo: (id: string) => `${placement}/pass/disclaim/${id}`,
|
placementDisclaimInfo: (id: string) => `${placement}/pass/disclaim/${id}`,
|
||||||
placementUpdatePass: `${placement}/pass/update-status`,
|
placementUpdatePass: `${placement}/pass/update-status`,
|
||||||
placementUpdateDraftStatus: `${placement}/update/draft-status`,
|
|
||||||
|
|
||||||
//personal
|
//personal
|
||||||
placementPersonalId: (personalId: string) =>
|
placementPersonalId: (personalId: string) =>
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,4 @@ export default {
|
||||||
|
|
||||||
leaveReportAPI: (type: string) =>
|
leaveReportAPI: (type: string) =>
|
||||||
`${leave}/report/download/time-records/${type}`,
|
`${leave}/report/download/time-records/${type}`,
|
||||||
|
|
||||||
leaveTask: `${leave}/admin/leave-task/process`,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,4 @@ export default {
|
||||||
|
|
||||||
applicationFormPDF: (candidateId: string) =>
|
applicationFormPDF: (candidateId: string) =>
|
||||||
`${env.API_URI}/placement/candidate/pdf/${candidateId}`,
|
`${env.API_URI}/placement/candidate/pdf/${candidateId}`,
|
||||||
|
|
||||||
downloadCandidateExam: (id: string) =>
|
|
||||||
`${periodExam}download/candidate-exam/${id}`,
|
|
||||||
downloadPassExam: (id: string) => `${periodExam}download/pass-exam/${id}`,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ export default {
|
||||||
uploadCandidates: (id: string) => `${recruit}candidate/${id}`,
|
uploadCandidates: (id: string) => `${recruit}candidate/${id}`,
|
||||||
uploadResult: (id: string) => `${recruit}result/${id}`,
|
uploadResult: (id: string) => `${recruit}result/${id}`,
|
||||||
getImportHistory: (id: string) => `${recruit}history/${id}`,
|
getImportHistory: (id: string) => `${recruit}history/${id}`,
|
||||||
getImportStatus: (jobId: string) => `${recruit}import/status/${jobId}`,
|
|
||||||
|
|
||||||
//upload
|
//upload
|
||||||
periodRecruitDoc: (examId: string) => `${recruit}doc/${examId}`,
|
periodRecruitDoc: (examId: string) => `${recruit}doc/${examId}`,
|
||||||
|
|
|
||||||
|
|
@ -272,10 +272,4 @@ export default {
|
||||||
profileAssistanceReturn: `${env.API_URI}/placement/repatriation`,
|
profileAssistanceReturn: `${env.API_URI}/placement/repatriation`,
|
||||||
profileAssistanceUpdateDelete: (type: string) =>
|
profileAssistanceUpdateDelete: (type: string) =>
|
||||||
`${registryNew}${type}/assistance/update-delete/`,
|
`${registryNew}${type}/assistance/update-delete/`,
|
||||||
|
|
||||||
profileAbsentLate: (type: string) => `${registryNew}${type}/absent-late`,
|
|
||||||
profileAbsentLateUpdateDelete: (type: string) => `${registryNew}${type}/absent-late/update-delete`,
|
|
||||||
profileAbsentLateHistory: (id: string, type: string) =>
|
|
||||||
`${registryNew}${type}/absent-late/history/${id}`,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,9 @@ async function fetchDataProfile(data: DataProfile) {
|
||||||
profile.avatar = data?.avatar ? data.avatar : "";
|
profile.avatar = data?.avatar ? data.avatar : "";
|
||||||
}
|
}
|
||||||
profile.id = data.profileId;
|
profile.id = data.profileId;
|
||||||
profile.fullName = `${data.rank ? data.rank : data.prefix ?? ""}${
|
profile.fullName = `${data.prefix ?? ""}${data.firstName ?? ""} ${
|
||||||
data.firstName ?? ""
|
data.lastName ?? ""
|
||||||
} ${data.lastName ?? ""} `;
|
} `;
|
||||||
|
|
||||||
if (data["posTypeNameOld"] !== undefined) {
|
if (data["posTypeNameOld"] !== undefined) {
|
||||||
profile.position =
|
profile.position =
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ watch(
|
||||||
outlined
|
outlined
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
@update:model-value="(rows = []), (selected = [])"
|
@update:model-value="rows = []"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -332,7 +332,6 @@ watch(
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
label="คำค้น"
|
label="คำค้น"
|
||||||
@keydown.enter.prevent="searchInput()"
|
|
||||||
>
|
>
|
||||||
<template v-slot:after>
|
<template v-slot:after>
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import FooterContact from "@/components/FooterContact.vue";
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = usePositionKeycloakStore();
|
const store = usePositionKeycloakStore();
|
||||||
|
|
@ -354,11 +353,6 @@ function onClose() {
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row col-12 q-col-gutter-sm">
|
<div class="row col-12 q-col-gutter-sm">
|
||||||
<div class="col-12">
|
|
||||||
<div class="text-caption text-grey-8">
|
|
||||||
ผู้ดูแลระบบจะติดต่อกลับผ่านทางอีเมลที่ท่านระบุ กรุณาตรวจสอบอีเมลของท่านเป็นระยะ
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12 col-md-6 col-lg-6">
|
<div class="col-xs-12 col-md-6 col-lg-6">
|
||||||
<q-input
|
<q-input
|
||||||
dense
|
dense
|
||||||
|
|
@ -368,11 +362,10 @@ function onClose() {
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:rules="[
|
:rules="[
|
||||||
(val: string) => !!val || 'กรุณากรอกที่อยู่อีเมล',
|
() =>
|
||||||
(val: string) => {
|
!!formData.email ||
|
||||||
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
!!formData.phone ||
|
||||||
return emailPattern.test(val) || 'กรุณากรอกที่อยู่อีเมลในรูปแบบที่ถูกต้อง';
|
'กรุณากรอกอีเมลหรือเบอร์โทรติดต่อกลับ',
|
||||||
}
|
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -384,6 +377,12 @@ function onClose() {
|
||||||
v-model="formData.phone"
|
v-model="formData.phone"
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
:rules="[
|
||||||
|
() =>
|
||||||
|
!!formData.email ||
|
||||||
|
!!formData.phone ||
|
||||||
|
'กรุณากรอกอีเมลหรือเบอร์โทรติดต่อกลับ',
|
||||||
|
]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -392,11 +391,7 @@ function onClose() {
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-actions class="q-px-sm items-center">
|
<q-card-actions align="right">
|
||||||
<div class="row items-center q-pa-sm">
|
|
||||||
<FooterContact />
|
|
||||||
</div>
|
|
||||||
<q-space />
|
|
||||||
<q-btn
|
<q-btn
|
||||||
type="submit"
|
type="submit"
|
||||||
for="#submitForm"
|
for="#submitForm"
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataRows: {
|
dataRows: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
require: true,
|
||||||
},
|
},
|
||||||
onSubmit: Function,
|
onSubmit: Function,
|
||||||
});
|
});
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const storeTree = useStructureTree();
|
const storeTree = useStructureTree();
|
||||||
const { fetchStructureTree } = storeTree;
|
const { fetchStructureTree } = useStructureTree();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const {
|
const {
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
|
|
@ -47,10 +47,10 @@ const {
|
||||||
/** props*/
|
/** props*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const title = defineModel<string>("title", { required: true });
|
const title = defineModel<string>("title", { required: true });
|
||||||
const type = defineModel<string | null>("type", { required: true });
|
const type = defineModel<any>("type", { required: true });
|
||||||
const posType = defineModel<string | null>("posType", { required: true });
|
const posType = defineModel<any>("posType", { required: true });
|
||||||
const posLevel = defineModel<string | null>("posLevel", { required: true });
|
const posLevel = defineModel<any>("posLevel", { required: true });
|
||||||
const position = defineModel<string | null>("position", { required: true });
|
const position = defineModel<any>("position", { required: true });
|
||||||
|
|
||||||
// const routeName = ref<string>(route?.name);
|
// const routeName = ref<string>(route?.name);
|
||||||
const orgRevisionId = ref<string>("");
|
const orgRevisionId = ref<string>("");
|
||||||
|
|
@ -64,7 +64,7 @@ const itemTaps = ref<string[]>();
|
||||||
const filters = ref<string>("");
|
const filters = ref<string>("");
|
||||||
const positionId = ref<string>("");
|
const positionId = ref<string>("");
|
||||||
const selectedPos = ref<any[]>([]);
|
const selectedPos = ref<any[]>([]);
|
||||||
const selectId = ref<string>("");
|
const seletcId = ref<string>("");
|
||||||
const datePos = ref<Date>(new Date());
|
const datePos = ref<Date>(new Date());
|
||||||
const rowsPosition = ref<Positions[]>([]);
|
const rowsPosition = ref<Positions[]>([]);
|
||||||
const positionData = ref<any[]>([]);
|
const positionData = ref<any[]>([]);
|
||||||
|
|
@ -79,6 +79,7 @@ const formActive = reactive<FormActive>({
|
||||||
});
|
});
|
||||||
/** node */
|
/** node */
|
||||||
const nodes = ref<Array<OrgTree>>([]);
|
const nodes = ref<Array<OrgTree>>([]);
|
||||||
|
const lazy = ref(nodes);
|
||||||
const expanded = ref<string[]>([]);
|
const expanded = ref<string[]>([]);
|
||||||
const nodeLevel = ref<number>(0);
|
const nodeLevel = ref<number>(0);
|
||||||
const nodeId = ref<string>(""); // id ของ Tree
|
const nodeId = ref<string>(""); // id ของ Tree
|
||||||
|
|
@ -149,7 +150,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const columnsPosition = ref<QTableProps["columns"]>([
|
const columnsPostition = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "no",
|
name: "no",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -180,7 +181,7 @@ const columnsPosition = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "posTypeName",
|
name: "posTypeName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ประเภทตำแหน่ง",
|
label: "ประเภทตำเเหน่ง",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "posTypeName",
|
field: "posTypeName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -243,16 +244,10 @@ function close() {
|
||||||
expanded.value = [];
|
expanded.value = [];
|
||||||
nodeLevel.value = 0;
|
nodeLevel.value = 0;
|
||||||
nodeId.value = "";
|
nodeId.value = "";
|
||||||
positionData.value = [];
|
|
||||||
positionNo.value = [];
|
|
||||||
rowData.value = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDataTable(id: string, level: number = 0) {
|
async function getDataTable(id: string, level: number = 0) {
|
||||||
showLoader();
|
showLoader();
|
||||||
positionData.value = [];
|
|
||||||
positionNo.value = [];
|
|
||||||
rowData.value = [];
|
|
||||||
const body = {
|
const body = {
|
||||||
node: level,
|
node: level,
|
||||||
nodeId: id,
|
nodeId: id,
|
||||||
|
|
@ -266,7 +261,7 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
|
|
||||||
await http
|
await http
|
||||||
.post(config.API.orgPosPlacement, body)
|
.post(config.API.orgPosPlacement, body)
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
const dataMain: PositionMain[] = [];
|
const dataMain: PositionMain[] = [];
|
||||||
posMasterMain.value = res.data.result.data;
|
posMasterMain.value = res.data.result.data;
|
||||||
|
|
||||||
|
|
@ -304,6 +299,7 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
|
|
||||||
positionNo.value = listPosNo;
|
positionNo.value = listPosNo;
|
||||||
rowData.value = listPosNo;
|
rowData.value = listPosNo;
|
||||||
|
// positionData.value = listPosNo;
|
||||||
|
|
||||||
if (props.dataRows?.posmasterId) {
|
if (props.dataRows?.posmasterId) {
|
||||||
const newUse = positionUse.value.filter(
|
const newUse = positionUse.value.filter(
|
||||||
|
|
@ -317,13 +313,14 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
(e: any) => !positionUse.value.includes(e.id)
|
(e: any) => !positionUse.value.includes(e.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await onClickSelectPos(positionId.value);
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
setTimeout(() => {
|
||||||
|
hideLoader();
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,11 +331,11 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
function updateSelected(data: DataTree) {
|
function updateSelected(data: DataTree) {
|
||||||
if (props?.dataRows?.nodeId === data.orgTreeId) {
|
if (props?.dataRows?.nodeId === data.orgTreeId) {
|
||||||
positionId.value = props?.dataRows?.posmasterId;
|
positionId.value = props?.dataRows?.posmasterId;
|
||||||
selectId.value = props?.dataRows?.positionId;
|
seletcId.value = props?.dataRows?.positionId;
|
||||||
datePos.value = props?.dataRows?.reportingDate;
|
datePos.value = props?.dataRows?.reportingDate;
|
||||||
} else {
|
} else {
|
||||||
positionId.value = "";
|
positionId.value = "";
|
||||||
selectId.value = "";
|
seletcId.value = "";
|
||||||
selectedPos.value = [];
|
selectedPos.value = [];
|
||||||
datePos.value = new Date();
|
datePos.value = new Date();
|
||||||
}
|
}
|
||||||
|
|
@ -385,9 +382,9 @@ async function onClickSelectPos(id: string) {
|
||||||
// หาตำแหน่ง
|
// หาตำแหน่ง
|
||||||
if (position) {
|
if (position) {
|
||||||
rowsPosition.value = position.positions;
|
rowsPosition.value = position.positions;
|
||||||
if (selectId.value) {
|
if (seletcId.value) {
|
||||||
selectedPos.value = rowsPosition.value.filter(
|
selectedPos.value = rowsPosition.value.filter(
|
||||||
(e) => e.id === selectId.value
|
(e) => e.id === seletcId.value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -406,19 +403,18 @@ async function fetchPosFind(level: number, id: string) {
|
||||||
};
|
};
|
||||||
await http
|
await http
|
||||||
.post(config.API.orgPosFind, body)
|
.post(config.API.orgPosFind, body)
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
expanded.value = data;
|
expanded.value = data;
|
||||||
nodeId.value = id;
|
nodeId.value = id;
|
||||||
positionId.value = props?.dataRows?.posmasterId;
|
positionId.value = props?.dataRows?.posmasterId;
|
||||||
selectId.value = props?.dataRows?.positionId;
|
seletcId.value = props?.dataRows?.positionId;
|
||||||
datePos.value = props?.dataRows?.reportingDate;
|
datePos.value = props?.dataRows?.reportingDate;
|
||||||
await getDataTable(nodeId.value, level);
|
|
||||||
|
getDataTable(nodeId.value, level);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -431,6 +427,11 @@ watch(
|
||||||
|
|
||||||
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
||||||
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
||||||
|
if (positionId.value) {
|
||||||
|
setTimeout(async () => {
|
||||||
|
await onClickSelectPos(positionId.value);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
expanded.value = [];
|
expanded.value = [];
|
||||||
}
|
}
|
||||||
|
|
@ -462,15 +463,19 @@ function fetchPositionUes() {
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => isAll.value,
|
() => isAll.value,
|
||||||
() => {
|
(value, oldVal) => {
|
||||||
getDataTable(nodeId.value, nodeLevel.value);
|
if (value !== oldVal) {
|
||||||
|
getDataTable(nodeId.value, nodeLevel.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => isBlank.value,
|
() => isBlank.value,
|
||||||
() => {
|
(value, oldVal) => {
|
||||||
getDataTable(nodeId.value, nodeLevel.value);
|
if (value !== oldVal) {
|
||||||
|
getDataTable(nodeId.value, nodeLevel.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -486,44 +491,35 @@ function onSubmit() {
|
||||||
const dataPosMaster = posMasterMain.value?.find(
|
const dataPosMaster = posMasterMain.value?.find(
|
||||||
(e: any) => e.id === positionId.value
|
(e: any) => e.id === positionId.value
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!dataPosMaster) {
|
|
||||||
dialogMessageNotify($q, "ไม่พบข้อมูลตำแหน่ง");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedPos.value.length === 0) {
|
if (selectedPos.value.length === 0) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
||||||
return;
|
} else {
|
||||||
|
dialogConfirm($q, async () => {
|
||||||
|
const body = {
|
||||||
|
personalId: props?.dataRows?.id,
|
||||||
|
node: dataPosMaster.node,
|
||||||
|
nodeId: dataPosMaster.nodeId,
|
||||||
|
orgRevisionId: formActive.activeId,
|
||||||
|
positionId: selectedPos.value[0].id,
|
||||||
|
posMasterNo: dataPosMaster.posMasterNo, //ตำแหน่งเลขที่(เลขอย่่างเดียว)
|
||||||
|
positionName: selectedPos.value[0].positionName, //ชื่อตำแหน่ง
|
||||||
|
positionField: selectedPos.value[0].positionField, //ชื่อตำแหน่ง
|
||||||
|
posTypeId: selectedPos.value[0].posTypeId, //ชื่อตำแหน่ง
|
||||||
|
posTypeName: selectedPos.value[0].posTypeName, //ชื่อตำแหน่ง
|
||||||
|
posLevelId: selectedPos.value[0].posLevelId, //ชื่อตำแหน่ง
|
||||||
|
posLevelName: selectedPos.value[0].posLevelName, //ชื่อตำแหน่ง
|
||||||
|
posExecutiveName: selectedPos.value[0].posExecutiveName, //ชื่อตำแหน่ง
|
||||||
|
reportingDate: convertDateToAPI(datePos.value),
|
||||||
|
posmasterId: dataPosMaster.id,
|
||||||
|
typeCommand: type.value,
|
||||||
|
positionExecutiveField: selectedPos.value[0].positionExecutiveField, //ด้านทางการบริหาร
|
||||||
|
positionArea: selectedPos.value[0].positionArea, //ด้าน/สาขา
|
||||||
|
};
|
||||||
|
|
||||||
|
await props.onSubmit?.(body);
|
||||||
|
close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogConfirm($q, async () => {
|
|
||||||
const body = {
|
|
||||||
personalId: props?.dataRows?.id,
|
|
||||||
node: dataPosMaster.node,
|
|
||||||
nodeId: dataPosMaster.nodeId,
|
|
||||||
orgRevisionId: formActive.activeId,
|
|
||||||
positionId: selectedPos.value[0].id,
|
|
||||||
posMasterNo: dataPosMaster.posMasterNo, //ตำแหน่งเลขที่(เลขอย่่างเดียว)
|
|
||||||
positionName: selectedPos.value[0].positionName, //ชื่อตำแหน่ง
|
|
||||||
positionField: selectedPos.value[0].positionField, //ชื่อตำแหน่ง
|
|
||||||
posTypeId: selectedPos.value[0].posTypeId, //ชื่อตำแหน่ง
|
|
||||||
posTypeName: selectedPos.value[0].posTypeName, //ชื่อตำแหน่ง
|
|
||||||
posLevelId: selectedPos.value[0].posLevelId, //ชื่อตำแหน่ง
|
|
||||||
posLevelName: selectedPos.value[0].posLevelName, //ชื่อตำแหน่ง
|
|
||||||
posExecutiveName: selectedPos.value[0].posExecutiveName, //ชื่อตำแหน่ง
|
|
||||||
posExecutiveId: selectedPos.value[0].posExecutiveId, //ชื่อตำแหน่ง
|
|
||||||
reportingDate: convertDateToAPI(datePos.value),
|
|
||||||
posmasterId: dataPosMaster.id,
|
|
||||||
typeCommand: type.value,
|
|
||||||
positionExecutiveField: selectedPos.value[0].positionExecutiveField, //ด้านทางการบริหาร
|
|
||||||
positionArea: selectedPos.value[0].positionArea, //ด้าน/สาขา
|
|
||||||
};
|
|
||||||
console.log(body);
|
|
||||||
|
|
||||||
await props.onSubmit?.(body);
|
|
||||||
close();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSearch() {
|
function onSearch() {
|
||||||
|
|
@ -538,7 +534,6 @@ onMounted(async () => {
|
||||||
await fetchTree();
|
await fetchTree();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="modal" persistent full-width>
|
<q-dialog v-model="modal" persistent full-width>
|
||||||
<q-card class="no-scroll">
|
<q-card class="no-scroll">
|
||||||
|
|
@ -570,7 +565,7 @@ onMounted(async () => {
|
||||||
<q-tree
|
<q-tree
|
||||||
class="q-pa-sm q-gutter-sm"
|
class="q-pa-sm q-gutter-sm"
|
||||||
dense
|
dense
|
||||||
:nodes="nodes"
|
:nodes="lazy"
|
||||||
node-key="orgTreeId"
|
node-key="orgTreeId"
|
||||||
label-key="labelName"
|
label-key="labelName"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
|
|
@ -836,7 +831,7 @@ onMounted(async () => {
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
<d-table
|
<d-table
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columnsPosition"
|
:columns="columnsPostition"
|
||||||
:rows="rowsPosition"
|
:rows="rowsPosition"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
flat
|
flat
|
||||||
|
|
@ -934,7 +929,6 @@ onMounted(async () => {
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.my-list-link {
|
.my-list-link {
|
||||||
color: rgb(118, 168, 222);
|
color: rgb(118, 168, 222);
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,7 @@ function close() {
|
||||||
|
|
||||||
async function getDataTable(id: string, level: number = 0) {
|
async function getDataTable(id: string, level: number = 0) {
|
||||||
showLoader();
|
showLoader();
|
||||||
positionNo.value = [];
|
|
||||||
rowsData.value = [];
|
|
||||||
const body = {
|
const body = {
|
||||||
node: level,
|
node: level,
|
||||||
nodeId: id,
|
nodeId: id,
|
||||||
|
|
@ -266,7 +265,6 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
posMasterNo:
|
posMasterNo:
|
||||||
e.orgShortname +
|
e.orgShortname +
|
||||||
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : "") +
|
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : "") +
|
||||||
" " +
|
|
||||||
e.posMasterNo +
|
e.posMasterNo +
|
||||||
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : ""),
|
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : ""),
|
||||||
positionName: e.positionName,
|
positionName: e.positionName,
|
||||||
|
|
@ -304,7 +302,9 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
setTimeout(() => {
|
||||||
|
hideLoader();
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="row items-center justify-center q-gutter-sm">
|
|
||||||
<q-icon name="support_agent" color="primary" size="sm" />
|
|
||||||
<span class="text-body2">
|
|
||||||
พบปัญหาการใช้งานกรุณาติดต่อผู้ดูแลระบบ
|
|
||||||
<span class="text-weight-medium text-primary"
|
|
||||||
><a href="tel:0882649800" style="text-decoration: none; color: inherit"
|
|
||||||
>088-264-9800</a
|
|
||||||
>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts"></script>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
import { getColumnLabel } from "@/utils/function";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
|
|
@ -186,7 +187,6 @@ watch(modal, (val) => {
|
||||||
dense
|
dense
|
||||||
label="คำค้น"
|
label="คำค้น"
|
||||||
@clear="search = ''"
|
@clear="search = ''"
|
||||||
@keydown.enter.prevent="onSearchData()"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<q-checkbox
|
<q-checkbox
|
||||||
|
|
@ -253,7 +253,7 @@ watch(modal, (val) => {
|
||||||
<q-th auto-width />
|
<q-th auto-width />
|
||||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<span class="text-weight-medium">
|
<span class="text-weight-medium">
|
||||||
{{ col.label }}
|
{{ getColumnLabel(col, isAct) }}
|
||||||
</span>
|
</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import th from "quasar/lang/th";
|
||||||
import "@vuepic/vue-datepicker/dist/main.css";
|
import "@vuepic/vue-datepicker/dist/main.css";
|
||||||
import http from "./plugins/http";
|
import http from "./plugins/http";
|
||||||
import { createPinia } from "pinia";
|
import { createPinia } from "pinia";
|
||||||
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
|
|
||||||
|
|
||||||
// import './assets/main.css'
|
// import './assets/main.css'
|
||||||
|
|
||||||
|
|
@ -21,7 +20,6 @@ import filters from "./plugins/filters";
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
pinia.use(piniaPluginPersistedstate);
|
|
||||||
|
|
||||||
// เพิ่ม Global Filters ลงใน App
|
// เพิ่ม Global Filters ลงใน App
|
||||||
app.config.globalProperties.$filters = filters;
|
app.config.globalProperties.$filters = filters;
|
||||||
|
|
|
||||||
|
|
@ -213,9 +213,7 @@ function formatHistoryOwnerData(data: HistoryPos[]) {
|
||||||
return data.map((item) => ({
|
return data.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
fullname: item.firstName
|
fullname: item.firstName
|
||||||
? `${item.prefix || ""}${item.firstName || ""} ${
|
? `${item.prefix}${item.firstName} ${item.lastName}`.trim()
|
||||||
item.lastName || ""
|
|
||||||
}`.trim()
|
|
||||||
: "ว่าง",
|
: "ว่าง",
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1004,6 +1004,7 @@ watch(
|
||||||
table-class="text-grey-9"
|
table-class="text-grey-9"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
dense
|
dense
|
||||||
|
hide-bottom
|
||||||
bordered
|
bordered
|
||||||
separator="vertical"
|
separator="vertical"
|
||||||
class="custom-header-table-expand"
|
class="custom-header-table-expand"
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ async function downloadFileDashboard() {
|
||||||
async function clickPassExam() {
|
async function clickPassExam() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.downloadPassExam(examId.value))
|
.get(config.API.exportExamPassExamList(examId.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
|
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
|
||||||
|
|
@ -382,7 +382,7 @@ async function clickPassExam() {
|
||||||
async function clickCandidateList() {
|
async function clickCandidateList() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.downloadCandidateExam(examId.value))
|
.get(config.API.exportExamCandidateList(examId.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
|
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
|
||||||
|
|
@ -397,6 +397,8 @@ async function clickCandidateList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onCheckShowExaminfo() {
|
async function onCheckShowExaminfo() {
|
||||||
|
console.log(props.isShowExaminfo);
|
||||||
|
|
||||||
dialogMessage(
|
dialogMessage(
|
||||||
$q,
|
$q,
|
||||||
`ยืนยันการ${props.isShowExaminfo ? "ปิด" : "เปิด"}`,
|
`ยืนยันการ${props.isShowExaminfo ? "ปิด" : "เปิด"}`,
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,16 @@ function clearFilter() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</q-form>
|
||||||
|
|
||||||
|
<div class="q-pa-sm q-gutter-sm">
|
||||||
|
<q-card flat bordered class="col-12">
|
||||||
|
<div class="row q-col-gutter-sm q-pa-sm">
|
||||||
|
<div class="row col-12 q-col-gutter-sm">
|
||||||
|
<q-space />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<!-- page:จัดการรอบการสอบ สรรหา -->
|
<!-- page:จัดการรอบการสอบ สรรหา -->
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { onMounted, ref, watch } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import genReport from "@/plugins/genreport";
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
@ -11,9 +11,6 @@ import config from "@/app.config";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { calculateFiscalYear } from "@/utils/function";
|
import { calculateFiscalYear } from "@/utils/function";
|
||||||
import { useUploadProgressStore } from "@/stores/uploadProgress";
|
|
||||||
import { useSocketStore } from "@/stores/socket";
|
|
||||||
import { storeToRefs } from "pinia";
|
|
||||||
|
|
||||||
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -36,14 +33,9 @@ const {
|
||||||
messageError,
|
messageError,
|
||||||
onSearchDataTable,
|
onSearchDataTable,
|
||||||
dialogRemove,
|
dialogRemove,
|
||||||
dialogMessage,
|
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const uploadProgress = useUploadProgressStore();
|
|
||||||
const socketStore = useSocketStore();
|
|
||||||
const { notificationCounter } = storeToRefs(socketStore);
|
|
||||||
|
|
||||||
const name = ref<string>("");
|
const name = ref<string>("");
|
||||||
const year = ref<number>(calculateFiscalYear(new Date()) + 543);
|
const year = ref<number>(calculateFiscalYear(new Date()) + 543);
|
||||||
const order = ref<number>(1);
|
const order = ref<number>(1);
|
||||||
|
|
@ -57,11 +49,6 @@ const modalScore = ref<boolean>(false);
|
||||||
const modalCandidate = ref<boolean>(false);
|
const modalCandidate = ref<boolean>(false);
|
||||||
const modalResult = ref<boolean>(false);
|
const modalResult = ref<boolean>(false);
|
||||||
const selected_row_id = ref<string>("");
|
const selected_row_id = ref<string>("");
|
||||||
const jobStatus = ref<{
|
|
||||||
candidate?: "running" | "completed" | "failed";
|
|
||||||
score?: "running" | "completed" | "failed";
|
|
||||||
result?: "running" | "completed" | "failed";
|
|
||||||
}>({});
|
|
||||||
const rowsHistory = ref<ResponseHistoryObject[]>([]); //select data history
|
const rowsHistory = ref<ResponseHistoryObject[]>([]); //select data history
|
||||||
const tittleHistory = ref<string>("ประวัติการนำเข้าข้อมูล"); //
|
const tittleHistory = ref<string>("ประวัติการนำเข้าข้อมูล"); //
|
||||||
const filterHistory = ref<string>(""); //search data table history
|
const filterHistory = ref<string>(""); //search data table history
|
||||||
|
|
@ -75,54 +62,6 @@ const textTittle = ref<string>("");
|
||||||
const textTittleScore = ref<string>("");
|
const textTittleScore = ref<string>("");
|
||||||
const textTittleCandidate = ref<string>("");
|
const textTittleCandidate = ref<string>("");
|
||||||
const textTittleResult = ref<string>("");
|
const textTittleResult = ref<string>("");
|
||||||
|
|
||||||
// Dialog message constants
|
|
||||||
const UPLOAD_RUNNING_DIALOG = {
|
|
||||||
title: "ไม่สามารถอัปโหลดไฟล์ได้",
|
|
||||||
message: "อยู่ระหว่างนำเข้าข้อมูล ระบบจะแจ้งผลให้ทราบทันทีเมื่อเสร็จสิ้น",
|
|
||||||
icon: "mdi-progress-alert",
|
|
||||||
btnLabel: "ตกลง",
|
|
||||||
color: "primary",
|
|
||||||
};
|
|
||||||
|
|
||||||
const UPLOAD_SUCCESS_DIALOG = {
|
|
||||||
title: "อัปโหลดไฟล์สำเร็จ",
|
|
||||||
message:
|
|
||||||
"ระบบกำลังนำเข้าข้อมูลคุณสามารถใช้งานเมนูอื่นในระหว่างนี้ได้ โดยระบบจะแจ้งผลการดำเนินการให้ทราบทันทีเมื่อเสร็จสิ้น",
|
|
||||||
icon: "check",
|
|
||||||
btnLabel: "ตกลง",
|
|
||||||
color: "primary",
|
|
||||||
};
|
|
||||||
|
|
||||||
// Function to show upload running dialog
|
|
||||||
function showUploadRunningDialog() {
|
|
||||||
dialogMessage(
|
|
||||||
$q,
|
|
||||||
UPLOAD_RUNNING_DIALOG.title,
|
|
||||||
UPLOAD_RUNNING_DIALOG.message,
|
|
||||||
UPLOAD_RUNNING_DIALOG.icon,
|
|
||||||
UPLOAD_RUNNING_DIALOG.btnLabel,
|
|
||||||
UPLOAD_RUNNING_DIALOG.color,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to show upload success dialog
|
|
||||||
function showUploadSuccessDialog() {
|
|
||||||
dialogMessage(
|
|
||||||
$q,
|
|
||||||
UPLOAD_SUCCESS_DIALOG.title,
|
|
||||||
UPLOAD_SUCCESS_DIALOG.message,
|
|
||||||
UPLOAD_SUCCESS_DIALOG.icon,
|
|
||||||
UPLOAD_SUCCESS_DIALOG.btnLabel,
|
|
||||||
UPLOAD_SUCCESS_DIALOG.color,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const rows = ref<ResponseRecruitPeriod[]>([]);
|
const rows = ref<ResponseRecruitPeriod[]>([]);
|
||||||
const rowsData = ref<ResponseRecruitPeriod[]>([]);
|
const rowsData = ref<ResponseRecruitPeriod[]>([]);
|
||||||
const initialPagination = ref<Pagination>({
|
const initialPagination = ref<Pagination>({
|
||||||
|
|
@ -396,15 +335,9 @@ function clickDetail(id: string) {
|
||||||
* @param id รอบสอบเเข่งขัน
|
* @param id รอบสอบเเข่งขัน
|
||||||
*/
|
*/
|
||||||
async function clickUpload(id: string) {
|
async function clickUpload(id: string) {
|
||||||
|
modalCandidate.value = true;
|
||||||
|
textTittleCandidate.value = "นำเข้าผู้สมัครสอบแข่งขัน";
|
||||||
selected_row_id.value = id;
|
selected_row_id.value = id;
|
||||||
const isRunning = await checkJobStatus(id, "candidate");
|
|
||||||
|
|
||||||
if (isRunning) {
|
|
||||||
showUploadRunningDialog();
|
|
||||||
} else {
|
|
||||||
modalCandidate.value = true;
|
|
||||||
textTittleCandidate.value = "นำเข้าผู้สมัครสอบแข่งขัน";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -412,15 +345,9 @@ async function clickUpload(id: string) {
|
||||||
* @param id รอบสอบเเข่งขัน
|
* @param id รอบสอบเเข่งขัน
|
||||||
*/
|
*/
|
||||||
async function clickEdit(id: string) {
|
async function clickEdit(id: string) {
|
||||||
|
modalScore.value = true;
|
||||||
|
textTittleScore.value = "นำเข้าบัญชีรวมคะแนน";
|
||||||
selected_row_id.value = id;
|
selected_row_id.value = id;
|
||||||
const isRunning = await checkJobStatus(id, "score");
|
|
||||||
|
|
||||||
if (isRunning) {
|
|
||||||
showUploadRunningDialog();
|
|
||||||
} else {
|
|
||||||
modalScore.value = true;
|
|
||||||
textTittleScore.value = "นำเข้าบัญชีรวมคะแนน";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -428,57 +355,9 @@ async function clickEdit(id: string) {
|
||||||
* @param id รอบสอบเเข่งขัน
|
* @param id รอบสอบเเข่งขัน
|
||||||
*/
|
*/
|
||||||
async function clickResult(id: string) {
|
async function clickResult(id: string) {
|
||||||
|
modalResult.value = true;
|
||||||
|
textTittleResult.value = "นำเข้าไฟล์ผลการสอบ";
|
||||||
selected_row_id.value = id;
|
selected_row_id.value = id;
|
||||||
const isRunning = await checkJobStatus(id, "result");
|
|
||||||
|
|
||||||
if (isRunning) {
|
|
||||||
showUploadRunningDialog();
|
|
||||||
} else {
|
|
||||||
modalResult.value = true;
|
|
||||||
textTittleResult.value = "นำเข้าไฟล์ผลการสอบ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ตรวจสอบสถานะการนำเข้าข้อมูล
|
|
||||||
* @param id รอบสอบเเข่งขัน
|
|
||||||
* @param type ประเภทไฟล์ที่ต้องการตรวจสอบ
|
|
||||||
* @return true ถ้ากำลัง running, false ถ้าไม่มี job หรือ job เสร็จแล้ว
|
|
||||||
*/
|
|
||||||
async function checkJobStatus(
|
|
||||||
id: string,
|
|
||||||
type: "candidate" | "score" | "result"
|
|
||||||
): Promise<boolean> {
|
|
||||||
const uploads = uploadProgress.pendingUploads.filter(
|
|
||||||
(u) => u.periodId === id && u.type === type
|
|
||||||
);
|
|
||||||
|
|
||||||
let hasRunningJob = false;
|
|
||||||
|
|
||||||
for (const upload of uploads) {
|
|
||||||
try {
|
|
||||||
const res = await http.get(config.API.getImportStatus(upload.jobId));
|
|
||||||
const status = res.data.result.status.toLowerCase(); // 'running', 'completed', 'failed'
|
|
||||||
|
|
||||||
if (status === "completed" || status === "failed") {
|
|
||||||
status === "completed" && fetchData();
|
|
||||||
uploadProgress.removeUpload(upload.jobId);
|
|
||||||
} else if (status === "running") {
|
|
||||||
jobStatus.value[type] = "running";
|
|
||||||
hasRunningJob = true;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// if error, remove from pending
|
|
||||||
uploadProgress.removeUpload(upload.jobId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if no running jobs, clear status
|
|
||||||
if (!uploadProgress.isUploading(id, type)) {
|
|
||||||
jobStatus.value[type] = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasRunningJob;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -584,13 +463,11 @@ async function checkSaveCandidate() {
|
||||||
await http
|
await http
|
||||||
.post(config.API.uploadCandidates(selected_row_id.value), fd)
|
.post(config.API.uploadCandidates(selected_row_id.value), fd)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const jobId = res.data.result.jobId;
|
success($q, "นำเข้าข้อมูลผู้สมัครสอบสำเร็จ");
|
||||||
uploadProgress.addUpload(jobId, selected_row_id.value, "candidate");
|
|
||||||
success($q, UPLOAD_SUCCESS_DIALOG.message);
|
|
||||||
|
|
||||||
modalCandidate.value = false;
|
modalCandidate.value = false;
|
||||||
files_candidate.value = null;
|
files_candidate.value = null;
|
||||||
selected_row_id.value = "";
|
selected_row_id.value = "";
|
||||||
|
fetchData();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -600,7 +477,7 @@ async function checkSaveCandidate() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** บันทึด คะเแนน */
|
/** บันทึด คะเเนน */
|
||||||
async function checkSaveScore() {
|
async function checkSaveScore() {
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("attachment", files_score.value[0]);
|
fd.append("attachment", files_score.value[0]);
|
||||||
|
|
@ -608,12 +485,11 @@ async function checkSaveScore() {
|
||||||
await http
|
await http
|
||||||
.post(config.API.saveScores(selected_row_id.value), fd)
|
.post(config.API.saveScores(selected_row_id.value), fd)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const jobId = res.data.result.jobId;
|
success($q, "นำเข้าข้อมูลผลคะแนนสอบสำเร็จ");
|
||||||
uploadProgress.addUpload(jobId, selected_row_id.value, "score");
|
|
||||||
success($q, UPLOAD_SUCCESS_DIALOG.message);
|
|
||||||
modalScore.value = false;
|
modalScore.value = false;
|
||||||
files_score.value = null;
|
files_score.value = null;
|
||||||
selected_row_id.value = "";
|
selected_row_id.value = "";
|
||||||
|
fetchData();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -631,12 +507,11 @@ async function checkSaveResult() {
|
||||||
await http
|
await http
|
||||||
.post(config.API.uploadResult(selected_row_id.value), fd)
|
.post(config.API.uploadResult(selected_row_id.value), fd)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const jobId = res.data.result.jobId;
|
success($q, "นำเข้าข้อมูลผลการสอบแข่งขันฯ (บัญชีรายชื่อ)");
|
||||||
uploadProgress.addUpload(jobId, selected_row_id.value, "result");
|
|
||||||
success($q, UPLOAD_SUCCESS_DIALOG.message);
|
|
||||||
modalResult.value = false;
|
modalResult.value = false;
|
||||||
files_result.value = null;
|
files_result.value = null;
|
||||||
selected_row_id.value = "";
|
selected_row_id.value = "";
|
||||||
|
fetchData();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -657,9 +532,6 @@ async function checkSave() {
|
||||||
await http
|
await http
|
||||||
.post(config.API.saveCandidates, fd)
|
.post(config.API.saveCandidates, fd)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const jobId = res.data.result.jobId;
|
|
||||||
uploadProgress.addUpload(jobId, selected_row_id.value, "period");
|
|
||||||
|
|
||||||
success($q, "นำเข้าข้อมูลผู้สมัครสอบแข่งขันสำเร็จ");
|
success($q, "นำเข้าข้อมูลผู้สมัครสอบแข่งขันสำเร็จ");
|
||||||
modalAdd.value = false;
|
modalAdd.value = false;
|
||||||
fetchData();
|
fetchData();
|
||||||
|
|
@ -685,18 +557,12 @@ onMounted(async () => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
await fetchData();
|
await fetchData();
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Watch notification counter on socket */
|
|
||||||
watch(notificationCounter, () => {
|
|
||||||
fetchData();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="toptitle text-dark col-12 row items-center">
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
จัดการรอบสอบแข่งขัน
|
จัดการรอบสอบแข่งขัน
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
|
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
|
||||||
<div>
|
<div>
|
||||||
<Table
|
<Table
|
||||||
|
|
@ -803,16 +669,16 @@ watch(notificationCounter, () => {
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.name == 'examCount'" class="table_ellipsis2">
|
<div v-else-if="col.name == 'examCount'" class="table_ellipsis2">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
|
||||||
(col.value == null || col.value == '0') &&
|
|
||||||
checkPermission($route)?.attrIsUpdate
|
|
||||||
"
|
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
size="12px"
|
size="12px"
|
||||||
color="green"
|
color="green"
|
||||||
round
|
round
|
||||||
@click.stop.prevent="clickUpload(props.row.id)"
|
@click.stop.prevent="clickUpload(props.row.id)"
|
||||||
|
v-if="
|
||||||
|
(col.value == null || col.value == '0') &&
|
||||||
|
checkPermission($route)?.attrIsUpdate
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<q-icon name="mdi-file-excel-outline" size="20px" />
|
<q-icon name="mdi-file-excel-outline" size="20px" />
|
||||||
<q-tooltip>นำเข้าไฟล์ผู้สมัครสอบ</q-tooltip>
|
<q-tooltip>นำเข้าไฟล์ผู้สมัครสอบ</q-tooltip>
|
||||||
|
|
@ -849,9 +715,6 @@ watch(notificationCounter, () => {
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.name == 'scoreCount'" class="table_ellipsis2">
|
<div v-else-if="col.name == 'scoreCount'" class="table_ellipsis2">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
|
||||||
col.value == null && checkPermission($route)?.attrIsUpdate
|
|
||||||
"
|
|
||||||
:disable="props.row.examCount == 0"
|
:disable="props.row.examCount == 0"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
|
@ -859,6 +722,9 @@ watch(notificationCounter, () => {
|
||||||
round
|
round
|
||||||
color="green"
|
color="green"
|
||||||
@click.stop.prevent="clickEdit(props.row.id)"
|
@click.stop.prevent="clickEdit(props.row.id)"
|
||||||
|
v-if="
|
||||||
|
col.value == null && checkPermission($route)?.attrIsUpdate
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<q-icon name="mdi-file-excel-outline" size="20px" />
|
<q-icon name="mdi-file-excel-outline" size="20px" />
|
||||||
<!-- นำเข้าไฟล์ผลคะแนนสอบ -->
|
<!-- นำเข้าไฟล์ผลคะแนนสอบ -->
|
||||||
|
|
@ -885,11 +751,6 @@ watch(notificationCounter, () => {
|
||||||
|
|
||||||
<div v-else-if="col.name == 'result'" class="table_ellipsis2">
|
<div v-else-if="col.name == 'result'" class="table_ellipsis2">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
|
||||||
(props.row.score == null ||
|
|
||||||
props.row.score.resultCount == 0) &&
|
|
||||||
checkPermission($route)?.attrIsUpdate
|
|
||||||
"
|
|
||||||
:disable="props.row.score == null"
|
:disable="props.row.score == null"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
|
@ -897,6 +758,11 @@ watch(notificationCounter, () => {
|
||||||
color="green"
|
color="green"
|
||||||
round
|
round
|
||||||
@click.stop.prevent="clickResult(props.row.id)"
|
@click.stop.prevent="clickResult(props.row.id)"
|
||||||
|
v-if="
|
||||||
|
(props.row.score == null ||
|
||||||
|
props.row.score.resultCount == 0) &&
|
||||||
|
checkPermission($route)?.attrIsUpdate
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<q-icon name="mdi-file-excel-outline" size="20px" />
|
<q-icon name="mdi-file-excel-outline" size="20px" />
|
||||||
<q-tooltip>นำเข้าไฟล์ผลการสอบ (บัญชีรายชื่อ)</q-tooltip>
|
<q-tooltip>นำเข้าไฟล์ผลการสอบ (บัญชีรายชื่อ)</q-tooltip>
|
||||||
|
|
@ -1055,12 +921,12 @@ watch(notificationCounter, () => {
|
||||||
|
|
||||||
<q-dialog v-model="modalCandidate" persistent>
|
<q-dialog v-model="modalCandidate" persistent>
|
||||||
<q-card style="width: 600px">
|
<q-card style="width: 600px">
|
||||||
<DialogHeadTemplate
|
|
||||||
:title="textTittleCandidate"
|
|
||||||
:close="clickCloseCandidate"
|
|
||||||
title-type="ข้อมูลผู้สมัครสอบ"
|
|
||||||
/>
|
|
||||||
<q-form ref="myFormScore">
|
<q-form ref="myFormScore">
|
||||||
|
<DialogHeadTemplate
|
||||||
|
:title="textTittleCandidate"
|
||||||
|
:close="clickCloseCandidate"
|
||||||
|
title-type="ข้อมูลผู้สมัครสอบ"
|
||||||
|
/>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="col-12 row items-center q-col-gutter-sm">
|
<div class="col-12 row items-center q-col-gutter-sm">
|
||||||
|
|
@ -1099,12 +965,12 @@ watch(notificationCounter, () => {
|
||||||
|
|
||||||
<q-dialog v-model="modalScore" persistent>
|
<q-dialog v-model="modalScore" persistent>
|
||||||
<q-card style="width: 600px">
|
<q-card style="width: 600px">
|
||||||
<DialogHeadTemplate
|
|
||||||
:title="textTittleScore"
|
|
||||||
:close="clickCloseScore"
|
|
||||||
title-type="บัญชีรวมคะแนน"
|
|
||||||
/>
|
|
||||||
<q-form ref="myFormScore">
|
<q-form ref="myFormScore">
|
||||||
|
<DialogHeadTemplate
|
||||||
|
:title="textTittleScore"
|
||||||
|
:close="clickCloseScore"
|
||||||
|
title-type="บัญชีรวมคะแนน"
|
||||||
|
/>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="col-12 row items-center q-col-gutter-sm">
|
<div class="col-12 row items-center q-col-gutter-sm">
|
||||||
|
|
@ -1143,12 +1009,12 @@ watch(notificationCounter, () => {
|
||||||
|
|
||||||
<q-dialog v-model="modalResult" persistent>
|
<q-dialog v-model="modalResult" persistent>
|
||||||
<q-card style="width: 600px">
|
<q-card style="width: 600px">
|
||||||
<DialogHeadTemplate
|
|
||||||
:title="textTittleResult"
|
|
||||||
:close="clickCloseResult"
|
|
||||||
title-type="ผลการสอบ (บัญชีรายชื่อ)"
|
|
||||||
/>
|
|
||||||
<q-form ref="myFormScore">
|
<q-form ref="myFormScore">
|
||||||
|
<DialogHeadTemplate
|
||||||
|
:title="textTittleResult"
|
||||||
|
:close="clickCloseResult"
|
||||||
|
title-type="ผลการสอบ (บัญชีรายชื่อ)"
|
||||||
|
/>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="col-12 row items-center q-col-gutter-sm">
|
<div class="col-12 row items-center q-col-gutter-sm">
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
format(val, row) {
|
||||||
return `${row.year ? row.year + 543 : "-"}`;
|
return `${row.year + 543}`;
|
||||||
},
|
},
|
||||||
sort: (a: number, b: number) => b - a,
|
sort: (a: number, b: number) => b - a,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -212,17 +212,17 @@ const columnsPosition = ref<QTableProps["columns"]>([
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// name: "type",
|
name: "type",
|
||||||
// align: "left",
|
align: "left",
|
||||||
// label: "ประเภทแบบฟอร์ม",
|
label: "ประเภทแบบฟอร์ม",
|
||||||
// sortable: true,
|
sortable: true,
|
||||||
// field: "type",
|
field: "type",
|
||||||
// headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
// style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
// sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
// },
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const shouldShowPaymentFields = computed(() => {
|
const shouldShowPaymentFields = computed(() => {
|
||||||
|
|
@ -400,7 +400,7 @@ async function checkSave() {
|
||||||
|
|
||||||
// เช็ค validation form ตำแหน่ง
|
// เช็ค validation form ตำแหน่ง
|
||||||
const isPositionFormValid = await myFormPosition.value?.validate();
|
const isPositionFormValid = await myFormPosition.value?.validate();
|
||||||
if (!isPositionFormValid && announcementExam.value) return;
|
if (!isPositionFormValid) return;
|
||||||
|
|
||||||
// เช็คการเพิ่มตำแหน่ง
|
// เช็คการเพิ่มตำแหน่ง
|
||||||
if (announcementExam.value && rowsPosition.value.length === 0) {
|
if (announcementExam.value && rowsPosition.value.length === 0) {
|
||||||
|
|
@ -889,7 +889,7 @@ function fetchPosition(level: number) {
|
||||||
* @param val ค่าประเภทตำแหน่ง 0 = ประเภททั่วไป ,1 = ประเภทวิชาการ
|
* @param val ค่าประเภทตำแหน่ง 0 = ประเภททั่วไป ,1 = ประเภทวิชาการ
|
||||||
* @param index ตำแหน่งของข้อมูล
|
* @param index ตำแหน่งของข้อมูล
|
||||||
*/
|
*/
|
||||||
function onUpdateHighDegree(val: string, index: number) {
|
function onUpdateHighDegree(val: string, index: string) {
|
||||||
rowsPosition.value[index].position = null;
|
rowsPosition.value[index].position = null;
|
||||||
rowsPosition.value[index].level =
|
rowsPosition.value[index].level =
|
||||||
val === "0" ? optionPosLevel1.value[0] : optionPosLevel2.value[0];
|
val === "0" ? optionPosLevel1.value[0] : optionPosLevel2.value[0];
|
||||||
|
|
@ -1476,7 +1476,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
||||||
<!-- <q-td key="type" :props="props">
|
<q-td key="type" :props="props">
|
||||||
<selector
|
<selector
|
||||||
class=""
|
class=""
|
||||||
outlined
|
outlined
|
||||||
|
|
@ -1490,7 +1490,7 @@ onMounted(async () => {
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:rules="[(val:any) => !!val || `${'กรุณาเลือกประเภทแบบฟอร์ม'}`]"
|
:rules="[(val:any) => !!val || `${'กรุณาเลือกประเภทแบบฟอร์ม'}`]"
|
||||||
></selector>
|
></selector>
|
||||||
</q-td> -->
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
</ProfileTable>
|
</ProfileTable>
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,7 @@ async function fetchData(loading: boolean = true) {
|
||||||
total.value = data.total;
|
total.value = data.total;
|
||||||
maxPage.value = await Math.ceil(data.total / pageSize.value);
|
maxPage.value = await Math.ceil(data.total / pageSize.value);
|
||||||
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
|
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
|
||||||
|
|
||||||
rows.value = [];
|
rows.value = [];
|
||||||
data.data.map((r: any) => {
|
data.data.map((r: any) => {
|
||||||
rows.value.push({
|
rows.value.push({
|
||||||
|
|
@ -401,7 +402,6 @@ onMounted(async () => {
|
||||||
await fetchDataCom();
|
await fetchDataCom();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="toptitle text-dark col-12 row items-center">
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
@ -474,9 +474,9 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-slide-transition>
|
</q-slide-transition>
|
||||||
|
|
||||||
<q-card flat bordered class="col-12 q-pt-sm">
|
<q-card flat bordered class="col-12 q-pt-sm">
|
||||||
<TableCandidate
|
<TableCandidate
|
||||||
|
style="max-height: 80vh"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
|
|
@ -603,7 +603,6 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
</TableCandidate>
|
</TableCandidate>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
<q-dialog v-model="modal" persistent>
|
<q-dialog v-model="modal" persistent>
|
||||||
<q-card style="min-width: 600px">
|
<q-card style="min-width: 600px">
|
||||||
<q-card-section class="row items-center q-py-sm">
|
<q-card-section class="row items-center q-py-sm">
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ const baseColumns = ref<QTableColumn[]>([
|
||||||
field: "year",
|
field: "year",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format: (v) => (v ? v + 543 : "-"),
|
format: (v) => v + 543,
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a
|
a
|
||||||
.toString()
|
.toString()
|
||||||
|
|
@ -920,11 +920,9 @@ onMounted(async () => {
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
year ? year + 543 : "-"
|
|
||||||
}}</template>
|
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
value ? parseInt(value + 543) : "-"
|
parseInt(value + 543)
|
||||||
}}</template>
|
}}</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
|
@ -932,7 +930,7 @@ onMounted(async () => {
|
||||||
outlined
|
outlined
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:model-value="insigniaForm.year != null && insigniaForm.year !== 0 ? (insigniaForm.year as number) + 543 : null"
|
:model-value="insigniaForm.year !== 0 ? (insigniaForm.year as number) + 543 : null"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val:string) =>
|
(val:string) =>
|
||||||
!!val ||
|
!!val ||
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,18 @@ const formMain = reactive<FormMain>({
|
||||||
workDate: null, //วันที่เริ่มปฏิบัติราชการ
|
workDate: null, //วันที่เริ่มปฏิบัติราชการ
|
||||||
reasonSameDate: "",
|
reasonSameDate: "",
|
||||||
retireDate: null, //วันเกษียณอายุ
|
retireDate: null, //วันเกษียณอายุ
|
||||||
ageAll: "", //อายุราชการ
|
ageAll: {
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
}, //อายุราชการ
|
||||||
absent: 0, //ขาดราชการ
|
absent: 0, //ขาดราชการ
|
||||||
age: 0, //อายุราชการเกื้อกูล
|
age: 0, //อายุราชการเกื้อกูล
|
||||||
govAgeBkk: "",
|
govAgeBkk:{
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const modalEdit = ref<boolean>(false); //แสดง popup แก้ไขข้อมูลราชการ
|
const modalEdit = ref<boolean>(false); //แสดง popup แก้ไขข้อมูลราชการ
|
||||||
|
|
@ -157,22 +165,10 @@ async function getData() {
|
||||||
formMain.reasonSameDate = data.reasonSameDate;
|
formMain.reasonSameDate = data.reasonSameDate;
|
||||||
formMain.retireDate = data.dateLeave;
|
formMain.retireDate = data.dateLeave;
|
||||||
formMain.dateRetireLaw = data.dateRetireLaw;
|
formMain.dateRetireLaw = data.dateRetireLaw;
|
||||||
formMain.ageAll = data.govAge
|
formMain.ageAll = data.govAge;
|
||||||
? (
|
|
||||||
(data.govAge.year > 0 ? `${data.govAge.year} ปี ` : "") +
|
|
||||||
(data.govAge.month > 0 ? `${data.govAge.month} เดือน ` : "") +
|
|
||||||
(data.govAge.day > 0 ? `${data.govAge.day} วัน` : "")
|
|
||||||
).trim() || "-"
|
|
||||||
: "-";
|
|
||||||
formMain.absent = data.govAgeAbsent;
|
formMain.absent = data.govAgeAbsent;
|
||||||
formMain.age = data.govAgePlus;
|
formMain.age = data.govAgePlus;
|
||||||
formMain.govAgeBkk = data.govAgeBkk
|
formMain.govAgeBkk = data.govAgeBkk;
|
||||||
? (
|
|
||||||
(data.govAgeBkk.year > 0 ? `${data.govAgeBkk.year} ปี ` : "") +
|
|
||||||
(data.govAgeBkk.month > 0 ? `${data.govAgeBkk.month} เดือน ` : "") +
|
|
||||||
(data.govAgeBkk.day > 0 ? `${data.govAgeBkk.day} วัน` : "")
|
|
||||||
).trim() || "-"
|
|
||||||
: "-";
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -459,19 +455,25 @@ onMounted(() => {
|
||||||
<span class="text-grey-6 text-weight-medium">อายุราชการ</span>
|
<span class="text-grey-6 text-weight-medium">อายุราชการ</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-7">
|
<div class="col-12 col-sm-12 col-md-7">
|
||||||
<span>{{ formMain.ageAll }}</span>
|
<span>{{
|
||||||
|
formMain.ageAll
|
||||||
|
? `${formMain.ageAll.year} ปี ${formMain.ageAll.month} เดือน ${formMain.ageAll.day} วัน`
|
||||||
|
: "-"
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-6 col-md-6">
|
<div class="col-12 col-sm-6 col-md-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-12 col-md-5">
|
<div class="col-12 col-sm-12 col-md-5">
|
||||||
<span class="text-grey-6 text-weight-medium"
|
<span class="text-grey-6 text-weight-medium">อายุราชการ (กทม.)</span>
|
||||||
>อายุราชการ (กทม.)</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-7">
|
<div class="col-12 col-sm-12 col-md-7">
|
||||||
<span>{{ formMain.govAgeBkk }}</span>
|
<span>{{
|
||||||
|
formMain.govAgeBkk
|
||||||
|
? `${formMain.govAgeBkk.year} ปี ${formMain.govAgeBkk.month} เดือน ${formMain.govAgeBkk.day} วัน`
|
||||||
|
: "-"
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -202,17 +202,6 @@ const pagination = ref({
|
||||||
const columnsHistory = ref<QTableColumn[]>(baseColumns.value);
|
const columnsHistory = ref<QTableColumn[]>(baseColumns.value);
|
||||||
const visibleColumnsHistory = ref<string[]>(baseVisibleColumns.value);
|
const visibleColumnsHistory = ref<string[]>(baseVisibleColumns.value);
|
||||||
|
|
||||||
/** รายการประเภทการลาของ ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน*/
|
|
||||||
const leaveSubTypeName = ref<string>("");
|
|
||||||
const optionSubTypeName = ref<string[]>([
|
|
||||||
"ศึกษาต่อ",
|
|
||||||
"ฝึกอบรม",
|
|
||||||
"ปฎิบัติการวิจัย",
|
|
||||||
"ดูงาน",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const coupleDayLevelCountry = ref<string>("");
|
|
||||||
|
|
||||||
/** function fetch ข้อมูลรายการลา*/
|
/** function fetch ข้อมูลรายการลา*/
|
||||||
async function getData() {
|
async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -224,7 +213,6 @@ async function getData() {
|
||||||
...item,
|
...item,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
typeLeave: item.leaveType.name,
|
typeLeave: item.leaveType.name,
|
||||||
codeLeave: item.leaveType.code,
|
|
||||||
code: item.leaveType.refCommandDate,
|
code: item.leaveType.refCommandDate,
|
||||||
dateStartLeave: item.dateLeaveStart,
|
dateStartLeave: item.dateLeaveStart,
|
||||||
dateEndLeave: item.dateLeaveEnd,
|
dateEndLeave: item.dateLeaveEnd,
|
||||||
|
|
@ -304,10 +292,8 @@ function openDialogEdit(props: DetailData) {
|
||||||
typeLeave.value = {
|
typeLeave.value = {
|
||||||
id: props.typeLeaveId,
|
id: props.typeLeaveId,
|
||||||
name: props.typeLeave,
|
name: props.typeLeave,
|
||||||
code: props.codeLeave,
|
code: props.code,
|
||||||
};
|
};
|
||||||
leaveSubTypeName.value = props.leaveSubTypeName;
|
|
||||||
coupleDayLevelCountry.value = props.coupleDayLevelCountry;
|
|
||||||
statLeave.value = props.status;
|
statLeave.value = props.status;
|
||||||
reason.value = props.reason;
|
reason.value = props.reason;
|
||||||
dateRange.value = [
|
dateRange.value = [
|
||||||
|
|
@ -330,10 +316,6 @@ function onSubmit() {
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
leaveTypeId: typeLeave.value?.id,
|
leaveTypeId: typeLeave.value?.id,
|
||||||
leaveSubTypeName:
|
|
||||||
typeLeave.value?.code === "LV-008" ? leaveSubTypeName.value : undefined,
|
|
||||||
coupleDayLevelCountry:
|
|
||||||
typeLeave.value?.code === "LV-010" ? coupleDayLevelCountry.value : undefined,
|
|
||||||
dateLeaveStart: dateToISO(dateRange.value[0]),
|
dateLeaveStart: dateToISO(dateRange.value[0]),
|
||||||
dateLeaveEnd: dateToISO(dateRange.value[1]),
|
dateLeaveEnd: dateToISO(dateRange.value[1]),
|
||||||
leaveDays: numLeave.value,
|
leaveDays: numLeave.value,
|
||||||
|
|
@ -469,8 +451,6 @@ function closeDialog() {
|
||||||
dateRange.value = [new Date(), new Date()];
|
dateRange.value = [new Date(), new Date()];
|
||||||
numLeave.value = 1;
|
numLeave.value = 1;
|
||||||
numUsedLeave.value = 0;
|
numUsedLeave.value = 0;
|
||||||
leaveSubTypeName.value = "";
|
|
||||||
coupleDayLevelCountry.value = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusLeave(val: string) {
|
function statusLeave(val: string) {
|
||||||
|
|
@ -761,43 +741,6 @@ onMounted(() => {
|
||||||
) "
|
) "
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
|
||||||
class="col-xs-6 col-sm-6 col-md-6"
|
|
||||||
v-if="
|
|
||||||
typeLeave?.code === 'LV-008' || typeLeave?.code === 'LV-010'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<q-select
|
|
||||||
v-if="typeLeave?.code === 'LV-008'"
|
|
||||||
ref="typeLeaveRef"
|
|
||||||
class="full-width inputgreen cursor-pointer"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
:label="`${'ประเภท'}`"
|
|
||||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภท'}`]"
|
|
||||||
v-model="leaveSubTypeName"
|
|
||||||
:options="optionSubTypeName"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-bottom-space
|
|
||||||
/>
|
|
||||||
<q-input
|
|
||||||
v-if="typeLeave?.code === 'LV-010'"
|
|
||||||
ref="numLeaveRef"
|
|
||||||
class="full-width inputgreen cursor-pointer"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
v-model="coupleDayLevelCountry"
|
|
||||||
:rules="[(val:string) => !!val || `${'กรุณากรอกประเทศที่ลาติดตามคู่สมรส'}`]"
|
|
||||||
hide-bottom-space
|
|
||||||
:label="`${'ประเทศที่ลาติดตามคู่สมรส'}`"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<datepicker
|
<datepicker
|
||||||
:readonly="!typeLeave"
|
:readonly="!typeLeave"
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,6 @@ const modalDialogSalary = ref<boolean>(false); //แสดง popup ตำแห
|
||||||
const isStatusEdit = ref<boolean>(false); //สถานะแก้ไขข้อมูลตำแหน่งเงินเดือน
|
const isStatusEdit = ref<boolean>(false); //สถานะแก้ไขข้อมูลตำแหน่งเงินเดือน
|
||||||
const salaryId = ref<string>(""); //id ที่ต้องการแก้ไข
|
const salaryId = ref<string>(""); //id ที่ต้องการแก้ไข
|
||||||
const dataLevel = ref<DataPosType[]>([]); //รายการ ตำแหน่งเงินเดือน
|
const dataLevel = ref<DataPosType[]>([]); //รายการ ตำแหน่งเงินเดือน
|
||||||
const idCommandId = ref<boolean>(false); //เช็คว่ามี commandId หรือไม่
|
|
||||||
|
|
||||||
const commandCodeOptions = ref<DataOption[]>(store.commandCodeData); //รายการปรเภทคำสั่ง
|
const commandCodeOptions = ref<DataOption[]>(store.commandCodeData); //รายการปรเภทคำสั่ง
|
||||||
const posTypeOptions = ref<DataOption[]>(store.posTypeData); //รายการประเภทตำแหน่ง | กลุ่มงาน
|
const posTypeOptions = ref<DataOption[]>(store.posTypeData); //รายการประเภทตำแหน่ง | กลุ่มงาน
|
||||||
|
|
@ -659,7 +658,6 @@ async function onClickOpenDialog(
|
||||||
} else {
|
} else {
|
||||||
await fetchOptionGroup();
|
await fetchOptionGroup();
|
||||||
}
|
}
|
||||||
idCommandId.value = statusEdit ? (data.commandId ? true : false) : false;
|
|
||||||
commandCodeOptions.value = store.commandCodeData;
|
commandCodeOptions.value = store.commandCodeData;
|
||||||
posTypeOptions.value = store.posTypeData;
|
posTypeOptions.value = store.posTypeData;
|
||||||
posLevelOptions.value = store.posLevelData;
|
posLevelOptions.value = store.posLevelData;
|
||||||
|
|
@ -980,7 +978,6 @@ onMounted(async () => {
|
||||||
<q-tooltip>ประวัติแก้ไขตำแหน่ง/เงินเดือน</q-tooltip>
|
<q-tooltip>ประวัติแก้ไขตำแหน่ง/เงินเดือน</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<!-- :disable="(props.row.commandId !== null && props.row.commandId !== '') || props.row.commandType === 'C-PM-47'" -->
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="
|
||||||
!isLeave &&
|
!isLeave &&
|
||||||
|
|
@ -988,7 +985,11 @@ onMounted(async () => {
|
||||||
checkPermission($route)?.attrOwnership === 'OWNER'
|
checkPermission($route)?.attrOwnership === 'OWNER'
|
||||||
"
|
"
|
||||||
flat
|
flat
|
||||||
color="edit"
|
:disable="
|
||||||
|
(props.row.commandId !== null && props.row.commandId !== '') ||
|
||||||
|
props.row.commandType === 'C-PM-47'
|
||||||
|
"
|
||||||
|
:color="props.row.commandId ? 'grey' : 'edit'"
|
||||||
dense
|
dense
|
||||||
round
|
round
|
||||||
icon="edit"
|
icon="edit"
|
||||||
|
|
@ -1153,8 +1154,7 @@ onMounted(async () => {
|
||||||
<div class="row q-col-gutter-sm">
|
<div class="row q-col-gutter-sm">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<q-input
|
<q-input
|
||||||
:class="classInput(!idCommandId)"
|
:class="classInput(true)"
|
||||||
:readonly="idCommandId"
|
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
|
@ -1174,8 +1174,7 @@ onMounted(async () => {
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
:class="classInput(!idCommandId)"
|
class="inputgreen"
|
||||||
:disabled="idCommandId"
|
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -1192,8 +1191,6 @@ onMounted(async () => {
|
||||||
: formData.commandYear + 543
|
: formData.commandYear + 543
|
||||||
"
|
"
|
||||||
label="ปี พ.ศ."
|
label="ปี พ.ศ."
|
||||||
:class="classInput(!idCommandId)"
|
|
||||||
:readonly="idCommandId"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
|
||||||
|
|
@ -1,424 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, onMounted, reactive } from "vue";
|
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
|
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { checkPermission } from "@/utils/permissions";
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
import { useAbsentLateStore } from "@/modules/04_registryPerson/stores/AbsentLate";
|
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
|
|
||||||
import type { QTableColumn } from "quasar";
|
|
||||||
import type { ResAbsentLateData} from "@/modules/04_registryPerson/interface/response/Government";
|
|
||||||
|
|
||||||
import DialogAbsentLate from "@/modules/04_registryPerson/components/detail/GovernmentInformation/08_DialogAbsentLate.vue";
|
|
||||||
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const absentLateStore = useAbsentLateStore();
|
|
||||||
const $q = useQuasar();
|
|
||||||
const {
|
|
||||||
date2Thai,
|
|
||||||
dialogConfirm,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
messageError,
|
|
||||||
success,
|
|
||||||
pathRegistryEmp,
|
|
||||||
onSearchDataTable,
|
|
||||||
convertDateToAPI,
|
|
||||||
dialogRemove,
|
|
||||||
} = useCounterMixin();
|
|
||||||
|
|
||||||
const profileId = ref<string>(
|
|
||||||
route.params.id ? route.params.id.toString() : ""
|
|
||||||
);
|
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
|
||||||
|
|
||||||
const isLeave = defineModel<boolean>("isLeave", {
|
|
||||||
required: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const baseColumns = ref<QTableColumn[]>([
|
|
||||||
{
|
|
||||||
name: "status",
|
|
||||||
align: "left",
|
|
||||||
label: "มาสาย/ ขาดราชการ",
|
|
||||||
sortable: true,
|
|
||||||
field: "status",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
const status = absentLateStore.statusOps.find(
|
|
||||||
(option) => option.id === val
|
|
||||||
);
|
|
||||||
return status ? status.name : val;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "stampDate",
|
|
||||||
align: "left",
|
|
||||||
label: "วันที่ลงเวลา",
|
|
||||||
sortable: true,
|
|
||||||
field: "stampDate",
|
|
||||||
format: (v) => date2Thai(v),
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "stampType",
|
|
||||||
align: "left",
|
|
||||||
label: "ประเภทการลงเวลา",
|
|
||||||
sortable: true,
|
|
||||||
field: "stampType",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val) {
|
|
||||||
const type = absentLateStore.stampTypeOps.find(
|
|
||||||
(option) => option.id === val
|
|
||||||
);
|
|
||||||
return type ? type.name : val;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "stampAmount",
|
|
||||||
align: "left",
|
|
||||||
label: "จำนวน",
|
|
||||||
sortable: true,
|
|
||||||
field: "stampAmount",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "remark",
|
|
||||||
align: "left",
|
|
||||||
label: "หมายเหตุ",
|
|
||||||
sortable: true,
|
|
||||||
field: "remark",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const baseVisibleColumns = ref<string[]>([
|
|
||||||
"status",
|
|
||||||
"stampDate",
|
|
||||||
"stampType",
|
|
||||||
"stampAmount",
|
|
||||||
"remark",
|
|
||||||
]);
|
|
||||||
|
|
||||||
/** Table*/
|
|
||||||
const rows = ref<ResAbsentLateData[]>([]);
|
|
||||||
const rowsMain = ref<ResAbsentLateData[]>([]);
|
|
||||||
const mode = ref<string>("table"); //การแสดงผล Table card
|
|
||||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
|
||||||
const columns = ref<QTableColumn[]>(
|
|
||||||
baseColumns.value.filter((e: QTableColumn) => e.name !== "lastUpdateFullName")
|
|
||||||
);
|
|
||||||
const visibleColumns = ref<string[]>(
|
|
||||||
baseVisibleColumns.value.filter((e: string) => e !== "lastUpdateFullName")
|
|
||||||
);
|
|
||||||
const pagination = ref({
|
|
||||||
sortBy: "lastUpdatedAt",
|
|
||||||
});
|
|
||||||
|
|
||||||
const columnsHistory = ref<QTableColumn[]>(baseColumns.value);
|
|
||||||
const visibleColumnsHistory = ref<string[]>(baseVisibleColumns.value);
|
|
||||||
|
|
||||||
/** Dialog*/
|
|
||||||
const isStatusEdit = ref<boolean>(false);
|
|
||||||
const modal = ref<boolean>(false);
|
|
||||||
const modalHistory = ref<boolean>(false);
|
|
||||||
const rowId = ref<string>("");
|
|
||||||
const dataAbsentLate = ref<ResAbsentLateData | null>(null);
|
|
||||||
|
|
||||||
async function fetchData() {
|
|
||||||
showLoader();
|
|
||||||
try {
|
|
||||||
const res = await http.get(
|
|
||||||
config.API.profileAbsentLate(empType.value) + `/${profileId.value}`
|
|
||||||
);
|
|
||||||
const data = res.data.result;
|
|
||||||
rowsMain.value = data;
|
|
||||||
serchDataTable();
|
|
||||||
} catch (err) {
|
|
||||||
messageError($q, err);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** function fetch ข้อมูลประวัติการแก้ไขข้อมูล*/
|
|
||||||
async function fetchDataHistory() {
|
|
||||||
showLoader();
|
|
||||||
try {
|
|
||||||
const res = await http.get(
|
|
||||||
config.API.profileAbsentLateHistory(rowId.value, empType.value)
|
|
||||||
);
|
|
||||||
return res.data.result;
|
|
||||||
} catch (err) {
|
|
||||||
messageError($q, err);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openEditDialog(data: any) {
|
|
||||||
modal.value = true;
|
|
||||||
isStatusEdit.value = true;
|
|
||||||
rowId.value = data.id;
|
|
||||||
dataAbsentLate.value = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showHistoryDialog(id: string) {
|
|
||||||
modalHistory.value = true;
|
|
||||||
rowId.value = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ค้นหาข้อมูลขาดราชการ/มาสาย*/
|
|
||||||
function serchDataTable() {
|
|
||||||
rows.value = onSearchDataTable(
|
|
||||||
filterKeyword.value,
|
|
||||||
rowsMain.value,
|
|
||||||
columns.value ? columns.value : []
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDelete(rowId: string) {
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
showLoader();
|
|
||||||
try {
|
|
||||||
await http.patch(
|
|
||||||
config.API.profileAbsentLateUpdateDelete(empType.value) + `/${rowId}`
|
|
||||||
);
|
|
||||||
await fetchData();
|
|
||||||
await success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
} catch (err) {
|
|
||||||
messageError($q, err);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
fetchData();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="row items-center q-gutter-x-sm q-pb-sm">
|
|
||||||
<q-btn
|
|
||||||
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
|
|
||||||
dense
|
|
||||||
color="primary"
|
|
||||||
icon="add"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
@click.stop.prevent="(modal = true), (isStatusEdit = false)"
|
|
||||||
>
|
|
||||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-space />
|
|
||||||
<q-input
|
|
||||||
standout
|
|
||||||
dense
|
|
||||||
v-model="filterKeyword"
|
|
||||||
ref="filterRef"
|
|
||||||
outlined
|
|
||||||
placeholder="ค้นหา"
|
|
||||||
@keydown.enter.prevent="serchDataTable"
|
|
||||||
>
|
|
||||||
<template v-slot:append>
|
|
||||||
<q-icon name="search" />
|
|
||||||
</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"
|
|
||||||
style="min-width: 140px"
|
|
||||||
/>
|
|
||||||
<q-btn-toggle
|
|
||||||
v-model="mode"
|
|
||||||
dense
|
|
||||||
class="no-shadow toggle-borderd"
|
|
||||||
toggle-color="grey-4"
|
|
||||||
:options="[
|
|
||||||
{ value: 'table', slot: 'table' },
|
|
||||||
{ value: 'card', slot: 'card' },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<template v-slot:table>
|
|
||||||
<q-icon
|
|
||||||
name="format_list_bulleted"
|
|
||||||
size="24px"
|
|
||||||
:style="{
|
|
||||||
color: mode === 'table' ? '#787B7C' : '#C9D3DB',
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-slot:card>
|
|
||||||
<q-icon
|
|
||||||
name="mdi-view-grid-outline"
|
|
||||||
size="24px"
|
|
||||||
:style="{
|
|
||||||
color: mode === 'card' ? '#787B7C' : '#C9D3DB',
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</q-btn-toggle>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<d-table
|
|
||||||
:grid="mode === 'card'"
|
|
||||||
ref="table"
|
|
||||||
row-key="id"
|
|
||||||
flat
|
|
||||||
bordered
|
|
||||||
dense
|
|
||||||
:columns="columns"
|
|
||||||
:rows="rows"
|
|
||||||
:visible-columns="visibleColumns"
|
|
||||||
v-model:pagination="pagination"
|
|
||||||
>
|
|
||||||
>
|
|
||||||
<template v-slot:header="props">
|
|
||||||
<q-tr :props="props">
|
|
||||||
<q-th auto-width></q-th>
|
|
||||||
<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" v-if="mode === 'table'">
|
|
||||||
<q-tr :props="props">
|
|
||||||
<q-td auto-width>
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
color="deep-purple"
|
|
||||||
icon="mdi-history"
|
|
||||||
@click.stop.prevent="showHistoryDialog(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ประวัติแก้ไขขาดราชการ/มาสาย</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
<q-btn
|
|
||||||
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
color="edit"
|
|
||||||
icon="edit"
|
|
||||||
@click.stop.prevent="openEditDialog(props.row)"
|
|
||||||
>
|
|
||||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="!isLeave && checkPermission($route)?.attrIsDelete"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
color="red"
|
|
||||||
icon="delete"
|
|
||||||
@click.stop.prevent="onDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
|
||||||
<div>
|
|
||||||
{{ col.value ? col.value : "-" }}
|
|
||||||
</div>
|
|
||||||
</q-td>
|
|
||||||
</q-tr>
|
|
||||||
</template>
|
|
||||||
<template v-slot:item="props" v-else>
|
|
||||||
<div class="q-pa-xs col-xs-12 col-sm-4 col-md-3">
|
|
||||||
<q-card flat bordered>
|
|
||||||
<q-card-actions align="right" class="bg-grey-3">
|
|
||||||
<q-btn
|
|
||||||
color="deep-purple"
|
|
||||||
icon="mdi-history"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
@click.stop.prevent="showHistoryDialog(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ประวัติแก้ไขขาดราชการ/มาสาย</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="isLeave === false && checkPermission($route)?.attrIsUpdate"
|
|
||||||
:color="props.row.commandId ? 'grey-5' : 'edit'"
|
|
||||||
:disable="props.row.commandId !== null"
|
|
||||||
icon="edit"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
@click.stop.prevent="openEditDialog(props.row)"
|
|
||||||
>
|
|
||||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="isLeave === false && checkPermission($route)?.attrIsDelete"
|
|
||||||
color="red"
|
|
||||||
icon="delete"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
@click.stop.prevent="onDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-card-actions>
|
|
||||||
<q-separator />
|
|
||||||
|
|
||||||
<q-list>
|
|
||||||
<div
|
|
||||||
:class="`row q-pa-sm`"
|
|
||||||
:style="`background-color: ${index % 2 !== 0 ? '#FAFAFA' : ''}`"
|
|
||||||
v-for="(col, index) in props.cols"
|
|
||||||
:key="col.name"
|
|
||||||
>
|
|
||||||
<div class="col text-grey-6">
|
|
||||||
<div>{{ col.label }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<div>{{ col.value ? col.value : "-" }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-list>
|
|
||||||
</q-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</d-table>
|
|
||||||
|
|
||||||
<DialogAbsentLate
|
|
||||||
v-model:modal="modal"
|
|
||||||
v-model:isStatusEdit="isStatusEdit"
|
|
||||||
:fetchData="fetchData"
|
|
||||||
:rowId="rowId"
|
|
||||||
:dataAbsentLate="dataAbsentLate"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DialogHistory
|
|
||||||
v-model:modal="modalHistory"
|
|
||||||
:title="`ประวัติแก้ไขขาดราชการ/มาสาย`"
|
|
||||||
:columns="columnsHistory"
|
|
||||||
:visible-columns="visibleColumnsHistory"
|
|
||||||
:fetch-data="fetchDataHistory"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
|
@ -1,263 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import { reactive, ref, computed, watch } from "vue";
|
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
|
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
import { useAbsentLateStore } from "@/modules/04_registryPerson/stores/AbsentLate";
|
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
|
|
||||||
/** import components*/
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
|
||||||
|
|
||||||
//use
|
|
||||||
const $q = useQuasar();
|
|
||||||
const route = useRoute();
|
|
||||||
const absentLateStore = useAbsentLateStore();
|
|
||||||
const {
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
messageError,
|
|
||||||
success,
|
|
||||||
date2Thai,
|
|
||||||
convertDateToAPI,
|
|
||||||
dialogConfirm,
|
|
||||||
pathRegistryEmp,
|
|
||||||
} = useCounterMixin();
|
|
||||||
|
|
||||||
//props
|
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
|
||||||
const isStatusEdit = defineModel<boolean>("isStatusEdit", { required: true });
|
|
||||||
const rowId = defineModel<string>("rowId", { required: true });
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
fetchData: () => Promise<void>;
|
|
||||||
dataAbsentLate: any;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const profileId = ref<string>(route.params.id?.toString() ?? ""); //ProfileId
|
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
|
||||||
|
|
||||||
const form = reactive({
|
|
||||||
status: "",
|
|
||||||
stampDate: new Date(),
|
|
||||||
stampType: "FULL_DAY",
|
|
||||||
stampAmount: "1.0",
|
|
||||||
remark: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const tittle = computed(() => {
|
|
||||||
return isStatusEdit.value
|
|
||||||
? "แก้ไขข้อมูลขาดราชการ/มาสาย"
|
|
||||||
: "เพิ่มข้อมูลขาดราชการ/มาสาย";
|
|
||||||
});
|
|
||||||
|
|
||||||
function onSubmit() {
|
|
||||||
dialogConfirm($q, async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
const payload = {
|
|
||||||
...form,
|
|
||||||
stampDate: convertDateToAPI(form.stampDate),
|
|
||||||
profileId:
|
|
||||||
!isStatusEdit.value && empType.value === ""
|
|
||||||
? profileId.value
|
|
||||||
: undefined,
|
|
||||||
profileEmployeeId:
|
|
||||||
!isStatusEdit.value && empType.value !== ""
|
|
||||||
? profileId.value
|
|
||||||
: undefined,
|
|
||||||
};
|
|
||||||
const method = isStatusEdit.value ? "patch" : "post";
|
|
||||||
const url = isStatusEdit.value
|
|
||||||
? config.API.profileAbsentLate(empType.value) + `/${rowId.value}`
|
|
||||||
: config.API.profileAbsentLate(empType.value);
|
|
||||||
await http[method](url, payload);
|
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
||||||
props.fetchData();
|
|
||||||
closeDialog();
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** function ปิด popup*/
|
|
||||||
function closeDialog() {
|
|
||||||
modal.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => form.stampType,
|
|
||||||
(stampType) => {
|
|
||||||
if (stampType === "FULL_DAY") {
|
|
||||||
form.stampAmount = "1.0";
|
|
||||||
} else if (stampType === "MORNING" || stampType === "AFTERNOON") {
|
|
||||||
form.stampAmount = "0.5";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => modal.value,
|
|
||||||
(newVal) => {
|
|
||||||
if (newVal) {
|
|
||||||
form.status = isStatusEdit.value ? props.dataAbsentLate.status : "";
|
|
||||||
form.stampDate = isStatusEdit.value
|
|
||||||
? new Date(props.dataAbsentLate.stampDate)
|
|
||||||
: new Date();
|
|
||||||
form.stampType = isStatusEdit.value
|
|
||||||
? props.dataAbsentLate.stampType
|
|
||||||
: "FULL_DAY";
|
|
||||||
form.stampAmount = isStatusEdit.value
|
|
||||||
? props.dataAbsentLate.stampAmount
|
|
||||||
: "1.0";
|
|
||||||
form.remark = isStatusEdit.value ? props.dataAbsentLate.remark : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<q-dialog v-model="modal" persistent>
|
|
||||||
<q-card style="min-width: 50vw">
|
|
||||||
<q-form greedy @submit.prevent="onSubmit">
|
|
||||||
<DialogHeader :tittle="tittle" :close="closeDialog" />
|
|
||||||
<q-separator />
|
|
||||||
|
|
||||||
<q-card-section class="q-pa-md">
|
|
||||||
<div class="col-12 row q-col-gutter-sm">
|
|
||||||
<div class="col-12 row">
|
|
||||||
<div class="col-md-4 col-sm-12">
|
|
||||||
<q-select
|
|
||||||
class="full-width inputgreen cursor-pointer"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
v-model="form.status"
|
|
||||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะ'}`]"
|
|
||||||
hide-bottom-space
|
|
||||||
:label="`${'สถานะ'}`"
|
|
||||||
map-options
|
|
||||||
emit-value
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
:options="absentLateStore.statusOps"
|
|
||||||
use-input
|
|
||||||
hide-selected
|
|
||||||
fill-input
|
|
||||||
input-debounce="0"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-4 col-sm-12">
|
|
||||||
<datepicker
|
|
||||||
class="inputgreen"
|
|
||||||
menu-class-name="modalfix"
|
|
||||||
v-model="form.stampDate"
|
|
||||||
:locale="'th'"
|
|
||||||
autoApply
|
|
||||||
borderless
|
|
||||||
:enableTimePicker="false"
|
|
||||||
week-start="0"
|
|
||||||
>
|
|
||||||
<template #year="{ year }">
|
|
||||||
{{ year + 543 }}
|
|
||||||
</template>
|
|
||||||
<template #year-overlay-value="{ value }">
|
|
||||||
{{ parseInt(value + 543) }}
|
|
||||||
</template>
|
|
||||||
<template #trigger>
|
|
||||||
<q-input
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
hide-bottom-space
|
|
||||||
class="full-width"
|
|
||||||
:model-value="
|
|
||||||
form.stampDate != null ? date2Thai(form.stampDate) : null
|
|
||||||
"
|
|
||||||
:label="`${'วันที่ลงเวลา'}`"
|
|
||||||
:rules="[
|
|
||||||
(val: string) =>
|
|
||||||
!!val || `${'กรุณาเลือกวันที่ลงเวลา'}`,
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<template v-slot:prepend>
|
|
||||||
<q-icon
|
|
||||||
name="event"
|
|
||||||
class="cursor-pointer"
|
|
||||||
style="color: var(--q-primary)"
|
|
||||||
>
|
|
||||||
</q-icon>
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
</datepicker>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 col-xs-12">
|
|
||||||
<q-select
|
|
||||||
class="full-width inputgreen cursor-pointer"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
v-model="form.stampType"
|
|
||||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทการลงเวลา'}`]"
|
|
||||||
hide-bottom-space
|
|
||||||
:label="`${'ประเภทการลงเวลา'}`"
|
|
||||||
map-options
|
|
||||||
emit-value
|
|
||||||
option-label="name"
|
|
||||||
:options="absentLateStore.stampTypeOps"
|
|
||||||
option-value="id"
|
|
||||||
use-input
|
|
||||||
hide-selected
|
|
||||||
fill-input
|
|
||||||
input-debounce="0"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-4 col-xs-12">
|
|
||||||
<q-input
|
|
||||||
class="inputgreen"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
v-model="form.stampAmount"
|
|
||||||
label="จำนวน"
|
|
||||||
hide-bottom-space
|
|
||||||
readonly
|
|
||||||
:rules="[(val:string) => !!val ||
|
|
||||||
`${'กรุณากรอกจำนวน'}`]"
|
|
||||||
mask="#.#"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12">
|
|
||||||
<q-input
|
|
||||||
class="inputgreen"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
v-model="form.remark"
|
|
||||||
label="เหตุผล"
|
|
||||||
hide-bottom-space
|
|
||||||
type="textarea"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
<q-separator />
|
|
||||||
|
|
||||||
<q-card-actions align="right">
|
|
||||||
<q-btn type="submit" :label="`บันทึก`" color="public">
|
|
||||||
<q-tooltip>บันทึก</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-card-actions>
|
|
||||||
</q-form>
|
|
||||||
</q-card>
|
|
||||||
</q-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
|
@ -14,7 +14,6 @@ import PerformSpecialWork from "@/modules/04_registryPerson/components/detail/Go
|
||||||
import ActingPos from "@/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue"; //รักษาการในตำแหน่ง
|
import ActingPos from "@/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue"; //รักษาการในตำแหน่ง
|
||||||
import HelpGovernmentDetail from "@/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue"; //ช่วยราชการ
|
import HelpGovernmentDetail from "@/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue"; //ช่วยราชการ
|
||||||
import Postion from "@/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue";
|
import Postion from "@/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue";
|
||||||
import AbsentLate from "@/modules/04_registryPerson/components/detail/GovernmentInformation/08_AbsentLate.vue";
|
|
||||||
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
|
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
|
||||||
|
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||||
|
|
@ -48,7 +47,6 @@ const storeRegistry = useRegistryNewDataStore();
|
||||||
<q-tab v-if="empType != '-employee'" name="6" label="ช่วยราชการ" />
|
<q-tab v-if="empType != '-employee'" name="6" label="ช่วยราชการ" />
|
||||||
<q-tab name="2" label="วินัย" />
|
<q-tab name="2" label="วินัย" />
|
||||||
<q-tab name="3" label="การลา" />
|
<q-tab name="3" label="การลา" />
|
||||||
<q-tab name="8" label="ขาดราชการ/มาสาย" />
|
|
||||||
<q-tab name="4" label="ปฏิบัติราชการพิเศษ" />
|
<q-tab name="4" label="ปฏิบัติราชการพิเศษ" />
|
||||||
</q-tabs>
|
</q-tabs>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
@ -78,9 +76,6 @@ const storeRegistry = useRegistryNewDataStore();
|
||||||
:citizen-id="storeRegistry.citizenId"
|
:citizen-id="storeRegistry.citizenId"
|
||||||
/>
|
/>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
<q-tab-panel name="8">
|
|
||||||
<AbsentLate :is-leave="storeRegistry.isLeave" />
|
|
||||||
</q-tab-panel>
|
|
||||||
<q-tab-panel name="7">
|
<q-tab-panel name="7">
|
||||||
<Postion
|
<Postion
|
||||||
:is-leave="storeRegistry.isLeave"
|
:is-leave="storeRegistry.isLeave"
|
||||||
|
|
|
||||||
|
|
@ -406,12 +406,6 @@ function calculateMinDate() {
|
||||||
return today;
|
return today;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prefixRankRule() {
|
|
||||||
return [
|
|
||||||
() => !!formData.rank || !!formData.prefix || "กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ดูการเปลี่ยนแปลงของวันเกิดเมื่อมีการเปลี่ยนแปลงจะคำนวนอายูใหม่*/
|
/** ดูการเปลี่ยนแปลงของวันเกิดเมื่อมีการเปลี่ยนแปลงจะคำนวนอายูใหม่*/
|
||||||
watch(
|
watch(
|
||||||
() => formData.birthDate,
|
() => formData.birthDate,
|
||||||
|
|
@ -605,8 +599,7 @@ onMounted(() => {
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:options="store.Ops.prefixOps"
|
:options="store.Ops.prefixOps"
|
||||||
:label="dataLabel.prefix"
|
:label="dataLabel.prefix"
|
||||||
:rules="prefixRankRule()"
|
:rules="[(val: string) => !!formData.rank || !!formData.prefix || `${'กรุณาเลือกคำนำหน้าชื่อ หรือยศ'}`]"
|
||||||
reactive-rules
|
|
||||||
@filter="(inputValue: string,
|
@filter="(inputValue: string,
|
||||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
|
doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
|
||||||
)"
|
)"
|
||||||
|
|
@ -627,8 +620,7 @@ onMounted(() => {
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="name"
|
option-value="name"
|
||||||
:rules="prefixRankRule()"
|
:rules="[(val: string) => !!formData.rank || !!formData.prefix || `${'กรุณาเลือกคำนำหน้าชื่อ หรือยศ'}`]"
|
||||||
reactive-rules
|
|
||||||
v-model="formData.rank"
|
v-model="formData.rank"
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:options="store.Ops.rankOps"
|
:options="store.Ops.rankOps"
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ const keyword = ref<string>(""); //คำค้นหา
|
||||||
const modalCommand = ref<boolean>(false);
|
const modalCommand = ref<boolean>(false);
|
||||||
const command = ref<string>("");
|
const command = ref<string>("");
|
||||||
const commandId = ref<string>("");
|
const commandId = ref<string>("");
|
||||||
const idCommandId = ref<boolean>(false); //สถานะการมีคำสั่ง
|
|
||||||
const baseColumns = ref<QTableColumn[]>([
|
const baseColumns = ref<QTableColumn[]>([
|
||||||
{
|
{
|
||||||
name: "commandDateAffect",
|
name: "commandDateAffect",
|
||||||
|
|
@ -639,7 +638,6 @@ async function onClickOpenDialog(
|
||||||
} else {
|
} else {
|
||||||
await fetchOptionGroup();
|
await fetchOptionGroup();
|
||||||
}
|
}
|
||||||
idCommandId.value = statusEdit && data.commandId ? true : false;
|
|
||||||
commandCodeOptions.value = store.commandCodeData;
|
commandCodeOptions.value = store.commandCodeData;
|
||||||
posTypeOptions.value = store.posTypeData;
|
posTypeOptions.value = store.posTypeData;
|
||||||
posLevelOptions.value = store.posLevelData;
|
posLevelOptions.value = store.posLevelData;
|
||||||
|
|
@ -941,10 +939,6 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-tooltip>ประวัติแก้ไขตำแหน่ง/เงินเดือน</q-tooltip>
|
<q-tooltip>ประวัติแก้ไขตำแหน่ง/เงินเดือน</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<!-- :disable="
|
|
||||||
(props.row.commandId !== null && props.row.commandId !== '') ||
|
|
||||||
props.row.commandType === 'C-PM-47'
|
|
||||||
" -->
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="
|
||||||
!isLeave &&
|
!isLeave &&
|
||||||
|
|
@ -952,7 +946,11 @@ onMounted(async () => {
|
||||||
checkPermission($route)?.attrOwnership === 'OWNER'
|
checkPermission($route)?.attrOwnership === 'OWNER'
|
||||||
"
|
"
|
||||||
flat
|
flat
|
||||||
color="edit"
|
:disable="
|
||||||
|
(props.row.commandId !== null && props.row.commandId !== '') ||
|
||||||
|
props.row.commandType === 'C-PM-47'
|
||||||
|
"
|
||||||
|
:color="props.row.commandId ? 'grey' : 'edit'"
|
||||||
dense
|
dense
|
||||||
round
|
round
|
||||||
icon="edit"
|
icon="edit"
|
||||||
|
|
@ -1121,8 +1119,7 @@ onMounted(async () => {
|
||||||
<div class="row q-col-gutter-sm">
|
<div class="row q-col-gutter-sm">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<q-input
|
<q-input
|
||||||
:class="classInput(!idCommandId)"
|
:class="classInput(true)"
|
||||||
:readonly="idCommandId"
|
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
|
@ -1142,8 +1139,7 @@ onMounted(async () => {
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
:class="classInput(!idCommandId)"
|
class="inputgreen"
|
||||||
:disable="idCommandId"
|
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -1160,8 +1156,6 @@ onMounted(async () => {
|
||||||
: formData.commandYear + 543
|
: formData.commandYear + 543
|
||||||
"
|
"
|
||||||
label="ปี พ.ศ."
|
label="ปี พ.ศ."
|
||||||
:class="classInput(!idCommandId)"
|
|
||||||
:readonly="idCommandId"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ interface FormMain {
|
||||||
workDate: any;
|
workDate: any;
|
||||||
reasonSameDate: string;
|
reasonSameDate: string;
|
||||||
retireDate: any;
|
retireDate: any;
|
||||||
ageAll: GovAgeForm | string;
|
ageAll: GovAgeForm;
|
||||||
govAgeBkk: GovAgeForm | string;
|
govAgeBkk: GovAgeForm;
|
||||||
absent: number;
|
absent: number;
|
||||||
age: number;
|
age: number;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ interface DetailData {
|
||||||
reason: string;
|
reason: string;
|
||||||
typeLeaveId: string;
|
typeLeaveId: string;
|
||||||
code: string;
|
code: string;
|
||||||
codeLeave:string
|
|
||||||
leaveSubTypeName:string
|
|
||||||
coupleDayLevelCountry:string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormFilter {
|
interface FormFilter {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ interface DataPosition {
|
||||||
status: string;
|
status: string;
|
||||||
posNumCodeSitAbb: string;
|
posNumCodeSitAbb: string;
|
||||||
posNumCodeSit: string;
|
posNumCodeSit: string;
|
||||||
positionExecutiveField: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { DataSalaryPos, DataPosition };
|
export type { DataSalaryPos, DataPosition };
|
||||||
|
|
|
||||||
|
|
@ -44,21 +44,4 @@ interface ResFileData {
|
||||||
pathname: string;
|
pathname: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ResAbsentLateData {
|
export type { ResActingPosData, ResAssistanceData, ResFileData };
|
||||||
createdAt: string;
|
|
||||||
createdFullName: string;
|
|
||||||
createdUserId: string;
|
|
||||||
id: string;
|
|
||||||
isDeleted: boolean;
|
|
||||||
lastUpdateFullName: string;
|
|
||||||
lastUpdateUserId: string;
|
|
||||||
lastUpdatedAt: string;
|
|
||||||
profileId: string;
|
|
||||||
remark: string;
|
|
||||||
stampAmount: string;
|
|
||||||
stampDate: string;
|
|
||||||
stampType: string;
|
|
||||||
status: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type { ResActingPosData, ResAssistanceData, ResFileData, ResAbsentLateData };
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { ref } from "vue";
|
|
||||||
import { defineStore } from "pinia";
|
|
||||||
|
|
||||||
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
|
||||||
|
|
||||||
export const useAbsentLateStore = defineStore("absentLate", () => {
|
|
||||||
const statusOps = ref<DataOption[]>([
|
|
||||||
{ name: "ขาดราชการ", id: "ABSENT" },
|
|
||||||
{ name: "มาสาย", id: "LATE" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const stampTypeOps = ref<DataOption[]>([
|
|
||||||
{ name: "เต็มวัน", id: "FULL_DAY" },
|
|
||||||
{ name: "ครึ่งเช้า", id: "MORNING" },
|
|
||||||
{ name: "ครึ่งบ่าย ", id: "AFTERNOON" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
return { statusOps, stampTypeOps };
|
|
||||||
});
|
|
||||||
|
|
@ -1,177 +0,0 @@
|
||||||
import * as XLSX from "xlsx";
|
|
||||||
|
|
||||||
export interface ExcelPreviewData {
|
|
||||||
fileName: string;
|
|
||||||
fileSize: number;
|
|
||||||
sheetNames: string[];
|
|
||||||
headers: string[];
|
|
||||||
rows: Array<Record<string, any>>;
|
|
||||||
totalRows: number;
|
|
||||||
previewRows: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ParseOptions {
|
|
||||||
maxPreviewRows?: number;
|
|
||||||
sheetIndex?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DEFAULT_CONFIG = {
|
|
||||||
MAX_FILE_SIZE: 10 * 1024 * 1024, // 10MB
|
|
||||||
MAX_PREVIEW_ROWS: 0, // 0 = ไม่จำกัด แสดงทั้งหมด
|
|
||||||
ALLOWED_EXTENSIONS: [".xlsx", ".xls"],
|
|
||||||
};
|
|
||||||
|
|
||||||
function formatFileSize(bytes: number): string {
|
|
||||||
if (bytes === 0) return "0 Bytes";
|
|
||||||
const k = 1024;
|
|
||||||
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
||||||
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileExtension(fileName: string): string {
|
|
||||||
return fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateFile(file: File): { message: string } | null {
|
|
||||||
const extension = getFileExtension(file.name);
|
|
||||||
|
|
||||||
if (!DEFAULT_CONFIG.ALLOWED_EXTENSIONS.includes(extension)) {
|
|
||||||
return {
|
|
||||||
message: `กรุณาเลือกไฟล์ Excel เท่านั้น (${DEFAULT_CONFIG.ALLOWED_EXTENSIONS.join(", ")})`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.size > DEFAULT_CONFIG.MAX_FILE_SIZE) {
|
|
||||||
const fileSizeMB = (file.size / (1024 * 1024)).toFixed(2);
|
|
||||||
const maxSizeMB = (DEFAULT_CONFIG.MAX_FILE_SIZE / (1024 * 1024)).toFixed(2);
|
|
||||||
return {
|
|
||||||
message: `ขนาดไฟล์เกิน ${maxSizeMB}MB (ไฟล์ของคุณ: ${fileSizeMB}MB)`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function parseExcelFile(
|
|
||||||
file: File,
|
|
||||||
options: ParseOptions = {}
|
|
||||||
): Promise<ExcelPreviewData> {
|
|
||||||
const maxPreviewRows = options.maxPreviewRows ?? DEFAULT_CONFIG.MAX_PREVIEW_ROWS;
|
|
||||||
const sheetIndex = options.sheetIndex ?? 0;
|
|
||||||
|
|
||||||
// Validate file
|
|
||||||
const validationError = validateFile(file);
|
|
||||||
if (validationError) {
|
|
||||||
throw new Error(validationError.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const reader = new FileReader();
|
|
||||||
|
|
||||||
reader.onload = (e) => {
|
|
||||||
try {
|
|
||||||
const data = e.target?.result;
|
|
||||||
if (!data) {
|
|
||||||
reject(new Error("ไม่สามารถอ่านไฟล์ได้"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const workbook = XLSX.read(data, { type: "binary" });
|
|
||||||
|
|
||||||
if (workbook.SheetNames.length === 0) {
|
|
||||||
reject(new Error("ไฟล์ไม่มีข้อมูล"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sheetName = workbook.SheetNames[sheetIndex];
|
|
||||||
const worksheet = workbook.Sheets[sheetName];
|
|
||||||
|
|
||||||
// ใช้ sheet_to_json กับ raw: true เพื่ออ่าน raw values ก่อน
|
|
||||||
const jsonData = XLSX.utils.sheet_to_json(worksheet, {
|
|
||||||
header: 1,
|
|
||||||
defval: "",
|
|
||||||
raw: true, // อ่าน raw values
|
|
||||||
}) as any[][];
|
|
||||||
|
|
||||||
// หลังจากได้ raw data แล้ว ต้องไปอ่านค่าจาก formula ที่ cells โดยตรง
|
|
||||||
// เพราะบาง formula อาจจะยังไม่ถูกคำนวณ
|
|
||||||
const range = XLSX.utils.decode_range(worksheet["!ref"] || "A1");
|
|
||||||
|
|
||||||
// อ่านค่าจาก cells ที่มี formula (column สุดท้าย)
|
|
||||||
for (let row = range.s.r; row <= range.e.r; row++) {
|
|
||||||
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
||||||
const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
|
|
||||||
const cell = worksheet[cellAddress];
|
|
||||||
|
|
||||||
// ถ้ามี formula ให้ใช้ผลลัพธ์ที่คำนวณแล้ว
|
|
||||||
if (cell && cell.f && !cell.v) {
|
|
||||||
// ลองใช้ cell.w (formatted value) ถ้ามี
|
|
||||||
if (cell.w) {
|
|
||||||
// แปลง array index ให้ถูกต้อง (row + 1 เพราะมี header row)
|
|
||||||
const arrayRowIndex = row - range.s.r;
|
|
||||||
if (jsonData[arrayRowIndex] && jsonData[arrayRowIndex][col] !== undefined) {
|
|
||||||
jsonData[arrayRowIndex][col] = cell.w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonData.length === 0) {
|
|
||||||
reject(new Error("ไฟล์ไม่มีข้อมูล"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract headers from first row (ภาษาไทย)
|
|
||||||
const headers = jsonData[0].map((h: any) => String(h ?? ""));
|
|
||||||
|
|
||||||
// Extract data rows (skip header row)
|
|
||||||
const dataRows = jsonData.slice(1).filter((row) => row.some((cell) => cell !== ""));
|
|
||||||
|
|
||||||
if (dataRows.length === 0) {
|
|
||||||
reject(new Error("ไฟล์ไม่มีข้อมูล"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert to array of objects - ใช้ header จาก Excel เป็น field names โดยตรง
|
|
||||||
// ถ้า maxPreviewRows = 0 จะแสดงทั้งหมด มิฉะนั้นจะแสดงตามจำนวนที่กำหนด
|
|
||||||
const rowsToProcess = maxPreviewRows === 0 ? dataRows : dataRows.slice(0, maxPreviewRows);
|
|
||||||
const rows = rowsToProcess.map((row, rowIndex) => {
|
|
||||||
const obj: Record<string, any> = {
|
|
||||||
id: `row_${rowIndex}`,
|
|
||||||
};
|
|
||||||
|
|
||||||
// ใช้ header เป็น field names โดยตรง
|
|
||||||
headers.forEach((header, index) => {
|
|
||||||
const cellValue = row[index] ?? "";
|
|
||||||
// ใช้ค่าจาก Excel โดยตรง ไม่แปลงค่า
|
|
||||||
obj[header] = cellValue;
|
|
||||||
});
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
});
|
|
||||||
|
|
||||||
resolve({
|
|
||||||
fileName: file.name,
|
|
||||||
fileSize: file.size,
|
|
||||||
sheetNames: workbook.SheetNames,
|
|
||||||
headers,
|
|
||||||
rows,
|
|
||||||
totalRows: dataRows.length,
|
|
||||||
previewRows: rows.length,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
reject(new Error("ไม่สามารถอ่านไฟล์ Excel ได้ กรุณาตรวจสอบไฟล์อีกครั้ง"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
reader.onerror = () => {
|
|
||||||
reject(new Error("ไม่สามารถอ่านไฟล์ได้"));
|
|
||||||
};
|
|
||||||
|
|
||||||
reader.readAsBinaryString(file);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export { formatFileSize };
|
|
||||||
|
|
@ -1,157 +0,0 @@
|
||||||
import ExcelJS from "exceljs";
|
|
||||||
import { useEditPosDataStore } from "@/modules/04_registryPerson/stores/Edit";
|
|
||||||
|
|
||||||
import type { DataPosition } from "@/modules/04_registryPerson/interface/response/Edit";
|
|
||||||
|
|
||||||
const store = useEditPosDataStore();
|
|
||||||
|
|
||||||
// ฟังก์ชันแปลงวันที่จาก ISO format เป็นรูปแบบ dd/mm/yyyy (เช่น 18/05/2564)
|
|
||||||
function formatDateToDDMMYYYY(dateString: string | null | Date): string {
|
|
||||||
if (!dateString) return "";
|
|
||||||
|
|
||||||
const date = new Date(dateString);
|
|
||||||
if (isNaN(date.getTime())) return "";
|
|
||||||
|
|
||||||
const day = String(date.getDate()).padStart(2, "0");
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
||||||
const year = date.getFullYear() + 543; // แปลงเป็นปีพุทธศักราช
|
|
||||||
|
|
||||||
return `${day}/${month}/${year}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function exportToExcelPosition(data: DataPosition[]) {
|
|
||||||
const workbook = new ExcelJS.Workbook();
|
|
||||||
const worksheet = workbook.addWorksheet("รายการประวัติตำแหน่งเงินเดือน");
|
|
||||||
|
|
||||||
// --- ส่วนที่ 1: สร้าง Master Data Sheet สำหรับอ้างอิง ID ---
|
|
||||||
// เราจะซ่อนแผ่นงานนี้ไว้ (hidden) เพื่อใช้ทำ Dropdown และ VLOOKUP
|
|
||||||
const masterSheet = workbook.addWorksheet("MasterData", { state: "hidden" });
|
|
||||||
const masterData = store.commandCodeData; // [{id: 1, name: "ย้าย"}, ...]
|
|
||||||
|
|
||||||
masterData.forEach((item, index) => {
|
|
||||||
masterSheet.getCell(`A${index + 1}`).value = item.name;
|
|
||||||
masterSheet.getCell(`B${index + 1}`).value = item.id;
|
|
||||||
});
|
|
||||||
|
|
||||||
// --- ส่วนที่ 2: กำหนด Columns ---
|
|
||||||
worksheet.columns = [
|
|
||||||
{ header: "ลำดับ", key: "no", width: 8 },
|
|
||||||
{ header: "วันที่คำสั่งมีผล", key: "commandDateAffect", width: 18 },
|
|
||||||
{ header: "ตำแหน่งในสายงาน", key: "positionName", width: 25 },
|
|
||||||
{ header: "ตำแหน่งประเภท", key: "positionType", width: 18 },
|
|
||||||
{ header: "ระดับ", key: "positionLevel", width: 12 },
|
|
||||||
{ header: "ระดับซี", key: "positionCee", width: 12 },
|
|
||||||
{ header: "สายงาน", key: "positionLine", width: 20 },
|
|
||||||
{ header: "ด้าน/สาขา", key: "positionPathSide", width: 15 },
|
|
||||||
{ header: "ตำแหน่งทางการบริหาร", key: "positionExecutive", width: 20 },
|
|
||||||
{ header: "ด้านทางการบริหาร", key: "positionExecutiveField", width: 20 },
|
|
||||||
{ header: "เงินเดือน", key: "amount", width: 15 },
|
|
||||||
{ header: "เงินค่าตอบแทนรายเดือน", key: "mouthSalaryAmount", width: 15 },
|
|
||||||
{ header: "เงินประจำตำแหน่ง", key: "positionSalaryAmount", width: 15 },
|
|
||||||
{ header: "เงินค่าตอบแทนพิเศษ", key: "amountSpecial", width: 15 },
|
|
||||||
{ header: "หน่วยงาน", key: "organization", width: 30 },
|
|
||||||
{ header: "ส่วนราชการระดับ 1", key: "orgChild1", width: 20 },
|
|
||||||
{ header: "ส่วนราชการระดับ 2", key: "orgChild2", width: 20 },
|
|
||||||
{ header: "ส่วนราชการระดับ 3", key: "orgChild3", width: 20 },
|
|
||||||
{ header: "ส่วนราชการระดับ 4", key: "orgChild4", width: 20 },
|
|
||||||
{ header: "ตัวย่อเลขที่ตำแหน่ง", key: "posNoAbb", width: 15 },
|
|
||||||
{ header: "เลขที่ตำแหน่ง", key: "posNo", width: 15 },
|
|
||||||
{ header: "หน่วยงานที่ออกคำสั่ง", key: "posNumCodeSit", width: 20 },
|
|
||||||
{
|
|
||||||
header: "ตัวย่อหน่วยงานที่ออกคำสั่ง",
|
|
||||||
key: "posNumCodeSitAbb",
|
|
||||||
width: 15,
|
|
||||||
},
|
|
||||||
{ header: "เลขที่คำสั่ง", key: "commandNo", width: 15 },
|
|
||||||
{ header: "ปีเลขที่คำสั่ง", key: "commandYear", width: 12 },
|
|
||||||
{ header: "วันที่ลงนาม", key: "commandDateSign", width: 18 },
|
|
||||||
{ header: "ประเภทคำสั่ง", key: "commandCodeName", width: 25 }, // AA
|
|
||||||
{ header: "หมายเหตุ", key: "remark", width: 20 },
|
|
||||||
{ header: "commandId", key: "commandId", width: 20 }, // AC (ลำดับที่ 29)
|
|
||||||
{ header: "commandCode", key: "commandCode", width: 20 }, // AD (ลำดับที่ 30)
|
|
||||||
];
|
|
||||||
|
|
||||||
// 3. Map ข้อมูล
|
|
||||||
const newData = data.map((e, index) => ({
|
|
||||||
no: index + 1,
|
|
||||||
commandDateAffect: e.commandDateAffect
|
|
||||||
? formatDateToDDMMYYYY(e.commandDateAffect)
|
|
||||||
: "",
|
|
||||||
positionName: e.positionName,
|
|
||||||
positionType: e.positionType,
|
|
||||||
positionLevel: e.positionLevel,
|
|
||||||
positionCee: e.positionCee,
|
|
||||||
positionLine: e.positionLine || "",
|
|
||||||
positionPathSide: e.positionPathSide || "",
|
|
||||||
positionExecutive: e.positionExecutive,
|
|
||||||
positionExecutiveField: e.positionExecutiveField || "",
|
|
||||||
amount: e.amount || 0,
|
|
||||||
mouthSalaryAmount: e.mouthSalaryAmount || 0,
|
|
||||||
positionSalaryAmount: e.positionSalaryAmount || 0,
|
|
||||||
amountSpecial: e.amountSpecial || 0,
|
|
||||||
organization: e.orgRoot,
|
|
||||||
orgChild1: e.orgChild1,
|
|
||||||
orgChild2: e.orgChild2,
|
|
||||||
orgChild3: e.orgChild3,
|
|
||||||
orgChild4: e.orgChild4,
|
|
||||||
posNoAbb: e.posNoAbb,
|
|
||||||
posNo: e.posNo,
|
|
||||||
posNumCodeSit: e.posNumCodeSit,
|
|
||||||
posNumCodeSitAbb: e.posNumCodeSitAbb,
|
|
||||||
commandNo: e.commandNo,
|
|
||||||
commandYear: e.commandYear ? Number(e.commandYear) + 543 : "",
|
|
||||||
commandDateSign: e.commandDateSign
|
|
||||||
? formatDateToDDMMYYYY(e.commandDateSign)
|
|
||||||
: "",
|
|
||||||
commandCodeName: store.convertCommandCodeName(e.commandCode),
|
|
||||||
remark: e.remark,
|
|
||||||
commandId: e.commandId || "",
|
|
||||||
commandCode: e.commandCode || "", // ใส่ค่าเริ่มต้นไว้
|
|
||||||
}));
|
|
||||||
|
|
||||||
worksheet.addRows(newData);
|
|
||||||
|
|
||||||
// 4. ตกแต่งสี, Dropdown และ สูตร VLOOKUP
|
|
||||||
newData.forEach((_, index) => {
|
|
||||||
const rowIndex = index + 2;
|
|
||||||
|
|
||||||
// --- ตั้งค่า Format สำหรับเซลล์วันที่ ---
|
|
||||||
// เซลล์ B (commandDateAffect) และ Z (commandDateSign)
|
|
||||||
const dateAffectCell = worksheet.getCell(`B${rowIndex}`);
|
|
||||||
const dateSignCell = worksheet.getCell(`Z${rowIndex}`);
|
|
||||||
|
|
||||||
[dateAffectCell, dateSignCell].forEach((cell) => {
|
|
||||||
cell.numFmt = "dd/mm/yyyy";
|
|
||||||
});
|
|
||||||
|
|
||||||
// --- ทำ Dropdown คอลัมน์ AA ---
|
|
||||||
// อ้างอิงรายการจาก MasterData Sheet จะทำให้ Excel ทำงานได้เสถียรกว่า (กรณีรายการเยอะ)
|
|
||||||
worksheet.getCell(`AA${rowIndex}`).dataValidation = {
|
|
||||||
type: "list",
|
|
||||||
allowBlank: true,
|
|
||||||
formulae: [`MasterData!$A$1:$A$${masterData.length}`],
|
|
||||||
};
|
|
||||||
|
|
||||||
// --- ผูกสูตรให้ commandCode (AD) เปลี่ยนตามการเลือกใน AA ---
|
|
||||||
// AA คือประเภทคำสั่ง, AD คือ commandCode
|
|
||||||
worksheet.getCell(`AD${rowIndex}`).value = {
|
|
||||||
formula: `=IFERROR(VLOOKUP(AA${rowIndex}, MasterData!$A$1:$B$${masterData.length}, 2, FALSE), "")`,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// 5. สไตล์ Header
|
|
||||||
worksheet.getRow(1).font = { bold: true };
|
|
||||||
worksheet.getRow(1).alignment = { vertical: "middle", horizontal: "center" };
|
|
||||||
|
|
||||||
// 6. เขียนไฟล์
|
|
||||||
const buffer = await workbook.xlsx.writeBuffer();
|
|
||||||
const blob = new Blob([buffer], {
|
|
||||||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
||||||
});
|
|
||||||
const url = window.URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement("a");
|
|
||||||
a.href = url;
|
|
||||||
a.download = "รายการประวัติตำแหน่งเงินเดือน.xlsx";
|
|
||||||
a.click();
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
}
|
|
||||||
|
|
@ -806,13 +806,9 @@ function handleBackNavigation() {
|
||||||
router.go(-1);
|
router.go(-1);
|
||||||
} else {
|
} else {
|
||||||
if (empType.value === "") {
|
if (empType.value === "") {
|
||||||
storeRegistry.isLeave
|
router.push("/registry-officer");
|
||||||
? router.push("/registry-retire-officer")
|
|
||||||
: router.push("/registry-officer");
|
|
||||||
} else if (empType.value === "-employee") {
|
} else if (empType.value === "-employee") {
|
||||||
storeRegistry.isLeave
|
router.push("/registry-employee");
|
||||||
? router.push("/registry-retire-employee")
|
|
||||||
: router.push("/registry-employee");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,270 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, computed, watch } from "vue";
|
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
import moment from "moment";
|
|
||||||
|
|
||||||
import {
|
|
||||||
parseExcelFile,
|
|
||||||
formatFileSize,
|
|
||||||
} from "@/modules/04_registryPerson/utils/excelParser";
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
|
||||||
const { dialogConfirm } = useCounterMixin();
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
modal: boolean;
|
|
||||||
file: File | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Emits {
|
|
||||||
(e: "update:modal", value: boolean): void;
|
|
||||||
(e: "confirm", file: File): void;
|
|
||||||
(e: "cancel"): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
|
||||||
const emit = defineEmits<Emits>();
|
|
||||||
|
|
||||||
const isLoading = ref(false);
|
|
||||||
const isUploading = ref(false);
|
|
||||||
const previewData = ref<Record<string, any>[]>([]);
|
|
||||||
const excelHeaders = ref<string[]>([]); // Headers จาก Excel
|
|
||||||
|
|
||||||
const fileName = computed(() => props.file?.name ?? "");
|
|
||||||
const fileSize = computed(() => props.file?.size ?? 0);
|
|
||||||
const totalRows = computed(() => previewData.value.length);
|
|
||||||
const previewRows = computed(() => previewData.value.length);
|
|
||||||
|
|
||||||
const pagination = ref({
|
|
||||||
page: 1,
|
|
||||||
rowsPerPage: 50,
|
|
||||||
});
|
|
||||||
|
|
||||||
// ฟังก์ชันแปลงวันที่เป็นภาษาไทย (ไม่บวก 543 เพราะ Excel เป็น พ.ศ. อยู่แล้ว)
|
|
||||||
function formatDateForDisplay(value: any): string {
|
|
||||||
if (!value) return "-";
|
|
||||||
|
|
||||||
// ถ้าเป็น string format dd/mm/yyyy (จาก Excel ที่เป็น พ.ศ.)
|
|
||||||
if (typeof value === "string") {
|
|
||||||
const parts = value.split("/");
|
|
||||||
if (parts.length === 3) {
|
|
||||||
const day = parts[0];
|
|
||||||
const monthNum = parseInt(parts[1], 10);
|
|
||||||
const year = parts[2];
|
|
||||||
|
|
||||||
// แปลงเลขเดือนเป็นชื่อเดือนภาษาไทย
|
|
||||||
const thaiMonths = [
|
|
||||||
"ม.ค.",
|
|
||||||
"ก.พ.",
|
|
||||||
"มี.ค.",
|
|
||||||
"เม.ย.",
|
|
||||||
"พ.ค.",
|
|
||||||
"มิ.ย.",
|
|
||||||
"ก.ค.",
|
|
||||||
"ส.ค.",
|
|
||||||
"ก.ย.",
|
|
||||||
"ต.ค.",
|
|
||||||
"พ.ย.",
|
|
||||||
"ธ.ค.",
|
|
||||||
];
|
|
||||||
const thaiMonth = thaiMonths[monthNum - 1] || parts[1];
|
|
||||||
|
|
||||||
return `${day} ${thaiMonth} ${year}`;
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ถ้าเป็น Date object ให้แปลงโดยไม่บวก 543 (เพราะ Excel serial date แปลงเป็น ค.ศ. แล้วแต่เดิมเป็น พ.ศ.)
|
|
||||||
const dateMoment = moment(value);
|
|
||||||
const day = dateMoment.format("DD");
|
|
||||||
const month = dateMoment.format("MMM");
|
|
||||||
const year = +dateMoment.format("YYYY"); // ไม่บวก 543
|
|
||||||
return `${day} ${month} ${year}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Headers ที่เป็นวันที่
|
|
||||||
const DATE_HEADERS = ["วันที่คำสั่งมีผล", "วันที่ลงนาม"];
|
|
||||||
const SALARY_HEADERS = [
|
|
||||||
"เงินเดือน",
|
|
||||||
"ค่าจ้าง",
|
|
||||||
"เงินค่าตอบแทนรายเดือน",
|
|
||||||
"เงินประจำตำแหน่ง",
|
|
||||||
"เงินค่าตอบแทนพิเศษ",
|
|
||||||
];
|
|
||||||
|
|
||||||
// สร้าง columns จาก Excel headers
|
|
||||||
const tableColumns = computed(() => {
|
|
||||||
if (excelHeaders.value.length === 0) return [];
|
|
||||||
return excelHeaders.value.map((header, index) => {
|
|
||||||
const isDateColumn = DATE_HEADERS.includes(header);
|
|
||||||
const isSalaryColumn = SALARY_HEADERS.includes(header);
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: `col_${index}`,
|
|
||||||
label: header,
|
|
||||||
field: header,
|
|
||||||
align: "left" as const,
|
|
||||||
sortable: false,
|
|
||||||
style: "white-space: nowrap;",
|
|
||||||
headerStyle: "font-size: 13px; font-weight: bold;",
|
|
||||||
format: (val: any) => {
|
|
||||||
// ถ้าค่าว่าง แสดง -
|
|
||||||
if (val == null || val === "") return "-";
|
|
||||||
|
|
||||||
// ถ้าเป็น column วันที่
|
|
||||||
if (isDateColumn) {
|
|
||||||
// ถ้าเป็น string วันที่ format dd/mm/yyyy (จาก Excel)
|
|
||||||
if (
|
|
||||||
typeof val === "string" &&
|
|
||||||
val.match(/^\d{1,2}\/\d{1,2}\/\d{4}$/)
|
|
||||||
) {
|
|
||||||
return formatDateForDisplay(val);
|
|
||||||
}
|
|
||||||
// ถ้าเป็น number (Excel serial date) ให้แปลงเป็น Date object ก่อน
|
|
||||||
if (typeof val === "number") {
|
|
||||||
return formatDateForDisplay((val - 25569) * 86400 * 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ถ้าเป็น column เงินให้ format มี comma separator (ตรวจสอบชื่อ label)
|
|
||||||
if (isSalaryColumn) {
|
|
||||||
const numericValue = Number(val);
|
|
||||||
if (typeof numericValue === "number" && !isNaN(numericValue)) {
|
|
||||||
return numericValue.toLocaleString("en-US");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
async function loadPreview() {
|
|
||||||
if (!props.file) return;
|
|
||||||
|
|
||||||
isLoading.value = true;
|
|
||||||
try {
|
|
||||||
const result = await parseExcelFile(props.file, {
|
|
||||||
maxPreviewRows: 0, // 0 = แสดงทั้งหมด
|
|
||||||
sheetIndex: 0, // ใช้ sheet แรกเสมอ
|
|
||||||
});
|
|
||||||
previewData.value = result.rows;
|
|
||||||
excelHeaders.value = result.headers; // เก็บ headers จาก Excel
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error parsing Excel file:", error);
|
|
||||||
previewData.value = [];
|
|
||||||
excelHeaders.value = [];
|
|
||||||
} finally {
|
|
||||||
isLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onConfirm() {
|
|
||||||
dialogConfirm($q, () => {
|
|
||||||
if (props.file) {
|
|
||||||
isUploading.value = true;
|
|
||||||
emit("confirm", props.file);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onClose() {
|
|
||||||
emit("cancel");
|
|
||||||
emit("update:modal", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onModalUpdate(value: boolean) {
|
|
||||||
emit("update:modal", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.modal,
|
|
||||||
(newValue) => {
|
|
||||||
if (newValue && props.file) {
|
|
||||||
isUploading.value = false;
|
|
||||||
loadPreview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<q-dialog :model-value="modal" @update:model-value="onModalUpdate" persistent>
|
|
||||||
<q-card style="min-width: 80vw; max-width: 95vw">
|
|
||||||
<q-card-section class="row items-center q-pb-none">
|
|
||||||
<div class="text-h6">ตัวอย่างข้อมูลไฟล์ Excel</div>
|
|
||||||
<q-space />
|
|
||||||
<q-btn icon="close" flat round dense v-close-popup @click="onClose" />
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator />
|
|
||||||
|
|
||||||
<!-- File Info Section -->
|
|
||||||
<q-card-section>
|
|
||||||
<div class="row q-col-gutter-md">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="text-subtitle2 text-grey-7">ข้อมูลไฟล์</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 col-sm-6 col-12">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<q-icon
|
|
||||||
name="insert_drive_file"
|
|
||||||
class="q-mr-sm"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
<span class="text-body2">ชื่อไฟล์: {{ fileName }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 col-sm-6 col-12">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<q-icon name="folder" class="q-mr-sm" color="primary" />
|
|
||||||
<span class="text-body2"
|
|
||||||
>ขนาด: {{ formatFileSize(fileSize) }}</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 col-sm-12 col-12">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<q-icon name="table_chart" class="q-mr-sm" color="primary" />
|
|
||||||
<span class="text-body2">จำนวนแถว: {{ totalRows }} แถว</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator />
|
|
||||||
|
|
||||||
<!-- Preview Table -->
|
|
||||||
<q-card-section style="max-height: 70vh" class="scroll">
|
|
||||||
<div class="text-subtitle2 q-mb-md">
|
|
||||||
รายการตำแหน่ง ({{ previewRows }} รายการ)
|
|
||||||
</div>
|
|
||||||
<d-table
|
|
||||||
:columns="tableColumns"
|
|
||||||
:rows="previewData"
|
|
||||||
:paging="true"
|
|
||||||
:rows-per-page-options="[20, 50, 100, 0]"
|
|
||||||
v-model:pagination="pagination"
|
|
||||||
:loading="isLoading"
|
|
||||||
row-key="id"
|
|
||||||
flat
|
|
||||||
bordered
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<!-- Actions -->
|
|
||||||
<q-card-actions align="right" class="q-pa-md">
|
|
||||||
<q-btn
|
|
||||||
type="submit"
|
|
||||||
color="public"
|
|
||||||
label="ยืนยันการอัปโหลด"
|
|
||||||
@click="onConfirm"
|
|
||||||
:loading="isUploading"
|
|
||||||
/>
|
|
||||||
</q-card-actions>
|
|
||||||
</q-card>
|
|
||||||
</q-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
@ -706,7 +706,6 @@ function classInput(val: boolean) {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
autocomplete="on"
|
autocomplete="on"
|
||||||
name="organization"
|
name="organization"
|
||||||
:label="`${'หน่วยงาน'}`"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed, reactive } from "vue";
|
import { ref, onMounted, computed, reactive } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
import * as XLSX from "xlsx";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useEditPosDataStore } from "@/modules/04_registryPerson/stores/Edit";
|
import { useEditPosDataStore } from "@/modules/04_registryPerson/stores/Edit";
|
||||||
import { exportToExcelPosition } from "@/modules/04_registryPerson/utils/exportPosition";
|
|
||||||
|
|
||||||
import type { QTableColumn } from "quasar";
|
import type { QTableColumn } from "quasar";
|
||||||
import type { FormDataSalary } from "@/modules/04_registryPerson/interface/index/Edit";
|
import type { FormDataSalary } from "@/modules/04_registryPerson/interface/index/Edit";
|
||||||
|
|
@ -20,7 +20,6 @@ import type {
|
||||||
|
|
||||||
import DialogForm from "@/modules/04_registryPerson/views/edit/components/DialogForm.vue";
|
import DialogForm from "@/modules/04_registryPerson/views/edit/components/DialogForm.vue";
|
||||||
import DialogSort from "@/modules/04_registryPerson/views/edit/components/DialogSort.vue";
|
import DialogSort from "@/modules/04_registryPerson/views/edit/components/DialogSort.vue";
|
||||||
import DialogExcelPreview from "@/modules/04_registryPerson/views/edit/components/DialogExcelPreview.vue";
|
|
||||||
import CurruncyInput from "@/components/CurruncyInput.vue";
|
import CurruncyInput from "@/components/CurruncyInput.vue";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -53,11 +52,6 @@ const amountRef = ref<any>(null);
|
||||||
const amountSpecialRef = ref<any>(null);
|
const amountSpecialRef = ref<any>(null);
|
||||||
const currencyPopupRef = ref<any>(null);
|
const currencyPopupRef = ref<any>(null);
|
||||||
|
|
||||||
// Excel Preview
|
|
||||||
const excelPreviewModal = ref<boolean>(false);
|
|
||||||
const selectedExcelFile = ref<File | null>(null);
|
|
||||||
const isParsingExcel = ref<boolean>(false);
|
|
||||||
|
|
||||||
//Table
|
//Table
|
||||||
const isLoad = ref<boolean>(true);
|
const isLoad = ref<boolean>(true);
|
||||||
const rowIndex = ref<number>(0);
|
const rowIndex = ref<number>(0);
|
||||||
|
|
@ -436,7 +430,66 @@ function classColorRow(isDelete: boolean, isEdit: boolean, isEntry: boolean) {
|
||||||
|
|
||||||
/** ฟังก์ชันดาวน์โหลดไฟล Excel */
|
/** ฟังก์ชันดาวน์โหลดไฟล Excel */
|
||||||
function exportToExcel() {
|
function exportToExcel() {
|
||||||
exportToExcelPosition(rows.value);
|
const newData = rows.value.map((e: DataPosition) => {
|
||||||
|
return {
|
||||||
|
commandDateAffect: date2Thai(e.commandDateAffect),
|
||||||
|
positionName: e.positionName,
|
||||||
|
positionType: e.positionType,
|
||||||
|
positionLevel: e.positionLevel
|
||||||
|
? e.positionLevel
|
||||||
|
: e.positionCee
|
||||||
|
? e.positionCee
|
||||||
|
: "",
|
||||||
|
positionExecutive: e.positionExecutive,
|
||||||
|
amount: e.amount,
|
||||||
|
mouthSalaryAmount: e.mouthSalaryAmount,
|
||||||
|
positionSalaryAmount: e.positionSalaryAmount,
|
||||||
|
organization: findOrgName({
|
||||||
|
root: e.orgRoot,
|
||||||
|
child1: e.orgChild1,
|
||||||
|
child2: e.orgChild2,
|
||||||
|
child3: e.orgChild3,
|
||||||
|
child4: e.orgChild4,
|
||||||
|
}),
|
||||||
|
posNo:
|
||||||
|
e.posNoAbb && e.posNo
|
||||||
|
? `${e.posNoAbb} ${e.posNo}`
|
||||||
|
: e.posNo
|
||||||
|
? e.posNo
|
||||||
|
: "",
|
||||||
|
posNumCodeSit:
|
||||||
|
e.posNumCodeSitAbb && e.posNumCodeSit
|
||||||
|
? `${e.posNumCodeSit} (${e.posNumCodeSitAbb})`
|
||||||
|
: e.posNumCodeSit
|
||||||
|
? e.posNumCodeSit
|
||||||
|
: "",
|
||||||
|
commandNo:
|
||||||
|
e.commandNo && e.commandYear
|
||||||
|
? `${e.commandNo}/${Number(e.commandYear) + 543}`
|
||||||
|
: "",
|
||||||
|
commandDateSign: date2Thai(e.commandDateSign),
|
||||||
|
commandCode: store.convertCommandCodeName(e.commandCode),
|
||||||
|
remark: e.remark,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const headers = columns.value.map((item: any) => item.label) || []; // หัวคอลัมน์ภาษาไทย
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(newData, {
|
||||||
|
header: visibleColumns.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
//แทรกหัวคอลัมน์ภาษาไทย (ใช้ A1, B1, C1 แทน)
|
||||||
|
XLSX.utils.sheet_add_aoa(worksheet, [headers], { origin: "A1" });
|
||||||
|
|
||||||
|
// Create a new workbook and append the worksheet
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
|
||||||
|
XLSX.utils.book_append_sheet(
|
||||||
|
workbook,
|
||||||
|
worksheet,
|
||||||
|
`รายการประวัติตำแหน่งเงินเดือน`
|
||||||
|
);
|
||||||
|
XLSX.writeFile(workbook, "รายการประวัติตำแหน่งเงินเดือน.xlsx");
|
||||||
}
|
}
|
||||||
|
|
||||||
const commandCodeOptions = ref<DataOption[]>(store.commandCodeData); //รายการปรเภทคำสั่ง
|
const commandCodeOptions = ref<DataOption[]>(store.commandCodeData); //รายการปรเภทคำสั่ง
|
||||||
|
|
@ -794,106 +847,6 @@ async function validateAndSave(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันอัปโหลดไฟล์ Excel
|
|
||||||
* เปิด preview modal ก่อนอัปโหลด
|
|
||||||
*/
|
|
||||||
function handUploadFile() {
|
|
||||||
const input = document.createElement("input");
|
|
||||||
input.type = "file";
|
|
||||||
input.accept = ".xlsx,.xls";
|
|
||||||
|
|
||||||
input.onchange = async (e: Event) => {
|
|
||||||
const file = (e.target as HTMLInputElement).files?.[0];
|
|
||||||
if (!file) return;
|
|
||||||
|
|
||||||
// ตรวจสอบชนิดไฟล์โดยตรวจสอบนามสกุล
|
|
||||||
const validExtensions = [".xlsx", ".xls"];
|
|
||||||
const fileExtension = file.name
|
|
||||||
.substring(file.name.lastIndexOf("."))
|
|
||||||
.toLowerCase();
|
|
||||||
|
|
||||||
if (!validExtensions.includes(fileExtension)) {
|
|
||||||
messageError($q, {
|
|
||||||
response: {
|
|
||||||
data: {
|
|
||||||
title: "กรุณาเลือกไฟล์ Excel เท่านั้น (.xlsx, .xls)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// เก็บไฟล์และเปิด preview modal
|
|
||||||
selectedExcelFile.value = file;
|
|
||||||
excelPreviewModal.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
input.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันยืนยันการอัปโหลดไฟล์
|
|
||||||
* ส่งไฟล์ไปยัง API เมื่อ user ยืนยันจาก preview modal
|
|
||||||
*/
|
|
||||||
async function onConfirmUpload(file: File) {
|
|
||||||
try {
|
|
||||||
isParsingExcel.value = true;
|
|
||||||
showLoader();
|
|
||||||
|
|
||||||
const type = empType.value === "officer" ? "office" : "employee";
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append("file", file);
|
|
||||||
|
|
||||||
await http.post(config.API.uploadProfile(type, profileId.value), formData, {
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "multipart/form-data",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
|
||||||
await fetchData();
|
|
||||||
excelPreviewModal.value = false;
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
isParsingExcel.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันยกเลิกการอัปโหลด
|
|
||||||
* ปิด preview modal และล้างค่า
|
|
||||||
*/
|
|
||||||
function onCancelUpload() {
|
|
||||||
selectedExcelFile.value = null;
|
|
||||||
excelPreviewModal.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ชันจัดเรียงข้อมูลตามวันที่*/
|
|
||||||
function handleSortByDate() {
|
|
||||||
dialogConfirm(
|
|
||||||
$q,
|
|
||||||
async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
await http.put(config.API.sortOrderByDate, {
|
|
||||||
type: empType.value.toLocaleUpperCase(),
|
|
||||||
profileId: profileId.value,
|
|
||||||
});
|
|
||||||
await fetchData();
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ยืนยันการจัดลำดับ",
|
|
||||||
"ต้องการยืนยันการจัดลำดับข้อมูลตามวันที่คำสั่งมีผลใช่หรือไม่?"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([fetchData(), fetchType()]);
|
await Promise.all([fetchData(), fetchType()]);
|
||||||
});
|
});
|
||||||
|
|
@ -929,39 +882,10 @@ onMounted(async () => {
|
||||||
icon="mdi-sort"
|
icon="mdi-sort"
|
||||||
@click="modalSort = true"
|
@click="modalSort = true"
|
||||||
>
|
>
|
||||||
<q-tooltip>จัดลำดับข้อมูล</q-tooltip>
|
<q-tooltip>จัดลำดับข้อมูล</q-tooltip></q-btn
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="
|
|
||||||
tabs === 'PENDING' && statusCheckEdit == 'PENDING' && isConfirmEdit
|
|
||||||
"
|
|
||||||
class="q-ml-sm"
|
|
||||||
round
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
color="indigo-5"
|
|
||||||
icon="mdi-calendar-export"
|
|
||||||
@click="handleSortByDate()"
|
|
||||||
>
|
>
|
||||||
<q-tooltip>จัดลำดับตามวันที่คำสั่งมีผล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
<q-space />
|
<q-space />
|
||||||
<div>
|
<div>
|
||||||
<q-btn
|
|
||||||
v-if="
|
|
||||||
tabs === 'PENDING' &&
|
|
||||||
statusCheckEdit == 'PENDING' &&
|
|
||||||
isConfirmEdit
|
|
||||||
"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="blue"
|
|
||||||
icon="upload"
|
|
||||||
@click="handUploadFile()"
|
|
||||||
>
|
|
||||||
<q-tooltip>อัปโหลดไฟล์แก้ไข</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
<q-btn
|
<q-btn
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
|
|
@ -969,9 +893,7 @@ onMounted(async () => {
|
||||||
icon="download"
|
icon="download"
|
||||||
:disable="rows.length == 0"
|
:disable="rows.length == 0"
|
||||||
@click="exportToExcel()"
|
@click="exportToExcel()"
|
||||||
>
|
/>
|
||||||
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
|
|
@ -1802,13 +1724,6 @@ onMounted(async () => {
|
||||||
:fetch-data="fetchData"
|
:fetch-data="fetchData"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DialogExcelPreview
|
|
||||||
v-model:modal="excelPreviewModal"
|
|
||||||
:file="selectedExcelFile"
|
|
||||||
@confirm="onConfirmUpload"
|
|
||||||
@cancel="onCancelUpload"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ const reason = ref<string>(""); //หมายเหตุ
|
||||||
const status = ref<string>("");
|
const status = ref<string>("");
|
||||||
const fullName = ref<string>("");
|
const fullName = ref<string>("");
|
||||||
const mianData = ref<MainData>();
|
const mianData = ref<MainData>();
|
||||||
const typeCommand = ref<string>(""); //ประเภทคำสั่ง
|
|
||||||
|
|
||||||
/** fetch รายละเอียดการปรับระดับชั้นงานลูกจ้าง*/
|
/** fetch รายละเอียดการปรับระดับชั้นงานลูกจ้าง*/
|
||||||
async function fecthappointmentByid() {
|
async function fecthappointmentByid() {
|
||||||
|
|
@ -80,7 +79,6 @@ async function fecthappointmentByid() {
|
||||||
salary.value = data.salary ?? 0;
|
salary.value = data.salary ?? 0;
|
||||||
reason.value = data.reason;
|
reason.value = data.reason;
|
||||||
date.value = data.positionDate;
|
date.value = data.positionDate;
|
||||||
typeCommand.value = data.typeCommand;
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -325,10 +323,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12"><q-separator /></div>
|
<div class="col-12"><q-separator /></div>
|
||||||
<div
|
<div class="col-xs-6 col-sm-6 row items-center">
|
||||||
class="col-xs-6 col-sm-6 row items-center"
|
|
||||||
v-if="typeCommand !== 'MOVE'"
|
|
||||||
>
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<datepicker
|
<datepicker
|
||||||
:readonly="!edit"
|
:readonly="!edit"
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ const date = ref<Date | null>(null); //ดำรงตำแหน่งใน
|
||||||
const reason = ref<string>(""); //หมายเหตุ
|
const reason = ref<string>(""); //หมายเหตุ
|
||||||
const status = ref<string>("");
|
const status = ref<string>("");
|
||||||
const fullName = ref<string>("");
|
const fullName = ref<string>("");
|
||||||
const typeCommand = ref<string>(""); //ประเภทคำสั่ง
|
|
||||||
|
|
||||||
/** fetch รายละเอียดการแต่งตั้ง-เลื่อน-ย้าย*/
|
/** fetch รายละเอียดการแต่งตั้ง-เลื่อน-ย้าย*/
|
||||||
async function fecthappointmentByid() {
|
async function fecthappointmentByid() {
|
||||||
|
|
@ -62,7 +61,6 @@ async function fecthappointmentByid() {
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
status.value = data.status;
|
status.value = data.status;
|
||||||
typeCommand.value = data.typeCommand;
|
|
||||||
educationOld.value = data.educationOld ?? "-";
|
educationOld.value = data.educationOld ?? "-";
|
||||||
organizationPositionOld.value = data.organizationPositionOld;
|
organizationPositionOld.value = data.organizationPositionOld;
|
||||||
positionTypeOld.value = data.positionTypeOld;
|
positionTypeOld.value = data.positionTypeOld;
|
||||||
|
|
@ -315,10 +313,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12"><q-separator /></div>
|
<div class="col-12"><q-separator /></div>
|
||||||
<div
|
<div class="col-xs-6 col-sm-6 row items-center">
|
||||||
class="col-xs-6 col-sm-6 row items-center"
|
|
||||||
v-if="typeCommand !== 'MOVE'"
|
|
||||||
>
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<datepicker
|
<datepicker
|
||||||
:readonly="!edit"
|
:readonly="!edit"
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ const saveData = async () => {
|
||||||
changeBtn();
|
changeBtn();
|
||||||
onEdit.value = false;
|
onEdit.value = false;
|
||||||
edit.value = false;
|
edit.value = false;
|
||||||
emit("update:statusEdit", false);
|
|
||||||
})
|
})
|
||||||
.catch((e: any) => {
|
.catch((e: any) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<!-- ส่วนหัวของ ข้อมูลส่วนตัว และ ที่อยู่ -->
|
<!-- ส่วนหัวของ ข้อมูลส่วนตัว และ ที่อยู่ -->
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { computed } from "vue";
|
import { ref } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
@ -62,9 +62,9 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["update:edit"]);
|
const emit = defineEmits(["update:edit"]);
|
||||||
const isEdit = computed(() => {
|
const isEdit = ref<boolean>(
|
||||||
return checkPermission(route)?.attrIsUpdate ? true : false;
|
checkPermission(route)?.attrIsUpdate ? true : false
|
||||||
});
|
);
|
||||||
|
|
||||||
const updateEdit = (value: any) => {
|
const updateEdit = (value: any) => {
|
||||||
emit("update:edit", value);
|
emit("update:edit", value);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, onMounted, watch } from "vue";
|
import { ref, onMounted, watch } from "vue";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
import { type QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
Positions,
|
Positions,
|
||||||
FormPosType,
|
FormPosType,
|
||||||
|
|
@ -22,14 +22,14 @@ const store = useSelectOrgStore();
|
||||||
/** props*/
|
/** props*/
|
||||||
const selected = defineModel("selectedPos", { required: true }); //ตำแหน่งที่เลือก
|
const selected = defineModel("selectedPos", { required: true }); //ตำแหน่งที่เลือก
|
||||||
const positionId = defineModel<string>("positionId", { required: true }); //id ตำแหน่งที่เลือก
|
const positionId = defineModel<string>("positionId", { required: true }); //id ตำแหน่งที่เลือก
|
||||||
const selectId = defineModel<string>("selectId", { required: true }); // ตำแหน่งที่เลือก
|
const seletcId = defineModel<string>("seletcId", { required: true }); // ตำแหน่งที่เลือก
|
||||||
const date = defineModel<Date | null>("datePos", { required: true }); //วันยที่รายงานคัว
|
const date = defineModel<Date>("datePos", { required: true }); //วันยที่รายงานคัว
|
||||||
const positionData = defineModel<any[]>("position", { required: true }); //ข้อมูลรายการเลขที่ตำแหน่ง
|
const positionData = defineModel<any[]>("position", { required: true }); //ข้อมูลรายการเลขที่ตำแหน่ง
|
||||||
const isAll = defineModel<boolean>("isAll", { required: true }); //แสดงตำแหน่งทั้งหมด
|
const isAll = defineModel<boolean>("isAll", { required: true }); //แสดงตำแหน่งทั้งหมด
|
||||||
const isBlank = defineModel<boolean>("isBlank", { required: true }); //แสดงเฉพาะตำแหน่งว่าง
|
const isBlank = defineModel<boolean>("isBlank", { required: true }); //แสดงเฉพาะตำแหน่งว่าง
|
||||||
const isPosition = defineModel<string>("isPosition", { required: true });
|
const isPosition = defineModel<string>("isPosition", { required: true });
|
||||||
// const isPositionOld = defineModel<boolean>("isPositionOld", { required: true }); //แสดงตำแหน่งที่ตรงกับประเภทและระดับเดิม
|
// const isPositionOld = defineModel<boolean>("isPositionOld", { required: true }); //แสดงตำแหน่งที่ตรงกับประเภทและระดับเดิม
|
||||||
const posType = defineModel<FormPosType | null>("posType", { required: true }); //ตำแหน่งประเภท
|
const posType = defineModel<FormPosType>("posType", { required: true }); //ตำแหน่งประเภท
|
||||||
const posLevel = defineModel<string>("posLevel", { required: true }); //ระดับตำแหน่ง
|
const posLevel = defineModel<string>("posLevel", { required: true }); //ระดับตำแหน่ง
|
||||||
const optionPosType = defineModel<FormPosType[]>("optionPosType", {
|
const optionPosType = defineModel<FormPosType[]>("optionPosType", {
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -47,7 +47,6 @@ const props = defineProps({
|
||||||
onPosType: Function,
|
onPosType: Function,
|
||||||
nodeId: String,
|
nodeId: String,
|
||||||
nodeLevel: Number,
|
nodeLevel: Number,
|
||||||
isLoadPosition: Boolean,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Table
|
//Table
|
||||||
|
|
@ -214,9 +213,9 @@ async function onClickSelectPos(id: string) {
|
||||||
// หาตำแหน่ง
|
// หาตำแหน่ง
|
||||||
if (position) {
|
if (position) {
|
||||||
rowsPosition.value = position.positions;
|
rowsPosition.value = position.positions;
|
||||||
if (selectId.value) {
|
if (seletcId.value) {
|
||||||
selected.value = rowsPosition.value.filter(
|
selected.value = rowsPosition.value.filter(
|
||||||
(e) => e.id === selectId.value
|
(e) => e.id === seletcId.value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -249,20 +248,15 @@ watch(positionData, (newVal, oldVal) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.isLoadPosition,
|
|
||||||
(newVal) => {
|
|
||||||
if (newVal && positionId.value) {
|
|
||||||
onClickSelectPos(positionId.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (!positionId.value) {
|
if (positionId.value) {
|
||||||
|
setTimeout(async () => {
|
||||||
|
await onClickSelectPos(positionId.value);
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
positionRows.value = positionData.value;
|
positionRows.value = positionData.value;
|
||||||
positionRowsData.value = positionData.value;
|
positionRowsData.value = positionData.value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { ref, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { calculateAge } from "@/utils/function";
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
|
@ -39,20 +38,6 @@ const props = defineProps({
|
||||||
|
|
||||||
const rows = ref<DataEducation[]>([]);
|
const rows = ref<DataEducation[]>([]);
|
||||||
const personalForm = ref<DataPerson>();
|
const personalForm = ref<DataPerson>();
|
||||||
const age = ref<string | null>(""); //อายุ
|
|
||||||
|
|
||||||
// ข้อมูลแปลงจาก ID เป็นชื่อ
|
|
||||||
const currentProvinceName = ref<string>("");
|
|
||||||
const currentDistrictName = ref<string>("");
|
|
||||||
const currentSubDistrictName = ref<string>("");
|
|
||||||
const registProvinceName = ref<string>("");
|
|
||||||
const registDistrictName = ref<string>("");
|
|
||||||
const registSubDistrictName = ref<string>("");
|
|
||||||
|
|
||||||
// Cache ข้อมูล
|
|
||||||
const provincesCache = ref<any[]>([]);
|
|
||||||
const districtsCache = ref<Map<string, any[]>>(new Map()); // key: provinceId, value: districts[]
|
|
||||||
const subDistrictsCache = ref<Map<string, any[]>>(new Map()); // key: districtId, value: subDistricts[]
|
|
||||||
|
|
||||||
/**หัวตาราง */
|
/**หัวตาราง */
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -102,20 +87,11 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
* ฟังก์ชันดึงข้อมูลรายละเอียด
|
* ฟังก์ชันดึงข้อมูลรายละเอียด
|
||||||
*/
|
*/
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
// Reset ข้อมูลเก่าก่อนโหลดข้อมูลใหม่
|
|
||||||
resetData();
|
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.getDatapersonal(props.personalId))
|
.get(config.API.getDatapersonal(props.personalId))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
personalForm.value = res.data.result;
|
personalForm.value = res.data.result;
|
||||||
if (res.data.result.dateOfBirth) {
|
|
||||||
// กำหนดอายุ ส่งวันเกิดไปคำนวน
|
|
||||||
age.value = calculateAge(res.data.result.dateOfBirth);
|
|
||||||
} else {
|
|
||||||
age.value = null;
|
|
||||||
}
|
|
||||||
personalForm.value?.education.map((e: Education) => {
|
personalForm.value?.education.map((e: Education) => {
|
||||||
rows.value.push({
|
rows.value.push({
|
||||||
university: e.institute,
|
university: e.institute,
|
||||||
|
|
@ -131,159 +107,6 @@ async function fetchData() {
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
|
|
||||||
// แปลง ID เป็นชื่อ
|
|
||||||
await convertAddressIds();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset ข้อมูลทุกครั้งที่เปิดคนใหม่
|
|
||||||
*/
|
|
||||||
function resetData() {
|
|
||||||
// Reset ข้อมูลส่วนตัว
|
|
||||||
personalForm.value = undefined;
|
|
||||||
age.value = "";
|
|
||||||
rows.value = [];
|
|
||||||
|
|
||||||
// Reset ข้อมูลที่อยู่
|
|
||||||
currentProvinceName.value = "";
|
|
||||||
currentDistrictName.value = "";
|
|
||||||
currentSubDistrictName.value = "";
|
|
||||||
registProvinceName.value = "";
|
|
||||||
registDistrictName.value = "";
|
|
||||||
registSubDistrictName.value = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันแปลง ID เป็นชื่อจริงของที่อยู่ (แบบ optimize)
|
|
||||||
*/
|
|
||||||
async function convertAddressIds() {
|
|
||||||
if (!personalForm.value) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// โหลดข้อมูลจังหวัดครั้งเดียวถ้ายังไม่มี
|
|
||||||
await loadProvinces();
|
|
||||||
|
|
||||||
// แปลงข้อมูลที่อยู่ปัจจุบัน
|
|
||||||
if (personalForm.value.currentProvinceId && personalForm.value.currentProvinceId.trim() !== "") {
|
|
||||||
currentProvinceName.value = getProvinceNameFromCache(
|
|
||||||
personalForm.value.currentProvinceId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (personalForm.value.currentDistrictId && personalForm.value.currentDistrictId.trim() !== "") {
|
|
||||||
currentDistrictName.value = await getDistrictNameOptimized(
|
|
||||||
personalForm.value.currentProvinceId,
|
|
||||||
personalForm.value.currentDistrictId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (personalForm.value.currentSubDistrictId && personalForm.value.currentSubDistrictId.trim() !== "") {
|
|
||||||
currentSubDistrictName.value = await getSubDistrictNameOptimized(
|
|
||||||
personalForm.value.currentDistrictId,
|
|
||||||
personalForm.value.currentSubDistrictId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// แปลงข้อมูลที่อยู่ตามทะเบียน
|
|
||||||
if (personalForm.value.registProvinceId && personalForm.value.registProvinceId.trim() !== "") {
|
|
||||||
registProvinceName.value = getProvinceNameFromCache(
|
|
||||||
personalForm.value.registProvinceId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (personalForm.value.registDistrictId && personalForm.value.registDistrictId.trim() !== "") {
|
|
||||||
registDistrictName.value = await getDistrictNameOptimized(
|
|
||||||
personalForm.value.registProvinceId,
|
|
||||||
personalForm.value.registDistrictId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (personalForm.value.registSubDistrictId && personalForm.value.registSubDistrictId.trim() !== "") {
|
|
||||||
registSubDistrictName.value = await getSubDistrictNameOptimized(
|
|
||||||
personalForm.value.registDistrictId,
|
|
||||||
personalForm.value.registSubDistrictId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error converting address IDs:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* โหลดข้อมูลจังหวัดทั้งหมด (ครั้งเดียว)
|
|
||||||
*/
|
|
||||||
async function loadProvinces() {
|
|
||||||
if (provincesCache.value.length === 0) {
|
|
||||||
try {
|
|
||||||
const res = await http.get(config.API.province);
|
|
||||||
provincesCache.value = res.data.result;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error loading provinces:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ดึงชื่อจังหวัดจาก cache
|
|
||||||
*/
|
|
||||||
function getProvinceNameFromCache(provinceId: string): string {
|
|
||||||
const province = provincesCache.value.find(
|
|
||||||
(p: any) => p.id.toString() === provinceId
|
|
||||||
);
|
|
||||||
return province ? province.name : "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ดึงชื่ออำเภอแบบ optimize (เรียก API เฉพาะจังหวัดที่ต้องการ)
|
|
||||||
* @param provinceId ID ของจังหวัด
|
|
||||||
* @param districtId ID ของอำเภอ
|
|
||||||
*/
|
|
||||||
async function getDistrictNameOptimized(
|
|
||||||
provinceId: string,
|
|
||||||
districtId: string
|
|
||||||
): Promise<string> {
|
|
||||||
try {
|
|
||||||
// เช็ค cache ว่ามีข้อมูล districts ของ province นี้หรือไม่
|
|
||||||
if (!districtsCache.value.has(provinceId)) {
|
|
||||||
const res = await http.get(config.API.listDistrict(provinceId));
|
|
||||||
districtsCache.value.set(provinceId, res.data.result.districts);
|
|
||||||
}
|
|
||||||
|
|
||||||
const districts = districtsCache.value.get(provinceId) || [];
|
|
||||||
const district = districts.find((d: any) => d.id.toString() === districtId);
|
|
||||||
return district ? district.name : "-";
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error loading district:", error);
|
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ดึงชื่อตำบลแบบ optimize (เรียก API เฉพาะอำเภอที่ต้องการ)
|
|
||||||
* @param districtId ID ของอำเภอ
|
|
||||||
* @param subDistrictId ID ของตำบล
|
|
||||||
*/
|
|
||||||
async function getSubDistrictNameOptimized(
|
|
||||||
districtId: string,
|
|
||||||
subDistrictId: string
|
|
||||||
): Promise<string> {
|
|
||||||
try {
|
|
||||||
// เช็ค cache ว่ามีข้อมูล subDistricts ของ district นี้หรือไม่
|
|
||||||
if (!subDistrictsCache.value.has(districtId)) {
|
|
||||||
const res = await http.get(config.API.listSubDistrict(districtId));
|
|
||||||
subDistrictsCache.value.set(districtId, res.data.result.subDistricts);
|
|
||||||
}
|
|
||||||
|
|
||||||
const subDistricts = subDistrictsCache.value.get(districtId) || [];
|
|
||||||
const subDistrict = subDistricts.find(
|
|
||||||
(sd: any) => sd.id.toString() === subDistrictId
|
|
||||||
);
|
|
||||||
return subDistrict ? subDistrict.name : "-";
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error loading subdistrict:", error);
|
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -308,7 +131,7 @@ function formBmaofficer(val: string) {
|
||||||
*/
|
*/
|
||||||
async function close() {
|
async function close() {
|
||||||
props.close();
|
props.close();
|
||||||
resetData(); // Reset ข้อมูลเมื่อปิด dialog
|
rows.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -347,58 +170,30 @@ watch(props, () => {
|
||||||
|
|
||||||
<div class="row q-pa-xs">
|
<div class="row q-pa-xs">
|
||||||
<div class="col-3 header-sub-text">
|
<div class="col-3 header-sub-text">
|
||||||
<div class="q-pb-sm">เลขประจำตัวประชาชน</div>
|
<div class="q-pb-md">เลขประจำตัวประชาชน</div>
|
||||||
<div class="q-pb-sm">วัน/เดือน/ปีเกิด</div>
|
<div>วัน/เดือน/ปีเกิด</div>
|
||||||
<div class="q-pb-sm">อายุ</div>
|
|
||||||
<div class="q-pb-sm">สัญชาติ</div>
|
|
||||||
<div>หมู่เลือด</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-4 sub-text">
|
<div class="col-4 sub-text">
|
||||||
<div class="q-pb-sm">
|
<div class="q-pb-md">
|
||||||
{{ personalForm?.idCard }}
|
{{ personalForm?.idCard }}
|
||||||
</div>
|
</div>
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ date2Thai(personalForm?.dateOfBirth) }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ age ? age : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{
|
|
||||||
personalForm?.nationality ? personalForm.nationality : "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
{{
|
{{ date2Thai(personalForm?.dateOfBirth) }}
|
||||||
personalForm?.bloodGroup ? personalForm.bloodGroup : "-"
|
|
||||||
}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-2 header-sub-text">
|
<div class="col-2 header-sub-text">
|
||||||
<div class="q-pb-sm">ชื่อ-นามสกุล</div>
|
<div class="q-pb-md">ชื่อ-นามสกุล</div>
|
||||||
<div class="q-pb-sm">เพศ</div>
|
<div>เพศ</div>
|
||||||
<div class="q-pb-sm">เชื้อชาติ</div>
|
|
||||||
<div class="q-pb-sm">ศาสนา</div>
|
|
||||||
<div>เบอร์โทรศัพท์</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 sub-text">
|
<div class="col-3 sub-text">
|
||||||
<div class="q-pb-sm">
|
<div class="q-pb-md">
|
||||||
{{ personalForm?.fullName }}
|
{{ personalForm?.fullName }}
|
||||||
</div>
|
</div>
|
||||||
<div class="q-pb-sm">
|
<div>
|
||||||
{{ personalForm?.gender }}
|
{{ personalForm?.gender }}
|
||||||
</div>
|
</div>
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ personalForm?.race ? personalForm.race : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ personalForm?.religion ? personalForm.religion : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-mt-sm">
|
|
||||||
{{ personalForm?.telephone ? personalForm.telephone : "-" }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
@ -408,90 +203,9 @@ watch(props, () => {
|
||||||
<q-card bordered class="card-panding">
|
<q-card bordered class="card-panding">
|
||||||
<div class="row items-center q-pa-xs header-text">ภูมิลำเนา</div>
|
<div class="row items-center q-pa-xs header-text">ภูมิลำเนา</div>
|
||||||
<div class="row q-pa-xs">
|
<div class="row q-pa-xs">
|
||||||
<!-- ที่อยู่ปัจจุบัน -->
|
<div class="col-3 header-sub-text">ที่อยู่</div>
|
||||||
<div class="col-6">
|
<div class="col-9 sub-text">
|
||||||
<div class="q-pb-sm text-weight-medium text-primary">
|
{{ personalForm?.registAddress }}
|
||||||
ที่อยู่ปัจจุบัน
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4 header-sub-text">
|
|
||||||
<div class="q-pb-sm">ที่อยู่</div>
|
|
||||||
<div class="q-pb-sm">จังหวัด</div>
|
|
||||||
<div class="q-pb-sm">เขต/อำเภอ</div>
|
|
||||||
<div class="q-pb-sm">แขวง/ตำบล</div>
|
|
||||||
<div>รหัสไปรษณีย์</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-8 sub-text">
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{
|
|
||||||
personalForm?.currentAddress
|
|
||||||
? personalForm.currentAddress
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ currentProvinceName ? currentProvinceName : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ currentDistrictName ? currentDistrictName : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{
|
|
||||||
currentSubDistrictName ? currentSubDistrictName : "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div class="q-mt-sm">
|
|
||||||
{{
|
|
||||||
personalForm?.currentZipCode
|
|
||||||
? personalForm.currentZipCode
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ที่อยู่ตามทะเบียนบ้าน -->
|
|
||||||
<div class="col-6">
|
|
||||||
<div class="q-pb-sm text-weight-medium text-primary">
|
|
||||||
ที่อยู่ตามทะเบียนบ้าน
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4 header-sub-text">
|
|
||||||
<div class="q-pb-sm">ที่อยู่</div>
|
|
||||||
<div class="q-pb-sm">จังหวัด</div>
|
|
||||||
<div class="q-pb-sm">เขต/อำเภอ</div>
|
|
||||||
<div class="q-pb-sm">แขวง/ตำบล</div>
|
|
||||||
<div>รหัสไปรษณีย์</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-8 sub-text">
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{
|
|
||||||
personalForm?.registAddress
|
|
||||||
? personalForm.registAddress
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ registProvinceName ? registProvinceName : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{ registDistrictName ? registDistrictName : "-" }}
|
|
||||||
</div>
|
|
||||||
<div class="q-pb-sm">
|
|
||||||
{{
|
|
||||||
registSubDistrictName ? registSubDistrictName : "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div class="q-mt-sm">
|
|
||||||
{{
|
|
||||||
personalForm?.registZipCode
|
|
||||||
? personalForm.registZipCode
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref, watch } from "vue";
|
import { onMounted, ref, watch, reactive } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
@ -11,7 +11,6 @@ import { useStructureTree } from "@/stores/structureTree";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
import type {
|
import type {
|
||||||
DataList,
|
|
||||||
PositionMaim,
|
PositionMaim,
|
||||||
PositionNo,
|
PositionNo,
|
||||||
Positions,
|
Positions,
|
||||||
|
|
@ -42,14 +41,17 @@ const {
|
||||||
|
|
||||||
/**props*/
|
/**props*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
const props = defineProps({
|
||||||
interface Props {
|
dataRow: {
|
||||||
dataRow?: DataList;
|
type: Object,
|
||||||
fetchTable?: () => Promise<void>;
|
require: true,
|
||||||
fetchStatCard?: () => Promise<void>;
|
},
|
||||||
}
|
fetchTable: {
|
||||||
|
type: Function,
|
||||||
const props = defineProps<Props>();
|
require: true,
|
||||||
|
},
|
||||||
|
fetchStatCard: { type: Function, require: true },
|
||||||
|
});
|
||||||
|
|
||||||
/** Tree*/
|
/** Tree*/
|
||||||
const nodeId = ref<string>("");
|
const nodeId = ref<string>("");
|
||||||
|
|
@ -63,16 +65,15 @@ const expanded = ref<string[]>([]);
|
||||||
const positionUse = ref<string[]>([]);
|
const positionUse = ref<string[]>([]);
|
||||||
const positionNo = ref<DataPositionNo[]>([]);
|
const positionNo = ref<DataPositionNo[]>([]);
|
||||||
const positionId = ref<string>("");
|
const positionId = ref<string>("");
|
||||||
const selectId = ref<string>("");
|
const seletcId = ref<string>("");
|
||||||
const posType = ref<FormPosType | null>(null);
|
const posType = ref<FormPosType | null>(null);
|
||||||
const posLevel = ref<string>("");
|
const posLevel = ref<string>("");
|
||||||
const selectedPos = ref<Positions[]>([]);
|
const selectedPos = ref<any[]>([]);
|
||||||
const datePos = ref<Date | null>(new Date());
|
const datePos = ref<Date>(new Date());
|
||||||
const posMasterMain = ref<PositionMaim[]>([]);
|
const posMasterMain = ref<any[]>([]);
|
||||||
const orgRevisionId = ref<string>("");
|
const orgRevisionId = ref<string>("");
|
||||||
const optionPosType = ref<FormPosType[]>([]);
|
const optionPosType = ref<FormPosType[]>([]);
|
||||||
const optionPosLevel = ref<FormPosLevel[]>([]);
|
const optionPosLevel = ref<FormPosLevel[]>([]);
|
||||||
const isLoadPosition = ref<boolean>(false);
|
|
||||||
|
|
||||||
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
|
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
|
||||||
async function fetchStructure() {
|
async function fetchStructure() {
|
||||||
|
|
@ -90,14 +91,12 @@ async function fetchStructure() {
|
||||||
*/
|
*/
|
||||||
function updateSelected(data: TreeMain) {
|
function updateSelected(data: TreeMain) {
|
||||||
if (props?.dataRow?.nodeId === data.orgTreeId) {
|
if (props?.dataRow?.nodeId === data.orgTreeId) {
|
||||||
positionId.value = props?.dataRow?.posmasterId ?? "";
|
positionId.value = props?.dataRow?.posmasterId;
|
||||||
selectId.value = props?.dataRow?.positionId ?? "";
|
seletcId.value = props?.dataRow?.positionId;
|
||||||
datePos.value = props?.dataRow?.reportingDate
|
datePos.value = props?.dataRow?.reportingDate;
|
||||||
? new Date(props.dataRow.reportingDate)
|
|
||||||
: new Date();
|
|
||||||
} else {
|
} else {
|
||||||
positionId.value = "";
|
positionId.value = "";
|
||||||
selectId.value = "";
|
seletcId.value = "";
|
||||||
selectedPos.value = [];
|
selectedPos.value = [];
|
||||||
datePos.value = new Date();
|
datePos.value = new Date();
|
||||||
}
|
}
|
||||||
|
|
@ -118,8 +117,6 @@ const isPosition = ref<string>("exam");
|
||||||
// const isPositionOld = ref<boolean>(false);
|
// const isPositionOld = ref<boolean>(false);
|
||||||
async function fetchDataTable(id: string, level: number = 0) {
|
async function fetchDataTable(id: string, level: number = 0) {
|
||||||
showLoader();
|
showLoader();
|
||||||
isLoadPosition.value = false;
|
|
||||||
positionNo.value = [];
|
|
||||||
const body = {
|
const body = {
|
||||||
node: level,
|
node: level,
|
||||||
nodeId: id,
|
nodeId: id,
|
||||||
|
|
@ -153,7 +150,7 @@ async function fetchDataTable(id: string, level: number = 0) {
|
||||||
if (p.length !== 0) {
|
if (p.length !== 0) {
|
||||||
const a = p.find((el: Positions) => el.positionIsSelected === true);
|
const a = p.find((el: Positions) => el.positionIsSelected === true);
|
||||||
const { id, ...rest } = a ? a : p[0];
|
const { id, ...rest } = a ? a : p[0];
|
||||||
const data: PositionMaim = { ...e, ...rest } as PositionMaim;
|
const data: any = { ...e, ...rest };
|
||||||
dataMain.push(data);
|
dataMain.push(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -165,22 +162,21 @@ async function fetchDataTable(id: string, level: number = 0) {
|
||||||
(e) => e !== props.dataRow?.posmasterId
|
(e) => e !== props.dataRow?.posmasterId
|
||||||
);
|
);
|
||||||
|
|
||||||
positionNo.value = posMain.filter(
|
positionNo.value = posMain.filter((e: any) => !newUse.includes(e.id));
|
||||||
(e: DataPositionNo) => !newUse.includes(e.id)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
positionNo.value = posMain.filter(
|
positionNo.value = posMain.filter(
|
||||||
(e: DataPositionNo) => !positionUse.value.includes(e.id)
|
(e: any) => !positionUse.value.includes(e.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoadPosition.value = true;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
setTimeout(() => {
|
||||||
|
hideLoader();
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,11 +198,9 @@ async function fetchPosFind(level: number, id: string) {
|
||||||
|
|
||||||
expanded.value = data;
|
expanded.value = data;
|
||||||
nodeId.value = id;
|
nodeId.value = id;
|
||||||
positionId.value = props?.dataRow?.posmasterId ?? "";
|
positionId.value = props?.dataRow?.posmasterId;
|
||||||
selectId.value = props?.dataRow?.positionId ?? "";
|
seletcId.value = props?.dataRow?.positionId;
|
||||||
datePos.value = props?.dataRow?.reportingDate
|
datePos.value = props?.dataRow?.reportingDate;
|
||||||
? new Date(props.dataRow.reportingDate)
|
|
||||||
: new Date();
|
|
||||||
|
|
||||||
fetchDataTable(nodeId.value, level);
|
fetchDataTable(nodeId.value, level);
|
||||||
})
|
})
|
||||||
|
|
@ -218,14 +212,12 @@ async function fetchPosFind(level: number, id: string) {
|
||||||
|
|
||||||
/** function บันทึกข้อมูลตำแหน่ง*/
|
/** function บันทึกข้อมูลตำแหน่ง*/
|
||||||
async function onClickSubmit() {
|
async function onClickSubmit() {
|
||||||
const dataPosMaster = posMasterMain.value?.find(
|
const dataPosMaster = await posMasterMain.value?.find(
|
||||||
(e) => e.id === positionId.value
|
(e: any) => e.id === positionId.value
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectedPos.value.length === 0) {
|
if (selectedPos.value.length === 0) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
||||||
} else if (!dataPosMaster) {
|
|
||||||
dialogMessageNotify($q, "ไม่พบข้อมูลตำแหน่ง");
|
|
||||||
} else {
|
} else {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -243,7 +235,6 @@ async function onClickSubmit() {
|
||||||
posLevelId: selectedPos.value[0].posLevelId, //ชื่อตำแหน่ง
|
posLevelId: selectedPos.value[0].posLevelId, //ชื่อตำแหน่ง
|
||||||
posLevelName: selectedPos.value[0].posLevelName, //ชื่อตำแหน่ง
|
posLevelName: selectedPos.value[0].posLevelName, //ชื่อตำแหน่ง
|
||||||
posExecutiveName: selectedPos.value[0].posExecutiveName,
|
posExecutiveName: selectedPos.value[0].posExecutiveName,
|
||||||
posExecutiveId: selectedPos.value[0].posExecutiveId,
|
|
||||||
reportingDate: convertDateToAPI(datePos.value),
|
reportingDate: convertDateToAPI(datePos.value),
|
||||||
posmasterId: dataPosMaster.id,
|
posmasterId: dataPosMaster.id,
|
||||||
positionExecutiveField: selectedPos.value[0].positionExecutiveField, //ด้านทางการบริหาร
|
positionExecutiveField: selectedPos.value[0].positionExecutiveField, //ด้านทางการบริหาร
|
||||||
|
|
@ -281,9 +272,6 @@ function clearData() {
|
||||||
posLevel.value = "";
|
posLevel.value = "";
|
||||||
isPosition.value = "exam";
|
isPosition.value = "exam";
|
||||||
filterTree.value = "";
|
filterTree.value = "";
|
||||||
datePos.value = new Date();
|
|
||||||
isLoadPosition.value = false;
|
|
||||||
positionNo.value = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callback function เมื่อมีการเปิด popup*/
|
/** callback function เมื่อมีการเปิด popup*/
|
||||||
|
|
@ -292,11 +280,9 @@ watch(
|
||||||
async () => {
|
async () => {
|
||||||
if (modal.value) {
|
if (modal.value) {
|
||||||
await fetchPositionUes();
|
await fetchPositionUes();
|
||||||
|
|
||||||
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
|
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
|
||||||
await fetchPosFind(
|
await fetchPosFind(props?.dataRow?.node, props?.dataRow?.nodeId);
|
||||||
props?.dataRow?.node ?? 0,
|
|
||||||
props?.dataRow?.nodeId ?? ""
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
expanded.value = [];
|
expanded.value = [];
|
||||||
}
|
}
|
||||||
|
|
@ -337,7 +323,8 @@ async function getOrgPosType() {
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPosType() {
|
function onPosType() {
|
||||||
|
|
@ -349,15 +336,28 @@ function onPosType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
[isAll, isBlank, () => isPosition.value],
|
() => isAll.value,
|
||||||
([newAll, newBlank, newPos], [oldAll, oldBlank, oldPos]) => {
|
(value, oldVal) => {
|
||||||
const shouldFetch = newAll !== oldAll || newBlank !== oldBlank;
|
if (value !== oldVal) {
|
||||||
const isSelectMode = newPos === "select" && oldPos !== "select";
|
|
||||||
|
|
||||||
if (shouldFetch || isSelectMode) {
|
|
||||||
fetchDataTable(nodeId.value, nodeLevel.value);
|
fetchDataTable(nodeId.value, nodeLevel.value);
|
||||||
}
|
}
|
||||||
if (isSelectMode) {
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => isBlank.value,
|
||||||
|
(value, oldVal) => {
|
||||||
|
if (value !== oldVal) {
|
||||||
|
fetchDataTable(nodeId.value, nodeLevel.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => isPosition.value === "select",
|
||||||
|
(value, oldVal) => {
|
||||||
|
if (value !== oldVal) {
|
||||||
|
fetchDataTable(nodeId.value, nodeLevel.value);
|
||||||
getOrgPosType();
|
getOrgPosType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -458,15 +458,15 @@ onMounted(() => {
|
||||||
:name="item"
|
:name="item"
|
||||||
>
|
>
|
||||||
<CardPosition
|
<CardPosition
|
||||||
v-model:position="positionNo"
|
v-model:position="positionNo as []"
|
||||||
v-model:selectedPos="selectedPos"
|
v-model:selectedPos="selectedPos"
|
||||||
v-model:datePos="datePos"
|
v-model:datePos="datePos"
|
||||||
v-model:positionId="positionId"
|
v-model:positionId="positionId"
|
||||||
v-model:selectId="selectId"
|
v-model:seletcId="seletcId"
|
||||||
v-model:is-all="isAll"
|
v-model:is-all="isAll"
|
||||||
v-model:is-blank="isBlank"
|
v-model:is-blank="isBlank"
|
||||||
v-model:is-position="isPosition"
|
v-model:is-position="isPosition"
|
||||||
v-model:pos-type="posType"
|
v-model:pos-type="posType as FormPosType"
|
||||||
v-model:pos-level="posLevel"
|
v-model:pos-level="posLevel"
|
||||||
v-model:option-pos-type="optionPosType"
|
v-model:option-pos-type="optionPosType"
|
||||||
v-model:option-pos-level="optionPosLevel"
|
v-model:option-pos-level="optionPosLevel"
|
||||||
|
|
@ -474,8 +474,7 @@ onMounted(() => {
|
||||||
:on-pos-type="onPosType"
|
:on-pos-type="onPosType"
|
||||||
:node-id="nodeId"
|
:node-id="nodeId"
|
||||||
:node-level="nodeLevel"
|
:node-level="nodeLevel"
|
||||||
:bma-officer="props.dataRow?.bmaOfficer ?? ''"
|
:bma-officer="props.dataRow?.bmaOfficer"
|
||||||
:is-load-position="isLoadPosition"
|
|
||||||
/>
|
/>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
</q-tab-panels>
|
</q-tab-panels>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch, reactive, computed, type PropType } from "vue";
|
import { ref, onMounted, watch, reactive, computed } from "vue";
|
||||||
import { useQuasar, QForm } from "quasar";
|
import { useQuasar, QForm } from "quasar";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
|
@ -9,8 +9,6 @@ import { useRoute, useRouter } from "vue-router";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
||||||
import { useMenuDataStore } from "@/stores/menuList";
|
|
||||||
import { validateFileSize } from "@/utils/function";
|
|
||||||
import avatar from "@/assets/avatar_user.jpg";
|
import avatar from "@/assets/avatar_user.jpg";
|
||||||
|
|
||||||
import type { PartialTableName } from "@/modules/05_placement/interface/request/placement";
|
import type { PartialTableName } from "@/modules/05_placement/interface/request/placement";
|
||||||
|
|
@ -29,7 +27,6 @@ import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewC
|
||||||
|
|
||||||
const $q = useQuasar(); // show dialog
|
const $q = useQuasar(); // show dialog
|
||||||
const DataStore = usePlacementDataStore();
|
const DataStore = usePlacementDataStore();
|
||||||
const storeMenu = useMenuDataStore();
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||||
|
|
@ -48,7 +45,7 @@ const {
|
||||||
/** รับค่ามาจากหน้าหลัก */
|
/** รับค่ามาจากหน้าหลัก */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
statCard: {
|
statCard: {
|
||||||
type: Function as PropType<() => Promise<void>>,
|
type: Function,
|
||||||
default: () => console.log("getStat"),
|
default: () => console.log("getStat"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -58,14 +55,7 @@ const command = ref<string>("");
|
||||||
const commandId = ref<string>("");
|
const commandId = ref<string>("");
|
||||||
const commandCitizenId = ref<string>("");
|
const commandCitizenId = ref<string>("");
|
||||||
|
|
||||||
// เปลี่ยนจาก ref เป็น computed property
|
let roleAdmin = ref<boolean>(false);
|
||||||
const roleAdmin = computed(() => {
|
|
||||||
if (!storeMenu.permissions) return false;
|
|
||||||
|
|
||||||
const permission = checkPermission(route);
|
|
||||||
return DataStore.isOfficer || permission?.attrOwnership == "OWNER";
|
|
||||||
});
|
|
||||||
|
|
||||||
const edit = ref<boolean>(true);
|
const edit = ref<boolean>(true);
|
||||||
const modalPersonal = ref<boolean>(false);
|
const modalPersonal = ref<boolean>(false);
|
||||||
const modal = ref<boolean>(false); //modal ขอผ่อนผัน + สละสิทธิ์
|
const modal = ref<boolean>(false); //modal ขอผ่อนผัน + สละสิทธิ์
|
||||||
|
|
@ -94,6 +84,7 @@ const appointModal = ref<boolean>(false);
|
||||||
const getNumFile = ref(0);
|
const getNumFile = ref(0);
|
||||||
const dataRes = ref<any>([]);
|
const dataRes = ref<any>([]);
|
||||||
const personal = ref<any>([]);
|
const personal = ref<any>([]);
|
||||||
|
const displayAdd = ref<boolean>(true);
|
||||||
const containStatus = ref<boolean>(false);
|
const containStatus = ref<boolean>(false);
|
||||||
const modaladdlist = ref<boolean>(false);
|
const modaladdlist = ref<boolean>(false);
|
||||||
const selected = ref<any>([]);
|
const selected = ref<any>([]);
|
||||||
|
|
@ -101,13 +92,6 @@ const personal_selected = ref<any>([]);
|
||||||
const filterlistAdd = ref<string>("");
|
const filterlistAdd = ref<string>("");
|
||||||
const paging = ref<boolean>(true);
|
const paging = ref<boolean>(true);
|
||||||
|
|
||||||
const displayAdd = computed(() => {
|
|
||||||
if (!storeMenu.permissions) return true;
|
|
||||||
|
|
||||||
const permission = checkPermission(route);
|
|
||||||
return roleAdmin.value || permission?.attrOwnership === "OWNER";
|
|
||||||
});
|
|
||||||
|
|
||||||
// เช็ตสถานะการเลือกคนไปยังหน่วยงาน
|
// เช็ตสถานะการเลือกคนไปยังหน่วยงาน
|
||||||
const checkSelected = computed(() => {
|
const checkSelected = computed(() => {
|
||||||
if (selected.value.length === 0) {
|
if (selected.value.length === 0) {
|
||||||
|
|
@ -264,17 +248,16 @@ const columnsBase = ref<QTableProps["columns"]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const columns = computed(() => {
|
const columns = computed(() =>
|
||||||
const permission = checkPermission(route);
|
roleAdmin.value || checkPermission(route)?.attrOwnership == "OWNER"
|
||||||
return roleAdmin.value || permission?.attrOwnership == "OWNER"
|
|
||||||
? columnsBase.value
|
? columnsBase.value
|
||||||
: columnsBase.value?.filter(
|
: columnsBase.value?.filter(
|
||||||
(col) =>
|
(col) =>
|
||||||
col.name !== "no" &&
|
col.name !== "no" &&
|
||||||
col.name !== "draft" &&
|
col.name !== "draft" &&
|
||||||
col.name !== "refCommandNo"
|
col.name !== "refCommandNo"
|
||||||
);
|
)
|
||||||
});
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* แปลงสถานะพนักงาน
|
* แปลงสถานะพนักงาน
|
||||||
|
|
@ -423,9 +406,8 @@ async function getTable() {
|
||||||
rowsAll.value.push(rowData);
|
rowsAll.value.push(rowData);
|
||||||
});
|
});
|
||||||
|
|
||||||
const permission = checkPermission(route);
|
|
||||||
const rowData = await (roleAdmin.value ||
|
const rowData = await (roleAdmin.value ||
|
||||||
permission?.attrOwnership == "OWNER"
|
checkPermission(route)?.attrOwnership == "OWNER"
|
||||||
? rowsAll.value
|
? rowsAll.value
|
||||||
: rowsAll.value.filter((x: any) => x.isDraft === true));
|
: rowsAll.value.filter((x: any) => x.isDraft === true));
|
||||||
|
|
||||||
|
|
@ -572,9 +554,8 @@ function getClass(val: boolean) {
|
||||||
* @param draft status
|
* @param draft status
|
||||||
*/
|
*/
|
||||||
function selectData(pid: string, draft: string) {
|
function selectData(pid: string, draft: string) {
|
||||||
const permission = checkPermission(route);
|
|
||||||
if (
|
if (
|
||||||
(roleAdmin.value || permission?.attrOwnership == "OWNER") &&
|
(roleAdmin.value || checkPermission(route)?.attrOwnership == "OWNER") &&
|
||||||
draft === "ส่งตัวแล้ว"
|
draft === "ส่งตัวแล้ว"
|
||||||
) {
|
) {
|
||||||
personalId.value = pid;
|
personalId.value = pid;
|
||||||
|
|
@ -877,33 +858,34 @@ async function filterRowsMain(type: string, pos: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function รอให้ permissions load เสร็จ
|
|
||||||
function waitForPermissions(): Promise<void> {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
const checkPermissions = () => {
|
|
||||||
if (storeMenu.permissions) {
|
|
||||||
resolve();
|
|
||||||
} else {
|
|
||||||
setTimeout(checkPermissions, 100); // เช็คทุก 100ms
|
|
||||||
}
|
|
||||||
};
|
|
||||||
checkPermissions();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ปรับปรุง getWorkFlow function
|
|
||||||
async function getWorkFlow() {
|
async function getWorkFlow() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
||||||
// รอให้ permissions load เสร็จก่อน
|
|
||||||
await waitForPermissions();
|
|
||||||
|
|
||||||
await http
|
await http
|
||||||
.get(config.API.workflowKeycloakSystem("SYS_PLACEMENT_PASS"))
|
.get(config.API.workflowKeycloakSystem("SYS_PLACEMENT_PASS"))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
DataStore.isOfficer = data.isOfficer;
|
DataStore.isOfficer = data.isOfficer;
|
||||||
DataStore.isStaff = data.isStaff;
|
DataStore.isStaff = data.isStaff;
|
||||||
|
roleAdmin.value =
|
||||||
|
data.isOfficer || checkPermission(route)?.attrOwnership == "OWNER";
|
||||||
|
if (
|
||||||
|
roleAdmin.value === false &&
|
||||||
|
checkPermission(route)?.attrOwnership !== "OWNER"
|
||||||
|
) {
|
||||||
|
displayAdd.value = false;
|
||||||
|
// visibleColumns.value = [
|
||||||
|
// "position",
|
||||||
|
// "fullName",
|
||||||
|
// "examNumber",
|
||||||
|
// "idCard",
|
||||||
|
// "positionNumber",
|
||||||
|
// "organizationName",
|
||||||
|
// "reportingDate",
|
||||||
|
// "bmaOfficer",
|
||||||
|
// "statusName",
|
||||||
|
// "positionCandidate",
|
||||||
|
// ];
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -968,28 +950,6 @@ function onUpdateStatus(id: string) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdateDraftStatus(id: string) {
|
|
||||||
dialogConfirm(
|
|
||||||
$q,
|
|
||||||
async () => {
|
|
||||||
showLoader();
|
|
||||||
try {
|
|
||||||
await http.post(config.API.placementUpdateDraftStatus, {
|
|
||||||
personalId: id,
|
|
||||||
});
|
|
||||||
await success($q, "บันทึกสำเร็จ");
|
|
||||||
await getTable();
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ยืนยันการยกเลิกการส่งตัว",
|
|
||||||
"ต้องการยกเลิกการส่งตัวรายชื่อนี้ใช่หรือไม่ ?"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getWorkFlow();
|
await getWorkFlow();
|
||||||
await getTable();
|
await getTable();
|
||||||
|
|
@ -1052,31 +1012,6 @@ onMounted(async () => {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>รายละเอียด</q-item-section>
|
<q-item-section>รายละเอียด</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
|
||||||
v-if="
|
|
||||||
checkPermission($route)?.attrIsUpdate &&
|
|
||||||
props.row.isDraft &&
|
|
||||||
props.row.statusId === 'PREPARE-CONTAIN' &&
|
|
||||||
(DataStore.isOfficer ||
|
|
||||||
checkPermission($route)?.attrOwnership == 'OWNER')
|
|
||||||
"
|
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="onUpdateDraftStatus(props.row.personalId)"
|
|
||||||
>
|
|
||||||
<q-item-section
|
|
||||||
style="min-width: 0px"
|
|
||||||
avatar
|
|
||||||
class="q-py-sm"
|
|
||||||
>
|
|
||||||
<q-icon
|
|
||||||
color="red"
|
|
||||||
size="xs"
|
|
||||||
name="mdi-account-arrow-left-outline"
|
|
||||||
/>
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section>ยกเลิกการส่งตัว</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
|
|
||||||
<q-item
|
<q-item
|
||||||
v-if="
|
v-if="
|
||||||
|
|
@ -1545,10 +1480,7 @@ onMounted(async () => {
|
||||||
:label="`${'เลือกไฟล์เอกสารหลักฐาน'}`"
|
:label="`${'เลือกไฟล์เอกสารหลักฐาน'}`"
|
||||||
outlined
|
outlined
|
||||||
use-chips
|
use-chips
|
||||||
:rules="[
|
:rules="[(val:string) => !!val || 'กรุณาเลือกไฟล์เอกสารหลักฐาน']"
|
||||||
(val) => !!val || 'กรุณาเลือกไฟล์เอกสารหลักฐาน',
|
|
||||||
(val) => validateFileSize(val),
|
|
||||||
]"
|
|
||||||
multiple
|
multiple
|
||||||
@update:model-value="clickEditRow"
|
@update:model-value="clickEditRow"
|
||||||
class="q-py-sm"
|
class="q-py-sm"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const dataMapToSend = computed(() => {
|
||||||
return selected.value.map((i: any) => ({
|
return selected.value.map((i: any) => ({
|
||||||
id: i.id,
|
id: i.id,
|
||||||
profileId: i.profileId,
|
profileId: i.profileId,
|
||||||
prefix: i.rank ? i.rank : i.prefix,
|
prefix: i.prefix,
|
||||||
firstName: i.firstName,
|
firstName: i.firstName,
|
||||||
lastName: i.lastName,
|
lastName: i.lastName,
|
||||||
citizenId: i.citizenId,
|
citizenId: i.citizenId,
|
||||||
|
|
@ -89,9 +89,7 @@ const columns2 = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
format(val, row) {
|
format(val, row) {
|
||||||
return `${row.rank ? row.rank : row.prefix ?? ""}${row.firstName ?? ""} ${
|
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
|
||||||
row.lastName ?? ""
|
|
||||||
}`;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -112,11 +110,9 @@ const columns2 = ref<QTableProps["columns"]>([
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
format(val, row) {
|
||||||
return row.positionTypeOld && row.positionTypeOl !== "-"
|
return row.positionTypeOld
|
||||||
? `${row.positionTypeOld}${
|
? `${row.positionTypeOld}${
|
||||||
row.positionLevelOld && row.positionLevelOld !== "-"
|
row.positionLevelOld ? `(${row.positionLevelOld})` : ""
|
||||||
? `(${row.positionLevelOld})`
|
|
||||||
: ""
|
|
||||||
}`
|
}`
|
||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ const informaData = ref<FormAddPerson>({
|
||||||
employeeType: null,
|
employeeType: null,
|
||||||
employeeClass: null,
|
employeeClass: null,
|
||||||
profileType: null,
|
profileType: null,
|
||||||
rank: "",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// รายการข้อมูลทั้งหมด
|
// รายการข้อมูลทั้งหมด
|
||||||
|
|
@ -61,7 +60,6 @@ const Ops = ref<InformationOps>({
|
||||||
religionOps: [],
|
religionOps: [],
|
||||||
employeeClassOps: [],
|
employeeClassOps: [],
|
||||||
employeeTypeOps: [],
|
employeeTypeOps: [],
|
||||||
rankOps: [],
|
|
||||||
});
|
});
|
||||||
// ข้อมูลเมื่อเลือกแล้ว
|
// ข้อมูลเมื่อเลือกแล้ว
|
||||||
const OpsFilter = ref<InformationOps>({
|
const OpsFilter = ref<InformationOps>({
|
||||||
|
|
@ -73,7 +71,6 @@ const OpsFilter = ref<InformationOps>({
|
||||||
religionOps: [],
|
religionOps: [],
|
||||||
employeeClassOps: [],
|
employeeClassOps: [],
|
||||||
employeeTypeOps: [],
|
employeeTypeOps: [],
|
||||||
rankOps: [],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// รูป profile
|
// รูป profile
|
||||||
|
|
@ -138,16 +135,6 @@ async function fetchPerson() {
|
||||||
});
|
});
|
||||||
Ops.value.religionOps = optionreligions;
|
Ops.value.religionOps = optionreligions;
|
||||||
OpsFilter.value.religionOps = optionreligions;
|
OpsFilter.value.religionOps = optionreligions;
|
||||||
|
|
||||||
let rank: DataOption[] = [];
|
|
||||||
data.rank.map((r: DataOptioninfo) => {
|
|
||||||
rank.push({
|
|
||||||
id: r.id.toString(),
|
|
||||||
name: r.name.toString(),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Ops.value.rankOps = rank;
|
|
||||||
OpsFilter.value.rankOps = rank;
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -217,13 +204,7 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "rankOps":
|
|
||||||
update(() => {
|
|
||||||
Ops.value.rankOps = OpsFilter.value.rankOps.filter(
|
|
||||||
(v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -246,7 +227,7 @@ function onSubmit() {
|
||||||
if (fileData.value != null) formData.append("File", fileData.value); //แก้ไขรูป
|
if (fileData.value != null) formData.append("File", fileData.value); //แก้ไขรูป
|
||||||
if (informaData.value.citizenId != undefined)
|
if (informaData.value.citizenId != undefined)
|
||||||
formData.append("citizenId", informaData.value.citizenId);
|
formData.append("citizenId", informaData.value.citizenId);
|
||||||
if (informaData.value.prefix != undefined && informaData.value.prefix != "")
|
if (informaData.value.prefix != undefined)
|
||||||
formData.append("prefix", informaData.value.prefix);
|
formData.append("prefix", informaData.value.prefix);
|
||||||
if (informaData.value.firstName != undefined)
|
if (informaData.value.firstName != undefined)
|
||||||
formData.append("firstName", informaData.value.firstName);
|
formData.append("firstName", informaData.value.firstName);
|
||||||
|
|
@ -275,8 +256,6 @@ function onSubmit() {
|
||||||
formData.append("employeeType", informaData.value.employeeType);
|
formData.append("employeeType", informaData.value.employeeType);
|
||||||
if (informaData.value.employeeClass != undefined)
|
if (informaData.value.employeeClass != undefined)
|
||||||
formData.append("employeeClass", informaData.value.employeeClass);
|
formData.append("employeeClass", informaData.value.employeeClass);
|
||||||
if (informaData.value.rank != undefined && informaData.value.rank != "")
|
|
||||||
formData.append("rank", informaData.value.rank);
|
|
||||||
|
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -310,15 +289,6 @@ function updateBirthDate(v: Date) {
|
||||||
age.value = calculateAge(v);
|
age.value = calculateAge(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function prefixRankRule() {
|
|
||||||
return [
|
|
||||||
() =>
|
|
||||||
!!informaData.value.rank ||
|
|
||||||
!!informaData.value.prefix ||
|
|
||||||
"กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ทำงานเมื่อมีการเรียกใช้ Components
|
* ทำงานเมื่อมีการเรียกใช้ Components
|
||||||
*/
|
*/
|
||||||
|
|
@ -413,7 +383,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
<q-card-section class="q-px-lg">
|
<q-card-section class="q-px-lg">
|
||||||
<div class="row q-col-gutter-sm">
|
<div class="row q-col-gutter-sm">
|
||||||
<div class="col-2">
|
<div class="col-3">
|
||||||
<q-input
|
<q-input
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
outlined
|
outlined
|
||||||
|
|
@ -434,14 +404,13 @@ onMounted(async () => {
|
||||||
mask="#############"
|
mask="#############"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-3">
|
||||||
<q-select
|
<q-select
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
v-model="informaData.prefix"
|
v-model="informaData.prefix"
|
||||||
label="คำนำหน้าชื่อ"
|
label="คำนำหน้าชื่อ"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
clearable
|
|
||||||
lazy-rules
|
lazy-rules
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:options="Ops.prefixOps"
|
:options="Ops.prefixOps"
|
||||||
|
|
@ -449,8 +418,11 @@ onMounted(async () => {
|
||||||
option-value="name"
|
option-value="name"
|
||||||
map-options
|
map-options
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:rules="prefixRankRule()"
|
:rules="[
|
||||||
reactive-rules
|
(val:string) => {
|
||||||
|
return val.length > 0 || 'กรุณาเลือกคำนำหน้าชื่อ';
|
||||||
|
},
|
||||||
|
]"
|
||||||
emit-value
|
emit-value
|
||||||
use-input
|
use-input
|
||||||
hide-selected
|
hide-selected
|
||||||
|
|
@ -460,32 +432,6 @@ onMounted(async () => {
|
||||||
)"
|
)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
|
||||||
<q-select
|
|
||||||
bg-color="white"
|
|
||||||
v-model="informaData.rank"
|
|
||||||
label="ยศ"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
clearable
|
|
||||||
class="inputgreen"
|
|
||||||
:options="Ops.rankOps"
|
|
||||||
option-label="name"
|
|
||||||
option-value="name"
|
|
||||||
map-options
|
|
||||||
hide-bottom-space
|
|
||||||
:rules="prefixRankRule()"
|
|
||||||
reactive-rules
|
|
||||||
emit-value
|
|
||||||
use-input
|
|
||||||
hide-selected
|
|
||||||
fill-input
|
|
||||||
@filter="(inputValue:string,
|
|
||||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps'
|
|
||||||
)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<q-input
|
<q-input
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ const Ops = ref<InformationOps>({
|
||||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||||
],
|
],
|
||||||
rankOps: [],
|
|
||||||
});
|
});
|
||||||
const OpsFilter = ref<InformationOps>({
|
const OpsFilter = ref<InformationOps>({
|
||||||
prefixOps: [],
|
prefixOps: [],
|
||||||
|
|
@ -130,7 +129,6 @@ const OpsFilter = ref<InformationOps>({
|
||||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||||
],
|
],
|
||||||
rankOps: [],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/** ฟังก์ชันดึงข้อมูลรายการข้อมูลเกี่ยวกับบุคคล (dropdown list)*/
|
/** ฟังก์ชันดึงข้อมูลรายการข้อมูลเกี่ยวกับบุคคล (dropdown list)*/
|
||||||
|
|
@ -188,16 +186,6 @@ async function fetchPerson() {
|
||||||
});
|
});
|
||||||
Ops.value.religionOps = optionreligions;
|
Ops.value.religionOps = optionreligions;
|
||||||
OpsFilter.value.religionOps = optionreligions;
|
OpsFilter.value.religionOps = optionreligions;
|
||||||
|
|
||||||
let rank: DataOption[] = [];
|
|
||||||
data.rank.map((r: DataOptioninfo) => {
|
|
||||||
rank.push({
|
|
||||||
id: r.id.toString(),
|
|
||||||
name: r.name.toString(),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Ops.value.rankOps = rank;
|
|
||||||
OpsFilter.value.rankOps = rank;
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -227,9 +215,9 @@ async function getData() {
|
||||||
}
|
}
|
||||||
rows.value = list;
|
rows.value = list;
|
||||||
profileId.value = data.profileId;
|
profileId.value = data.profileId;
|
||||||
title.value.fullname = `${data.rank ? data.rank : data.prefix ?? ""}${
|
title.value.fullname = `${data.prefix ?? ""}${data.firstName ?? ""} ${
|
||||||
data.firstName ?? ""
|
data.lastName ?? ""
|
||||||
} ${data.lastName ?? ""}`;
|
}`;
|
||||||
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
|
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
|
||||||
title.value.positionLevelOld = data.positionLevelOld ?? "-";
|
title.value.positionLevelOld = data.positionLevelOld ?? "-";
|
||||||
title.value.positionTypeOld = data.positionTypeOld ?? "-";
|
title.value.positionTypeOld = data.positionTypeOld ?? "-";
|
||||||
|
|
@ -242,7 +230,6 @@ async function getData() {
|
||||||
(data.prefix == "00000000-0000-0000-0000-000000000000"
|
(data.prefix == "00000000-0000-0000-0000-000000000000"
|
||||||
? null
|
? null
|
||||||
: data.prefix) ?? "",
|
: data.prefix) ?? "",
|
||||||
rank: data.rank ?? "",
|
|
||||||
firstname: data.firstName ?? "",
|
firstname: data.firstName ?? "",
|
||||||
lastname: data.lastName ?? "",
|
lastname: data.lastName ?? "",
|
||||||
birthDate:
|
birthDate:
|
||||||
|
|
@ -308,7 +295,6 @@ async function fetchData(data: any) {
|
||||||
(data.prefix == "00000000-0000-0000-0000-000000000000"
|
(data.prefix == "00000000-0000-0000-0000-000000000000"
|
||||||
? null
|
? null
|
||||||
: data.prefix) ?? "",
|
: data.prefix) ?? "",
|
||||||
rank: data.rank ?? "",
|
|
||||||
firstname: data.firstName ?? "",
|
firstname: data.firstName ?? "",
|
||||||
lastname: data.lastName ?? "",
|
lastname: data.lastName ?? "",
|
||||||
birthDate: data.dateOfBirth !== null ? new Date(data.dateOfBirth) : null,
|
birthDate: data.dateOfBirth !== null ? new Date(data.dateOfBirth) : null,
|
||||||
|
|
@ -450,14 +436,6 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "rankOps":
|
|
||||||
update(() => {
|
|
||||||
Ops.value.rankOps = OpsFilter.value.rankOps.filter(
|
|
||||||
(v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +470,6 @@ function saveData() {
|
||||||
positionNumberOld: posNo.value,
|
positionNumberOld: posNo.value,
|
||||||
amount: 0,
|
amount: 0,
|
||||||
amountOld: salary.value,
|
amountOld: salary.value,
|
||||||
rank: informaData.value.rank,
|
|
||||||
};
|
};
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -540,15 +517,6 @@ function updateBirthDate(v: Date) {
|
||||||
informaData.value.age = calculateAge(v);
|
informaData.value.age = calculateAge(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function prefixRankRule() {
|
|
||||||
return [
|
|
||||||
() =>
|
|
||||||
!!informaData.value.rank ||
|
|
||||||
!!informaData.value.prefixId ||
|
|
||||||
"กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ทำงานเมื่อมีการเรียกใช้ Components*/
|
/** ทำงานเมื่อมีการเรียกใช้ Components*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchPerson();
|
await fetchPerson();
|
||||||
|
|
@ -630,7 +598,7 @@ onMounted(async () => {
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="text-weight-bold text-grey">ข้อมูลส่วนตัว</div>
|
<div class="text-weight-bold text-grey">ข้อมูลส่วนตัว</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
<q-input
|
<q-input
|
||||||
:class="getClass(edit)"
|
:class="getClass(edit)"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
|
@ -646,7 +614,7 @@ onMounted(async () => {
|
||||||
mask="#############"
|
mask="#############"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
<selector
|
<selector
|
||||||
:hide-dropdown-icon="!edit"
|
:hide-dropdown-icon="!edit"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
|
@ -666,42 +634,10 @@ onMounted(async () => {
|
||||||
option-value="name"
|
option-value="name"
|
||||||
:label="`${'คำนำหน้าชื่อ'}`"
|
:label="`${'คำนำหน้าชื่อ'}`"
|
||||||
use-input
|
use-input
|
||||||
clearable
|
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
:rules="prefixRankRule()"
|
|
||||||
reactive-rules
|
|
||||||
@filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' ) "
|
@filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' ) "
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
|
||||||
<selector
|
|
||||||
:hide-dropdown-icon="!edit"
|
|
||||||
hide-bottom-space
|
|
||||||
:class="getClass(edit)"
|
|
||||||
:readonly="!edit"
|
|
||||||
:borderless="!edit"
|
|
||||||
:outlined="edit"
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
v-model="informaData.rank"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
fill-input
|
|
||||||
:rules="prefixRankRule()"
|
|
||||||
option-label="name"
|
|
||||||
:options="Ops.rankOps"
|
|
||||||
option-value="name"
|
|
||||||
:label="`${'ยศ'}`"
|
|
||||||
reactive-rules
|
|
||||||
use-input
|
|
||||||
input-debounce="0"
|
|
||||||
@filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'rankOps' ) "
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
<q-input
|
<q-input
|
||||||
:class="getClass(edit)"
|
:class="getClass(edit)"
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,6 @@ watch(modal, (val) => {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
dense
|
dense
|
||||||
label="คำค้น"
|
label="คำค้น"
|
||||||
@keydown.enter.prevent="onSearchData()"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<q-checkbox
|
<q-checkbox
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ interface InformationOps {
|
||||||
religionOps: DataOption[];
|
religionOps: DataOption[];
|
||||||
employeeClassOps: DataOption[];
|
employeeClassOps: DataOption[];
|
||||||
employeeTypeOps: DataOption[];
|
employeeTypeOps: DataOption[];
|
||||||
rankOps: DataOption[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//ข้อมูลส่วนตัว
|
//ข้อมูลส่วนตัว
|
||||||
|
|
@ -64,7 +63,6 @@ interface FormAddPerson {
|
||||||
employeeType: string | null;
|
employeeType: string | null;
|
||||||
employeeClass: string | null;
|
employeeClass: string | null;
|
||||||
profileType: string | null;
|
profileType: string | null;
|
||||||
rank?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultInformation: Information = {
|
const defaultInformation: Information = {
|
||||||
|
|
@ -85,7 +83,6 @@ const defaultInformation: Information = {
|
||||||
employeeType: null,
|
employeeType: null,
|
||||||
employeeClass: null,
|
employeeClass: null,
|
||||||
profileType: null,
|
profileType: null,
|
||||||
rank: null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { defaultInformation };
|
export { defaultInformation };
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,6 @@ interface FormDataAppoint {
|
||||||
reportingDate: string;
|
reportingDate: string;
|
||||||
posmasterId: string;
|
posmasterId: string;
|
||||||
posExecutiveName?: string;
|
posExecutiveName?: string;
|
||||||
posExecutiveId?: string;
|
|
||||||
typeCommand: string;
|
typeCommand: string;
|
||||||
positionExecutiveField?: string;
|
positionExecutiveField?: string;
|
||||||
positionArea?: string;
|
positionArea?: string;
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,17 @@
|
||||||
interface DataList {
|
interface DataList {
|
||||||
avatar: string;
|
avatar: string;
|
||||||
bmaOfficer: string;
|
bmaOfficer: string;
|
||||||
bmaOfficerCheck?: string;
|
|
||||||
deferment: boolean;
|
deferment: boolean;
|
||||||
draft: string;
|
draft: string;
|
||||||
examNumber: number;
|
examNumber: number;
|
||||||
fullName: string;
|
fullName: string;
|
||||||
idCard: string;
|
idCard: string;
|
||||||
name: string;
|
name: string;
|
||||||
node: number | null;
|
|
||||||
nodeId: string | null;
|
|
||||||
orgName: string | null;
|
orgName: string | null;
|
||||||
organizationName: string;
|
organizationName: string;
|
||||||
organizationShortName: string | null;
|
organizationShortName: string | null;
|
||||||
personalId: string;
|
personalId: string;
|
||||||
posLevelCandidateId: string | null;
|
|
||||||
posmasterId: string | null;
|
|
||||||
posTypeCandidateId: string | null;
|
|
||||||
positionCandidate: string;
|
positionCandidate: string;
|
||||||
positionId: string | null;
|
|
||||||
positionNumber: string | null;
|
positionNumber: string | null;
|
||||||
positionPath: string | null;
|
positionPath: string | null;
|
||||||
profilePhoto: string;
|
profilePhoto: string;
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@ export const useSelectOrgStore = defineStore("selectorg", () => {
|
||||||
isPosition: e.isPosition,
|
isPosition: e.isPosition,
|
||||||
posMasterNo:
|
posMasterNo:
|
||||||
e.orgShortname +
|
e.orgShortname +
|
||||||
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : "") +
|
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : " ") +
|
||||||
" " +
|
|
||||||
e.posMasterNo +
|
e.posMasterNo +
|
||||||
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : ""),
|
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : " "),
|
||||||
positionName: e.positionName,
|
positionName: e.positionName,
|
||||||
posTypeName: e.posTypeName,
|
posTypeName: e.posTypeName,
|
||||||
posLevelName: e.posLevelName,
|
posLevelName: e.posLevelName,
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
format(val, row) {
|
format(val, row) {
|
||||||
return ` ${row.rank ? row.rank : row.prefix ?? ""}${
|
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
|
||||||
row.firstName ?? ""
|
|
||||||
} ${row.lastName ?? ""}`;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -133,11 +131,9 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
format(val, row) {
|
||||||
return row.positionTypeOld && row.positionTypeOld !== "-"
|
return row.positionTypeOld
|
||||||
? `${row.positionTypeOld}${
|
? `${row.positionTypeOld}${
|
||||||
row.positionLevelOld && row.positionLevelOld !== "-"
|
row.positionLevelOld ? `(${row.positionLevelOld})` : ""
|
||||||
? `(${row.positionLevelOld})`
|
|
||||||
: ""
|
|
||||||
}`
|
}`
|
||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
|
|
@ -382,7 +378,6 @@ async function onSave(data: FormDataAppoint) {
|
||||||
typeCommand: data.typeCommand,
|
typeCommand: data.typeCommand,
|
||||||
positionExecutiveField: data.positionExecutiveField,
|
positionExecutiveField: data.positionExecutiveField,
|
||||||
positionArea: data.positionArea,
|
positionArea: data.positionArea,
|
||||||
posExecutiveId: data.posExecutiveId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,7 @@ async function fecthlistappointment() {
|
||||||
e.positionTypeOld &&
|
e.positionTypeOld &&
|
||||||
e.positionLevelOld &&
|
e.positionLevelOld &&
|
||||||
e.positionNumberOld &&
|
e.positionNumberOld &&
|
||||||
(e.typeCommand === "MOVE" || e.positionDate)
|
e.positionDate
|
||||||
);
|
);
|
||||||
rows2.value = listData;
|
rows2.value = listData;
|
||||||
rows2Data.value = listData;
|
rows2Data.value = listData;
|
||||||
|
|
@ -457,7 +457,6 @@ async function onSave(data: FormDataAppoint) {
|
||||||
typeCommand: data.typeCommand,
|
typeCommand: data.typeCommand,
|
||||||
positionExecutiveField: data.positionExecutiveField,
|
positionExecutiveField: data.positionExecutiveField,
|
||||||
positionArea: data.positionArea,
|
positionArea: data.positionArea,
|
||||||
posExecutiveId: data.posExecutiveId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ async function fecthlistappointment() {
|
||||||
e.positionTypeOld &&
|
e.positionTypeOld &&
|
||||||
e.positionLevelOld &&
|
e.positionLevelOld &&
|
||||||
e.positionNumberOld &&
|
e.positionNumberOld &&
|
||||||
(e.positionDate || e.typeCommand === "MOVE")
|
e.positionDate
|
||||||
);
|
);
|
||||||
rows2.value = listData;
|
rows2.value = listData;
|
||||||
rows2Data.value = listData;
|
rows2Data.value = listData;
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,6 @@ async function onSaveSelectOrg(data: any) {
|
||||||
typeCommand: data.typeCommand,
|
typeCommand: data.typeCommand,
|
||||||
positionExecutiveField: data.positionExecutiveField,
|
positionExecutiveField: data.positionExecutiveField,
|
||||||
positionArea: data.positionArea,
|
positionArea: data.positionArea,
|
||||||
posExecutiveId: data.posExecutiveId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
|
||||||
|
|
@ -370,32 +370,18 @@ async function uploadFile(event: any, date: any) {
|
||||||
*/
|
*/
|
||||||
async function downloadAttachment(type: string, id: string) {
|
async function downloadAttachment(type: string, id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
try {
|
await http
|
||||||
const response = await http.get(
|
.get(config.API.reportRetireList(type, id))
|
||||||
config.API.retirementReport + `/${type}/${id}`,
|
.then(async (res) => {
|
||||||
{
|
const data = res.data.result;
|
||||||
headers: {
|
await genReport(data, `รายชื่อผู้เกษียณอายุราชการ`, type);
|
||||||
accept:
|
})
|
||||||
type === "pdf"
|
.catch(async (e) => {
|
||||||
? "application/pdf"
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
})
|
||||||
"content-Type": "application/json",
|
.finally(() => {
|
||||||
},
|
hideLoader();
|
||||||
responseType: "blob",
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
const blob = response.data;
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
const link = document.createElement("a");
|
|
||||||
link.href = url;
|
|
||||||
link.download = `รายชื่อผู้เกษียณอายุราชการ.${type}`;
|
|
||||||
link.click();
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
} catch (e) {
|
|
||||||
messageError($q, e);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ยืนยันการแก้ไขข้อมูล
|
// ยืนยันการแก้ไขข้อมูล
|
||||||
|
|
|
||||||
|
|
@ -771,7 +771,6 @@ onMounted(async () => {
|
||||||
<q-space />
|
<q-space />
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="
|
||||||
!checkRoutePermisson &&
|
|
||||||
isStaff &&
|
isStaff &&
|
||||||
status === 'WAITTING' &&
|
status === 'WAITTING' &&
|
||||||
checkPermission($route)?.attrIsUpdate
|
checkPermission($route)?.attrIsUpdate
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ const {
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailreject");
|
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailReject");
|
||||||
|
|
||||||
/** ตัวแปร */
|
/** ตัวแปร */
|
||||||
const roleUser = ref<string>("");
|
const roleUser = ref<string>("");
|
||||||
|
|
|
||||||
|
|
@ -801,7 +801,6 @@ onMounted(async () => {
|
||||||
<q-space />
|
<q-space />
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="
|
||||||
!checkRoutePermisson &&
|
|
||||||
isStaff &&
|
isStaff &&
|
||||||
status === 'WAITTING' &&
|
status === 'WAITTING' &&
|
||||||
checkPermission($route)?.attrIsUpdate
|
checkPermission($route)?.attrIsUpdate
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const router = useRouter();
|
||||||
const store = useRetirementDataStore();
|
const store = useRetirementDataStore();
|
||||||
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
|
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
|
||||||
const { convertStatusText } = store;
|
const { convertStatusText } = store;
|
||||||
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailrejectEMP");
|
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailRejectEMP");
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const {
|
const {
|
||||||
messageError,
|
messageError,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
import { getColumnLabel } from "@/utils/function";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
@ -228,7 +229,6 @@ watch(
|
||||||
label="ค้นหา"
|
label="ค้นหา"
|
||||||
v-model="keyword"
|
v-model="keyword"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
@keydown.enter.prevent="onSearchData"
|
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<q-icon name="search"></q-icon>
|
<q-icon name="search"></q-icon>
|
||||||
|
|
@ -308,7 +308,9 @@ watch(
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
>
|
>
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{
|
||||||
|
getColumnLabel(col, isAct)
|
||||||
|
}}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ async function fetchDataRetirement() {
|
||||||
firstNameTH: filter.value.firstNameTH.trim(),
|
firstNameTH: filter.value.firstNameTH.trim(),
|
||||||
lastNameTH: filter.value.lastNameTH.trim(),
|
lastNameTH: filter.value.lastNameTH.trim(),
|
||||||
});
|
});
|
||||||
const data: RetirementOld = response.data.result;
|
const data: RetirementOld = response.data.data;
|
||||||
pagination.value.rowsNumber = data.totalRecords;
|
pagination.value.rowsNumber = data.totalRecords;
|
||||||
rows.value = data.dataRecords;
|
rows.value = data.dataRecords;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
field: "year",
|
field: "year",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format: (v) => (v ? v + 543 : "-"),
|
format: (v) => v + 543,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "receiveDate",
|
name: "receiveDate",
|
||||||
|
|
|
||||||
|
|
@ -267,13 +267,7 @@ watch(
|
||||||
<div class="q-pa-md q-gutter-md">
|
<div class="q-pa-md q-gutter-md">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-grey-8">เวลาเข้างาน</div>
|
<div class="col text-grey-8">เวลาเข้างาน</div>
|
||||||
<div class="col">
|
<div class="col">{{ formData.checkInTime }}</div>
|
||||||
{{
|
|
||||||
formData.checkInDate
|
|
||||||
? `${formData.checkInDate} ${formData.checkInTime} น.`
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-grey-8">สถานที่ทำงาน</div>
|
<div class="col text-grey-8">สถานที่ทำงาน</div>
|
||||||
|
|
@ -343,23 +337,17 @@ watch(
|
||||||
<div class="q-pa-md q-gutter-md">
|
<div class="q-pa-md q-gutter-md">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-grey-8">เวลาออกงาน</div>
|
<div class="col text-grey-8">เวลาออกงาน</div>
|
||||||
<div class="col">
|
<div class="col">{{ formData.checkOutTime }}</div>
|
||||||
{{
|
|
||||||
formData.checkOutDate
|
|
||||||
? `${formData.checkOutDate} ${formData.checkOutTime} น.`
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-grey-8">สถานที่ทำงาน</div>
|
<div class="col text-grey-8">สถานที่ทำงาน</div>
|
||||||
<div class="col" v-if="formData.isLocationCheckOut">
|
<div class="col" v-if="formData.isLocationCheckOut">
|
||||||
{{ formData.checkOutLat ? "ในสถานที่" : "-" }}
|
ในสถานที่
|
||||||
</div>
|
</div>
|
||||||
<div class="col" v-else>
|
<div class="col" v-else>
|
||||||
{{
|
{{
|
||||||
formData.checkOutLocationName
|
formData.checkInLocationName
|
||||||
? `นอกสถานที่ (${formData.checkOutLocationName})`
|
? `นอกสถานที่ (${formData.checkInLocationName})`
|
||||||
: ""
|
: ""
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,6 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
field: "checkInTime",
|
field: "checkInTime",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
|
||||||
if (row.checkInDate && val) {
|
|
||||||
return `${row.checkInDate} ${val} น.`;
|
|
||||||
}
|
|
||||||
return "-";
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "checkInLocation",
|
name: "checkInLocation",
|
||||||
|
|
@ -107,12 +101,6 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
field: "checkOutTime",
|
field: "checkOutTime",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
|
||||||
if (row.checkOutDate && val) {
|
|
||||||
return `${row.checkOutDate} ${val} น.`;
|
|
||||||
}
|
|
||||||
return "-";
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "checkOutLocation",
|
name: "checkOutLocation",
|
||||||
|
|
@ -172,19 +160,19 @@ async function fetchListTimeRecord() {
|
||||||
id: e.id,
|
id: e.id,
|
||||||
fullName: e.fullName,
|
fullName: e.fullName,
|
||||||
profileType: e.profileType,
|
profileType: e.profileType,
|
||||||
checkInDate: date2Thai(e.checkInDate),
|
checkInDate: e.checkInDate ? date2Thai(e.checkInDate) : "-",
|
||||||
checkInTime: e.checkInTime,
|
checkInTime: e.checkInTime,
|
||||||
checkInLocation: e.checkInLocation,
|
checkInLocation: e.checkInLocation,
|
||||||
checkInLat: e.checkInLat,
|
checkInLat: e.checkInLat ? e.checkInLat : "",
|
||||||
checkInLon: e.checkInLon,
|
checkInLon: e.checkInLon ? e.checkInLon : "",
|
||||||
checkInStatus: e.checkInStatus
|
checkInStatus: e.checkInStatus
|
||||||
? workStore.convertSatatus(e.checkInStatus)
|
? workStore.convertSatatus(e.checkInStatus)
|
||||||
: "-",
|
: "-",
|
||||||
checkOutDate: date2Thai(e.checkOutDate),
|
checkOutDate: e.checkOutDate ? date2Thai(e.checkOutDate) : "-",
|
||||||
checkOutLocation: e.checkOutLocation,
|
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
|
||||||
checkOutTime: e.checkOutTime,
|
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
|
||||||
checkOutLat: e.checkOutLat,
|
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
|
||||||
checkOutLon: e.checkOutLon,
|
checkOutLon: e.checkOutLat ? e.checkOutLon : "",
|
||||||
checkOutStatus: e.checkOutStatus
|
checkOutStatus: e.checkOutStatus
|
||||||
? workStore.convertSatatus(e.checkOutStatus)
|
? workStore.convertSatatus(e.checkOutStatus)
|
||||||
: "-",
|
: "-",
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,6 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
field: "checkInTime",
|
field: "checkInTime",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
|
||||||
if (row.checkInDate && val) {
|
|
||||||
return `${row.checkInDate} ${val} น.`;
|
|
||||||
}
|
|
||||||
return "-";
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "checkInLocation",
|
name: "checkInLocation",
|
||||||
|
|
@ -94,12 +88,6 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
field: "checkOutTime",
|
field: "checkOutTime",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format(val, row) {
|
|
||||||
if (row.checkOutDate && val) {
|
|
||||||
return `${row.checkOutDate} ${val} น.`;
|
|
||||||
}
|
|
||||||
return "-";
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "checkOutLocation",
|
name: "checkOutLocation",
|
||||||
|
|
@ -145,15 +133,15 @@ async function fetchListLogRecord() {
|
||||||
profileType: e.profileType,
|
profileType: e.profileType,
|
||||||
fullName: e.fullName,
|
fullName: e.fullName,
|
||||||
checkInDate: e.checkInDate && date2Thai(e.checkInDate),
|
checkInDate: e.checkInDate && date2Thai(e.checkInDate),
|
||||||
checkInTime: e.checkInTime,
|
checkInTime: e.checkInTime ? e.checkInTime : "-",
|
||||||
checkInLocation: e.checkInLocation,
|
checkInLocation: e.checkInLocation ? e.checkInLocation : "-",
|
||||||
checkInLat: e.checkInLat,
|
checkInLat: e.checkInLat ? e.checkInLat : "",
|
||||||
checkInLon: e.checkInLon,
|
checkInLon: e.checkInLon ? e.checkInLon : "",
|
||||||
checkOutDate: e.checkOutDate && date2Thai(e.checkOutDate),
|
checkOutDate: e.checkOutDate && date2Thai(e.checkOutDate),
|
||||||
checkOutLocation: e.checkOutLocation,
|
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
|
||||||
checkOutTime: e.checkOutTime,
|
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
|
||||||
checkOutLat: e.checkOutLat,
|
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
|
||||||
checkOutLon: e.checkOutLon,
|
checkOutLon: e.checkOutLon ? e.checkOutLon : "",
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
rows.value = [];
|
rows.value = [];
|
||||||
|
|
|
||||||
|
|
@ -1,491 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import { onMounted, reactive, ref } from "vue";
|
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
|
||||||
import type { FormDataProcess } from "@/modules/09_leave/interface/request/work";
|
|
||||||
import type { DataProcess } from "@/modules/09_leave/interface/response/work";
|
|
||||||
|
|
||||||
import HeaderDialog from "@/components/DialogHeader.vue";
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
|
||||||
const {
|
|
||||||
dialogConfirm,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
messageError,
|
|
||||||
success,
|
|
||||||
date2Thai,
|
|
||||||
onSearchDataTable,
|
|
||||||
convertDateToAPI,
|
|
||||||
dialogRemove,
|
|
||||||
} = useCounterMixin();
|
|
||||||
|
|
||||||
/** ข้อมูลตาราง*/
|
|
||||||
const keyword = ref<string>("");
|
|
||||||
const rowsMain = ref<DataProcess[]>([]);
|
|
||||||
const rows = ref<DataProcess[]>([]);
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
|
||||||
{
|
|
||||||
name: "no",
|
|
||||||
align: "left",
|
|
||||||
label: "ลำดับ",
|
|
||||||
sortable: false,
|
|
||||||
field: "no",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "startDate",
|
|
||||||
align: "left",
|
|
||||||
label: "วันเริ่มต้น",
|
|
||||||
sortable: true,
|
|
||||||
field: "startDate",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
return val ? date2Thai(val) : "-";
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "endDate",
|
|
||||||
align: "left",
|
|
||||||
label: "วันสิ้นสุด",
|
|
||||||
sortable: true,
|
|
||||||
field: "endDate",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
return val ? date2Thai(val) : "-";
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "processingDate",
|
|
||||||
align: "left",
|
|
||||||
label: "วันที่ประมวลผล",
|
|
||||||
sortable: true,
|
|
||||||
field: "processingDate",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
return val ? date2Thai(val, false, true) : "-";
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "completedDate",
|
|
||||||
align: "left",
|
|
||||||
label: "วันที่เสร็จสิ้น",
|
|
||||||
sortable: true,
|
|
||||||
field: "completedDate",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
return val ? date2Thai(val, false, true) : "-";
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "status",
|
|
||||||
align: "left",
|
|
||||||
label: "สถานะ",
|
|
||||||
sortable: true,
|
|
||||||
field: "status",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
return convertStatus(val);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "createdAt",
|
|
||||||
align: "left",
|
|
||||||
label: "วันที่สร้าง",
|
|
||||||
sortable: true,
|
|
||||||
field: "createdAt",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
format(val, row) {
|
|
||||||
return val ? date2Thai(val, false, true) : "-";
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "createdFullName",
|
|
||||||
align: "left",
|
|
||||||
label: "ผู้สร้าง",
|
|
||||||
sortable: true,
|
|
||||||
field: "createdFullName",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const visibleColumns = ref<string[]>([
|
|
||||||
"no",
|
|
||||||
"startDate",
|
|
||||||
"endDate",
|
|
||||||
"processingDate",
|
|
||||||
"completedDate",
|
|
||||||
"status",
|
|
||||||
"createdAt",
|
|
||||||
"createdFullName",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const modal = ref<boolean>(false); // dialog
|
|
||||||
const isEdit = ref<boolean>(false); // แก้ไขหรือเพิ่ม
|
|
||||||
const editId = ref<string>(""); // id ที่จะแก้ไข
|
|
||||||
const formData = reactive<FormDataProcess>({
|
|
||||||
startDate: null,
|
|
||||||
endDate: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** ฟังก์ชันดึงข้อมูลจาก API */
|
|
||||||
async function fetchData() {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
// เรียก API เพื่อดึงข้อมูล
|
|
||||||
const res = await http.get(`${config.API.leaveTask}`);
|
|
||||||
rowsMain.value = res.data.result;
|
|
||||||
serchDataTable();
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ชันค้นหาข้อมูลในตาราง */
|
|
||||||
function serchDataTable() {
|
|
||||||
rows.value = onSearchDataTable(
|
|
||||||
keyword.value,
|
|
||||||
rowsMain.value,
|
|
||||||
columns.value ? columns.value : []
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ชันเปิด dialog เพื่อเพิ่มข้อมูล */
|
|
||||||
function handleOpenDialog() {
|
|
||||||
modal.value = true;
|
|
||||||
isEdit.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ชันปิด dialog และรีเซ็ตข้อมูล */
|
|
||||||
function handleCloseDialog() {
|
|
||||||
modal.value = false;
|
|
||||||
formData.startDate = null;
|
|
||||||
formData.endDate = null;
|
|
||||||
editId.value = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ชันส่งข้อมูล */
|
|
||||||
function onSubmit() {
|
|
||||||
dialogConfirm($q, async () => {
|
|
||||||
showLoader();
|
|
||||||
|
|
||||||
// สร้าง payload สำหรับส่งข้อมูลไปยัง API
|
|
||||||
const payload = {
|
|
||||||
startDate: convertDateToAPI(formData.startDate),
|
|
||||||
endDate: convertDateToAPI(formData.endDate),
|
|
||||||
};
|
|
||||||
|
|
||||||
//กำหนด URL และ method สำหรับเรียก API โดยตรวจสอบว่าเป็นการแก้ไขหรือเพิ่มข้อมูล
|
|
||||||
const url = isEdit.value
|
|
||||||
? `${config.API.leaveTask}/${editId.value}`
|
|
||||||
: config.API.leaveTask;
|
|
||||||
|
|
||||||
// กำหนด method สำหรับเรียก API โดยตรวจสอบว่าเป็นการแก้ไขหรือเพิ่มข้อมูล
|
|
||||||
const method = isEdit.value ? "put" : "post";
|
|
||||||
|
|
||||||
try {
|
|
||||||
await http[method](url, payload);
|
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
||||||
fetchData();
|
|
||||||
handleCloseDialog();
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ฟังก์ชันตรวจสอบและอัปเดตวันที่สิ้นสุดให้เป็น null หากวันที่เริ่มต้นมากกว่าวันที่สิ้นสุด*/
|
|
||||||
function updateDate() {
|
|
||||||
if (
|
|
||||||
formData.startDate &&
|
|
||||||
formData.endDate &&
|
|
||||||
new Date(formData.startDate) > new Date(formData.endDate)
|
|
||||||
) {
|
|
||||||
formData.endDate = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันแก้ไขข้อมูล
|
|
||||||
* @param data ข้อมูลที่ต้องการแก้ไข
|
|
||||||
*/
|
|
||||||
function handleEdit(data: DataProcess) {
|
|
||||||
isEdit.value = true;
|
|
||||||
editId.value = data.id;
|
|
||||||
formData.startDate = data.startDate;
|
|
||||||
formData.endDate = data.endDate;
|
|
||||||
modal.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันลบข้อมูล
|
|
||||||
* @param id ที่ต้องการลบ
|
|
||||||
*/
|
|
||||||
function handleDelete(id: string) {
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
showLoader();
|
|
||||||
try {
|
|
||||||
await http.delete(`${config.API.leaveTask}/${id}`);
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
fetchData();
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันแปลงสถานะเป็นข้อความ
|
|
||||||
* @param val
|
|
||||||
*/
|
|
||||||
function convertStatus(val: string) {
|
|
||||||
switch (val) {
|
|
||||||
case "PENDING":
|
|
||||||
return "รอดำเนินการ";
|
|
||||||
case "COMPLETED":
|
|
||||||
return "ดำเนินการเสร็จสิ้น";
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
fetchData();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="row items-center q-gutter-x-sm q-pb-sm">
|
|
||||||
<q-btn
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
color="primary"
|
|
||||||
icon="add"
|
|
||||||
@click="handleOpenDialog"
|
|
||||||
>
|
|
||||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-space />
|
|
||||||
|
|
||||||
<q-input
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
v-model="keyword"
|
|
||||||
label="ค้นหา"
|
|
||||||
@keydown.enter.prevent="serchDataTable"
|
|
||||||
>
|
|
||||||
<template v-slot:append>
|
|
||||||
<q-icon name="search" />
|
|
||||||
</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"
|
|
||||||
style="min-width: 140px"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<d-table
|
|
||||||
:columns="columns"
|
|
||||||
:rows="rows"
|
|
||||||
row-key="id"
|
|
||||||
flat
|
|
||||||
bordered
|
|
||||||
:paging="true"
|
|
||||||
dense
|
|
||||||
class="custom-header-table"
|
|
||||||
:visible-columns="visibleColumns"
|
|
||||||
>
|
|
||||||
<template v-slot:header="props">
|
|
||||||
<q-tr :props="props">
|
|
||||||
<q-th auto-width />
|
|
||||||
<q-th
|
|
||||||
v-for="col in props.cols"
|
|
||||||
:key="col.name"
|
|
||||||
:props="props"
|
|
||||||
style="color: #000000; font-weight: 500"
|
|
||||||
>
|
|
||||||
<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">
|
|
||||||
<q-td auto-width>
|
|
||||||
<q-btn
|
|
||||||
v-if="props.row.status === 'PENDING'"
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="edit"
|
|
||||||
icon="edit"
|
|
||||||
@click.stop.prevent="handleEdit(props.row)"
|
|
||||||
>
|
|
||||||
<q-tooltip>แก้ไข</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="props.row.status === 'PENDING'"
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="red"
|
|
||||||
icon="delete"
|
|
||||||
@click.stop.prevent="handleDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบ</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
|
||||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
|
||||||
<div v-if="col.name == 'no'">
|
|
||||||
{{ props.rowIndex + 1 }}
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
{{ col.value ? col.value : "-" }}
|
|
||||||
</div>
|
|
||||||
</q-td>
|
|
||||||
</q-tr>
|
|
||||||
</template>
|
|
||||||
</d-table>
|
|
||||||
|
|
||||||
<q-dialog v-model="modal" persistent>
|
|
||||||
<q-card style="width: 320px">
|
|
||||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
|
||||||
<HeaderDialog
|
|
||||||
:tittle="'ประมวลผลการขาดราชการ/มาสาย'"
|
|
||||||
:close="handleCloseDialog"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<q-separator />
|
|
||||||
<q-card-section>
|
|
||||||
<div class="row q-col-gutter-md">
|
|
||||||
<div class="col-12">
|
|
||||||
<datepicker
|
|
||||||
menu-class-name="modalfix"
|
|
||||||
v-model="formData.startDate"
|
|
||||||
:locale="'th'"
|
|
||||||
autoApply
|
|
||||||
borderless
|
|
||||||
:enableTimePicker="false"
|
|
||||||
week-start="0"
|
|
||||||
@update:model-value="updateDate"
|
|
||||||
>
|
|
||||||
<template #year="{ year }">
|
|
||||||
{{ year + 543 }}
|
|
||||||
</template>
|
|
||||||
<template #year-overlay-value="{ value }">
|
|
||||||
{{ parseInt(value + 543) }}
|
|
||||||
</template>
|
|
||||||
<template #trigger>
|
|
||||||
<q-input
|
|
||||||
ref="dateRef"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
hide-bottom-space
|
|
||||||
:model-value="
|
|
||||||
formData.startDate != null
|
|
||||||
? date2Thai(formData.startDate)
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
label="วันที่เริ่มต้น"
|
|
||||||
:rules="[
|
|
||||||
(val:string) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`,
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<template v-slot:prepend>
|
|
||||||
<q-icon
|
|
||||||
name="event"
|
|
||||||
class="cursor-pointer"
|
|
||||||
style="color: var(--q-primary)"
|
|
||||||
>
|
|
||||||
</q-icon>
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
</datepicker>
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
<datepicker
|
|
||||||
menu-class-name="modalfix"
|
|
||||||
v-model="formData.endDate"
|
|
||||||
:locale="'th'"
|
|
||||||
autoApply
|
|
||||||
borderless
|
|
||||||
:enableTimePicker="false"
|
|
||||||
week-start="0"
|
|
||||||
:min-date="formData.startDate"
|
|
||||||
>
|
|
||||||
<template #year="{ year }">
|
|
||||||
{{ year + 543 }}
|
|
||||||
</template>
|
|
||||||
<template #year-overlay-value="{ value }">
|
|
||||||
{{ parseInt(value + 543) }}
|
|
||||||
</template>
|
|
||||||
<template #trigger>
|
|
||||||
<q-input
|
|
||||||
ref="dateRef"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
hide-bottom-space
|
|
||||||
:model-value="
|
|
||||||
formData.endDate != null
|
|
||||||
? date2Thai(formData.endDate)
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
label="วันที่สิ้นสุด"
|
|
||||||
:rules="[
|
|
||||||
(val:string) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`,
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<template v-slot:prepend>
|
|
||||||
<q-icon
|
|
||||||
name="event"
|
|
||||||
class="cursor-pointer"
|
|
||||||
style="color: var(--q-primary)"
|
|
||||||
>
|
|
||||||
</q-icon>
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
</datepicker>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator />
|
|
||||||
<q-card-actions align="right">
|
|
||||||
<q-btn color="secondary" label="บันทึก" type="submit" />
|
|
||||||
</q-card-actions>
|
|
||||||
</q-form>
|
|
||||||
</q-card>
|
|
||||||
</q-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
|
@ -123,7 +123,7 @@ onMounted(() => {
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.name == 'checkInLocation'">
|
<div v-else-if="col.name == 'checkInLocation'">
|
||||||
<q-item style="padding: 0" v-if="props.row.checkInLocation">
|
<q-item style="padding: 0">
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label> {{ props.row.checkInLocation }}</q-item-label>
|
<q-item-label> {{ props.row.checkInLocation }}</q-item-label>
|
||||||
<q-item-label caption lines="2">{{
|
<q-item-label caption lines="2">{{
|
||||||
|
|
@ -131,10 +131,9 @@ onMounted(() => {
|
||||||
}}</q-item-label>
|
}}</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<div v-else>-</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.name == 'checkOutLocation'">
|
<div v-else-if="col.name == 'checkOutLocation'">
|
||||||
<q-item style="padding: 0" v-if="props.row.checkOutLocation">
|
<q-item style="padding: 0">
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label> {{ props.row.checkOutLocation }}</q-item-label>
|
<q-item-label> {{ props.row.checkOutLocation }}</q-item-label>
|
||||||
<q-item-label caption lines="2">{{
|
<q-item-label caption lines="2">{{
|
||||||
|
|
@ -142,7 +141,6 @@ onMounted(() => {
|
||||||
}}</q-item-label>
|
}}</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<div v-else>-</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.name == 'profileType'">
|
<div v-else-if="col.name == 'profileType'">
|
||||||
{{
|
{{
|
||||||
|
|
@ -152,7 +150,7 @@ onMounted(() => {
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
{{ col.value ? col.value : "-" }}
|
{{ col.value }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,7 @@ const {
|
||||||
convertDateToAPI,
|
convertDateToAPI,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
const emit = defineEmits(["update:change-page", "update:selected"]);
|
const emit = defineEmits(["update:change-page"]);
|
||||||
|
|
||||||
const isMultiple = defineModel<boolean>("isMultiple", {
|
|
||||||
default: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**Props */
|
/**Props */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
@ -44,10 +40,6 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
selectedMultiple: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**FormData */
|
/**FormData */
|
||||||
|
|
@ -126,43 +118,18 @@ function onSubmit() {
|
||||||
async function changeRound() {
|
async function changeRound() {
|
||||||
const formattedDateForAPI = await convertDateToAPI(formData.effectiveDate);
|
const formattedDateForAPI = await convertDateToAPI(formData.effectiveDate);
|
||||||
|
|
||||||
const urlAPI =
|
const url =
|
||||||
props.type == "emp" ? config.API.leaveRoundEMP() : config.API.leaveRound();
|
props.type == "emp" ? config.API.leaveRoundEMP() : config.API.leaveRound();
|
||||||
showLoader();
|
showLoader();
|
||||||
|
await http
|
||||||
const urlFull = isMultiple.value ? urlAPI + `/multiple ` : urlAPI;
|
.post(url, {
|
||||||
let payload: any;
|
|
||||||
if (isMultiple.value && props.selectedMultiple.length > 0) {
|
|
||||||
payload = props.selectedMultiple.map((item: any) => ({
|
|
||||||
profileId: item.profileId,
|
|
||||||
roundId: formData.round,
|
|
||||||
effectiveDate: formattedDateForAPI,
|
|
||||||
remark: formData.reson,
|
|
||||||
firstName: item.firstName,
|
|
||||||
lastName: item.lastName,
|
|
||||||
prefix: item.prefix,
|
|
||||||
rootDnaId: item.rootDnaId,
|
|
||||||
child1DnaId: item.child1DnaId,
|
|
||||||
child2DnaId: item.child2DnaId,
|
|
||||||
child3DnaId: item.child3DnaId,
|
|
||||||
child4DnaId: item.child4DnaId,
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
payload = {
|
|
||||||
profileId: props.personId,
|
profileId: props.personId,
|
||||||
roundId: formData.round,
|
roundId: formData.round,
|
||||||
effectiveDate: formattedDateForAPI,
|
effectiveDate: formattedDateForAPI,
|
||||||
remark: formData.reson,
|
remark: formData.reson,
|
||||||
};
|
})
|
||||||
}
|
|
||||||
await http
|
|
||||||
.post(urlFull, payload)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
success($q, "บันทึกข้อมูลเปลี่ยนรอบเวลา");
|
success($q, "บันทึกข้อมูลเปลี่ยนรอบเวลา");
|
||||||
if (isMultiple.value) {
|
|
||||||
emit("update:selected");
|
|
||||||
isMultiple.value = false;
|
|
||||||
}
|
|
||||||
props.closeDialog?.();
|
props.closeDialog?.();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -275,10 +242,10 @@ watch(
|
||||||
? "เปลี่ยนรอบการปฏิบัติงาน"
|
? "เปลี่ยนรอบการปฏิบัติงาน"
|
||||||
: "ประวัติการเปลี่ยนรอบการปฏิบัติงาน"
|
: "ประวัติการเปลี่ยนรอบการปฏิบัติงาน"
|
||||||
}}
|
}}
|
||||||
<span class="text-teal-6" v-if="!isMultiple">
|
<span class="text-teal-6">{{
|
||||||
{{ props.DataRow ? props.DataRow.fullName : "" }}
|
props.DataRow ? props.DataRow.fullName : ""
|
||||||
</span>
|
}}</span></q-toolbar-title
|
||||||
</q-toolbar-title>
|
>
|
||||||
<q-btn
|
<q-btn
|
||||||
icon="close"
|
icon="close"
|
||||||
unelevated
|
unelevated
|
||||||
|
|
@ -292,7 +259,7 @@ watch(
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section style="max-height: 50vh" class="scroll q-pa-none">
|
<q-card-section style="max-height: 50vh" class="scroll q-pa-none">
|
||||||
<div class="q-pa-md">
|
<div class="q-pa-md">
|
||||||
<div class="row" v-if="!isMultiple">
|
<div class="row">
|
||||||
<q-icon
|
<q-icon
|
||||||
name="mdi-label-variant"
|
name="mdi-label-variant"
|
||||||
class="cursor-pointer self-center"
|
class="cursor-pointer self-center"
|
||||||
|
|
@ -300,12 +267,12 @@ watch(
|
||||||
size="md"
|
size="md"
|
||||||
>
|
>
|
||||||
</q-icon>
|
</q-icon>
|
||||||
<span class="self-center text-bold text-blue text-subtitle1">
|
<span class="self-center text-bold text-blue text-subtitle1"
|
||||||
รอบปัจจุบัน
|
>รอบปัจจุบัน</span
|
||||||
</span>
|
>
|
||||||
<span class="self-center text-subtitle1 q-ml-sm">
|
<span class="self-center text-subtitle1 q-ml-sm">{{
|
||||||
{{ props.DataRow ? `${props.DataRow.currentRound} น.` : "" }}
|
props.DataRow ? `${props.DataRow.currentRound} น.` : ""
|
||||||
</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-mt-sm q-col-gutter-sm">
|
<div class="row q-mt-sm q-col-gutter-sm">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|
|
||||||
|
|
@ -228,12 +228,8 @@ onMounted(async () => {
|
||||||
<template>
|
<template>
|
||||||
<div class="q-mt-sm">
|
<div class="q-mt-sm">
|
||||||
<div class="row q-gutter-sm">
|
<div class="row q-gutter-sm">
|
||||||
<div class="col-3 scrollable-list">
|
<div class="col-3">
|
||||||
<q-list
|
<q-list bordered class="rounded-borders">
|
||||||
bordered
|
|
||||||
class="rounded-borders"
|
|
||||||
style="max-height: 80vh; overflow-y: auto"
|
|
||||||
>
|
|
||||||
<q-item
|
<q-item
|
||||||
v-for="(item, i) in filterLists"
|
v-for="(item, i) in filterLists"
|
||||||
:key="i"
|
:key="i"
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,6 @@ const formData = reactive<FormData>({
|
||||||
status: "", //สถานะการของลา
|
status: "", //สถานะการของลา
|
||||||
leaveLimit: 0, //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน
|
leaveLimit: 0, //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน
|
||||||
leaveSummary: 0, //ลาป่วยไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน
|
leaveSummary: 0, //ลาป่วยไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน
|
||||||
leaveWaitingSummary: 0, //ลาอยู่ระหว่างการพิจารณา(แต่ละประเภท)หน่วยเป็นวัน
|
|
||||||
leaveRemain: 0, //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน
|
leaveRemain: 0, //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน
|
||||||
leaveWrote: "", //เขียนที่
|
leaveWrote: "", //เขียนที่
|
||||||
leaveAddress: "", //สถานที่ติดต่อขณะลา
|
leaveAddress: "", //สถานที่ติดต่อขณะลา
|
||||||
|
|
@ -150,41 +149,21 @@ const rows = ref<RowsType>();
|
||||||
// เช็คสิทธิ์การอนุมัติ
|
// เช็คสิทธิ์การอนุมัติ
|
||||||
const idCheck = computed(() => {
|
const idCheck = computed(() => {
|
||||||
if (typeAdd.value == "COMMANDER") {
|
if (typeAdd.value == "COMMANDER") {
|
||||||
return rows.value?.commanders.map((items: SeqTypeRow) => items.keyId);
|
return rows.value?.commanders.map((items: SeqTypeRow) => items.profileId);
|
||||||
} else if (typeAdd.value == "APPROVER") {
|
} else if (typeAdd.value == "APPROVER") {
|
||||||
return rows.value?.approvers.map((items: SeqTypeRow) => items.keyId);
|
return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// เช็คสิทธิ์การเลือกผู้มีอำนาจ
|
// เช็คสิทธิ์การเลือกผู้มีอำนาจ
|
||||||
const commanderList = computed(() => {
|
const commanderList = computed(() => {
|
||||||
if (typeAdd.value === "COMMANDER") {
|
if (typeAdd.value == "COMMANDER") {
|
||||||
return rows.value?.approvers.map((items: SeqTypeRow) => ({
|
return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId);
|
||||||
profileId: items.profileId,
|
} else if (typeAdd.value == "APPROVER") {
|
||||||
isAct: items.isAct,
|
return rows.value?.commanders.map((items: SeqTypeRow) => items.profileId);
|
||||||
}));
|
|
||||||
} else if (typeAdd.value === "APPROVER") {
|
|
||||||
return rows.value?.commanders.map((items: SeqTypeRow) => ({
|
|
||||||
profileId: items.profileId,
|
|
||||||
isAct: items.isAct,
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
return [];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
|
||||||
const isAct = computed(() => {
|
|
||||||
if (typeAdd.value === "COMMANDER") {
|
|
||||||
return rows.value?.commanders && rows.value.commanders.length > 0
|
|
||||||
? rows.value.commanders[0].isAct
|
|
||||||
: false;
|
|
||||||
} else if (typeAdd.value === "APPROVER") {
|
|
||||||
return rows.value?.approvers && rows.value.approvers.length > 0
|
|
||||||
? rows.value.approvers[0].isAct
|
|
||||||
: false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
// เช็คว่าผู้ใช้มีสิทธิ์อนุมัติหรือไม่
|
// เช็คว่าผู้ใช้มีสิทธิ์อนุมัติหรือไม่
|
||||||
const approveCheck = computed(() => {
|
const approveCheck = computed(() => {
|
||||||
const commanders = rows.value?.commanders;
|
const commanders = rows.value?.commanders;
|
||||||
|
|
@ -412,9 +391,6 @@ async function fetchDetailLeave(paramsId: string) {
|
||||||
formData.leaveRange = data.leaveRange;
|
formData.leaveRange = data.leaveRange;
|
||||||
formData.commanderPosition = data.commanderPosition;
|
formData.commanderPosition = data.commanderPosition;
|
||||||
formData.leaveRangeEnd = data.leaveRangeEnd;
|
formData.leaveRangeEnd = data.leaveRangeEnd;
|
||||||
formData.leaveWaitingSummary = data.leaveWaitingSummary
|
|
||||||
? data.leaveWaitingSummary
|
|
||||||
: "0";
|
|
||||||
keycloakUserId.value = data.keycloakUserId;
|
keycloakUserId.value = data.keycloakUserId;
|
||||||
rows.value = {
|
rows.value = {
|
||||||
commanders: data.commanders,
|
commanders: data.commanders,
|
||||||
|
|
@ -692,10 +668,10 @@ onMounted(async () => {
|
||||||
fetchOptionType(),
|
fetchOptionType(),
|
||||||
fetchKeycloakPositionData(),
|
fetchKeycloakPositionData(),
|
||||||
fetchDetailLeave(paramsId),
|
fetchDetailLeave(paramsId),
|
||||||
|
checkOfficer(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await checkLeaveType(formData.leaveTypeId, formData);
|
await checkLeaveType(formData.leaveTypeId, formData);
|
||||||
await checkOfficer();
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|
@ -797,50 +773,40 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-7 row">
|
<div class="col-xs-12 col-sm-7 row">
|
||||||
<div class="row col-12 q-col-gutter-md">
|
<div class="row col-12 q-gutter-md">
|
||||||
<div
|
<div
|
||||||
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
||||||
class="col-md-3 col-xs-6"
|
class="col-3"
|
||||||
>
|
>
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
<q-card bordered class="items-center row col-12 q-pa-md">
|
||||||
<div class="text-h6 text-weight-bold text-blue-10">
|
<div class="text-h6 text-weight-bold text-blue-10">
|
||||||
{{ formData.leaveLimit }}
|
{{ formData.leaveLimit }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||||
<span>ได้รับ</span>
|
<span class="gt-xs">ได้รับ</span>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-xs-6">
|
<div class="col-3">
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
<q-card bordered class="items-center row col-12 q-pa-md">
|
||||||
<div class="text-h6 text-weight-bold text-light-blue-6">
|
<div class="text-h6 text-weight-bold text-light-blue-6">
|
||||||
{{ formData.leaveSummary }}
|
{{ formData.leaveSummary }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||||
<span>ใช้ไป</span>
|
<span class="gt-xs">ใช้ไป</span>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
||||||
class="col-md-3 col-xs-6"
|
class="col-3"
|
||||||
>
|
>
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
<q-card bordered class="items-center row col-12 q-pa-md">
|
||||||
<div class="text-h6 text-weight-bold text-indigo-7">
|
<div class="text-h6 text-weight-bold text-indigo-7">
|
||||||
{{ formData.leaveRemain }}
|
{{ formData.leaveRemain }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||||
<span>คงเหลือ</span>
|
<span class="gt-xs">คงเหลือ</span>
|
||||||
</div>
|
|
||||||
</q-card>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3 col-xs-6">
|
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
|
||||||
<div class="text-h6 text-weight-bold text-light-blue-6">
|
|
||||||
{{ formData.leaveWaitingSummary }}
|
|
||||||
</div>
|
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
|
||||||
<span>อยู่ระหว่างการพิจารณา</span>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1292,6 +1258,5 @@ onMounted(async () => {
|
||||||
:id-check="idCheck"
|
:id-check="idCheck"
|
||||||
:keycloak-user-id="keycloakUserId"
|
:keycloak-user-id="keycloakUserId"
|
||||||
:commanders-list="commanderList"
|
:commanders-list="commanderList"
|
||||||
:commanders-is-act="isAct"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ const formData = reactive<FormData>({
|
||||||
leaveSubTypeName: "",
|
leaveSubTypeName: "",
|
||||||
commanderPosition: "",
|
commanderPosition: "",
|
||||||
leaveRangeEnd: "",
|
leaveRangeEnd: "",
|
||||||
leaveWaitingSummary: 0, //ลาอยู่ระหว่างการพิจารณา(แต่ละประเภท)หน่วยเป็นวัน
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const isLoadData = ref<boolean>(false);
|
const isLoadData = ref<boolean>(false);
|
||||||
|
|
@ -218,9 +217,6 @@ async function fetchDetailLeave(paramsId: string) {
|
||||||
formData.leaveLimit = data.leaveLimit;
|
formData.leaveLimit = data.leaveLimit;
|
||||||
formData.leaveSummary = data.leaveSummary;
|
formData.leaveSummary = data.leaveSummary;
|
||||||
formData.leaveRemain = data.leaveRemain;
|
formData.leaveRemain = data.leaveRemain;
|
||||||
formData.leaveWaitingSummary = data.leaveWaitingSummary
|
|
||||||
? data.leaveWaitingSummary
|
|
||||||
: 0;
|
|
||||||
formData.leaveWrote = data.leaveWrote;
|
formData.leaveWrote = data.leaveWrote;
|
||||||
formData.leaveAddress = data.leaveAddress;
|
formData.leaveAddress = data.leaveAddress;
|
||||||
formData.leaveNumber = data.leaveNumber;
|
formData.leaveNumber = data.leaveNumber;
|
||||||
|
|
@ -630,50 +626,40 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-7 row">
|
<div class="col-xs-12 col-sm-7 row">
|
||||||
<div class="row col-12 q-col-gutter-md">
|
<div class="row col-12 q-gutter-md">
|
||||||
<div
|
<div
|
||||||
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
||||||
class="col-md-3 col-xs-6"
|
class="col-3"
|
||||||
>
|
>
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
<q-card bordered class="items-center row col-12 q-pa-md">
|
||||||
<div class="text-h6 text-weight-bold text-blue-10">
|
<div class="text-h6 text-weight-bold text-blue-10">
|
||||||
{{ formData.leaveLimit }}
|
{{ formData.leaveLimit }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||||
<span>ได้รับ</span>
|
<span class="gt-xs">ได้รับ</span>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-xs-6">
|
<div class="col-3">
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
<q-card bordered class="items-center row col-12 q-pa-md">
|
||||||
<div class="text-h6 text-weight-bold text-light-blue-6">
|
<div class="text-h6 text-weight-bold text-light-blue-6">
|
||||||
{{ formData.leaveSummary }}
|
{{ formData.leaveSummary }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||||
<span>ใช้ไป</span>
|
<span class="gt-xs">ใช้ไป</span>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
v-if="formData.leaveTypeName == 'ลาพักผ่อน'"
|
||||||
class="col-md-3 col-xs-6"
|
class="col-3"
|
||||||
>
|
>
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
<q-card bordered class="items-center row col-12 q-pa-md">
|
||||||
<div class="text-h6 text-weight-bold text-indigo-7">
|
<div class="text-h6 text-weight-bold text-indigo-7">
|
||||||
{{ formData.leaveRemain }}
|
{{ formData.leaveRemain }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||||
<span>คงเหลือ</span>
|
<span class="gt-xs">คงเหลือ</span>
|
||||||
</div>
|
|
||||||
</q-card>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3 col-xs-6">
|
|
||||||
<q-card bordered class="items-center row col-12 q-pa-md">
|
|
||||||
<div class="text-h6 text-weight-bold text-light-blue-6">
|
|
||||||
{{ formData.leaveWaitingSummary }}
|
|
||||||
</div>
|
|
||||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
|
||||||
<span>อยู่ระหว่างการพิจารณา</span>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
import { getColumnLabel } from "@/utils/function";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
@ -29,7 +30,6 @@ const props = defineProps({
|
||||||
fetchDetailLeave: Function,
|
fetchDetailLeave: Function,
|
||||||
idCheck: Array,
|
idCheck: Array,
|
||||||
commandersList: Array,
|
commandersList: Array,
|
||||||
commandersIsAct: Boolean,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const pageId = ref<string>(route.params.id as string);
|
const pageId = ref<string>(route.params.id as string);
|
||||||
|
|
@ -117,7 +117,7 @@ async function getData() {
|
||||||
total.value = data.total;
|
total.value = data.total;
|
||||||
rows.value = data.data;
|
rows.value = data.data;
|
||||||
selected.value = data.data.filter((items: any) => {
|
selected.value = data.data.filter((items: any) => {
|
||||||
return props.idCheck?.some((i: any) => i === items.key);
|
return props.idCheck?.some((i: any) => i === items.id);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -153,14 +153,10 @@ function onSubmit() {
|
||||||
]
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(" "),
|
.join(" "),
|
||||||
isAct: isAct.value,
|
|
||||||
keyId: items.key,
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const hasCommander = selected.value.some((e) =>
|
const hasCommander = selected.value.some((e) =>
|
||||||
props.commandersList?.some(
|
props.commandersList?.some((i: any) => i === e.id)
|
||||||
(i: any) => i.profileId === e.id && i.isAct === isAct.value
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasCommander) {
|
if (hasCommander) {
|
||||||
|
|
@ -209,7 +205,6 @@ watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
() => {
|
() => {
|
||||||
if (modal.value) {
|
if (modal.value) {
|
||||||
isAct.value = props.commandersIsAct ?? false;
|
|
||||||
getSearch();
|
getSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +233,6 @@ watch(
|
||||||
label="ค้นหา"
|
label="ค้นหา"
|
||||||
v-model="keyword"
|
v-model="keyword"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
@keydown.enter.prevent="onSearchData()"
|
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<q-icon name="search"></q-icon>
|
<q-icon name="search"></q-icon>
|
||||||
|
|
@ -318,7 +312,9 @@ watch(
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
>
|
>
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{
|
||||||
|
getColumnLabel(col, isAct)
|
||||||
|
}}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -248,22 +248,6 @@ function updatePagination(newPagination: any) {
|
||||||
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันสำหรับดึงชื่อ CSS Class ตามสถานะ
|
|
||||||
* @param statusText สถานะของรายการ
|
|
||||||
*/
|
|
||||||
function getStatusColor(statusText: string) {
|
|
||||||
const statusMap: Record<string, string> = {
|
|
||||||
APPROVE: "text-green-6",
|
|
||||||
REJECT: "text-red",
|
|
||||||
NEW: "text-blue",
|
|
||||||
PENDING: "text-warning",
|
|
||||||
// DELETE DELETING
|
|
||||||
};
|
|
||||||
|
|
||||||
return statusMap[statusText.toUpperCase()] ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Hook*/
|
/** Hook*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (leaveStore.tabMenu === "1") {
|
if (leaveStore.tabMenu === "1") {
|
||||||
|
|
@ -318,7 +302,18 @@ onMounted(() => {
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
:class="getStatusColor(props.row.statusText)"
|
:class="
|
||||||
|
props.row.statusText == 'REJECT'
|
||||||
|
? 'text-red'
|
||||||
|
: props.row.statusText == 'NEW'
|
||||||
|
? 'text-blue'
|
||||||
|
: props.row.statusText == 'PENDING'
|
||||||
|
? 'text-warning'
|
||||||
|
: props.row.statusText == 'DELETE' ||
|
||||||
|
props.row.statusText == 'DELETING'
|
||||||
|
? 'text-orange'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<div v-if="col.name == 'no'">
|
<div v-if="col.name == 'no'">
|
||||||
{{
|
{{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useLeaveHistoryDataStore } from "@/modules/09_leave/stores/LeaveHistoryStore";
|
import { useLeaveHistoryDataStore } from "@/modules/09_leave/stores/LeaveHistoryStore";
|
||||||
import { calculateFiscalYear } from "@/utils/function";
|
import { calculateFiscalYear } from "@/utils/function";
|
||||||
import { usePagination } from "@/composables/usePagination";
|
import { usePagination } from "@/composables/usePagination";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
|
||||||
|
|
||||||
import type { QTableColumn } from "quasar";
|
import type { QTableColumn } from "quasar";
|
||||||
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
|
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
|
||||||
|
|
@ -105,18 +104,10 @@ async function onSubmit() {
|
||||||
leaveTypeId: formData.leaveTypeId,
|
leaveTypeId: formData.leaveTypeId,
|
||||||
leaveYear: formData.leaveYear,
|
leaveYear: formData.leaveYear,
|
||||||
leaveDays: formData.leaveDays ? Number(formData.leaveDays) : 0,
|
leaveDays: formData.leaveDays ? Number(formData.leaveDays) : 0,
|
||||||
leaveDaysUsed:
|
leaveDaysUsed: formData.leaveDaysUsed
|
||||||
checkPermission(route)?.attrOwnership === "OWNER"
|
? Number(formData.leaveDaysUsed)
|
||||||
? formData.leaveDaysUsed
|
: 0,
|
||||||
? Number(formData.leaveDaysUsed)
|
leaveCount: formData.leaveCount ? Number(formData.leaveCount) : 0,
|
||||||
: 0
|
|
||||||
: undefined,
|
|
||||||
leaveCount:
|
|
||||||
checkPermission(route)?.attrOwnership === "OWNER"
|
|
||||||
? formData.leaveCount
|
|
||||||
? Number(formData.leaveCount)
|
|
||||||
: 0
|
|
||||||
: undefined,
|
|
||||||
beginningLeaveDays: formData.beginningLeaveDays
|
beginningLeaveDays: formData.beginningLeaveDays
|
||||||
? Number(formData.beginningLeaveDays)
|
? Number(formData.beginningLeaveDays)
|
||||||
: 0,
|
: 0,
|
||||||
|
|
@ -274,6 +265,7 @@ watch(modal, async (val) => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
filterLeaveTypeData(),
|
filterLeaveTypeData(),
|
||||||
isStatusEdit.value && defineDataLeaveBeginning(rowData.value),
|
isStatusEdit.value && defineDataLeaveBeginning(rowData.value),
|
||||||
|
console.log(rowData.value),
|
||||||
]);
|
]);
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|
@ -322,7 +314,6 @@ watch(modal, async (val) => {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
dense
|
dense
|
||||||
label="คำค้น"
|
label="คำค้น"
|
||||||
@keydown.enter.prevent="onSearchData(true)"
|
|
||||||
>
|
>
|
||||||
<template v-slot:after>
|
<template v-slot:after>
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
@ -396,7 +387,7 @@ watch(modal, async (val) => {
|
||||||
<q-separator vertical />
|
<q-separator vertical />
|
||||||
|
|
||||||
<!-- input -->
|
<!-- input -->
|
||||||
<div class="col overflow-auto q-pa-md">
|
<div class="col overflow-hidden q-pa-md">
|
||||||
<div class="row q-col-gutter-sm">
|
<div class="row q-col-gutter-sm">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<datepicker
|
<datepicker
|
||||||
|
|
@ -407,7 +398,6 @@ watch(modal, async (val) => {
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
:max-date="`${calculateFiscalYear(new Date())}, 12, 31`"
|
:max-date="`${calculateFiscalYear(new Date())}, 12, 31`"
|
||||||
:class="classInput(true)"
|
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -464,7 +454,7 @@ watch(modal, async (val) => {
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="leaveTypeCode === 'LV-005'" class="col-12">
|
<div class="col-12">
|
||||||
<q-input
|
<q-input
|
||||||
:class="classInput(leaveTypeCode == 'LV-005')"
|
:class="classInput(leaveTypeCode == 'LV-005')"
|
||||||
:readonly="leaveTypeCode !== 'LV-005'"
|
:readonly="leaveTypeCode !== 'LV-005'"
|
||||||
|
|
@ -472,8 +462,31 @@ watch(modal, async (val) => {
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="จำนวนสิทธิ์การลา"
|
label="จำนวนสิทธิ์การลา"
|
||||||
hint="* สำหรับลาพักผ่อนเท่านั้น คือสิทธิ์ลาประจำปี + สิทธิ์สะสม"
|
hide-bottom-space
|
||||||
:rules="[(val: string) => !val || /^\d+(\.\d*)?$/.test(val) || 'กรุณากรอกเฉพาะตัวเลข']"
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<q-input
|
||||||
|
:class="classInput(true)"
|
||||||
|
v-model="formData.leaveDaysUsed"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
label="ที่ใช้ไป (วัน)"
|
||||||
|
hide-bottom-space
|
||||||
|
mask="#"
|
||||||
|
reverse-fill-mask
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<q-input
|
||||||
|
:class="classInput(true)"
|
||||||
|
v-model="formData.leaveCount"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
label="ที่ใช้ไป (ครั้ง)"
|
||||||
|
hide-bottom-space
|
||||||
|
mask="#"
|
||||||
|
reverse-fill-mask
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -483,9 +496,10 @@ watch(modal, async (val) => {
|
||||||
v-model="formData.beginningLeaveDays"
|
v-model="formData.beginningLeaveDays"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="จำนวนวันลาก่อนใช้งานระบบ"
|
label="ยกมา (วัน)"
|
||||||
:rules="[(val: string) => !val || /^\d+(\.\d*)?$/.test(val) || 'กรุณากรอกเฉพาะตัวเลข']"
|
hide-bottom-space
|
||||||
hint="* จำนวนวันรวมการลาในปีงบประมาณนี้ที่เกิดขึ้นก่อนเริ่มใช้ระบบ"
|
mask="#"
|
||||||
|
reverse-fill-mask
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -495,38 +509,10 @@ watch(modal, async (val) => {
|
||||||
v-model="formData.beginningLeaveCount"
|
v-model="formData.beginningLeaveCount"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="จำนวนครั้งที่ลาก่อนใช้งานระบบ"
|
label="ยกมา (ครั้ง)"
|
||||||
:rules="[(val: string) => !val || /^\d+$/.test(val) || 'กรุณากรอกเฉพาะตัวเลขที่เป็นจำนวนเต็ม']"
|
|
||||||
hint="* จำนวนครั้งของการลาในปีงบประมาณนี้ที่เกิดขึ้นก่อนเริ่มใช้ระบบ"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="checkPermission(route)?.attrOwnership === 'OWNER'"
|
|
||||||
class="col-12"
|
|
||||||
>
|
|
||||||
<q-input
|
|
||||||
:class="classInput(true)"
|
|
||||||
v-model="formData.leaveDaysUsed"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
label="ที่ใช้ไปทั้งหมด (วัน)"
|
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:rules="[(val: string) => !val || /^\d+(\.\d*)?$/.test(val) || 'กรุณากรอกเฉพาะตัวเลข']"
|
mask="#"
|
||||||
/>
|
reverse-fill-mask
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="checkPermission(route)?.attrOwnership === 'OWNER'"
|
|
||||||
class="col-12"
|
|
||||||
>
|
|
||||||
<q-input
|
|
||||||
:class="classInput(true)"
|
|
||||||
v-model="formData.leaveCount"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
label="ที่ใช้ไปทั้งหมด (ครั้ง)"
|
|
||||||
hide-bottom-space
|
|
||||||
:rules="[(val: string) => !val || /^\d+$/.test(val) || 'กรุณากรอกเฉพาะตัวเลขที่เป็นจำนวนเต็ม']"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ interface DataPost {
|
||||||
lastName: string;
|
lastName: string;
|
||||||
page: number;
|
page: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
selectedNodeId?: string | null;
|
|
||||||
selectedNode?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataOption {
|
interface DataOption {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ interface FormData {
|
||||||
status: string; //สถานะการของลา
|
status: string; //สถานะการของลา
|
||||||
leaveLimit: number; //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน
|
leaveLimit: number; //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน
|
||||||
leaveSummary: number; //ลาป่วยไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน
|
leaveSummary: number; //ลาป่วยไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน
|
||||||
leaveWaitingSummary: number; //ลาอยู่ระหว่างการพิจารณา(แต่ละประเภท)หน่วยเป็นวัน
|
|
||||||
leaveRemain: number; //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน
|
leaveRemain: number; //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน
|
||||||
// leaveStartDate: Date | null; //*วัน เดือน ปีเริ่มต้นลา
|
// leaveStartDate: Date | null; //*วัน เดือน ปีเริ่มต้นลา
|
||||||
// leaveEndDate: Date | null; //*วัน เดือน ปีสิ้นสุดลา
|
// leaveEndDate: Date | null; //*วัน เดือน ปีสิ้นสุดลา
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
interface FormDataProcess {
|
|
||||||
startDate: Date | null;
|
|
||||||
endDate: Date | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type { FormDataProcess };
|
|
||||||
|
|
@ -50,8 +50,6 @@ interface SeqTypeRow {
|
||||||
keycloakId: string;
|
keycloakId: string;
|
||||||
approveStatus: string;
|
approveStatus: string;
|
||||||
comment: string;
|
comment: string;
|
||||||
keyId?: string;
|
|
||||||
isAct?: boolean;
|
|
||||||
}
|
}
|
||||||
interface DataDateMonthObject {
|
interface DataDateMonthObject {
|
||||||
month: number;
|
month: number;
|
||||||
|
|
|
||||||
|
|
@ -85,24 +85,4 @@ interface FormDetail {
|
||||||
checkInLocationName: string;
|
checkInLocationName: string;
|
||||||
checkOutLocationName: string;
|
checkOutLocationName: string;
|
||||||
}
|
}
|
||||||
|
export type { TableRows, DataResLog, DataResTime, TableRowsTime, FormDetail };
|
||||||
interface DataProcess {
|
|
||||||
id: string;
|
|
||||||
createdFullName: string;
|
|
||||||
createdAt: Date | null;
|
|
||||||
status: string;
|
|
||||||
startDate: Date | null;
|
|
||||||
endDate: Date | null;
|
|
||||||
processingDate: Date | null;
|
|
||||||
completedDate: Date | null;
|
|
||||||
errorMessage: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type {
|
|
||||||
TableRows,
|
|
||||||
DataResLog,
|
|
||||||
DataResTime,
|
|
||||||
TableRowsTime,
|
|
||||||
FormDetail,
|
|
||||||
DataProcess,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ export const useChangeRoundDataStore = defineStore(
|
||||||
|
|
||||||
async function fetchDataForCardId(dataDetail: any, type?: string) {
|
async function fetchDataForCardId(dataDetail: any, type?: string) {
|
||||||
if (dataDetail) {
|
if (dataDetail) {
|
||||||
// showLoader();
|
showLoader();
|
||||||
const url =
|
const url =
|
||||||
type && type == "emp"
|
type && type == "emp"
|
||||||
? config.API.leaveSearchEMP()
|
? config.API.leaveSearchEMP()
|
||||||
|
|
@ -138,8 +138,6 @@ export const useChangeRoundDataStore = defineStore(
|
||||||
page: dataDetail.page, //หน้า
|
page: dataDetail.page, //หน้า
|
||||||
pageSize: dataDetail.pageSize || 10, //จำนวนแถวต่อหน้า
|
pageSize: dataDetail.pageSize || 10, //จำนวนแถวต่อหน้า
|
||||||
keyword: dataDetail.keyword || "", //keyword ค้นหา
|
keyword: dataDetail.keyword || "", //keyword ค้นหา
|
||||||
selectedNodeId: dataDetail.selectedNodeId, //id ต้นไม้ที่เลือก
|
|
||||||
selectedNode: dataDetail.selectedNode, //ระดับต้นไม้ที่เลือก
|
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const apiData = res.data.result.data;
|
const apiData = res.data.result.data;
|
||||||
|
|
@ -150,7 +148,6 @@ export const useChangeRoundDataStore = defineStore(
|
||||||
if (apiData.length > 0) {
|
if (apiData.length > 0) {
|
||||||
checkCilck.value = false;
|
checkCilck.value = false;
|
||||||
rows.value = apiData.map((e: any) => ({
|
rows.value = apiData.map((e: any) => ({
|
||||||
...e,
|
|
||||||
profileId: e.profileId,
|
profileId: e.profileId,
|
||||||
cardId: e.citizenId,
|
cardId: e.citizenId,
|
||||||
fullName: e.fullName,
|
fullName: e.fullName,
|
||||||
|
|
@ -170,7 +167,7 @@ export const useChangeRoundDataStore = defineStore(
|
||||||
console.log(e);
|
console.log(e);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,7 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
|
||||||
{ id: "NOT_COMPLETE", name: "ปฏิบัติงานไม่ครบตามกำหนดเวลา" },
|
{ id: "NOT_COMPLETE", name: "ปฏิบัติงานไม่ครบตามกำหนดเวลา" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const optionStatusMain = ref<DataOption[]>([
|
// convertSatatus
|
||||||
{ id: "ALL", name: "ทั้งหมด" },
|
|
||||||
{ id: "PENDING", name: "รอดำเนินการ" },
|
|
||||||
{ id: "APPROVE", name: "อนุมัติ" },
|
|
||||||
{ id: "REJECT", name: "ไม่อนุมัติ" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// convertStatus
|
|
||||||
function convertStatus(val: string) {
|
function convertStatus(val: string) {
|
||||||
const value = val ? val.toUpperCase() : null;
|
const value = val ? val.toUpperCase() : null;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
|
@ -36,6 +29,5 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
|
||||||
return {
|
return {
|
||||||
optionStatus,
|
optionStatus,
|
||||||
convertStatus,
|
convertStatus,
|
||||||
optionStatusMain,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, toRefs } from "vue";
|
import { ref, toRefs } from "vue";
|
||||||
|
|
||||||
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
|
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
|
|
||||||
/** import Components */
|
/** import Components */
|
||||||
import Tab1 from "@/modules/09_leave/components/02_WorkList/Tab1.vue";
|
import Tab1 from "@/modules/09_leave/components/02_WorkList/Tab1.vue";
|
||||||
import Tab2 from "@/modules/09_leave/components/02_WorkList/Tab2.vue";
|
import Tab2 from "@/modules/09_leave/components/02_WorkList/Tab2.vue";
|
||||||
import Tab3 from "@/modules/09_leave/components/02_WorkList/Tab3_Processed_Late.vue";
|
|
||||||
|
|
||||||
const stores = useWorklistDataStore();
|
const stores = useWorklistDataStore();
|
||||||
const route = useRoute();
|
|
||||||
const { tabs } = toRefs(stores);
|
|
||||||
|
|
||||||
const isPermissionTab3 = computed(() => {
|
const { tabs } = toRefs(stores);
|
||||||
return (
|
|
||||||
checkPermission(route)?.attrOwnership === "OWNER" ||
|
|
||||||
(checkPermission(route)?.attrOwnership === "STAFF" &&
|
|
||||||
checkPermission(route)?.attrIsUpdate)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -41,12 +30,6 @@ const isPermissionTab3 = computed(() => {
|
||||||
>
|
>
|
||||||
<q-tab name="1" label="รายการลงเวลาที่ประมวลผลแล้ว" />
|
<q-tab name="1" label="รายการลงเวลาที่ประมวลผลแล้ว" />
|
||||||
<q-tab name="2" label="รายการลงเวลา" />
|
<q-tab name="2" label="รายการลงเวลา" />
|
||||||
<q-tab
|
|
||||||
v-if="isPermissionTab3"
|
|
||||||
name="3"
|
|
||||||
label="ประมวลผลการขาดราชการ/มาสาย"
|
|
||||||
/>
|
|
||||||
<!-- เพิ่มแท็บใหม่ -->
|
|
||||||
</q-tabs>
|
</q-tabs>
|
||||||
|
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
@ -59,9 +42,6 @@ const isPermissionTab3 = computed(() => {
|
||||||
<q-tab-panel name="2">
|
<q-tab-panel name="2">
|
||||||
<Tab2 />
|
<Tab2 />
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
<q-tab-panel name="3">
|
|
||||||
<Tab3 />
|
|
||||||
</q-tab-panel>
|
|
||||||
</q-tab-panels>
|
</q-tab-panels>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, reactive, onMounted, nextTick } from "vue";
|
import { ref, watch, reactive, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
|
@ -7,20 +7,22 @@ import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundStore";
|
import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundStore";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { useStructureTree } from "@/stores/structureTree";
|
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
|
|
||||||
import type { DataPost } from "@/modules/09_leave/interface/request/changeRound";
|
import type { DataPost } from "@/modules/09_leave/interface/request/changeRound";
|
||||||
|
|
||||||
import Dialogform from "@/modules/09_leave/components/03_ChangeRound/DialogForm.vue";
|
import Dialogform from "@/modules/09_leave/components/03_ChangeRound/DialogForm.vue";
|
||||||
|
|
||||||
/** useStore */
|
/** useStore */
|
||||||
const route = useRoute();
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
const {
|
||||||
const { showLoader, hideLoader, success, messageError, dialogConfirm } = mixin;
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
success,
|
||||||
|
messageError,
|
||||||
|
dialogMessageNotify,
|
||||||
|
dialogConfirm,
|
||||||
|
} = mixin;
|
||||||
const dataStore = useChangeRoundDataStore();
|
const dataStore = useChangeRoundDataStore();
|
||||||
const { fetchStructureTree } = useStructureTree();
|
|
||||||
|
|
||||||
/** use */
|
/** use */
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -35,42 +37,9 @@ const formData = reactive<DataPost>({
|
||||||
firstName: "",
|
firstName: "",
|
||||||
lastName: "",
|
lastName: "",
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 100,
|
pageSize: 10,
|
||||||
selectedNodeId: null,
|
|
||||||
selectedNode: "",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const pagination = ref({
|
|
||||||
page: 1,
|
|
||||||
rowsPerPage: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** โครงสร้างข้อมูลต้นไม้ขององค์กร **/
|
|
||||||
const nodeTree = ref<any[]>([]);
|
|
||||||
const expanded = ref<string[]>([]);
|
|
||||||
const orgTreeId = ref<string | null>(null);
|
|
||||||
const filter = ref<string>("");
|
|
||||||
const selected = ref<any[]>([]);
|
|
||||||
const isMultiple = ref<boolean>(false);
|
|
||||||
|
|
||||||
/** client-side data & batch loading **/
|
|
||||||
const allRows = ref<any[]>([]);
|
|
||||||
const isLoadingAll = ref<boolean>(false);
|
|
||||||
const loadAllProgress = ref<number>(0);
|
|
||||||
const totalToLoad = ref<number | null>(null);
|
|
||||||
const BATCH_SIZE = 250;
|
|
||||||
|
|
||||||
function waitForUi() {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(resolve, 0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** function fetch ข้อมูลของ Tree*/
|
|
||||||
async function fetchDataTree() {
|
|
||||||
nodeTree.value = await fetchStructureTree(route.meta.Key as string, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function openPopup
|
* Function openPopup
|
||||||
* @param check action edit,history
|
* @param check action edit,history
|
||||||
|
|
@ -118,7 +87,6 @@ async function OpenmodalFix(detail: any) {
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
modalFix.value = false;
|
modalFix.value = false;
|
||||||
isMultiple.value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
|
@ -142,416 +110,214 @@ function save() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Function โหลดข้อมูลทั้งหมดแบบ batch แล้วให้ QTable ทำ pagination เอง */
|
/**
|
||||||
async function fetchAllData() {
|
* function updatePagination
|
||||||
isLoadingAll.value = true;
|
* @param newPagination ข้อมูล Pagination ใหม่
|
||||||
allRows.value = [];
|
*/
|
||||||
loadAllProgress.value = 0;
|
function updatePagination(newPagination: any) {
|
||||||
totalToLoad.value = null;
|
formData.pageSize = newPagination.rowsPerPage;
|
||||||
selected.value = [];
|
|
||||||
|
|
||||||
// ให้ UI แสดงสถานะกำลังโหลดทันที ก่อนรอผล API แรก
|
|
||||||
await nextTick();
|
|
||||||
await waitForUi();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await dataStore.fetchDataForCardId({
|
|
||||||
...formData,
|
|
||||||
page: 1,
|
|
||||||
pageSize: BATCH_SIZE,
|
|
||||||
});
|
|
||||||
allRows.value = dataStore.rows.slice();
|
|
||||||
|
|
||||||
const total = dataStore.totalListMain;
|
|
||||||
totalToLoad.value = total;
|
|
||||||
const totalPages = Math.ceil(total / BATCH_SIZE);
|
|
||||||
loadAllProgress.value =
|
|
||||||
totalPages <= 1 ? 100 : Math.round(100 / totalPages);
|
|
||||||
await nextTick();
|
|
||||||
|
|
||||||
for (let page = 2; page <= totalPages; page++) {
|
|
||||||
await dataStore.fetchDataForCardId({
|
|
||||||
...formData,
|
|
||||||
page,
|
|
||||||
pageSize: BATCH_SIZE,
|
|
||||||
});
|
|
||||||
allRows.value.push(...dataStore.rows);
|
|
||||||
loadAllProgress.value = Math.round((page / totalPages) * 100);
|
|
||||||
await nextTick();
|
|
||||||
await waitForUi();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
isLoadingAll.value = false;
|
|
||||||
totalToLoad.value = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Function ค้นหาข้อมูล */
|
/** Function ค้นหาข้อมูล */
|
||||||
async function searchData() {
|
async function searchData() {
|
||||||
await fetchAllData();
|
if (formData.cardId || formData.firstName || formData.lastName) {
|
||||||
}
|
await dataStore.fetchDataForCardId(formData);
|
||||||
|
} else {
|
||||||
function submitSearchByEnter() {
|
dialogMessageNotify($q, "กรุณากรอกข้อมูลอย่างน้อย 1 ช่อง");
|
||||||
if (isLoadingAll.value) return;
|
}
|
||||||
if (!checkPermission(route)?.attrIsGet) return;
|
|
||||||
formData.page = 1;
|
|
||||||
searchData();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Function เลือกทั้งหมด */
|
|
||||||
function selectAllRows() {
|
|
||||||
selected.value = [...allRows.value];
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSelectedOrgTree(data: any) {
|
|
||||||
if (isLoadingAll.value) return;
|
|
||||||
selected.value = [];
|
|
||||||
allRows.value = [];
|
|
||||||
orgTreeId.value = data.orgTreeId;
|
|
||||||
formData.selectedNodeId = data.orgTreeDnaId;
|
|
||||||
formData.selectedNode = data.orgLevel;
|
|
||||||
formData.page = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSelectMultiple() {
|
|
||||||
modal.value = true;
|
|
||||||
isMultiple.value = true;
|
|
||||||
editCheck.value = "edit";
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetSelected() {
|
|
||||||
selected.value = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => formData.pageSize,
|
() => formData.pageSize,
|
||||||
() => {
|
() => {
|
||||||
// pageSize ถูกควบคุมโดย QTable (client-side) ไม่ต้อง fetch API ใหม่
|
formData.page = 1;
|
||||||
|
searchData();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchDataTree();
|
|
||||||
dataStore.rows = [];
|
dataStore.rows = [];
|
||||||
allRows.value = [];
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="toptitle text-dark col-12 row items-center">
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
เปลี่ยนแปลงรอบการปฏิบัติงานของข้าราชการ
|
เปลี่ยนแปลงรอบการปฏิบัติงานของข้าราชการ
|
||||||
</div>
|
</div>
|
||||||
|
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||||
<q-card>
|
<div class="row col-12 q-mb-sm">
|
||||||
<q-card-section :horizontal="$q.screen.gt.xs">
|
<q-card flat bordered class="bg-grey-2 col-12 bg-white q-pa-lg">
|
||||||
<q-card-section class="col-lg-3 col-md-4 col-xs-12 q-gutter-sm">
|
<div class="text-dark col-12 text-weight-bold text-subtitle1">
|
||||||
<div>
|
ค้นหารายชื่อ
|
||||||
<q-input dense outlined v-model="filter" label="ค้นหา">
|
|
||||||
<template v-slot:append>
|
|
||||||
<q-icon name="search" />
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white tree-container q-pa-xs">
|
<div class="row justify-between q-gutter-y-sm">
|
||||||
<q-tree
|
<q-input
|
||||||
class="q-pa-sm q-gutter-sm"
|
:readonly="!checkPermission($route)?.attrIsGet"
|
||||||
|
v-model="formData.cardId"
|
||||||
|
outlined
|
||||||
|
label="เลขประจำตัวประชาชน"
|
||||||
|
class="col-6 col-md-4 bg-white inputgreen"
|
||||||
dense
|
dense
|
||||||
:nodes="nodeTree"
|
hide-bottom-space
|
||||||
node-key="orgTreeId"
|
maxlength="13"
|
||||||
label-key="labelName"
|
/>
|
||||||
:filter="filter.trim()"
|
<q-input
|
||||||
no-results-label="ไม่พบข้อมูลที่ค้นหา"
|
:readonly="!checkPermission($route)?.attrIsGet"
|
||||||
no-nodes-label="ไม่มีข้อมูล"
|
v-model="formData.firstName"
|
||||||
v-model:expanded="expanded"
|
outlined
|
||||||
|
label="ชื่อ"
|
||||||
|
class="col-5 col-md-3 bg-white inputgreen"
|
||||||
|
dense
|
||||||
|
hide-bottom-space
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
:readonly="!checkPermission($route)?.attrIsGet"
|
||||||
|
v-model="formData.lastName"
|
||||||
|
outlined
|
||||||
|
label="นามสกุล"
|
||||||
|
class="col-6 col-md-3 bg-white inputgreen"
|
||||||
|
dense
|
||||||
|
hide-bottom-space
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
v-if="checkPermission($route)?.attrIsGet"
|
||||||
|
@click="(formData.page = 1), searchData()"
|
||||||
|
for="#search"
|
||||||
|
dense
|
||||||
|
unelevated
|
||||||
|
color="primary"
|
||||||
|
class="q-px-sm col-5 col-md-1"
|
||||||
|
style="max-height: 40px"
|
||||||
|
>ค้นหา</q-btn
|
||||||
>
|
>
|
||||||
<template v-slot:default-header="prop">
|
|
||||||
<q-item
|
|
||||||
clickable
|
|
||||||
:active="orgTreeId == prop.node.orgTreeId"
|
|
||||||
@click.stop="onSelectedOrgTree(prop.node)"
|
|
||||||
active-class="my-list-link text-primary text-weight-medium"
|
|
||||||
class="row col-12 text-dark items-center q-py-xs q-pl-sm rounded-borders my-list"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<div class="text-weight-medium">
|
|
||||||
{{ prop.node.orgTreeName }}
|
|
||||||
</div>
|
|
||||||
<div class="text-weight-light text-grey-8">
|
|
||||||
{{ prop.node.orgCode == null ? null : prop.node.orgCode }}
|
|
||||||
{{
|
|
||||||
prop.node.orgTreeShortName == null
|
|
||||||
? null
|
|
||||||
: prop.node.orgTreeShortName
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-item>
|
|
||||||
</template>
|
|
||||||
</q-tree>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card>
|
||||||
<q-separator :vertical="$q.screen.gt.xs" />
|
</div>
|
||||||
<q-card-section
|
<div v-if="dataStore.rows.length === 0 && dataStore.checkCilck === true">
|
||||||
class="col-lg-9 col-md-8 col-xs-12 q-gutter-sm scroll"
|
<q-card
|
||||||
style="height: 80vh"
|
flat
|
||||||
|
bordered
|
||||||
|
class="bg-grey-2 col-12 q-pa-lg text-center text-subtitle1 text-bold"
|
||||||
|
>ไม่พบข้อมูล</q-card
|
||||||
>
|
>
|
||||||
<div class="row col-xs-12 col-sm-9">
|
</div>
|
||||||
<q-card flat bordered class="bg-grey-2 col-12 bg-white q-pa-lg">
|
<div v-if="dataStore.rows.length !== 0" class="col-12 q-mt-xl">
|
||||||
<div class="text-dark col-12 text-weight-bold text-subtitle1">
|
<d-table
|
||||||
ค้นหารายชื่อ
|
ref="table"
|
||||||
</div>
|
:columns="dataStore.columns"
|
||||||
<div class="row justify-between q-gutter-y-sm">
|
:rows="dataStore.rows"
|
||||||
<q-input
|
row-key="interrogated"
|
||||||
:readonly="!checkPermission($route)?.attrIsGet || isLoadingAll"
|
flat
|
||||||
v-model="formData.cardId"
|
bordered
|
||||||
outlined
|
dense
|
||||||
label="เลขประจำตัวประชาชน"
|
class="custom-header-table"
|
||||||
class="col-6 col-md-4 bg-white inputgreen"
|
:visible-columns="dataStore.visibleColumns"
|
||||||
dense
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
hide-bottom-space
|
@update:pagination="updatePagination"
|
||||||
maxlength="13"
|
>
|
||||||
@keyup.enter="submitSearchByEnter"
|
<!-- :paging="true" -->
|
||||||
/>
|
<template v-slot:header="props">
|
||||||
<q-input
|
<q-tr :props="props">
|
||||||
:readonly="!checkPermission($route)?.attrIsGet || isLoadingAll"
|
<q-th auto-width />
|
||||||
v-model="formData.firstName"
|
<q-th
|
||||||
outlined
|
v-for="col in props.cols"
|
||||||
label="ชื่อ"
|
:key="col.name"
|
||||||
class="col-5 col-md-3 bg-white inputgreen"
|
:props="props"
|
||||||
dense
|
style="color: #000000; font-weight: 500"
|
||||||
hide-bottom-space
|
>
|
||||||
@keyup.enter="submitSearchByEnter"
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
/>
|
</q-th>
|
||||||
<q-input
|
</q-tr>
|
||||||
:readonly="!checkPermission($route)?.attrIsGet || isLoadingAll"
|
</template>
|
||||||
v-model="formData.lastName"
|
<template v-slot:body="props">
|
||||||
outlined
|
<q-tr :props="props">
|
||||||
label="นามสกุล"
|
<q-td>
|
||||||
class="col-6 col-md-3 bg-white inputgreen"
|
<div>
|
||||||
dense
|
<q-btn
|
||||||
hide-bottom-space
|
flat
|
||||||
@keyup.enter="submitSearchByEnter"
|
icon="mdi-dots-horizontal-circle-outline"
|
||||||
/>
|
color="secondary"
|
||||||
<q-btn
|
for="#cancel"
|
||||||
v-if="checkPermission($route)?.attrIsGet"
|
dense
|
||||||
@click="(formData.page = 1), searchData()"
|
round
|
||||||
:disable="isLoadingAll"
|
|
||||||
for="#search"
|
|
||||||
dense
|
|
||||||
unelevated
|
|
||||||
color="primary"
|
|
||||||
class="q-px-sm col-5 col-md-1"
|
|
||||||
style="max-height: 40px"
|
|
||||||
>ค้นหา</q-btn
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</q-card>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="
|
|
||||||
allRows.length === 0 &&
|
|
||||||
dataStore.checkCilck === true &&
|
|
||||||
!isLoadingAll
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<q-card
|
|
||||||
flat
|
|
||||||
bordered
|
|
||||||
class="bg-grey-2 col-12 q-pa-lg text-center text-subtitle1 text-bold"
|
|
||||||
>ไม่พบข้อมูล</q-card
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div v-if="allRows.length !== 0 || isLoadingAll" class="col-12">
|
|
||||||
<q-banner
|
|
||||||
v-if="isLoadingAll"
|
|
||||||
rounded
|
|
||||||
class="bg-blue-1 text-primary q-mb-sm"
|
|
||||||
>
|
|
||||||
<div class="row items-center q-gutter-sm">
|
|
||||||
<q-spinner color="primary" size="22px" />
|
|
||||||
<div v-if="totalToLoad === null || totalToLoad <= 500">
|
|
||||||
กำลังค้นหาข้อมูล กรุณารอสักครู่
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
กำลังโหลดข้อมูลจำนวนมาก กรุณารอสักครู่
|
|
||||||
<div class="text-caption text-grey-7">
|
|
||||||
ระบบกำลังดึงข้อมูลทั้งหมด
|
|
||||||
{{ totalToLoad.toLocaleString() }} รายการ
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-banner>
|
|
||||||
<q-linear-progress
|
|
||||||
v-if="isLoadingAll && totalToLoad === null"
|
|
||||||
indeterminate
|
|
||||||
color="primary"
|
|
||||||
class="q-mb-xs"
|
|
||||||
/>
|
|
||||||
<q-linear-progress
|
|
||||||
v-if="isLoadingAll && totalToLoad !== null"
|
|
||||||
:value="loadAllProgress / 100"
|
|
||||||
color="primary"
|
|
||||||
class="q-mb-xs"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
v-if="isLoadingAll && totalToLoad !== null"
|
|
||||||
class="text-caption text-grey-6 q-mb-xs"
|
|
||||||
>
|
|
||||||
กำลังโหลด... {{ allRows.length.toLocaleString() }} /
|
|
||||||
{{ totalToLoad.toLocaleString() }} รายการ
|
|
||||||
</div>
|
|
||||||
<div class="row justify-between items-center q-mb-sm">
|
|
||||||
<div class="row q-gutter-sm">
|
|
||||||
<!-- <q-btn
|
|
||||||
color="secondary"
|
|
||||||
dense
|
|
||||||
icon="mdi-checkbox-multiple-marked-outline"
|
|
||||||
label="เลือกทั้งหมด"
|
|
||||||
:disable="isLoadingAll || allRows.length === 0"
|
|
||||||
@click="selectAllRows()"
|
|
||||||
/> -->
|
|
||||||
<q-btn
|
|
||||||
v-if="checkPermission($route)?.attrIsUpdate"
|
|
||||||
:disable="selected.length === 0 || isLoadingAll"
|
|
||||||
:color="selected.length === 0 ? 'grey' : 'info'"
|
|
||||||
dense
|
|
||||||
icon="mdi-shuffle-variant"
|
|
||||||
:label="`เปลี่ยนรอบการลงเวลา${
|
|
||||||
selected.length > 0 ? ` (${selected.length})` : ''
|
|
||||||
}`"
|
|
||||||
@click="handleSelectMultiple()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<d-table
|
|
||||||
ref="table"
|
|
||||||
:columns="dataStore.columns"
|
|
||||||
:rows="allRows"
|
|
||||||
row-key="profileId"
|
|
||||||
flat
|
|
||||||
bordered
|
|
||||||
dense
|
|
||||||
virtual-scroll
|
|
||||||
table-style="max-height: 58vh"
|
|
||||||
class="custom-header-table"
|
|
||||||
:visible-columns="dataStore.visibleColumns"
|
|
||||||
hide-pagination
|
|
||||||
v-model:pagination="pagination"
|
|
||||||
selection="multiple"
|
|
||||||
v-model:selected="selected"
|
|
||||||
>
|
|
||||||
<template v-slot:header="props">
|
|
||||||
<q-tr :props="props">
|
|
||||||
<q-th auto-width>
|
|
||||||
<q-checkbox
|
|
||||||
keep-color
|
|
||||||
color="primary"
|
|
||||||
dense
|
|
||||||
:disable="isLoadingAll"
|
|
||||||
v-model="props.selected"
|
|
||||||
/>
|
|
||||||
</q-th>
|
|
||||||
<q-th auto-width />
|
|
||||||
<q-th
|
|
||||||
v-for="col in props.cols"
|
|
||||||
:key="col.name"
|
|
||||||
:props="props"
|
|
||||||
style="color: #000000; font-weight: 500"
|
|
||||||
>
|
>
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<q-menu>
|
||||||
</q-th>
|
<q-list>
|
||||||
</q-tr>
|
<q-item
|
||||||
</template>
|
v-if="checkPermission($route)?.attrIsUpdate"
|
||||||
<template v-slot:body="props">
|
clickable
|
||||||
<q-tr :props="props">
|
v-close-popup
|
||||||
<q-td class="text-center">
|
@click="Openmodal('edit', props.row)"
|
||||||
<q-checkbox
|
>
|
||||||
keep-color
|
<q-item-section style="min-width: 0px" avatar>
|
||||||
color="primary"
|
<q-icon
|
||||||
dense
|
color="primary"
|
||||||
:disable="isLoadingAll"
|
name="mdi-shuffle-variant"
|
||||||
v-model="props.selected"
|
size="xs"
|
||||||
/>
|
/>
|
||||||
</q-td>
|
</q-item-section>
|
||||||
<q-td>
|
|
||||||
<div>
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
icon="mdi-dots-horizontal-circle-outline"
|
|
||||||
color="secondary"
|
|
||||||
for="#cancel"
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
>
|
|
||||||
<q-menu>
|
|
||||||
<q-list>
|
|
||||||
<q-item
|
|
||||||
v-if="checkPermission($route)?.attrIsUpdate"
|
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="Openmodal('edit', props.row)"
|
|
||||||
>
|
|
||||||
<q-item-section style="min-width: 0px" avatar>
|
|
||||||
<q-icon
|
|
||||||
color="primary"
|
|
||||||
name="mdi-shuffle-variant"
|
|
||||||
size="xs"
|
|
||||||
/>
|
|
||||||
</q-item-section>
|
|
||||||
|
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>เปลี่ยนรอบการลงเวลา</q-item-label>
|
<q-item-label>เปลี่ยนรอบการลงเวลา</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
v-if="checkPermission($route)?.attrIsUpdate"
|
v-if="checkPermission($route)?.attrIsUpdate"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="OpenmodalFix(props.row)"
|
@click="OpenmodalFix(props.row)"
|
||||||
>
|
>
|
||||||
<q-item-section style="min-width: 0px" avatar>
|
<q-item-section style="min-width: 0px" avatar>
|
||||||
<q-icon color="edit" name="edit" size="xs" />
|
<q-icon color="edit" name="edit" size="xs" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>แก้ไขปฏิทินวันทำงาน</q-item-label>
|
<q-item-label>แก้ไขปฏิทินวันทำงาน</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="Openmodal('history', props.row)"
|
@click="Openmodal('history', props.row)"
|
||||||
>
|
>
|
||||||
<q-item-section style="min-width: 0px" avatar>
|
<q-item-section style="min-width: 0px" avatar>
|
||||||
<q-icon
|
<q-icon
|
||||||
color="deep-purple"
|
color="deep-purple"
|
||||||
name="mdi-history"
|
name="mdi-history"
|
||||||
size="xs"
|
size="xs"
|
||||||
/>
|
/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>ประวัติการเปลี่ยนรอบ</q-item-label>
|
<q-item-label>ประวัติการเปลี่ยนรอบ</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<div>
|
<div>
|
||||||
{{ col.value ?? "-" }}
|
{{ col.value ?? "-" }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
</d-table>
|
<template v-slot:pagination="scope">
|
||||||
<div class="text-caption text-grey-7 q-mt-sm">
|
ทั้งหมด {{ dataStore.totalListMain }} รายการ
|
||||||
ทั้งหมด {{ allRows.length }} รายการ
|
<q-pagination
|
||||||
</div>
|
v-model="formData.page"
|
||||||
</div>
|
active-color="primary"
|
||||||
</q-card-section>
|
color="dark"
|
||||||
</q-card-section>
|
:max="Number(dataStore.maxPageMain)"
|
||||||
|
size="sm"
|
||||||
|
boundary-links
|
||||||
|
direction-links
|
||||||
|
:max-pages="5"
|
||||||
|
@update:model-value="dataStore.fetchDataForCardId(formData)"
|
||||||
|
></q-pagination>
|
||||||
|
</template>
|
||||||
|
</d-table>
|
||||||
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
<!-- popup เปลี่ยนรอบการปฏิบัติงาน ,ประวัติการเปลี่ยนรอบการปฏิบัติงาน -->
|
<!-- popup เปลี่ยนรอบการปฏิบัติงาน ,ประวัติการเปลี่ยนรอบการปฏิบัติงาน -->
|
||||||
|
|
@ -562,9 +328,6 @@ onMounted(() => {
|
||||||
:DataRow="DataRow"
|
:DataRow="DataRow"
|
||||||
:personId="DataRow == null ? '' : DataRow.profileId"
|
:personId="DataRow == null ? '' : DataRow.profileId"
|
||||||
@update:change-page="dataStore.changePage"
|
@update:change-page="dataStore.changePage"
|
||||||
v-model:isMultiple="isMultiple"
|
|
||||||
:selectedMultiple="selected"
|
|
||||||
@update:selected="resetSelected"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- แก้ไขปฏิทินวันทำงาน -->
|
<!-- แก้ไขปฏิทินวันทำงาน -->
|
||||||
|
|
@ -621,19 +384,4 @@ onMounted(() => {
|
||||||
.q-table tbody td:before.no-background {
|
.q-table tbody td:before.no-background {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tree-container {
|
|
||||||
overflow: auto;
|
|
||||||
height: 75vh;
|
|
||||||
border: 1px solid #e6e6e7;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-list-link {
|
|
||||||
color: rgb(118, 168, 222);
|
|
||||||
border-radius: 5px;
|
|
||||||
background: #a3d3fb48 !important;
|
|
||||||
font-weight: 600;
|
|
||||||
border: 1px solid rgba(175, 185, 196, 0.217);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,8 @@ import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore"
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { usePagination } from "@/composables/usePagination";
|
import { usePagination } from "@/composables/usePagination";
|
||||||
|
|
||||||
import type {
|
import type { DataDateMonthObject } from "@/modules/09_leave/interface/request/specialTime";
|
||||||
DataSpecialTime,
|
import type { DataSpecialTime } from "@/modules/09_leave/interface/index/Main";
|
||||||
DataOption,
|
|
||||||
} from "@/modules/09_leave/interface/index/Main";
|
|
||||||
|
|
||||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||||
import DialogApprove from "@/modules/09_leave/components/04_SpecialTime/DialogApprove.vue";
|
import DialogApprove from "@/modules/09_leave/components/04_SpecialTime/DialogApprove.vue";
|
||||||
|
|
@ -23,17 +21,23 @@ const mixin = useCounterMixin();
|
||||||
const store = useSpecialTimeStore();
|
const store = useSpecialTimeStore();
|
||||||
const {
|
const {
|
||||||
hideLoader,
|
hideLoader,
|
||||||
|
monthYear2Thai,
|
||||||
messageError,
|
messageError,
|
||||||
showLoader,
|
showLoader,
|
||||||
success,
|
success,
|
||||||
date2Thai,
|
date2Thai,
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
dateToISO,
|
|
||||||
} = mixin;
|
} = mixin;
|
||||||
const { pagination, params, onRequest } = usePagination("", fetchData);
|
const { pagination, params, onRequest } = usePagination("", fetchData);
|
||||||
|
|
||||||
const emit = defineEmits(["update:change-page"]);
|
const emit = defineEmits(["update:change-page"]);
|
||||||
|
|
||||||
|
const toDay = ref<Date>(new Date());
|
||||||
|
const monthToday = toDay.value.getMonth();
|
||||||
|
const yearToday = toDay.value.getFullYear();
|
||||||
|
|
||||||
|
const month = ref<number>(monthToday + 1);
|
||||||
|
const year = ref<number>(yearToday);
|
||||||
const description = ref<string>("");
|
const description = ref<string>("");
|
||||||
|
|
||||||
/**ตัวแปรที่ใช้ */
|
/**ตัวแปรที่ใช้ */
|
||||||
|
|
@ -47,12 +51,16 @@ const name = ref<string>("");
|
||||||
const id = ref<string>("");
|
const id = ref<string>("");
|
||||||
const dateDialog = ref<string>("");
|
const dateDialog = ref<string>("");
|
||||||
const dateFixDialog = ref<string>("");
|
const dateFixDialog = ref<string>("");
|
||||||
|
const dateYear = ref<number>(new Date().getFullYear());
|
||||||
|
|
||||||
|
/** Function Date */
|
||||||
|
const dateMonth = ref<DataDateMonthObject>({
|
||||||
|
month: new Date().getMonth(),
|
||||||
|
year: new Date().getFullYear(),
|
||||||
|
});
|
||||||
|
|
||||||
// ค้นหาในตาราง
|
// ค้นหาในตาราง
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const filterStatus = ref<string>("PENDING");
|
|
||||||
const filterDate = ref<[Date, Date] | null>([new Date(), new Date()]); //วันที่ประกาศ
|
|
||||||
const optionStatus = ref<DataOption[]>(store.optionStatusMain);
|
|
||||||
const rows = ref<DataSpecialTime[]>([]);
|
const rows = ref<DataSpecialTime[]>([]);
|
||||||
const visibleColumns = ref<String[]>([
|
const visibleColumns = ref<String[]>([
|
||||||
"no",
|
"no",
|
||||||
|
|
@ -136,10 +144,9 @@ async function fetchData() {
|
||||||
.get(config.API.specialTime(), {
|
.get(config.API.specialTime(), {
|
||||||
params: {
|
params: {
|
||||||
...params.value,
|
...params.value,
|
||||||
|
year: year.value,
|
||||||
|
month: month.value,
|
||||||
keyword: filterKeyword.value.trim(),
|
keyword: filterKeyword.value.trim(),
|
||||||
status: filterStatus.value != "ALL" ? filterStatus.value : null,
|
|
||||||
startDate: filterDate.value ? dateToISO(filterDate.value[0]) : null,
|
|
||||||
endDate: filterDate.value ? dateToISO(filterDate.value[1]) : null,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
|
@ -239,43 +246,40 @@ async function clickSave(reason: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ดึงข้อมูลตามปี
|
||||||
|
* @param e ปี
|
||||||
|
*/
|
||||||
|
async function updateMonth(e: DataDateMonthObject) {
|
||||||
|
if (e != null) {
|
||||||
|
dateYear.value = e.year;
|
||||||
|
dateYear.value = year.value;
|
||||||
|
month.value = dateMonth.value.month + 1;
|
||||||
|
year.value = dateMonth.value.year;
|
||||||
|
onSearchData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//แปลงเดือนเป็นไทย
|
||||||
|
function monthYearThai(val: DataDateMonthObject) {
|
||||||
|
if (val == null) return "";
|
||||||
|
else return monthYear2Thai(val.month, val.year);
|
||||||
|
}
|
||||||
|
|
||||||
/** ฟังก์ชั่นค้นหาข้อมูล */
|
/** ฟังก์ชั่นค้นหาข้อมูล */
|
||||||
function onSearchData() {
|
function onSearchData() {
|
||||||
pagination.value.page = 1;
|
pagination.value.page = 1;
|
||||||
fetchData();
|
fetchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชั่นค้นหาข้อมูลของ Option Filter
|
|
||||||
* @param val คำที่ค้นหา
|
|
||||||
* @param update Function
|
|
||||||
* @param typeOp ประเภทของ Select
|
|
||||||
*/
|
|
||||||
function filterOption(val: string, update: Function) {
|
|
||||||
update(() => {
|
|
||||||
const needle = val.toLowerCase();
|
|
||||||
optionStatus.value = store.optionStatusMain.filter(
|
|
||||||
(v: DataOption) => v.name.toLowerCase().indexOf(needle) > -1
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* แปลงช่วงวันที่ถ้า2ค่าเป็นวันเดียวกันจะโชววันเดียวแต่ถ้าไม่เท่ากันจะแสดงเป็นช่วง
|
|
||||||
* @param val ช่วงวันที่
|
|
||||||
*/
|
|
||||||
function dateThaiRange(val: [Date, Date]) {
|
|
||||||
if (val === null) {
|
|
||||||
return "";
|
|
||||||
} else if (date2Thai(val[0], true) === date2Thai(val[1], true)) {
|
|
||||||
return `${date2Thai(val[0], true)}`;
|
|
||||||
} else {
|
|
||||||
return `${date2Thai(val[0], true)} - ${date2Thai(val[1], true)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**Hook */
|
/**Hook */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
//อัพเดทเป็นวันปัจจุบันเมื่อเข้าหน้านี้
|
||||||
|
const toDay = ref<Date>(new Date());
|
||||||
|
const monthToday = toDay.value.getMonth();
|
||||||
|
const yearToday = toDay.value.getFullYear();
|
||||||
|
month.value = monthToday + 1;
|
||||||
|
year.value = yearToday;
|
||||||
await fetchData();
|
await fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -287,31 +291,25 @@ onMounted(async () => {
|
||||||
|
|
||||||
<q-card flat bordered class="col-12 q-pa-md">
|
<q-card flat bordered class="col-12 q-pa-md">
|
||||||
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
||||||
<div class="col-xs-12 col-sm-6 col-md-3">
|
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||||
<datepicker
|
<datepicker
|
||||||
v-model="filterDate"
|
v-model="dateMonth"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
borderless
|
month-picker
|
||||||
range
|
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
week-start="0"
|
@update:modelValue="updateMonth"
|
||||||
@update:modelValue="onSearchData()"
|
|
||||||
>
|
>
|
||||||
<template #year="{ year }">
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
{{ year + 543 }}
|
<template #year-overlay-value="{ value }">{{
|
||||||
</template>
|
parseInt(value + 543)
|
||||||
<template #year-overlay-value="{ value }">
|
}}</template>
|
||||||
{{ parseInt(value + 543) }}
|
|
||||||
</template>
|
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
:model-value="monthYearThai(dateMonth)"
|
||||||
dense
|
dense
|
||||||
class="full-width datepicker"
|
outlined
|
||||||
:model-value="
|
hide-bottom-space
|
||||||
filterDate != null ? dateThaiRange(filterDate) : null
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -325,37 +323,9 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6 col-md-2">
|
|
||||||
<q-select
|
|
||||||
hide-bottom-space
|
|
||||||
dense
|
|
||||||
lazy-rules
|
|
||||||
outlined
|
|
||||||
onlind
|
|
||||||
hide-selected
|
|
||||||
v-model="filterStatus"
|
|
||||||
label="สถานะ"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
:options="optionStatus"
|
|
||||||
option-value="id"
|
|
||||||
use-input
|
|
||||||
fill-input
|
|
||||||
option-label="name"
|
|
||||||
@update:modelValue="onSearchData()"
|
|
||||||
@filter="(inputValue:string, doneFn:Function) =>
|
|
||||||
filterOption(inputValue, doneFn,)"
|
|
||||||
>
|
|
||||||
<template v-slot:no-option>
|
|
||||||
<q-item>
|
|
||||||
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</template>
|
|
||||||
</q-select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<q-space v-if="!$q.screen.xs && !$q.screen.sm" />
|
<q-space />
|
||||||
<div class="col-xs-12 col-sm-6 col-md-2">
|
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||||
<q-input
|
<q-input
|
||||||
standout
|
standout
|
||||||
dense
|
dense
|
||||||
|
|
@ -370,7 +340,7 @@ onMounted(async () => {
|
||||||
</q-input>
|
</q-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-12 col-sm-6 col-md-2">
|
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||||
<q-select
|
<q-select
|
||||||
v-model="visibleColumns"
|
v-model="visibleColumns"
|
||||||
multiple
|
multiple
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,6 @@ async function fetchLeaveday(
|
||||||
* @param data ข้อมูลบัญชีวันลา
|
* @param data ข้อมูลบัญชีวันลา
|
||||||
*/
|
*/
|
||||||
async function fetchDocumentTemplate(data: any) {
|
async function fetchDocumentTemplate(data: any) {
|
||||||
if (typeReport.value === 4) return;
|
|
||||||
await axios
|
await axios
|
||||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -353,7 +352,7 @@ function clearData() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onSearch() {
|
function onSearch() {
|
||||||
isReport.value = false;
|
isReport.value = false;
|
||||||
isLoadPDF.value = true;
|
isLoadPDF.value = true;
|
||||||
pdfSrc.value = undefined;
|
pdfSrc.value = undefined;
|
||||||
|
|
@ -468,19 +467,6 @@ const reportName = () => {
|
||||||
return reportNameVal + employeeClassName;
|
return reportNameVal + employeeClassName;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function handleDownload() {
|
|
||||||
updateLeaveday();
|
|
||||||
await fetchLeaveday(
|
|
||||||
employeeClass.value,
|
|
||||||
typeReport.value == 3 || typeReport.value == 4
|
|
||||||
? leaveType.value
|
|
||||||
: yearType.value,
|
|
||||||
dateStart.value,
|
|
||||||
dateEnd.value
|
|
||||||
);
|
|
||||||
await genReportXLSX(detailReport.value, `${reportName()}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchDataTree();
|
fetchDataTree();
|
||||||
});
|
});
|
||||||
|
|
@ -526,11 +512,7 @@ onMounted(() => {
|
||||||
round
|
round
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="download"
|
icon="download"
|
||||||
v-if="
|
v-if="checkPermission($route)?.attrIsGet && typeReport !== 3"
|
||||||
checkPermission($route)?.attrIsGet &&
|
|
||||||
typeReport !== 3 &&
|
|
||||||
typeReport !== 4
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<q-menu>
|
<q-menu>
|
||||||
<q-list style="min-width: 150px">
|
<q-list style="min-width: 150px">
|
||||||
|
|
@ -565,11 +547,8 @@ onMounted(() => {
|
||||||
round
|
round
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="download"
|
icon="download"
|
||||||
v-if="
|
v-if="checkPermission($route)?.attrIsGet && typeReport == 3"
|
||||||
checkPermission($route)?.attrIsGet &&
|
@click="getReport()"
|
||||||
(typeReport == 3 || typeReport == 4)
|
|
||||||
"
|
|
||||||
@click="typeReport == 3 ? getReport() : handleDownload()"
|
|
||||||
>
|
>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -978,7 +957,7 @@ onMounted(() => {
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="typeReport !== 3 && typeReport !== 4"
|
v-if="typeReport !== 3"
|
||||||
dense
|
dense
|
||||||
class="q-px-md"
|
class="q-px-md"
|
||||||
label="ค้นหา"
|
label="ค้นหา"
|
||||||
|
|
@ -997,7 +976,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12 col-xs-12 flex">
|
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12 col-xs-12 flex">
|
||||||
<q-splitter
|
<q-splitter
|
||||||
v-if="typeReport !== 3 && typeReport !== 4"
|
v-if="typeReport !== 3"
|
||||||
disable
|
disable
|
||||||
v-model="splitterModel"
|
v-model="splitterModel"
|
||||||
horizontal
|
horizontal
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ const columns = ref<QTableColumn[]>([
|
||||||
{
|
{
|
||||||
name: "leaveDaysUsed",
|
name: "leaveDaysUsed",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ที่ใช้ไปทั้งหมด (วัน)",
|
label: "ที่ใช้ไป (วัน)",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "leaveDaysUsed",
|
field: "leaveDaysUsed",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -92,7 +92,7 @@ const columns = ref<QTableColumn[]>([
|
||||||
{
|
{
|
||||||
name: "leaveCount",
|
name: "leaveCount",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ที่ใช้ไปทั้งหมด (ครั้ง)",
|
label: "ที่ใช้ไป (ครั้ง)",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "leaveCount",
|
field: "leaveCount",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -101,7 +101,7 @@ const columns = ref<QTableColumn[]>([
|
||||||
{
|
{
|
||||||
name: "beginningLeaveDays",
|
name: "beginningLeaveDays",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "จำนวนวันลาก่อนใช้งานระบบ",
|
label: "ยกมา (วัน)",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "beginningLeaveDays",
|
field: "beginningLeaveDays",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -110,7 +110,7 @@ const columns = ref<QTableColumn[]>([
|
||||||
{
|
{
|
||||||
name: "beginningLeaveCount",
|
name: "beginningLeaveCount",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "จำนวนครั้งที่ลาก่อนใช้งานระบบ",
|
label: "ยกมา (ครั้ง)",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "beginningLeaveCount",
|
field: "beginningLeaveCount",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import type { QTableColumn } from "quasar";
|
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
@ -23,12 +22,21 @@ const checkRoutePermisson = ref<boolean>(
|
||||||
route.name == "disciplineInvestigatefactsDetail"
|
route.name == "disciplineInvestigatefactsDetail"
|
||||||
);
|
);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps({
|
||||||
rows?: any[];
|
rows: {
|
||||||
columns?: QTableColumn[];
|
type: Array,
|
||||||
visibleColumns?: string[];
|
default: [],
|
||||||
fetchData?: () => void;
|
},
|
||||||
}>();
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
visibleColumns: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
fetchData: Function,
|
||||||
|
});
|
||||||
|
|
||||||
const remark = ref<string>("");
|
const remark = ref<string>("");
|
||||||
const selected = ref<any[]>([]);
|
const selected = ref<any[]>([]);
|
||||||
|
|
@ -92,7 +100,7 @@ function onSubmit() {
|
||||||
<q-card-section class="q-pa-xs">
|
<q-card-section class="q-pa-xs">
|
||||||
<q-table
|
<q-table
|
||||||
:columns="props.columns"
|
:columns="props.columns"
|
||||||
:rows="props.rows ?? []"
|
:rows="rows"
|
||||||
row-key="personId"
|
row-key="personId"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { useInvestigateFactStore } from "@/modules/11_discipline/store/Investiga
|
||||||
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
|
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
|
||||||
|
|
||||||
import type { ArrayPersonAdd } from "@/modules/11_discipline/interface/response/investigate";
|
import type { ArrayPersonAdd } from "@/modules/11_discipline/interface/response/investigate";
|
||||||
import type { FormData } from "@/modules/11_discipline/interface/request/investigateFact";
|
import type { FormData } from "@/modules/11_discipline/interface/request/InvestigateFact";
|
||||||
import type {
|
import type {
|
||||||
FormData as FormDataComplaint,
|
FormData as FormDataComplaint,
|
||||||
ArrayPerson,
|
ArrayPerson,
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue