แก้ วันนี้เริ่มต้น
This commit is contained in:
parent
cd5647cb10
commit
0b11e5647f
3 changed files with 12 additions and 8 deletions
|
|
@ -23,8 +23,8 @@
|
|||
@click="selectData(props)"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<div v-if="col.name == 'date'" class="table_ellipsis">
|
||||
{{ col.value ? date2Thai(col.value) : "-" }}
|
||||
<div v-if="col.name == 'date'">
|
||||
{{ col.value !== null ? date2Thai(col.value) : "-" }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
|
|
@ -213,7 +213,7 @@ const {
|
|||
} = mixin;
|
||||
const route = useRoute();
|
||||
const id = ref<string>("");
|
||||
const date = ref<Date>(new Date());
|
||||
const date = ref<Date|null>(null);
|
||||
const detail = ref<string>();
|
||||
const myForm = ref<any>(); //form data input
|
||||
const edit = ref<boolean>(false); //เช็คการกดปุ่มแก้ไขใน dialog
|
||||
|
|
@ -350,11 +350,12 @@ const fetchData = async () => {
|
|||
data.map((e: ResponseObject) => {
|
||||
rows.value.push({
|
||||
id: e.id,
|
||||
date: new Date(e.date),
|
||||
date: e.date ? new Date(e.date):null,
|
||||
detail: e.detail,
|
||||
createdFullName: e.createdFullName,
|
||||
createdAt: new Date(e.createdAt),
|
||||
});
|
||||
console.log(rows.value)
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -391,7 +392,9 @@ const clickNext = async () => {
|
|||
*/
|
||||
const getData = () => {
|
||||
const row = rows.value[rowIndex.value];
|
||||
console.log(row)
|
||||
date.value = row.date;
|
||||
inputDate.value = row.date == null ? '':convertDateDisplay(row.date as Date);
|
||||
detail.value = row.detail;
|
||||
id.value = row.id;
|
||||
};
|
||||
|
|
@ -564,7 +567,7 @@ const selectData = async (props: DataProps) => {
|
|||
detail.value = props.row.detail;
|
||||
id.value = props.row.id;
|
||||
|
||||
inputDate.value = convertDateDisplay(date.value);
|
||||
inputDate.value = date.value !== null ? convertDateDisplay(date.value as Date):'';
|
||||
await checkRowPage();
|
||||
};
|
||||
|
||||
|
|
@ -575,8 +578,9 @@ const addData = () => {
|
|||
modalEdit.value = false;
|
||||
modal.value = true;
|
||||
edit.value = true;
|
||||
date.value = new Date();
|
||||
date.value = null;
|
||||
detail.value = "";
|
||||
inputDate.value = "";
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ interface DataProps {
|
|||
//ข้อมูล
|
||||
interface RequestItemsObject {
|
||||
id: string;
|
||||
date: Date;
|
||||
date: Date|null;
|
||||
detail: string;
|
||||
createdFullName: string;
|
||||
createdAt: Date;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//ข้อมูล
|
||||
interface ResponseObject {
|
||||
id: string;
|
||||
date: Date;
|
||||
date: Date|null;
|
||||
detail: string;
|
||||
createdFullName: string;
|
||||
createdAt: Date;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue