แก้บัค แบบประเมินผล (คณะกรรมการ)

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-10-03 11:00:24 +07:00
parent 77e4294ec5
commit f773550bfd
8 changed files with 792 additions and 285 deletions

View file

@ -1,4 +1,4 @@
divdivdiv
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
@ -60,7 +60,7 @@ const title = ref<ResponseTitle>({
const fecthappointmentByid = async () => {
showLoader();
await http
.get(config.API.appointmentByid(paramsId.toString()))
.get(config.API.appointEmployeeByid(paramsId.toString()))
.then((res: ResponseData) => {
const data = res.data.result;
appointment.value = data;
@ -120,19 +120,19 @@ const putAppointment = async () => {
reason: reason.value,
positionDate: date.value,
};
// showLoader();
// await http
// .put(config.API.appointmentByid(paramsId.toString()), data)
// .then(() => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// fecthappointmentByid();
// edit.value = false;
// });
showLoader();
await http
.put(config.API.appointEmployeeByid(paramsId.toString()), data)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthappointmentByid();
edit.value = false;
});
};
const cancel = () => {
edit.value = false;

View file

@ -87,13 +87,12 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
const pageNext = (item: object) => {
props.nextPage?.(item)
}
props.nextPage?.(item);
};
const emit = defineEmits([
"update:filterKeyword2",
"update:type",
"update:selected",
]);
const updateInput = (value: any) => {
emit("update:filterKeyword2", value);
@ -111,11 +110,10 @@ const clickAddlist = () => {
dialogConfirm($q, () => createdAppoint());
};
//
const createdAppoint = async () => {
let pId: string[] = [];
let Type = props.type as string
let Type = props.type as string;
selected.value.forEach((e: UserData) => {
pId.push(e.personalId);
});
@ -125,7 +123,7 @@ const createdAppoint = async () => {
showLoader();
await http
.put(config.API.apppointmentReport(Type), data)
.then((res) => {
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
@ -135,7 +133,7 @@ const createdAppoint = async () => {
hideLoader();
props.fecthlistappointment?.();
selected.value = [];
props.clickClose?.()
props.clickClose?.();
});
};
@ -154,36 +152,90 @@ watchEffect(() => {
<div class="row justify-between">
<div class="col-5">
<q-toolbar style="padding: 0">
<q-select outlined dense :model-value="type" @update:model-value="updateInputType" :options="optionsType"
label="คำสั่งแต่งตั่ง-เลื่อน-ย้าย" style="width: 400px; max-width: auto" emit-value map-options
option-label="name" option-value="id" />
<q-select
outlined
dense
:model-value="type"
@update:model-value="updateInputType"
:options="optionsType"
label="คำสั่งแต่งตั่ง-เลื่อน-ย้าย"
style="width: 400px; max-width: auto"
emit-value
map-options
option-label="name"
option-value="id"
readonly
/>
</q-toolbar>
</div>
<div class="col-5">
<q-toolbar style="padding: 0">
<q-input borderless outlined dense debounce="300" :model-value="filterKeyword2"
@update:model-value="updateInput" placeholder="ค้นหา" style="width: 850px; max-width: auto">
<q-input
borderless
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
style="width: 850px; max-width: auto"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon v-if="filterKeyword2 !== ''" name="clear" class="cursor-pointer" @click="Reset" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
/>
</template>
</q-input>
<q-select v-model="visibleColumns2" multiple outlined dense options-dense
:display-value="$q.lang.table.columns" emit-value map-options :options="columns2" option-value="name"
options-cover style="min-width: 150px" class="gt-xs q-ml-sm" />
<q-select
v-model="visibleColumns2"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
/>
</q-toolbar>
</div>
</div>
<d-table :columns="columns2" :rows="rows2" :filter="filterKeyword2" row-key="personalId" flat
:visible-columns="visibleColumns2" selection="multiple" v-model:selected="selected">
<d-table
:columns="columns2"
:rows="rows2"
:filter="filterKeyword2"
row-key="personalId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<template v-slot:header-selection="scope">
<q-checkbox keep-color color="primary" dense v-model="scope.selected" />
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>
<q-checkbox keep-color color="primary" dense v-model="props.selected" />
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
@ -194,18 +246,37 @@ watchEffect(() => {
<q-td key="fullname" :props="props" @click="pageNext(props.row)">
{{ props.row.fullname }}
</q-td>
<q-td key="organizationName" :props="props" @click="pageNext(props.row)">
<div v-if="props.row.orgName !== null ||
props.row.positionPath !== null
">
<q-td
key="organizationName"
:props="props"
@click="pageNext(props.row)"
>
<div
v-if="
props.row.orgName !== null ||
props.row.positionPath !== null
"
>
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.orgName !== null ? props.row.orgName : "-" }}
{{ props.row.organizationShortName !== null ? `(${props.row.organizationShortName})` : "" }}
{{
props.row.organizationShortName !== null
? `(${props.row.organizationShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{ props.row.positionPath !== null ? props.row.positionPath : "-" }}
{{ props.row.positionNumber !== null ? `(${props.row.positionNumber})` : "" }}
{{
props.row.positionPath !== null
? props.row.positionPath
: "-"
}}
{{
props.row.positionNumber !== null
? `(${props.row.positionNumber})`
: ""
}}
</div>
</div>
</div>
@ -224,8 +295,13 @@ watchEffect(() => {
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn label="ส่งไปออกคำสั่ง" @click="clickAddlist" color="public" :disable="checkSelected" />
<q-btn
label="ส่งไปออกคำสั่ง"
@click="clickAddlist"
color="public"
:disable="checkSelected"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
</template>

View file

@ -124,81 +124,65 @@ const columns = ref<QTableProps["columns"]>([
},
]);
// input
const resetFilter = () => {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
// modal
const clickClose = () => {
modal.value = false;
};
// modal
const popup = () => {
modal.value = true;
filterKeyword2.value = "";
fecthTypeOption();
};
onMounted(() => {
fecthlistappointment();
});
// API
const fecthlistappointment = async () => {
// showLoader();
// rows.value = [];
// await http
// .get(config.API.appointmentMain())
// .then((res) => {
// let response = res.data.result;
// listRecevice.value = response;
// rows.value = response.map((e: resData) => ({
// personalId: e.id,
// citizenId: e.citizenId,
// fullname: e.prefix + e.firstname + " " + e.lastname,
// organizationName:
// e.organizationName +
// " " +
// e.organizationShortName +
// " " +
// e.positionNumber +
// " " +
// e.positionPath,
// orgName: e.organizationName,
// organizationShortName: e.organizationShortName,
// positionNumber: e.positionNumber,
// positionPath: e.positionPath,
// status: statusText(e.status),
// createdAt: date2Thai(e.createdAt),
// birthday: e.dateOfBirth == null ? "-" : date2Thai(e.dateOfBirth),
// educationOld: e.educationOld,
// organizationPositionOld: e.organizationPositionOld,
// positionTypeOld: e.positionTypeOld,
// positionLevelOld: e.positionLevelOld,
// positionNumberOld: e.positionNumberOld,
// salary: e.salary,
// positionDate: e.positionDate,
// }));
// rows2.value = rows.value.filter(
// (e: orgFilter) =>
// e.orgName !== null &&
// e.status !== "" &&
// e.status !== "" &&
// e.educationOld &&
// e.organizationPositionOld &&
// e.positionTypeOld &&
// e.positionLevelOld &&
// e.positionNumberOld &&
// e.salary !== null &&
// e.positionDate
// );
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
showLoader();
rows.value = [];
await http
.get(config.API.appointEmployee())
.then((res) => {
let response = res.data.result;
listRecevice.value = response;
rows.value = response.map((e: resData) => ({
personalId: e.id,
citizenId: e.citizenId,
fullname: e.prefix + e.firstname + " " + e.lastname,
organizationName:
e.organizationName +
" " +
e.organizationShortName +
" " +
e.positionNumber +
" " +
e.positionPath,
orgName: e.organizationName,
organizationShortName: e.organizationShortName,
positionNumber: e.positionNumber,
positionPath: e.positionPath,
status: statusText(e.status),
createdAt: date2Thai(e.createdAt),
birthday: e.dateOfBirth == null ? "-" : date2Thai(e.dateOfBirth),
educationOld: e.educationOld,
organizationPositionOld: e.organizationPositionOld,
positionTypeOld: e.positionTypeOld,
positionLevelOld: e.positionLevelOld,
positionNumberOld: e.positionNumberOld,
salary: e.salary,
positionDate: e.positionDate,
}));
rows2.value = rows.value.filter(
(e: orgFilter) =>
e.orgName !== null &&
e.status !== "ส่งรายชื่อไปออกคำสั่ง" &&
e.status !== "ออกคำสั่งเสร็จแล้ว" &&
e.educationOld &&
e.organizationPositionOld &&
e.positionTypeOld &&
e.positionLevelOld &&
e.positionNumberOld &&
e.salary !== null &&
e.positionDate
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
//
@ -208,15 +192,14 @@ const fecthTypeOption = async () => {
.get(config.API.typeOrder())
.then((res) => {
optionsType.value = res.data.result.filter(
(e: OpType) =>
e.commandCode === "C-PM-05"
(e: OpType) => e.commandCode === "C-PM-05"
);
type.value = optionsType.value[0].id;
})
.catch((e) => {
messageError($q, e);
});
};
//
const openModalTree = (id: string) => {
personalId.value = id;
@ -227,12 +210,11 @@ const openModalTree = (id: string) => {
const clickDelete = (id: string) => {
dialogRemove($q, () => deleteAppoint(id));
};
//
const deleteAppoint = async (id: string) => {
showLoader();
await http
.delete(config.API.appointmentDelete(id))
.delete(config.API.appointEmployeeByid(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
@ -244,7 +226,6 @@ const deleteAppoint = async (id: string) => {
hideLoader();
});
};
// modal
const closeModalTree = async () => {
await fecthlistappointment();
@ -257,10 +238,22 @@ const nextPage = (id: string) => {
path: `appoint-promote/detail/${id}`,
});
};
onMounted(() => {
fecthlistappointment();
});
// input
const resetFilter = () => {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
// modal
const clickClose = () => {
modal.value = false;
};
// modal
const popup = () => {
modal.value = true;
filterKeyword2.value = "";
fecthTypeOption();
};
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
@ -271,27 +264,65 @@ onMounted(() => {
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn @click="popup()" size="14px" flat round color="add" icon="mdi-account-arrow-right">
<q-btn
@click="popup()"
size="14px"
flat
round
color="add"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
<q-space />
<q-input class="col-xs-12 col-sm-3 col-md-2" standout dense v-model="filterKeyword" ref="filterRef" outlined
debounce="300" placeholder="ค้นหา">
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
>
<template v-slot:append>
<q-icon v-if="filterKeyword == ''" name="search" />
<q-icon v-if="filterKeyword !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
<q-icon
v-if="filterKeyword !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
<q-select v-model="visibleColumns" multiple outlined dense options-dense :display-value="$q.lang.table.columns"
emit-value map-options :options="columns" option-value="name" options-cover style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm" />
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table :columns="columns" :rows="rows" :filter="filterKeyword" row-key="citizenId"
:visible-columns="visibleColumns" v-model:pagination="pagination">
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="citizenId"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
@ -302,19 +333,38 @@ onMounted(() => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props" @click="nextPage(props.row.personalId)">
<q-td
key="no"
:props="props"
@click="nextPage(props.row.personalId)"
>
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props" @click="nextPage(props.row.personalId)">
<q-td
key="citizenId"
:props="props"
@click="nextPage(props.row.personalId)"
>
{{ props.row.citizenId }}
</q-td>
<q-td key="fullname" :props="props" @click="nextPage(props.row.personalId)">
<q-td
key="fullname"
:props="props"
@click="nextPage(props.row.personalId)"
>
{{ props.row.fullname }}
</q-td>
<q-td key="organizationName" :props="props" @click="nextPage(props.row.personalId)">
<div v-if="props.row.orgName !== null ||
props.row.positionPath !== null
">
<q-td
key="organizationName"
:props="props"
@click="nextPage(props.row.personalId)"
>
<div
v-if="
props.row.orgName !== null ||
props.row.positionPath !== null
"
>
<div class="col-4">
<div class="text-weight-medium">
{{
@ -322,20 +372,20 @@ onMounted(() => {
}}
{{
props.row.organizationShortName !== null
? `(${props.row.organizationShortName})`
: ""
? `(${props.row.organizationShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.positionPath !== null
? props.row.positionPath
: "-"
? props.row.positionPath
: "-"
}}
{{
props.row.positionNumber !== null
? `(${props.row.positionNumber})`
: ""
? `(${props.row.positionNumber})`
: ""
}}
</div>
</div>
@ -346,29 +396,73 @@ onMounted(() => {
</div>
</div>
</q-td>
<q-td key="birthday" :props="props" @click="nextPage(props.row.personalId)">
<q-td
key="birthday"
:props="props"
@click="nextPage(props.row.personalId)"
>
{{ props.row.birthday }}
</q-td>
<q-td key="createdAt" :props="props" @click="nextPage(props.row.personalId)">
<q-td
key="createdAt"
:props="props"
@click="nextPage(props.row.personalId)"
>
{{ props.row.createdAt }}
</q-td>
<q-td key="status" :props="props" @click="nextPage(props.row.personalId)">
<q-td
key="status"
:props="props"
@click="nextPage(props.row.personalId)"
>
{{ props.row.status }}
</q-td>
<q-td auto-width>
<q-btn v-if="props.row.status !== 'ส่งรายชื่อไปออกคำสั่ง' &&
props.row.status !== 'ออกคำสั่งแล้ว'
" icon="mdi-dots-vertical" size="12px" color="grey-7" flat round dense>
<q-menu transition-show="jump-down" transition-hide="jump-up">
<q-btn
v-if="
props.row.status !== 'ส่งรายชื่อไปออกคำสั่ง' &&
props.row.status !== 'ออกคำสั่งแล้ว'
"
icon="mdi-dots-vertical"
size="12px"
color="grey-7"
flat
round
dense
>
<q-menu
transition-show="jump-down"
transition-hide="jump-up"
>
<q-list dense style="min-width: 100px">
<q-item clickable v-close-popup @click="openModalTree(props.row.personalId)">
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
<q-icon color="primary" size="xs" name="mdi-bookmark-outline" />
<q-item
clickable
v-close-popup
@click="openModalTree(props.row.personalId)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section>เลอกหนวยงาน/ตำแหน</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="clickDelete(props.row.personalId)">
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
<q-item
clickable
v-close-popup
@click="clickDelete(props.row.personalId)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-tooltip>ลบขอม</q-tooltip>
<q-icon color="red" size="xs" name="mdi-delete" />
</q-item-section>
@ -386,9 +480,21 @@ onMounted(() => {
</div>
</q-card>
<Dialogbody v-model:Modal="modal" :clickClose="clickClose" :optionsType="optionsType" :rows2="rows2"
v-model:filterKeyword2="filterKeyword2" v-model:type="type" :nextPage="nextPage"
:fecthlistappointment="fecthlistappointment" />
<DialogOrgTree v-model:modal="modalTree" :close="closeModalTree" :personal="personal" :personalId="personalId" />
<Dialogbody
v-model:Modal="modal"
:clickClose="clickClose"
:optionsType="optionsType"
:rows2="rows2"
v-model:filterKeyword2="filterKeyword2"
v-model:type="type"
:nextPage="nextPage"
:fecthlistappointment="fecthlistappointment"
/>
<DialogOrgTree
v-model:modal="modalTree"
:close="closeModalTree"
:personal="personal"
:personalId="personalId"
/>
</template>
<style scoped lang="scss"></style>

View file

@ -59,9 +59,7 @@ const fetchPublishFile = async () => {
hideLoader();
});
};
// json
const loadTreeData = async () => {
expanded.value = [];
await http
@ -69,7 +67,6 @@ const loadTreeData = async () => {
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
@ -81,7 +78,6 @@ const loadTreeData = async () => {
hideLoader();
});
};
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
return true;
@ -92,12 +88,10 @@ function filterByPersonIdNull(obj: any) {
}
return false;
}
// position
const fetchplacementPosition = async () => {
await http
.get(config.API.apppointmentPosition())
.get(config.API.apppointmentPositionUse())
.then((res: any) => {
placementPosition.value = res.data.result;
})
@ -105,9 +99,6 @@ const fetchplacementPosition = async () => {
messageError($q, e);
});
};
const props = defineProps({
personalId: String,
modal: Boolean,
@ -117,10 +108,8 @@ const props = defineProps({
},
personal: Object,
});
const myFilterMethod = (node: any, filter: string) => {
const filt = filter;
return (
(node.name && node.name.indexOf(filt) > -1) ||
(node.organizationName && node.organizationName.indexOf(filt) > -1) ||
@ -138,7 +127,6 @@ const myFilterMethod = (node: any, filter: string) => {
(node.positionLevel && node.positionLevel.indexOf(filt) > -1)
);
};
const validateData = async () => {
checkValidate.value = true;
await myFormPosition.value.validate().then((result: boolean) => {
@ -147,7 +135,6 @@ const validateData = async () => {
}
});
};
const saveAppoint = async () => {
myFormPosition.value.validate().then(async (result: boolean) => {
if (props.personalId !== undefined) {
@ -165,8 +152,8 @@ const saveAppoint = async () => {
};
showLoader();
await http
.put(config.API.appointmentPosition(id.value), dataAppoint)
.then((res) => {
.put(config.API.appointEmployeePosition(id.value), dataAppoint)
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
@ -182,8 +169,6 @@ const saveAppoint = async () => {
}
});
};
const closeModal = () => {
if (editDataStatus.value == true) {
dialogConfirm(
@ -199,7 +184,6 @@ const closeModal = () => {
closeAndClear();
}
};
const closeAndClear = async () => {
await props.close();
editDataStatus.value = false;