แก้ไขโครงการ/หลักสูตรการฝึกอบรม เป้าหมาย

This commit is contained in:
setthawutttty 2024-12-26 12:02:40 +07:00
parent 90d6421a9e
commit 8876d481a9
3 changed files with 40 additions and 28 deletions

View file

@ -47,6 +47,7 @@ const checkRoutePermission = ref<boolean>(
);
const plannedGoals = ref<ResPlannedGoals[]>([]);
const plannedGoalsData = ref<ResPlannedGoals[]>([]);
const plannedPeoples = ref<ResPeople[]>([]);
const actualGoals = ref<ResActualGoals[]>([]);
const actualPeoples = ref<ResPeople[]>([]);
@ -253,6 +254,7 @@ async function fetchData(id: string) {
actualGoals.value = data.actualGoals;
actualPeoples.value = data.actualPeoples;
plannedGoals.value = data.plannedGoals;
plannedGoalsData.value = data.plannedGoals;
plannedPeoples.value = data.plannedPeoples;
})
.catch((err) => {
@ -287,6 +289,7 @@ function onClickOpenDialog(type: string, target: string) {
/** เพิ่ม/แก้ไขกลุ่มเป้าหมาย */
function onSubmitGroup() {
dialogConfirm($q, async () => {
showLoader();
if (isTarget.value === "planned") {
await http
.put(
@ -362,6 +365,7 @@ function onSubmitGroup() {
/** เพิ่มผู้เกี่ยวข้อง */
function onSubmitRelate() {
dialogConfirm($q, async () => {
showLoader();
if (isTarget.value === "planned") {
await http
.put(
@ -487,6 +491,25 @@ function deleteTargetData(index: any) {
formGroupTarget.positions.splice(index, 1);
}
function onOpenDialog(data: any) {
isEdit.value = true;
isTarget.value = "planned";
editId.value = data.id;
formGroupTarget.type = data.type;
formGroupTarget.groupTarget = data.groupTarget;
formGroupTarget.groupTargetSub = data.groupTargetSub;
formGroupTarget.amount = data.amount;
formGroupTarget.positions = (
plannedGoalsData.value.find((item: any) => item.id === data.id)?.position ||
[]
).map((pos: any) => ({
position: pos.position,
posTypeId: pos.posTypeId || null,
posLevelId: pos.posLevelId || null,
}));
newModalGroupTarget.value = true;
}
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
onMounted(() => {
fetchType();
@ -542,7 +565,6 @@ onMounted(() => {
<div class="col-12">
<d-table
for="table"
ref="table"
:columns="columnsPlannedGoals"
:rows="plannedGoals"
row-key="id"
@ -572,19 +594,7 @@ onMounted(() => {
color="primary"
icon="mdi-pencil-outline"
size="14px"
@click="
() => {
isEdit = true;
isTarget = 'planned';
editId = props.row.id;
formGroupTarget.type = props.row.type;
formGroupTarget.groupTarget = props.row.groupTarget;
formGroupTarget.groupTargetSub = props.row.groupTargetSub;
formGroupTarget.amount = props.row.amount;
formGroupTarget.positions = props.row.position;
newModalGroupTarget = true;
}
"
@click="onOpenDialog(props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip></q-btn
>

View file

@ -30,13 +30,7 @@ interface FormGroupTarget {
}
interface FormGroupTargetPlannedGoal {
positions: [
{
position: string;
posTypeId: string | null;
posLevelId: string | null;
}
];
positions: PositionsType[];
plannedGoalPositions?: [
{
position: string;
@ -53,6 +47,11 @@ interface FormGroupTargetPlannedGoal {
amount: number | null;
}
interface PositionsType {
position: string;
posTypeId: string | null;
posLevelId: string | null;
}
interface FormGroupRelate {
relate: string;
amount: number | null;

View file

@ -96,19 +96,21 @@ interface ResPlannedGoals {
posLevelPlannedId: string;
}
];
positions?: [
{
position: string;
posTypePlannedId: string;
posLevelPlannedId: string;
}
];
position: PositionsType[];
posTypePlannedId: string;
posLevelPlannedId: string;
type: string | null;
amount: number | null;
}
interface PositionsType {
id: string;
posLevel: string;
posLevelId: string;
posType: string;
posTypeId: string;
position: string;
}
interface ResRecord {
commandDate: Date | null;
commandNumber: string | null;
@ -219,4 +221,5 @@ export type {
ResHistory,
ResPrefix,
ResRisk,
PositionsType
};