fix ทดลองงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-26 17:15:07 +07:00
parent 546003492d
commit 008c47084e
4 changed files with 26 additions and 25 deletions

View file

@ -17,14 +17,18 @@ const mixin = useCounterMixin();
const { dialogConfirm, onSearchDataTable } = mixin;
const dataMapToSend = computed(() => {
return selected.value.map((i: any) => ({
id: i.id,
profileId: null,
prefix: null,
firstName: null,
lastName: null,
citizenId: null,
}));
const firstSelected = selected.value[0];
return firstSelected
? firstSelected.directors.map((i: any) => ({
id: firstSelected.id,
profileId: i.profileId,
prefix: i.prefix,
firstName: i.firstName,
lastName: i.lastName,
citizenId: i.citizenId,
rootId: i.rootId,
}))
: [];
});
const filterKeyword = defineModel<string>("filterKeyword", { required: true });

View file

@ -280,8 +280,10 @@ function onAddPerson() {
actFullName: item.actFullName,
posNo: item.posNo,
role: member.value,
rootId: item.orgRootId,
}));
rows.value = [...rows.value, ...data];
rows.value.push(...data);
const roleOrder: Record<"chairman" | "committee" | "caregiver", number> = {
chairman: 0,
committee: 1,
@ -294,6 +296,7 @@ function onAddPerson() {
roleOrder[b.role as keyof typeof roleOrder]
);
});
close();
}
@ -365,25 +368,24 @@ function changeFormData() {
function onSubmit() {
const body = {
topic: topic.value,
persons: rows.value.map(
({ prefix, firstName, lastName, citizenId, ...newData }) => newData
),
persons: rows.value.map(({ ...newData }) => newData),
};
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
showLoader();
http
await http
.put(config.API.appointMain + `/${id.value}`, body)
.then(async (res) => {
.then(async () => {
await getData();
success($q, "บันทึกข้อมูลสำเร็จ");
isSave.value = false;
hideLoader();
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
});
}
@ -446,17 +448,11 @@ async function onAct() {
selected.value = [];
}
function resetFilter() {
pagination.value.page = 1;
filterKeyword.value = "";
getPerson();
}
watch(
() => modal.value,
() => {
if (modal.value) {
filterKeyword.value = "";
optionsTypeMain.value = optionsType.value;
const optionData = optionsType.value;
const caregiverCount = rows.value.filter(

View file

@ -96,6 +96,7 @@ interface AppointMainRows {
topic: string;
commandNo: string;
status: string;
directors: any[];
}
interface FormAppointData {
@ -130,6 +131,7 @@ interface MemBerType {
posNo: string;
actFullName: string;
isDirector?: boolean;
orgRootId?: string;
}
interface FormDataAppoint {

View file

@ -275,7 +275,6 @@ async function fetchCommandType() {
(v: ListCommand) => v.code == props.commandTypeCode
);
commandType.value = commandOp.value[0].id;
console.log("🚀 ~ fetchCommandType ~ commandType.value:", commandType.value);
}
/**