mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
Validate mandatory fields when creating a business partner (#725)
* Fixes: #724 * bugfix: Delete duplicated code. * minimal changes * remove computed Co-authored-by: Edwin Betancourt <EdwinBetanc0urt@outlook.com>
This commit is contained in:
parent
54dce3ff69
commit
0860a69b22
@ -29,7 +29,8 @@ export default [
|
|||||||
defaultValue: '@#C_Country_ID@',
|
defaultValue: '@#C_Country_ID@',
|
||||||
size: 24,
|
size: 24,
|
||||||
sequenceFields: 'CO',
|
sequenceFields: 'CO',
|
||||||
index: 2
|
index: 2,
|
||||||
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -40,7 +41,8 @@ export default [
|
|||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24,
|
size: 24,
|
||||||
sequenceFields: 'R',
|
sequenceFields: 'R',
|
||||||
index: 3
|
index: 3,
|
||||||
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -51,7 +53,8 @@ export default [
|
|||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24,
|
size: 24,
|
||||||
sequenceFields: 'C',
|
sequenceFields: 'C',
|
||||||
index: 4
|
index: 4,
|
||||||
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -237,15 +237,15 @@ export default {
|
|||||||
// })
|
// })
|
||||||
},
|
},
|
||||||
sendValuesToServer() {
|
sendValuesToServer() {
|
||||||
const fieldsNotReady = this.$store.getters.getFieldsListEmptyMandatory({
|
const emptyMandatoryFields = this.$store.getters.getFieldsListEmptyMandatory({
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
isValidate: true
|
formatReturn: 'name'
|
||||||
})
|
})
|
||||||
if (!this.isEmptyValue(fieldsNotReady)) {
|
if (!this.isEmptyValue(emptyMandatoryFields)) {
|
||||||
showNotification({
|
showNotification({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
title: this.$t('notifications.emptyValues'),
|
title: this.$t('notifications.emptyValues'),
|
||||||
name: '<b>' + fieldsNotReady + '.</b> ',
|
name: '<b>' + emptyMandatoryFields + '.</b> ',
|
||||||
message: this.$t('notifications.fieldMandatory'),
|
message: this.$t('notifications.fieldMandatory'),
|
||||||
isRedirect: false
|
isRedirect: false
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
class="custom-button-create-bp"
|
class="custom-button-create-bp"
|
||||||
icon="el-icon-check"
|
icon="el-icon-check"
|
||||||
:loading="isLoadingRecord"
|
|
||||||
@click="createBusinessParter"
|
@click="createBusinessParter"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
@ -75,14 +74,6 @@ export default {
|
|||||||
unsubscribe: () => {}
|
unsubscribe: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
emptyMandatoryFields() {
|
|
||||||
const field = this.$store.getters.getFieldsListEmptyMandatory({
|
|
||||||
containerUuid: this.containerUuid
|
|
||||||
})
|
|
||||||
return field
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
showField(value) {
|
showField(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
@ -105,16 +96,17 @@ export default {
|
|||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
format: 'object'
|
format: 'object'
|
||||||
})
|
})
|
||||||
if (this.isEmptyValue(values)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const name2 = this.$store.getters.getValueOfField({
|
const name2 = this.$store.getters.getValueOfField({
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
columnName: 'Name2'
|
columnName: 'Name2'
|
||||||
})
|
})
|
||||||
values = this.convertValuesToSend(values)
|
values = this.convertValuesToSend(values)
|
||||||
values.name2 = name2
|
values.name2 = name2
|
||||||
if (this.isEmptyValue(this.emptyMandatoryFields)) {
|
const emptyMandatoryFields = this.$store.getters.getFieldsListEmptyMandatory({
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
formatReturn: 'name'
|
||||||
|
})
|
||||||
|
if (this.isEmptyValue(emptyMandatoryFields)) {
|
||||||
this.isLoadingRecord = true
|
this.isLoadingRecord = true
|
||||||
requestCreateBusinessPartner(values)
|
requestCreateBusinessPartner(values)
|
||||||
.then(responseBPartner => {
|
.then(responseBPartner => {
|
||||||
@ -132,7 +124,7 @@ export default {
|
|||||||
this.showsPopovers.isShowCreate = true
|
this.showsPopovers.isShowCreate = true
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: error.message,
|
message: error.message + 'Name',
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
@ -144,7 +136,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'warn',
|
type: 'warn',
|
||||||
message: this.$t('notifications.mandatoryFieldMissing') + this.emptyMandatoryFields,
|
message: this.$t('notifications.mandatoryFieldMissing') + emptyMandatoryFields,
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
|
@ -8,7 +8,8 @@ export default [
|
|||||||
tabindex: '0',
|
tabindex: '0',
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24,
|
||||||
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -19,7 +20,8 @@ export default [
|
|||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
isCustomField: true,
|
isCustomField: true,
|
||||||
size: 24
|
size: 24,
|
||||||
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,7 +68,8 @@ export default [
|
|||||||
componentPath: 'FieldLocation',
|
componentPath: 'FieldLocation',
|
||||||
handleActionPerformed: false,
|
handleActionPerformed: false,
|
||||||
isSendParentValues: true,
|
isSendParentValues: true,
|
||||||
popoverPlacement: 'top'
|
popoverPlacement: 'top',
|
||||||
|
isMandatory: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user