Merge branch 'develop'

This commit is contained in:
Warunee Tamkoo 2025-05-30 16:37:02 +07:00
commit e1f4c58f62
3 changed files with 175 additions and 148 deletions

View file

@ -24,7 +24,7 @@ export const useRestDataStore = defineStore("Rest", () => {
case "DONEREJECT": case "DONEREJECT":
return "ออกคำสั่งยกเลิกลาออกเสร็จแล้ว"; return "ออกคำสั่งยกเลิกลาออกเสร็จแล้ว";
case "CANCELING": case "CANCELING":
return "กำลังดำเนิดการยกเลิกการ"; return "กำลังดำเนินการยกเลิก";
default: default:
return "-"; return "-";
} }

View file

@ -87,11 +87,14 @@ function onSubmit() {
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
search.value = "";
rows.value = [];
selected.value = [];
} }
function getCommander() { async function getCommander() {
showLoader(); showLoader();
http await http
.put(config.API.commanderPosexe("operate"), { .put(config.API.commanderPosexe("operate"), {
isAct: isAct.value, isAct: isAct.value,
keyword: search.value, keyword: search.value,
@ -104,7 +107,6 @@ function getCommander() {
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
hideLoader();
}) })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
@ -313,6 +315,7 @@ onMounted(() => {
hide-bottom-space hide-bottom-space
dense dense
label="คำค้น" label="คำค้น"
@keydown.enter.prevent="getSearch()"
/> />
</div> </div>
<q-checkbox <q-checkbox
@ -332,7 +335,7 @@ onMounted(() => {
label="ค้นหา" label="ค้นหา"
class="full-width q-pa-sm" class="full-width q-pa-sm"
outline outline
@click.prevent="getCommander" @click.prevent="getSearch()"
> >
</q-btn> </q-btn>
</div> </div>
@ -423,9 +426,14 @@ onMounted(() => {
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit" <q-btn
><q-tooltip>นทกขอม</q-tooltip></q-btn label="บันทึก"
color="secondary"
type="submit"
:disable="selected.length === 0"
> >
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions> </q-card-actions>
</q-form> </q-form>
</q-card> </q-card>

View file

@ -41,8 +41,14 @@ const formCommand = reactive<FormCommand>({
commanderAboveFullname: "", // 1 commanderAboveFullname: "", // 1
commanderAbovePosition: "", // 1 commanderAbovePosition: "", // 1
author: "", // author: "", //
subject: "", // subject: [], //
assignedPosition: "", assignedPosition: "",
commanderPositionOld: "",
commanderOrgOld: "",
commanderOrg: "",
commanderAbovePositionOld: "",
commanderAboveOrgOld: "",
commanderAboveOrg: "",
}); });
const formData = reactive<FormData>({ const formData = reactive<FormData>({
@ -181,150 +187,150 @@ async function onClickDowloadFile(
fileName: string fileName: string
) { ) {
showLoader(); showLoader();
let educations: any = []; // let educations: any = [];
if (profile.value != null) { // if (profile.value != null) {
profile.value.educations.map((e: any) => { // profile.value.educations.map((e: any) => {
educations.push({ // educations.push({
educationLevel: e.educationLevel ?? "", // educationLevel: e.educationLevel ?? "",
finishYear: // finishYear:
e.finishDate == null // e.finishDate == null
? "" // ? ""
: new Date(e.finishDate).getFullYear() + 543, // : new Date(e.finishDate).getFullYear() + 543,
institute: e.institute ?? "", // institute: e.institute ?? "",
}); // });
}); // });
} // }
let certificates: any = []; // let certificates: any = [];
if (profile.value != null) { // if (profile.value != null) {
profile.value.certificates.map((e: any) => { // profile.value.certificates.map((e: any) => {
certificates.push({ // certificates.push({
certificateNo: e.certificateNo ?? "", // certificateNo: e.certificateNo ?? "",
certificateType: e.certificateType ?? "", // certificateType: e.certificateType ?? "",
issuer: e.issuer ?? "", // issuer: e.issuer ?? "",
}); // });
}); // });
} // }
let salaries: any = []; // let salaries: any = [];
if (profile.value != null) { // if (profile.value != null) {
profile.value.salaries.map((e: any) => { // profile.value.salaries.map((e: any) => {
salaries.push({ // salaries.push({
date: e.date == null ? "" : date2Thai(new Date(e.date)), // date: e.date == null ? "" : date2Thai(new Date(e.date)),
position: e.position ?? "", // position: e.position ?? "",
amount: e.amount ?? "", // amount: e.amount ?? "",
}); // });
}); // });
} // }
let trainings: any = []; // let trainings: any = [];
if (profile.value != null) { // if (profile.value != null) {
profile.value.trainings.map((e: any) => { // profile.value.trainings.map((e: any) => {
trainings.push({ // trainings.push({
yearly: e.yearly ?? "", // yearly: e.yearly ?? "",
startDate: e.startDate == null ? "" : date2Thai(new Date(e.startDate)), // startDate: e.startDate == null ? "" : date2Thai(new Date(e.startDate)),
endDate: e.endDate == null ? "" : date2Thai(new Date(e.endDate)), // endDate: e.endDate == null ? "" : date2Thai(new Date(e.endDate)),
name: e.name ?? "", // name: e.name ?? "",
topic: e.topic ?? "", // topic: e.topic ?? "",
}); // });
}); // });
} // }
const data = Object.assign( // const data = Object.assign(
{ educations: educations }, // { educations: educations },
{ certificates: certificates }, // { certificates: certificates },
{ salaries: salaries }, // { salaries: salaries },
{ trainings: trainings }, // { trainings: trainings },
{ // {
fullName: dataPerson.formData.firstName // fullName: dataPerson.formData.firstName
? `${dataPerson.formData.prefix}${dataPerson.formData.firstName} ${dataPerson.formData.lastName}` // ? `${dataPerson.formData.prefix}${dataPerson.formData.firstName} ${dataPerson.formData.lastName}`
: "", // : "",
}, // },
{ // {
position: dataPerson.formData.position // position: dataPerson.formData.position
? dataPerson.formData.position // ? dataPerson.formData.position
: "", // : "",
}, // },
{ // {
positionLevel: dataPerson.formData.posLevelName // positionLevel: dataPerson.formData.posLevelName
? dataPerson.formData.posLevelName // ? dataPerson.formData.posLevelName
: "", // : "",
}, // },
{ posNo: dataPerson.formData.posNo ? dataPerson.formData.posNo : "" }, // { posNo: dataPerson.formData.posNo ? dataPerson.formData.posNo : "" },
{ org: dataPerson.formData ? dataPerson.formData.org : "" }, // { org: dataPerson.formData ? dataPerson.formData.org : "" },
{ // {
birthDate: dataPerson.formData.birthDate // birthDate: dataPerson.formData.birthDate
? date2Thai(new Date(dataPerson.formData.birthDate)) // ? date2Thai(new Date(dataPerson.formData.birthDate))
: "", // : "",
}, // },
{ // {
govAge: profile.value.government // govAge: profile.value.government
? `${ // ? `${
profile.value.government.govAge.year !== 0 // profile.value.government.govAge.year !== 0
? `${profile.value.government.govAge.year} ปี` // ? `${profile.value.government.govAge.year} `
: "" // : ""
} ${ // } ${
profile.value.government.govAge.month !== 0 // profile.value.government.govAge.month !== 0
? `${profile.value.government.govAge.month} เดือน` // ? `${profile.value.government.govAge.month} `
: "" // : ""
} ${ // } ${
profile.value.government.govAge.day !== 0 // profile.value.government.govAge.day !== 0
? `${profile.value.government.govAge.day} วัน` // ? `${profile.value.government.govAge.day} `
: "" // : ""
}` // }`
: ``, // : ``,
}, // },
{ // {
positionLevelNew: // positionLevelNew:
profile.value == null // profile.value == null
? "" // ? ""
: profile.value.type == "EXPERT" // : profile.value.type == "EXPERT"
? "ชำนาญการ" // ? ""
: "ชำนาญการพิเศษ", // : "",
}, // },
tp === "EV1_005" // tp === "EV1_005"
? { salary: dataPerson.formData.salary ? dataPerson.formData.salary : "" } // ? { salary: dataPerson.formData.salary ? dataPerson.formData.salary : "" }
: null, // : null,
tp === "EV1_006" // tp === "EV1_006"
? { // ? {
years: { // years: {
lastTwoYear: toThaiNumber(currentYear - 2 + 543), // lastTwoYear: toThaiNumber(currentYear - 2 + 543),
lastOneYear: toThaiNumber(currentYear - 1 + 543), // lastOneYear: toThaiNumber(currentYear - 1 + 543),
currentYear: toThaiNumber(currentYear + 543), // currentYear: toThaiNumber(currentYear + 543),
}, // },
} // }
: null, // : null,
tp === "EV1_006" || tp === "EV1_008" // tp === "EV1_006" || tp === "EV1_008"
? { commanderFullname: formData.commanderFullname } // ? { commanderFullname: formData.commanderFullname }
: null, // : null,
tp === "EV1_006" || tp === "EV1_008" // tp === "EV1_006" || tp === "EV1_008"
? { commanderPosition: formData.commanderPosition } // ? { commanderPosition: formData.commanderPosition }
: null, // : null,
tp === "EV1_006" ? { commanderOrg: "" } : null, // tp === "EV1_006" ? { commanderOrg: "" } : null,
tp === "EV1_006" || tp === "EV1_008" // tp === "EV1_006" || tp === "EV1_008"
? { commanderAboveFullname: formData.commanderAboveFullname } // ? { commanderAboveFullname: formData.commanderAboveFullname }
: null, // : null,
tp === "EV1_006" || tp === "EV1_008" // tp === "EV1_006" || tp === "EV1_008"
? { commanderAbovePosition: formData.commanderAbovePosition } // ? { commanderAbovePosition: formData.commanderAbovePosition }
: null, // : null,
tp === "EV1_006" ? { commanderAboveOrg: "" } : null, // tp === "EV1_006" ? { commanderAboveOrg: "" } : null,
tp === "EV1_007" ? { positionName: "-" } : null, // tp === "EV1_007" ? { positionName: "-" } : null,
tp === "EV1_007" ? { positionLeaveName: "-" } : null, // tp === "EV1_007" ? { positionLeaveName: "-" } : null,
tp === "EV1_009" ? { dateStart: dataPerson.formData.dateStart } : null, // tp === "EV1_009" ? { dateStart: dataPerson.formData.dateStart } : null,
tp === "EV1_009" // tp === "EV1_009"
? { dateRetireLaw: dataPerson.formData.dateRetireLaw } // ? { dateRetireLaw: dataPerson.formData.dateRetireLaw }
: null, // : null,
tp === "EV1_010" ? { subject: formData.subject } : null, // tp === "EV1_010" ? { subject: formData.subject } : null,
{ typeTh: "เชี่ยวชาญ" }, // { typeTh: "" },
{ posNoWithSym: `(${dataPerson.formData.posNo})` }, // { posNoWithSym: `(${dataPerson.formData.posNo})` },
{ orgNoNewLine: dataPerson.formData.org } // { orgNoNewLine: dataPerson.formData.org }
); // );
const body = { const body = {
template: tp, template: tp,
reportName: templateName, reportName: templateName,
data: data, data: reportData.value,
}; };
await genReport(body, fileName); // await genReport(body, fileName); //
} }
@ -402,7 +408,7 @@ async function uploadfile(uploadUrl: string, file: any) {
}); });
} }
function getData() { async function getData() {
showLoader(); showLoader();
http http
.get(config.API.evaluationExpertise + `/${evaluateId.value}`) .get(config.API.evaluationExpertise + `/${evaluateId.value}`)
@ -418,10 +424,9 @@ function getData() {
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader(); hideLoader();
}); })
.finally(() => {});
} }
function getDetail(type: any) { function getDetail(type: any) {
@ -447,9 +452,23 @@ const keyObject = ref<string[]>([
"assessments", "assessments",
"government", "government",
]); ]);
const reportData = ref<any>();
async function getCheckSpace() {
http
.get(config.API.evaluationReportCheckspecByid(evaluateId.value))
.then((res) => {
reportData.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
}
onMounted(() => { onMounted(() => {
showLoader(); showLoader();
Promise.all([getData(), ...keyObject.value.map(getDetail)]) Promise.all([getData(), getCheckSpace(), ...keyObject.value.map(getDetail)])
.then(() => {}) .then(() => {})
.catch((e) => { .catch((e) => {
hideLoader(); hideLoader();