Skip to content

Commit

Permalink
fix: Filters in Legacy Report (PanJiaChen#2739)
Browse files Browse the repository at this point in the history
* fix: Filters in Legacy Report

* fix: Filters in Legacy Report

* fix: Filters in Legacy Report

* fix: Filters in Legacy Report

* fix: Filters in Legacy Report
  • Loading branch information
Ricargame authored Oct 7, 2024
1 parent 6bfb9f3 commit dca94ba
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 116 deletions.
6 changes: 6 additions & 0 deletions src/components/ADempiere/FieldDefinition/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ export default {
return 'border: 1px solid #fff;border-radius: 5px;'
},
isOperatior() {
if (this.$route.meta.type === 'report') {
const { is_jasper_report: isJasper } = store.getters.getStoredReport(this.containerUuid)
if (isJasper) {
return false
}
}
const isBrowser = this.$route.meta.type === 'browser'
const {
isAdvancedQuery,
Expand Down
193 changes: 121 additions & 72 deletions src/components/ADempiere/ReportManager/Setup/optionsReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,74 +23,99 @@
{{ $t('report.reportSettings') }}
</b>
</div>

<div class="text item">
<el-form
label-position="top"
label-width="10px"
@submit.native.prevent="notSubmitForm"
>
<el-row class="report-setup-preferences-fields" :gutter="20">
<el-col :span="8">
<el-form-item
:label="$t('report.printFormats')"
style="display: grid;"
>
<el-select
v-model="reportAsPrintFormatValue"
style="display: contents;"
>
<el-option
v-for="(item, key) in reportAsPrintFormat.childs"
:key="key"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>

<el-col :span="8">
<el-form-item
:label="$t('report.reportViews')"
style="display: grid;"
>
<el-select
v-model="reportAsViewValue"
style="display: contents;"
>
<el-option
v-for="(item, key) in reportAsView.childs"
:key="key"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>

<el-col :span="8">
<el-form-item
:label="$t('report.typeReport')"
style="display: grid;"
<el-collapse v-model="activeCollapse">
<el-collapse-item name="1">
<template slot="title">
<b style="font-size: 18px">
{{ $t('report.preference') }}
<i style="font-size: 18px;" class="el-icon-s-operation" />
</b>
</template>
<el-card class="box-card">
<div class="text item">
<el-form
label-position="top"
label-width="10px"
@submit.native.prevent="notSubmitForm"
>
<el-select
v-model="reportTypeFormatValue"
style="display: contents;"
>
<el-option
v-for="(item, key) in reportTypeFormat.childs"
:key="key"
:label="item.name"
:value="item.type"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>

<el-row class="report-setup-preferences-fields" :gutter="20">
<el-col :span="8">
<el-form-item
:label="$t('report.printFormats')"
style="display: grid;"
>
<el-select
v-model="reportAsPrintFormatValue"
style="display: contents;"
@change="runReport()"
>
<el-option
v-for="(item, key) in reportAsPrintFormat.childs"
:key="key"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
:label="$t('report.reportViews')"
style="display: grid;"
>
<el-select
v-model="reportAsViewValue"
style="display: contents;"
@change="runReport()"
>
<el-option
v-for="(item, key) in reportAsView.childs"
:key="key"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
:label="$t('report.typeReport')"
style="display: grid;"
>
<el-select
v-model="reportTypeFormatValue"
style="display: contents;"
@change="runReport()"
>
<el-option
v-for="(item, key) in reportTypeFormat.childs"
:key="key"
:label="item.name"
:value="item.type"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</el-card>
</el-collapse-item>
<el-collapse-item name="2">
<template slot="title">
<b style="font-size: 18px">
{{ $t('actionMenu.changeParameters') }}
<i style="font-size: 18px;" class="el-icon-set-up" />
</b>
</template>
<component
:is="componentRender"
:container-uuid="containerUuid"
:container-manager="containerManagerReportViwer"
:is-tab-panel="true"
/>
</el-collapse-item>
</el-collapse>
<el-row
style="
position: absolute;
Expand Down Expand Up @@ -167,13 +192,31 @@ export default defineComponent({
const reportAsViewValue = ref(undefined)
const reportAsPrintFormatValue = ref(undefined)
const reportTypeFormatValue = ref('')

const activeCollapse = ref(['1', '2'])
const attributes = computed(() => {
return store.getters.getConfigReport({
containerUuid: props.containerUuid,
columnName: 'reportType'
})
})
const storedPanelReport = computed(() => {
return store.getters.getModalDialogManager({
containerUuid: props.containerUuid
})
})
const containerManagerReportViwer = computed(() => {
const modalDialogStored = storedPanelReport.value
if (!isEmptyValue(modalDialogStored) && !isEmptyValue(modalDialogStored.containerManager)) {
return {
...props.containerManager,
...modalDialogStored.containerManager
}
}
return {
...props.containerManager
}
})

const reportAsView = computed(() => {
const options = store.getters.getStoredActionsMenu({
containerUuid: props.containerUuid
Expand All @@ -197,7 +240,9 @@ export default defineComponent({
}
return options
})

const componentRender = computed(() => {
return () => import('@/components/ADempiere/PanelDefinition/index.vue')
})
const reportTypeFormat = computed(() => {
const options = store.getters.getStoredActionsMenu({
containerUuid: props.containerUuid
Expand Down Expand Up @@ -259,7 +304,7 @@ export default defineComponent({
}

function runReport() {
store.dispatch('buildReport', {
store.dispatch('runReport', {
containerUuid: props.containerUuid,
isSummary: true
})
Expand Down Expand Up @@ -303,12 +348,16 @@ export default defineComponent({
reportAsView,
reportAsPrintFormat,
reportTypeFormat,
updatePrintFormat,
componentRender,
activeCollapse,
storedPanelReport,
isShowSetupReport,
containerManagerReportViwer,
// methods
handleClose,
actionClear,
runReport
runReport,
updatePrintFormat
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions src/router/modules/ADempiere/staticRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ const staticRoutes = [
},

{
path: '/report-viewer/:reportId/:instanceUuid',
path: '/report-viewer/:reportId',
component: Layout,
hidden: true,
children: [
{
path: '/report-viewer/:reportId/:instanceUuid?',
path: '/report-viewer/:reportId?',
component: () => import('@/views/ADempiere/ReportViewer'),
name: REPORT_VIEWER_NAME,
meta: {
Expand Down
21 changes: 15 additions & 6 deletions src/store/modules/ADempiere/report/reportRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ import { isEmptyValue } from '@/utils/ADempiere'
import { showNotification } from '@/utils/ADempiere/notification.js'

const initState = {
reportRun: {}
reportRun: {},
isLoading: false
}
const reportRun = {
state: initState,

mutations: {
scrollByetTest(state, contactSend) {
state.reportRun = contactSend
},
setIsLoadingReportLegacy(state, isLoading) {
state.isLoading = isLoading
}
},
actions: {
Expand Down Expand Up @@ -84,6 +88,7 @@ const reportRun = {
tableName
})
}
commit('setIsLoadingReportLegacy', true)
generateReportRequest({
reportFormat,
id: reportId,
Expand Down Expand Up @@ -120,9 +125,8 @@ const reportRun = {
if (!REPORT_VIEWER_SUPPORTED_FORMATS.includes(reportFormat)) {
link.click()
}

router.push({
path: `/report-viewer/${reportDefinition.internal_id}/${instance_id}`,
path: `/report-viewer/${reportDefinition.internal_id}`,
name: REPORT_VIEWER_NAME,
params: {
reportId: reportDefinition.internal_id,
Expand All @@ -140,18 +144,17 @@ const reportRun = {
type: 'success'
})
}

commit('setReportOutput', {
...output,
reportId: reportDefinition.internal_id,
reportUuid: reportDefinition.uuid,
instanceUuid: instance_id,
instanceUuid: reportDefinition.internal_id,
parametersList,
link,
url: link.href,
download: link.download
})

commit('setIsLoadingReportLegacy', false)
resolve(runReportRepsonse)
})
.catch(error => {
Expand All @@ -162,6 +165,9 @@ const reportRun = {
})
console.warn(`Error getting Get Report: ${error.message}. Code: ${error.code}.`)
})
.finally(() => {
commit('setIsLoadingReportLegacy', false)
})
})
},
reportOutput({ dispatch, getters }, {
Expand Down Expand Up @@ -191,6 +197,9 @@ const reportRun = {
getters: {
getReportRun: (state) => {
return state.reportRun
},
getIsLoadingReportLegacy: (state) => {
return state.isLoading
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/ADempiere/Report/Report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
icon="el-icon-arrow-left"
circle
style="top: 50%; right: 0%; position: absolute;"
@click="handleOpem()"
@click="handleOpen()"
/>
<panel-footer
:container-uuid="reportUuid"
Expand Down Expand Up @@ -203,7 +203,7 @@ export default defineComponent({
showPanelConfigReport(false)
}

function handleOpem() {
function handleOpen() {
showPanelConfigReport(!isShowPanelConfig.value)
}

Expand Down Expand Up @@ -251,7 +251,7 @@ export default defineComponent({
closeTagView,
handleClose,
closeReport,
handleOpem,
handleOpen,
runReport
}
}
Expand Down
Loading

0 comments on commit dca94ba

Please sign in to comment.