1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

add validation at the time of creating the business partner (#562)

* add validation at the time of creating the business partner
add translation
validate PriceChecking

* minimal changue

* Add translation
This commit is contained in:
Elsio Sanchez 2020-12-22 20:41:48 -04:00 committed by GitHub
parent 0b9e4e7df4
commit 986c206073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 100 additions and 56 deletions

View File

@ -224,6 +224,9 @@ export default {
})
}
}
if (mutation.type === 'changeFormAttribute') {
this.focusProductValue()
}
})
},
timeMessage() {

View File

@ -70,6 +70,14 @@ export default {
unsubscribe: () => {}
}
},
computed: {
emptyMandatoryFields() {
const field = this.$store.getters.getFieldsListEmptyMandatory({
containerUuid: this.containerUuid
})
return field
}
},
beforeDestroy() {
this.unsubscribe()
},
@ -84,33 +92,41 @@ export default {
return
}
values = this.convertValuesToSend(values)
this.isLoadingRecord = true
requestCreateBusinessPartner(values)
.then(responseBPartner => {
// TODO: Add new record into vuex store.
this.setBusinessPartner(responseBPartner)
this.clearValues()
this.$message({
type: 'success',
message: 'Socio de negocio creado exitosamente',
duration: 1500,
showClose: true
if (this.isEmptyValue(this.emptyMandatoryFields)) {
this.isLoadingRecord = true
requestCreateBusinessPartner(values)
.then(responseBPartner => {
// TODO: Add new record into vuex store.
this.setBusinessPartner(responseBPartner)
this.clearValues()
this.$message({
type: 'success',
message: this.$t('form.pos.order.BusinessPartnerCreate.businessPartner'),
duration: 1500,
showClose: true
})
})
})
.catch(error => {
this.showsPopovers.isShowCreate = true
this.$message({
type: 'warning',
message: error.message,
duration: 1500,
showClose: true
.catch(error => {
this.showsPopovers.isShowCreate = true
this.$message({
type: 'warning',
message: error.message,
duration: 1500,
showClose: true
})
console.warn(`Error create Business Partner. Message: ${error.message}, code ${error.code}.`)
})
console.warn(`Error create Business Partner. Message: ${error.message}, code ${error.code}.`)
})
.finally(() => {
this.isLoadingRecord = false
.finally(() => {
this.isLoadingRecord = false
})
} else {
this.$message({
type: 'warn',
message: this.$t('notifications.mandatoryFieldMissing') + this.emptyMandatoryFields,
duration: 1500,
showClose: true
})
}
},
clearValues() {
this.showsPopovers.isShowCreate = false

View File

@ -1,54 +1,51 @@
// List of fields to send for create new
const tableName = 'C_BPartner'
export default [
{
columnName: 'Value',
// displayType: CHAR.id,
definition: {
name: 'Search Key',
tableName,
isFromDictionary: true,
overwriteDefinition: {
// name: 'Search Key',
isCustomField: true,
size: 24
}
},
{
columnName: 'Name',
// displayType: CHAR.id,
definition: {
name: 'Name',
tableName,
isFromDictionary: true,
overwriteDefinition: {
// name: 'Name',
isCustomField: true,
size: 24
}
},
{
columnName: 'Contact',
// displayType: CHAR.id,
definition: {
name: 'Contact Name',
columnName: 'Name2',
tableName,
isFromDictionary: true,
overwriteDefinition: {
// name: 'Contact Name',
isCustomField: true,
size: 24
}
},
{
columnName: 'EMail',
// displayType: CHAR.id,
definition: {
name: 'E-Mail Address',
isCustomField: true,
size: 24
}
},
{
columnName: 'Postal',
// displayType: CHAR.id,
definition: {
name: 'Postal Code',
tableName: 'AD_user',
isFromDictionary: true,
overwriteDefinition: {
// name: 'E-Mail Address',
isCustomField: true,
size: 24
}
},
{
columnName: 'Phone',
// displayType: CHAR.id,
definition: {
tableName: 'AD_user',
isFromDictionary: true,
overwriteDefinition: {
name: 'Phone',
isCustomField: true,
size: 24

View File

@ -30,7 +30,7 @@
<el-form-item>
<template slot="label">
Business Partner
{{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }}
<i
v-popover:businessPartnerCreate
class="el-icon-circle-plus"

View File

@ -379,7 +379,11 @@ export default {
itemQuantity: 'Item Quantity',
numberLines: 'Number of Lines',
pointSale: 'Point of Sale',
collect: 'Collect'
collect: 'Collect',
BusinessPartnerCreate: {
businessPartner: 'Business Partner',
successfullyCreated: 'Successful Business Partner'
}
},
collect: {
orderTotal: 'Order Total',

View File

@ -354,7 +354,11 @@ export default {
itemQuantity: 'Cantidad de Árticulo',
numberLines: 'Cantidad de Lineas',
pointSale: 'Punto de Venta',
collect: 'Cobrar'
collect: 'Cobrar',
BusinessPartnerCreate: {
businessPartner: 'Socio de Negocios',
successfullyCreated: 'Socio de Negocio Creado Exitosamente'
}
},
collect: {
orderTotal: 'Total de Orden',

View File

@ -12,7 +12,7 @@
:collapse-transition="false"
mode="vertical"
>
<sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
<sidebar-item v-for="route in menu" :key="route.path" :item="route" :base-path="route.path" />
</el-menu>
</el-scrollbar>
</div>
@ -23,6 +23,7 @@ import { mapGetters } from 'vuex'
import Logo from './Logo'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
export default {
components: { SidebarItem, Logo },
@ -48,6 +49,25 @@ export default {
},
isCollapse() {
return !this.sidebar.opened
},
menu() {
const viewSearch = recursiveTreeSearch({
treeData: this.permission_routes,
attributeValue: '5aacaab1-1ba0-4cf0-992a-0da34c460ffe',
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
const router = this.permission_routes.map(menu => {
if (menu.path === '/PriceChecking') {
return {
...viewSearch,
hidden: false
}
}
return menu
})
return router
}
}
}

View File

@ -68,7 +68,7 @@ const staticRoutes = [
{
path: '/PriceChecking',
component: Layout,
hidden: false,
hidden: true,
children: [
{
path: '/PriceChecking',

View File

@ -238,9 +238,9 @@ export default {
type: 'success',
color: '#67C23A'
}
if (isReport) {
return status
}
// if (isReport) {
// return status
// }
// is executing
if (isProcessing) {
status.text = this.$t('notifications.processing')