mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 07:04:21 +08:00
fix: Mandatory fields empty. (#456)
This commit is contained in:
parent
9d59700aa5
commit
0d7aa7c72f
@ -415,14 +415,49 @@ export const contextMixin = {
|
||||
},
|
||||
runAction(action) {
|
||||
if (action.type === 'action') {
|
||||
// run process or report
|
||||
const fieldNotReady = this.$store.getters.isNotReadyForSubmit(this.$route.meta.uuid)
|
||||
if (!fieldNotReady) {
|
||||
this.executeAction(action)
|
||||
} else if (action.type === 'process') {
|
||||
// run process associate with view (window or browser)
|
||||
this.showModal(action)
|
||||
} else if (action.type === 'dataAction') {
|
||||
if (action.action === 'undoModifyData' && Boolean(!this.getterDataLog) && this.getterWindowOldRoute) {
|
||||
this.$router.push({
|
||||
path: this.getterWindowOldRoute.path,
|
||||
query: {
|
||||
...this.getterWindowOldRoute.query
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$store.dispatch(action.action, {
|
||||
parentUuid: this.parentUuid,
|
||||
containerUuid: this.containerUuid,
|
||||
recordUuid: this.recordUuid,
|
||||
panelType: this.panelType,
|
||||
isNewRecord: action.action === 'resetPanelToNew',
|
||||
tableName: action.tableName,
|
||||
recordId: action.recordId
|
||||
})
|
||||
.then(response => {
|
||||
if (response && response.isPrivateAccess) {
|
||||
this.validatePrivateAccess(response)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (action.type === 'updateReport') {
|
||||
this.updateReport(action)
|
||||
}
|
||||
},
|
||||
executeAction(action) {
|
||||
let containerParams = this.$route.meta.uuid
|
||||
if (this.lastParameter !== undefined) {
|
||||
containerParams = this.lastParameter
|
||||
}
|
||||
const fieldsNotReady = this.$store.getters.getFieldListEmptyMandatory({
|
||||
containerUuid: containerParams
|
||||
})
|
||||
|
||||
// run process or report
|
||||
if (this.isEmptyValue(fieldsNotReady)) {
|
||||
let menuParentUuid = this.menuParentUuid
|
||||
if (this.isEmptyValue(menuParentUuid) && this.$route.params) {
|
||||
if (!this.isEmptyValue(this.$route.params.menuParentUuid)) {
|
||||
@ -464,40 +499,11 @@ export const contextMixin = {
|
||||
this.showNotification({
|
||||
type: 'warning',
|
||||
title: this.$t('notifications.emptyValues'),
|
||||
name: '<b>' + fieldNotReady.name + '.</b> ',
|
||||
message: this.$t('notifications.fieldMandatory')
|
||||
name: '<b>' + fieldsNotReady + '.</b> ',
|
||||
message: this.$t('notifications.fieldMandatory'),
|
||||
isRedirect: false
|
||||
})
|
||||
}
|
||||
} else if (action.type === 'process') {
|
||||
// run process associate with view (window or browser)
|
||||
this.showModal(action)
|
||||
} else if (action.type === 'dataAction') {
|
||||
if (action.action === 'undoModifyData' && Boolean(!this.getterDataLog) && this.getterWindowOldRoute) {
|
||||
this.$router.push({
|
||||
path: this.getterWindowOldRoute.path,
|
||||
query: {
|
||||
...this.getterWindowOldRoute.query
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$store.dispatch(action.action, {
|
||||
parentUuid: this.parentUuid,
|
||||
containerUuid: this.containerUuid,
|
||||
recordUuid: this.recordUuid,
|
||||
panelType: this.panelType,
|
||||
isNewRecord: action.action === 'resetPanelToNew',
|
||||
tableName: action.tableName,
|
||||
recordId: action.recordId
|
||||
})
|
||||
.then(response => {
|
||||
if (response && response.isPrivateAccess) {
|
||||
this.validatePrivateAccess(response)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (action.type === 'updateReport') {
|
||||
this.updateReport(action)
|
||||
}
|
||||
},
|
||||
updateReport(action) {
|
||||
let instanceUuid = action.instanceUuid
|
||||
|
@ -1049,7 +1049,7 @@ const panel = {
|
||||
if (row) {
|
||||
value = row[fieldItem.columnName]
|
||||
}
|
||||
if (fieldIsDisplayed(fieldItem) && isMandatory && !isEmptyValue(value)) {
|
||||
if (fieldIsDisplayed(fieldItem) && isMandatory && isEmptyValue(value)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
@ -20,7 +20,7 @@ export function hasTranslation(text) {
|
||||
* @param {string} name
|
||||
* @param {array} logs
|
||||
*/
|
||||
export function showNotification({ type, title, message, summary, name, logs = [] }) {
|
||||
export function showNotification({ type, title, message, summary, name, logs = [], isRedirect = true }) {
|
||||
title = hasTranslation(title)
|
||||
if (message) {
|
||||
message = hasTranslation(message)
|
||||
@ -52,10 +52,12 @@ export function showNotification({ type, title, message, summary, name, logs = [
|
||||
position: 'bottom-right',
|
||||
dangerouslyUseHTMLString: true,
|
||||
onClick() {
|
||||
if (isRedirect) {
|
||||
router.push({
|
||||
name: 'ProcessActivity'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user