fix: commander popup
This commit is contained in:
parent
e7e767e7f9
commit
cb7f021834
9 changed files with 231 additions and 172 deletions
|
|
@ -48,15 +48,6 @@ const pagination = ref({
|
|||
|
||||
const rows = ref<any[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "posNo",
|
||||
align: "left",
|
||||
label: "เลขที่ตำแหน่ง",
|
||||
sortable: true,
|
||||
field: "posNo",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "fullName",
|
||||
align: "left",
|
||||
|
|
@ -70,11 +61,20 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "posExecutiveName",
|
||||
name: "posNo",
|
||||
align: "left",
|
||||
label: "ตำแหน่งทางการบริหาร",
|
||||
label: "เลขที่ตำแหน่ง",
|
||||
sortable: true,
|
||||
field: "posExecutiveName",
|
||||
field: "posNo",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "positionSign",
|
||||
align: "left",
|
||||
label: "ตำแหน่งใต้ลายเซ็น",
|
||||
sortable: true,
|
||||
field: "positionSign",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
|
@ -127,60 +127,61 @@ async function getData() {
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
if (selected.value.length !== 0) {
|
||||
dialogConfirm($q, async () => {
|
||||
if (props.keycloakUserId) {
|
||||
const body = selected.value.map((items: any, index: any) => ({
|
||||
seq: index,
|
||||
prefix: items.prefix,
|
||||
firstName: items.firstName,
|
||||
lastName: items.lastName,
|
||||
positionName: items.position,
|
||||
profileId: items.id,
|
||||
keycloakId: items.keycloakId,
|
||||
...(items.posExecutiveName
|
||||
? { PositionExecutiveName: items.posExecutiveName }
|
||||
: {}),
|
||||
}));
|
||||
showLoader();
|
||||
const profileSuffix =
|
||||
(props.profileType?.toLocaleLowerCase() as string) === "officer"
|
||||
? ""
|
||||
: "-employee";
|
||||
// if (selected.value.length !== 0) {
|
||||
dialogConfirm($q, async () => {
|
||||
if (props.keycloakUserId) {
|
||||
const body = selected.value.map((items: any, index: any) => ({
|
||||
seq: index,
|
||||
prefix: items.prefix,
|
||||
firstName: items.firstName,
|
||||
lastName: items.lastName,
|
||||
positionName: items.position,
|
||||
profileId: items.id,
|
||||
keycloakId: items.keycloakId,
|
||||
PositionExecutiveName: items.positionSign,
|
||||
// ...(items.positionSign
|
||||
// ? { PositionExecutiveName: items.positionSign }
|
||||
// : {}),
|
||||
}));
|
||||
showLoader();
|
||||
const profileSuffix =
|
||||
(props.profileType?.toLocaleLowerCase() as string) === "officer"
|
||||
? ""
|
||||
: "-employee";
|
||||
|
||||
const apiEndpoint =
|
||||
routeName.value === "resignReject" ||
|
||||
routeName.value === "resignRejectEMP"
|
||||
? config.API.addResignCancel(
|
||||
profileSuffix,
|
||||
props.type?.toLocaleLowerCase() as string,
|
||||
pageId.value
|
||||
)
|
||||
: config.API.addResign(
|
||||
profileSuffix,
|
||||
props.type?.toLocaleLowerCase() as string,
|
||||
pageId.value
|
||||
);
|
||||
await http
|
||||
.post(apiEndpoint, body)
|
||||
.then(async () => {
|
||||
await props.getData?.(pageId.value);
|
||||
closeDialog();
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 คน");
|
||||
}
|
||||
const apiEndpoint =
|
||||
routeName.value === "resignReject" ||
|
||||
routeName.value === "resignRejectEMP"
|
||||
? config.API.addResignCancel(
|
||||
profileSuffix,
|
||||
props.type?.toLocaleLowerCase() as string,
|
||||
pageId.value
|
||||
)
|
||||
: config.API.addResign(
|
||||
profileSuffix,
|
||||
props.type?.toLocaleLowerCase() as string,
|
||||
pageId.value
|
||||
);
|
||||
await http
|
||||
.post(apiEndpoint, body)
|
||||
.then(async () => {
|
||||
await props.getData?.(pageId.value);
|
||||
closeDialog();
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 คน");
|
||||
// }
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue