mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +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:
parent
0b9e4e7df4
commit
986c206073
@ -224,6 +224,9 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mutation.type === 'changeFormAttribute') {
|
||||||
|
this.focusProductValue()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
timeMessage() {
|
timeMessage() {
|
||||||
|
@ -70,6 +70,14 @@ export default {
|
|||||||
unsubscribe: () => {}
|
unsubscribe: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
emptyMandatoryFields() {
|
||||||
|
const field = this.$store.getters.getFieldsListEmptyMandatory({
|
||||||
|
containerUuid: this.containerUuid
|
||||||
|
})
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
},
|
},
|
||||||
@ -84,33 +92,41 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
values = this.convertValuesToSend(values)
|
values = this.convertValuesToSend(values)
|
||||||
|
if (this.isEmptyValue(this.emptyMandatoryFields)) {
|
||||||
this.isLoadingRecord = true
|
this.isLoadingRecord = true
|
||||||
requestCreateBusinessPartner(values)
|
requestCreateBusinessPartner(values)
|
||||||
.then(responseBPartner => {
|
.then(responseBPartner => {
|
||||||
// TODO: Add new record into vuex store.
|
// TODO: Add new record into vuex store.
|
||||||
this.setBusinessPartner(responseBPartner)
|
this.setBusinessPartner(responseBPartner)
|
||||||
this.clearValues()
|
this.clearValues()
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: 'Socio de negocio creado exitosamente',
|
message: this.$t('form.pos.order.BusinessPartnerCreate.businessPartner'),
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
showClose: true
|
showClose: true
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.catch(error => {
|
||||||
.catch(error => {
|
this.showsPopovers.isShowCreate = true
|
||||||
this.showsPopovers.isShowCreate = true
|
this.$message({
|
||||||
this.$message({
|
type: 'warning',
|
||||||
type: 'warning',
|
message: error.message,
|
||||||
message: error.message,
|
duration: 1500,
|
||||||
duration: 1500,
|
showClose: true
|
||||||
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() {
|
clearValues() {
|
||||||
this.showsPopovers.isShowCreate = false
|
this.showsPopovers.isShowCreate = false
|
||||||
|
@ -1,54 +1,51 @@
|
|||||||
// List of fields to send for create new
|
// List of fields to send for create new
|
||||||
|
const tableName = 'C_BPartner'
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
columnName: 'Value',
|
columnName: 'Value',
|
||||||
// displayType: CHAR.id,
|
tableName,
|
||||||
definition: {
|
isFromDictionary: true,
|
||||||
name: 'Search Key',
|
overwriteDefinition: {
|
||||||
|
// name: 'Search Key',
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnName: 'Name',
|
columnName: 'Name',
|
||||||
// displayType: CHAR.id,
|
tableName,
|
||||||
definition: {
|
isFromDictionary: true,
|
||||||
name: 'Name',
|
overwriteDefinition: {
|
||||||
|
// name: 'Name',
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnName: 'Contact',
|
columnName: 'Name2',
|
||||||
// displayType: CHAR.id,
|
tableName,
|
||||||
definition: {
|
isFromDictionary: true,
|
||||||
name: 'Contact Name',
|
overwriteDefinition: {
|
||||||
|
// name: 'Contact Name',
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnName: 'EMail',
|
columnName: 'EMail',
|
||||||
// displayType: CHAR.id,
|
tableName: 'AD_user',
|
||||||
definition: {
|
isFromDictionary: true,
|
||||||
name: 'E-Mail Address',
|
overwriteDefinition: {
|
||||||
isCustomField: true,
|
// name: 'E-Mail Address',
|
||||||
size: 24
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
columnName: 'Postal',
|
|
||||||
// displayType: CHAR.id,
|
|
||||||
definition: {
|
|
||||||
name: 'Postal Code',
|
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnName: 'Phone',
|
columnName: 'Phone',
|
||||||
// displayType: CHAR.id,
|
tableName: 'AD_user',
|
||||||
definition: {
|
isFromDictionary: true,
|
||||||
|
overwriteDefinition: {
|
||||||
name: 'Phone',
|
name: 'Phone',
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
Business Partner
|
{{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }}
|
||||||
<i
|
<i
|
||||||
v-popover:businessPartnerCreate
|
v-popover:businessPartnerCreate
|
||||||
class="el-icon-circle-plus"
|
class="el-icon-circle-plus"
|
||||||
|
@ -379,7 +379,11 @@ export default {
|
|||||||
itemQuantity: 'Item Quantity',
|
itemQuantity: 'Item Quantity',
|
||||||
numberLines: 'Number of Lines',
|
numberLines: 'Number of Lines',
|
||||||
pointSale: 'Point of Sale',
|
pointSale: 'Point of Sale',
|
||||||
collect: 'Collect'
|
collect: 'Collect',
|
||||||
|
BusinessPartnerCreate: {
|
||||||
|
businessPartner: 'Business Partner',
|
||||||
|
successfullyCreated: 'Successful Business Partner'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
collect: {
|
collect: {
|
||||||
orderTotal: 'Order Total',
|
orderTotal: 'Order Total',
|
||||||
|
@ -354,7 +354,11 @@ export default {
|
|||||||
itemQuantity: 'Cantidad de Árticulo',
|
itemQuantity: 'Cantidad de Árticulo',
|
||||||
numberLines: 'Cantidad de Lineas',
|
numberLines: 'Cantidad de Lineas',
|
||||||
pointSale: 'Punto de Venta',
|
pointSale: 'Punto de Venta',
|
||||||
collect: 'Cobrar'
|
collect: 'Cobrar',
|
||||||
|
BusinessPartnerCreate: {
|
||||||
|
businessPartner: 'Socio de Negocios',
|
||||||
|
successfullyCreated: 'Socio de Negocio Creado Exitosamente'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
collect: {
|
collect: {
|
||||||
orderTotal: 'Total de Orden',
|
orderTotal: 'Total de Orden',
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
mode="vertical"
|
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-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
@ -23,6 +23,7 @@ import { mapGetters } from 'vuex'
|
|||||||
import Logo from './Logo'
|
import Logo from './Logo'
|
||||||
import SidebarItem from './SidebarItem'
|
import SidebarItem from './SidebarItem'
|
||||||
import variables from '@/styles/variables.scss'
|
import variables from '@/styles/variables.scss'
|
||||||
|
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { SidebarItem, Logo },
|
components: { SidebarItem, Logo },
|
||||||
@ -48,6 +49,25 @@ export default {
|
|||||||
},
|
},
|
||||||
isCollapse() {
|
isCollapse() {
|
||||||
return !this.sidebar.opened
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ const staticRoutes = [
|
|||||||
{
|
{
|
||||||
path: '/PriceChecking',
|
path: '/PriceChecking',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: false,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/PriceChecking',
|
path: '/PriceChecking',
|
||||||
|
@ -238,9 +238,9 @@ export default {
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
color: '#67C23A'
|
color: '#67C23A'
|
||||||
}
|
}
|
||||||
if (isReport) {
|
// if (isReport) {
|
||||||
return status
|
// return status
|
||||||
}
|
// }
|
||||||
// is executing
|
// is executing
|
||||||
if (isProcessing) {
|
if (isProcessing) {
|
||||||
status.text = this.$t('notifications.processing')
|
status.text = this.$t('notifications.processing')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user