refactor: refs #8316 used VnSection and VnBetaCard
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jose Antonio Tubau 2024-12-27 14:06:12 +01:00
parent 93047ab179
commit 967e3334ae
5 changed files with 105 additions and 92 deletions

View File

@ -1,20 +1,12 @@
<script setup> <script setup>
import VnCard from 'components/common/VnCard.vue'; import VnCardBeta from 'components/common/VnCardBeta.vue';
import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue'; import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
import ItemTypeFilter from 'src/pages/Item/ItemType/ItemTypeFilter.vue';
import ItemTypeSearchbar from '../ItemTypeSearchbar.vue';
</script> </script>
<template> <template>
<VnCard <VnCardBeta
data-key="ItemTypeSummary" data-key="ItemTypeSummary"
base-url="ItemTypes" base-url="ItemTypes"
:descriptor="ItemTypeDescriptor" :descriptor="ItemTypeDescriptor"
:filter-panel="ItemTypeFilter" />
search-data-key="ItemTypeList"
search-url="ItemTypes"
>
<template #searchbar>
<ItemTypeSearchbar />
</template>
</VnCard>
</template> </template>

View File

@ -15,3 +15,5 @@ itemType:
promo: Promo promo: Promo
itemPackingType: Item packing type itemPackingType: Item packing type
isUnconventionalSize: Is unconventional size isUnconventionalSize: Is unconventional size
search: Search item type
searchInfo: Search item type by id, name or code

View File

@ -15,3 +15,5 @@ itemType:
promo: Promoción promo: Promoción
itemPackingType: Tipo de embalaje itemPackingType: Tipo de embalaje
isUnconventionalSize: Es de tamaño poco convencional isUnconventionalSize: Es de tamaño poco convencional
search: Buscar familia
searchInfo: Buscar familia por id, nombre o código

View File

@ -1,17 +1,17 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import ItemTypeSearchbar from 'src/pages/Item/ItemType/ItemTypeSearchbar.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ItemTypeFilter from './ItemType/ItemTypeFilter.vue'; import ItemTypeFilter from './ItemType/ItemTypeFilter.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const itemCategoriesOptions = ref([]); const itemCategoriesOptions = ref([]);
const temperatureOptions = ref([]); const temperatureOptions = ref([]);
const dataKey='ItemTypeList';
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -103,16 +103,23 @@ const columns = computed(() => [
@on-fetch="(data) => (temperatureOptions = data)" @on-fetch="(data) => (temperatureOptions = data)"
auto-load auto-load
/> />
<RightMenu> <VnSection
<template #right-panel> :data-key="dataKey"
:columns="columns"
prefix="itemType"
:array-data-props="{
url: 'ItemTypes',
order: 'name ASC',
exprBuilder,
}"
>
<template #rightMenu>
<ItemTypeFilter data-key="ItemTypeList" /> <ItemTypeFilter data-key="ItemTypeList" />
</template> </template>
</RightMenu> <template #body>
<ItemTypeSearchbar />
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="ItemTypeList" :data-key="dataKey"
url="ItemTypes"
:create="{ :create="{
urlCreate: 'ItemTypes', urlCreate: 'ItemTypes',
title: t('Create ItemTypes'), title: t('Create ItemTypes'),
@ -133,7 +140,6 @@ const columns = computed(() => [
}, },
}, },
}" }"
order="name ASC"
:columns="columns" :columns="columns"
auto-load auto-load
:right-search="false" :right-search="false"
@ -146,6 +152,8 @@ const columns = computed(() => [
</span> </span>
</template> </template>
</VnTable> </VnTable>
</template>
</VnSection>
</template> </template>
<i18n> <i18n>

View File

@ -1,44 +1,34 @@
import { RouterView } from 'vue-router'; import { RouterView } from 'vue-router';
export default { const itemTypeCard = {
path: '/item/item-type',
name: 'ItemType',
meta: {
title: 'itemType',
icon: 'contact_support',
moduleName: 'ItemType',
},
component: RouterView,
redirect: { name: 'ItemTypeList' },
menus: {
main: [],
card: ['ItemTypeBasicData', 'ItemTypeLog'],
},
children: [
{
name: 'ItemTypeCard', name: 'ItemTypeCard',
path: ':id', path: ':id',
component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'), component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'),
redirect: { name: 'ItemTypeSummary' }, redirect: { name: 'ItemTypeSummary' },
meta: {
menu: [
'ItemTypeBasicData',
'ItemTypeLog',
]
},
children: [ children: [
{ {
name: 'ItemTypeSummary',
path: 'summary', path: 'summary',
name: 'ItemTypeSummary',
meta: { meta: {
title: 'summary', title: 'summary',
icon: 'launch',
}, },
component: () => component: () => import('src/pages/Item/ItemType/Card/ItemTypeSummary.vue'),
import('src/pages/Item/ItemType/Card/ItemTypeSummary.vue'),
}, },
{ {
name: 'ItemTypeBasicData',
path: 'basic-data', path: 'basic-data',
name: 'ItemTypeBasicData',
meta: { meta: {
title: 'basicData', title: 'basicData',
icon: 'vn:settings', icon: 'vn:settings',
}, },
component: () => component: () => import('src/pages/Item/ItemType/Card/ItemTypeBasicData.vue'),
import('src/pages/Item/ItemType/Card/ItemTypeBasicData.vue'),
}, },
{ {
path: 'log', path: 'log',
@ -47,10 +37,29 @@ export default {
title: 'log', title: 'log',
icon: 'vn:History', icon: 'vn:History',
}, },
component: () => component: () => import('src/pages/Item/ItemType/Card/ItemTypeLog.vue'),
import('src/pages/Item/ItemType/Card/ItemTypeLog.vue'), },
}, ],
], };
export default {
name: 'ItemType',
path: '/item/item-type',
meta: {
title: 'itemType',
icon: 'contact_support',
moduleName: 'ItemType',
menu: [],
},
component: RouterView,
redirect: { name: 'ItemTypeMain' },
children: [
{
name: 'ItemTypeMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'ItemTypeIndexMain' },
children: [itemTypeCard],
}, },
], ],
}; };