feat(VnTable): add selected funcitionality
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
22f42ca7f9
commit
6d12c0f00c
|
@ -59,6 +59,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hasSubtoolbar: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -177,9 +181,12 @@ function columnName(col) {
|
|||
function getColAlign(col) {
|
||||
return 'text-' + (col.align ?? 'left');
|
||||
}
|
||||
|
||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||
defineExpose({
|
||||
reload,
|
||||
redirect: redirectFn,
|
||||
selected,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
@ -225,11 +232,18 @@ defineExpose({
|
|||
:search-url="searchUrl"
|
||||
:disable-infinite-scroll="mode == TABLE_MODE"
|
||||
@save-changes="reload"
|
||||
:has-subtoolbar="isEditable"
|
||||
:has-subtoolbar="$attrs['hasSubtoolbar'] ?? isEditable"
|
||||
>
|
||||
<template
|
||||
v-for="(_, slotName) in $slots"
|
||||
#[slotName]="slotData"
|
||||
:key="slotName"
|
||||
>
|
||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||
</template>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-bind="$attrs['QTable']"
|
||||
v-bind="$attrs['q-table']"
|
||||
class="vnTable"
|
||||
:columns="splittedColumns.columns"
|
||||
:rows="rows"
|
||||
|
@ -246,6 +260,7 @@ defineExpose({
|
|||
CrudModelRef.vnPaginateRef.paginate()
|
||||
"
|
||||
@row-click="(_, row) => rowClickFunction(row)"
|
||||
@update:selected="emit('update:selected', $event)"
|
||||
>
|
||||
<template #top-left>
|
||||
<slot name="top-left"></slot>
|
||||
|
@ -485,6 +500,7 @@ defineExpose({
|
|||
default="input"
|
||||
v-model="data[column.name]"
|
||||
:show-label="true"
|
||||
component-prop="columnCreate"
|
||||
/>
|
||||
<slot name="more-create-dialog" :data="data" />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue