diff --git a/src/pages/Wagon/Type/WagonTypeList.vue b/src/pages/Wagon/Type/WagonTypeList.vue index 7615dea02..2f0d55fbe 100644 --- a/src/pages/Wagon/Type/WagonTypeList.vue +++ b/src/pages/Wagon/Type/WagonTypeList.vue @@ -2,14 +2,13 @@ import { ref, computed } from 'vue'; import axios from 'axios'; import { useQuasar } from 'quasar'; -import VnPaginate from 'src/components/ui/VnPaginate.vue'; import { useArrayData } from 'src/composables/useArrayData'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; -import CardList from 'components/ui/CardList.vue'; import FormModelPopup from 'src/components/FormModelPopup.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnRow from 'src/components/ui/VnRow.vue'; +import VnTable from 'src/components/VnTable/VnTable.vue'; const quasar = useQuasar(); const arrayData = useArrayData('WagonTypeList'); @@ -17,7 +16,7 @@ const store = arrayData.store; const dialog = ref(); const { push } = useRouter(); const { t } = useI18n(); -const paginate = ref(); +const tableRef = ref(); const initialData = computed(() => { return { @@ -25,10 +24,46 @@ const initialData = computed(() => { }; }); -function reloadData() { - initialData.value.name = null; - paginate.value.fetch(); -} +const columns = computed(() => [ + { + align: 'left', + name: 'id', + label: t('ID'), + isId: true, + cardVisible: true, + }, + { + align: 'left', + name: 'name', + label: t('Name'), + isTitle: true, + }, + { + align: 'left', + name: 'divisible', + label: t('Divisible'), + cardVisible: true, + component: 'checkbox', + }, + { + align: 'right', + name: 'tableActions', + actions: [ + { + title: t('components.smartCard.openCard'), + icon: 'arrow_forward', + isPrimary: true, + action: (row) => navigate(row.id, row.name), + }, + { + title: t('wagon.list.remove'), + icon: 'delete', + isPrimary: true, + action: (row) => remove(row), + }, + ], + }, +]); function navigate(id, name) { push({ path: `/wagon/type/${id}/edit`, query: { name } }); @@ -41,51 +76,25 @@ async function remove(row) { type: 'positive', }); store.data.splice(store.data.indexOf(row), 1); + window.location.reload(); }