feat: refs #6919 sync alias
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-11-18 16:38:58 +01:00
parent a44ea9384a
commit 617af7b7cb
5 changed files with 21 additions and 34 deletions

View File

@ -4,19 +4,11 @@ import { ref, computed } from 'vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import exprBuilder from './Alias/AliasExprBuilder.js';
const tableRef = ref(); const tableRef = ref();
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const exprBuilder = (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? { id: value }
: { alias: { like: `%${value}%` } };
}
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',

View File

@ -0,0 +1,8 @@
export default (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? { id: value }
: { alias: { like: `%${value}%` } };
}
};

View File

@ -1,8 +1,7 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import AliasDescriptor from './AliasDescriptor.vue'; import AliasDescriptor from './AliasDescriptor.vue';
const { t } = useI18n(); import exprBuilder from '../AliasExprBuilder.js';
</script> </script>
<template> <template>
@ -13,9 +12,10 @@ const { t } = useI18n();
search-data-key="AccountAliasList" search-data-key="AccountAliasList"
:searchbar-props="{ :searchbar-props="{
url: 'MailAliases', url: 'MailAliases',
info: t('mailAlias.searchInfo'), info: $t('mailAlias.searchInfo'),
label: t('mailAlias.search'), label: $t('mailAlias.search'),
searchUrl: 'table', searchUrl: 'table',
exprBuilder,
}" }"
/> />
</template> </template>

View File

@ -7,7 +7,6 @@ import { useQuasar } from 'quasar';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
@ -29,9 +28,6 @@ const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.alias, entity.id));
const removeAlias = () => { const removeAlias = () => {
quasar quasar
.dialog({ .dialog({
@ -60,10 +56,8 @@ const removeAlias = () => {
ref="descriptor" ref="descriptor"
:url="`MailAliases/${entityId}`" :url="`MailAliases/${entityId}`"
module="Alias" module="Alias"
@on-fetch="setData" data-key="Alias"
data-key="aliasData" title="alias"
:title="data.title"
:subtitle="data.subtitle"
> >
<template #menu> <template #menu>
<QItem v-ripple clickable @click="removeAlias()"> <QItem v-ripple clickable @click="removeAlias()">

View File

@ -1,13 +1,11 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -18,20 +16,15 @@ const $props = defineProps({
}, },
}); });
const { store } = useArrayData('Alias');
const alias = ref(store.data);
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
</script> </script>
<template> <template>
<CardSummary <CardSummary ref="summary" :url="`MailAliases/${entityId}`" data-key="Alias">
ref="summary" <template #header="{ entity: alias }">
:url="`MailAliases/${entityId}`" {{ alias.id }} - {{ alias.alias }}
@on-fetch="(data) => (alias = data)" </template>
data-key="MailAliasesSummary" <template #body="{ entity: alias }">
>
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
<template #body>
<QCard class="vn-one"> <QCard class="vn-one">
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
<router-link <router-link