1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Support Document Type (#929)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-06-21 17:59:34 -04:00 committed by GitHub
parent 7bba8dafee
commit 46db7de0b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 129 additions and 61 deletions

View File

@ -103,6 +103,7 @@ export function updateOrder({
orderUuid,
posUuid,
customerUuid,
documentTypeUuid,
description,
warehouseUuid
}) {
@ -113,6 +114,7 @@ export function updateOrder({
order_uuid: orderUuid,
pos_uuid: posUuid,
customer_uuid: customerUuid,
document_type_uuid: documentTypeUuid,
description,
warehouse_uuid: warehouseUuid
}

View File

@ -23,26 +23,34 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 24,
sequence: 10,
handleFocusGained: true,
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,
handleActionPerformed: true,
handleContentSelection: true,
handleActionKeyPerformed: true
}
}
// {
// elementColumnName: 'QtyEntered',
// columnName: 'QtyEntered',
// tabindex: '2',
// isFromDictionary: true,
// overwriteDefinition: {
// size: 24,
// sequence: 8,
// handleActionPerformed: true,
// handleContentSelection: true,
// handleActionKeyPerformed: true
// }
// },
// {
// elementColumnName: 'PriceEntered',
// columnName: 'PriceEntered',
// tabindex: '3',

View File

@ -26,7 +26,7 @@
height="auto"
:style="isShowedPOSKeyLayout ? 'padding-right: 20px; padding-left: 0px;' : 'padding-right: 0px; padding-left: 0px;'"
>
<el-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
<el-form label-position="top" label-width="500px" @submit.native.prevent="notSubmitForm">
<el-row :gutter="24" style="display: flex;">
<el-col :span="colFieldProductCode" style="padding-left: 0px; padding-right: 0px;">
<template
@ -40,7 +40,7 @@
/>
</template>
</el-col>
<el-col :span="isEmptyValue(currentOrder) ? 9 : 7" :style="styleTab">
<el-col :span="isEmptyValue(currentOrder) ? 5 : 5" :style="styleTab">
<business-partner
id="BusinessPartner"
:parent-metadata="{
@ -52,6 +52,20 @@
:is-disabled="isDisabled"
/>
</el-col>
<el-col :span="5" :style="styleTab">
<el-form-item>
<template
v-for="(field) in fieldsList"
>
<field
v-if="field.columnName === 'C_DocTypeTarget_ID'"
:key="field.columnName"
:metadata-field="field"
:v-model="field.value"
/>
</template>
</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%;'">
<el-form-item>
<el-row :gutter="24">
@ -178,7 +192,6 @@
</el-table-column>
</el-table>
</el-main>
<el-footer :class="classOrderFooter">
<div class="keypad">
<span id="toolPoint">
@ -454,7 +467,7 @@ export default {
styleTab() {
const isShowedPOSOptions = this.$store.getters.getIsShowPOSOptions
if (this.isShowedPOSKeyLayout || isShowedPOSOptions) {
return 'adding-left: 0px; padding-left: 0px; padding-right: 0px; padding: 0px; '
return 'padding-left: 0px; padding-left: 0px; padding-right: 0px; padding: 0px; '
}
return 'padding-left: 0px; padding-right: 0px; '
},
@ -481,7 +494,7 @@ export default {
},
numberOfLines() {
if (this.isEmptyValue(this.currentOrder)) {
return
return 0
}
return this.listOrderLine.length
},
@ -560,7 +573,10 @@ export default {
},
currentLineOrder() {
const line = this.$store.state['pointOfSales/orderLine/index'].line
return line
if (!this.isEmptyValue(line)) {
return line
}
return {}
},
currentPriceList() {
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {

View File

@ -149,22 +149,22 @@ export default {
this.$store.dispatch('listOrderLine', [])
this.listOrderLines()
} else {
this.$store.commit('updateValuesOfContainer', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
attributes: [{
columnName: 'C_BPartner_ID',
value: value.businessPartner.id
},
{
columnName: 'DisplayColumn_C_BPartner_ID',
value: value.businessPartner.name
},
{
columnName: ' C_BPartner_ID_UUID',
value: value.businessPartner.uuid
}]
const businessPartner = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_BPartner_ID' // this.parentMetadata.columnName
})
const documentType = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID' // this.parentMetadata.columnName
})
if (!this.isEmptyValue(businessPartner) && businessPartner !== value.businessPartner.id) {
this.setBusinessPartner(value.businessPartner)
} else if (this.isEmptyValue(businessPartner) && value.businessPartner.id) {
this.setBusinessPartner(value.businessPartner)
}
if (!this.isEmptyValue(documentType) && documentType !== value.documentType.id) {
this.setDocumentType(value.documentType)
}
}
},
updateOrderProcessPos(value) {
@ -211,31 +211,53 @@ export default {
},
updateOrder(update) {
// user session
const documentTypeUuid = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID_UUID'
})
if (!this.isEmptyValue(update.value) && update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPointOfSales)) {
this.$store.dispatch('updateOrder', {
orderUuid: this.$route.query.action,
posUuid: this.currentPointOfSales.uuid,
customerUuid: update.value
customerUuid: update.value,
documentTypeUuid
})
}
},
setBusinessPartner({ name, id, uuid }) {
// Use update values of container (without subscription)
this.$store.commit('updateValuesOfContainer', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
attributes: [{
columnName: 'C_BPartner_ID',
value: id
},
{
columnName: 'DisplayColumn_C_BPartner_ID',
value: name
},
{
columnName: ' C_BPartner_ID_UUID',
value: uuid
}]
this.$store.commit('updateValueOfField', {
containerUuid: this.$route.meta.uuid,
columnName: 'C_BPartner_ID',
value: id
})
this.$store.commit('updateValueOfField', {
containerUuid: this.$route.meta.uuid,
columnName: 'DisplayColumn_C_BPartner_ID',
value: name
})
this.$store.commit('updateValueOfField', {
containerUuid: this.$route.meta.uuid,
columnName: 'C_BPartner_ID_UUID',
value: uuid
})
},
setDocumentType({ name, id, uuid }) {
// Use update values of container (without subscription)
this.$store.commit('updateValueOfField', {
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID',
value: id
})
this.$store.commit('updateValueOfField', {
containerUuid: this.$route.meta.uuid,
columnName: 'DisplayColumn_C_DocTypeTarget_ID',
value: name
})
this.$store.commit('updateValueOfField', {
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID_UUID',
value: uuid
})
},
findProduct(searchValue) {
@ -299,6 +321,10 @@ export default {
containerUuid: this.metadata.containerUuid,
columnName: 'C_BPartner_ID'
})
const documentTypeUuid = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID_UUID'
})
if (this.isEmptyValue(customerUuid) || id === 1000006) {
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
}
@ -306,7 +332,8 @@ export default {
this.$store.dispatch('createOrder', {
posUuid,
customerUuid,
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid,
documentTypeUuid
})
.then(response => {
// this.order = response
@ -363,11 +390,6 @@ export default {
...orderToPush
})
}
if (!this.isEmptyValue(order.businessPartner)) {
const { businessPartner } = order
this.setBusinessPartner(businessPartner)
}
// this.order = orderToPush
},
getOrderTax(currency) {
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
@ -390,6 +412,20 @@ export default {
this.updateOrderLine(mutation.payload)
}
break
case 'C_DocTypeTarget_ID': {
const documentTypeUuid = this.$store.getters.getValueOfField({
containerUuid: mutation.payload.containerUuid,
columnName: 'C_DocTypeTarget_ID_UUID'
})
if (!this.isEmptyValue(documentTypeUuid) && !this.isEmptyValue(this.currentOrder.documentType.uuid) && this.currentOrder.documentType.uuid !== documentTypeUuid) {
this.$store.dispatch('updateOrder', {
orderUuid: this.$route.query.action,
posUuid: this.currentPointOfSales.uuid,
documentTypeUuid
})
}
break
}
}
} else if (mutation.type === 'updateValueOfField') {
switch (mutation.payload.columnName) {

View File

@ -37,13 +37,15 @@ export default {
createOrder({ commit, dispatch, rootGetters }, {
posUuid,
customerUuid,
salesRepresentativeUuid
salesRepresentativeUuid,
documentTypeUuid
}) {
return createOrder({
posUuid,
customerUuid,
salesRepresentativeUuid,
warehouseUuid: rootGetters.currentWarehouse.uuid
warehouseUuid: rootGetters.currentWarehouse.uuid,
documentTypeUuid
})
.then(order => {
commit('setOrder', order)
@ -70,12 +72,16 @@ export default {
updateOrder({ commit, dispatch, rootGetters }, {
orderUuid,
posUuid,
customerUuid
customerUuid,
documentTypeUuid,
warehouseUuid
}) {
updateOrder({
orderUuid,
posUuid,
warehouseUuid: rootGetters.currentWarehouse.uuid
documentTypeUuid,
customerUuid,
warehouseUuid
})
.then(response => {
dispatch('reloadOrder', { orderUuid: response.uuid })