แก้ เก็บ ข้อมูลเเต่อาเรย์ที่ 0 เป็น inUse

This commit is contained in:
setthawutttty 2025-02-17 10:15:51 +07:00
parent 5f2d8cd481
commit d6d0d535aa
2 changed files with 6 additions and 4 deletions

View file

@ -1556,7 +1556,7 @@ onMounted(async () => {
</q-card>
</q-dialog>
<DialogSortEducation v-model:modal="modalSort" :data-sort="dataSort" />
<DialogSortEducation v-model:modal="modalSort" :data-sort="dataSort" :fetch-data="fetchData"/>
</template>
<style scoped>

View file

@ -35,6 +35,7 @@ const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
dataSort: Array as PropType<ResponseObject[]>,
fetchData: Function,
});
const profileId = ref<string>(route.params.id.toString()); //id profile
@ -247,6 +248,7 @@ function onSubmit() {
.then(async () => {
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
props.fetchData?.(profileId.value);
})
.catch((err) => {
messageError($q, err);
@ -259,8 +261,9 @@ function onSubmit() {
watch(modal, async () => {
if (modal.value && props.dataSort) {
rows.value = props.dataSort;
selected.value.push(rows.value[0]);
const dataList = props.dataSort;
rows.value = dataList;
selected.value = dataList.filter((item: any) => item.isUse == true);
} else {
selected.value = [];
rows.value = [];
@ -276,7 +279,6 @@ watch(modal, async () => {
:close="() => (modal = false)"
/>
<q-separator />
<q-card-section style="max-height: 70vh" class="scroll">
<q-table
v-if="rows.length > 0"