API รายละเอียด รายการลงเวลา
This commit is contained in:
parent
b4f269cd94
commit
9100062af6
5 changed files with 22 additions and 11 deletions
|
|
@ -7,7 +7,7 @@ export default {
|
||||||
/**รายการลงเวลาปฏิบัติงาน */
|
/**รายการลงเวลาปฏิบัติงาน */
|
||||||
logRecord: () => `${leave}/log-record`,
|
logRecord: () => `${leave}/log-record`,
|
||||||
timeRecord: () => `${leave}/time-record`,
|
timeRecord: () => `${leave}/time-record`,
|
||||||
timeRecordById: (id: string) => `${leave}/time-record/${id}`,
|
recordById: (id: string, type: string) => `${leave}/${type}/${id}`,
|
||||||
/** เปลี่ยนแปลงลงเวลา*/
|
/** เปลี่ยนแปลงลงเวลา*/
|
||||||
leaveSearch: () => `${leave}/search`,
|
leaveSearch: () => `${leave}/search`,
|
||||||
leaveRound: () => `${leave}/round`,
|
leaveRound: () => `${leave}/round`,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
|
typeTab: {
|
||||||
|
type: String,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
detail: {
|
detail: {
|
||||||
type: Object,
|
type: Object,
|
||||||
require: true,
|
require: true,
|
||||||
|
|
@ -59,10 +63,10 @@ const formData = reactive<FormDetail>({
|
||||||
* function เรียกรายการลงเวลาตาม
|
* function เรียกรายการลงเวลาตาม
|
||||||
* @param id รายการลงเวลาปฏิบัติงาน
|
* @param id รายการลงเวลาปฏิบัติงาน
|
||||||
*/
|
*/
|
||||||
async function fetchDetailByid(id: string) {
|
async function fetchDetailByid(id: string, type: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.timeRecordById(id))
|
.get(config.API.recordById(id, type))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
formData.checkInDate = data.checkInDate && date2Thai(data.checkInDate);
|
formData.checkInDate = data.checkInDate && date2Thai(data.checkInDate);
|
||||||
|
|
@ -111,7 +115,9 @@ function closePopup() {
|
||||||
watch(
|
watch(
|
||||||
() => props.modal,
|
() => props.modal,
|
||||||
() => {
|
() => {
|
||||||
props.modal === true && props.detail && fetchDetailByid(props.detail.id);
|
props.modal === true &&
|
||||||
|
props.detail &&
|
||||||
|
fetchDetailByid(props.detail.id, props.typeTab as string);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ onMounted(async () => {
|
||||||
:rowsPerPage="rowsPerPage"
|
:rowsPerPage="rowsPerPage"
|
||||||
:maxPage="maxPage"
|
:maxPage="maxPage"
|
||||||
@update:pagination="updatePaging"
|
@update:pagination="updatePaging"
|
||||||
:tab="'1'"
|
:tab="'time-record'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ onMounted(async () => {
|
||||||
:rowsPerPage="rowsPerPage"
|
:rowsPerPage="rowsPerPage"
|
||||||
:maxPage="maxPage"
|
:maxPage="maxPage"
|
||||||
@update:pagination="updatePagingProp"
|
@update:pagination="updatePagingProp"
|
||||||
:tab="'2'"
|
:tab="'log-record'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,15 +64,15 @@ function updateProp(newPagination: any, page: number) {
|
||||||
emit("update:pagination", newPagination, page);
|
emit("update:pagination", newPagination, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const typeTab = ref<string>("");
|
||||||
/**
|
/**
|
||||||
* Function openPopup และแสดงรายละเอียด
|
* Function openPopup และแสดงรายละเอียด
|
||||||
* @param data ข้อมูลรายละเอียด
|
* @param data ข้อมูลรายละเอียด
|
||||||
*/
|
*/
|
||||||
function clickDetail(data: any) {
|
function clickDetail(data: any) {
|
||||||
if (props.tab === "1") {
|
typeTab.value = props.tab as string;
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
dataDetail.value = data;
|
dataDetail.value = data;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Function ปิด popup */
|
/** Function ปิด popup */
|
||||||
|
|
@ -156,7 +156,12 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
</template>
|
</template>
|
||||||
</d-table>
|
</d-table>
|
||||||
|
|
||||||
<DialogDetail :modal="modal" :detail="dataDetail" :close="closeDetail" />
|
<DialogDetail
|
||||||
|
:modal="modal"
|
||||||
|
:detail="dataDetail"
|
||||||
|
:typeTab="typeTab"
|
||||||
|
:close="closeDetail"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue