Compare commits

..

No commits in common. "dev" and "v1.1.64" have entirely different histories.
dev ... v1.1.64

97 changed files with 631 additions and 1831 deletions

View file

@ -36,7 +36,6 @@
"moment": "^2.29.4",
"pdf-lib": "^1.17.1",
"pinia": "^2.0.29",
"pinia-plugin-persistedstate": "^3.2.3",
"quasar": "^2.11.1",
"socket.io-client": "^4.7.4",
"structure-chart": "^0.0.9",

View file

@ -194,7 +194,6 @@ export default {
`${orgProfile}${type}/profileid/position`,
uploadProfile: (type: string, id: string) =>
`${organization}/upload/${type}-profileSalaryTemp/${id}`,
sortOrderByDate: `${orgProfile}/salaryTemp/sort-order`,
workflowCommanderOperate: `${workflow}/commander/operate`,
workflowCommanderSign: `${workflow}/commander/sign`,

View file

@ -96,8 +96,4 @@ export default {
applicationFormPDF: (candidateId: string) =>
`${env.API_URI}/placement/candidate/pdf/${candidateId}`,
downloadCandidateExam: (id: string) =>
`${periodExam}download/candidate-exam/${id}`,
downloadPassExam: (id: string) => `${periodExam}download/pass-exam/${id}`,
};

View file

@ -23,7 +23,6 @@ export default {
uploadCandidates: (id: string) => `${recruit}candidate/${id}`,
uploadResult: (id: string) => `${recruit}result/${id}`,
getImportHistory: (id: string) => `${recruit}history/${id}`,
getImportStatus: (jobId: string) => `${recruit}import/status/${jobId}`,
//upload
periodRecruitDoc: (examId: string) => `${recruit}doc/${examId}`,

View file

@ -8,7 +8,6 @@ import config from "@/app.config";
import type { PropType } from "vue";
import type { FormProfile } from "@/interface/main";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import avatarMain from "@/assets/avatar_user.jpg";
/** importComponents*/
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
@ -44,9 +43,9 @@ async function fetchDataProfile(data: DataProfile) {
profile.avatar = data?.avatar ? data.avatar : "";
}
profile.id = data.profileId;
profile.fullName = `${data.rank ? data.rank : data.prefix ?? ""}${
data.firstName ?? ""
} ${data.lastName ?? ""} `;
profile.fullName = `${data.prefix ?? ""}${data.firstName ?? ""} ${
data.lastName ?? ""
} `;
if (data["posTypeNameOld"] !== undefined) {
profile.position =
@ -92,11 +91,8 @@ function fetchProfile(id: string, name: string) {
if (profile.avatar === "") {
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `${name}`))
.then((res) => {
.then(async (res) => {
profile.avatar = res.data.downloadUrl;
})
.catch(() => {
profile.avatar = avatarMain;
});
}
}

View file

@ -9,8 +9,6 @@
round
dense
@click="close"
@keydown.enter.prevent
@keydown.space.prevent
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>

View file

@ -332,7 +332,6 @@ watch(
outlined
dense
label="คำค้น"
@keydown.enter.prevent="searchInput()"
>
<template v-slot:after>
<q-btn

View file

@ -24,14 +24,14 @@ import DialogHeader from "@/components/DialogHeader.vue";
const props = defineProps({
dataRows: {
type: Object,
default: () => ({}),
require: true,
},
onSubmit: Function,
});
const $q = useQuasar();
const route = useRoute();
const storeTree = useStructureTree();
const { fetchStructureTree } = storeTree;
const { fetchStructureTree } = useStructureTree();
const mixin = useCounterMixin();
const {
dialogConfirm,
@ -47,10 +47,10 @@ const {
/** props*/
const modal = defineModel<boolean>("modal", { required: true });
const title = defineModel<string>("title", { required: true });
const type = defineModel<string | null>("type", { required: true });
const posType = defineModel<string | null>("posType", { required: true });
const posLevel = defineModel<string | null>("posLevel", { required: true });
const position = defineModel<string | null>("position", { required: true });
const type = defineModel<any>("type", { required: true });
const posType = defineModel<any>("posType", { required: true });
const posLevel = defineModel<any>("posLevel", { required: true });
const position = defineModel<any>("position", { required: true });
// const routeName = ref<string>(route?.name);
const orgRevisionId = ref<string>("");
@ -64,7 +64,7 @@ const itemTaps = ref<string[]>();
const filters = ref<string>("");
const positionId = ref<string>("");
const selectedPos = ref<any[]>([]);
const selectId = ref<string>("");
const seletcId = ref<string>("");
const datePos = ref<Date>(new Date());
const rowsPosition = ref<Positions[]>([]);
const positionData = ref<any[]>([]);
@ -79,6 +79,7 @@ const formActive = reactive<FormActive>({
});
/** node */
const nodes = ref<Array<OrgTree>>([]);
const lazy = ref(nodes);
const expanded = ref<string[]>([]);
const nodeLevel = ref<number>(0);
const nodeId = ref<string>(""); // id Tree
@ -149,7 +150,7 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const columnsPosition = ref<QTableProps["columns"]>([
const columnsPostition = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
@ -180,7 +181,7 @@ const columnsPosition = ref<QTableProps["columns"]>([
{
name: "posTypeName",
align: "left",
label: "ประเภทตำหน่ง",
label: "ประเภทตำเเหน่ง",
sortable: true,
field: "posTypeName",
headerStyle: "font-size: 14px",
@ -243,16 +244,10 @@ function close() {
expanded.value = [];
nodeLevel.value = 0;
nodeId.value = "";
positionData.value = [];
positionNo.value = [];
rowData.value = [];
}
async function getDataTable(id: string, level: number = 0) {
showLoader();
positionData.value = [];
positionNo.value = [];
rowData.value = [];
const body = {
node: level,
nodeId: id,
@ -266,7 +261,7 @@ async function getDataTable(id: string, level: number = 0) {
await http
.post(config.API.orgPosPlacement, body)
.then(async (res) => {
.then((res) => {
const dataMain: PositionMain[] = [];
posMasterMain.value = res.data.result.data;
@ -304,6 +299,7 @@ async function getDataTable(id: string, level: number = 0) {
positionNo.value = listPosNo;
rowData.value = listPosNo;
// positionData.value = listPosNo;
if (props.dataRows?.posmasterId) {
const newUse = positionUse.value.filter(
@ -317,13 +313,14 @@ async function getDataTable(id: string, level: number = 0) {
(e: any) => !positionUse.value.includes(e.id)
);
}
await onClickSelectPos(positionId.value);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
});
}
@ -334,11 +331,11 @@ async function getDataTable(id: string, level: number = 0) {
function updateSelected(data: DataTree) {
if (props?.dataRows?.nodeId === data.orgTreeId) {
positionId.value = props?.dataRows?.posmasterId;
selectId.value = props?.dataRows?.positionId;
seletcId.value = props?.dataRows?.positionId;
datePos.value = props?.dataRows?.reportingDate;
} else {
positionId.value = "";
selectId.value = "";
seletcId.value = "";
selectedPos.value = [];
datePos.value = new Date();
}
@ -385,9 +382,9 @@ async function onClickSelectPos(id: string) {
//
if (position) {
rowsPosition.value = position.positions;
if (selectId.value) {
if (seletcId.value) {
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
.post(config.API.orgPosFind, body)
.then(async (res) => {
.then((res) => {
const data = res.data.result;
expanded.value = data;
nodeId.value = id;
positionId.value = props?.dataRows?.posmasterId;
selectId.value = props?.dataRows?.positionId;
seletcId.value = props?.dataRows?.positionId;
datePos.value = props?.dataRows?.reportingDate;
await getDataTable(nodeId.value, level);
getDataTable(nodeId.value, level);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
@ -431,6 +427,11 @@ watch(
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
if (positionId.value) {
setTimeout(async () => {
await onClickSelectPos(positionId.value);
}, 200);
}
} else {
expanded.value = [];
}
@ -462,16 +463,20 @@ function fetchPositionUes() {
watch(
() => isAll.value,
() => {
(value, oldVal) => {
if (value !== oldVal) {
getDataTable(nodeId.value, nodeLevel.value);
}
}
);
watch(
() => isBlank.value,
() => {
(value, oldVal) => {
if (value !== oldVal) {
getDataTable(nodeId.value, nodeLevel.value);
}
}
);
watch(
@ -486,17 +491,9 @@ function onSubmit() {
const dataPosMaster = posMasterMain.value?.find(
(e: any) => e.id === positionId.value
);
if (!dataPosMaster) {
dialogMessageNotify($q, "ไม่พบข้อมูลตำแหน่ง");
return;
}
if (selectedPos.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
return;
}
} else {
dialogConfirm($q, async () => {
const body = {
personalId: props?.dataRows?.id,
@ -512,18 +509,17 @@ function onSubmit() {
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() {
@ -538,7 +534,6 @@ onMounted(async () => {
await fetchTree();
});
</script>
<template>
<q-dialog v-model="modal" persistent full-width>
<q-card class="no-scroll">
@ -570,7 +565,7 @@ onMounted(async () => {
<q-tree
class="q-pa-sm q-gutter-sm"
dense
:nodes="nodes"
:nodes="lazy"
node-key="orgTreeId"
label-key="labelName"
:filter="filter"
@ -836,7 +831,7 @@ onMounted(async () => {
</q-toolbar>
<d-table
ref="table"
:columns="columnsPosition"
:columns="columnsPostition"
:rows="rowsPosition"
row-key="id"
flat
@ -934,7 +929,6 @@ onMounted(async () => {
</q-card>
</q-dialog>
</template>
<style scoped>
.my-list-link {
color: rgb(118, 168, 222);

View file

@ -232,8 +232,7 @@ function close() {
async function getDataTable(id: string, level: number = 0) {
showLoader();
positionNo.value = [];
rowsData.value = [];
const body = {
node: level,
nodeId: id,
@ -266,7 +265,6 @@ async function getDataTable(id: string, level: number = 0) {
posMasterNo:
e.orgShortname +
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : "") +
" " +
e.posMasterNo +
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : ""),
positionName: e.positionName,
@ -304,7 +302,9 @@ async function getDataTable(id: string, level: number = 0) {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
});
}

View file

@ -14,7 +14,6 @@ import type {
GovermentEmpTemp,
} from "@/components/information/interface/response/Government";
import type { Avatar } from "@/components/information/interface/response/avatar";
import avatarMain from "@/assets/avatar_user.jpg";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
@ -168,9 +167,9 @@ async function fetchInformation(id: string) {
avatar.position = data.position ? data.position : "-";
// Function fetchProfile
if (data.avatarName) {
fetchProfile(data.id as string, data.avatarName);
await fetchProfile(data.id as string, data.avatarName);
} else {
avatar.avatar = avatarMain;
avatar.avatar = "";
}
if (props.id) {
@ -261,14 +260,11 @@ async function fetchProfileGovTemp(id: string) {
* @param id profileID
* @param avatarName อไฟล
*/
function fetchProfile(id: string, avatarName: string) {
http
async function fetchProfile(id: string, avatarName: string) {
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
.then((res) => {
avatar.avatar = res.data.downloadUrl;
})
.catch(() => {
avatar.avatar = avatarMain;
.then(async (res) => {
avatar.avatar = await res.data.downloadUrl;
});
}

View file

@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { getColumnLabel } from "@/utils/function";
import type { QTableProps } from "quasar";
@ -186,7 +187,6 @@ watch(modal, (val) => {
dense
label="คำค้น"
@clear="search = ''"
@keydown.enter.prevent="onSearchData()"
/>
</div>
<q-checkbox
@ -253,7 +253,7 @@ watch(modal, (val) => {
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">
{{ col.label }}
{{ getColumnLabel(col, isAct) }}
</span>
</q-th>
</q-tr>

View file

@ -13,7 +13,6 @@ import th from "quasar/lang/th";
import "@vuepic/vue-datepicker/dist/main.css";
import http from "./plugins/http";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
// import './assets/main.css'
@ -21,7 +20,6 @@ import filters from "./plugins/filters";
const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
// เพิ่ม Global Filters ลงใน App
app.config.globalProperties.$filters = filters;

View file

@ -213,9 +213,7 @@ function formatHistoryOwnerData(data: HistoryPos[]) {
return data.map((item) => ({
...item,
fullname: item.firstName
? `${item.prefix || ""}${item.firstName || ""} ${
item.lastName || ""
}`.trim()
? `${item.prefix}${item.firstName} ${item.lastName}`.trim()
: "ว่าง",
}));
}

View file

@ -1004,6 +1004,7 @@ watch(
table-class="text-grey-9"
row-key="id"
dense
hide-bottom
bordered
separator="vertical"
class="custom-header-table-expand"

View file

@ -365,7 +365,7 @@ async function downloadFileDashboard() {
async function clickPassExam() {
showLoader();
await http
.get(config.API.downloadPassExam(examId.value))
.get(config.API.exportExamPassExamList(examId.value))
.then(async (res) => {
const data = res.data.result;
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
@ -382,7 +382,7 @@ async function clickPassExam() {
async function clickCandidateList() {
showLoader();
await http
.get(config.API.downloadCandidateExam(examId.value))
.get(config.API.exportExamCandidateList(examId.value))
.then(async (res) => {
const data = res.data.result;
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
@ -397,6 +397,8 @@ async function clickCandidateList() {
}
async function onCheckShowExaminfo() {
console.log(props.isShowExaminfo);
dialogMessage(
$q,
`ยืนยันการ${props.isShowExaminfo ? "ปิด" : "เปิด"}`,

View file

@ -1,7 +1,7 @@
<!-- page:ดการรอบการสอบ สรรหา -->
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { onMounted, ref, watch } from "vue";
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { useQuasar } from "quasar";
import genReport from "@/plugins/genreport";
@ -11,9 +11,6 @@ import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
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 {
@ -36,14 +33,9 @@ const {
messageError,
onSearchDataTable,
dialogRemove,
dialogMessage,
} = mixin;
const router = useRouter();
const uploadProgress = useUploadProgressStore();
const socketStore = useSocketStore();
const { notificationCounter } = storeToRefs(socketStore);
const name = ref<string>("");
const year = ref<number>(calculateFiscalYear(new Date()) + 543);
const order = ref<number>(1);
@ -57,11 +49,6 @@ const modalScore = ref<boolean>(false);
const modalCandidate = ref<boolean>(false);
const modalResult = ref<boolean>(false);
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 tittleHistory = ref<string>("ประวัติการนำเข้าข้อมูล"); //
const filterHistory = ref<string>(""); //search data table history
@ -75,54 +62,6 @@ const textTittle = ref<string>("");
const textTittleScore = ref<string>("");
const textTittleCandidate = 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 rowsData = ref<ResponseRecruitPeriod[]>([]);
const initialPagination = ref<Pagination>({
@ -396,15 +335,9 @@ function clickDetail(id: string) {
* @param id รอบสอบเเขงข
*/
async function clickUpload(id: string) {
selected_row_id.value = id;
const isRunning = await checkJobStatus(id, "candidate");
if (isRunning) {
showUploadRunningDialog();
} else {
modalCandidate.value = true;
textTittleCandidate.value = "นำเข้าผู้สมัครสอบแข่งขัน";
}
selected_row_id.value = id;
}
/**
@ -412,15 +345,9 @@ async function clickUpload(id: string) {
* @param id รอบสอบเเขงข
*/
async function clickEdit(id: string) {
selected_row_id.value = id;
const isRunning = await checkJobStatus(id, "score");
if (isRunning) {
showUploadRunningDialog();
} else {
modalScore.value = true;
textTittleScore.value = "นำเข้าบัญชีรวมคะแนน";
}
selected_row_id.value = id;
}
/**
@ -428,57 +355,9 @@ async function clickEdit(id: string) {
* @param id รอบสอบเเขงข
*/
async function clickResult(id: string) {
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;
selected_row_id.value = id;
}
/**
@ -584,13 +463,11 @@ async function checkSaveCandidate() {
await http
.post(config.API.uploadCandidates(selected_row_id.value), fd)
.then((res) => {
const jobId = res.data.result.jobId;
uploadProgress.addUpload(jobId, selected_row_id.value, "candidate");
success($q, UPLOAD_SUCCESS_DIALOG.message);
success($q, "นำเข้าข้อมูลผู้สมัครสอบสำเร็จ");
modalCandidate.value = false;
files_candidate.value = null;
selected_row_id.value = "";
fetchData();
})
.catch((e) => {
messageError($q, e);
@ -600,7 +477,7 @@ async function checkSaveCandidate() {
});
}
/** บันทึด คะเนน */
/** บันทึด คะเนน */
async function checkSaveScore() {
const fd = new FormData();
fd.append("attachment", files_score.value[0]);
@ -608,12 +485,11 @@ async function checkSaveScore() {
await http
.post(config.API.saveScores(selected_row_id.value), fd)
.then((res) => {
const jobId = res.data.result.jobId;
uploadProgress.addUpload(jobId, selected_row_id.value, "score");
success($q, UPLOAD_SUCCESS_DIALOG.message);
success($q, "นำเข้าข้อมูลผลคะแนนสอบสำเร็จ");
modalScore.value = false;
files_score.value = null;
selected_row_id.value = "";
fetchData();
})
.catch((e) => {
messageError($q, e);
@ -631,12 +507,11 @@ async function checkSaveResult() {
await http
.post(config.API.uploadResult(selected_row_id.value), fd)
.then((res) => {
const jobId = res.data.result.jobId;
uploadProgress.addUpload(jobId, selected_row_id.value, "result");
success($q, UPLOAD_SUCCESS_DIALOG.message);
success($q, "นำเข้าข้อมูลผลการสอบแข่งขันฯ (บัญชีรายชื่อ)");
modalResult.value = false;
files_result.value = null;
selected_row_id.value = "";
fetchData();
})
.catch((e) => {
messageError($q, e);
@ -657,9 +532,6 @@ async function checkSave() {
await http
.post(config.API.saveCandidates, fd)
.then((res) => {
const jobId = res.data.result.jobId;
uploadProgress.addUpload(jobId, selected_row_id.value, "period");
success($q, "นำเข้าข้อมูลผู้สมัครสอบแข่งขันสำเร็จ");
modalAdd.value = false;
fetchData();
@ -685,18 +557,12 @@ onMounted(async () => {
hideLoader();
await fetchData();
});
/** Watch notification counter on socket */
watch(notificationCounter, () => {
fetchData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
ดการรอบสอบแขงข
</div>
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
<div>
<Table
@ -803,16 +669,16 @@ watch(notificationCounter, () => {
</div>
<div v-else-if="col.name == 'examCount'" class="table_ellipsis2">
<q-btn
v-if="
(col.value == null || col.value == '0') &&
checkPermission($route)?.attrIsUpdate
"
flat
dense
size="12px"
color="green"
round
@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-tooltip>นำเขาไฟลสมครสอบ</q-tooltip>
@ -849,9 +715,6 @@ watch(notificationCounter, () => {
</div>
<div v-else-if="col.name == 'scoreCount'" class="table_ellipsis2">
<q-btn
v-if="
col.value == null && checkPermission($route)?.attrIsUpdate
"
:disable="props.row.examCount == 0"
flat
dense
@ -859,6 +722,9 @@ watch(notificationCounter, () => {
round
color="green"
@click.stop.prevent="clickEdit(props.row.id)"
v-if="
col.value == null && checkPermission($route)?.attrIsUpdate
"
>
<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">
<q-btn
v-if="
(props.row.score == null ||
props.row.score.resultCount == 0) &&
checkPermission($route)?.attrIsUpdate
"
:disable="props.row.score == null"
flat
dense
@ -897,6 +758,11 @@ watch(notificationCounter, () => {
color="green"
round
@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-tooltip>นำเขาไฟลผลการสอบ (ญชรายช)</q-tooltip>
@ -1055,12 +921,12 @@ watch(notificationCounter, () => {
<q-dialog v-model="modalCandidate" persistent>
<q-card style="width: 600px">
<q-form ref="myFormScore">
<DialogHeadTemplate
:title="textTittleCandidate"
:close="clickCloseCandidate"
title-type="ข้อมูลผู้สมัครสอบ"
/>
<q-form ref="myFormScore">
<q-separator />
<q-card-section>
<div class="col-12 row items-center q-col-gutter-sm">
@ -1099,12 +965,12 @@ watch(notificationCounter, () => {
<q-dialog v-model="modalScore" persistent>
<q-card style="width: 600px">
<q-form ref="myFormScore">
<DialogHeadTemplate
:title="textTittleScore"
:close="clickCloseScore"
title-type="บัญชีรวมคะแนน"
/>
<q-form ref="myFormScore">
<q-separator />
<q-card-section>
<div class="col-12 row items-center q-col-gutter-sm">
@ -1143,12 +1009,12 @@ watch(notificationCounter, () => {
<q-dialog v-model="modalResult" persistent>
<q-card style="width: 600px">
<q-form ref="myFormScore">
<DialogHeadTemplate
:title="textTittleResult"
:close="clickCloseResult"
title-type="ผลการสอบ (บัญชีรายชื่อ)"
/>
<q-form ref="myFormScore">
<q-separator />
<q-card-section>
<div class="col-12 row items-center q-col-gutter-sm">

View file

@ -212,17 +212,17 @@ const columnsPosition = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
// {
// name: "type",
// align: "left",
// label: "",
// sortable: true,
// field: "type",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
// },
{
name: "type",
align: "left",
label: "ประเภทแบบฟอร์ม",
sortable: true,
field: "type",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const shouldShowPaymentFields = computed(() => {
@ -1476,7 +1476,7 @@ onMounted(async () => {
</div>
</q-td>
<!-- <q-td key="type" :props="props">
<q-td key="type" :props="props">
<selector
class=""
outlined
@ -1490,7 +1490,7 @@ onMounted(async () => {
lazy-rules
:rules="[(val:any) => !!val || `${'กรุณาเลือกประเภทแบบฟอร์ม'}`]"
></selector>
</q-td> -->
</q-td>
</q-tr>
</template>
</ProfileTable>

View file

@ -260,6 +260,7 @@ async function fetchData(loading: boolean = true) {
total.value = data.total;
maxPage.value = await Math.ceil(data.total / pageSize.value);
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
rows.value = [];
data.data.map((r: any) => {
rows.value.push({
@ -401,7 +402,6 @@ onMounted(async () => {
await fetchDataCom();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
@ -474,9 +474,9 @@ onMounted(async () => {
</div>
</q-card>
</q-slide-transition>
<q-card flat bordered class="col-12 q-pt-sm">
<TableCandidate
style="max-height: 80vh"
:rows="rows"
:columns="columns"
:filter="filter"
@ -603,7 +603,6 @@ onMounted(async () => {
</template>
</TableCandidate>
</q-card>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 600px">
<q-card-section class="row items-center q-py-sm">

View file

@ -50,10 +50,18 @@ const formMain = reactive<FormMain>({
workDate: null, //
reasonSameDate: "",
retireDate: null, //
ageAll: "", //
ageAll: {
year: 0,
month: 0,
day: 0,
}, //
absent: 0, //
age: 0, //
govAgeBkk: "",
govAgeBkk:{
year: 0,
month: 0,
day: 0,
}
});
const modalEdit = ref<boolean>(false); // popup
@ -157,22 +165,10 @@ async function getData() {
formMain.reasonSameDate = data.reasonSameDate;
formMain.retireDate = data.dateLeave;
formMain.dateRetireLaw = data.dateRetireLaw;
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.ageAll = data.govAge;
formMain.absent = data.govAgeAbsent;
formMain.age = data.govAgePlus;
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() || "-"
: "-";
formMain.govAgeBkk = data.govAgeBkk;
})
.catch((e) => {
messageError($q, e);
@ -459,19 +455,25 @@ onMounted(() => {
<span class="text-grey-6 text-weight-medium">อายราชการ</span>
</div>
<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 class="col-12 col-sm-6 col-md-6">
<div class="row">
<div class="col-12 col-sm-12 col-md-5">
<span class="text-grey-6 text-weight-medium"
>อายราชการ (กทม.)</span
>
<span class="text-grey-6 text-weight-medium">อายราชการ (กทม.)</span>
</div>
<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>

View file

@ -866,8 +866,7 @@ onMounted(() => {
outlined
dense
:model-value="date2Thai(formData.dateEnd)"
clearable
@clear="formData.dateEnd = null"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วันที่สิ้นสุด'}`]"
hide-bottom-space
:label="`${'วันที่สิ้นสุด'}`"
>

View file

@ -408,8 +408,7 @@ function calculateMinDate() {
function prefixRankRule() {
return [
() =>
!!formData.rank || !!formData.prefix || "กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
() => !!formData.rank || !!formData.prefix || "กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
];
}
@ -589,7 +588,6 @@ onMounted(() => {
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
dense
outlined
use-input
@ -604,6 +602,7 @@ onMounted(() => {
option-value="name"
v-model="formData.prefix"
clearable
class="inputgreen"
:options="store.Ops.prefixOps"
:label="dataLabel.prefix"
:rules="prefixRankRule()"
@ -641,24 +640,24 @@ onMounted(() => {
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
dense
outlined
lazy-rules
hide-bottom-space
v-model="formData.firstName"
class="inputgreen"
:label="dataLabel.firstName"
:rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
dense
outlined
lazy-rules
hide-bottom-space
v-model="formData.lastName"
class="inputgreen"
:label="dataLabel.lastName"
:rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
/>
@ -722,7 +721,6 @@ onMounted(() => {
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
dense
outlined
use-input
@ -737,6 +735,7 @@ onMounted(() => {
option-label="name"
option-value="name"
v-model="formData.gender"
class="inputgreen"
:options="store.Ops.genderOps"
:label="dataLabel.gender"
@filter="(inputValue: string,

View file

@ -13,8 +13,8 @@ interface FormMain {
workDate: any;
reasonSameDate: string;
retireDate: any;
ageAll: GovAgeForm | string;
govAgeBkk: GovAgeForm | string;
ageAll: GovAgeForm;
govAgeBkk: GovAgeForm;
absent: number;
age: number;
[key: string]: any;

View file

@ -323,10 +323,10 @@ async function uploadFileURL(uploadUrl: string, file: any) {
* งกนดงขอมลรปโปรไฟล
* @param id โปรไฟล
*/
function fetchProfile(id: string) {
http
async function fetchProfile(id: string) {
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then((res) => {
.then(async (res) => {
profilePicture.value = res.data.downloadUrl;
})
.catch(() => {
@ -403,7 +403,7 @@ async function fetchDataPersonal() {
fileName.value = res.data.result.avatarName;
if (formDetail.value?.avatarName) {
fetchProfile(profileId.value);
await fetchProfile(profileId.value);
} else {
profilePicture.value = avatar;
}

View file

@ -437,6 +437,66 @@ function classColorRow(isDelete: boolean, isEdit: boolean, isEntry: boolean) {
/** ฟังก์ชันดาวน์โหลดไฟล Excel */
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); //
@ -871,29 +931,6 @@ function onCancelUpload() {
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 () => {
await Promise.all([fetchData(), fetchType()]);
});
@ -929,23 +966,8 @@ onMounted(async () => {
icon="mdi-sort"
@click="modalSort = true"
>
<q-tooltip>ดลำดบขอม</q-tooltip>
</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-tooltip>ดลำดบตามวนทคำสงมผล</q-tooltip>
</q-btn>
<q-space />
<div>
<q-btn

View file

@ -54,7 +54,6 @@ const reason = ref<string>(""); //หมายเหตุ
const status = ref<string>("");
const fullName = ref<string>("");
const mianData = ref<MainData>();
const typeCommand = ref<string>(""); //
/** fetch รายละเอียดการปรับระดับชั้นงานลูกจ้าง*/
async function fecthappointmentByid() {
@ -80,7 +79,6 @@ async function fecthappointmentByid() {
salary.value = data.salary ?? 0;
reason.value = data.reason;
date.value = data.positionDate;
typeCommand.value = data.typeCommand;
})
.catch((e) => {
messageError($q, e);
@ -325,10 +323,7 @@ onMounted(async () => {
</div>
<div class="col-12"><q-separator /></div>
<div
class="col-xs-6 col-sm-6 row items-center"
v-if="typeCommand !== 'MOVE'"
>
<div class="col-xs-6 col-sm-6 row items-center">
<div class="col-12">
<datepicker
:readonly="!edit"

View file

@ -45,7 +45,6 @@ const date = ref<Date | null>(null); //ดำรงตำแหน่งใน
const reason = ref<string>(""); //
const status = ref<string>("");
const fullName = ref<string>("");
const typeCommand = ref<string>(""); //
/** fetch รายละเอียดการแต่งตั้ง-เลื่อน-ย้าย*/
async function fecthappointmentByid() {
@ -62,7 +61,6 @@ async function fecthappointmentByid() {
}`;
status.value = data.status;
typeCommand.value = data.typeCommand;
educationOld.value = data.educationOld ?? "-";
organizationPositionOld.value = data.organizationPositionOld;
positionTypeOld.value = data.positionTypeOld;
@ -315,10 +313,7 @@ onMounted(() => {
</div>
<div class="col-12"><q-separator /></div>
<div
class="col-xs-6 col-sm-6 row items-center"
v-if="typeCommand !== 'MOVE'"
>
<div class="col-xs-6 col-sm-6 row items-center">
<div class="col-12">
<datepicker
:readonly="!edit"

View file

@ -316,10 +316,9 @@ onMounted(() => {
:model-value="
dateEnd !== null ? date2Thai(dateEnd) : null
"
:rules="edit ? [(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]:[]"
hide-bottom-space
:label="`${'ถึงวันที่'}`"
clearable
@clear="dateEnd = null"
>
<template v-slot:prepend>
<q-icon

View file

@ -2,7 +2,7 @@
import { ref, onMounted, watch } from "vue";
/** importType*/
import { type QTableProps } from "quasar";
import type { QTableProps } from "quasar";
import type {
Positions,
FormPosType,
@ -22,14 +22,14 @@ const store = useSelectOrgStore();
/** props*/
const selected = defineModel("selectedPos", { required: true }); //
const positionId = defineModel<string>("positionId", { required: true }); //id
const selectId = defineModel<string>("selectId", { required: true }); //
const date = defineModel<Date | null>("datePos", { required: true }); //
const seletcId = defineModel<string>("seletcId", { required: true }); //
const date = defineModel<Date>("datePos", { required: true }); //
const positionData = defineModel<any[]>("position", { required: true }); //
const isAll = defineModel<boolean>("isAll", { required: true }); //
const isBlank = defineModel<boolean>("isBlank", { required: true }); //
const isPosition = defineModel<string>("isPosition", { 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 optionPosType = defineModel<FormPosType[]>("optionPosType", {
required: true,
@ -47,7 +47,6 @@ const props = defineProps({
onPosType: Function,
nodeId: String,
nodeLevel: Number,
isLoadPosition: Boolean,
});
//Table
@ -214,9 +213,9 @@ async function onClickSelectPos(id: string) {
//
if (position) {
rowsPosition.value = position.positions;
if (selectId.value) {
if (seletcId.value) {
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 กเรยกใชงาน
*/
onMounted(async () => {
if (!positionId.value) {
if (positionId.value) {
setTimeout(async () => {
await onClickSelectPos(positionId.value);
}, 1000);
} else {
positionRows.value = positionData.value;
positionRowsData.value = positionData.value;
}

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { onMounted, ref, watch, reactive } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
@ -11,7 +11,6 @@ import { useStructureTree } from "@/stores/structureTree";
/** importType*/
import type {
DataList,
PositionMaim,
PositionNo,
Positions,
@ -42,14 +41,17 @@ const {
/**props*/
const modal = defineModel<boolean>("modal", { required: true });
interface Props {
dataRow?: DataList;
fetchTable?: () => Promise<void>;
fetchStatCard?: () => Promise<void>;
}
const props = defineProps<Props>();
const props = defineProps({
dataRow: {
type: Object,
require: true,
},
fetchTable: {
type: Function,
require: true,
},
fetchStatCard: { type: Function, require: true },
});
/** Tree*/
const nodeId = ref<string>("");
@ -63,16 +65,15 @@ const expanded = ref<string[]>([]);
const positionUse = ref<string[]>([]);
const positionNo = ref<DataPositionNo[]>([]);
const positionId = ref<string>("");
const selectId = ref<string>("");
const seletcId = ref<string>("");
const posType = ref<FormPosType | null>(null);
const posLevel = ref<string>("");
const selectedPos = ref<Positions[]>([]);
const datePos = ref<Date | null>(new Date());
const posMasterMain = ref<PositionMaim[]>([]);
const selectedPos = ref<any[]>([]);
const datePos = ref<Date>(new Date());
const posMasterMain = ref<any[]>([]);
const orgRevisionId = ref<string>("");
const optionPosType = ref<FormPosType[]>([]);
const optionPosLevel = ref<FormPosLevel[]>([]);
const isLoadPosition = ref<boolean>(false);
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchStructure() {
@ -90,14 +91,12 @@ async function fetchStructure() {
*/
function updateSelected(data: TreeMain) {
if (props?.dataRow?.nodeId === data.orgTreeId) {
positionId.value = props?.dataRow?.posmasterId ?? "";
selectId.value = props?.dataRow?.positionId ?? "";
datePos.value = props?.dataRow?.reportingDate
? new Date(props.dataRow.reportingDate)
: new Date();
positionId.value = props?.dataRow?.posmasterId;
seletcId.value = props?.dataRow?.positionId;
datePos.value = props?.dataRow?.reportingDate;
} else {
positionId.value = "";
selectId.value = "";
seletcId.value = "";
selectedPos.value = [];
datePos.value = new Date();
}
@ -118,8 +117,6 @@ const isPosition = ref<string>("exam");
// const isPositionOld = ref<boolean>(false);
async function fetchDataTable(id: string, level: number = 0) {
showLoader();
isLoadPosition.value = false;
positionNo.value = [];
const body = {
node: level,
nodeId: id,
@ -153,7 +150,7 @@ async function fetchDataTable(id: string, level: number = 0) {
if (p.length !== 0) {
const a = p.find((el: Positions) => el.positionIsSelected === true);
const { id, ...rest } = a ? a : p[0];
const data: PositionMaim = { ...e, ...rest } as PositionMaim;
const data: any = { ...e, ...rest };
dataMain.push(data);
}
});
@ -165,22 +162,21 @@ async function fetchDataTable(id: string, level: number = 0) {
(e) => e !== props.dataRow?.posmasterId
);
positionNo.value = posMain.filter(
(e: DataPositionNo) => !newUse.includes(e.id)
);
positionNo.value = posMain.filter((e: any) => !newUse.includes(e.id));
} else {
positionNo.value = posMain.filter(
(e: DataPositionNo) => !positionUse.value.includes(e.id)
(e: any) => !positionUse.value.includes(e.id)
);
}
isLoadPosition.value = true;
})
.catch((err) => {
messageError($q, err);
hideLoader();
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
});
}
@ -202,11 +198,9 @@ async function fetchPosFind(level: number, id: string) {
expanded.value = data;
nodeId.value = id;
positionId.value = props?.dataRow?.posmasterId ?? "";
selectId.value = props?.dataRow?.positionId ?? "";
datePos.value = props?.dataRow?.reportingDate
? new Date(props.dataRow.reportingDate)
: new Date();
positionId.value = props?.dataRow?.posmasterId;
seletcId.value = props?.dataRow?.positionId;
datePos.value = props?.dataRow?.reportingDate;
fetchDataTable(nodeId.value, level);
})
@ -218,14 +212,12 @@ async function fetchPosFind(level: number, id: string) {
/** function บันทึกข้อมูลตำแหน่ง*/
async function onClickSubmit() {
const dataPosMaster = posMasterMain.value?.find(
(e) => e.id === positionId.value
const dataPosMaster = await posMasterMain.value?.find(
(e: any) => e.id === positionId.value
);
if (selectedPos.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
} else if (!dataPosMaster) {
dialogMessageNotify($q, "ไม่พบข้อมูลตำแหน่ง");
} else {
dialogConfirm($q, async () => {
showLoader();
@ -243,7 +235,6 @@ async function onClickSubmit() {
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,
positionExecutiveField: selectedPos.value[0].positionExecutiveField, //
@ -281,9 +272,6 @@ function clearData() {
posLevel.value = "";
isPosition.value = "exam";
filterTree.value = "";
datePos.value = new Date();
isLoadPosition.value = false;
positionNo.value = [];
}
/** callback function เมื่อมีการเปิด popup*/
@ -292,11 +280,9 @@ watch(
async () => {
if (modal.value) {
await fetchPositionUes();
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
await fetchPosFind(
props?.dataRow?.node ?? 0,
props?.dataRow?.nodeId ?? ""
);
await fetchPosFind(props?.dataRow?.node, props?.dataRow?.nodeId);
} else {
expanded.value = [];
}
@ -337,7 +323,8 @@ async function getOrgPosType() {
})
.catch((e) => {
messageError($q, e);
});
})
.finally(() => {});
}
function onPosType() {
@ -349,15 +336,28 @@ function onPosType() {
}
watch(
[isAll, isBlank, () => isPosition.value],
([newAll, newBlank, newPos], [oldAll, oldBlank, oldPos]) => {
const shouldFetch = newAll !== oldAll || newBlank !== oldBlank;
const isSelectMode = newPos === "select" && oldPos !== "select";
if (shouldFetch || isSelectMode) {
() => isAll.value,
(value, oldVal) => {
if (value !== oldVal) {
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();
}
}
@ -458,15 +458,15 @@ onMounted(() => {
:name="item"
>
<CardPosition
v-model:position="positionNo"
v-model:position="positionNo as []"
v-model:selectedPos="selectedPos"
v-model:datePos="datePos"
v-model:positionId="positionId"
v-model:selectId="selectId"
v-model:seletcId="seletcId"
v-model:is-all="isAll"
v-model:is-blank="isBlank"
v-model:is-position="isPosition"
v-model:pos-type="posType"
v-model:pos-type="posType as FormPosType"
v-model:pos-level="posLevel"
v-model:option-pos-type="optionPosType"
v-model:option-pos-level="optionPosLevel"
@ -474,8 +474,7 @@ onMounted(() => {
:on-pos-type="onPosType"
:node-id="nodeId"
:node-level="nodeLevel"
:bma-officer="props.dataRow?.bmaOfficer ?? ''"
:is-load-position="isLoadPosition"
:bma-officer="props.dataRow?.bmaOfficer"
/>
</q-tab-panel>
</q-tab-panels>

View file

@ -1,5 +1,5 @@
<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 http from "@/plugins/http";
@ -10,7 +10,6 @@ import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
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 type { PartialTableName } from "@/modules/05_placement/interface/request/placement";
@ -48,7 +47,7 @@ const {
/** รับค่ามาจากหน้าหลัก */
const props = defineProps({
statCard: {
type: Function as PropType<() => Promise<void>>,
type: Function,
default: () => console.log("getStat"),
},
});
@ -1057,8 +1056,7 @@ onMounted(async () => {
checkPermission($route)?.attrIsUpdate &&
props.row.isDraft &&
props.row.statusId === 'PREPARE-CONTAIN' &&
(DataStore.isOfficer ||
checkPermission($route)?.attrOwnership == 'OWNER')
(DataStore.isOfficer || checkPermission($route)?.attrOwnership == 'OWNER')
"
clickable
v-close-popup
@ -1545,10 +1543,7 @@ onMounted(async () => {
:label="`${'เลือกไฟล์เอกสารหลักฐาน'}`"
outlined
use-chips
:rules="[
(val) => !!val || 'กรุณาเลือกไฟล์เอกสารหลักฐาน',
(val) => validateFileSize(val),
]"
:rules="[(val:string) => !!val || 'กรุณาเลือกไฟล์เอกสารหลักฐาน']"
multiple
@update:model-value="clickEditRow"
class="q-py-sm"

View file

@ -20,7 +20,7 @@ const dataMapToSend = computed(() => {
return selected.value.map((i: any) => ({
id: i.id,
profileId: i.profileId,
prefix: i.rank ? i.rank : i.prefix,
prefix: i.prefix,
firstName: i.firstName,
lastName: i.lastName,
citizenId: i.citizenId,
@ -89,9 +89,7 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
format(val, row) {
return `${row.rank ? row.rank : row.prefix ?? ""}${row.firstName ?? ""} ${
row.lastName ?? ""
}`;
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
},
},
{
@ -112,11 +110,9 @@ const columns2 = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return row.positionTypeOld && row.positionTypeOl !== "-"
return row.positionTypeOld
? `${row.positionTypeOld}${
row.positionLevelOld && row.positionLevelOld !== "-"
? `(${row.positionLevelOld})`
: ""
row.positionLevelOld ? `(${row.positionLevelOld})` : ""
}`
: "";
},

View file

@ -48,7 +48,6 @@ const informaData = ref<FormAddPerson>({
employeeType: null,
employeeClass: null,
profileType: null,
rank: "",
});
//
@ -61,7 +60,6 @@ const Ops = ref<InformationOps>({
religionOps: [],
employeeClassOps: [],
employeeTypeOps: [],
rankOps: [],
});
//
const OpsFilter = ref<InformationOps>({
@ -73,7 +71,6 @@ const OpsFilter = ref<InformationOps>({
religionOps: [],
employeeClassOps: [],
employeeTypeOps: [],
rankOps: [],
});
// profile
@ -138,16 +135,6 @@ async function fetchPerson() {
});
Ops.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) => {
messageError($q, e);
@ -217,13 +204,7 @@ function filterSelector(val: string, update: Function, refData: string) {
);
});
break;
case "rankOps":
update(() => {
Ops.value.rankOps = OpsFilter.value.rankOps.filter(
(v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1
);
});
break;
default:
break;
}
@ -246,7 +227,7 @@ function onSubmit() {
if (fileData.value != null) formData.append("File", fileData.value); //
if (informaData.value.citizenId != undefined)
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);
if (informaData.value.firstName != undefined)
formData.append("firstName", informaData.value.firstName);
@ -275,8 +256,6 @@ function onSubmit() {
formData.append("employeeType", informaData.value.employeeType);
if (informaData.value.employeeClass != undefined)
formData.append("employeeClass", informaData.value.employeeClass);
if (informaData.value.rank != undefined && informaData.value.rank != "")
formData.append("rank", informaData.value.rank);
dialogConfirm($q, async () => {
showLoader();
@ -310,15 +289,6 @@ function updateBirthDate(v: Date) {
age.value = calculateAge(v);
}
function prefixRankRule() {
return [
() =>
!!informaData.value.rank ||
!!informaData.value.prefix ||
"กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
];
}
/**
* ทำงานเมอมการเรยกใช Components
*/
@ -413,7 +383,7 @@ onMounted(async () => {
</div>
<q-card-section class="q-px-lg">
<div class="row q-col-gutter-sm">
<div class="col-2">
<div class="col-3">
<q-input
bg-color="white"
outlined
@ -434,14 +404,13 @@ onMounted(async () => {
mask="#############"
/>
</div>
<div class="col-2">
<div class="col-3">
<q-select
bg-color="white"
v-model="informaData.prefix"
label="คำนำหน้าชื่อ"
outlined
dense
clearable
lazy-rules
class="inputgreen"
:options="Ops.prefixOps"
@ -449,8 +418,11 @@ onMounted(async () => {
option-value="name"
map-options
hide-bottom-space
:rules="prefixRankRule()"
reactive-rules
:rules="[
(val:string) => {
return val.length > 0 || 'กรุณาเลือกคำนำหน้าชื่อ';
},
]"
emit-value
use-input
hide-selected
@ -460,32 +432,6 @@ onMounted(async () => {
)"
/>
</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">
<q-input
bg-color="white"

View file

@ -113,7 +113,6 @@ const Ops = ref<InformationOps>({
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
rankOps: [],
});
const OpsFilter = ref<InformationOps>({
prefixOps: [],
@ -130,7 +129,6 @@ const OpsFilter = ref<InformationOps>({
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
rankOps: [],
});
/** ฟังก์ชันดึงข้อมูลรายการข้อมูลเกี่ยวกับบุคคล (dropdown list)*/
@ -188,16 +186,6 @@ async function fetchPerson() {
});
Ops.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) => {
messageError($q, e);
@ -227,9 +215,9 @@ async function getData() {
}
rows.value = list;
profileId.value = data.profileId;
title.value.fullname = `${data.rank ? data.rank : data.prefix ?? ""}${
data.firstName ?? ""
} ${data.lastName ?? ""}`;
title.value.fullname = `${data.prefix ?? ""}${data.firstName ?? ""} ${
data.lastName ?? ""
}`;
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
title.value.positionLevelOld = data.positionLevelOld ?? "-";
title.value.positionTypeOld = data.positionTypeOld ?? "-";
@ -242,7 +230,6 @@ async function getData() {
(data.prefix == "00000000-0000-0000-0000-000000000000"
? null
: data.prefix) ?? "",
rank: data.rank ?? "",
firstname: data.firstName ?? "",
lastname: data.lastName ?? "",
birthDate:
@ -308,7 +295,6 @@ async function fetchData(data: any) {
(data.prefix == "00000000-0000-0000-0000-000000000000"
? null
: data.prefix) ?? "",
rank: data.rank ?? "",
firstname: data.firstName ?? "",
lastname: data.lastName ?? "",
birthDate: data.dateOfBirth !== null ? new Date(data.dateOfBirth) : null,
@ -450,14 +436,6 @@ function filterSelector(val: string, update: Function, refData: string) {
});
break;
case "rankOps":
update(() => {
Ops.value.rankOps = OpsFilter.value.rankOps.filter(
(v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1
);
});
break;
default:
break;
}
@ -492,7 +470,6 @@ function saveData() {
positionNumberOld: posNo.value,
amount: 0,
amountOld: salary.value,
rank: informaData.value.rank,
};
showLoader();
http
@ -540,15 +517,6 @@ function updateBirthDate(v: Date) {
informaData.value.age = calculateAge(v);
}
function prefixRankRule() {
return [
() =>
!!informaData.value.rank ||
!!informaData.value.prefixId ||
"กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
];
}
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(async () => {
await fetchPerson();
@ -630,7 +598,7 @@ onMounted(async () => {
<div class="col-xs-12">
<div class="text-weight-bold text-grey">อมลสวนต</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
:class="getClass(edit)"
hide-bottom-space
@ -646,7 +614,7 @@ onMounted(async () => {
mask="#############"
/>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<div class="col-xs-6 col-sm-3 col-md-3">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
@ -666,42 +634,10 @@ onMounted(async () => {
option-value="name"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
clearable
input-debounce="0"
:rules="prefixRankRule()"
reactive-rules
@filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' ) "
/>
</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">
<q-input
:class="getClass(edit)"

View file

@ -201,7 +201,6 @@ watch(modal, (val) => {
hide-bottom-space
dense
label="คำค้น"
@keydown.enter.prevent="onSearchData()"
/>
</div>
<q-checkbox

View file

@ -7,7 +7,6 @@ interface InformationOps {
religionOps: DataOption[];
employeeClassOps: DataOption[];
employeeTypeOps: DataOption[];
rankOps: DataOption[];
}
//ข้อมูลส่วนตัว
@ -64,7 +63,6 @@ interface FormAddPerson {
employeeType: string | null;
employeeClass: string | null;
profileType: string | null;
rank?: string;
}
const defaultInformation: Information = {
@ -85,7 +83,6 @@ const defaultInformation: Information = {
employeeType: null,
employeeClass: null,
profileType: null,
rank: null,
};
export { defaultInformation };

View file

@ -152,7 +152,6 @@ interface FormDataAppoint {
reportingDate: string;
posmasterId: string;
posExecutiveName?: string;
posExecutiveId?: string;
typeCommand: string;
positionExecutiveField?: string;
positionArea?: string;

View file

@ -1,24 +1,17 @@
interface DataList {
avatar: string;
bmaOfficer: string;
bmaOfficerCheck?: string;
deferment: boolean;
draft: string;
examNumber: number;
fullName: string;
idCard: string;
name: string;
node: number | null;
nodeId: string | null;
orgName: string | null;
organizationName: string;
organizationShortName: string | null;
personalId: string;
posLevelCandidateId: string | null;
posmasterId: string | null;
posTypeCandidateId: string | null;
positionCandidate: string;
positionId: string | null;
positionNumber: string | null;
positionPath: string | null;
profilePhoto: string;

View file

@ -10,7 +10,8 @@ import type {
} from "@/modules/05_placement/interface/request/Main";
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
interface profile {
export const useProfileDataStore = defineStore("profilePlacenent", () => {
interface profile {
main: { columns: String[] };
education: { columns: String[] };
certicate: { columns: String[] };
@ -26,9 +27,8 @@ interface profile {
record: { columns: String[] };
other: { columns: String[] };
document: { columns: String[] };
}
}
export const useProfileDataStore = defineStore("profilePlacenent", () => {
const birthDate = ref<Date>(new Date());
const retireText = ref<string | null>(null);
const changeRetireText = (val: string | null) => {
@ -87,15 +87,15 @@ export const useProfileDataStore = defineStore("profilePlacenent", () => {
changeRetireText,
};
});
interface placement {
mappingPosition: { columns: String[] };
}
export const usePlacementDataStore = defineStore("placement", () => {
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
const tabsMain = ref<string>("probation");
const isOfficer = ref<boolean | null>(null);
const isStaff = ref<boolean | null>(null);
const { hideLoader } = mixin;
interface placement {
mappingPosition: { columns: String[] };
}
const placementData = ref<placement>({
mappingPosition: { columns: [] },
});
@ -218,10 +218,10 @@ export const usePlacementDataStore = defineStore("placement", () => {
isStaff,
};
});
interface placementOrder {
mappingPosition: { columns: String[] };
}
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
interface placementOrder {
mappingPosition: { columns: String[] };
}
const placementOrderData = ref<placementOrder>({
mappingPosition: { columns: [] },
});
@ -369,8 +369,6 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
]);
const statusOp = ref<DataOptions[]>(statusMainOp.value);
const statusDelete = ["REPORT", "WAITING", "DONE"];
const statusText = (val: string) => {
switch (val) {
case "WAITTING":
@ -440,6 +438,5 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
statusOp,
statusMainOp,
filterOption,
statusDelete,
};
});

View file

@ -14,10 +14,9 @@ export const useSelectOrgStore = defineStore("selectorg", () => {
isPosition: e.isPosition,
posMasterNo:
e.orgShortname +
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : "") +
" " +
(e.posMasterNoPrefix != null ? e.posMasterNoPrefix : " ") +
e.posMasterNo +
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : ""),
(e.posMasterNoSuffix != null ? e.posMasterNoSuffix : " "),
positionName: e.positionName,
posTypeName: e.posTypeName,
posLevelName: e.posLevelName,

View file

@ -2,7 +2,7 @@
import { ref, onMounted, computed } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useRouter } from "vue-router";
import {
checkPermission,
checkPermissionList,
@ -20,19 +20,11 @@ import DialogOrders from "@/modules/05_placement/components/Transfer/DialogOrder
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const mixin = useCounterMixin();
const store = useTransferDataStore();
const { statusText, filterOption } = useTransferDataStore();
const {
date2Thai,
messageError,
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
success,
} = mixin;
const { date2Thai, messageError, showLoader, hideLoader, onSearchDataTable } =
mixin;
const modal = ref<boolean>(false); //
const dataTransfer = ref<ResponseData[]>([]); //
@ -149,15 +141,6 @@ const visibleColumns = ref<string[]>([
"createdAt",
]);
const isPermissionDelete = computed(() => {
return (status: string) => {
return (
checkPermission(route)?.attrOwnership === "OWNER" &&
!store.statusDelete.includes(status)
);
};
});
/** ฟังก์ชันดึงข้อมูรายการขอโอน*/
async function fetchData() {
showLoader();
@ -211,21 +194,6 @@ function onSearch() {
);
}
function handleDelete(id: string) {
dialogRemove($q, async () => {
try {
showLoader();
await http.delete(config.API.transfer + `/admin/${id}`);
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
}
/**
* ทำงานเม Components กเรยกใชงาน
* จะเรยกใช fetchData เพอดงขอมลรายการขอโอน
@ -369,18 +337,6 @@ onMounted(async () => {
>
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
<q-btn
v-if="isPermissionDelete(props.row.status)"
flat
round
dense
icon="mdi-delete"
color="red"
@click.prevent="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">

View file

@ -110,9 +110,7 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
format(val, row) {
return ` ${row.rank ? row.rank : row.prefix ?? ""}${
row.firstName ?? ""
} ${row.lastName ?? ""}`;
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
},
},
{
@ -133,11 +131,9 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return row.positionTypeOld && row.positionTypeOld !== "-"
return row.positionTypeOld
? `${row.positionTypeOld}${
row.positionLevelOld && row.positionLevelOld !== "-"
? `(${row.positionLevelOld})`
: ""
row.positionLevelOld ? `(${row.positionLevelOld})` : ""
}`
: "";
},
@ -313,7 +309,7 @@ function openDelete(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.receiveData() + `/admin/${id}`)
.delete(config.API.receiveDataId(id))
.then(async () => {
await fecthlistRecevice();
await success($q, "ลบข้อมูลสำเร็จ");
@ -382,7 +378,6 @@ async function onSave(data: FormDataAppoint) {
typeCommand: data.typeCommand,
positionExecutiveField: data.positionExecutiveField,
positionArea: data.positionArea,
posExecutiveId: data.posExecutiveId,
};
showLoader();
@ -606,10 +601,8 @@ onMounted(async () => {
<q-item
v-if="
checkPermission($route)?.attrOwnership ===
'OWNER' &&
checkPermission($route)?.attrIsDelete &&
props.row.status !== 'REPORT' &&
props.row.status !== 'WAITING' &&
props.row.status !== 'DONE'
"
clickable

View file

@ -236,7 +236,8 @@ function openModalOrder() {
item.status == "APPROVE") &&
item.organizationPositionOld &&
item.organization &&
item.dateStart
item.dateStart &&
item.dateEnd
);
rows2.value = row;
rows2Data.value = row;

View file

@ -381,7 +381,7 @@ async function fecthlistappointment() {
e.positionTypeOld &&
e.positionLevelOld &&
e.positionNumberOld &&
(e.typeCommand === "MOVE" || e.positionDate)
e.positionDate
);
rows2.value = listData;
rows2Data.value = listData;
@ -457,7 +457,6 @@ async function onSave(data: FormDataAppoint) {
typeCommand: data.typeCommand,
positionExecutiveField: data.positionExecutiveField,
positionArea: data.positionArea,
posExecutiveId: data.posExecutiveId,
};
showLoader();

View file

@ -252,7 +252,7 @@ async function fecthlistappointment() {
e.positionTypeOld &&
e.positionLevelOld &&
e.positionNumberOld &&
(e.positionDate || e.typeCommand === "MOVE")
e.positionDate
);
rows2.value = listData;
rows2Data.value = listData;

View file

@ -286,7 +286,6 @@ async function onSaveSelectOrg(data: any) {
typeCommand: data.typeCommand,
positionExecutiveField: data.positionExecutiveField,
positionArea: data.positionArea,
posExecutiveId: data.posExecutiveId,
};
showLoader();

View file

@ -33,8 +33,7 @@ const {
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
success,
findOrgName,
} = mixin;
/** Table */
@ -258,21 +257,6 @@ function onSearch() {
);
}
function handleDelete(id: string) {
dialogRemove($q, async () => {
try {
showLoader();
await http.delete(config.API.listResign() + `/admin/${id}`);
await fecthlist();
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
}
/**Hook */
onMounted(async () => {
status.value = stroeResign.formQurey.status;
@ -324,11 +308,7 @@ onMounted(async () => {
color="primary"
icon="mdi-account-arrow-right"
>
<q-tooltip>{{
`ส่งไปออกคำสั่ง${
stroeResign.mainTabs == "2" ? "ยกเลิกการ" : ""
}ลาออก`
}}</q-tooltip>
<q-tooltip>{{ `ส่งไปออกคำสั่ง${stroeResign.mainTabs == '2'?"ยกเลิกการ":''}ลาออก` }}</q-tooltip>
</q-btn>
</div>
<q-space />
@ -413,26 +393,6 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="
checkPermission($route)?.attrOwnership === 'OWNER' &&
props.row.status !== 'REPORT' &&
props.row.status !== 'WAITING' &&
props.row.status !== 'DONE' &&
props.row.status !== 'CANCELING' &&
props.row.status !== 'CANCEL' &&
stroeResign.mainTabs === '1'
"
flat
dense
round
color="red"
icon="delete"
@click.prevent="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div

View file

@ -27,15 +27,8 @@ const stroeResign = useDataStore();
const { statusText } = stroe;
const router = useRouter();
const mixin = useCounterMixin();
const {
messageError,
date2Thai,
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
success,
} = mixin;
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
mixin;
/** Table */
const rows = ref<ResponseItems[]>([]);
@ -136,7 +129,7 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return stroeResign.mainTabsEMP === "1"
return stroeResign.mainTabs === "1"
? statusText(row.status)
: statusText(row.status, "อนุญาต");
},
@ -259,21 +252,6 @@ function onSearch() {
);
}
function handleDelete(id: string) {
dialogRemove($q, async () => {
try {
showLoader();
await http.delete(config.API.listResignEMP() + `/admin/${id}`);
await fecthlist();
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
}
/**Hook */
onMounted(async () => {
statusEMP.value = stroeResign.formQureyEMP.status;
@ -413,26 +391,6 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="
checkPermission($route)?.attrOwnership === 'OWNER' &&
props.row.status !== 'REPORT' &&
props.row.status !== 'WAITING' &&
props.row.status !== 'DONE' &&
props.row.status !== 'CANCELING' &&
props.row.status !== 'CANCEL' &&
stroeResign.mainTabsEMP === '1'
"
flat
dense
round
color="red"
icon="delete"
@click.prevent="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div

View file

@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { getColumnLabel } from "@/utils/function";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
@ -228,7 +229,6 @@ watch(
label="ค้นหา"
v-model="keyword"
style="width: 300px"
@keydown.enter.prevent="onSearchData"
>
<template v-slot:append>
<q-icon name="search"></q-icon>
@ -308,7 +308,9 @@ watch(
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span>
<span class="text-weight-medium">{{
getColumnLabel(col, isAct)
}}</span>
</q-th>
</q-tr>
</template>

View file

@ -267,13 +267,7 @@ watch(
<div class="q-pa-md q-gutter-md">
<div class="row">
<div class="col text-grey-8">เวลาเขางาน</div>
<div class="col">
{{
formData.checkInDate
? `${formData.checkInDate} ${formData.checkInTime} น.`
: "-"
}}
</div>
<div class="col">{{ formData.checkInTime }}</div>
</div>
<div class="row">
<div class="col text-grey-8">สถานททำงาน</div>
@ -343,23 +337,17 @@ watch(
<div class="q-pa-md q-gutter-md">
<div class="row">
<div class="col text-grey-8">เวลาออกงาน</div>
<div class="col">
{{
formData.checkOutDate
? `${formData.checkOutDate} ${formData.checkOutTime} น.`
: "-"
}}
</div>
<div class="col">{{ formData.checkOutTime }}</div>
</div>
<div class="row">
<div class="col text-grey-8">สถานททำงาน</div>
<div class="col" v-if="formData.isLocationCheckOut">
{{ formData.checkOutLat ? "ในสถานที่" : "-" }}
ในสถานท
</div>
<div class="col" v-else>
{{
formData.checkOutLocationName
? `นอกสถานที่ (${formData.checkOutLocationName})`
formData.checkInLocationName
? `นอกสถานที่ (${formData.checkInLocationName})`
: ""
}}
</div>

View file

@ -74,12 +74,6 @@ const columns = ref<QTableProps["columns"]>([
field: "checkInTime",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
if (row.checkInDate && val) {
return `${row.checkInDate} ${val} น.`;
}
return "-";
},
},
{
name: "checkInLocation",
@ -107,12 +101,6 @@ const columns = ref<QTableProps["columns"]>([
field: "checkOutTime",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
if (row.checkOutDate && val) {
return `${row.checkOutDate} ${val} น.`;
}
return "-";
},
},
{
name: "checkOutLocation",
@ -172,19 +160,19 @@ async function fetchListTimeRecord() {
id: e.id,
fullName: e.fullName,
profileType: e.profileType,
checkInDate: date2Thai(e.checkInDate),
checkInDate: e.checkInDate ? date2Thai(e.checkInDate) : "-",
checkInTime: e.checkInTime,
checkInLocation: e.checkInLocation,
checkInLat: e.checkInLat,
checkInLon: e.checkInLon,
checkInLat: e.checkInLat ? e.checkInLat : "",
checkInLon: e.checkInLon ? e.checkInLon : "",
checkInStatus: e.checkInStatus
? workStore.convertSatatus(e.checkInStatus)
: "-",
checkOutDate: date2Thai(e.checkOutDate),
checkOutLocation: e.checkOutLocation,
checkOutTime: e.checkOutTime,
checkOutLat: e.checkOutLat,
checkOutLon: e.checkOutLon,
checkOutDate: e.checkOutDate ? date2Thai(e.checkOutDate) : "-",
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
checkOutLon: e.checkOutLat ? e.checkOutLon : "",
checkOutStatus: e.checkOutStatus
? workStore.convertSatatus(e.checkOutStatus)
: "-",

View file

@ -70,12 +70,6 @@ const columns = ref<QTableProps["columns"]>([
field: "checkInTime",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
if (row.checkInDate && val) {
return `${row.checkInDate} ${val} น.`;
}
return "-";
},
},
{
name: "checkInLocation",
@ -94,12 +88,6 @@ const columns = ref<QTableProps["columns"]>([
field: "checkOutTime",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
if (row.checkOutDate && val) {
return `${row.checkOutDate} ${val} น.`;
}
return "-";
},
},
{
name: "checkOutLocation",
@ -145,15 +133,15 @@ async function fetchListLogRecord() {
profileType: e.profileType,
fullName: e.fullName,
checkInDate: e.checkInDate && date2Thai(e.checkInDate),
checkInTime: e.checkInTime,
checkInLocation: e.checkInLocation,
checkInLat: e.checkInLat,
checkInLon: e.checkInLon,
checkInTime: e.checkInTime ? e.checkInTime : "-",
checkInLocation: e.checkInLocation ? e.checkInLocation : "-",
checkInLat: e.checkInLat ? e.checkInLat : "",
checkInLon: e.checkInLon ? e.checkInLon : "",
checkOutDate: e.checkOutDate && date2Thai(e.checkOutDate),
checkOutLocation: e.checkOutLocation,
checkOutTime: e.checkOutTime,
checkOutLat: e.checkOutLat,
checkOutLon: e.checkOutLon,
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
checkOutLon: e.checkOutLon ? e.checkOutLon : "",
}));
} else {
rows.value = [];

View file

@ -123,7 +123,7 @@ onMounted(() => {
{{ props.rowIndex + 1 }}
</div>
<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-label> {{ props.row.checkInLocation }}</q-item-label>
<q-item-label caption lines="2">{{
@ -131,10 +131,9 @@ onMounted(() => {
}}</q-item-label>
</q-item-section>
</q-item>
<div v-else>-</div>
</div>
<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-label> {{ props.row.checkOutLocation }}</q-item-label>
<q-item-label caption lines="2">{{
@ -142,7 +141,6 @@ onMounted(() => {
}}</q-item-label>
</q-item-section>
</q-item>
<div v-else>-</div>
</div>
<div v-else-if="col.name == 'profileType'">
{{
@ -152,7 +150,7 @@ onMounted(() => {
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
{{ col.value }}
</div>
</q-td>
</q-tr>

View file

@ -228,12 +228,8 @@ onMounted(async () => {
<template>
<div class="q-mt-sm">
<div class="row q-gutter-sm">
<div class="col-3 scrollable-list">
<q-list
bordered
class="rounded-borders"
style="max-height: 80vh; overflow-y: auto"
>
<div class="col-3">
<q-list bordered class="rounded-borders">
<q-item
v-for="(item, i) in filterLists"
:key="i"

View file

@ -150,41 +150,21 @@ const rows = ref<RowsType>();
//
const idCheck = computed(() => {
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") {
return rows.value?.approvers.map((items: SeqTypeRow) => items.keyId);
return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId);
}
});
//
const commanderList = computed(() => {
if (typeAdd.value === "COMMANDER") {
return rows.value?.approvers.map((items: SeqTypeRow) => ({
profileId: items.profileId,
isAct: items.isAct,
}));
} else if (typeAdd.value === "APPROVER") {
return rows.value?.commanders.map((items: SeqTypeRow) => ({
profileId: items.profileId,
isAct: items.isAct,
}));
if (typeAdd.value == "COMMANDER") {
return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId);
} else if (typeAdd.value == "APPROVER") {
return rows.value?.commanders.map((items: SeqTypeRow) => items.profileId);
}
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 commanders = rows.value?.commanders;
@ -692,10 +672,10 @@ onMounted(async () => {
fetchOptionType(),
fetchKeycloakPositionData(),
fetchDetailLeave(paramsId),
checkOfficer(),
]);
await checkLeaveType(formData.leaveTypeId, formData);
await checkOfficer();
} finally {
hideLoader();
}
@ -1292,6 +1272,5 @@ onMounted(async () => {
:id-check="idCheck"
:keycloak-user-id="keycloakUserId"
:commanders-list="commanderList"
:commanders-is-act="isAct"
/>
</template>

View file

@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { getColumnLabel } from "@/utils/function";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
@ -29,7 +30,6 @@ const props = defineProps({
fetchDetailLeave: Function,
idCheck: Array,
commandersList: Array,
commandersIsAct: Boolean,
});
const pageId = ref<string>(route.params.id as string);
@ -117,7 +117,7 @@ async function getData() {
total.value = data.total;
rows.value = data.data;
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) => {
@ -153,14 +153,10 @@ function onSubmit() {
]
.filter(Boolean)
.join(" "),
isAct: isAct.value,
keyId: items.key,
}));
const hasCommander = selected.value.some((e) =>
props.commandersList?.some(
(i: any) => i.profileId === e.id && i.isAct === isAct.value
)
props.commandersList?.some((i: any) => i === e.id)
);
if (hasCommander) {
@ -209,7 +205,6 @@ watch(
() => modal.value,
() => {
if (modal.value) {
isAct.value = props.commandersIsAct ?? false;
getSearch();
}
}
@ -238,7 +233,6 @@ watch(
label="ค้นหา"
v-model="keyword"
style="width: 300px"
@keydown.enter.prevent="onSearchData()"
>
<template v-slot:append>
<q-icon name="search"></q-icon>
@ -318,7 +312,9 @@ watch(
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span>
<span class="text-weight-medium">{{
getColumnLabel(col, isAct)
}}</span>
</q-th>
</q-tr>
</template>

View file

@ -1,59 +1,17 @@
<script setup lang="ts">
import { ref, onMounted, computed } from "vue";
import { useQuasar } from "quasar";
import { ref, onMounted, watch } from "vue";
import type { QTableProps } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const leaveStore = useLeavelistDataStore();
const route = useRoute();
const router = useRouter();
const { showLoader, hideLoader, messageError, dialogRemove, success } =
useCounterMixin();
const total = defineModel<number>("total", { required: true });
const totalList = defineModel<number>("totalList", { required: true });
const pagination = defineModel<any>("pagination", { required: true });
const props = defineProps({
getList: Function,
rows: {
type: Object,
require: true,
},
page: {
type: Number,
require: true,
},
rowsPerPage: {
type: Number,
require: true,
},
maxPage: {
type: Number,
require: true,
},
totalList: {
type: Number,
require: true,
},
dataToobar: Object,
});
const isPermissionDelete = computed(() => {
return (status: string) => {
return (
checkPermission(route)?.attrOwnership === "OWNER" &&
!leaveStore.statusDelete.includes(status) &&
leaveStore.tabMenu === "1"
);
};
});
/** ข้อมูลหัวตาราง รายการลา */
const columnsLeave = ref<QTableProps["columns"]>([
@ -254,6 +212,31 @@ const visibleReject = ref<string[]>([
"status",
]);
const props = defineProps({
getList: Function,
rows: {
type: Object,
require: true,
},
page: {
type: Number,
require: true,
},
rowsPerPage: {
type: Number,
require: true,
},
maxPage: {
type: Number,
require: true,
},
totalList: {
type: Number,
require: true,
},
dataToobar: Object,
});
/** ไปหน้ารายละเอียด */
function redirectToDetail(id: string) {
const routePrefix = leaveStore.tabMenu === "1" ? "/leave" : "/leave-reject";
@ -265,37 +248,6 @@ function updatePagination(newPagination: any) {
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()] ?? "";
}
function handleDelete(id: string) {
dialogRemove($q, async () => {
try {
showLoader();
await http.delete(config.API.leaveList() + `/${id}`);
await props.getList?.();
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
}
/** Hook*/
onMounted(() => {
if (leaveStore.tabMenu === "1") {
@ -345,23 +297,23 @@ onMounted(() => {
>
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
<q-btn
v-if="isPermissionDelete(props.row.statusText)"
flat
round
dense
icon="mdi-delete"
color="red"
@click.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"
: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'">
{{

View file

@ -10,7 +10,6 @@ import { useCounterMixin } from "@/stores/mixin";
import { useLeaveHistoryDataStore } from "@/modules/09_leave/stores/LeaveHistoryStore";
import { calculateFiscalYear } from "@/utils/function";
import { usePagination } from "@/composables/usePagination";
import { checkPermission } from "@/utils/permissions";
import type { QTableColumn } from "quasar";
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
@ -105,24 +104,20 @@ async function onSubmit() {
leaveTypeId: formData.leaveTypeId,
leaveYear: formData.leaveYear,
leaveDays: formData.leaveDays ? Number(formData.leaveDays) : 0,
leaveDaysUsed:
checkPermission(route)?.attrOwnership === "OWNER"
leaveDaysUsed: formData.leaveDaysUsed
? Number(formData.leaveDaysUsed)
: 0,
leaveCount: formData.leaveCount ? Number(formData.leaveCount) : 0,
beginningLeaveDays: !isStatusEdit.value
? formData.leaveDaysUsed
? Number(formData.leaveDaysUsed)
: 0
: undefined,
leaveCount:
checkPermission(route)?.attrOwnership === "OWNER"
beginningLeaveCount: !isStatusEdit.value
? formData.leaveCount
? Number(formData.leaveCount)
: 0
: undefined,
beginningLeaveDays: formData.beginningLeaveDays
? Number(formData.beginningLeaveDays)
: 0,
beginningLeaveCount: formData.beginningLeaveCount
? Number(formData.beginningLeaveCount)
: 0,
})
.then(async () => {
@ -322,7 +317,6 @@ watch(modal, async (val) => {
hide-bottom-space
dense
label="คำค้น"
@keydown.enter.prevent="onSearchData(true)"
>
<template v-slot:after>
<q-btn
@ -407,7 +401,6 @@ watch(modal, async (val) => {
year-picker
:enableTimePicker="false"
:max-date="`${calculateFiscalYear(new Date())}, 12, 31`"
:class="classInput(true)"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
@ -472,12 +465,34 @@ watch(modal, async (val) => {
dense
outlined
label="จำนวนสิทธิ์การลา"
:rules="[(val: string) => !val || /^\d+$/.test(val) || 'กรุณากรอกเฉพาะตัวเลขที่เป็นจำนวนเต็ม']"
hint="* สำหรับลาพักผ่อนเท่านั้น คือสิทธิ์ลาประจำปี + สิทธิ์สะสม"
/>
</div>
<div class="col-12">
<q-input
:class="classInput(true)"
v-model="formData.leaveDaysUsed"
dense
outlined
label="ที่ใช้ไป (วัน)"
hide-bottom-space
:rules="[(val: string) => !val || /^\d+(\.\d*)?$/.test(val) || 'กรุณากรอกเฉพาะตัวเลข']"
/>
</div>
<div 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 class="col-12">
<q-input
:class="classInput(true)"
v-model="formData.beginningLeaveDays"
@ -499,36 +514,7 @@ watch(modal, async (val) => {
: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
:rules="[(val: string) => !val || /^\d+(\.\d*)?$/.test(val) || 'กรุณากรอกเฉพาะตัวเลข']"
/>
</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>
</div>

View file

@ -4,8 +4,8 @@ interface DataPost {
lastName: string;
page: number;
pageSize: number;
selectedNodeId?: string | null;
selectedNode?: string;
selectedNodeId: string | null;
selectedNode: string;
}
interface DataOption {

View file

@ -50,8 +50,6 @@ interface SeqTypeRow {
keycloakId: string;
approveStatus: string;
comment: string;
keyId?: string;
isAct?: boolean;
}
interface DataDateMonthObject {
month: number;

View file

@ -44,8 +44,6 @@ export const useLeavelistDataStore = defineStore("leave", () => {
const leaveType = ref<LeaveType[]>([]);
const statusDelete = ["APPROVE", "DELETING", "DELETE"];
/**
* fetchListLeave
* @param data Page
@ -266,6 +264,5 @@ export const useLeavelistDataStore = defineStore("leave", () => {
leaveTypeOption,
leaveTypeList,
fetchKeycloakPosition,
statusDelete,
};
});

View file

@ -11,14 +11,7 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
{ id: "NOT_COMPLETE", name: "ปฏิบัติงานไม่ครบตามกำหนดเวลา" },
]);
const optionStatusMain = ref<DataOption[]>([
{ id: "ALL", name: "ทั้งหมด" },
{ id: "PENDING", name: "รอดำเนินการ" },
{ id: "APPROVE", name: "อนุมัติ" },
{ id: "REJECT", name: "ไม่อนุมัติ" },
]);
// convertStatus
// convertSatatus
function convertStatus(val: string) {
const value = val ? val.toUpperCase() : null;
switch (value) {
@ -36,6 +29,5 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
return {
optionStatus,
convertStatus,
optionStatusMain,
};
});

View file

@ -410,7 +410,6 @@ onMounted(() => {
@click="selectAllRows()"
/> -->
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
:disable="selected.length === 0 || isLoadingAll"
:color="selected.length === 0 ? 'grey' : 'info'"
dense

View file

@ -10,10 +10,8 @@ import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore"
import { checkPermission } from "@/utils/permissions";
import { usePagination } from "@/composables/usePagination";
import type {
DataSpecialTime,
DataOption,
} from "@/modules/09_leave/interface/index/Main";
import type { DataDateMonthObject } from "@/modules/09_leave/interface/request/specialTime";
import type { DataSpecialTime } from "@/modules/09_leave/interface/index/Main";
import DialogReason from "@/components/Dialogs/PopupReason.vue";
import DialogApprove from "@/modules/09_leave/components/04_SpecialTime/DialogApprove.vue";
@ -23,17 +21,23 @@ const mixin = useCounterMixin();
const store = useSpecialTimeStore();
const {
hideLoader,
monthYear2Thai,
messageError,
showLoader,
success,
date2Thai,
dialogConfirm,
dateToISO,
} = mixin;
const { pagination, params, onRequest } = usePagination("", fetchData);
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>("");
/**ตัวแปรที่ใช้ */
@ -47,12 +51,16 @@ const name = ref<string>("");
const id = ref<string>("");
const dateDialog = 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 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 visibleColumns = ref<String[]>([
"no",
@ -136,10 +144,9 @@ async function fetchData() {
.get(config.API.specialTime(), {
params: {
...params.value,
year: year.value,
month: month.value,
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) => {
@ -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() {
pagination.value.page = 1;
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 */
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();
});
</script>
@ -287,31 +291,25 @@ onMounted(async () => {
<q-card flat bordered class="col-12 q-pa-md">
<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
v-model="filterDate"
v-model="dateMonth"
:locale="'th'"
autoApply
borderless
range
month-picker
:enableTimePicker="false"
week-start="0"
@update:modelValue="onSearchData()"
@update:modelValue="updateMonth"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
outlined
:model-value="monthYearThai(dateMonth)"
dense
class="full-width datepicker"
:model-value="
filterDate != null ? dateThaiRange(filterDate) : null
"
outlined
hide-bottom-space
>
<template v-slot:prepend>
<q-icon
@ -325,37 +323,9 @@ onMounted(async () => {
</template>
</datepicker>
</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" />
<div class="col-xs-12 col-sm-6 col-md-2">
<q-space />
<div class="col-xs-12 col-sm-3 col-md-2">
<q-input
standout
dense
@ -370,7 +340,7 @@ onMounted(async () => {
</q-input>
</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
v-model="visibleColumns"
multiple

View file

@ -2,7 +2,6 @@
import { ref } from "vue";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import type { QTableColumn } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -23,12 +22,21 @@ const checkRoutePermisson = ref<boolean>(
route.name == "disciplineInvestigatefactsDetail"
);
const props = defineProps<{
rows?: any[];
columns?: QTableColumn[];
visibleColumns?: string[];
fetchData?: () => void;
}>();
const props = defineProps({
rows: {
type: Array,
default: [],
},
columns: {
type: Array,
default: [],
},
visibleColumns: {
type: Array,
default: [],
},
fetchData: Function,
});
const remark = ref<string>("");
const selected = ref<any[]>([]);
@ -92,7 +100,7 @@ function onSubmit() {
<q-card-section class="q-pa-xs">
<q-table
:columns="props.columns"
:rows="props.rows ?? []"
:rows="rows"
row-key="personId"
flat
bordered

View file

@ -10,7 +10,7 @@ import { useInvestigateFactStore } from "@/modules/11_discipline/store/Investiga
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
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 {
FormData as FormDataComplaint,
ArrayPerson,

View file

@ -11,7 +11,7 @@ import { useInvestigateDisStore } from "@/modules/11_discipline/store/Investigat
import { useInvestigateFactStore } from "@/modules/11_discipline/store/InvestigateFactStore";
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
import type { FormData } from "@/modules/11_discipline/interface/request/investigateFact";
import type { FormData } from "@/modules/11_discipline/interface/request/InvestigateFact";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import CalandarDialog from "@/modules/11_discipline/components/2_InvestigateFacts/CalandarDialog.vue";

View file

@ -15,7 +15,7 @@ import type {
FormData,
Director,
PersonsArray,
} from "@/modules/11_discipline/interface/request/disciplinary";
} from "@/modules/11_discipline/interface/request/Disciplinary";
import type {
DataOption,
FileLists,

View file

@ -260,7 +260,7 @@ watch(
keep-color
color="primary"
dense
:disable="commandType === ''"
:disable="commandType"
v-model="scope.selected"
/>
</template>
@ -271,7 +271,7 @@ watch(
keep-color
color="primary"
dense
:disable="commandType === ''"
:disable="commandType"
v-model="props.selected"
/>
</q-td>

View file

@ -9,13 +9,13 @@ import { useCounterMixin } from "@/stores/mixin";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
import type { DataListRow } from "@/modules/11_discipline/interface/request/result";
import type { DataListRow } from "@/modules/11_discipline/interface/request/Result";
import type {
FormData as FormDataComplaint,
ArrayPerson,
ArrayFileList,
} from "@/modules/11_discipline/interface/request/complaint";
import type { FormData as FormInvestigateFact } from "@/modules/11_discipline/interface/request/investigateFact";
import type { FormData as FormInvestigateFact } from "@/modules/11_discipline/interface/request/InvestigateFact";
import DialogSendToCommand from "@/modules/11_discipline/components/4_Result/DialogSendToCommand.vue";
import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.vue"; //

View file

@ -98,7 +98,7 @@ watch(props, () => {
v-ripple
:active="listCheck === index"
active-class="my-menu-link"
@click="clickList(Number(index), item.director)"
@click="clickList(index, item.director)"
>
<q-item-section>{{ item.title }}</q-item-section>
</q-item>

View file

@ -294,7 +294,6 @@ watch(
hide-bottom-space
dense
label="คำค้น"
@keydown.enter.prevent="searchInput()"
>
<template v-slot:after>
<q-btn

View file

@ -280,7 +280,6 @@ onMounted(async () => {
hide-bottom-space
dense
label="คำค้น"
@keydown.enter.prevent="(pagination.page = 1), searchInput()"
>
<template v-slot:after>
<q-btn

View file

@ -52,7 +52,7 @@ function fetchInformation() {
citizenId.value = data.citizenId;
if (data.avatarName) {
fetchProfile(data.id as string, data.avatarName);
await fetchProfile(data.id as string, data.avatarName);
} else {
avatar.value = avatarMain;
}
@ -70,14 +70,11 @@ function fetchInformation() {
* @param id profileId
* @param avatarName อไฟล
*/
function fetchProfile(id: string, avatarName: string) {
async function fetchProfile(id: string, avatarName: string) {
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
.then((res) => {
.then(async (res) => {
avatar.value = res.data.downloadUrl;
})
.catch(() => {
avatar.value = avatarMain;
});
}

View file

@ -8,7 +8,6 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/14_KPI/store";
import avatar from "@/assets/avatar_user.jpg";
import DialogHeader from "@/components/DialogHeader.vue";
import type { FormProfile } from "@/modules/14_KPI/interface/request/index";
@ -66,7 +65,7 @@ async function fetchEvaluation() {
await store.checkCompetency();
await store.checkCompetencyDefaultCompetencyLevel();
fetchProfile(data.profileId);
await fetchProfile(data.profileId);
plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
rolePoint.value = data.rolePoint == null ? "" : data.rolePoint;
@ -82,8 +81,8 @@ async function fetchEvaluation() {
// });
}
function fetchProfile(id: string) {
http
async function fetchProfile(id: string) {
await http
.get(
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`)
)
@ -91,7 +90,6 @@ function fetchProfile(id: string) {
store.dataEvaluation.avartar = res.data.downloadUrl;
})
.catch(() => {
store.dataEvaluation.avartar = avatar;
// profilePicture.value = avatar;
});
}

View file

@ -905,7 +905,6 @@ onMounted(() => {
hide-bottom-space
dense
label="คำค้น"
@keydown.enter.prevent="(formFilter.page = 1), fetchListPerson()"
>
<template v-slot:after>
<q-btn

View file

@ -50,7 +50,7 @@ const modal = defineModel<boolean>("modal", { required: true });
let reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
const totalPage = defineModel<number>("totalPage", { required: true });
const nodeTree = defineModel<OrgTree[]>("nodeTree", { required: true });
const columns = defineModel<QTableProps["columns"]>("columns", { required: true });
const columns = defineModel<QTableProps[]>("columns", {});
const rows = defineModel<PosMaster2[]>("rows", { required: true });
const props = defineProps({
fetchDataTree: {

View file

@ -777,7 +777,7 @@ watch(
<DialogMovePos
v-model:modal="modalDialogMMove"
v-model:nodeTree="nodeTree"
v-model:columns="columns"
v-model:columns="columns as QTableProps[]"
v-model:rows="posMaster"
v-model:totalPage="totalPage"
v-model:reqMaster="reqMaster"

View file

@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar";
import { usePagination } from "@/composables/usePagination";
import { useCounterMixin } from "@/stores/mixin";
import { getColumnLabel } from "@/utils/function";
import http from "@/plugins/http";
import config from "@/app.config";
@ -273,7 +274,9 @@ watch(modal, (newVal) => {
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span>
<span class="text-weight-medium">{{
getColumnLabel(col, isAct)
}}</span>
</q-th>
</q-tr>
</template>

View file

@ -719,7 +719,6 @@ onMounted(async () => {
dense
label="คำค้น"
@clear="search = ''"
@keydown.enter.prevent="onSearchData"
/>
</div>
<q-checkbox

View file

@ -191,6 +191,7 @@ async function uploadFileDoc(
* @param group ประเภพไฟล "คำสั่ง","แนบท้าย"
*/
async function fetchDoc(group: string) {
showLoader();
let type = group === "order" ? "คำสั่ง" : "แนบท้าย";
if (group === "order") {
await fetchDocOrder(type);

View file

@ -109,8 +109,8 @@ async function fetchCheckIdofficer() {
* กำหนดค `store.readonly` เม route.name เป "commandViewDetailPage" จะอานขอมลไดอยางเดยว
*/
onMounted(async () => {
await fetchCheckIdofficer();
await fetchDataCommandList();
await fetchCheckIdofficer();
store.readonly =
route.name === "commandViewDetailPage" ||
formCommandList.status === "REPORTED" ||

View file

@ -454,6 +454,7 @@ onMounted(async () => {
table-class="text-grey-9"
row-key="id"
dense
hide-bottom
bordered
separator="vertical"
class="custom-header-table-expand"

View file

@ -13,10 +13,8 @@ export const useIssueStore = defineStore("issue", () => {
const statusOptions = ref<Options[]>([
{ label: "ทั้งหมด", value: "" },
{ label: "ใหม่", value: "NEW" },
{ label: "Dev กำลังดำเนินการ", value: "IN_PROGRESS" },
{ label: "กำลังดำเนินการ", value: "IN_PROGRESS" },
{ label: "แก้ไขแล้ว", value: "RESOLVED" },
{ label: "Helpdesk กำลังดำเนินการ", value: "HELPDESK_IN_PROGRESS" },
{ label: "แจ้งกลับแล้ว", value: "REPLIED" },
{ label: "ปิดแล้ว", value: "CLOSED" },
]);
@ -31,10 +29,6 @@ export const useIssueStore = defineStore("issue", () => {
return "แก้ไขแล้ว";
case "CLOSED":
return "ปิดแล้ว";
case "HELPDESK_IN_PROGRESS":
return "Helpdesk กำลังดำเนินการ";
case "REPLIED":
return "แจ้งกลับแล้ว";
default:
return "-";
}

View file

@ -22,7 +22,6 @@ const { convertStatus, convertSystem } = store;
const { systemOptions, statusOptions } = storeToRefs(store);
const visibleColumns = ref<string[]>([
"codeIssue",
"title",
"description",
"system",
@ -35,43 +34,6 @@ const visibleColumns = ref<string[]>([
"status",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "codeIssue",
align: "left",
label: "รหัส",
sortable: false,
field: "codeIssue",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdAt",
align: "left",
label: "วันที่สร้าง",
sortable: false,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => date2Thai(new Date(val), false, true),
},
{
name: "org",
align: "left",
label: "หน่วยงาน",
sortable: false,
field: "org",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdFullName",
align: "left",
label: "ชื่อผู้สร้าง",
sortable: false,
field: "createdFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "title",
align: "left",
@ -110,6 +72,15 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "org",
align: "left",
label: "หน่วยงาน",
sortable: false,
field: "org",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "email",
align: "left",
@ -129,6 +100,25 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "createdAt",
align: "left",
label: "วันที่สร้าง",
sortable: false,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => date2Thai(new Date(val), false, true),
},
{
name: "createdFullName",
align: "left",
label: "ชื่อผู้สร้าง",
sortable: false,
field: "createdFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",

View file

@ -1,306 +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 { usePersonsStore } from "@/modules/23_persons/stores/PersonsStore";
import { usePagination } from "@/composables/usePagination";
import type { QTableProps } from "quasar";
import type {
DataOptions,
PosTypes,
PosLevels,
Person,
} from "@/modules/23_persons/interface/Main";
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const { pagination, params, onRequest } = usePagination("", fetchData);
const store = usePersonsStore();
const props = defineProps<{ type: "current" | "draft" }>();
const options = reactive({
posType: [] as DataOptions[],
posLevel: [] as DataOptions[],
});
const filters = reactive({
keyword: "",
position: "",
posTypeId: "",
posLevelId: "",
});
const rows = ref<Person[]>([]);
const visibleColumns = ref<string[]>([
"citizenId",
"fullName",
"position",
"posType",
"posLevel",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "citizenId",
align: "left",
label: "เลขบัตรประชาชน",
sortable: false,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: false,
field: "fullName",
format(val, row) {
return `${row.prefix || ""}${row.firstName || ""} ${
row.lastName || ""
}`.trim();
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่งในสายงาน",
sortable: false,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: false,
field: "posType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posLevel",
align: "left",
label: "ระดับตำแหน่ง",
sortable: false,
field: "posLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/** ฟังก์ชันดึงข้อมูลรายชื่อขรก. ที่ไม่อยู่ในโครงสร้าง */
async function fetchData() {
try {
showLoader();
const payload = {
...params.value,
posTypeId: filters.posTypeId,
posLevelId: filters.posLevelId,
position: filters.position.trim(),
keyword: filters.keyword.trim(),
};
const endpoint =
props.type === "current"
? config.API.orgSearchCurrentProfile
: config.API.orgSearchProfile;
const res = await http.post(endpoint, payload);
const result = res.data.result;
pagination.value.rowsNumber = result?.total || 0;
rows.value = result?.data || [];
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
/** ฟังก์ชันดึงข้อมูลประเภทตำแหน่ง */
async function getPosType() {
try {
options.posType = await store.fetchPosType();
} catch (error) {
messageError($q, error);
}
}
/**
* งกนอปเดตตวเลอกระดบตำแหนงเมอเลอกประเภทตำแหน
* @param val ID เภทตำแหน
*/
function updateSelectType(val: string) {
const listLevel: PosTypes | undefined = store.optionsData.dataType.find(
(e: PosTypes) => e.id === val
);
store.optionsData.posLevel =
listLevel?.posLevels?.map((e: PosLevels) => ({
id: e.id,
name: e.posLevelName,
})) || [];
options.posLevel = store.optionsData.posLevel;
filters.posLevelId = "";
searchData();
}
/** ฟังก์ชันค้นหาข้อมูล*/
function searchData() {
pagination.value.page = 1;
fetchData();
}
/**
* งกนเปดหนาทะเบยนขรก. ในแทบใหม
* @param personId ID ของขรก.
*/
function handleRedirect(personId: string) {
window.open(`/registry-officer/${personId}`, "_blank");
}
onMounted(() => {
fetchData();
getPosType();
});
</script>
<template>
<div class="col-12">
<!-- Filter Section -->
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-sm-6 col-md-2">
<q-input
v-model="filters.position"
dense
outlined
label="ตำแหน่งในสายงาน"
@keydown.enter.prevent="searchData"
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-2">
<q-select
label="ตำแหน่งประเภท"
v-model="filters.posTypeId"
:options="options.posType"
emit-value
dense
map-options
outlined
option-label="name"
option-value="id"
clearable
@clear="filters.posTypeId = ''"
@update:model-value="updateSelectType"
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-2">
<q-select
label="ระดับตำแหน่ง"
v-model="filters.posLevelId"
:disable="!filters.posTypeId"
:options="options.posLevel"
emit-value
dense
map-options
outlined
option-label="name"
option-value="id"
clearable
@clear="filters.posLevelId = ''"
@update:model-value="searchData"
/>
</div>
<q-space />
<div class="col-xs-12 col-sm-6 col-md-2">
<q-input
v-model="filters.keyword"
dense
outlined
label="ค้นหาจากชื่อ-นามสกุล หรือเลขประจำตัวประชาชน"
@keydown.enter.prevent="searchData"
>
<template v-slot:append>
<q-icon name="search" class="cursor-pointer" @click="searchData" />
</template>
</q-input>
</div>
<div class="col-xs-12 col-sm-6 col-md-2">
<q-select
for="visibleColumns"
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
/>
</div>
</div>
<!-- Table Section -->
<div class="col-12">
<p-table
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
dense
class="custom-header-table"
:visible-columns="visibleColumns"
:rows-per-page-options="[1, 10, 25, 50, 100]"
v-model:pagination="pagination"
@request="onRequest"
>
<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">
<q-tr :props="props">
<q-td auto-width>
<q-btn
flat
dense
round
color="info"
icon="mdi-eye"
@click.prevent="handleRedirect(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>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</p-table>
</div>
</div>
</template>
<style scoped></style>

View file

@ -1,38 +0,0 @@
interface DataOptions {
id: string;
name: string;
}
interface PosTypes {
createdAt: Date;
id: string;
lastUpdateFullName: string;
lastUpdatedAt: Date;
posTypeName: string;
posTypeRank: number;
posLevels: PosLevels[];
}
interface PosLevels {
createdAt: Date;
id: string;
lastUpdateFullName: string;
lastUpdatedAt: Date;
posLevelAuthority: string;
posLevelName: string;
posLevelRank: number;
}
interface Person {
citizenId: string;
firstName: string;
id: string;
lastName: string;
posLevel: string;
posType: string;
position: string;
prefix: string;
rank: string;
}
export type { DataOptions, PosTypes, PosLevels, Person };

View file

@ -1,14 +0,0 @@
const Main = () => import("@/modules/23_persons/views/Main.vue");
export default [
{
path: "/persons",
name: "personsMain",
component: Main,
meta: {
Auth: true,
Key: "PERSONS",
Role: "PERSONS",
},
},
];

View file

@ -1,45 +0,0 @@
import { defineStore } from "pinia";
import { reactive } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
DataOptions,
PosTypes,
} from "@/modules/23_persons/interface/Main";
export const usePersonsStore = defineStore("personsStore", () => {
const routeCheck = {
registry: {
meta: { Auth: true, Key: "SYS_REGISTRY_OFFICER", Role: "OWNER" },
},
org: {
meta: { Auth: true, Key: "SYS_ORG", Role: "OWNER" },
},
};
const optionsData = reactive({
posType: [] as DataOptions[],
posLevel: [] as DataOptions[],
dataType: [] as PosTypes[],
});
/** ฟังก์ชันดึงข้อมูลประเภทตำแหน่ง */
async function fetchPosType() {
if (optionsData.posType.length > 0) {
return optionsData.posType;
}
const res = await http.get(config.API.orgPosType);
optionsData.dataType = res.data.result;
optionsData.posType = res.data.result.map((e: PosTypes) => ({
id: e.id,
name: e.posTypeName,
}));
return optionsData.posType;
}
return { routeCheck, optionsData, fetchPosType };
});

View file

@ -1,77 +0,0 @@
<script setup lang="ts">
import { watch, computed, ref } from "vue";
import { useRouter } from "vue-router";
import { usePersonsStore } from "@/modules/23_persons/stores/PersonsStore";
import { checkPermission } from "@/utils/permissions";
import TablePersons from "@/modules/23_persons/components/TablePersons.vue";
const router = useRouter();
const { routeCheck } = usePersonsStore();
/// .
const hasPermission = computed(() => {
const registryPermission = checkPermission(routeCheck.registry);
const orgPermission = checkPermission(routeCheck.org);
if (registryPermission === null || orgPermission === null) {
return null;
}
return (
registryPermission?.attrOwnership === "OWNER" &&
orgPermission?.attrOwnership === "OWNER"
);
});
const tabs = ref("1");
watch(
() => hasPermission.value,
(allowed) => {
if (!allowed) {
router.push("/404");
}
}
);
</script>
<template>
<div class="row items-center">
<div class="toptitle text-dark row items-center q-py-xs">
รายชอขรก. ไมอยในโครงสราง
</div>
</div>
<q-card bordered flat>
<q-tabs
v-model="tabs"
dense
align="left"
inline-label
class="rounded-borders"
indicator-color="primary"
active-bg-color="teal-1"
active-class="text-primary"
>
<q-tab name="1" label="ปัจจุบัน" />
<q-tab name="2" label="แบบร่าง" />
</q-tabs>
<q-separator />
<div class="q-pa-sm">
<q-tab-panels v-model="tabs" animated>
<q-tab-panel name="1">
<TablePersons v-if="hasPermission" type="current" />
</q-tab-panel>
<q-tab-panel name="2">
<TablePersons v-if="hasPermission" type="draft" />
</q-tab-panel>
</q-tab-panels>
</div>
</q-card>
</template>
<style scoped></style>

View file

@ -29,7 +29,6 @@ import ModulePositionCondition from "@/modules/19_condition/router";
import ModulePositionTemp from "@/modules/20_positionTemp/router";
import ModuleReport from "@/modules/21_report/router";
import ModuleIssues from "@/modules/22_issues/router";
import ModulePersons from "@/modules/23_persons/router";
// TODO: ใช้หรือไม่?
import { authenticated, logout } from "@/plugins/auth";
@ -82,7 +81,6 @@ const router = createRouter({
...ModulePositionTemp,
...ModuleReport,
...ModuleIssues,
...ModulePersons,
],
},
/**

View file

@ -3,7 +3,6 @@ import { getToken } from "@/plugins/auth";
import { defineStore } from "pinia";
import { Notify } from "quasar";
import { io, Socket } from "socket.io-client";
import { ref } from "vue";
interface sockeBackup {
message: string;
success?: boolean;
@ -11,7 +10,6 @@ interface sockeBackup {
export const useSocketStore = defineStore("socket", () => {
let socket: Socket;
const notificationCounter = ref(0);
async function init() {
socket = io(new URL(config.API.socket).origin, {
@ -45,12 +43,6 @@ export const useSocketStore = defineStore("socket", () => {
notifyStatusOrg("current", body.message, body.success);
}
});
socket.on("socket-notification", (payload) => {
let body: sockeBackup = JSON.parse(payload);
notifyStatusWithProgress(body.message, body.success);
notificationCounter.value++;
});
}
function notifyStatus(message: string, success?: boolean) {
@ -70,27 +62,6 @@ export const useSocketStore = defineStore("socket", () => {
});
}
function notifyStatusWithProgress(message: string, success?: boolean) {
Notify.create({
group: false,
type: success === undefined || success ? "positive" : "negative",
message: `${message}`,
position: "top",
timeout: success === undefined || success ? 3000 : 0,
actions:
success === undefined || success
? []
: [
{
icon: "close",
color: "white",
round: true,
},
],
progress: true,
});
}
function fnStyleNotiOrg() {
if (document.getElementById("notify-link-style")) return;
const style = document.createElement("style");
@ -113,12 +84,10 @@ export const useSocketStore = defineStore("socket", () => {
`;
document.head.appendChild(style);
}
(window as any).resetOrgPage = (type: string) => {
localStorage.setItem("org_type", type);
window.location.reload();
};
function notifyStatusOrg(type: string, message: string, success?: boolean) {
fnStyleNotiOrg();
Notify.create({
@ -142,5 +111,5 @@ export const useSocketStore = defineStore("socket", () => {
init();
return { notificationCounter };
return {};
});

View file

@ -1,46 +0,0 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';
interface PendingUpload {
jobId: string;
type: 'candidate' | 'score' | 'result' | 'period';
periodId: string;
}
export const useUploadProgressStore = defineStore('uploadProgress', () => {
const pendingUploads = ref<PendingUpload[]>([]);
function addUpload(jobId: string, periodId: string, uploadType: 'candidate' | 'score' | 'result' | 'period') {
pendingUploads.value.push({
jobId,
type: uploadType,
periodId
});
}
function removeUpload(jobId: string) {
const index = pendingUploads.value.findIndex(u => u.jobId === jobId);
if (index !== -1) {
pendingUploads.value.splice(index, 1);
}
}
function removeByPeriodAndType(periodId: string, uploadType: string) {
const index = pendingUploads.value.findIndex(
u => u.periodId === periodId && u.type === uploadType
);
if (index !== -1) {
pendingUploads.value.splice(index, 1);
}
}
function isUploading(periodId: string, uploadType: string): boolean {
return pendingUploads.value.some(
u => u.periodId === periodId && u.type === uploadType
);
}
return { pendingUploads, addUpload, removeUpload, removeByPeriodAndType, isUploading };
}, {
persist: true
});

View file

@ -73,24 +73,3 @@ export function getColumnLabel(col: any, isAct: boolean) {
}
return col.label;
}
/**
*
* @param val
* @param maxSizeMB MB ( 10MB)
* @returns true ,
*/
export function validateFileSize(
val: File | File[],
maxSizeMB: number = 10
): string | true {
if (!val) return true;
const filesArray = Array.isArray(val) ? val : [val];
const limit = maxSizeMB * 1024 * 1024;
const isAllValid = filesArray.every((file: File) => file.size <= limit);
if (isAllValid) return true;
return `ขนาดไฟล์ไม่เกิน ${maxSizeMB}MB`;
}

View file

@ -532,29 +532,25 @@ async function fetchKeycloakPosition() {
await http
.get(config.API.keycloakPosition())
.then(async (res) => {
const data = res.data.result;
const data = await res.data.result;
usePositionKeycloakStore().setPositionKeycloak(data);
if (data.avatarName) {
getImg(data.profileId, data.avatarName);
await getImg(data.profileId, data.avatarName);
} else {
profileImg.value = avatar;
}
})
.catch((err) => {
messageError($q, err);
profileImg.value = avatar;
});
}
const profileImg = ref<string>("");
function getImg(id: string, pathName: string) {
http
async function getImg(id: string, pathName: string) {
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
.then((res) => {
profileImg.value = res.data.downloadUrl;
})
.catch((err) => {
profileImg.value = avatar;
});
}