You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.5 KiB

1 year ago
<template>
<w-dialog ref="dialogRef" :title="$t('re.resources.importSample.dialog.title')" width="900px" :can-maximize="false">
<div class="px-2">
<w-grid
ref="gridRef"
:height="300"
:title="$t('re.resources.importSample.grid.title')"
selection="multiple"
:full-screen-button="false"
10 months ago
:config-button="false"
1 year ago
:tree="true"
dense-body
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
'expand',
'separator',
{
name: 'import',
label: $t('re.resources.importSample.grid.toolbar.import'),
icon: 'bi-database-up',
enableIf: (arg) => {
return arg.ticked;
},
click: (arg) => {
if (arg.tickeds && arg.tickeds.length > 0) {
const ids = Tools.extractProperties(arg.tickeds, 'id');
10 months ago
axios.post(Environment.apiContextPath('/api/re/resource/createExample'), ids, { loading: true }).then(() => {
close();
emit('afterImported');
1 year ago
});
10 months ago
// DialogManager.confirm($t('re.resources.importSample.grid.toolbar.import.tip'), () => {
// });
1 year ago
}
},
},
]"
:query-form-fields="[]"
:auto-fetch-data="false"
:fetch-data-url="Environment.apiContextPath('/api/re/resource/listResourceExampleContributionItems')"
foreign-key="parentId"
:columns="[
{
width: 200,
name: 'name',
label: $t('name'),
format: (value, row) => {
return $t(row.id);
},
},
{
width: '100%',
name: 'description',
label: $t('description'),
format: (value, row) => {
return $t(row.id + '.description');
},
},
]"
></w-grid>
</div>
</w-dialog>
</template>
<script setup lang="ts">
import { ref, nextTick } from 'vue';
10 months ago
import { useQuasar } from 'quasar';
1 year ago
import { axios, Environment, DialogManager, Tools } from 'platform-core';
const emit = defineEmits<{
(e: 'afterImported', evt: Event): void;
}>();
10 months ago
const quasar = useQuasar();
1 year ago
const dialogRef = ref();
const gridRef = ref();
const open = () => {
dialogRef.value.show();
nextTick(() => {
gridRef.value.refresh();
});
};
const close = () => {
dialogRef.value.hide();
};
defineExpose({
open,
close,
});
</script>