refactor: refs #8316 unify router item and itemType
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
2c67041030
commit
4c7a35f142
|
@ -332,8 +332,8 @@ onBeforeMount(async () => {
|
|||
:columns="columns"
|
||||
prefix="item"
|
||||
:array-data-props="{
|
||||
url: 'Items',
|
||||
order: ['isActive DESC', 'name', 'id']
|
||||
url: 'Items/filter',
|
||||
order: ['isActive DESC', 'name', 'id'],
|
||||
}"
|
||||
>
|
||||
<template #rightMenu>
|
||||
|
@ -347,15 +347,14 @@ onBeforeMount(async () => {
|
|||
:columns="columns"
|
||||
:right-search="false"
|
||||
redirect="Item"
|
||||
url="Items/filter"
|
||||
:create="{
|
||||
urlCreate: 'Items/new',
|
||||
title: t('item.list.newItem'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
||||
formInitialData: {
|
||||
editorFk: entityId,
|
||||
tag: defaultTag,
|
||||
priority: defaultPriority,
|
||||
tag: defaultTag,
|
||||
priority: defaultPriority,
|
||||
},
|
||||
}"
|
||||
:is-editable="false"
|
||||
|
@ -397,96 +396,100 @@ onBeforeMount(async () => {
|
|||
</div>
|
||||
<FetchedTags :item="row" :columns="3" />
|
||||
</template>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
v-model="data.provisionalName"
|
||||
:label="t('globals.description')"
|
||||
:is-required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="Tags"
|
||||
v-model="data.tag"
|
||||
:label="t('globals.tag')"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
:sort-by="['name ASC']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
v-model="data.provisionalName"
|
||||
:label="t('globals.description')"
|
||||
:is-required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="Tags"
|
||||
v-model="data.tag"
|
||||
:label="t('globals.tag')"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
:sort-by="['name ASC']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
#{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:options="validPriorities"
|
||||
v-model="data.priority"
|
||||
:label="t('item.create.priority')"
|
||||
:is-required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="ItemTypes"
|
||||
v-model="data.typeFk"
|
||||
:label="t('item.list.typeName')"
|
||||
:fields="['id', 'code', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
url="Intrastats"
|
||||
v-model="data.intrastatFk"
|
||||
:label="t('globals.intrastat')"
|
||||
:fields="['id', 'description']"
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.description }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
#{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
url="Origins"
|
||||
v-model="data.originFk"
|
||||
:label="t('globals.origin')"
|
||||
:fields="['id', 'code', 'name']"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:options="validPriorities"
|
||||
v-model="data.priority"
|
||||
:label="t('item.create.priority')"
|
||||
:is-required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="ItemTypes"
|
||||
v-model="data.typeFk"
|
||||
:label="t('item.list.typeName')"
|
||||
:fields="['id', 'code', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
url="Intrastats"
|
||||
v-model="data.intrastatFk"
|
||||
:label="t('globals.intrastat')"
|
||||
:fields="['id', 'description']"
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.description }}</QItemLabel>
|
||||
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
url="Origins"
|
||||
v-model="data.originFk"
|
||||
:label="t('globals.origin')"
|
||||
:fields="['id', 'code', 'name']"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['search']);
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'name':
|
||||
return {
|
||||
name: { like: `%${value}%` },
|
||||
};
|
||||
case 'code':
|
||||
return {
|
||||
code: { like: `%${value}%` },
|
||||
};
|
||||
case 'search':
|
||||
if (value) {
|
||||
if (!isNaN(value)) {
|
||||
return { id: value };
|
||||
} else {
|
||||
return {
|
||||
or: [
|
||||
{
|
||||
name: {
|
||||
like: `%${value}%`,
|
||||
},
|
||||
},
|
||||
{
|
||||
code: {
|
||||
like: `%${value}%`,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
@search="emit('search')"
|
||||
search-url="table"
|
||||
:expr-builder="exprBuilder"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput v-model="params.code" :label="t('Code')" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
name: Name
|
||||
code: Code
|
||||
es:
|
||||
params:
|
||||
name: Nombre
|
||||
code: Código
|
||||
Name: Nombre
|
||||
Code: Código
|
||||
</i18n>
|
|
@ -3,7 +3,6 @@ import { useI18n } from 'vue-i18n';
|
|||
import { ref, computed } from 'vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import ItemTypeFilter from './ItemType/ItemTypeFilter.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
|
||||
|
@ -11,7 +10,41 @@ const { t } = useI18n();
|
|||
const tableRef = ref();
|
||||
const itemCategoriesOptions = ref([]);
|
||||
const temperatureOptions = ref([]);
|
||||
const dataKey='ItemTypeList';
|
||||
const dataKey = 'ItemTypeList';
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'name':
|
||||
return {
|
||||
name: { like: `%${value}%` },
|
||||
};
|
||||
case 'code':
|
||||
return {
|
||||
code: { like: `%${value}%` },
|
||||
};
|
||||
case 'search':
|
||||
if (value) {
|
||||
if (!isNaN(value)) {
|
||||
return { id: value };
|
||||
} else {
|
||||
return {
|
||||
or: [
|
||||
{
|
||||
name: {
|
||||
like: `%${value}%`,
|
||||
},
|
||||
},
|
||||
{
|
||||
code: {
|
||||
like: `%${value}%`,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
|
@ -110,11 +143,9 @@ const columns = computed(() => [
|
|||
:array-data-props="{
|
||||
url: 'ItemTypes',
|
||||
order: 'name ASC',
|
||||
exprBuilder,
|
||||
}"
|
||||
>
|
||||
<template #rightMenu>
|
||||
<ItemTypeFilter data-key="ItemTypeList" />
|
||||
</template>
|
||||
<template #body>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
|
@ -141,7 +172,6 @@ const columns = computed(() => [
|
|||
}"
|
||||
:columns="columns"
|
||||
auto-load
|
||||
:right-search="false"
|
||||
redirect="item/item-type"
|
||||
>
|
||||
<template #column-workerFk="{ row }">
|
||||
|
|
|
@ -15,7 +15,6 @@ import Entry from './entry';
|
|||
import roadmap from './roadmap';
|
||||
import Parking from './parking';
|
||||
import Agency from './agency';
|
||||
import ItemType from './itemType';
|
||||
import Zone from './zone';
|
||||
import Account from './account';
|
||||
import Monitor from './monitor';
|
||||
|
@ -38,7 +37,6 @@ export default [
|
|||
roadmap,
|
||||
Parking,
|
||||
Agency,
|
||||
ItemType,
|
||||
Zone,
|
||||
Account,
|
||||
Monitor,
|
||||
|
|
|
@ -16,7 +16,7 @@ const itemCard = {
|
|||
'ItemBarcode',
|
||||
'ItemShelving',
|
||||
'ItemLastEntries',
|
||||
]
|
||||
],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
@ -112,6 +112,45 @@ const itemCard = {
|
|||
],
|
||||
};
|
||||
|
||||
const itemTypeCard = {
|
||||
name: 'ItemTypeCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'),
|
||||
redirect: { name: 'ItemTypeSummary' },
|
||||
meta: {
|
||||
menu: ['ItemTypeBasicData', 'ItemTypeLog'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'summary',
|
||||
name: 'ItemTypeSummary',
|
||||
meta: {
|
||||
title: 'summary',
|
||||
icon: 'launch',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeSummary.vue'),
|
||||
},
|
||||
{
|
||||
path: 'basic-data',
|
||||
name: 'ItemTypeBasicData',
|
||||
meta: {
|
||||
title: 'basicData',
|
||||
icon: 'vn:settings',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeBasicData.vue'),
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
name: 'ItemTypeLog',
|
||||
meta: {
|
||||
title: 'log',
|
||||
icon: 'vn:History',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeLog.vue'),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'Item',
|
||||
path: '/item',
|
||||
|
@ -125,7 +164,7 @@ export default {
|
|||
'WasteBreakdown',
|
||||
'ItemFixedPrice',
|
||||
'ItemRequest',
|
||||
'ItemTypeList'
|
||||
'ItemTypeList',
|
||||
],
|
||||
},
|
||||
component: RouterView,
|
||||
|
@ -138,7 +177,7 @@ export default {
|
|||
redirect: { name: 'ItemIndexMain' },
|
||||
children: [
|
||||
{
|
||||
path:'',
|
||||
path: '',
|
||||
name: 'ItemIndexMain',
|
||||
redirect: { name: 'ItemList' },
|
||||
component: () => import('src/pages/Item/ItemList.vue'),
|
||||
|
@ -151,7 +190,7 @@ export default {
|
|||
icon: 'view_list',
|
||||
},
|
||||
},
|
||||
itemCard,
|
||||
itemCard,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -186,22 +225,21 @@ export default {
|
|||
component: () => import('src/pages/Item/ItemFixedPrice.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'ItemCreate',
|
||||
meta: {
|
||||
title: 'itemCreate',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemCreate.vue'),
|
||||
},
|
||||
|
||||
{
|
||||
path: 'item-type-list',
|
||||
name: 'ItemTypeList',
|
||||
meta: {
|
||||
title: 'family',
|
||||
icon: 'contact_support',
|
||||
},
|
||||
path: 'item-type',
|
||||
name: 'ItemTypeMain',
|
||||
redirect: { name: 'ItemTypeList' },
|
||||
component: () => import('src/pages/Item/ItemTypeList.vue'),
|
||||
children: [
|
||||
{
|
||||
name: 'ItemTypeList',
|
||||
path: 'list',
|
||||
meta: {
|
||||
title: 'family',
|
||||
icon: 'contact_support',
|
||||
},
|
||||
},
|
||||
itemTypeCard,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
import { RouterView } from 'vue-router';
|
||||
|
||||
const itemTypeCard = {
|
||||
name: 'ItemTypeCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'),
|
||||
redirect: { name: 'ItemTypeSummary' },
|
||||
meta: {
|
||||
menu: [
|
||||
'ItemTypeBasicData',
|
||||
'ItemTypeLog',
|
||||
]
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'summary',
|
||||
name: 'ItemTypeSummary',
|
||||
meta: {
|
||||
title: 'summary',
|
||||
icon: 'launch',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeSummary.vue'),
|
||||
},
|
||||
{
|
||||
path: 'basic-data',
|
||||
name: 'ItemTypeBasicData',
|
||||
meta: {
|
||||
title: 'basicData',
|
||||
icon: 'vn:settings',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeBasicData.vue'),
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
name: 'ItemTypeLog',
|
||||
meta: {
|
||||
title: 'log',
|
||||
icon: 'vn:History',
|
||||
},
|
||||
component: () => 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],
|
||||
},
|
||||
],
|
||||
};
|
|
@ -9,7 +9,6 @@ import invoiceIn from './modules/invoiceIn';
|
|||
import wagon from './modules/wagon';
|
||||
import supplier from './modules/supplier';
|
||||
import travel from './modules/travel';
|
||||
import ItemType from './modules/itemType';
|
||||
import shelving from 'src/router/modules/shelving';
|
||||
import order from 'src/router/modules/order';
|
||||
import entry from 'src/router/modules/entry';
|
||||
|
@ -88,7 +87,6 @@ const routes = [
|
|||
entry,
|
||||
parking,
|
||||
agency,
|
||||
ItemType,
|
||||
zone,
|
||||
account,
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue