refactor: refs #8220 requested changes
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
5de2805fa9
commit
548db113eb
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, onBeforeMount } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
@ -17,7 +17,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
|||
import ItemListFilter from './ItemListFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const entityId = computed(() => route.params.id);
|
||||
const { openCloneDialog } = cloneItem();
|
||||
|
@ -26,6 +26,8 @@ const { t } = useI18n();
|
|||
const tableRef = ref();
|
||||
const route = useRoute();
|
||||
const validPriorities = ref([]);
|
||||
const defaultTag = ref();
|
||||
const defaultPriority = ref();
|
||||
const itemFilter = {
|
||||
include: [
|
||||
{
|
||||
|
@ -134,7 +136,6 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
|
@ -302,13 +303,17 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const { data } = await axios.get('ItemConfigs');
|
||||
defaultTag.value = data[0].defaultTag;
|
||||
defaultPriority.value = data[0].defaultPriority;
|
||||
data.forEach((priority) => {
|
||||
validPriorities.value = priority.validPriorities;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="ItemConfigs"
|
||||
@on-fetch="([{ validPriorities: data }]) => (validPriorities = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="ItemList"
|
||||
:label="t('item.searchbar.label')"
|
||||
|
@ -320,6 +325,7 @@ const columns = computed(() => [
|
|||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
v-if="defaultTag"
|
||||
ref="tableRef"
|
||||
data-key="ItemList"
|
||||
url="Items/filter"
|
||||
|
@ -329,8 +335,8 @@ const columns = computed(() => [
|
|||
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
||||
formInitialData: {
|
||||
editorFk: entityId,
|
||||
tag: 56,
|
||||
priority: 2,
|
||||
tag: defaultTag,
|
||||
priority: defaultPriority,
|
||||
},
|
||||
}"
|
||||
:order="['isActive DESC', 'name', 'id']"
|
||||
|
|
|
@ -3,12 +3,10 @@ describe('Item botanical', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/list`);
|
||||
cy.typeSearchbar('1{enter}');
|
||||
cy.visit(`/#/item/1/botanical`);
|
||||
});
|
||||
|
||||
it('should modify the botanical', () => {
|
||||
cy.get('[href="#/item/1/botanical"]').click();
|
||||
cy.dataCy('AddGenusSelectDialog').type('Abies');
|
||||
cy.get('.q-menu .q-item').contains('Abies').click();
|
||||
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
|
||||
|
@ -18,7 +16,6 @@ describe('Item botanical', () => {
|
|||
});
|
||||
|
||||
it('should create a new Genus', () => {
|
||||
cy.get('[href="#/item/1/botanical"]').click();
|
||||
cy.dataCy('Genus_icon').click();
|
||||
cy.dataCy('Latin genus name_input').type('Test');
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
|
@ -26,7 +23,6 @@ describe('Item botanical', () => {
|
|||
});
|
||||
|
||||
it('should create a new specie', () => {
|
||||
cy.get('[href="#/item/1/botanical"]').click();
|
||||
cy.dataCy('Species_icon').click();
|
||||
cy.dataCy('Latin species name_input').type('Test specie');
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
|
|
|
@ -3,8 +3,7 @@ describe('Item summary', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/list`);
|
||||
cy.typeSearchbar('1{enter}');
|
||||
cy.visit(`/#/item/1/summary`);
|
||||
});
|
||||
|
||||
it('should clone the item', () => {
|
||||
|
|
|
@ -3,12 +3,10 @@ describe('Item tax', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/list`);
|
||||
cy.typeSearchbar('1{enter}');
|
||||
cy.visit(`/#/item/1/tax`);
|
||||
});
|
||||
|
||||
it('should modify the tax for Spain', () => {
|
||||
cy.get('[href="#/item/1/tax"]').click();
|
||||
cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification('Data saved');
|
||||
|
|
Loading…
Reference in New Issue