Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into me

This commit is contained in:
Thanit Konmek 2023-07-11 13:15:07 +07:00
commit 15778de7b9
20 changed files with 2758 additions and 2540 deletions

View file

@ -366,7 +366,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขผลก
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -595,34 +597,36 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileAssessmentId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
point1Total: e.point1Total,
point1: e.point1,
point2Total: e.point2Total,
point2: e.point2,
pointSumTotal: e.pointSumTotal,
pointSum: e.pointSum,
date: new Date(e.date),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileAssessmentId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
point1Total: e.point1Total,
point1: e.point1,
point2Total: e.point2Total,
point2: e.point2,
pointSumTotal: e.pointSumTotal,
pointSum: e.pointSum,
date: new Date(e.date),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -712,29 +716,31 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileAssessmentId(profileId.value), {
id: id.value,
name: name.value,
point1Total: point1Total.value,
point1: point1.value,
point2Total: point2Total.value,
point2: point2.value,
pointSumTotal: pointSumTotal.value,
pointSum: pointSum.value,
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileAssessmentId(profileId.value), {
id: id.value,
name: name.value,
point1Total: point1Total.value,
point1: point1.value,
point2Total: point2Total.value,
point2: point2.value,
pointSumTotal: pointSumTotal.value,
pointSum: pointSum.value,
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -319,7 +319,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขประ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -487,32 +489,34 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileHonorId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileHonorId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -599,27 +603,29 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileHonorId(profileId.value), {
id: id.value,
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileHonorId(profileId.value), {
id: id.value,
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -381,7 +381,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขวิน
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -587,33 +589,35 @@ const filterSelector = (val: string, update: Function, refData: string) => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileDisId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.level,
detail: e.detail,
unStigma: e.unStigma,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileDisId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.level,
detail: e.detail,
unStigma: e.unStigma,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -701,28 +705,30 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileDisId(profileId.value), {
id: id.value,
level: level.value,
detail: detail.value,
unStigma: unStigma.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileDisId(profileId.value), {
id: id.value,
level: level.value,
detail: detail.value,
unStigma: unStigma.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -162,7 +162,9 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const route = useRoute();
const { success, messageError } = mixin;
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const edit = ref<boolean>(false);
const uploader = ref<any>();
const files = ref<any>([]);
@ -174,19 +176,21 @@ onMounted(async () => {
});
const getData = async () => {
loaderPage(true);
await http
.get(config.API.profilePaperId(profileId.value))
.then((res) => {
const data = res.data.result;
files.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profilePaperId(profileId.value))
.then((res) => {
const data = res.data.result;
files.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
const deleteData = async (id: string) => {
@ -205,39 +209,41 @@ const deleteData = async (id: string) => {
};
const uploadData = async () => {
if (file.value.length > 0) {
const blob = file.value.slice(0, file.value[0].size);
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();
if (profileId.value) {
if (file.value.length > 0) {
const blob = file.value.slice(0, file.value[0].size);
const newFile = new File(blob, name.value, {
type: file.value[0].type,
});
} else {
// modalError(
// $q,
// "",
// ""
// );
getData();
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 {
// modalError(
// $q,
// "",
// ""
// );
getData();
}
}
};

View file

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

View file

@ -5,11 +5,12 @@
header="ข้อมูลที่อยู่"
icon="mdi-map-marker"
:save="saveData"
:history="true"
:history="!statusAdd()"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
:historyClick="clickHistory"
:addEmployee="statusAdd()"
/>
<q-form ref="myform">
<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,
required: true,
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -507,8 +512,28 @@ const visibleColumnsHistory = ref<String[]>([
onMounted(async () => {
await getNewData();
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) => {
switch (refData) {
case "provinceOps":
@ -606,27 +631,29 @@ const getNewData = async () => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
addressData.value.address = data.registrationAddress;
addressData.value.addressC = data.currentAddress;
addressData.value.districtId = data.registrationDistrictId;
addressData.value.districtIdC = data.currentDistrictId;
addressData.value.provinceId = data.registrationProvinceId;
addressData.value.provinceIdC = data.currentProvinceId;
addressData.value.subdistrictId = data.registrationSubDistrictId;
addressData.value.subdistrictIdC = data.currentSubDistrictId;
addressData.value.same = data.registrationSame ? "1" : "0";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
addressData.value.address = data.registrationAddress;
addressData.value.addressC = data.currentAddress;
addressData.value.districtId = data.registrationDistrictId;
addressData.value.districtIdC = data.currentDistrictId;
addressData.value.provinceId = data.registrationProvinceId;
addressData.value.provinceIdC = data.currentProvinceId;
addressData.value.subdistrictId = data.registrationSubDistrictId;
addressData.value.subdistrictIdC = data.currentSubDistrictId;
addressData.value.same = data.registrationSame ? "1" : "0";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
const editData = async () => {
@ -673,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 () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
await editData();
if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else {
}
});

View file

@ -316,7 +316,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขใบอ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -484,31 +486,33 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
certificateNo: e.certificateNo,
issuer: e.issuer,
issueDate: new Date(e.issueDate),
expireDate: new Date(e.expireDate),
certificateType: e.certificateType,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
certificateNo: e.certificateNo,
issuer: e.issuer,
issueDate: new Date(e.issueDate),
expireDate: new Date(e.expireDate),
certificateType: e.certificateType,
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="ข้อมูลครอบครัว"
icon="mdi-account-group"
:save="saveData"
:history="true"
:history="!statusAdd()"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
:historyClick="historyData"
:addEmployee="statusAdd()"
/>
<q-form ref="myform" class="col-12">
<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,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -1171,8 +1176,43 @@ onMounted(async () => {
await fetchPrefix();
await fetchData();
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 () => {
await fetchHistory();
};
@ -1299,61 +1339,63 @@ const fetchHistory = async () => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileFamiId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
familyData.value.prefixC = "";
familyData.value.prefixIdC = data.couplePrefixId;
familyData.value.firstnameC = data.coupleFirstName;
familyData.value.lastnameC = data.coupleLastName;
familyData.value.lastnameCOld = data.coupleLastNameOld;
familyData.value.occupationC = data.coupleCareer;
familyData.value.liveC = data.coupleLive ? "1" : "0";
familyData.value.citizenIdC = data.coupleCitizenId;
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileFamiId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
familyData.value.prefixC = "";
familyData.value.prefixIdC = data.couplePrefixId;
familyData.value.firstnameC = data.coupleFirstName;
familyData.value.lastnameC = data.coupleLastName;
familyData.value.lastnameCOld = data.coupleLastNameOld;
familyData.value.occupationC = data.coupleCareer;
familyData.value.liveC = data.coupleLive ? "1" : "0";
familyData.value.citizenIdC = data.coupleCitizenId;
familyData.value.prefixM = "";
familyData.value.prefixIdM = data.fatherPrefixId;
familyData.value.firstnameM = data.fatherFirstName;
familyData.value.lastnameM = data.fatherLastName;
familyData.value.occupationM = data.fatherCareer;
familyData.value.liveM = data.fatherLive ? "1" : "0";
familyData.value.citizenIdM = data.fatherCitizenId;
familyData.value.prefixM = "";
familyData.value.prefixIdM = data.fatherPrefixId;
familyData.value.firstnameM = data.fatherFirstName;
familyData.value.lastnameM = data.fatherLastName;
familyData.value.occupationM = data.fatherCareer;
familyData.value.liveM = data.fatherLive ? "1" : "0";
familyData.value.citizenIdM = data.fatherCitizenId;
familyData.value.prefixF = "";
familyData.value.prefixIdF = data.motherPrefixId;
familyData.value.firstnameF = data.motherFirstName;
familyData.value.lastnameF = data.motherLastName;
familyData.value.occupationF = data.motherCareer;
familyData.value.liveF = data.motherLive ? "1" : "0";
familyData.value.citizenIdF = data.motherCitizenId;
familyData.value.same = data.couple ? "1" : "0";
familyData.value.prefixF = "";
familyData.value.prefixIdF = data.motherPrefixId;
familyData.value.firstnameF = data.motherFirstName;
familyData.value.lastnameF = data.motherLastName;
familyData.value.occupationF = data.motherCareer;
familyData.value.liveF = data.motherLive ? "1" : "0";
familyData.value.citizenIdF = data.motherCitizenId;
familyData.value.same = data.couple ? "1" : "0";
if (data.childrens.length > 0) {
let dataChild: childrenFamily[] = [];
data.childrens.map((row: childrenFamily, index: number) => {
dataChild.push({
id: `${index + 1}`,
childrenPrefixId: row.childrenPrefixId,
childrenFirstName: row.childrenFirstName,
childrenLastName: row.childrenLastName,
childrenCareer: row.childrenCareer,
childrenLive: row.childrenLive,
childrenCitizenId: row.childrenCitizenId,
if (data.childrens.length > 0) {
let dataChild: childrenFamily[] = [];
data.childrens.map((row: childrenFamily, index: number) => {
dataChild.push({
id: `${index + 1}`,
childrenPrefixId: row.childrenPrefixId,
childrenFirstName: row.childrenFirstName,
childrenLastName: row.childrenLastName,
childrenCareer: row.childrenCareer,
childrenLive: row.childrenLive,
childrenCitizenId: row.childrenCitizenId,
});
});
});
familyData.value.childrens = dataChild;
} else {
familyData.value.childrens = [];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
});
familyData.value.childrens = dataChild;
} else {
familyData.value.childrens = [];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
});
}
};
const editData = async () => {
@ -1398,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 () => {
await myform.value?.validate().then(async (success: boolean) => {
if (success) {
await editData();
if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else {
}
});

View file

@ -5,11 +5,12 @@
header="ข้อมูลส่วนตัว"
icon="mdi-account"
:save="saveData"
:history="true"
:history="!statusAdd()"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="onCancel"
:historyClick="clickHistory"
:addEmployee="statusAdd()"
/>
<q-form ref="myform" class="col-12">
<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,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -693,8 +698,36 @@ onMounted(async () => {
await fetchPerson();
await fetchData();
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 () => {
if (myform.value != null) {
myform.value.reset();
@ -962,44 +995,49 @@ const calRetire = async (birth: Date) => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
const data: ResponseObject = res.data.result;
defaultCitizenData.value = data.citizenId;
informaData.value.cardid = data.citizenId;
informaData.value.prefix = "";
informaData.value.prefixId = data.prefixId;
informaData.value.firstname = data.firstName;
informaData.value.lastname = data.lastName;
informaData.value.birthDate = new Date(data.birthDate);
informaData.value.genderId = data.genderId;
informaData.value.bloodId = data.bloodGroupId;
informaData.value.nationality = data.nationality;
informaData.value.ethnicity = data.race;
informaData.value.statusId = data.relationshipId;
informaData.value.religionId = data.religionId;
informaData.value.tel = data.telephoneNumber;
informaData.value.age = data.age;
informaData.value.employeeType = data.employeeType;
informaData.value.employeeClass = data.employeeClass;
informaData.value.profileType = data.profileType;
dateBefore.value = new Date(data.birthDate);
same.value = data.changeName == true ? "1" : "0";
await calRetire(new Date(dateToISO(new Date(data.birthDate))));
if (data.profileType == "officer" && columnsHistory.value.length >= 15) {
columnsHistory.value.splice(13, 1);
columnsHistory.value.splice(12, 1);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
await props.fetchDataProfile();
});
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
const data: ResponseObject = res.data.result;
defaultCitizenData.value = data.citizenId;
informaData.value.cardid = data.citizenId;
informaData.value.prefix = "";
informaData.value.prefixId = data.prefixId;
informaData.value.firstname = data.firstName;
informaData.value.lastname = data.lastName;
informaData.value.birthDate = new Date(data.birthDate);
informaData.value.genderId = data.genderId;
informaData.value.bloodId = data.bloodGroupId;
informaData.value.nationality = data.nationality;
informaData.value.ethnicity = data.race;
informaData.value.statusId = data.relationshipId;
informaData.value.religionId = data.religionId;
informaData.value.tel = data.telephoneNumber;
informaData.value.age = data.age;
informaData.value.employeeType = data.employeeType;
informaData.value.employeeClass = data.employeeClass;
informaData.value.profileType = data.profileType;
dateBefore.value = new Date(data.birthDate);
same.value = data.changeName == true ? "1" : "0";
await calRetire(new Date(dateToISO(new Date(data.birthDate))));
if (
data.profileType == "officer" &&
columnsHistory.value.length >= 15
) {
columnsHistory.value.splice(13, 1);
columnsHistory.value.splice(12, 1);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
await props.fetchDataProfile();
});
}
};
const editData = async () => {
@ -1040,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 () => {
if (myform.value != null) {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
await editData();
if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else {
}
});

View file

@ -43,7 +43,7 @@
size="12px"
flat
round
v-if="edit"
v-if="edit && !addEmployee"
:color="!edit ? 'grey-7' : 'red'"
@click="ClickCancel"
icon="mdi-undo"
@ -157,6 +157,10 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
addEmployee: {
type: Boolean,
defualt: false,
},
});
const emit = defineEmits(["update:edit"]);

View file

@ -527,7 +527,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขเคร
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -937,41 +939,43 @@ const fetchInsignia = async () => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileInsignId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
insignia: e.insignia,
insigniaId: e.insigniaId,
insigniaType: e.insigniaType,
year: e.year,
no: e.no,
issue: e.issue,
volumeNo: e.volumeNo,
volume: e.volume,
section: e.section,
page: e.page,
receiveDate: new Date(e.receiveDate),
dateAnnounce: new Date(e.dateAnnounce),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileInsignId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
insignia: e.insignia,
insigniaId: e.insigniaId,
insigniaType: e.insigniaType,
year: e.year,
no: e.no,
issue: e.issue,
volumeNo: e.volumeNo,
volume: e.volume,
section: e.section,
page: e.page,
receiveDate: new Date(e.receiveDate),
dateAnnounce: new Date(e.dateAnnounce),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -1066,35 +1070,37 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileInsignId(profileId.value), {
id: id.value,
insigniaId: insigniaId.value,
insigniaType: insigniaType.value,
year: year.value,
no: no.value,
issue: issue.value,
volumeNo: volumeNo.value,
volume: volume.value,
section: section.value,
page: page.value,
receiveDate: dateToISO(receiveDate.value),
dateAnnounce: dateToISO(dateAnnounce.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileInsignId(profileId.value), {
id: id.value,
insigniaId: insigniaId.value,
insigniaType: insigniaType.value,
year: year.value,
no: no.value,
issue: issue.value,
volumeNo: volumeNo.value,
volume: volume.value,
section: section.value,
page: page.value,
receiveDate: dateToISO(receiveDate.value),
dateAnnounce: dateToISO(dateAnnounce.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -444,7 +444,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขการ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filterTotal = ref<string>("");
const rowsTotal = ref<RequestItemsTotalObject[]>([]); //select data history
@ -715,33 +717,35 @@ onMounted(async () => {
const fetchData = async () => {
rows.value = [];
loaderPage(true);
await http
.get(config.API.profileLeaveId(profileId.value))
.then((res) => {
const data = res.data.result;
// console.log(data);
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
typeLeave: e.typeLeave,
dateStartLeave: new Date(e.dateStartLeave),
dateEndLeave: new Date(e.dateEndLeave),
numLeave: e.numLeave,
sumLeave: e.sumLeave,
totalLeave: e.totalLeave,
status: e.status,
reason: e.reason,
typeLeaveId: e.typeLeaveId,
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileLeaveId(profileId.value))
.then((res) => {
const data = res.data.result;
// console.log(data);
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
typeLeave: e.typeLeave,
dateStartLeave: new Date(e.dateStartLeave),
dateEndLeave: new Date(e.dateEndLeave),
numLeave: e.numLeave,
sumLeave: e.sumLeave,
totalLeave: e.totalLeave,
status: e.status,
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) => {
@ -964,28 +968,30 @@ const clickSave = async () => {
const saveData = async () => {
const sum = Number(numLeave.value) + Number(numUsedLeave.value);
loaderPage(true);
await http
.post(config.API.profileLeaveId(profileId.value), {
dateStartLeave: dateToISO(dateRange.value[0]),
dateEndLeave: dateToISO(dateRange.value[1]),
numLeave: numLeave.value,
sumLeave: numUsedLeave.value,
totalLeave: sum,
status: statLeave.value,
reason: reason.value,
typeLeaveId: typeLeave.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modalAdd.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileLeaveId(profileId.value), {
dateStartLeave: dateToISO(dateRange.value[0]),
dateEndLeave: dateToISO(dateRange.value[1]),
numLeave: numLeave.value,
sumLeave: numUsedLeave.value,
totalLeave: sum,
status: statLeave.value,
reason: reason.value,
typeLeaveId: typeLeave.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modalAdd.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
// /**
@ -1185,27 +1191,29 @@ const addData = async () => {
*/
const clickTotal = async () => {
rowsTotal.value = [];
loaderPage(true);
await http
.get(config.API.profileLeaveTotalId(profileId.value))
.then((res) => {
let data = res.data.result;
data.map((e: ResponseTotalObject) => {
rowsTotal.value.push({
typeLeaveId: e.typeLeaveId,
totalLeave: e.totalLeave,
limitLeave: e.limitLeave,
remainLeave: e.remainLeave,
typeLeave: e.typeLeave,
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileLeaveTotalId(profileId.value))
.then((res) => {
let data = res.data.result;
data.map((e: ResponseTotalObject) => {
rowsTotal.value.push({
typeLeaveId: e.typeLeaveId,
totalLeave: e.totalLeave,
limitLeave: e.limitLeave,
remainLeave: e.remainLeave,
typeLeave: e.typeLeave,
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
// /**

View file

@ -213,7 +213,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขอื่
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -302,28 +304,30 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileOtherId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileOtherId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -407,23 +411,25 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileOtherId(profileId.value), {
id: id.value,
date: date.value,
detail: detail.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileOtherId(profileId.value), {
id: id.value,
date: date.value,
detail: detail.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -309,7 +309,9 @@ const tittleHistory = ref<string>(
);
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const checkValidate = ref<boolean>(false); //validate data
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
@ -478,32 +480,34 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileNopaidId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileNopaidId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
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 +594,29 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileNopaidId(profileId.value), {
id: id.value,
date: dateToISO(date.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileNopaidId(profileId.value), {
id: id.value,
date: dateToISO(date.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -213,7 +213,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขควา
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -352,30 +354,32 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileAbiliId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
field: e.field,
detail: e.detail,
remark: e.remark,
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileAbiliId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
field: e.field,
detail: e.detail,
remark: e.remark,
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -461,25 +465,27 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileAbiliId(profileId.value), {
id: id.value,
field: field.value,
detail: detail.value,
remark: remark.value,
reference: reference.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileAbiliId(profileId.value), {
id: id.value,
field: field.value,
detail: detail.value,
remark: remark.value,
reference: reference.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -459,7 +459,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขการ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -751,36 +753,38 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileTrainId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
topic: e.topic,
yearly: e.yearly,
place: e.place,
duration: e.duration,
department: e.department,
numberOrder: e.numberOrder,
dateOrder: e.dateOrder,
startDate: new Date(e.startDate),
endDate: new Date(e.endDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileTrainId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
topic: e.topic,
yearly: e.yearly,
place: e.place,
duration: e.duration,
department: e.department,
numberOrder: e.numberOrder,
dateOrder: e.dateOrder,
startDate: new Date(e.startDate),
endDate: new Date(e.endDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -872,31 +876,33 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileTrainId(profileId.value), {
id: id.value,
name: name.value,
topic: topic.value,
yearly: yearly.value,
place: place.value,
duration: duration.value,
department: department.value,
numberOrder: numberOrder.value,
dateOrder: dateOrder.value,
startDate: dateToISO(startDate.value),
endDate: dateToISO(endDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileTrainId(profileId.value), {
id: id.value,
name: name.value,
topic: topic.value,
yearly: yearly.value,
place: place.value,
duration: duration.value,
department: department.value,
numberOrder: numberOrder.value,
dateOrder: dateOrder.value,
startDate: dateToISO(startDate.value),
endDate: dateToISO(endDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**

View file

@ -356,7 +356,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขปฏิ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -552,33 +554,35 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileDutyId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
dateStart: new Date(e.dateStart),
dateEnd: new Date(e.dateEnd),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileDutyId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
dateStart: new Date(e.dateStart),
dateEnd: new Date(e.dateEnd),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**
@ -666,28 +670,30 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
await http
.post(config.API.profileDutyId(profileId.value), {
id: id.value,
dateStart: dateToISO(dateStart.value),
dateEnd: dateToISO(dateEnd.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
if (profileId.value) {
loaderPage(true);
await http
.post(config.API.profileDutyId(profileId.value), {
id: id.value,
dateStart: dateToISO(dateStart.value),
dateEnd: dateToISO(dateEnd.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**