Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Fix: Refresh Table (#2471)
Browse files Browse the repository at this point in the history
* Fix: Refresh Table

* Fix: Refresh Table
  • Loading branch information
Ricargame authored Jul 22, 2024
1 parent b665cf3 commit a9aa6a8
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 65 deletions.
37 changes: 20 additions & 17 deletions src/store/modules/ADempiere/reportManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const initState = {
pageNumber: 1,
isLoading: false,
showDialog: false,
expandedAll: false
expandedAll: true
}
const reportManager = {
state: initState,
Expand Down Expand Up @@ -617,7 +617,8 @@ const reportManager = {
isSummary,
// window
tableName,
recordId
recordId,
isView
}) {
return new Promise(resolve => {
generateReport({
Expand All @@ -635,30 +636,32 @@ const reportManager = {
})
.then(reportResponse => {
const {
id,
// id,
name,
instance_id,
report_view_id
} = reportResponse
router.push({
path: `report-viewer-engine/${id}/${instance_id}/${report_view_id}`,
name: 'Report Viewer Engine',
params: {
reportId: id,
instanceUuid: instance_id,
fileName: name,
reportUuid,
// menuParentUuid,
name: name + instance_id,
tableName
}
}, () => {})
if (!isView) {
router.push({
path: `report-viewer-engine/${reportId}/${instance_id}/${report_view_id}`,
name: 'Report Viewer Engine',
params: {
reportId,
instanceUuid: instance_id,
fileName: name,
reportUuid,
// menuParentUuid,
name: name + instance_id,
tableName
}
}, () => {})
}
commit('setPageSize', pageSize)
commit('setReportOutput', {
...reportResponse,
containerUuid,
rowCells: reportResponse.rows,
instanceUuid: id
instanceUuid: reportId
})
resolve(reportResponse)
})
Expand Down
68 changes: 41 additions & 27 deletions src/views/ADempiere/ReportViewerEngine/dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<template #header>
<p>{{ $t('report.reportEnginer.optionsImport.format') }}</p>
</template>
<el-row :gutter="12">
<el-row :gutter="12" style="height: 30px;">
<el-col style="width: 100%; text-align: center;">
<el-switch
v-model="checkedItem"
Expand All @@ -21,7 +21,7 @@
</el-card>
</el-col>
</el-row>
<el-row :gutter="12" style="margin-top: 20px;">
<el-row :gutter="12" style="margin-top: 20px; height: 50px">
<el-col :span="24">
<el-card>
<template #header>
Expand Down Expand Up @@ -68,30 +68,44 @@
</el-col>
</el-row>
<el-row v-if="checkedItemGeneral === 1" :gutter="12" style="margin-top: 25px; display: flex; justify-content: center;">
<el-col :span="6" style="width: 60%;">
<p>{{ $t('report.reportEnginer.optionsImport.typeNotify') }}</p>
<el-select @visible-change="getOptionFormat">
<el-option
v-for="(item, key) in optionTypeFormat.childs"
:key="key"
:label="item.name"
:value="item.type"
/>
</el-select>
</el-col>
<el-col :span="6" style="width: 30%;">
<p>{{ $t('report.reportEnginer.optionsImport.contactsSend') }}</p>
<el-select
placeholder="Select an option"
@visible-change="getOptionFormat"
>
<el-option
v-for="(item, key) in optionTypeFormat.childs"
:key="key"
:label="item.name"
:value="item.type"
/>
</el-select>
<el-col :span="18">
<el-form>
<el-row :gutter="12">
<el-col :span="12">
<el-form-item>
<template slot="label">
{{ $t('report.reportEnginer.optionsImport.typeNotify') }}
</template>
<el-select @visible-change="getOptionFormat">
<el-option
v-for="(item, key) in optionTypeFormat.childs"
:key="key"
:label="item.name"
:value="item.type"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<template slot="label">
{{ $t('report.reportEnginer.optionsImport.contactsSend') }}
</template>
<el-select
placeholder="Select an option"
@visible-change="getOptionFormat"
>
<el-option
v-for="(item, key) in optionTypeFormat.childs"
:key="key"
:label="item.name"
:value="item.type"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-col>
</el-row>
<el-row v-if="checkedItemGeneral === 3" :gutter="12" style="margin-top: 50px; text-align: center;">
Expand Down Expand Up @@ -141,7 +155,7 @@
</el-card>
</el-col>
</el-row>
<el-row :gutter="12" style="margin-top: 20px;">
<el-row :gutter="12" style="margin-top: 70px;">
<el-button
class="button-base-icon"
icon="el-icon-check"
Expand Down
53 changes: 38 additions & 15 deletions src/views/ADempiere/ReportViewerEngine/reportPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
:report-output="reportOutput"
/>
<el-dialog
v-shortkey="shortsKey"
:visible.sync="showDialog"
:title="$t('report.reportEnginer.optionsImport.title')"
@shortkey.native="keyAction"
@close="viewShowDialog"
>
<dialogShareReport
:report-output="reportOutput"
Expand Down Expand Up @@ -86,7 +89,7 @@
</template>
<script>
import store from '@/store'
import { defineComponent, computed, ref, watch, onMounted, nextTick } from '@vue/composition-api'
import { defineComponent, computed, ref, watch, nextTick, onMounted } from '@vue/composition-api'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import CustomPagination from '@/components/ADempiere/DataTable/Components/CustomPagination.vue'
import { isNumberField, isDateField, isBooleanField, isDecimalField } from '@/utils/ADempiere/references'
Expand Down Expand Up @@ -125,6 +128,17 @@ export default defineComponent({
const selectedRow = ref(undefined)
const selectedColumn = ref(undefined)
const tableReportEngine = ref(undefined)
const shortsKey = computed(() => {
return {
close: ['esc']
}
})
function keyAction(event) {
switch (event.srcKey) {
case 'close':
viewShowDialog()
}
}
const data = computed(() => {
const { rowCells } = props.reportOutput
if (isEmptyValue(rowCells)) return []
Expand Down Expand Up @@ -203,6 +217,9 @@ export default defineComponent({
}
})
}
function viewShowDialog() {
store.commit('setShowDialog', false)
}
const showDialog = computed(() => {
return store.getters.getReportShowDialog
})
Expand Down Expand Up @@ -274,28 +291,31 @@ export default defineComponent({
const expanded = computed(() => {
return store.getters.getExpandedAll
})
watch(expanded, () => {
expandedRowAll()
})

function expandedRowAll() {
dataList.value.forEach(function expandRecursively(row) {
if (row.children && row.children.length > 0) {
tableReportEngine.value.toggleRowExpansion(row)
tableReportEngine.value.toggleRowExpansion(row, expanded.value)
row.children.forEach(expandRecursively)
}
})
}
onMounted(() => {
const isLoadingReport = computed(() => {
return store.getters.getReportIsLoading
})
watch(data, () => {
nextTick(() => {
if (!isLoadingReport.value) {
expandedRowAll()
}
expandedRowAll()
})
})

const isLoadingReport = computed(() => {
return store.getters.getReportIsLoading
watch(expanded, () => {
nextTick(() => {
expandedRowAll()
})
})
onMounted(() => {
nextTick(() => {
expandedRowAll()
})
})
function widthColumn(data) {
if (
Expand All @@ -304,7 +324,7 @@ export default defineComponent({
isBooleanField(data) ||
isDecimalField(data)
) {
return '290'
return '250'
}
return '360'
}
Expand All @@ -323,6 +343,8 @@ export default defineComponent({
isLoadingReport,
data,
columns,
shortsKey,
keyAction,
widthColumn,
exportFile,
displayLabel,
Expand All @@ -334,7 +356,8 @@ export default defineComponent({
handleRowClick,
getRowClassName,
findParent,
expandedRowAll
expandedRowAll,
viewShowDialog
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ export default defineComponent({
.finally(() => {
store.commit('setReportIsLoading', false)
})
store.commit('setShowPanelConfig', {
containerUuid: props.containerUuid,
value: false
})
}, 500)
}
watch(reportAsPrintFormatValue, (newValue) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<div class="select-container" style="margin-top: 10px; margin-left: 50px; display: flex; align-items: center;">
<label for="report-format-switch" class="select-label" style="margin-right: 15px;">{{ $t('report.reportEnginer.Detail') }}</label>
<label for="report-format-switch" class="select-label" style="margin-right: 15px;">{{ $t('report.reportEnginer.summary') }}</label>
<el-switch
id="report-format-switch"
v-model="showChildren"
style="font-weight: bold;"
@change="expandedAll"
/>
<label for="report-format-switch" class="select-label" style="margin-left: 15px;">{{ $t('report.reportEnginer.summary') }}</label>
<label for="report-format-switch" class="select-label" style="margin-left: 15px;">{{ $t('report.reportEnginer.Detail') }}</label>
</div>
</template>

Expand Down

0 comments on commit a9aa6a8

Please sign in to comment.