fix bug row table
This commit is contained in:
parent
b50ce5a533
commit
25932352a6
3 changed files with 42 additions and 33 deletions
|
|
@ -77,7 +77,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const rows = ref<any>();
|
||||
const rows = ref<any>([]);
|
||||
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
} from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
import { QForm, useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
|
@ -12,9 +9,16 @@ import config from "@/app.config";
|
|||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, success, messageError, dialogConfirm, hideLoader,date2Thai } = mixin;
|
||||
const {
|
||||
showLoader,
|
||||
success,
|
||||
messageError,
|
||||
dialogConfirm,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
const listCheck = ref<string>("");
|
||||
const id = ref<string>('')
|
||||
const id = ref<string>("");
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
personId: {
|
||||
|
|
@ -23,7 +27,7 @@ const props = defineProps({
|
|||
},
|
||||
close: Function,
|
||||
});
|
||||
const rows = ref<any>();
|
||||
const rows = ref<any>([]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -55,40 +59,45 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
function getHistory(id:string){
|
||||
showLoader()
|
||||
function getHistory(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.historyOrderById(id))
|
||||
.then((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()
|
||||
})
|
||||
.get(config.API.historyOrderById(id))
|
||||
.then((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)
|
||||
watch(
|
||||
() => props.personId,
|
||||
() => {
|
||||
if (props.personId) {
|
||||
getHistory(props.personId);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="props.modal" persistent>
|
||||
<q-card style="min-width: 40vw">
|
||||
<q-form ref="myForm">
|
||||
<DialogHeader
|
||||
:title="`ประวัติการออกคำสั่ง`"
|
||||
:close="props.close"
|
||||
/>
|
||||
<DialogHeader :title="`ประวัติการออกคำสั่ง`" :close="props.close" />
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<d-table
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const rows = ref<any>();
|
||||
const rows = ref<any>([]);
|
||||
|
||||
const props = defineProps({
|
||||
rowId: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue