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() {
|
validPay() {
|
||||||
const containerUuid = this.containerUuid
|
const containerUuid = this.containerUuid
|
||||||
|
// filter by visible fields
|
||||||
|
const fieldLogic = this.fieldsList.filter(field => field.isDisplayedFromLogic === true)
|
||||||
const fieldsEmpty = this.$store.getters.getFieldsListEmptyMandatory({
|
const fieldsEmpty = this.$store.getters.getFieldsListEmptyMandatory({
|
||||||
containerUuid,
|
containerUuid,
|
||||||
fieldsList: this.fieldsList
|
fieldsList: fieldLogic,
|
||||||
|
isValidate: true
|
||||||
})
|
})
|
||||||
return !this.isEmptyValue(fieldsEmpty)
|
return !this.isEmptyValue(fieldsEmpty)
|
||||||
},
|
},
|
||||||
@ -565,7 +568,7 @@ export default {
|
|||||||
columnName: 'C_Currency_ID'
|
columnName: 'C_Currency_ID'
|
||||||
})
|
})
|
||||||
const currencyToPay = this.isEmptyValue(currencyUuid) ? currencyId : currencyUuid
|
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
|
this.amontSend = this.convert.divideRate * this.amontSend
|
||||||
}
|
}
|
||||||
if (this.sendToServer) {
|
if (this.sendToServer) {
|
||||||
|
@ -82,12 +82,13 @@ const getters = {
|
|||||||
getFieldsListEmptyMandatory: (state, getters) => ({
|
getFieldsListEmptyMandatory: (state, getters) => ({
|
||||||
containerUuid,
|
containerUuid,
|
||||||
fieldsList,
|
fieldsList,
|
||||||
formatReturn = 'name'
|
formatReturn = 'name',
|
||||||
|
isValidate = false
|
||||||
}) => {
|
}) => {
|
||||||
if (isEmptyValue(fieldsList)) {
|
if (isEmptyValue(fieldsList)) {
|
||||||
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
||||||
}
|
}
|
||||||
|
const fieldsEmpty = []
|
||||||
// all optionals (not mandatory) fields
|
// all optionals (not mandatory) fields
|
||||||
const fieldsNameEmpty = fieldsList.filter(fieldItem => {
|
const fieldsNameEmpty = fieldsList.filter(fieldItem => {
|
||||||
const value = getters.getValueOfField({
|
const value = getters.getValueOfField({
|
||||||
@ -95,7 +96,12 @@ const getters = {
|
|||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: fieldItem.columnName
|
columnName: fieldItem.columnName
|
||||||
})
|
})
|
||||||
|
if (isValidate && isEmptyValue(value)) {
|
||||||
|
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
||||||
|
if (fieldIsDisplayed(fieldItem) && isMandatory) {
|
||||||
|
fieldsEmpty.push(fieldItem.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isEmptyValue(value)) {
|
if (isEmptyValue(value)) {
|
||||||
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
||||||
if (fieldIsDisplayed(fieldItem) && isMandatory) {
|
if (fieldIsDisplayed(fieldItem) && isMandatory) {
|
||||||
@ -103,7 +109,9 @@ const getters = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (isValidate) {
|
||||||
|
return fieldsEmpty
|
||||||
|
}
|
||||||
if (formatReturn) {
|
if (formatReturn) {
|
||||||
return fieldsList.map(fieldItem => {
|
return fieldsList.map(fieldItem => {
|
||||||
return fieldItem[formatReturn]
|
return fieldItem[formatReturn]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user