forked from verdnatura/salix-front
Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
38437aa2f9
|
@ -37,6 +37,10 @@ const $props = defineProps({
|
|||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
rowCtrlClick: {
|
||||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
redirect: {
|
||||
type: String,
|
||||
default: null,
|
||||
|
@ -206,6 +210,16 @@ const rowClickFunction = computed(() => {
|
|||
return () => {};
|
||||
});
|
||||
|
||||
const rowCtrlClickFunction = computed(() => {
|
||||
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
|
||||
if ($props.redirect)
|
||||
return (evt, { id }) => {
|
||||
stopEventPropagation(evt);
|
||||
window.open(`/#/${$props.redirect}/${id}`, '_blank');
|
||||
};
|
||||
return () => {};
|
||||
});
|
||||
|
||||
function redirectFn(id) {
|
||||
router.push({ path: `/${$props.redirect}/${id}` });
|
||||
}
|
||||
|
@ -420,6 +434,11 @@ defineExpose({
|
|||
class="no-margin q-px-xs"
|
||||
:class="[getColAlign(col), col.class, col.columnField?.class]"
|
||||
v-if="col.visible ?? true"
|
||||
@click.ctrl="
|
||||
($event) =>
|
||||
rowCtrlClickFunction &&
|
||||
rowCtrlClickFunction($event, row)
|
||||
"
|
||||
>
|
||||
<slot :name="`column-${col.name}`" :col="col" :row="row">
|
||||
<VnTableColumn
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
|
@ -15,12 +15,13 @@ const columns = [
|
|||
{
|
||||
align: 'center',
|
||||
label: t('entry.latestBuys.tableVisibleColumns.image'),
|
||||
name: 'image',
|
||||
name: 'itemFk',
|
||||
columnField: {
|
||||
component: VnImg,
|
||||
attrs: (id) => {
|
||||
return {
|
||||
id,
|
||||
size: '50x50',
|
||||
width: '50px',
|
||||
};
|
||||
},
|
||||
|
@ -169,6 +170,7 @@ const columns = [
|
|||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
||||
},
|
||||
];
|
||||
const tableRef = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
|
@ -191,6 +193,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
order="id DESC"
|
||||
:columns="columns"
|
||||
redirect="entry"
|
||||
:row-click="({ entryFk }) => tableRef.redirect(entryFk)"
|
||||
auto-load
|
||||
:right-search="false"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue