Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-06-07 09:43:37 +07:00
commit 56452db4e7
20 changed files with 642 additions and 443 deletions

View file

@ -48,43 +48,43 @@ let dataForm = reactive({
});
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
});
const fetchPublishFile = async () => {
await http
.get(config.API.getPublishFileHistory)
.then((res) => {
let data = res.data.result;
selectedFile.value = data[0].fileName;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
};
// const fetchPublishFile = async () => {
// await http
// .get(config.API.getPublishFileHistory)
// .then((res) => {
// let data = res.data.result;
// selectedFile.value = data[0].fileName;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// });
// };
// json
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
return true;
@ -171,8 +171,8 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
hideLoader();
});

View file

@ -47,42 +47,41 @@ let dataForm = reactive({
positionTypeId: "",
});
const fetchPublishFile = async () => {
await http
.get(config.API.getPublishFileHistory)
.then((res) => {
let data = res.data.result;
selectedFile.value = data[0].fileName;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
};
// const fetchPublishFile = async () => {
// await http
// .get(config.API.getPublishFileHistory)
// .then((res) => {
// let data = res.data.result;
// selectedFile.value = data[0].fileName;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// });
// };
// json
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
@ -177,8 +176,8 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
hideLoader();
});
@ -393,8 +392,8 @@ function findByPerson(element: any): any {
}
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
// await fetchplacementPosition();
});
</script>

View file

@ -258,26 +258,23 @@ const openModalTree = (data: any, type: string) => {
posLevel.value = data.positionLevelOld;
position.value = data.positionOld;
};
//
//
const clickDelete = (id: string) => {
dialogRemove($q, () => deleteAppoint(id));
};
//
const deleteAppoint = async (id: string) => {
showLoader();
await http
.delete(config.API.appointmentDelete(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthlistappointment();
hideLoader();
});
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.appointmentDelete(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthlistappointment();
hideLoader();
});
});
};
//
@ -546,7 +543,7 @@ onMounted(() => {
<q-item
clickable
v-close-popup
@click="clickDelete(props.row.personalId)"
@click="clickDelete(props.row.id)"
>
<q-item-section
style="min-width: 0px"

View file

@ -198,11 +198,13 @@ async function fetchPosFind(level: number, id: string) {
.post(config.API.orgPosFind, body)
.then((res) => {
const data = res.data.result;
console.log(data);
expanded.value = data;
nodeId.value = id;
positionId.value = props?.dataRow?.posmasterId;
seletcId.value = props?.dataRow?.positionId;
datePos.value = props?.dataRow?.reportingDateFullDate;
datePos.value = props?.dataRow?.reportingDate;
fetchDataTable(nodeId.value, level);
})
@ -277,7 +279,10 @@ watch(
async () => {
if (modal.value) {
await fetchOrganizationActive();
console.log(props?.dataRow);
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
await fetchPosFind(props?.dataRow?.node, props?.dataRow?.nodeId);
} else {
expanded.value = [];

View file

@ -61,41 +61,41 @@ let dataForm = reactive({
});
/** ฟังชั่น get file*/
async function fetchPublishFile() {
await http
.get(config.API.getPublishFileHistory)
.then((res) => {
let data = res.data.result;
selectedFile.value = data[0].fileName;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
// async function fetchPublishFile() {
// await http
// .get(config.API.getPublishFileHistory)
// .then((res) => {
// let data = res.data.result;
// selectedFile.value = data[0].fileName;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// });
// }
/** โหลดข้อมูลโครงสร้างจาก json */
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
/**
* งกนกรองขอมลท personId เป null
@ -202,8 +202,8 @@ async function saveAppoint() {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
hideLoader();
});
@ -419,8 +419,8 @@ watch(props, () => {
});
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
});
</script>

View file

@ -83,6 +83,7 @@ const {
dateText,
success,
dialogConfirm,
date2Thai,
} = mixin;
const route = useRoute();
@ -239,9 +240,9 @@ function convertContainStatus(val: string, type: string = "") {
case "UN-CONTAIN":
return "ยังไม่บรรจุ";
case "PREPARE-CONTAIN":
return "เตรียม" + (type != "" ? type : "บรรจุ");
return "เตรียม" + (!type ? type : "บรรจุ");
case "CONTAIN":
return (type != "" ? type : "บรรจุ") + "แล้ว";
return (!type ? type : "บรรจุ") + "แล้ว";
case "DISCLAIM":
return "สละสิทธิ์";
default:
@ -336,6 +337,7 @@ async function getTable() {
posLevelCandidateId: data.posLevelCandidateId,
posLevelCandidateName: data.posLevelCandidateName,
posmasterId: data.posmasterId,
statusNameCheck: convertContainStatus(data.statusId),
statusName:
convertContainStatus(data.statusId) +
@ -357,18 +359,18 @@ async function getTable() {
});
//
rows.value = roleAdmin.value
rows.value = await (roleAdmin.value
? rowsAll.value
: rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN");
: rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN"));
//
rowsFilter.value = rows.value.filter(
rowsFilter.value = await rows.value.filter(
(e: any) =>
e.draft == "รอส่งตัว" &&
e.positionNumber !== null &&
e.statusName == "เตรียมบรรจุ"
e.nodeName !== null &&
e.reportingDate !== null
);
insertAvatar(rowsAll.value);
insertAvatar(rows.value);
})
.catch((e) => {
messageError($q, e);
@ -390,13 +392,13 @@ function insertAvatar(items: any) {
)
)
.then((img) => {
rowsAll.value[index] = {
rows.value[index] = {
...x,
avatar: img.data.downloadUrl,
};
})
.catch(() => {
rowsAll.value[index] = {
rows.value[index] = {
...x,
avatar: avatar,
};
@ -623,6 +625,7 @@ async function clickClose() {
modalDefermentDisclaim.value = false;
modalwaitInfo.value = false;
modal.value = false;
modalDate.value = false;
}
}
@ -677,6 +680,59 @@ watch(containStatus, () => {
}
});
function onRestorePos(id: string) {
dialogConfirm(
$q,
async () => {
showLoader();
await http
.post(config.API.clearPosition(id), {})
.then(() => {
success($q, "คืนตำแหน่งสำเร็จ");
getTable();
props.statCard();
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
},
"ยืนยันการคืนตำแหน่ง",
"ต้องการยืนยันการคืนตำแหน่งนี้ใช่หรือไม่ ?"
);
}
const modalDate = ref<boolean>(false);
const reportingDate = ref<Date | null>(null);
const rowId = ref<string>("");
function onSelectDate(id: string, date: Date) {
modalDate.value = true;
rowId.value = id;
reportingDate.value = date;
}
function onSubmitDate() {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.clearDate(rowId.value), { date: reportingDate.value })
.then(() => {
getTable();
props.statCard();
success($q, "บันทึกข้อมูลสำเร็จ");
modalDate.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
});
}
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
@ -830,7 +886,7 @@ onMounted(async () => {
</q-td>
<q-td auto-width>
<q-btn
v-if="roleAdmin && props.row.statusId !== 'CONTAIN'"
v-if="props.row.statusId !== 'CONTAIN'"
icon="mdi-dots-vertical"
size="12px"
color="grey-7"
@ -842,9 +898,9 @@ onMounted(async () => {
<q-list dense style="min-width: 100px">
<q-item
v-if="
(roleAdmin && props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -873,11 +929,61 @@ onMounted(async () => {
</q-item>
<q-item
v-if="
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
roleAdmin &&
props.row.draft === 'รอส่งตัว' &&
props.row.nodeName !== null
"
clickable
v-close-popup
@click="
onSelectDate(
props.row.personalId,
props.row.reportingDate
)
"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon
color="blue-7"
size="xs"
name="mdi-calendar-account"
/>
</q-item-section>
<q-item-section>เลอกวนรายงานต</q-item-section>
</q-item>
<q-item
v-if="
roleAdmin &&
props.row.draft === 'รอส่งตัว' &&
props.row.nodeName !== null
"
clickable
v-close-popup
@click="onRestorePos(props.row.personalId)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon
color="orange-7"
size="xs"
name="mdi-backup-restore"
/>
</q-item-section>
<q-item-section>นตำแหน</q-item-section>
</q-item>
<q-item
v-if="
props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -905,11 +1011,10 @@ onMounted(async () => {
<q-item
v-if="
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -933,11 +1038,10 @@ onMounted(async () => {
<q-item
v-if="
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -1243,7 +1347,7 @@ onMounted(async () => {
:props="props"
class="cursor-pointer"
>
<template v-if="col.name === 'position'">
<template v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</template>
<template
@ -1252,8 +1356,13 @@ onMounted(async () => {
>
<q-item v-ripple style="padding: 0">
<q-item-section avatar>
<q-avatar size="32px" color="grey-4">
<q-img :src="props.row.avatar" class="photo-profile" />
<q-avatar size="30px" color="grey-4">
<q-img
:src="props.row.avatar"
class="photo-profile"
v-if="props.row.avatar"
/>
<q-img :src="avatar" class="photo-profile" v-else"/>
</q-avatar>
</q-item-section>
@ -1396,6 +1505,67 @@ onMounted(async () => {
:fetchStatCard="statCard"
:typeCommand="typeCommand"
/>
<!-- dialog นรายงานต-->
<q-dialog v-model="modalDate" persistent>
<q-card style="width: 500px; max-width: 300px">
<q-form
ref="myForm"
greedy
@submit.prevent
@validation-success="onSubmitDate"
>
<DialogHeader :tittle="`เลือกวันรายงานตัว`" :close="clickClose" />
<q-separator />
<q-card-section class="q-p-sm">
<datepicker
menu-class-name="modalfix"
v-model="reportingDate"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
:min-date="new Date()"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
ref="dateRef"
outlined
dense
hide-bottom-space
:model-value="
reportingDate != null ? date2Thai(reportingDate) : null
"
label="วันที่รายงานตัว"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<style lang="scss" scoped>

View file

@ -118,40 +118,40 @@ let dataForm = reactive({
positionTypeId: "",
});
const fetchPublishFile = async () => {
await http
.get(config.API.getPublishFileHistory)
.then((res) => {
let data = res.data.result;
selectedFile.value = data[0].fileName;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
};
// const fetchPublishFile = async () => {
// await http
// .get(config.API.getPublishFileHistory)
// .then((res) => {
// let data = res.data.result;
// selectedFile.value = data[0].fileName;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// });
// };
// json
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
@ -234,8 +234,8 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
// await fetchplacementPosition();
hideLoader();
});
@ -634,8 +634,8 @@ watch(
);
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
// await fetchplacementPosition();
});
</script>

View file

@ -43,24 +43,24 @@ let dataForm = reactive({
});
onMounted(async () => {
await fetchPublishFile();
// await fetchPublishFile();
await loadTreeData();
await fetchplacementPosition();
});
const fetchPublishFile = async () => {
await http
.get(config.API.getPublishFileHistory)
.then((res) => {
let data = res.data.result;
selectedFile.value = data[0].fileName;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
};
// const fetchPublishFile = async () => {
// await http
// .get(config.API.getPublishFileHistory)
// .then((res) => {
// let data = res.data.result;
// selectedFile.value = data[0].fileName;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// });
// };
// json
const treeData = ref<Array<any>>([]);
@ -192,7 +192,7 @@ const saveAppoint = async () => {
.finally(async () => {
await closeAndClear();
// await resetFilter();
await fetchPublishFile();
// await fetchPublishFile();
await loadTreeData();
await fetchplacementPosition();
hideLoader();