ต่อ API
This commit is contained in:
parent
8be5a28594
commit
bf4143ece4
2 changed files with 31 additions and 30 deletions
|
|
@ -22,6 +22,7 @@ export default {
|
||||||
probationsGetAssign: (assignId: string) =>
|
probationsGetAssign: (assignId: string) =>
|
||||||
`${probation}/assign/probation-assign?assign_id=${assignId}`,
|
`${probation}/assign/probation-assign?assign_id=${assignId}`,
|
||||||
summarySurveyDetail: (id: string) => `${probation}/survey?assign_id=${id}`,
|
summarySurveyDetail: (id: string) => `${probation}/survey?assign_id=${id}`,
|
||||||
|
summaryDetail: () => `${probation}/survey`,
|
||||||
saveEditAssign: (personalId: string) =>
|
saveEditAssign: (personalId: string) =>
|
||||||
`${probation}/assign/probation-assign?id=${personalId}`,
|
`${probation}/assign/probation-assign?id=${personalId}`,
|
||||||
saveFinish: (personalId: string) =>
|
saveFinish: (personalId: string) =>
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,10 @@ const classBordered = ref<string>("");
|
||||||
async function getSurveyData() {
|
async function getSurveyData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.summarySurveyDetail(assignId.value))
|
.get(config.API.summaryDetail())
|
||||||
.then(async (res: any) => {
|
.then(async (res: any) => {
|
||||||
const data = await res.data.data;
|
const data = await res.data.data.data;
|
||||||
|
assignId.value = res.data.data.assignId;
|
||||||
if (data !== null) {
|
if (data !== null) {
|
||||||
answer1.value = data.answer1;
|
answer1.value = data.answer1;
|
||||||
answer2.value = data.answer2;
|
answer2.value = data.answer2;
|
||||||
|
|
@ -56,33 +57,32 @@ async function getSurveyData() {
|
||||||
|
|
||||||
/** save ข้อมูล */
|
/** save ข้อมูล */
|
||||||
async function save() {
|
async function save() {
|
||||||
await myForm.value!.validate().then((result: boolean) => {
|
if (answer3.value !== 0) {
|
||||||
if (result && answer3.value !== 0) {
|
const data = {
|
||||||
const data = {
|
answer1: answer1.value,
|
||||||
answer1: answer1.value,
|
answer2: answer2.value,
|
||||||
answer2: answer2.value,
|
answer3: answer3.value,
|
||||||
answer3: answer3.value,
|
};
|
||||||
};
|
dialogConfirm($q, async () => {
|
||||||
dialogConfirm($q, async () => {
|
showLoader();
|
||||||
showLoader();
|
await http
|
||||||
await http
|
.post(config.API.summarySurveyDetail(assignId.value), data)
|
||||||
.post(config.API.summarySurveyDetail(assignId.value), data)
|
.then((res: any) => {
|
||||||
.then((res: any) => {
|
success($q, "บันทึกสำเร็จ");
|
||||||
success($q, "บันทึกสำเร็จ");
|
getSurveyData();
|
||||||
getSurveyData();
|
})
|
||||||
})
|
.catch((e: any) => {
|
||||||
.catch((e: any) => {
|
messageError($q, e);
|
||||||
messageError($q, e);
|
})
|
||||||
})
|
.finally(() => {
|
||||||
.finally(() => {
|
hideLoader();
|
||||||
hideLoader();
|
});
|
||||||
});
|
});
|
||||||
});
|
} else if (answer3.value == 0) {
|
||||||
} else if (answer3.value == 0) {
|
classBordered.value = "border_custom";
|
||||||
classBordered.value = "border_custom";
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ถ้าเป็น 0 ใส่ class */
|
/** ถ้าเป็น 0 ใส่ class */
|
||||||
watch(answer3, () => {
|
watch(answer3, () => {
|
||||||
if (answer3.value == 0) {
|
if (answer3.value == 0) {
|
||||||
|
|
@ -229,9 +229,9 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator />
|
<q-separator v-if="status" />
|
||||||
|
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right" v-if="status">
|
||||||
<q-btn label="บันทึก" color="secondary" type="submit"
|
<q-btn label="บันทึก" color="secondary" type="submit"
|
||||||
><q-tooltip>บันทึกข้อมูล</q-tooltip></q-btn
|
><q-tooltip>บันทึกข้อมูล</q-tooltip></q-btn
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue