clear code + comment

This commit is contained in:
STW_TTTY\stwtt 2024-04-30 14:31:55 +07:00
parent a9609d2d7f
commit ac70090e22
19 changed files with 231 additions and 166 deletions

View file

@ -53,6 +53,8 @@ const budgetSubOp = ref<DataOption[]>([
name: "เงินอุดหนุน",
},
]);
/** ดึงข้อมูล จังหวัด */
const getProvince = async () => {
showLoader();
http
@ -74,6 +76,7 @@ const getProvince = async () => {
});
};
/** ตัวแปร */
const formData = reactive<FormData>({
dateStart: null, //
dateEnd: null, //
@ -96,6 +99,7 @@ const formData = reactive<FormData>({
provinceActualId: "", //()
});
/** ดึงข้อมูล */
function fetchData() {
http
.get(config.API.developmentMainTab("tab5", projectId.value))
@ -132,6 +136,7 @@ function fetchData() {
});
}
/** ฟังชั่นเคลียค่าวันสิ้นสุดเมื่อวันสิ้นสุดมากกว่าวันเริ่ม */
function changeDateStart() {
if (formData.dateStart !== null && formData.dateEnd !== null) {
const startDate = new Date(formData.dateStart);
@ -145,6 +150,7 @@ function changeDateStart() {
}
}
/** ฟังชั่น เก็บค่า ระยะกี่วันจากวันเริ่ม */
function changeDateEnd() {
formData.totalDate = diffDay(formData.dateStart, formData.dateEnd);
}
@ -162,6 +168,7 @@ const filterSelector = (val: string, update: Function) => {
});
};
/** ระดับความเสี่ยงของโครงการ option */
async function calRiskLevel() {
if (formData.chance && formData.effects) {
const riskLevel =
@ -185,6 +192,7 @@ async function calRiskLevel() {
}
}
/** เพิ่มข้อมูล */
function onClickAddLocation() {
const data = {
address: "",
@ -193,10 +201,12 @@ function onClickAddLocation() {
formData.developmentAddresss.push(data);
}
/** ลบข้อมูล */
function onClickDeleteLocation(index: number) {
formData.developmentAddresss.splice(index, 1);
}
/** บันทึกข้อมูล */
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
@ -233,6 +243,7 @@ function onSubmit() {
});
}
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
onMounted(() => {
fetchData();
getProvince();