Merge branch 'develop' into warunee-dev

This commit is contained in:
Warunee Tamkoo 2023-07-14 10:35:11 +07:00
commit 4baece4ebf
9 changed files with 153 additions and 159 deletions

View file

@ -28,6 +28,7 @@ import type {
Education,
Family,
Address,
Certificate,
} from "@/modules/05_placement/interface/index/Main";
import type { Information } from "@/modules/05_placement/components/PersonalDetail/profileType";
@ -92,6 +93,7 @@ const InformationData = ref<Information>(InformationDataDefualt);
const EducationData = ref<Education[]>([]);
const FamilyData = ref<Family>(FamilyDataDefualt);
const AddressData = ref<Address>(AddressDataDefualt);
const CertificateData = ref<Certificate[]>([]);
onMounted(async () => {
// await checkProfileData();
@ -106,7 +108,7 @@ const fetchData = async () => {
.then((res: any) => {
const data = res.data.result;
// data.value = data;
console.log(data);
// console.log(data);
personalData.value.fullName = data.fullName;
personalData.value.id = data.personalId;
@ -190,13 +192,27 @@ const fetchData = async () => {
durationYear: row.durationYear ?? 0,
finishDate: row.finishDate ?? new Date(),
isDate: row.isDate ?? "",
startDate: row.startDate ?? 0,
endDate: row.endDate ?? 0,
startDate: row.startDate ? new Date(row.startDate).getFullYear() : 0,
endDate: row.endDate ? new Date(row.endDate).getFullYear() : 0,
positionPath: row.positionPath ?? "",
isEducation: row.isEducation ?? "",
});
});
EducationData.value = listRow;
let listCert: Certificate[] = [];
data.certificates.map((row: any) => {
listCert.push({
id: row.id ?? "",
certificateNo: row.certificateNo ?? "",
issuer: row.issuer ?? "",
issueDate: new Date(row.issueDate) ?? new Date(),
expireDate: new Date(row.expireDate) ?? new Date(),
certificateType: row.certificateType ?? "",
});
});
CertificateData.value = listCert;
})
.catch((e: any) => {
messageError($q, e);
@ -252,7 +268,7 @@ const fetchData = async () => {
<Certicate
v-model:statusEdit="statusEdit"
:profileType="profileType"
v-model:data="InformationData"
v-model:data="CertificateData"
:fetch="fetchData"
/>
</div>

View file

@ -43,8 +43,6 @@ const props = defineProps({
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { success, dateToISO, date2Thai, messageError, showLoader, hideLoader } =
mixin;
@ -94,7 +92,7 @@ const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.education.columns.length == 0
? (visibleColumns.value = [
"level",
"educationLevel",
"institute",
"degree",
"field",
@ -112,11 +110,11 @@ profileData.education.columns.length == 0
: (visibleColumns.value = profileData.education.columns);
const columns = ref<QTableProps["columns"]>([
{
name: "level",
name: "educationLevel",
align: "left",
label: "ระดับศึกษา",
sortable: true,
field: "level",
field: "educationLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -474,7 +472,8 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
onMounted(async () => {
await fetchLevel();
await fetchPositionPath();
// await fetchData();
await props.fetch();
rows.value = props.data;
});
const fetchLevel = async () => {
@ -541,45 +540,6 @@ const filterSelector = (val: any, update: Function, refData: string) => {
}
};
const fetchData = async () => {
showLoader();
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,
// positionPathId: e.positionPathId,
// 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,
// finishDate: new Date(e.finishDate),
// startDate: new Date(e.startDate).getFullYear(),
// endDate: new Date(e.endDate).getFullYear(),
// createdFullName: e.createdFullName,
// createdAt: new Date(e.createdAt),
// });
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
/**
* กดดอมลกอนหน
*/
@ -604,22 +564,32 @@ const clickNext = async () => {
* กดดอมลตอไป
*/
const getData = () => {
// const row = rows.value[rowIndex.value];
// levelId.value = row.levelId;
// positionPathId.value = row.positionPathId;
// institute.value = row.institute;
// degree.value = row.degree;
// field.value = row.field;
// gpa.value = row.gpa;
// country.value = row.country;
// duration.value = row.duration;
// durationYear.value = row.durationYear;
// other.value = row.other;
// fundName.value = row.fundName;
// finishDate.value = row.finishDate;
// startDate.value = row.startDate;
// endDate.value = row.endDate;
// id.value = row.id;
const row = rows.value[rowIndex.value];
const filter = OpsFilter.value.levelOptions.filter(
(r: any) => r.name == row.educationLevel
);
const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
(r: any) => r.name == row.positionPath
);
const result = filter.length > 0 ? filter[0].id : "";
const resultPath =
filterPositionPath.length > 0 ? filterPositionPath[0].id : "";
levelId.value = result;
positionPathId.value = resultPath;
institute.value = row.institute;
degree.value = row.degree;
field.value = row.field;
gpa.value = row.gpa;
country.value = row.country;
duration.value = row.duration;
durationYear.value = row.durationYear;
other.value = row.other;
fundName.value = row.fundName;
finishDate.value = row.finishDate;
startDate.value = row.startDate;
endDate.value = row.endDate;
id.value = row.id;
};
/**
@ -673,15 +643,9 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
// const filter = OpsFilter.value.levelOptions.filter(
// (r: any) => r.id == levelId.value
// );
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == positionPathId.value
// );
showLoader();
await http
.post(config.API.profileEduId(profileId.value), {
.post(config.API.placementEducationId(route.params.personalId.toString()), {
id: id.value,
// educationLevel: filter[0].name,
educationLevelId: levelId.value,
@ -692,7 +656,7 @@ const saveData = async () => {
gpa: gpa.value,
country: country.value,
duration: duration.value,
durationYear: durationYear.value,
durationYear: Number(durationYear.value),
other: other.value,
fundName: fundName.value,
finishDate: dateToISO(finishDate.value),
@ -707,7 +671,8 @@ const saveData = async () => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
};
@ -723,7 +688,7 @@ const editData = async () => {
// );
showLoader();
await http
.put(config.API.profileEduId(id.value), {
.put(config.API.placementEducationId(route.params.personalId.toString()), {
id: id.value,
// educationLevel: filter[0].name,
educationLevelId: levelId.value,
@ -734,10 +699,10 @@ const editData = async () => {
gpa: gpa.value,
country: country.value,
duration: duration.value,
durationYear: durationYear.value,
durationYear: Number(durationYear.value),
other: other.value,
fundName: fundName.value,
finishDate: dateToISO(finishDate.value),
finishDate: new Date(finishDate.value),
startDate: new Date(`${startDate.value}-01-01`),
endDate: new Date(`${endDate.value}-01-01`),
})
@ -749,7 +714,8 @@ const editData = async () => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
};
@ -767,7 +733,7 @@ const clickDelete = async () => {
.onOk(async () => {
showLoader();
await http
.delete(config.API.profileEduId(id.value))
.delete(config.API.placementEducationId(id.value))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
modal.value = false;
@ -776,11 +742,13 @@ const clickDelete = async () => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
})
.onCancel(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
};
@ -812,13 +780,26 @@ const clickClose = async () => {
* @param _props props ใน row เลอก
*/
const selectData = async (_props: DataProps) => {
const filter = OpsFilter.value.levelOptions.filter(
(r: any) => r.name == _props.row.educationLevel
);
const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
(r: any) => r.name == _props.row.positionPath
);
const result = filter.length > 0 ? filter[0].id : "";
const resultPath =
filterPositionPath.length > 0 ? filterPositionPath[0].id : "";
// console.log(_props.row);
modalEdit.value = true;
modal.value = true;
edit.value = false;
rawItem.value = _props.row;
rowIndex.value = _props.rowIndex;
levelId.value = _props.row.levelId;
positionPathId.value = _props.row.positionPathId;
levelId.value = result;
positionPathId.value = resultPath;
// levelId.value = _props.row.levelId;
// positionPathId.value = _props.row.positionPathId;
institute.value = _props.row.institute;
degree.value = _props.row.degree;
field.value = _props.row.field;

View file

@ -18,6 +18,8 @@ import HistoryTable from "@/components/TableHistory.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { PropType } from "vue";
import type { Certificate } from "@/modules/05_placement/interface/index/Main";
const props = defineProps({
statusEdit: {
@ -32,13 +34,16 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
data: {
type: Array as PropType<Certificate[]>,
default: [],
},
});
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
@ -68,7 +73,7 @@ const checkValidate = ref<boolean>(false); //validate data ผ่านหรื
// route.params.id ? route.params.id.toString() : ""
// );
const profileId = ref<string>("");
const rows = ref<RequestItemsObject[]>([]);
const rows = ref<Certificate[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.certicate.columns.length == 0
@ -233,40 +238,12 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
onMounted(async () => {
// await fetchData();
if (route.params.id) {
profileId.value = route.params.id.toString();
profileId.value = route.params.personalId.toString();
}
await props.fetch();
rows.value = props.data;
});
const fetchData = async () => {
if (profileId.value != "") {
showLoader();
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(() => {
hideLoader();
});
}
};
/**
* กดดอมลกอนหน
*/
@ -351,42 +328,16 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
showLoader();
await http
.post(config.API.profileCertId(profileId.value), {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: dateToISO(issueDate.value),
expireDate: dateToISO(expireDate.value),
certificateType: certificateType.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
// console.log("saveData");
/**
* นทกแกไขขอม
*/
const editData = async () => {
showLoader();
await http
.put(config.API.profileCertId(id.value), {
.post(config.API.placementCertId(route.params.personalId.toString()), {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: dateToISO(issueDate.value),
expireDate: dateToISO(expireDate.value),
issueDate: new Date(issueDate.value),
expireDate: new Date(expireDate.value),
certificateType: certificateType.value,
})
.then((res) => {
@ -397,7 +348,35 @@ const editData = async () => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
};
/**
* นทกแกไขขอม
*/
const editData = async () => {
showLoader();
await http
.put(config.API.placementCertId(route.params.personalId.toString()), {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: new Date(issueDate.value),
expireDate: new Date(expireDate.value),
certificateType: certificateType.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await props.fetch();
rows.value = props.data;
});
};
@ -415,7 +394,12 @@ const clickDelete = async () => {
.onOk(async () => {
showLoader();
await http
.delete(config.API.profileCertId(id.value))
.delete(
config.API.placementCertDetailId(
route.params.personalId.toString(),
id.value
)
)
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
modal.value = false;
@ -424,11 +408,13 @@ const clickDelete = async () => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
})
.onCancel(async () => {
await fetchData();
await props.fetch();
rows.value = props.data;
});
};

View file

@ -115,7 +115,7 @@ const fetchPerson = async () => {
.then((res) => {
const data = res.data.result;
let optionbloodGroups: optionData[] = [];
console.log(data);
// console.log(data);
data.bloodGroups.map((r: any) => {
optionbloodGroups.push({
id: r.id ?? "",

View file

@ -54,7 +54,7 @@
<div class="col-12 text-top0 items-center">
<q-avatar class="bg-grey-2 q-mr-sm" size="28px">2</q-avatar>
แลการทดลองปฏหนาทราชการ (อาจมไดมากกว 1 คน)
<q-btn round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
<q-btn v-if="routeName == 'probationWorkAdd'" round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
</div>
<div class="col-12 row q-col-gutter-md">
<q-select
@ -87,7 +87,7 @@
<div class="col-12 text-top2 row items-center ">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
3.1 องาน / ภารกจงานทมอบหมาย (ควรมมากกว 1 ภารกจงาน)
<q-btn round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
<q-btn v-if="routeName == 'probationWorkAdd'" round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
</div>
<div class="col-12 row q-gutter-md">
<q-card flat bordered class="col-12 q-pa-sm bg-grey-1">
@ -153,7 +153,7 @@
<div class="col-12 row">
<div class="col-12 text-top2 row items-center">
ความรความสามารถในการปฏงาน
<q-btn round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
<q-btn v-if="routeName == 'probationWorkAdd'" round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
</div>
<div class="col-12 row q-col-gutter-sm">
<div class="col-12 ">
@ -194,7 +194,7 @@
<div class="col-12 row">
<div class="col-12 text-top2 row items-center">
ความรเรองกฎหมายและกฎระเบยบ (ไมเก 20 วข)
<q-btn round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
<q-btn v-if="routeName == 'probationWorkAdd'" round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
</div>
<q-card flat bordered class="col-12 q-pa-md" style="max-height: 500px; overflow-y: scroll">
<div class="col-12 row q-pb-sm" v-for="(lawl, index) in listlaw" :key="index" >
@ -457,7 +457,7 @@
<div class="col-12 text-top2 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
3.6 ผลผลตของงานทคาดหวงและตวชดความสาเรจของงาน
<q-btn round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
<q-btn v-if="routeName == 'probationWorkAdd'" round color="primary" dense icon="mdi-plus" flat class="q-ml-sm" />
</div>
<div class="col-12 row q-gutter-md">
<q-card flat bordered class="col-12 q-pa-sm bg-grey-1">

View file

@ -140,6 +140,15 @@ interface Address {
registSame: string;
}
interface Certificate {
id: string;
certificateNo: string;
issuer: string;
issueDate: Date;
expireDate: Date;
certificateType: string;
}
const AddressDataDefualt: Address = {
registAddress: "",
currentAddress: "",
@ -195,6 +204,7 @@ export type {
Family,
Address,
optionData,
Certificate,
};
export { AddressDataDefualt, FamilyDataDefualt };

View file

@ -6,6 +6,7 @@ interface DataProps {
//ข้อมูล
interface RequestItemsObject {
id: string;
educationLevel: string;
level: string;
levelId: string;
positionPath: string;