mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
Verify empty fields before processing payment (#618)
Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
This commit is contained in:
parent
eeba4c7b45
commit
b1bd5c8e11
@ -363,9 +363,12 @@ export default {
|
||||
},
|
||||
validPay() {
|
||||
const containerUuid = this.containerUuid
|
||||
// filter by visible fields
|
||||
const fieldLogic = this.fieldsList.filter(field => field.isDisplayedFromLogic === true)
|
||||
const fieldsEmpty = this.$store.getters.getFieldsListEmptyMandatory({
|
||||
containerUuid,
|
||||
fieldsList: this.fieldsList
|
||||
fieldsList: fieldLogic,
|
||||
isValidate: true
|
||||
})
|
||||
return !this.isEmptyValue(fieldsEmpty)
|
||||
},
|
||||
@ -565,7 +568,7 @@ export default {
|
||||
columnName: 'C_Currency_ID'
|
||||
})
|
||||
const currencyToPay = this.isEmptyValue(currencyUuid) ? currencyId : currencyUuid
|
||||
if (this.currencyDisplay(currencyToPay).currencyUuid !== this.currencyPoint.uuid) {
|
||||
if (this.isEmptyValue(this.currencyDisplay(currencyToPay)) && this.currencyDisplay(currencyToPay).currencyUuid !== this.currencyPoint.uuid) {
|
||||
this.amontSend = this.convert.divideRate * this.amontSend
|
||||
}
|
||||
if (this.sendToServer) {
|
||||
|
@ -82,12 +82,13 @@ const getters = {
|
||||
getFieldsListEmptyMandatory: (state, getters) => ({
|
||||
containerUuid,
|
||||
fieldsList,
|
||||
formatReturn = 'name'
|
||||
formatReturn = 'name',
|
||||
isValidate = false
|
||||
}) => {
|
||||
if (isEmptyValue(fieldsList)) {
|
||||
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
||||
}
|
||||
|
||||
const fieldsEmpty = []
|
||||
// all optionals (not mandatory) fields
|
||||
const fieldsNameEmpty = fieldsList.filter(fieldItem => {
|
||||
const value = getters.getValueOfField({
|
||||
@ -95,7 +96,12 @@ const getters = {
|
||||
containerUuid,
|
||||
columnName: fieldItem.columnName
|
||||
})
|
||||
|
||||
if (isValidate && isEmptyValue(value)) {
|
||||
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
||||
if (fieldIsDisplayed(fieldItem) && isMandatory) {
|
||||
fieldsEmpty.push(fieldItem.name)
|
||||
}
|
||||
}
|
||||
if (isEmptyValue(value)) {
|
||||
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
||||
if (fieldIsDisplayed(fieldItem) && isMandatory) {
|
||||
@ -103,7 +109,9 @@ const getters = {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (isValidate) {
|
||||
return fieldsEmpty
|
||||
}
|
||||
if (formatReturn) {
|
||||
return fieldsList.map(fieldItem => {
|
||||
return fieldItem[formatReturn]
|
||||
|
Loading…
x
Reference in New Issue
Block a user