แก้พัฒนา

This commit is contained in:
setthawutttty 2025-04-10 17:21:12 +07:00
parent f228ca20e9
commit 2695c07f7c
5 changed files with 96 additions and 17 deletions

View file

@ -182,6 +182,7 @@ interface DataManageList {
interface ResOrg {
labelName: string;
orgTreeDnaId?: string;
orgCode: string;
orgLevel: number;
orgName: string;

View file

@ -93,7 +93,7 @@ const baseColumns = ref<QTableProps["columns"]>([
{
name: "posTypeName",
align: "left",
label: "ประเภทตำแหน่ง",
label: "ตำแหน่งประเภท",
sortable: true,
field: "posTypeName",
headerStyle: "font-size: 14px",

View file

@ -1,6 +1,6 @@
divdiv
<script setup lang="ts">
import { onMounted, ref, reactive } from "vue";
import { onMounted, ref, reactive, computed } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
@ -65,8 +65,33 @@ const modalRelate = ref<boolean>(false);
const isTarget = ref<string>("");
const posTypeOp = ref<DataOption[]>([]);
const posTypeOpEMP = ref<DataOption[]>([]);
const posLevelOp = ref<DataOption[]>([]);
const posTypeMain = ref<ResGroup[]>([]);
const posTypeMainEMP = ref<ResGroup[]>([]);
const levelComputed = computed(() => {
return formGroupTarget.positions.map((items) => {
if (
formGroupTarget.groupTargetSub !== "EMPLOYEE" &&
formGroupTarget.groupTargetSub !== "EMPLOYEETEMP"
) {
return (
posTypeMain.value.find((v) => items.posTypeId === v.id)?.posLevels || []
);
} else {
const v = posTypeMainEMP.value.find((v) => items.posTypeId === v.id);
return (
v?.posLevels.map((e: any) => ({
id: e.id,
posLevelName: v.posTypeShortName
? `${v.posTypeShortName} ${e.posLevelName}`
: e.posLevelName,
})) || []
);
}
});
});
const formGroupTarget = reactive<FormGroupTargetPlannedGoal>({
groupTarget: "",
@ -255,6 +280,24 @@ function fetchType() {
});
}
}
/** function เรียกข้อมูลกลุ่มงานของ ลูกจ้าง*/
function fetchTypeEMP() {
if (posTypeMain.value.length === 0) {
http
.get(config.API.orgEmployeeType)
.then((res) => {
const data = res.data.result;
posTypeMainEMP.value = data;
posTypeOpEMP.value = data.map((e: ResGroup) => ({
id: e.id,
name: e.posTypeName,
}));
})
.catch((err) => {
messageError($q, err);
});
}
}
/** ดึงข้อมูล */
async function fetchData(id: string) {
@ -529,6 +572,7 @@ function onOpenDialog(data: any) {
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
onMounted(() => {
fetchType();
fetchTypeEMP();
fetchData(projectId.value);
});
</script>
@ -640,11 +684,9 @@ onMounted(() => {
v-if="props.row.groupTarget !== 'OUTSIDERS'"
v-for="row in props.row.position"
>
{{ `${row.posExecutive ?row.posExecutive: "-"}` }}
</div>
<div v-if="props.row.position.length == 0">
-
{{ `${row.posExecutive ? row.posExecutive : "-"}` }}
</div>
<div v-if="props.row.position.length == 0">-</div>
</div>
<div v-else class="table_ellipsis">
{{ col.value ? col.value : "-" }}
@ -1122,7 +1164,17 @@ onMounted(() => {
emit-value
lazy-rules
class="inputgreen"
@update:model-value="updateGroupTarget"
@update:model-value="
updateGroupTarget,
(formGroupTarget.positions = [
{
position: '',
posTypeId: null,
posLevelId: null,
posExecutive: '',
},
])
"
:rules="[
(val:string) =>
!!val || `${'กรุณาเลือกกลุ่มเป้าหมาย'}`,
@ -1159,6 +1211,16 @@ onMounted(() => {
(val:string) =>
!!val || `${'กรุณาเลือกกลุ่มเป้าหมายย่อย'}`,
]"
@update:model-value="
formGroupTarget.positions = [
{
position: '',
posTypeId: null,
posLevelId: null,
posExecutive: '',
},
]
"
/>
</div>
<div
@ -1223,13 +1285,23 @@ onMounted(() => {
outlined
class="inputgreen"
v-model="items.posTypeId"
:options="posTypeOp"
:options="
formGroupTarget.groupTargetSub !== 'EMPLOYEE' &&
formGroupTarget.groupTargetSub !== 'EMPLOYEETEMP'
? posTypeOp
: posTypeOpEMP
"
option-label="name"
option-value="id"
emit-value
map-options
input-class="text-red"
label="ประเภทตำแหน่ง"
:label="
formGroupTarget.groupTargetSub !== 'EMPLOYEE' &&
formGroupTarget.groupTargetSub !== 'EMPLOYEETEMP'
? 'ตำแหน่งประเภท'
: 'กลุ่มงาน'
"
clearable
@update:model-value="updatePosTypeName"
/>
@ -1243,16 +1315,18 @@ onMounted(() => {
outlined
class="inputgreen"
v-model="items.posLevelId"
:options="
posTypeMain.find((v) => items.posTypeId === v.id)
?.posLevels || []
"
:options="levelComputed[index]"
option-label="posLevelName"
option-value="id"
emit-value
map-options
input-class="text-red"
label="ระดับตำแหน่ง"
:label="
formGroupTarget.groupTargetSub !== 'EMPLOYEE' &&
formGroupTarget.groupTargetSub !== 'EMPLOYEETEMP'
? 'ระดับตำแหน่ง'
: 'ระดับชั้นงาน'
"
clearable
/>
</div>
@ -1276,7 +1350,11 @@ onMounted(() => {
<div
class="col"
v-if="formGroupTarget.groupTarget !== 'OUTSIDERS'"
v-if="
formGroupTarget.groupTarget !== 'OUTSIDERS' &&
formGroupTarget.groupTargetSub !== 'EMPLOYEE' &&
formGroupTarget.groupTargetSub !== 'EMPLOYEETEMP'
"
>
<q-input
outlined

View file

@ -180,7 +180,7 @@ async function getOrg(id: string) {
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then(async (res) => {
const data = await res.data.result.map((item: ResOrg) => ({
id: item.orgTreeId,
id: item.orgTreeDnaId,
name: item.orgName,
}));
organizationOpsMain.value = data;

View file

@ -64,7 +64,7 @@ async function fetchReport() {
await http
.get(
config.API.evaluationReport +
`?year=${year.value + 543}&rootId=${nodeId.value}`
`?year=${year.value}&rootId=${nodeId.value}`
)
.then(async (res) => {
const data = await res.data.result;