mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
Support Document Type (#929)
Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
7bba8dafee
commit
46db7de0b2
@ -103,6 +103,7 @@ export function updateOrder({
|
|||||||
orderUuid,
|
orderUuid,
|
||||||
posUuid,
|
posUuid,
|
||||||
customerUuid,
|
customerUuid,
|
||||||
|
documentTypeUuid,
|
||||||
description,
|
description,
|
||||||
warehouseUuid
|
warehouseUuid
|
||||||
}) {
|
}) {
|
||||||
@ -113,6 +114,7 @@ export function updateOrder({
|
|||||||
order_uuid: orderUuid,
|
order_uuid: orderUuid,
|
||||||
pos_uuid: posUuid,
|
pos_uuid: posUuid,
|
||||||
customer_uuid: customerUuid,
|
customer_uuid: customerUuid,
|
||||||
|
document_type_uuid: documentTypeUuid,
|
||||||
description,
|
description,
|
||||||
warehouse_uuid: warehouseUuid
|
warehouse_uuid: warehouseUuid
|
||||||
}
|
}
|
||||||
|
@ -23,26 +23,34 @@ export default [
|
|||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
size: 24,
|
size: 24,
|
||||||
sequence: 10,
|
|
||||||
handleFocusGained: true,
|
handleFocusGained: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
handleActionKeyPerformed: 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',
|
// elementColumnName: 'PriceEntered',
|
||||||
// columnName: 'PriceEntered',
|
// columnName: 'PriceEntered',
|
||||||
// tabindex: '3',
|
// tabindex: '3',
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
height="auto"
|
height="auto"
|
||||||
:style="isShowedPOSKeyLayout ? 'padding-right: 20px; padding-left: 0px;' : 'padding-right: 0px; padding-left: 0px;'"
|
: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-row :gutter="24" style="display: flex;">
|
||||||
<el-col :span="colFieldProductCode" style="padding-left: 0px; padding-right: 0px;">
|
<el-col :span="colFieldProductCode" style="padding-left: 0px; padding-right: 0px;">
|
||||||
<template
|
<template
|
||||||
@ -40,7 +40,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="isEmptyValue(currentOrder) ? 9 : 7" :style="styleTab">
|
<el-col :span="isEmptyValue(currentOrder) ? 5 : 5" :style="styleTab">
|
||||||
<business-partner
|
<business-partner
|
||||||
id="BusinessPartner"
|
id="BusinessPartner"
|
||||||
:parent-metadata="{
|
:parent-metadata="{
|
||||||
@ -52,6 +52,20 @@
|
|||||||
:is-disabled="isDisabled"
|
:is-disabled="isDisabled"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</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-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px; margin-top: 3.%;' : 'padding: 0px; margin-top: 2.4%;'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
@ -178,7 +192,6 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
||||||
<el-footer :class="classOrderFooter">
|
<el-footer :class="classOrderFooter">
|
||||||
<div class="keypad">
|
<div class="keypad">
|
||||||
<span id="toolPoint">
|
<span id="toolPoint">
|
||||||
@ -454,7 +467,7 @@ export default {
|
|||||||
styleTab() {
|
styleTab() {
|
||||||
const isShowedPOSOptions = this.$store.getters.getIsShowPOSOptions
|
const isShowedPOSOptions = this.$store.getters.getIsShowPOSOptions
|
||||||
if (this.isShowedPOSKeyLayout || isShowedPOSOptions) {
|
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; '
|
return 'padding-left: 0px; padding-right: 0px; '
|
||||||
},
|
},
|
||||||
@ -481,7 +494,7 @@ export default {
|
|||||||
},
|
},
|
||||||
numberOfLines() {
|
numberOfLines() {
|
||||||
if (this.isEmptyValue(this.currentOrder)) {
|
if (this.isEmptyValue(this.currentOrder)) {
|
||||||
return
|
return 0
|
||||||
}
|
}
|
||||||
return this.listOrderLine.length
|
return this.listOrderLine.length
|
||||||
},
|
},
|
||||||
@ -560,7 +573,10 @@ export default {
|
|||||||
},
|
},
|
||||||
currentLineOrder() {
|
currentLineOrder() {
|
||||||
const line = this.$store.state['pointOfSales/orderLine/index'].line
|
const line = this.$store.state['pointOfSales/orderLine/index'].line
|
||||||
return line
|
if (!this.isEmptyValue(line)) {
|
||||||
|
return line
|
||||||
|
}
|
||||||
|
return {}
|
||||||
},
|
},
|
||||||
currentPriceList() {
|
currentPriceList() {
|
||||||
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
||||||
|
@ -149,22 +149,22 @@ export default {
|
|||||||
this.$store.dispatch('listOrderLine', [])
|
this.$store.dispatch('listOrderLine', [])
|
||||||
this.listOrderLines()
|
this.listOrderLines()
|
||||||
} else {
|
} else {
|
||||||
this.$store.commit('updateValuesOfContainer', {
|
const businessPartner = this.$store.getters.getValueOfField({
|
||||||
parentUuid: this.parentUuid,
|
containerUuid: this.$route.meta.uuid,
|
||||||
containerUuid: this.containerUuid,
|
columnName: 'C_BPartner_ID' // this.parentMetadata.columnName
|
||||||
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 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) {
|
updateOrderProcessPos(value) {
|
||||||
@ -211,31 +211,53 @@ export default {
|
|||||||
},
|
},
|
||||||
updateOrder(update) {
|
updateOrder(update) {
|
||||||
// user session
|
// 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)) {
|
if (!this.isEmptyValue(update.value) && update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPointOfSales)) {
|
||||||
this.$store.dispatch('updateOrder', {
|
this.$store.dispatch('updateOrder', {
|
||||||
orderUuid: this.$route.query.action,
|
orderUuid: this.$route.query.action,
|
||||||
posUuid: this.currentPointOfSales.uuid,
|
posUuid: this.currentPointOfSales.uuid,
|
||||||
customerUuid: update.value
|
customerUuid: update.value,
|
||||||
|
documentTypeUuid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setBusinessPartner({ name, id, uuid }) {
|
setBusinessPartner({ name, id, uuid }) {
|
||||||
// Use update values of container (without subscription)
|
// Use update values of container (without subscription)
|
||||||
this.$store.commit('updateValuesOfContainer', {
|
this.$store.commit('updateValueOfField', {
|
||||||
parentUuid: this.parentUuid,
|
containerUuid: this.$route.meta.uuid,
|
||||||
containerUuid: this.containerUuid,
|
columnName: 'C_BPartner_ID',
|
||||||
attributes: [{
|
value: id
|
||||||
columnName: 'C_BPartner_ID',
|
})
|
||||||
value: id
|
this.$store.commit('updateValueOfField', {
|
||||||
},
|
containerUuid: this.$route.meta.uuid,
|
||||||
{
|
columnName: 'DisplayColumn_C_BPartner_ID',
|
||||||
columnName: 'DisplayColumn_C_BPartner_ID',
|
value: name
|
||||||
value: name
|
})
|
||||||
},
|
this.$store.commit('updateValueOfField', {
|
||||||
{
|
containerUuid: this.$route.meta.uuid,
|
||||||
columnName: ' C_BPartner_ID_UUID',
|
columnName: 'C_BPartner_ID_UUID',
|
||||||
value: 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) {
|
findProduct(searchValue) {
|
||||||
@ -299,6 +321,10 @@ export default {
|
|||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: 'C_BPartner_ID'
|
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) {
|
if (this.isEmptyValue(customerUuid) || id === 1000006) {
|
||||||
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
|
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
|
||||||
}
|
}
|
||||||
@ -306,7 +332,8 @@ export default {
|
|||||||
this.$store.dispatch('createOrder', {
|
this.$store.dispatch('createOrder', {
|
||||||
posUuid,
|
posUuid,
|
||||||
customerUuid,
|
customerUuid,
|
||||||
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid
|
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid,
|
||||||
|
documentTypeUuid
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// this.order = response
|
// this.order = response
|
||||||
@ -363,11 +390,6 @@ export default {
|
|||||||
...orderToPush
|
...orderToPush
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (!this.isEmptyValue(order.businessPartner)) {
|
|
||||||
const { businessPartner } = order
|
|
||||||
this.setBusinessPartner(businessPartner)
|
|
||||||
}
|
|
||||||
// this.order = orderToPush
|
|
||||||
},
|
},
|
||||||
getOrderTax(currency) {
|
getOrderTax(currency) {
|
||||||
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
|
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
|
||||||
@ -390,6 +412,20 @@ export default {
|
|||||||
this.updateOrderLine(mutation.payload)
|
this.updateOrderLine(mutation.payload)
|
||||||
}
|
}
|
||||||
break
|
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') {
|
} else if (mutation.type === 'updateValueOfField') {
|
||||||
switch (mutation.payload.columnName) {
|
switch (mutation.payload.columnName) {
|
||||||
|
@ -37,13 +37,15 @@ export default {
|
|||||||
createOrder({ commit, dispatch, rootGetters }, {
|
createOrder({ commit, dispatch, rootGetters }, {
|
||||||
posUuid,
|
posUuid,
|
||||||
customerUuid,
|
customerUuid,
|
||||||
salesRepresentativeUuid
|
salesRepresentativeUuid,
|
||||||
|
documentTypeUuid
|
||||||
}) {
|
}) {
|
||||||
return createOrder({
|
return createOrder({
|
||||||
posUuid,
|
posUuid,
|
||||||
customerUuid,
|
customerUuid,
|
||||||
salesRepresentativeUuid,
|
salesRepresentativeUuid,
|
||||||
warehouseUuid: rootGetters.currentWarehouse.uuid
|
warehouseUuid: rootGetters.currentWarehouse.uuid,
|
||||||
|
documentTypeUuid
|
||||||
})
|
})
|
||||||
.then(order => {
|
.then(order => {
|
||||||
commit('setOrder', order)
|
commit('setOrder', order)
|
||||||
@ -70,12 +72,16 @@ export default {
|
|||||||
updateOrder({ commit, dispatch, rootGetters }, {
|
updateOrder({ commit, dispatch, rootGetters }, {
|
||||||
orderUuid,
|
orderUuid,
|
||||||
posUuid,
|
posUuid,
|
||||||
customerUuid
|
customerUuid,
|
||||||
|
documentTypeUuid,
|
||||||
|
warehouseUuid
|
||||||
}) {
|
}) {
|
||||||
updateOrder({
|
updateOrder({
|
||||||
orderUuid,
|
orderUuid,
|
||||||
posUuid,
|
posUuid,
|
||||||
warehouseUuid: rootGetters.currentWarehouse.uuid
|
documentTypeUuid,
|
||||||
|
customerUuid,
|
||||||
|
warehouseUuid
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
dispatch('reloadOrder', { orderUuid: response.uuid })
|
dispatch('reloadOrder', { orderUuid: response.uuid })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user