This commit is contained in:
setthawutttty 2024-01-05 11:05:49 +07:00
parent c2e0e5cb59
commit bc8a03139d
4 changed files with 51 additions and 48 deletions

View file

@ -11,11 +11,14 @@ import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader,date2Thai } = mixin;
const listCheck = ref<string>("");
const id = ref<string>('')
const props = defineProps({
modal: Boolean,
personId: {
@ -37,41 +40,50 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "directions",
name: "commandSubject",
align: "left",
label: "คำสั่ง",
sortable: true,
field: "directions",
field: "commandSubject",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateDirections",
name: "lastUpdatedAt",
align: "left",
label: "วันที่ส่งไปออกคำสั่ง",
sortable: true,
field: "dateDirections",
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
onMounted(() => {
const data = [
{
id: "1",
directions: "จำลอง1",
dateDirections: date2Thai(new Date(),false,true),
},
{
id: "2",
directions: "จำลอง2",
dateDirections: date2Thai(new Date(),false,true),
},
];
function getHistory(id:string){
showLoader()
http
.get(config.API.historyOrderById(id))
.then((res)=>{
console.log(res)
const data = res.data.result;
rows.value = data.map((item:any)=>({
commandSubject:item.commandSubject ? item.commandSubject : '-',
createdAt:item.createdAt ? date2Thai(item.createdAt,false,true) : '-',
lastUpdatedAt:item.lastUpdatedAt ? date2Thai(item.lastUpdatedAt,false,true) : '-',
}))
}).catch((e)=>{
messageError($q,e)
}).finally(()=>{
hideLoader()
})
}
watch(()=>props.personId,()=>{
if(props.personId){
getHistory(props.personId)
}
})
rows.value = data;
});
</script>
<template>