Skip to content

Commit

Permalink
Fix: Send In Search Criteria (PanJiaChen#2632)
Browse files Browse the repository at this point in the history
* Fix: Send In Search Criteria

* Fix: Send In Search Criteria

* Fix: Send In Search Criteria
  • Loading branch information
Ricargame authored Sep 13, 2024
1 parent 1c4db0a commit c2685d9
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 75 deletions.
2 changes: 1 addition & 1 deletion src/api/ADempiere/file-management/resource-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function requestShareResources({
seconds
}) {
return request({
baseURL: `${config.adempiere.api.url}resources/download-url/${fileName}`,
baseURL: `${config.adempiere.api.url}/resources/download-url/${fileName}`,
isWithoutAuthorization: true,
method: 'get',
params: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export default defineComponent({
type: String,
required: false
},
reportOutput: {
type: Object,
required: true
},
containerManager: {
type: Object,
required: false
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/ADempiere/reportManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ const reportManager = {
if (!isEmptyValue(file_name)) {
if (isDownload) {
const file = document.createElement('a')
file.href = `${config.adempiere.api.url}resources/${file_name}`
file.href = `${config.adempiere.api.url}/resources/${file_name}`
file.download = `${reportName}`
file.target = '_blank'
file.click()
Expand Down
16 changes: 14 additions & 2 deletions src/views/ADempiere/Report/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
/>
<div id="report-view">
<br><br>
<downloadButtom
:container-uuid="reportUuid"
:is-loading-report="false"
style="display: flex; justify-content: flex-end; padding-bottom: 10px"
/>
<dialogShareReport
:report-metadata="reportMetadata"
:is-panel="false"
/>
<panel-definition
:container-uuid="reportUuid"
:panel-metadata="reportMetadata"
Expand Down Expand Up @@ -98,6 +107,8 @@ import PanelDefinition from '@/components/ADempiere/PanelDefinition/index.vue'
import OptionsReport from '@/components/ADempiere/ReportManager/Setup/optionsReport.vue'
import TitleAndHelp from '@/components/ADempiere/TitleAndHelp/index.vue'
import PanelFooter from '@/components/ADempiere/PanelFooter/index.vue'
import downloadButtom from '@/components/ADempiere/ReportManager/Setup/options/downloadButtom'
import dialogShareReport from '@/views/ADempiere/ReportViewerEngine/dialog'

// Utils and Helper Methods
import { closeTagView } from '@/utils/ADempiere/componentUtils'
Expand All @@ -111,13 +122,14 @@ export default defineComponent({
PanelDefinition,
TitleAndHelp,
OptionsReport,
PanelFooter
PanelFooter,
downloadButtom,
dialogShareReport
},

setup() {
const isLoadedMetadata = ref(false)
const reportMetadata = ref({})

const currentRoute = router.app._route
const reportId = currentRoute.meta.id
const reportUuid = currentRoute.meta.uuid
Expand Down
98 changes: 71 additions & 27 deletions src/views/ADempiere/ReportViewerEngine/dialog/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<template>
<div>
<el-dialog
v-shortkey="shortsKey"
:visible.sync="showDialog"
:title="$t('report.reportEnginer.optionsImport.title')"
top="2vh"
@shortkey.native="keyAction"
@close="viewShowDialog"
>
<el-row :gutter="12">
<el-col :span="12">
<el-col :span="!isPanel ? 24 : 12">
<el-card>
<template #header>
<p>{{ $t('report.reportEnginer.exportFormat') }}</p>
Expand All @@ -22,7 +29,7 @@
</el-row>
</el-card>
</el-col>
<el-col :span="12">
<el-col v-if="isPanel" :span="12">
<el-card>
<template #header>
<p>{{ $t('report.reportEnginer.optionsImport.format') }}</p>
Expand Down Expand Up @@ -157,7 +164,7 @@
/>
</el-col>
</el-row>
</div>
</el-dialog>
</template>

<script>
Expand Down Expand Up @@ -193,9 +200,26 @@ export default defineComponent({
reportOutput: {
type: Object,
required: false
},
reportMetadata: {
type: Object,
required: false
},
isPanel: {
type: Boolean,
required: false,
default: true
}
},
setup(props) {
const shortsKey = computed(() => {
return {
close: ['esc']
}
})
const showDialog = computed(() => {
return store.getters.getReportShowDialog
})
const storedMailTemplatesList = computed(() => {
return store.getters.getListMailTemplates
})
Expand All @@ -216,17 +240,28 @@ export default defineComponent({
const linkShare = ref('')
const isLoading = ref(false)
const validTime = ref(3600)
const titleDocument = ref(props.reportOutput.name)
const titleDocument = ref(
isEmptyValue(props.reportOutput) ? props.reportMetadata.name : props.reportOutput.name
)
const isTemplateSelected = ref(false)
const markdownContent = ref(store.getters.getDefaultBody)
const oldContent = ref(markdownContent.value)
const allReport = ref(false)
const pageSize = computed(() => {
if (isEmptyValue(props.reportOutput)) {
return 25
}
if (!allReport.value) {
return props.reportOutput.pageSize
}
return props.reportOutput.record_count
})
const pageToken = computed(() => {
if (isEmptyValue(props.reportOutput)) {
return 1
}
return props.reportOutput.pageToken
})
function isToolbar() {
isTemplateSelected.value = true
nextTick(() => {
Expand All @@ -251,12 +286,19 @@ export default defineComponent({
store.commit('setDefaultBody', markdownContent.value)
}
const getStoreReport = computed(() => {
return store.getters.getStoredReport(props.reportOutput.containerUuid)
let containerUuid = ''
if (!isEmptyValue(props.reportMetadata)) {
containerUuid = props.reportMetadata.containerUuid
}
if (isEmptyValue(containerUuid)) {
containerUuid = props.reportOutput.containerUuid
}
return store.getters.getStoredReport(containerUuid)
})
function loadData() {
isLoading.value = true
requestShareResources({
fileName: props.reportOutput.name,
fileName: titleDocument.value,
seconds: validTime.value
})
.then(response => {
Expand Down Expand Up @@ -291,7 +333,7 @@ export default defineComponent({
}
showNotification({
title: this.$t('notifications.processing'),
message: props.reportOutput.name,
message: titleDocument.value,
type: 'info'
})
store.commit('setShowDialog', false)
Expand All @@ -302,28 +344,27 @@ export default defineComponent({
function downloadFile() {
store.dispatch('exportReport', {
reportId: getStoreReport.value.internal_id,
reportName: props.reportOutput.name,
printFormatId: props.reportOutput.print_format_id,
reportViewId: props.reportOutput.report_view_id,
containerUuid: props.reportOutput.containerUuid,
reportName: titleDocument.value,
printFormatId: getStoreReport.value.print_format_id,
reportViewId: getStoreReport.value.report_view_id,
containerUuid: getStoreReport.value.containerUuid,
pageSize: pageSize.value,
pageToken: props.reportOutput.pageToken,
pageToken: pageToken.value,
isSummary: isSummary.value
})
blankValue()
}
function shareUrl() {
store.dispatch('exportReport', {
reportId: getStoreReport.value.internal_id,
reportName: props.reportOutput.name,
printFormatId: props.reportOutput.print_format_id,
reportViewId: props.reportOutput.report_view_id,
reportName: titleDocument.value,
printFormatId: getStoreReport.value.print_format_id,
reportViewId: getStoreReport.value.report_view_id,
seconds: validTime.value,
isDownload: false,
containerUuid: props.reportOutput.containerUuid,
containerUuid: getStoreReport.value.containerUuid,
pageSize: pageSize.value,
pageToken: props.reportOutput.pageToken,
pageToken: pageToken.value,
isSummary: isSummary.value
})
.then(fileNameResource => {
Expand Down Expand Up @@ -369,9 +410,9 @@ export default defineComponent({
function handleDownload() {
const link = document.createElement('a')
const imageURL = `${config.adempiere.api.url}resources/${props.reportOutput.name}`
const imageURL = config.adempiere.resource.url + titleDocument.value
link.href = imageURL
link.download = props.reportOutput.name
link.download = titleDocument.value
link.click()
}
const exportData = computed(() => {
Expand All @@ -390,14 +431,14 @@ export default defineComponent({
const user_id = store.getters['user/userInfo'].id
store.dispatch('exportReport', {
reportId: getStoreReport.value.internal_id,
reportName: props.reportOutput.name,
printFormatId: props.reportOutput.print_format_id,
reportViewId: props.reportOutput.report_view_id,
reportName: titleDocument.value,
printFormatId: getStoreReport.value.print_format_id,
reportViewId: getStoreReport.value.report_view_id,
seconds: validTime.value,
isDownload: false,
containerUuid: props.reportOutput.containerUuid,
containerUuid: getStoreReport.value.containerUuid,
pageSize: pageSize.value,
pageToken: props.reportOutput.pageToken,
pageToken: pageToken.value,
isSummary: isSummary.value
})
.then(fileNameResource => {
Expand Down Expand Up @@ -437,7 +478,7 @@ export default defineComponent({
function blankValue() {
store.commit('setContactSend', '')
store.commit('setTypeNotify', '')
titleDocument.value = props.reportOutput.name
titleDocument.value = isEmptyValue(props.reportOutput) ? props.reportMetadata.name : props.reportOutput.name
let menuDefault = ''
if (!isEmptyValue(storedMailTemplatesList.value) && !isEmptyValue(storedMailTemplatesList.value.menus)) {
menuDefault = storedMailTemplatesList.value.menus[0].mail_text
Expand Down Expand Up @@ -483,6 +524,9 @@ export default defineComponent({
titleDocument,
oldContent,
isSummary,
showDialog,
shortsKey,
pageToken,
updateContent,
updateMardown,
copyToClipboard,
Expand Down
45 changes: 5 additions & 40 deletions src/views/ADempiere/ReportViewerEngine/reportPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,10 @@
:is-report-enginer="false"
:is-loading-report="isLoadingReport"
/>
<el-dialog
v-shortkey="shortsKey"
:visible.sync="showDialog"
:title="$t('report.reportEnginer.optionsImport.title')"
top="2vh"
@shortkey.native="keyAction"
@close="viewShowDialog"
>
<dialogShareReport
:report-output="reportOutput"
:container-uuid="containerUuid"
/>
</el-dialog>
<dialogShareReport
:report-output="reportOutput"
:container-uuid="containerUuid"
/>
<data-report
:container-manager="containerManager"
:instance-uuid="instanceUuid"
Expand Down Expand Up @@ -87,38 +78,12 @@ export default defineComponent({
}
},
setup() {
// Computed
const shortsKey = computed(() => {
return {
close: ['esc']
}
})

const showDialog = computed(() => {
return store.getters.getReportShowDialog
})
// Methods
function keyAction(event) {
switch (event.srcKey) {
case 'close':
viewShowDialog()
}
}

function viewShowDialog() {
store.commit('setShowDialog', false)
}
const isLoadingReport = computed(() => {
return store.getters.getReportIsLoading
})
return {
// Computed
showDialog,
shortsKey,
isLoadingReport,
// Methods
keyAction,
viewShowDialog
isLoadingReport
}
}
})
Expand Down

0 comments on commit c2685d9

Please sign in to comment.