แก้ไข noteส่งไม่ไป,แสดงผลคอลัมน์

This commit is contained in:
oat 2024-01-30 10:22:14 +07:00
parent c8a9e61625
commit 64573c492f
3 changed files with 7 additions and 9 deletions

View file

@ -181,7 +181,6 @@ async function fetchData(id: string) {
}
onMounted(async () => {
fetchData(id.value);
console.log(id.value);
});
async function onSubmit() {
@ -207,7 +206,7 @@ async function addData() {
name: name.value,
isActive: isActive.value,
shortName: shortName.value,
note: note.value == "" ? "-" : "",
note: note.value == "" ? "-" : note.value,
insigniaTypeId: id.value,
});
fetchData(id.value);
@ -218,7 +217,7 @@ async function editData(idData: string) {
name: name.value,
isActive: isActive.value,
shortName: shortName.value,
note: note.value == "" ? "-" : "",
note: note.value == "" ? "-" : note.value,
insigniaTypeId: id.value,
});
fetchData(id.value);
@ -232,10 +231,6 @@ async function deleteData(idData: string) {
import { defineEmits } from "vue";
const emit = defineEmits(["nameType"]);
const nameType = () => {
emit("nameType", insigniaTypeId.value);
};
</script>
<template>

View file

@ -5,6 +5,7 @@ interface DataResponse {
lastUpdateFullName: String;
lastUpdatedAt: Date;
name: string;
level: Number;
}
interface DataRow {

View file

@ -10,15 +10,17 @@ const { date2Thai } = useCounterMixin();
export const useInsigniaDataStore = defineStore("insigniaData", () => {
const row = ref<DataRow[]>();
const name1 = ref<string>("");
function fetchData(data: DataResponse[], insigniaType?: string) {
data.forEach((row, index) => {
row.level = index + 1;
});
const list = data.map((e) => ({
...e,
insigniaType: insigniaType,
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
}));
console.log("test");
list;
row.value = list;
}