ทะเบียนประวัติ => ข้อมูลครอบครัว

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-15 16:11:43 +07:00
parent f89c9e02c1
commit acee32e3cf
12 changed files with 240 additions and 110 deletions

View file

@ -24,6 +24,9 @@ const {
const route = useRoute();
const id = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const dialog = ref<boolean>(false);
const mode = ref<string>("table");
const columns = ref<QTableProps["columns"]>([
@ -396,11 +399,13 @@ function editForm(row: any) {
async function addData() {
await http
.post(config.API.profileNewTraining, {
.post(config.API.profileNewTraining(empType.value), {
...trainData,
startYear: undefined,
finishYear: undefined,
isDate: isDate.value === "false" ? false : true,
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
@ -416,7 +421,7 @@ async function addData() {
async function editData(idData: string) {
await http
.patch(config.API.profileNewTrainingByTrainingId(idData), {
.patch(config.API.profileNewTrainingByTrainingId(idData, empType.value), {
...trainData,
profileId: undefined,
startYear: undefined,
@ -438,7 +443,7 @@ async function editData(idData: string) {
function deleteData(idData: string) {
dialogRemove($q, () =>
http
.delete(config.API.profileNewTrainingByTrainingId(idData))
.delete(config.API.profileNewTrainingByTrainingId(idData, empType.value))
.then(() => {
fetchData(id.value);
success($q, "ลบข้อมูลสำเร็จ");
@ -463,7 +468,7 @@ function closeHistoryDialog() {
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.profileNewTrainingByProfileId(id))
.get(config.API.profileNewTrainingByProfileId(id, empType.value))
.then(async (res) => {
rows.value = res.data.result;
})
@ -478,7 +483,7 @@ async function fetchData(id: string) {
async function fetchHistoryData(id: string) {
showLoader();
await http
.get(config.API.profileNewTrainingHisByTrainingId(id))
.get(config.API.profileNewTrainingHisByTrainingId(id, empType.value))
.then(async (res) => {
historyRows.value = res.data.result;
})