Skip to content

Commit

Permalink
Generic action to call specific action (PanJiaChen#2271)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored May 24, 2024
1 parent 80535b3 commit 681795e
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</el-col>

<el-col :span="6">
<sale-transaction-field
<sales-transaction-field
:uuid-form="uuidForm"
:parent-uuid="metadata.parentUuid"
:container-uuid="metadata.containerUuid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export default ({
clearTimeout(timeOutRecords.value)
timeOutRecords.value = setTimeout(() => {
// search on server
containerManager.getInvoiceSearchFieldRecordList({
containerManager.getSearchRecordsList({
parentUuid,
containerUuid: uuidForm,
contextColumnNames: fieldAttributes.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export default {
}

this.isLoading = true
this.containerManager.getInvoiceSearchFieldRecordList({
this.containerManager.getSearchRecordsList({
parentUuid,
containerUuid: this.metadata.containerUuid,
contextColumnNames: this.metadata.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default ({
clearTimeout(timeOutRecords.value)
timeOutRecords.value = setTimeout(() => {
// search on server
containerManager.getOrdersSearchFieldRecordList({
containerManager.getSearchRecordsList({
parentUuid,
containerUuid: uuidForm,
contextColumnNames: fieldAttributes.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export default {
clearTimeout(this.timeOutRecords)
this.timeOutRecords = setTimeout(() => {
// search on server
this.containerManager.getOrdersSearchFieldRecordList({
this.containerManager.getSearchRecordsList({
parentUuid,
containerUuid: this.uuidForm,
contextColumnNames: this.metadata.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
class="button-show-popover"
:disabled="isDisabled"
>
<i
<!-- <i
class="el-icon-s-order"
/>
/> -->
<svg-icon icon-class="clipboard" />
</el-button>
</el-popover>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import OrderFieldMixin from './mixinOrder'
import ButtonBusinessPartnersList from './buttonBusinessPartnersList.vue'

// Constants
import { TABLE_NAME, COLUMN_NAME } from '@/utils/ADempiere/dictionary/field/search/businessPartner.ts'
import { TABLE_NAME, COLUMN_NAME } from '@/utils/ADempiere/dictionary/field/search/order'
import { RECORD_ROWS_BY_LIST } from '@/utils/ADempiere/dictionary/field/lookups'
import {
DISPLAY_COLUMN_PREFIX,
Expand Down Expand Up @@ -242,7 +242,7 @@ export default {
}

this.isLoading = true
this.containerManager.getOrdersSearchFieldRecordList({
this.containerManager.getSearchRecordsList({
parentUuid,
containerUuid: this.metadata.containerUuid,
contextColumnNames: this.metadata.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default ({
clearTimeout(timeOutRecords.value)
timeOutRecords.value = setTimeout(() => {
// search on server
containerManager.getPaymentSearchFieldRecordList({
containerManager.getSearchRecordsList({
parentUuid,
containerUuid: uuidForm,
contextColumnNames: fieldAttributes.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export default {
clearTimeout(this.timeOutRecords)
this.timeOutRecords = setTimeout(() => {
// search on server
this.containerManager.getPaymentSearchFieldRecordList({
this.containerManager.getSearchRecordsList({
parentUuid,
containerUuid: this.uuidForm,
contextColumnNames: this.metadata.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import OrderFieldMixin from './mixinOrder'
import ButtonBusinessPartnersList from './buttonBusinessPartnersList.vue'

// Constants
import { TABLE_NAME, COLUMN_NAME } from '@/utils/ADempiere/dictionary/field/search/businessPartner.ts'
import { TABLE_NAME, COLUMN_NAME } from '@/utils/ADempiere/dictionary/field/search/payment'
import { RECORD_ROWS_BY_LIST } from '@/utils/ADempiere/dictionary/field/lookups'
import {
DISPLAY_COLUMN_PREFIX,
Expand Down Expand Up @@ -242,7 +242,7 @@ export default {
}

this.isLoading = true
this.containerManager.getPaymentSearchFieldRecordList({
this.containerManager.getSearchRecordsList({
parentUuid,
containerUuid: this.metadata.containerUuid,
contextColumnNames: this.metadata.reference.context_column_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export default {
if (isEmptyValue(this.metadata.referenceTableName)) {
return fieldRender
}
console.log(this.metadata.referenceTableName)
switch (this.metadata.referenceTableName) {
case 'C_BPartner':
fieldRender = () => import('@/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo')
Expand Down
108 changes: 52 additions & 56 deletions src/store/modules/ADempiere/field/search/generalSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import { requestGridGeneralInfo } from '@/api/ADempiere/field/search/index.js'
// Constants
import { TABLE_NAME as TABLE_NAME_BPartner } from '@/utils/ADempiere/dictionary/field/search/businessPartner.ts'
import { TABLE_NAME as TABLE_NAME_PRODUCT } from '@/utils/ADempiere/dictionary/field/search/product.ts'
import { TABLE_NAME as TABLE_NAME_ORDER } from '@/utils/ADempiere/dictionary/field/search/order'
import { TABLE_NAME as TABLE_NAME_INVOICE } from '@/utils/ADempiere/dictionary/field/search/invoice'
import { TABLE_NAME as TABLE_NAME_PAYMENT } from '@/utils/ADempiere/dictionary/field/search/payment'
import { ROWS_OF_RECORDS_BY_PAGE } from '@/utils/ADempiere/tableUtils'
import { OPERATOR_LIKE } from '@/utils/ADempiere/dataUtils'

Expand Down Expand Up @@ -261,72 +264,65 @@ const generalInfoSearch = {
pageSize
}) {
return new Promise(resolve => {
if (tableName === TABLE_NAME_BPartner) {
return dispatch('gridBusinessPartners', {
parentUuid,
containerUuid,
contextColumnNames,
//
columnId,
fieldId,
processParameterId,
browseFieldId,
//
tableName,
columnName,
//
isForm,
filters,
searchValue,
pageNumber,
pageSize
}).then(response => {
resolve(response)
})
} else if (tableName === TABLE_NAME_PRODUCT) {
return dispatch('gridProducts', {
parentUuid,
containerUuid,
contextColumnNames,
//
columnId,
fieldId,
processParameterId,
browseFieldId,
//
tableName,
columnName,
//
isForm,
filters,
searchValue,
pageNumber,
pageSize
}).then(response => {
resolve(response)
})
}
return dispatch('getGeneralSearchRecordsFromServer', {
containerUuid,
const queryField = {
parentUuid,
containerUuid,
contextColumnNames,
filters,
//
// References
columnId,
fieldId,
processParameterId,
browseFieldId,
//
searchValue,
//
// Query
tableName,
columnName,
//
isForm,
filters,
searchValue,
// Page Data
pageNumber,
pageSize
}).then(response => {
resolve(response)
})
}

// Load the Service indicated in the received attributes.
switch (tableName) {
case TABLE_NAME_BPartner:
dispatch('gridBusinessPartners', queryField)
.then(response => {
resolve(response)
})
break
case TABLE_NAME_PRODUCT:
dispatch('gridProducts', queryField)
.then(response => {
resolve(response)
})
break
case TABLE_NAME_INVOICE:
dispatch('gridInvoices', queryField)
.then(response => {
resolve(response)
})
break
case TABLE_NAME_ORDER:
dispatch('gridOrders', queryField)
.then(response => {
resolve(response)
})
break
case TABLE_NAME_PAYMENT:
dispatch('gridPayments', queryField)
.then(response => {
resolve(response)
})
break
default:
dispatch('getGeneralSearchRecordsFromServer', queryField)
.then(response => {
resolve(response)
})
break
}
})
},

Expand Down
45 changes: 0 additions & 45 deletions src/utils/ADempiere/dictionary/browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,51 +551,6 @@ export const containerManager = {
})
},

getInvoiceSearchFieldRecordList({ parentUuid, containerUuid, contextColumnNames, tableName, columnName, id, filters, searchValue, pageNumber, pageSize }) {
return store.dispatch('gridInvoices', {
parentUuid,
containerUuid,
contextColumnNames,
browseFieldId: id,
tableName,
columnName,
filters,
searchValue,
pageNumber,
pageSize
})
},

getOrdersSearchFieldRecordList({ parentUuid, containerUuid, contextColumnNames, tableName, columnName, id, filters, searchValue, pageNumber, pageSize }) {
return store.dispatch('gridOrders', {
parentUuid,
containerUuid,
contextColumnNames,
browseFieldId: id,
tableName,
columnName,
filters,
searchValue,
pageNumber,
pageSize
})
},

getPaymentSearchFieldRecordList({ parentUuid, containerUuid, contextColumnNames, tableName, columnName, id, filters, searchValue, pageNumber, pageSize }) {
return store.dispatch('gridPayments', {
parentUuid,
containerUuid,
contextColumnNames,
browseFieldId: id,
tableName,
columnName,
filters,
searchValue,
pageNumber,
pageSize
})
},

warehouseLocatorSearch({
containerUuid,
parentUuid,
Expand Down
45 changes: 0 additions & 45 deletions src/utils/ADempiere/dictionary/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,51 +293,6 @@ export const containerManager = {
})
},

getInvoiceSearchFieldRecordList({ parentUuid, containerUuid, contextColumnNames, tableName, columnName, id, filters, searchValue, pageNumber, pageSize }) {
return store.dispatch('gridInvoices', {
parentUuid,
containerUuid,
contextColumnNames,
processParameterId: id,
tableName,
columnName,
filters,
searchValue,
pageNumber,
pageSize
})
},

getOrdersSearchFieldRecordList({ parentUuid, containerUuid, contextColumnNames, tableName, columnName, id, filters, searchValue, pageNumber, pageSize }) {
return store.dispatch('gridOrders', {
parentUuid,
containerUuid,
contextColumnNames,
processParameterId: id,
tableName,
columnName,
filters,
searchValue,
pageNumber,
pageSize
})
},

getPaymentSearchFieldRecordList({ parentUuid, containerUuid, contextColumnNames, tableName, columnName, id, filters, searchValue, pageNumber, pageSize }) {
return store.dispatch('gridPayments', {
parentUuid,
containerUuid,
contextColumnNames,
processParameterId: id,
tableName,
columnName,
filters,
searchValue,
pageNumber,
pageSize
})
},

warehouseLocatorSearch({
containerUuid,
parentUuid,
Expand Down
Loading

0 comments on commit 681795e

Please sign in to comment.