This commit is contained in:
Viet An
2026-06-08 10:19:16 +07:00
parent 605b016a5f
commit c1fa84083f
3 changed files with 33 additions and 11 deletions

View File

@@ -14,7 +14,7 @@
<div <div
class="modal-card" class="modal-card"
:style="{ :style="{
width: $store.viewport <= 1 ? 'calc(100% - 2rem)' : width || '60%', width: $store.viewport <= 1 ? 'calc(100% - 2rem)' : width,
}" }"
> >
<header <header
@@ -33,14 +33,25 @@
</header> </header>
<section <section
class="modal-card-body p-4" class="modal-card-body p-4"
:style="{ minHeight: height || '750px' }" :style="{ minHeight: height }"
> >
<Suspense>
<component <component
:is="resolvedComponent" :is="resolvedComponent"
v-bind="vbind" v-bind="vbind"
@modalevent="modalEvent" @modalevent="modalEvent"
@close="closeModal" @close="closeModal"
/> />
<template #fallback>
<div class="h-full is-flex is-justify-content-center is-align-items-center">
<Icon
name="svg-spinners:180-ring-with-bg"
:size="28"
class="has-text-primary"
/>
</div>
</template>
</Suspense>
</section> </section>
<footer class="modal-card-foot px-4 pb-4 pt-0"></footer> <footer class="modal-card-foot px-4 pb-4 pt-0"></footer>
</div> </div>
@@ -56,8 +67,8 @@ const { $store } = useNuxtApp();
const props = defineProps({ const props = defineProps({
component: String, component: String,
width: String, width: { type: String, default: "60%" },
height: String, height: { type: String, default: "750px" },
vbind: Object, vbind: Object,
title: String, title: String,
}); });

View File

@@ -59,6 +59,7 @@
name: field, name: field,
fontsize: 14, fontsize: 14,
maxHeight: '200px', maxHeight: '200px',
clearTrigger,
}" }"
@selected="choose" @selected="choose"
/> />
@@ -187,6 +188,7 @@ const pos = computed(() => {
return "is-right"; return "is-right";
} }
}); });
const clearTrigger = ref(0);
if (props.vdata) { if (props.vdata) {
orgdata.value = props.vdata; orgdata.value = props.vdata;
@@ -273,6 +275,7 @@ function doSelect(option) {
function clearValue() { function clearValue() {
value.value = undefined; value.value = undefined;
selected.value = undefined; selected.value = undefined;
clearTrigger.value++;
emit("option", null); emit("option", null);
emit("modalevent", { name: "option", data: null }); emit("modalevent", { name: "option", data: null });
} }

View File

@@ -17,7 +17,7 @@
<td> <td>
<span>{{ $stripHtml(v[name] || v.fullname || v.code || "n/a", 75) }}</span> <span>{{ $stripHtml(v[name] || v.fullname || v.code || "n/a", 75) }}</span>
<span <span
v-if="checked[i] && notick !== true" v-if="checked[i] && !notick"
class="icon right-3 has-background-inherit" class="icon right-3 has-background-inherit"
> >
<Icon <Icon
@@ -183,6 +183,7 @@ const props = defineProps({
show: Object, show: Object,
notick: Boolean, notick: Boolean,
inContext: Boolean, inContext: Boolean,
clearTrigger: Number,
}); });
const emit = defineEmits(["selected"]); const emit = defineEmits(["selected"]);
@@ -211,6 +212,13 @@ watch(
{ deep: true }, { deep: true },
); );
watch(
() => props.clearTrigger,
() => {
checked.value = {};
},
);
function getdata() { function getdata() {
currentPage.value = 1; currentPage.value = 1;
array.value = $copy(props.data); array.value = $copy(props.data);