mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
Add support to list document type service (#986)
This commit is contained in:
parent
cba978916b
commit
80b9e9e95b
@ -643,10 +643,10 @@ export function validatePin({
|
||||
}
|
||||
|
||||
/**
|
||||
* list Warehouse
|
||||
* list Warehouses
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
*/
|
||||
export function listWarehouse({
|
||||
export function listWarehouses({
|
||||
posUuid
|
||||
}) {
|
||||
return request({
|
||||
@ -661,6 +661,25 @@ export function listWarehouse({
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* list Document Types
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
*/
|
||||
export function listDocumentTypes({
|
||||
posUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/available-document-types`,
|
||||
method: 'get',
|
||||
params: {
|
||||
pos_uuid: posUuid
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List Prices
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
|
@ -27,86 +27,5 @@ export default [
|
||||
handleActionPerformed: true,
|
||||
handleActionKeyPerformed: true
|
||||
}
|
||||
},
|
||||
{
|
||||
elementColumnName: 'C_DocType_ID',
|
||||
tabindex: '2',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
handleActionPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleActionKeyPerformed: true
|
||||
}
|
||||
},
|
||||
{
|
||||
elementColumnName: 'C_DocTypeTarget_ID',
|
||||
tabindex: '2',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
handleFocusGained: true,
|
||||
handleActionPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleActionKeyPerformed: true,
|
||||
isReadOnly: true
|
||||
}
|
||||
}
|
||||
// {
|
||||
// elementColumnName: 'PriceEntered',
|
||||
// columnName: 'PriceEntered',
|
||||
// tabindex: '3',
|
||||
// isFromDictionary: true,
|
||||
// overwriteDefinition: {
|
||||
// size: 24,
|
||||
// sequence: 9,
|
||||
// isReadOnly: true,
|
||||
// handleActionPerformed: true,
|
||||
// handleContentSelection: true,
|
||||
// handleActionKeyPerformed: true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// elementColumnName: 'Discount',
|
||||
// columnName: 'Discount',
|
||||
// tabindex: '4',
|
||||
// isFromDictionary: true,
|
||||
// overwriteDefinition: {
|
||||
// size: 24,
|
||||
// sequence: 10,
|
||||
// isReadOnly: true,
|
||||
// handleActionPerformed: true,
|
||||
// handleContentSelection: true,
|
||||
// handleActionKeyPerformed: true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// tableName: 'C_Order',
|
||||
// columnName: 'C_Currency_ID',
|
||||
// isFromDictionary: true,
|
||||
// overwriteDefinition: {
|
||||
// size: 24,
|
||||
// handleActionKeyPerformed: true,
|
||||
// handleActionPerformed: true,
|
||||
// validationCode: 'C_Currency.C_Currency_ID = 100',
|
||||
// isActiveLogics: false,
|
||||
// isMandatory: true
|
||||
// }
|
||||
// }
|
||||
// // TenderType
|
||||
// {
|
||||
// tableName: 'C_Payment',
|
||||
// elementColumnName: 'TenderType',
|
||||
// columnName: 'TenderType',
|
||||
// isFromDictionary: true,
|
||||
// overwriteDefinition: {
|
||||
// defaultValue: 'X',
|
||||
// handleActionKeyPerformed: true,
|
||||
// handleContentSelection: true,
|
||||
// handleActionPerformed: true,
|
||||
// size: 24,
|
||||
// isActiveLogics: false,
|
||||
// isMandatory: true
|
||||
// }
|
||||
// }
|
||||
]
|
||||
|
@ -54,11 +54,28 @@
|
||||
</el-col>
|
||||
<el-col :span="5" :style="styleTab">
|
||||
<el-form-item>
|
||||
<field
|
||||
:key="fieldsList[2].columnName"
|
||||
:metadata-field="fieldsList[2]"
|
||||
:v-model="fieldsList[2].value"
|
||||
/>
|
||||
<br>
|
||||
<el-dropdown
|
||||
v-if="!isEmptyValue(currentWarehouse)"
|
||||
trigger="click"
|
||||
class="info-pos"
|
||||
@command="changeDocumentType"
|
||||
>
|
||||
<span>
|
||||
<svg-icon icon-class="tree" />
|
||||
<b style="cursor: pointer"> {{ currentDocumentType.name }} </b>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in listDocumentTypes"
|
||||
:key="item.uuid"
|
||||
:command="item"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<br>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px; margin-top: 3.%;' : 'padding: 0px; margin-top: 2.4%;'">
|
||||
@ -262,7 +279,7 @@
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in listWarehouse"
|
||||
v-for="item in listWarehouses"
|
||||
:key="item.uuid"
|
||||
:command="item"
|
||||
>
|
||||
@ -573,7 +590,6 @@ export default {
|
||||
currentOrder() {
|
||||
if (this.isEmptyValue(this.currentPointOfSales)) {
|
||||
return {
|
||||
documentType: {},
|
||||
documentStatus: {
|
||||
value: ''
|
||||
},
|
||||
@ -619,15 +635,27 @@ export default {
|
||||
},
|
||||
currentWarehouse() {
|
||||
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) {
|
||||
return this.$store.getters.getcurrentWarehousePos
|
||||
return this.$store.getters.getCurrentWarehousePos
|
||||
}
|
||||
return {}
|
||||
},
|
||||
listWarehouse() {
|
||||
currentDocumentType() {
|
||||
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.documentType)) {
|
||||
return this.$store.getters.getCurrentDocumentTypePos
|
||||
}
|
||||
return {}
|
||||
},
|
||||
listWarehouses() {
|
||||
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehousesList)) {
|
||||
return this.$store.getters.posAttributes.currentPointOfSales.warehousesList
|
||||
}
|
||||
return []
|
||||
},
|
||||
listDocumentTypes() {
|
||||
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.documentTypesList)) {
|
||||
return this.$store.getters.posAttributes.currentPointOfSales.documentTypesList
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -768,6 +796,14 @@ export default {
|
||||
}
|
||||
this.visible = true
|
||||
},
|
||||
changeDocumentType(documentType) {
|
||||
this.attributePin = {
|
||||
...documentType,
|
||||
action: 'changeDocumentType',
|
||||
type: 'actionPos'
|
||||
}
|
||||
this.visible = true
|
||||
},
|
||||
changePriceList(priceList) {
|
||||
this.attributePin = {
|
||||
...priceList,
|
||||
|
@ -245,6 +245,9 @@ export default {
|
||||
case 'changeWarehouse':
|
||||
this.$store.commit('setCurrentWarehousePos', action)
|
||||
break
|
||||
case 'changeDocumentType':
|
||||
this.$store.commit('setCurrentDocumentTypePos', action)
|
||||
break
|
||||
case 'changePriceList':
|
||||
this.$store.commit('setCurrentPriceList', action)
|
||||
break
|
||||
|
@ -55,6 +55,7 @@ export default {
|
||||
...state.currentPointOfSales,
|
||||
listOrder: state.listOrder,
|
||||
warehousesList: state.warehousesList,
|
||||
documentTypesList: state.documentTypesList,
|
||||
pricesList: state.pricesList,
|
||||
currentPriceList: state.currentPriceList,
|
||||
currentOrder: {
|
||||
@ -124,11 +125,21 @@ export default {
|
||||
/**
|
||||
* Current Warehouse
|
||||
*/
|
||||
getcurrentWarehousePos: (state) => {
|
||||
getCurrentWarehousePos: (state) => {
|
||||
if (!isEmptyValue(state.currentWarehousePos)) {
|
||||
return state.currentWarehousePos
|
||||
}
|
||||
return {}
|
||||
},
|
||||
|
||||
/**
|
||||
* Current Document Type
|
||||
*/
|
||||
getCurrentDocumentTypePos: (state) => {
|
||||
if (!isEmptyValue(state.currentDocumentTypePos)) {
|
||||
return state.currentDocumentTypePos
|
||||
}
|
||||
return {}
|
||||
}
|
||||
// Current POS, it can be s
|
||||
}
|
||||
|
@ -17,7 +17,8 @@
|
||||
import router from '@/router'
|
||||
import {
|
||||
listPointOfSales,
|
||||
listWarehouse,
|
||||
listWarehouses,
|
||||
listDocumentTypes,
|
||||
listPrices,
|
||||
listCurrencies
|
||||
} from '@/api/ADempiere/form/point-of-sales.js'
|
||||
@ -61,15 +62,31 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
listWarehouseFromServer({ commit }, posUuid) {
|
||||
listWarehouse({
|
||||
listWarehousesFromServer({ commit }, posUuid) {
|
||||
listWarehouses({
|
||||
posUuid
|
||||
})
|
||||
.then(response => {
|
||||
commit('setWarehousesList', response.records)
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`listWarehouseFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
console.warn(`listWarehousesFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
},
|
||||
listDocumentTypesFromServer({ commit }, posUuid) {
|
||||
listDocumentTypes({
|
||||
posUuid
|
||||
})
|
||||
.then(response => {
|
||||
commit('setDocumentTypesList', response.records)
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`listDocumentTypesFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
@ -123,10 +140,12 @@ export default {
|
||||
}
|
||||
}, () => {})
|
||||
state.currenciesList = []
|
||||
dispatch('listWarehouseFromServer', posToSet.uuid)
|
||||
dispatch('listWarehousesFromServer', posToSet.uuid)
|
||||
dispatch('listDocumentTypesFromServer', posToSet.uuid)
|
||||
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
||||
dispatch('listPricesFromServer', posToSet)
|
||||
commit('setCurrentPriceList', posToSet.priceList)
|
||||
commit('setCurrentDocumentTypePos', posToSet.documentType)
|
||||
commit('setCurrentWarehousePos', rootGetters['user/getWarehouse'])
|
||||
commit('resetConversionRate', [])
|
||||
commit('setIsReloadKeyLayout')
|
||||
|
@ -25,12 +25,18 @@ export default {
|
||||
setWarehousesList(state, warehousesList) {
|
||||
state.warehousesList = warehousesList
|
||||
},
|
||||
setDocumentTypesList(state, documentTypesList) {
|
||||
state.documentTypesList = documentTypesList
|
||||
},
|
||||
setCurrentPriceList(state, currentPriceList) {
|
||||
state.currentPriceList = currentPriceList
|
||||
},
|
||||
setCurrentWarehousePos(state, warehouse) {
|
||||
state.currentWarehousePos = warehouse
|
||||
},
|
||||
setCurrentDocumentTypePos(state, documentType) {
|
||||
state.currentDocumentTypePos = documentType
|
||||
},
|
||||
setPricesList(state, pricesList) {
|
||||
state.pricesList = pricesList
|
||||
},
|
||||
|
@ -29,9 +29,11 @@ export default {
|
||||
},
|
||||
pointOfSalesList: {},
|
||||
warehousesList: {},
|
||||
documentTypesList: {},
|
||||
pricesList: {},
|
||||
currentPriceList: {},
|
||||
currentWarehousePos: {},
|
||||
currentDocumentTypePos: {},
|
||||
listCurrency: [],
|
||||
conversionsList: [],
|
||||
currentPointOfSales: {},
|
||||
|
Loading…
x
Reference in New Issue
Block a user