Compare commits
No commits in common. "dev" and "v1.1.106" have entirely different histories.
19 changed files with 95 additions and 293 deletions
|
|
@ -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";
|
||||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@
|
|||
round
|
||||
dense
|
||||
@click="close"
|
||||
@keydown.enter.prevent
|
||||
@keydown.space.prevent
|
||||
style="color: #ff8080; background-color: #ffdede"
|
||||
/>
|
||||
</q-toolbar>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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="`${'วันที่สิ้นสุด'}`"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -889,8 +889,8 @@ function handleSortByDate() {
|
|||
hideLoader();
|
||||
}
|
||||
},
|
||||
"ยืนยันการจัดลำดับ",
|
||||
"ต้องการยืนยันการจัดลำดับข้อมูลตามวันที่คำสั่งมีผลใช่หรือไม่?"
|
||||
"ยืนยันการเรียงลำดับข้อมูล",
|
||||
"ต้องการยืนยันการเรียงลำดับข้อมูลนี้ใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -941,10 +941,10 @@ onMounted(async () => {
|
|||
flat
|
||||
dense
|
||||
color="indigo-5"
|
||||
icon="mdi-calendar-export"
|
||||
icon="mdi-sort-alphabetical-descending"
|
||||
@click="handleSortByDate()"
|
||||
>
|
||||
<q-tooltip>จัดลำดับตามวันที่คำสั่งมีผล</q-tooltip>
|
||||
<q-tooltip>เรียงลำดับข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import type {
|
|||
} from "@/modules/05_placement/interface/request/Main";
|
||||
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||
|
||||
export const useProfileDataStore = defineStore("profilePlacenent", () => {
|
||||
interface profile {
|
||||
main: { columns: String[] };
|
||||
education: { columns: String[] };
|
||||
|
|
@ -28,7 +29,6 @@ interface profile {
|
|||
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,
|
||||
};
|
||||
});
|
||||
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
||||
interface placementOrder {
|
||||
mappingPosition: { columns: String[] };
|
||||
}
|
||||
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
||||
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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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'">
|
||||
|
|
|
|||
|
|
@ -313,7 +313,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, "ลบข้อมูลสำเร็จ");
|
||||
|
|
@ -606,10 +606,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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -281,21 +264,6 @@ function getStatusColor(statusText: string) {
|
|||
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,17 +313,6 @@ 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"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue