fix ทดลองงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-01-23 15:45:25 +07:00
parent c6ff356638
commit 9b132aa1a2
3 changed files with 465 additions and 33 deletions

View file

@ -770,11 +770,11 @@ async function getAssign() {
)?.directors;
const dataPerson = dataMap?.map((dataPerson: AppointTopic) => ({
...dataPerson,
name: `${dataPerson.name} (${dataPerson.position}${
dataPerson.positionLevel && dataPerson.positionType
? dataPerson.positionLevel
name: `${dataPerson.name} ${
dataPerson.position
? `(${dataPerson.position}${dataPerson.positionLevel})`
: ""
})`,
}`,
}));
reportPersonIdOp.value = dataPerson ?? [];
if (reportPersonIdOp.value.length !== 0) {
@ -903,6 +903,7 @@ function filterFnCaretaker(val: string, update: any) {
const dataFilter = filtermantor(OPcaretakerNew.value, [
caretaker2.value,
]).filter((i: any) => i.id !== chairman.value.id);
if (val == "") {
update(() => {
optionCaretaker.value = dataFilter;
@ -1004,11 +1005,11 @@ function updateAppointMent() {
const data = appointTopic.value.directors;
const dataPerson = data.map((dataPerson: AppointTopic) => ({
...dataPerson,
name: `${dataPerson.name} (${dataPerson.position}${
dataPerson.positionLevel && dataPerson.positionType
? +dataPerson.positionLevel
name: `${dataPerson.name} ${
dataPerson.position
? `(${dataPerson.position}${dataPerson.positionLevel})`
: ""
})`,
}`,
}));
reportPersonIdOp.value = dataPerson;
@ -1029,11 +1030,10 @@ function updateAppointMent() {
const createChairmanObject = (dataPerson: AppointTopic) => ({
id: dataPerson.profileId,
name: dataPerson.name,
label: dataPerson.position
? `${dataPerson.name} (${dataPerson.position}${
dataPerson.positionLevel && dataPerson.positionType
? +dataPerson.positionLevel
: ""
dataPerson.positionLevel ? dataPerson.positionLevel : ""
})`
: dataPerson.name,
posLevel: dataPerson.positionLevel,

View file

@ -0,0 +1,287 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true }); //popup /
const emit = defineEmits(["update-authority"]);
const selected = ref<any[]>([]);
const isAct = ref<boolean>(false);
const search = ref<string>("");
const rows = ref<any[]>([]); ///
const page = ref<number>(1);
const pageSize = ref<number>(10);
const maxPaeg = ref<number>(1);
const total = ref<number>(0);
const columns = ref<QTableProps["columns"]>([
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "เลขที่ตำแหน่ง",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "fullName",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "posType",
format(val, row) {
return `${row.posType} ${row.posLevel ? `(${row.posLevel})` : ""} `;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "actFullName",
align: "left",
label: "รักษาการแทน",
sortable: true,
field: "actFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
function onCloseDialog() {
modal.value = false;
isAct.value = false;
rows.value = [];
selected.value = [];
search.value = "";
page.value = 1;
pageSize.value = 10;
maxPaeg.value = 1;
total.value = 0;
}
function fetchList() {
showLoader();
http
.post(config.API.commandDirector, {
isDirector: true, // fix true
isAct: isAct.value,
keyword: search.value.trim(),
page: page.value,
pageSize: pageSize.value,
})
.then((res) => {
const data = res.data.result;
rows.value = data.data;
maxPaeg.value = Math.ceil(data.total / pageSize.value);
total.value = data.total;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function onAct() {
onSearchData();
}
function onSearchData() {
page.value = 1;
fetchList();
}
function updatePagination(newPagination: any) {
pageSize.value = newPagination.rowsPerPage;
}
function onSelectAuthority() {
emit("update-authority", selected.value[0]);
onCloseDialog();
}
watch(modal, (val) => {
if (val) {
fetchList();
}
});
</script>
<template>
<!-- อำนาจออกคำส -->
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 70%">
<DialogHeader
:tittle="'เลือกผู้มีอำนาจออกคำสั่ง'"
:close="onCloseDialog"
/>
<q-separator />
<q-card-section>
<div class="col-12 q-col-gutter-sm">
<div class="col-12 row q-col-gutter-md items-start">
<div class="col-12 col-sm-4 col-md-4">
<q-input
v-model="search"
outlined
hide-bottom-space
dense
label="คำค้น"
/>
</div>
<q-checkbox
keep-color
v-model="isAct"
label="แสดงเฉพาะรักษาการแทน"
color="primary"
@update:model-value="onAct"
>
<q-tooltip>แสดงเฉพาะรกษาการแทน </q-tooltip>
</q-checkbox>
<q-space />
<div class="col-12 col-sm-6 col-md-3">
<q-btn
color="primary"
icon="search"
label="ค้นหา"
class="full-width q-pa-sm"
outline
@click.prevent="onSearchData"
>
</q-btn>
</div>
</div>
<div class="col-12">
<d-table
flat
:columns="columns"
:rows="rows"
row-key="key"
dense
selection="single"
v-model:selected="selected"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.checkBox"
/>
</template>
<template v-slot:header="props">
<q-tr :props="props">
<q-th class="text-center"> </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 class="text-center">
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div>
{{ col.value ?? "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="page"
active-color="primary"
color="dark"
:max="Number(maxPaeg)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchList"
></q-pagination>
</template>
</d-table>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
:disable="selected.length === 0"
label="เลือกผู้มีอำนาจออกคำสั่ง"
color="public"
@click="onSelectAuthority"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style scoped></style>

View file

@ -9,6 +9,7 @@ import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
import genReport from "@/plugins/genreport";
import FormUploadFile from "@/modules/05_placement/components/probation/FormEvaluation/FormUploadFile.vue";
import DialogSelectAuthority from "@/modules/05_placement/components/probation/FormEvaluation/DialogSelectAuthority.vue";
const probationStore = useProbationDataStore();
@ -57,11 +58,30 @@ const options = ref<any>([
{ value: 2, label: "พัฒนาไม่ครบ 3 ส่วน" },
]);
const optionsResult = ref<any>([
{ value: 1, label: "ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อ" },
{ value: 2, label: "ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกจากราชการ" },
{
value: 4,
label: "ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป",
type: "save1",
},
{
value: 2,
label: "ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกจากราชการ",
type: "save1",
},
{
value: 1,
label: "ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป",
type: "save2",
},
{
value: 2,
label: "ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกจากราชการ",
type: "save2",
},
{
value: 3,
label: "เห็นควรให้ขยายระยะเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก",
type: "save2",
},
]);
@ -156,6 +176,11 @@ const fecthResult = async (id: string) => {
status.value = false;
action.value = "edit";
expand_month.value = data.expand_month;
authority_name.value = data.authority_name;
authority_pos.value = data.authority_pos;
authority_type.value = data.authority_type;
authority_level.value = data.authority_level;
authority_dated.value = data.authority_dated;
changeReson52(Number(data.pass_result));
}
})
@ -180,7 +205,7 @@ async function postData(action: string) {
const data = {
start_date: date_start.value,
date_finish: date_finish.value,
develop_complete: develop.value,
develop_complete: props.tab === "save1" ? 0 : develop.value,
pass_result: result.value,
reson: reson.value,
chairman_dated: chairman_dated.value,
@ -188,6 +213,11 @@ async function postData(action: string) {
// director2_dated: director2_dated.value ? director2_dated.value : new Date(),
expand_month: expand_month.value ? expand_month.value : undefined,
evaluate_no: props?.tab ? Number(props?.tab.charAt(4)) : undefined,
authority_name: authority_name.value,
authority_pos: authority_pos.value,
authority_type: authority_type.value,
authority_level: authority_level.value,
authority_dated: authority_dated.value,
};
if (action === "post") {
showLoader();
@ -238,25 +268,53 @@ function selectResult() {
* @param val วเลข
*/
function changeReson52(val: number) {
switch (val) {
case 1:
reson52.value = "เห็นควรให้รับราชการต่อไป";
break;
case 2:
reson52.value = "เห็นควรให้ออกจากราชการ";
break;
case 3:
reson52.value = `เห็นควรให้ขยายเวลาทดลองปฏิบัตหิน้าท่ีราชการต่อไปอีก ${expand_month.value} เดือน`;
break;
if (props.tab === "save1") {
switch (val) {
case 4:
reson52.value = "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป";
break;
case 2:
reson52.value = "เห็นควรให้ออกจากราชการ";
break;
default:
break;
default:
break;
}
} else if (props.tab === "save2") {
switch (val) {
case 1:
reson52.value = "เห็นควรให้รับราชการต่อไป";
break;
case 2:
reson52.value = "เห็นควรให้ออกจากราชการ";
break;
case 3:
reson52.value = `เห็นควรให้ขยายเวลาทดลองปฏิบัตหิน้าท่ีราชการต่อไปอีก ${expand_month.value} เดือน`;
break;
default:
break;
}
}
}
onMounted(() => {
fecthAssign();
fecthResult(assignId.value);
const modal = ref<boolean>(false);
const authority_dated = ref<Date | null>(null);
const authority_name = ref<string>("");
const authority_pos = ref<string>("");
const authority_type = ref<string>("");
const authority_level = ref<string>("");
function updateAuthority(data: any) {
authority_name.value = `${data.prefix}${data.firstName} ${data.lastName}`;
authority_pos.value = `${data.position}`;
authority_type.value = `${data.posType}`;
authority_level.value = `${data.posLevel}`;
}
onMounted(async () => {
await fecthAssign();
await fecthResult(assignId.value);
});
</script>
@ -405,7 +463,7 @@ onMounted(() => {
<div class="col-12 row q-mt-xs">
<div class="col-12 row q-col-gutter-md">
<div class="col-xs-12 col-sm-6">
<div class="col-xs-12 col-sm-6" v-if="props?.tab === 'save2'">
<q-select
:rules="[
(val:string) =>
@ -439,6 +497,7 @@ onMounted(() => {
</template>
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<div class="row">
<q-select
@ -449,7 +508,7 @@ onMounted(() => {
'กรุณาเลือกผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ',
]"
hide-bottom-space
:options="optionsResult"
:options="optionsResult.filter((e:any)=> e.type === props?.tab)"
:readonly="
!status ||
checkRoutePermisson ||
@ -479,6 +538,9 @@ onMounted(() => {
<q-input
outlined
dense
@update:model-value="
reson52 = `เห็นควรให้ขยายเวลาทดลองปฏิบัตหิน้าท่ีราชการต่อไปอีก ${expand_month} เดือน`
"
v-model="expand_month"
label="จำนวนเดือน"
:rules="[(val:string) => !!val || 'กรุณากรอกจำนวนเดือน']"
@ -540,8 +602,7 @@ onMounted(() => {
<div class="row col-12 q-gutter-lg q-mt-none">
<div class="col-12 row">
<div class="col-12 text-top2 row items-center">
ประธานคณะกรรมการประเมนผลการปฏหนาทราชการ/านาจสงบรรจตามมาตรา
52
ประธานคณะกรรมการประเมนผลการปฏหนาทราชการ
</div>
<div class="col-12 row q-col-gutter-md">
<q-select
@ -602,6 +663,85 @@ onMounted(() => {
</div>
</div>
<div class="col-12 row q-mt-xs">
<div class="col-12 text-top2 row items-center q-gutter-sm">
<span> านาจสงบรรจตามมาตรา 52 </span>
<div
v-if="
status &&
checkRoutePermisson &&
probationStore.dataPermissions?.tab6.isEdit
"
>
<q-btn
color="primary"
label="เลือกผู้มีอํานาจ"
@click="modal = true"
/>
</div>
</div>
<div class="col-12 row q-col-gutter-md">
<q-input
class="col-xs-12 col-sm-8"
dense
outlined
label="ชื่อ-นามสกุล"
readonly
option-label="label"
:model-value="`${authority_name ? authority_name : ''} ${
authority_pos ? `(${authority_pos}${authority_level})` : ''
}`"
/>
<div class="col-xs-12 col-sm-4">
<datepicker
menu-class-name="modalfix"
v-model="authority_dated"
:locale="'th'"
autoApply
borderless
:readonly="
!status ||
checkRoutePermisson ||
probationStore.dataPermissions?.tab6.isEdit == false
"
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
outlined
dense
:readonly="!status || checkRoutePermisson"
class="full-width datepicker col-3"
:model-value="
authority_dated != null
? date2Thai(authority_dated)
: null
"
:label="`${'ลงวันที่'}`"
:rules="[(val:string) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</div>
<!-- <div class="col-12 row q-mt-xs">
<div class="col-12 text-top2 row items-center">คณะกรรมการ</div>
<div class="col-12 row q-col-gutter-md">
@ -758,6 +898,11 @@ onMounted(() => {
"
/>
</div>
<DialogSelectAuthority
v-model:modal="modal"
@update-authority="updateAuthority"
/>
</template>
<style lang="scss" scoped>