no message

This commit is contained in:
Kittapath 2023-07-11 10:41:31 +07:00
parent dc05b4740c
commit cf343f7b8f
19 changed files with 2595 additions and 2416 deletions

View file

@ -597,34 +597,36 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileAssessmentId(profileId.value)) await http
.then((res) => { .get(config.API.profileAssessmentId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
name: e.name, id: e.id,
point1Total: e.point1Total, name: e.name,
point1: e.point1, point1Total: e.point1Total,
point2Total: e.point2Total, point1: e.point1,
point2: e.point2, point2Total: e.point2Total,
pointSumTotal: e.pointSumTotal, point2: e.point2,
pointSum: e.pointSum, pointSumTotal: e.pointSumTotal,
date: new Date(e.date), pointSum: e.pointSum,
createdAt: new Date(e.createdAt), date: new Date(e.date),
createdFullName: e.createdFullName, createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -714,29 +716,31 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileAssessmentId(profileId.value), { await http
id: id.value, .post(config.API.profileAssessmentId(profileId.value), {
name: name.value, id: id.value,
point1Total: point1Total.value, name: name.value,
point1: point1.value, point1Total: point1Total.value,
point2Total: point2Total.value, point1: point1.value,
point2: point2.value, point2Total: point2Total.value,
pointSumTotal: pointSumTotal.value, point2: point2.value,
pointSum: pointSum.value, pointSumTotal: pointSumTotal.value,
date: dateToISO(date.value), pointSum: pointSum.value,
}) date: dateToISO(date.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -489,32 +489,34 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileHonorId(profileId.value)) await http
.then((res) => { .get(config.API.profileHonorId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
issuer: e.issuer, id: e.id,
detail: e.detail, issuer: e.issuer,
issueDate: new Date(e.issueDate), detail: e.detail,
refCommandNo: e.refCommandNo, issueDate: new Date(e.issueDate),
refCommandDate: refCommandNo: e.refCommandNo,
e.refCommandDate == null ? null : new Date(e.refCommandDate), refCommandDate:
createdAt: new Date(e.createdAt), e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName, createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -601,27 +603,29 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileHonorId(profileId.value), { await http
id: id.value, .post(config.API.profileHonorId(profileId.value), {
issuer: issuer.value, id: id.value,
detail: detail.value, issuer: issuer.value,
issueDate: dateToISO(issueDate.value), detail: detail.value,
refCommandNo: refCommandNo.value, issueDate: dateToISO(issueDate.value),
refCommandDate: refCommandNo: refCommandNo.value,
refCommandDate.value == null ? null : dateToISO(refCommandDate.value), refCommandDate:
}) refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -589,33 +589,35 @@ const filterSelector = (val: string, update: Function, refData: string) => {
}; };
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileDisId(profileId.value)) await http
.then((res) => { .get(config.API.profileDisId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
level: e.level, id: e.id,
detail: e.detail, level: e.level,
unStigma: e.unStigma, detail: e.detail,
refCommandNo: e.refCommandNo, unStigma: e.unStigma,
refCommandDate: refCommandNo: e.refCommandNo,
e.refCommandDate == null ? null : new Date(e.refCommandDate), refCommandDate:
date: new Date(e.date), e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName, date: new Date(e.date),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -703,28 +705,30 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileDisId(profileId.value), { await http
id: id.value, .post(config.API.profileDisId(profileId.value), {
level: level.value, id: id.value,
detail: detail.value, level: level.value,
unStigma: unStigma.value, detail: detail.value,
refCommandNo: refCommandNo.value, unStigma: unStigma.value,
refCommandDate: refCommandNo: refCommandNo.value,
refCommandDate.value == null ? null : dateToISO(refCommandDate.value), refCommandDate:
date: dateToISO(date.value), refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
}) date: dateToISO(date.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -176,19 +176,21 @@ onMounted(async () => {
}); });
const getData = async () => { const getData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profilePaperId(profileId.value)) await http
.then((res) => { .get(config.API.profilePaperId(profileId.value))
const data = res.data.result; .then((res) => {
files.value = data; const data = res.data.result;
}) files.value = data;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(() => { })
loaderPage(false); .finally(() => {
}); loaderPage(false);
});
}
}; };
const deleteData = async (id: string) => { const deleteData = async (id: string) => {
@ -207,39 +209,41 @@ const deleteData = async (id: string) => {
}; };
const uploadData = async () => { const uploadData = async () => {
if (file.value.length > 0) { if (profileId.value) {
const blob = file.value.slice(0, file.value[0].size); if (file.value.length > 0) {
const newFile = new File(blob, name.value, { const blob = file.value.slice(0, file.value[0].size);
type: file.value[0].type, const newFile = new File(blob, name.value, {
}); type: file.value[0].type,
const formData = new FormData();
formData.append("avatar", newFile);
formData.append("moss", "newFile");
console.log(formData);
loaderPage(true);
await http
.post(config.API.profilePaperId(profileId.value), formData)
.then((res) => {
const data = res.data.result;
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
uploader.value.reset();
name.value = "";
edit.value = false;
emit("update:statusEdit", false);
await getData();
}); });
} else { const formData = new FormData();
// modalError( formData.append("avatar", newFile);
// $q, formData.append("moss", "newFile");
// "", console.log(formData);
// "" loaderPage(true);
// ); await http
getData(); .post(config.API.profilePaperId(profileId.value), formData)
.then((res) => {
const data = res.data.result;
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
uploader.value.reset();
name.value = "";
edit.value = false;
emit("update:statusEdit", false);
await getData();
});
} else {
// modalError(
// $q,
// "",
// ""
// );
getData();
}
} }
}; };

View file

@ -1112,45 +1112,47 @@ const filterSelector = (val: any, update: Function, refData: string) => {
}; };
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileEduId(profileId.value)) await http
.then((res) => { .get(config.API.profileEduId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
level: e.educationLevel, id: e.id,
levelId: e.educationLevelId, level: e.educationLevel,
positionPath: e.positionPath, levelId: e.educationLevelId,
isEducation: e.isEducation, positionPath: e.positionPath,
institute: e.institute, isEducation: e.isEducation,
degree: e.degree, institute: e.institute,
field: e.field, degree: e.degree,
gpa: e.gpa, field: e.field,
country: e.country, gpa: e.gpa,
duration: e.duration, country: e.country,
durationYear: e.durationYear, duration: e.duration,
other: e.other, durationYear: e.durationYear,
fundName: e.fundName, other: e.other,
isDate: e.isDate.toString(), fundName: e.fundName,
finishDate: new Date(e.finishDate), isDate: e.isDate.toString(),
startDate: new Date(e.startDate).getFullYear(), finishDate: new Date(e.finishDate),
endDate: new Date(e.endDate).getFullYear(), startDate: new Date(e.startDate).getFullYear(),
startDate2: new Date(e.startDate), endDate: new Date(e.endDate).getFullYear(),
endDate2: new Date(e.endDate), startDate2: new Date(e.startDate),
createdFullName: e.createdFullName, endDate2: new Date(e.endDate),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -1255,43 +1257,45 @@ const saveData = async () => {
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter( // const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == isEducation.value // (r: any) => r.id == isEducation.value
// ); // );
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileEduId(profileId.value), { await http
id: id.value, .post(config.API.profileEduId(profileId.value), {
// educationLevel: filter[0].name, id: id.value,
educationLevelId: levelId.value, // educationLevel: filter[0].name,
isEducation: isEducation.value, educationLevelId: levelId.value,
institute: institute.value, isEducation: isEducation.value,
degree: degree.value, institute: institute.value,
field: field.value, degree: degree.value,
gpa: gpa.value, field: field.value,
country: country.value, gpa: gpa.value,
duration: duration.value, country: country.value,
durationYear: durationYear.value, duration: duration.value,
other: other.value, durationYear: durationYear.value,
fundName: fundName.value, other: other.value,
isDate: isDate.value == "true" ? true : false, fundName: fundName.value,
finishDate: dateToISO(finishDate.value), isDate: isDate.value == "true" ? true : false,
startDate: finishDate: dateToISO(finishDate.value),
isDate.value == "true" startDate:
? dateToISO(startDate2.value) isDate.value == "true"
: new Date(`${startDate.value}-01-01`), ? dateToISO(startDate2.value)
endDate: : new Date(`${startDate.value}-01-01`),
isDate.value == "true" endDate:
? dateToISO(endDate2.value) isDate.value == "true"
: new Date(`${endDate.value}-01-01`), ? dateToISO(endDate2.value)
}) : new Date(`${endDate.value}-01-01`),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -5,11 +5,12 @@
header="ข้อมูลที่อยู่" header="ข้อมูลที่อยู่"
icon="mdi-map-marker" icon="mdi-map-marker"
:save="saveData" :save="saveData"
:history="true" :history="!statusAdd()"
:changeBtn="changeBtn" :changeBtn="changeBtn"
:disable="statusEdit" :disable="statusEdit"
:cancel="refreshData" :cancel="refreshData"
:historyClick="clickHistory" :historyClick="clickHistory"
:addEmployee="statusAdd()"
/> />
<q-form ref="myform"> <q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
@ -311,6 +312,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
required: true, required: true,
}, },
statusAdd: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(["update:statusEdit"]); const emit = defineEmits(["update:statusEdit"]);
@ -507,8 +512,28 @@ const visibleColumnsHistory = ref<String[]>([
onMounted(async () => { onMounted(async () => {
await getNewData(); await getNewData();
emit("update:statusEdit", false); emit("update:statusEdit", false);
defaultAdd();
}); });
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
addressData.value = {
address: null,
provinceId: null,
districtId: null,
subdistrictId: null,
addressC: null,
provinceIdC: null,
districtIdC: null,
subdistrictIdC: null,
same: "0",
};
}
};
const filterSelector = (val: any, update: Function, refData: string) => { const filterSelector = (val: any, update: Function, refData: string) => {
switch (refData) { switch (refData) {
case "provinceOps": case "provinceOps":
@ -675,10 +700,32 @@ const editData = async () => {
}); });
}; };
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => { const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => { await myform.value.validate().then(async (success: boolean) => {
if (success) { if (success) {
await editData(); if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else { } else {
} }
}); });

View file

@ -486,31 +486,33 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileCertId(profileId.value)) await http
.then((res) => { .get(config.API.profileCertId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
certificateNo: e.certificateNo, id: e.id,
issuer: e.issuer, certificateNo: e.certificateNo,
issueDate: new Date(e.issueDate), issuer: e.issuer,
expireDate: new Date(e.expireDate), issueDate: new Date(e.issueDate),
certificateType: e.certificateType, expireDate: new Date(e.expireDate),
createdFullName: e.createdFullName, certificateType: e.certificateType,
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**

View file

@ -5,11 +5,12 @@
header="ข้อมูลครอบครัว" header="ข้อมูลครอบครัว"
icon="mdi-account-group" icon="mdi-account-group"
:save="saveData" :save="saveData"
:history="true" :history="!statusAdd()"
:changeBtn="changeBtn" :changeBtn="changeBtn"
:disable="statusEdit" :disable="statusEdit"
:cancel="refreshData" :cancel="refreshData"
:historyClick="historyData" :historyClick="historyData"
:addEmployee="statusAdd()"
/> />
<q-form ref="myform" class="col-12"> <q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
@ -1114,6 +1115,10 @@ const props = defineProps({
type: Function, type: Function,
default: () => console.log("not function"), default: () => console.log("not function"),
}, },
statusAdd: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(["update:statusEdit"]); const emit = defineEmits(["update:statusEdit"]);
@ -1171,8 +1176,43 @@ onMounted(async () => {
await fetchPrefix(); await fetchPrefix();
await fetchData(); await fetchData();
emit("update:statusEdit", false); emit("update:statusEdit", false);
defaultAdd();
}); });
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
familyData.value = {
prefixC: null,
prefixIdC: null,
firstnameC: null,
lastnameC: null,
lastnameCOld: null,
occupationC: null,
citizenIdC: null,
liveC: null,
prefixM: null,
prefixIdM: null,
firstnameM: null,
lastnameM: null,
occupationM: null,
citizenIdM: null,
liveM: null,
prefixF: null,
prefixIdF: null,
firstnameF: null,
lastnameF: null,
occupationF: null,
citizenIdF: null,
liveF: null,
same: "0",
childrens: [],
};
}
};
const historyData = async () => { const historyData = async () => {
await fetchHistory(); await fetchHistory();
}; };
@ -1400,10 +1440,32 @@ const editData = async () => {
}); });
}; };
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => { const saveData = async () => {
await myform.value?.validate().then(async (success: boolean) => { await myform.value?.validate().then(async (success: boolean) => {
if (success) { if (success) {
await editData(); if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else { } else {
} }
}); });

View file

@ -5,11 +5,12 @@
header="ข้อมูลส่วนตัว" header="ข้อมูลส่วนตัว"
icon="mdi-account" icon="mdi-account"
:save="saveData" :save="saveData"
:history="true" :history="!statusAdd()"
:changeBtn="changeBtn" :changeBtn="changeBtn"
:disable="statusEdit" :disable="statusEdit"
:cancel="onCancel" :cancel="onCancel"
:historyClick="clickHistory" :historyClick="clickHistory"
:addEmployee="statusAdd()"
/> />
<q-form ref="myform" class="col-12"> <q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-sm"> <div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-sm">
@ -439,6 +440,10 @@ const props = defineProps({
type: Function, type: Function,
default: () => console.log("not function"), default: () => console.log("not function"),
}, },
statusAdd: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(["update:statusEdit"]); const emit = defineEmits(["update:statusEdit"]);
@ -693,8 +698,36 @@ onMounted(async () => {
await fetchPerson(); await fetchPerson();
await fetchData(); await fetchData();
emit("update:statusEdit", false); emit("update:statusEdit", false);
defaultAdd();
}); });
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
informaData.value = {
cardid: null,
age: null,
prefix: null,
prefixId: null,
firstname: null,
lastname: null,
birthDate: new Date(),
genderId: null,
bloodId: null,
nationality: null,
ethnicity: null,
statusId: null,
religionId: null,
tel: null,
employeeType: null,
employeeClass: null,
profileType: null,
};
}
};
const onCancel = async () => { const onCancel = async () => {
if (myform.value != null) { if (myform.value != null) {
myform.value.reset(); myform.value.reset();
@ -1045,11 +1078,33 @@ const editData = async () => {
}); });
}; };
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => { const saveData = async () => {
if (myform.value != null) { if (myform.value != null) {
await myform.value.validate().then(async (success: boolean) => { await myform.value.validate().then(async (success: boolean) => {
if (success) { if (success) {
await editData(); if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else { } else {
} }
}); });

View file

@ -939,41 +939,43 @@ const fetchInsignia = async () => {
}; };
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileInsignId(profileId.value)) await http
.then((res) => { .get(config.API.profileInsignId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
insignia: e.insignia, id: e.id,
insigniaId: e.insigniaId, insignia: e.insignia,
insigniaType: e.insigniaType, insigniaId: e.insigniaId,
year: e.year, insigniaType: e.insigniaType,
no: e.no, year: e.year,
issue: e.issue, no: e.no,
volumeNo: e.volumeNo, issue: e.issue,
volume: e.volume, volumeNo: e.volumeNo,
section: e.section, volume: e.volume,
page: e.page, section: e.section,
receiveDate: new Date(e.receiveDate), page: e.page,
dateAnnounce: new Date(e.dateAnnounce), receiveDate: new Date(e.receiveDate),
refCommandNo: e.refCommandNo, dateAnnounce: new Date(e.dateAnnounce),
refCommandDate: refCommandNo: e.refCommandNo,
e.refCommandDate == null ? null : new Date(e.refCommandDate), refCommandDate:
createdFullName: e.createdFullName, e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -1068,35 +1070,37 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileInsignId(profileId.value), { await http
id: id.value, .post(config.API.profileInsignId(profileId.value), {
insigniaId: insigniaId.value, id: id.value,
insigniaType: insigniaType.value, insigniaId: insigniaId.value,
year: year.value, insigniaType: insigniaType.value,
no: no.value, year: year.value,
issue: issue.value, no: no.value,
volumeNo: volumeNo.value, issue: issue.value,
volume: volume.value, volumeNo: volumeNo.value,
section: section.value, volume: volume.value,
page: page.value, section: section.value,
receiveDate: dateToISO(receiveDate.value), page: page.value,
dateAnnounce: dateToISO(dateAnnounce.value), receiveDate: dateToISO(receiveDate.value),
refCommandNo: refCommandNo.value, dateAnnounce: dateToISO(dateAnnounce.value),
refCommandDate: refCommandNo: refCommandNo.value,
refCommandDate.value == null ? null : dateToISO(refCommandDate.value), refCommandDate:
}) refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -717,33 +717,35 @@ onMounted(async () => {
const fetchData = async () => { const fetchData = async () => {
rows.value = []; rows.value = [];
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileLeaveId(profileId.value)) await http
.then((res) => { .get(config.API.profileLeaveId(profileId.value))
const data = res.data.result; .then((res) => {
// console.log(data); const data = res.data.result;
data.map((e: ResponseObject) => { // console.log(data);
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
typeLeave: e.typeLeave, id: e.id,
dateStartLeave: new Date(e.dateStartLeave), typeLeave: e.typeLeave,
dateEndLeave: new Date(e.dateEndLeave), dateStartLeave: new Date(e.dateStartLeave),
numLeave: e.numLeave, dateEndLeave: new Date(e.dateEndLeave),
sumLeave: e.sumLeave, numLeave: e.numLeave,
totalLeave: e.totalLeave, sumLeave: e.sumLeave,
status: e.status, totalLeave: e.totalLeave,
reason: e.reason, status: e.status,
typeLeaveId: e.typeLeaveId, reason: e.reason,
typeLeaveId: e.typeLeaveId,
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
const filterSelector = (val: any, update: Function, filtername: string) => { const filterSelector = (val: any, update: Function, filtername: string) => {
@ -966,28 +968,30 @@ const clickSave = async () => {
const saveData = async () => { const saveData = async () => {
const sum = Number(numLeave.value) + Number(numUsedLeave.value); const sum = Number(numLeave.value) + Number(numUsedLeave.value);
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileLeaveId(profileId.value), { await http
dateStartLeave: dateToISO(dateRange.value[0]), .post(config.API.profileLeaveId(profileId.value), {
dateEndLeave: dateToISO(dateRange.value[1]), dateStartLeave: dateToISO(dateRange.value[0]),
numLeave: numLeave.value, dateEndLeave: dateToISO(dateRange.value[1]),
sumLeave: numUsedLeave.value, numLeave: numLeave.value,
totalLeave: sum, sumLeave: numUsedLeave.value,
status: statLeave.value, totalLeave: sum,
reason: reason.value, status: statLeave.value,
typeLeaveId: typeLeave.value, reason: reason.value,
}) typeLeaveId: typeLeave.value,
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modalAdd.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modalAdd.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
// /** // /**
@ -1187,27 +1191,29 @@ const addData = async () => {
*/ */
const clickTotal = async () => { const clickTotal = async () => {
rowsTotal.value = []; rowsTotal.value = [];
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileLeaveTotalId(profileId.value)) await http
.then((res) => { .get(config.API.profileLeaveTotalId(profileId.value))
let data = res.data.result; .then((res) => {
data.map((e: ResponseTotalObject) => { let data = res.data.result;
rowsTotal.value.push({ data.map((e: ResponseTotalObject) => {
typeLeaveId: e.typeLeaveId, rowsTotal.value.push({
totalLeave: e.totalLeave, typeLeaveId: e.typeLeaveId,
limitLeave: e.limitLeave, totalLeave: e.totalLeave,
remainLeave: e.remainLeave, limitLeave: e.limitLeave,
typeLeave: e.typeLeave, remainLeave: e.remainLeave,
typeLeave: e.typeLeave,
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
// /** // /**

View file

@ -304,28 +304,30 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileOtherId(profileId.value)) await http
.then((res) => { .get(config.API.profileOtherId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
date: new Date(e.date), id: e.id,
detail: e.detail, date: new Date(e.date),
createdFullName: e.createdFullName, detail: e.detail,
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -409,23 +411,25 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileOtherId(profileId.value), { await http
id: id.value, .post(config.API.profileOtherId(profileId.value), {
date: date.value, id: id.value,
detail: detail.value, date: date.value,
}) detail: detail.value,
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -478,32 +478,34 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileNopaidId(profileId.value)) await http
.then((res) => { .get(config.API.profileNopaidId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
date: new Date(e.date), id: e.id,
detail: e.detail, date: new Date(e.date),
reference: e.reference, detail: e.detail,
refCommandNo: e.refCommandNo, reference: e.reference,
refCommandDate: refCommandNo: e.refCommandNo,
e.refCommandDate == null ? null : new Date(e.refCommandDate), refCommandDate:
createdFullName: e.createdFullName, e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -590,27 +592,29 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileNopaidId(profileId.value), { await http
id: id.value, .post(config.API.profileNopaidId(profileId.value), {
date: dateToISO(date.value), id: id.value,
detail: detail.value, date: dateToISO(date.value),
reference: reference.value, detail: detail.value,
refCommandNo: refCommandNo.value, reference: reference.value,
refCommandDate: refCommandNo: refCommandNo.value,
refCommandDate.value == null ? null : dateToISO(refCommandDate.value), refCommandDate:
}) refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -909,7 +909,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขตำแ
const filterHistory = ref<string>(""); //search data table history const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id ? route.params.id.toString() : ""); const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]); const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]); const visibleColumns = ref<String[]>([]);
@ -1512,51 +1514,53 @@ const fetchPosition = async () => {
}; };
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileSalaryId(profileId.value)) await http
.then((res) => { .get(config.API.profileSalaryId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
date: new Date(e.date), id: e.id,
amount: e.amount, date: new Date(e.date),
positionSalaryAmount: e.positionSalaryAmount, amount: e.amount,
mouthSalaryAmount: e.mouthSalaryAmount, positionSalaryAmount: e.positionSalaryAmount,
oc: e.oc, mouthSalaryAmount: e.mouthSalaryAmount,
ocId: e.ocId, oc: e.oc,
position: e.position, ocId: e.ocId,
positionId: e.positionId, position: e.position,
posNo: e.posNo, positionId: e.positionId,
posNoId: e.posNoId, posNo: e.posNo,
positionLine: e.positionLine, posNoId: e.posNoId,
positionLineId: e.positionLineId, positionLine: e.positionLine,
positionPathSide: e.positionPathSide, positionLineId: e.positionLineId,
positionPathSideId: e.positionPathSideId, positionPathSide: e.positionPathSide,
positionType: e.positionType, positionPathSideId: e.positionPathSideId,
positionTypeId: e.positionTypeId, positionType: e.positionType,
positionLevel: e.positionLevel, positionTypeId: e.positionTypeId,
positionLevelId: e.positionLevelId, positionLevel: e.positionLevel,
positionExecutive: e.positionExecutive, positionLevelId: e.positionLevelId,
positionExecutiveId: e.positionExecutiveId, positionExecutive: e.positionExecutive,
positionExecutiveSide: e.positionExecutiveSide, positionExecutiveId: e.positionExecutiveId,
positionExecutiveSideId: e.positionExecutiveSideId, positionExecutiveSide: e.positionExecutiveSide,
salaryClass: e.salaryClass, positionExecutiveSideId: e.positionExecutiveSideId,
salaryRef: e.salaryRef, salaryClass: e.salaryClass,
refCommandNo: e.refCommandNo, salaryRef: e.salaryRef,
createdFullName: e.createdFullName, refCommandNo: e.refCommandNo,
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
const onSelected = async (id: string) => { const onSelected = async (id: string) => {
@ -1762,36 +1766,38 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileSalaryId(profileId.value), { await http
date: dateToISO(date.value), .post(config.API.profileSalaryId(profileId.value), {
amount: amount.value, date: dateToISO(date.value),
positionSalaryAmount: positionSalaryAmount.value, amount: amount.value,
mouthSalaryAmount: mouthSalaryAmount.value, positionSalaryAmount: positionSalaryAmount.value,
ocId: selected.value, mouthSalaryAmount: mouthSalaryAmount.value,
positionId: positionId.value, ocId: selected.value,
posNoId: posNoId.value, positionId: positionId.value,
positionLineId: positionLineId.value, posNoId: posNoId.value,
positionPathSideId: positionPathSideId.value, positionLineId: positionLineId.value,
positionTypeId: positionTypeId.value, positionPathSideId: positionPathSideId.value,
positionLevelId: positionLevelId.value, positionTypeId: positionTypeId.value,
positionExecutiveId: positionExecutiveId.value, positionLevelId: positionLevelId.value,
positionExecutiveSideId: positionExecutiveSideId.value, positionExecutiveId: positionExecutiveId.value,
salaryClass: salaryClass.value, positionExecutiveSideId: positionExecutiveSideId.value,
salaryRef: salaryRef.value, salaryClass: salaryClass.value,
refCommandNo: refCommandNo.value, salaryRef: salaryRef.value,
}) refCommandNo: refCommandNo.value,
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -918,7 +918,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขตำแ
const filterHistory = ref<string>(""); //search data table history const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id ? route.params.id.toString() : ""); const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<ResponseObjectEmployee[]>([]); const rows = ref<ResponseObjectEmployee[]>([]);
const filter = ref<string>(""); //search data table const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]); const visibleColumns = ref<String[]>([]);
@ -1466,48 +1468,50 @@ const filterSelector = (val: any, update: Function, filtername: string) => {
}; };
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileSalaryEmployeeId(profileId.value)) await http
.then((res) => { .get(config.API.profileSalaryEmployeeId(profileId.value))
const data = res.data.result; .then((res) => {
// console.log(data); const data = res.data.result;
rows.value = []; // console.log(data);
data.map((e: ResponseObjectEmployee) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObjectEmployee) => {
id: e.id, rows.value.push({
date: new Date(e.date), id: e.id,
amount: e.amount, date: new Date(e.date),
positionSalaryAmount: e.positionSalaryAmount, amount: e.amount,
mouthSalaryAmount: e.mouthSalaryAmount, positionSalaryAmount: e.positionSalaryAmount,
oc: e.oc, mouthSalaryAmount: e.mouthSalaryAmount,
ocId: e.ocId, oc: e.oc,
posNo: e.posNo, ocId: e.ocId,
posNoId: e.posNoId, posNo: e.posNo,
posNoEmployee: e.posNoEmployee, posNoId: e.posNoId,
positionEmployeeGroup: e.positionEmployeeGroup, posNoEmployee: e.posNoEmployee,
positionEmployeeGroupId: e.positionEmployeeGroupId, positionEmployeeGroup: e.positionEmployeeGroup,
positionEmployeeLevel: e.positionEmployeeLevel, positionEmployeeGroupId: e.positionEmployeeGroupId,
positionEmployeeLevelId: e.positionEmployeeLevelId, positionEmployeeLevel: e.positionEmployeeLevel,
positionEmployeePosition: e.positionEmployeePosition, positionEmployeeLevelId: e.positionEmployeeLevelId,
positionEmployeePositionId: e.positionEmployeePositionId, positionEmployeePosition: e.positionEmployeePosition,
positionEmployeePositionSide: e.positionEmployeePositionSide, positionEmployeePositionId: e.positionEmployeePositionId,
positionEmployeePositionSideId: e.positionEmployeePositionSideId, positionEmployeePositionSide: e.positionEmployeePositionSide,
salaryClass: e.salaryClass, positionEmployeePositionSideId: e.positionEmployeePositionSideId,
salaryRef: e.salaryRef, salaryClass: e.salaryClass,
refCommandNo: e.refCommandNo, salaryRef: e.salaryRef,
// refCommandDate: new Date(e.refCommandDate), refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName, // refCommandDate: new Date(e.refCommandDate),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
const fetchPositionNumber = async (id: string) => { const fetchPositionNumber = async (id: string) => {
@ -1691,34 +1695,36 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileSalaryEmployeeId(profileId.value), { await http
amount: amount.value, .post(config.API.profileSalaryEmployeeId(profileId.value), {
date: dateToISO(date.value), amount: amount.value,
positionSalaryAmount: positionSalaryAmount.value, date: dateToISO(date.value),
mouthSalaryAmount: mouthSalaryAmount.value, positionSalaryAmount: positionSalaryAmount.value,
ocId: agencyId.value, mouthSalaryAmount: mouthSalaryAmount.value,
// posNoId: posNoId.value, ocId: agencyId.value,
posNoEmployee: posNoEmployee.value, // posNoId: posNoId.value,
positionEmployeeGroupId: employeeGroupId.value, posNoEmployee: posNoEmployee.value,
positionEmployeeLevelId: employeeLevelId.value, positionEmployeeGroupId: employeeGroupId.value,
positionEmployeePositionId: employeePositionId.value, positionEmployeeLevelId: employeeLevelId.value,
positionEmployeePositionSideId: employeePositionSideId.value, positionEmployeePositionId: employeePositionId.value,
salaryClass: salaryClass.value, positionEmployeePositionSideId: employeePositionSideId.value,
salaryRef: salaryRef.value, salaryClass: salaryClass.value,
refCommandNo: refCommandNo.value, salaryRef: salaryRef.value,
}) refCommandNo: refCommandNo.value,
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

File diff suppressed because it is too large Load diff

View file

@ -354,30 +354,32 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileAbiliId(profileId.value)) await http
.then((res) => { .get(config.API.profileAbiliId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
field: e.field, id: e.id,
detail: e.detail, field: e.field,
remark: e.remark, detail: e.detail,
reference: e.reference, remark: e.remark,
createdFullName: e.createdFullName, reference: e.reference,
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -463,25 +465,27 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileAbiliId(profileId.value), { await http
id: id.value, .post(config.API.profileAbiliId(profileId.value), {
field: field.value, id: id.value,
detail: detail.value, field: field.value,
remark: remark.value, detail: detail.value,
reference: reference.value, remark: remark.value,
}) reference: reference.value,
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -753,36 +753,38 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileTrainId(profileId.value)) await http
.then((res) => { .get(config.API.profileTrainId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
name: e.name, id: e.id,
topic: e.topic, name: e.name,
yearly: e.yearly, topic: e.topic,
place: e.place, yearly: e.yearly,
duration: e.duration, place: e.place,
department: e.department, duration: e.duration,
numberOrder: e.numberOrder, department: e.department,
dateOrder: e.dateOrder, numberOrder: e.numberOrder,
startDate: new Date(e.startDate), dateOrder: e.dateOrder,
endDate: new Date(e.endDate), startDate: new Date(e.startDate),
createdFullName: e.createdFullName, endDate: new Date(e.endDate),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -874,31 +876,33 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileTrainId(profileId.value), { await http
id: id.value, .post(config.API.profileTrainId(profileId.value), {
name: name.value, id: id.value,
topic: topic.value, name: name.value,
yearly: yearly.value, topic: topic.value,
place: place.value, yearly: yearly.value,
duration: duration.value, place: place.value,
department: department.value, duration: duration.value,
numberOrder: numberOrder.value, department: department.value,
dateOrder: dateOrder.value, numberOrder: numberOrder.value,
startDate: dateToISO(startDate.value), dateOrder: dateOrder.value,
endDate: dateToISO(endDate.value), startDate: dateToISO(startDate.value),
}) endDate: dateToISO(endDate.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**

View file

@ -554,33 +554,35 @@ onMounted(async () => {
}); });
const fetchData = async () => { const fetchData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.get(config.API.profileDutyId(profileId.value)) await http
.then((res) => { .get(config.API.profileDutyId(profileId.value))
let data = res.data.result; .then((res) => {
rows.value = []; let data = res.data.result;
data.map((e: ResponseObject) => { rows.value = [];
rows.value.push({ data.map((e: ResponseObject) => {
id: e.id, rows.value.push({
dateStart: new Date(e.dateStart), id: e.id,
dateEnd: new Date(e.dateEnd), dateStart: new Date(e.dateStart),
detail: e.detail, dateEnd: new Date(e.dateEnd),
reference: e.reference, detail: e.detail,
refCommandNo: e.refCommandNo, reference: e.reference,
refCommandDate: refCommandNo: e.refCommandNo,
e.refCommandDate == null ? null : new Date(e.refCommandDate), refCommandDate:
createdFullName: e.createdFullName, e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt), createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}); });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
}); });
}) }
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}; };
/** /**
@ -668,28 +670,30 @@ const clickSave = async () => {
* นทกเพมขอม * นทกเพมขอม
*/ */
const saveData = async () => { const saveData = async () => {
loaderPage(true); if (profileId.value) {
await http loaderPage(true);
.post(config.API.profileDutyId(profileId.value), { await http
id: id.value, .post(config.API.profileDutyId(profileId.value), {
dateStart: dateToISO(dateStart.value), id: id.value,
dateEnd: dateToISO(dateEnd.value), dateStart: dateToISO(dateStart.value),
detail: detail.value, dateEnd: dateToISO(dateEnd.value),
reference: reference.value, detail: detail.value,
refCommandNo: refCommandNo.value, reference: reference.value,
refCommandDate: refCommandNo: refCommandNo.value,
refCommandDate.value == null ? null : dateToISO(refCommandDate.value), refCommandDate:
}) refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
.then((res) => { })
success($q, "บันทึกข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await fetchData(); .finally(async () => {
}); await fetchData();
});
}
}; };
/** /**