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;