From 0b11e5647f419729b68c8c45a12b4a944d089822 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 4 Mar 2024 12:47:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B8=A7?= =?UTF-8?q?=E0=B8=B1=E0=B8=99=E0=B8=99=E0=B8=B5=E0=B9=89=E0=B9=80=E0=B8=A3?= =?UTF-8?q?=E0=B8=B4=E0=B9=88=E0=B8=A1=E0=B8=95=E0=B9=89=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/04_registry/components/Other.vue | 16 ++++++++++------ .../04_registry/interface/request/Other.ts | 2 +- .../04_registry/interface/response/Other.ts | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/modules/04_registry/components/Other.vue b/src/modules/04_registry/components/Other.vue index 8cf5944c1..27374a881 100644 --- a/src/modules/04_registry/components/Other.vue +++ b/src/modules/04_registry/components/Other.vue @@ -23,8 +23,8 @@ @click="selectData(props)" class="cursor-pointer" > -
- {{ col.value ? date2Thai(col.value) : "-" }} +
+ {{ col.value !== null ? date2Thai(col.value) : "-" }}
{{ col.value ? col.value : "-" }} @@ -213,7 +213,7 @@ const { } = mixin; const route = useRoute(); const id = ref(""); -const date = ref(new Date()); +const date = ref(null); const detail = ref(); const myForm = ref(); //form data input const edit = ref(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 = ""; }; /** diff --git a/src/modules/04_registry/interface/request/Other.ts b/src/modules/04_registry/interface/request/Other.ts index 90339caaa..94dd9944b 100644 --- a/src/modules/04_registry/interface/request/Other.ts +++ b/src/modules/04_registry/interface/request/Other.ts @@ -6,7 +6,7 @@ interface DataProps { //ข้อมูล interface RequestItemsObject { id: string; - date: Date; + date: Date|null; detail: string; createdFullName: string; createdAt: Date; diff --git a/src/modules/04_registry/interface/response/Other.ts b/src/modules/04_registry/interface/response/Other.ts index 7bce7e100..8cb46c7db 100644 --- a/src/modules/04_registry/interface/response/Other.ts +++ b/src/modules/04_registry/interface/response/Other.ts @@ -1,7 +1,7 @@ //ข้อมูล interface ResponseObject { id: string; - date: Date; + date: Date|null; detail: string; createdFullName: string; createdAt: Date;