fixed: Fixed export module default options

This commit is contained in:
zhaojisen 2024-06-18 18:02:20 +08:00
parent eba323fb64
commit 5dcdbb702f
4 changed files with 38 additions and 10 deletions

View File

@ -145,7 +145,7 @@ export default {
{ {
label: this.$t('ExportOnlySelectedItems'), label: this.$t('ExportOnlySelectedItems'),
value: 'selected', value: 'selected',
can: this.selectedRows.length > 0 && this.canExportSelected can: this.hasSelected && this.canExportSelected
}, },
{ {
label: this.$t('ExportOnlyFiltered'), label: this.$t('ExportOnlyFiltered'),
@ -180,6 +180,15 @@ export default {
showExportDialog() { showExportDialog() {
if (!this.mfaVerifyRequired) { if (!this.mfaVerifyRequired) {
this.exportDialogShow = true this.exportDialogShow = true
if (this.hasSelected) {
this.exportOption = 'selected'
}
if (this.tableHasQuery) {
this.exportOption = 'filtered'
}
return return
} }
this.$axios.get('/api/v1/authentication/confirm/check/?confirm_type=mfa').then(() => { this.$axios.get('/api/v1/authentication/confirm/check/?confirm_type=mfa').then(() => {
@ -221,12 +230,11 @@ export default {
async handleExportConfirm() { async handleExportConfirm() {
await this.handleExport() await this.handleExport()
this.exportDialogShow = false this.exportDialogShow = false
this.$emit('importDialogConfirm')
}, },
handleExportCancel() { handleExportCancel() {
const vm = this this.exportDialogShow = false
setTimeout(() => { this.$emit('importDialogClose')
vm.exportDialogShow = false
}, 100)
}, },
handleAuthMFAError() { handleAuthMFAError() {
this.mfaDialogShow = false this.mfaDialogShow = false

View File

@ -2,11 +2,13 @@
<div> <div>
<ActionsGroup :actions="rightSideActions" :is-fa="true" class="right-side-actions right-side-item" /> <ActionsGroup :actions="rightSideActions" :is-fa="true" class="right-side-actions right-side-item" />
<ImExportDialog <ImExportDialog
v-if="dialogExportVisible"
:export-options="iExportOptions" :export-options="iExportOptions"
:import-options="iImportOptions" :import-options="iImportOptions"
:selected-rows="selectedRows" :selected-rows="selectedRows"
v-bind="$attrs" v-bind="$attrs"
@importDialogClose="onImportDialogClose" @importDialogClose="onImportDialogClose"
@importDialogConfirm="onImportDialogConfirm"
/> />
</div> </div>
</template> </template>
@ -40,7 +42,10 @@ export default {
default: function({ selectedRows }) { default: function({ selectedRows }) {
const { exportOptions, tableUrl } = this const { exportOptions, tableUrl } = this
const url = exportOptions?.url ? exportOptions.url : tableUrl const url = exportOptions?.url ? exportOptions.url : tableUrl
this.$eventBus.$emit('showExportDialog', { selectedRows, url, name: this.name }) this.dialogExportVisible = true
this.$nextTick(() => {
this.$eventBus.$emit('showExportDialog', { selectedRows, url, name: this.name })
})
} }
}, },
hasImport: defaultTrue, hasImport: defaultTrue,
@ -53,7 +58,10 @@ export default {
default: function({ selectedRows }) { default: function({ selectedRows }) {
const { importOptions, tableUrl } = this const { importOptions, tableUrl } = this
const url = importOptions?.url ? importOptions.url : tableUrl const url = importOptions?.url ? importOptions.url : tableUrl
this.$eventBus.$emit('showImportDialog', { selectedRows, url, name: this.name }) this.dialogExportVisible = true
this.$nextTick(() => {
this.$eventBus.$emit('showImportDialog', { selectedRows, url, name: this.name })
})
} }
}, },
hasColumnSetting: defaultTrue, hasColumnSetting: defaultTrue,
@ -156,6 +164,15 @@ export default {
}, },
onImportDialogClose() { onImportDialogClose() {
this.$emit('importDialogClose') this.$emit('importDialogClose')
setTimeout(() => {
this.dialogExportVisible = false
}, 100)
},
onImportDialogConfirm() {
this.$emit('importDialogClose')
setTimeout(() => {
this.dialogExportVisible = false
}, 100)
this.reloadTable() this.reloadTable()
} }
} }

View File

@ -15,6 +15,3 @@ export default {
} }
} }
</script> </script>
<style>
</style>

View File

@ -12,6 +12,7 @@
@showAll="showAll" @showAll="showAll"
/> />
<BaseList <BaseList
ref="baseList"
slot="table" slot="table"
:add-extra-more-actions="addExtraMoreActions" :add-extra-more-actions="addExtraMoreActions"
:header-actions="headerActions" :header-actions="headerActions"
@ -66,6 +67,11 @@ export default {
mounted() { mounted() {
this.treeRef = this.$refs.AssetTreeTable.$refs.TreeList this.treeRef = this.$refs.AssetTreeTable.$refs.TreeList
}, },
activated() {
setTimeout(() => {
this.$refs.baseList.$refs.ListTable.reloadTable()
}, 500)
},
methods: { methods: {
decorateRMenu() { decorateRMenu() {
const show_current_asset = this.$cookie.get('show_current_asset') || '0' const show_current_asset = this.$cookie.get('show_current_asset') || '0'