fix bug
This commit is contained in:
parent
db60969d3f
commit
2f95271b1b
5 changed files with 139 additions and 99 deletions
|
|
@ -100,8 +100,9 @@ export default {
|
|||
orgDeceasedProfile: `${orgPos}/profile/search`,
|
||||
|
||||
//
|
||||
orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId/${id}`,
|
||||
orgCheckAvatarAdmin: (id: string) => `${orgProfile}/avatar/profileid-admin/${id}`,
|
||||
orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId-admin/${id}`,
|
||||
orgCheckAvatarAdmin: (id: string) =>
|
||||
`${orgProfile}/avatar/profileid-admin/${id}`,
|
||||
orgCheckAvatarCard: (path: string) => `${organization}/${path}`, //noPernission
|
||||
|
||||
changePosition: `${organization}/placement/change-position`,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ const avatarProfile = ref<string>("");
|
|||
const filterKeyword = ref<string>("");
|
||||
const position_line = ref<string>("");
|
||||
const position_level = ref<string>("");
|
||||
const position_type = ref<string>("");
|
||||
|
||||
const probation_status = ref<any>();
|
||||
const probation_statusold = ref<string>("");
|
||||
const pagination = ref({
|
||||
|
|
@ -148,9 +150,9 @@ async function getAssignList() {
|
|||
showLoader();
|
||||
await http
|
||||
.get(config.API.probationGetAssignList(personalId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.data;
|
||||
rows.value = data.map((item: FormProbationDetail) => ({
|
||||
.then(async (res) => {
|
||||
const data = await res.data.data;
|
||||
rows.value = await data.map((item: FormProbationDetail) => ({
|
||||
id: item.id,
|
||||
round_no: item.round_no,
|
||||
date_start: date2Thai(new Date(item.date_start)),
|
||||
|
|
@ -160,7 +162,9 @@ async function getAssignList() {
|
|||
chairman: item.chairman,
|
||||
}));
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
|
@ -171,8 +175,8 @@ async function getpersonalList() {
|
|||
showLoader();
|
||||
await http
|
||||
.get(config.API.personal(personalId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.data;
|
||||
.then(async (res) => {
|
||||
const data = await res.data.data;
|
||||
name.value = data.name;
|
||||
position_line.value = data.position_line;
|
||||
position_level.value = data.position_level;
|
||||
|
|
@ -180,24 +184,27 @@ async function getpersonalList() {
|
|||
probation_status.value = data.probation_status;
|
||||
probation_statusold.value = data.probation_status;
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** เปลี่ยนสถานะ */
|
||||
async function selectStatus() {
|
||||
function selectStatus() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
() => {
|
||||
showLoader();
|
||||
await http
|
||||
http
|
||||
.put(config.API.changestatusProbations(personalId.value), {
|
||||
status: probation_status.value,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "แก้ไขสถานะสำเร็จ");
|
||||
.then(async () => {
|
||||
await getpersonalList();
|
||||
await success($q, "แก้ไขสถานะสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -205,7 +212,6 @@ async function selectStatus() {
|
|||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
getpersonalList();
|
||||
});
|
||||
},
|
||||
"ยืนยันการเปลี่ยนสถานะการทดลองปฏิบัติหน้าที่ราชการ",
|
||||
|
|
@ -271,9 +277,7 @@ async function fetchProfilePhoto() {
|
|||
|
||||
/** get ค่า เมื่อโหลดหน้า */
|
||||
onMounted(async () => {
|
||||
await getpersonalList();
|
||||
await getAssignList();
|
||||
fetchProfilePhoto();
|
||||
await Promise.all([getpersonalList(), getAssignList(), fetchProfilePhoto()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -289,7 +293,7 @@ onMounted(async () => {
|
|||
class="q-mr-sm"
|
||||
@click="router.push(`/probation/`)"
|
||||
/>
|
||||
รายละเอียดงานที่ได้รับมอบหมายของ {{ name }}
|
||||
รายละเอียดงานที่ได้รับมอบหมายของ{{ name }}
|
||||
</div>
|
||||
<q-card bordered class="row col-12 text-dark">
|
||||
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
|
||||
|
|
@ -322,7 +326,7 @@ onMounted(async () => {
|
|||
|
||||
<div class="col-xs-6 col-sm-2 row items-center">
|
||||
<div class="col-12">
|
||||
<div class="col-12 text-top">ระดับ</div>
|
||||
<div class="col-12 text-top">ประเภทตำแหน่ง</div>
|
||||
<div class="col-12 text-detail">{{ position_level }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -458,8 +462,7 @@ onMounted(async () => {
|
|||
<q-tooltip>รายละเอียด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsUpdate
|
||||
"
|
||||
v-if="checkPermission($route)?.attrIsUpdate"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
|
|
|
|||
|
|
@ -89,9 +89,9 @@ const router = useRouter();
|
|||
async function fetchEvaluation() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.kpiEvaluationUser + `/${id.value}`)
|
||||
.get(config.API.kpiEvaluationUser + `/admin/${id.value}`)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
const data = await res.data.result;
|
||||
store.dataEvaluation = await data;
|
||||
formProfile.status = await store.convertStatus(data.evaluationStatus);
|
||||
formProfile.result = await store.convertResults(data.evaluationResults);
|
||||
|
|
@ -240,7 +240,7 @@ async function getProfile() {
|
|||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
store.dataProfile = await data;
|
||||
await setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
store.checkStep();
|
||||
}, 1000);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ function fetchRoundOption() {
|
|||
|
||||
roundOp.value = list;
|
||||
store.formQuery.round = list[0].id;
|
||||
fetchList();
|
||||
await fetchList();
|
||||
} else {
|
||||
roundOp.value = [];
|
||||
store.formQuery.round = "";
|
||||
|
|
@ -127,7 +127,7 @@ function fetchRoundOption() {
|
|||
}
|
||||
|
||||
// const status = ref<string>("");
|
||||
function fetchList() {
|
||||
async function fetchList() {
|
||||
showLoader();
|
||||
const body = {
|
||||
page: formQuery.page,
|
||||
|
|
@ -136,13 +136,12 @@ function fetchList() {
|
|||
keyword: store.formQuery.keyword
|
||||
? store.formQuery.keyword.replace(/\s+/g, "")
|
||||
: store.formQuery.keyword,
|
||||
// status: status.value,
|
||||
};
|
||||
|
||||
http
|
||||
await http
|
||||
.post(config.API.kpiUserEvaluation + `/list`, body)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
maxPage.value = Math.ceil(data.total / formQuery.pageSize);
|
||||
totalList.value = data.total;
|
||||
rows.value = data.data;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import avatar from "@/assets/avatar_user.jpg";
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import avatar from "@/assets/avatar_user.jpg";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
|
|
@ -20,19 +18,10 @@ interface ListMain {
|
|||
}
|
||||
|
||||
const profileId = ref<string>("");
|
||||
const rows = ref<ListMain[]>([]);
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
messageError,
|
||||
dialogConfirm,
|
||||
findOrgName,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
const { messageError, findOrgName, showLoader, hideLoader, date2Thai } = mixin;
|
||||
|
||||
const filter = ref<string>("");
|
||||
const mode = ref<any>($q.screen.gt.xs);
|
||||
const profileImg = ref<string>("");
|
||||
const router = useRouter();
|
||||
|
|
@ -50,16 +39,9 @@ const formData = reactive<any>({
|
|||
});
|
||||
const sizeImg = ref<string>("");
|
||||
|
||||
/** ข้อมูลที่เเสดงในตาราง */
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"date_start",
|
||||
"date_finish",
|
||||
"mentors",
|
||||
"commander",
|
||||
]);
|
||||
|
||||
/** หัวตาราง */
|
||||
/** Table */
|
||||
const rows = ref<ListMain[]>([]);
|
||||
const filter = ref<string>("");
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -109,38 +91,45 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"date_start",
|
||||
"date_finish",
|
||||
"mentors",
|
||||
"commander",
|
||||
]);
|
||||
|
||||
function onResize(size: any) {
|
||||
const width = size.width > 100 ? 100 : size.width;
|
||||
sizeImg.value = `${width}px`;
|
||||
}
|
||||
|
||||
function onMobile(type: string) {
|
||||
router.push(`/registry/${type}`);
|
||||
}
|
||||
|
||||
function getMain() {
|
||||
/**
|
||||
* fetch ข้แมูลส่วนตัว
|
||||
*/
|
||||
async function getMain() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.profilePosition + `/${idEva.value}`)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
const data = await res.data.result;
|
||||
formData.prefix = data.prefix;
|
||||
formData.firstName = data.firstName;
|
||||
formData.lastName = data.lastName;
|
||||
formData.position = data.position;
|
||||
|
||||
formData.posTypeName = data.posTypeName;
|
||||
formData.posExecutiveName = data.posExecutiveName;
|
||||
formData.posLevelName = data.posLevelName;
|
||||
formData.org = findOrgName(data);
|
||||
profileId.value = data.profileId;
|
||||
if (data.avatarName) {
|
||||
getImg(data.profileId, data.avatarName);
|
||||
const promises = [];
|
||||
promises.push(getList(data.profileId)); // fetch รายการทดลองงาน
|
||||
if (profileId.value) {
|
||||
promises.push(fetchProfilePhoto(profileId.value)); // fetch รูปโปรไฟล์
|
||||
} else {
|
||||
profileImg.value = avatar;
|
||||
}
|
||||
await getList(data.profileId);
|
||||
await Promise.all(promises);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -150,28 +139,71 @@ function getMain() {
|
|||
});
|
||||
}
|
||||
|
||||
function getList(id: string) {
|
||||
http
|
||||
/**
|
||||
* fetch รายการทดลองงาน
|
||||
* @param id โปรไฟล์
|
||||
*/
|
||||
async function getList(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.probationGetAssignList(id))
|
||||
.then((res) => {
|
||||
const data = res.data.data;
|
||||
.then(async (res) => {
|
||||
const data = await res.data.data;
|
||||
rows.value = data;
|
||||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {});
|
||||
}
|
||||
function getImg(id: string, pathName: string) {
|
||||
http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
|
||||
.then((res) => {
|
||||
profileImg.value = res.data.downloadUrl;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* chceck รูปโปรไฟล์
|
||||
* @param id โปรไฟล์
|
||||
*/
|
||||
async function fetchProfilePhoto(id: string) {
|
||||
await http
|
||||
.get(config.API.orgCheckAvatar(id))
|
||||
.then(async (res) => {
|
||||
// ถ้ามีรูปให่ fetch รูป
|
||||
if (res.data.result.avatarName) {
|
||||
await http
|
||||
.get(
|
||||
config.API.fileByFile(
|
||||
"ทะเบียนประวัติ",
|
||||
"โปรไฟล์",
|
||||
id,
|
||||
res.data.result.avatarName
|
||||
)
|
||||
)
|
||||
.then(async (res) => {
|
||||
profileImg.value = await res.data.downloadUrl;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
// ไม่มีรูปให่ set รูป เป็น default
|
||||
profileImg.value = avatar;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* redairect การทดลองปฏิบัติหน้าที่ราชการ
|
||||
* @param id ทดลองงาน
|
||||
*/
|
||||
function onDetail(id: string) {
|
||||
router.push(`/probation/detail/${profileId.value}/${id}`);
|
||||
}
|
||||
|
|
@ -209,7 +241,7 @@ onMounted(async () => {
|
|||
<div class="row">
|
||||
<div class="col-2 text-center self-center">
|
||||
<q-avatar :size="sizeImg" rounded>
|
||||
<img
|
||||
<q-img
|
||||
:src="profileImg"
|
||||
style="border-radius: 10px; object-fit: cover"
|
||||
/>
|
||||
|
|
@ -218,7 +250,7 @@ onMounted(async () => {
|
|||
<div class="col-10 column justify-center no-wrap">
|
||||
<div class="row text-grey-6">
|
||||
<div class="col-4">ตำแหน่งในสายงาน</div>
|
||||
<div class="col-4">ระดับ</div>
|
||||
<div class="col-4">ประเภทตำแหน่ง</div>
|
||||
<div class="col-4">สังกัด</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
@ -226,7 +258,13 @@ onMounted(async () => {
|
|||
{{ formData.position ? formData.position : "-" }}
|
||||
</div>
|
||||
<div class="col-4">
|
||||
{{ formData.posLevelName ? formData.posLevelName : "-" }}
|
||||
{{
|
||||
formData.posTypeName
|
||||
? formData.posLevelName
|
||||
? `${formData.posTypeName}(${formData.posLevelName})`
|
||||
: formData.posTypeName
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
<div class="col-4">
|
||||
{{ formData.org ? formData.org : "-" }}
|
||||
|
|
@ -289,16 +327,6 @@ onMounted(async () => {
|
|||
<div class="col-12 row">
|
||||
<q-card bordered class="col-12 q-pa-md">
|
||||
<div class="row">
|
||||
<!-- <q-btn
|
||||
@click="router.push(`/probation/add/${profileId}`)"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="add"
|
||||
icon="mdi-plus"
|
||||
>
|
||||
<q-tooltip>เพิ่มงานที่ได้รับมอบหมาย</q-tooltip>
|
||||
</q-btn> -->
|
||||
<q-space />
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
|
|
@ -357,6 +385,7 @@ onMounted(async () => {
|
|||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
|
|
@ -364,12 +393,20 @@ onMounted(async () => {
|
|||
</template>
|
||||
|
||||
<template v-if="$q.screen.gt.xs" v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td
|
||||
v-for="(col, index) in props.cols"
|
||||
:key="col.name"
|
||||
@click="onDetail(props.row.id)"
|
||||
>
|
||||
<q-tr :props="props">
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
color="info"
|
||||
icon="mdi-eye"
|
||||
round
|
||||
@click="onDetail(props.row.id)"
|
||||
>
|
||||
<q-tooltip> ดูรายละเอียด </q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.name">
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue