mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +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) {
|
runAction(action) {
|
||||||
if (action.type === 'action') {
|
if (action.type === 'action') {
|
||||||
// run process or report
|
this.executeAction(action)
|
||||||
const fieldNotReady = this.$store.getters.isNotReadyForSubmit(this.$route.meta.uuid)
|
} else if (action.type === 'process') {
|
||||||
if (!fieldNotReady) {
|
// 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
|
let containerParams = this.$route.meta.uuid
|
||||||
if (this.lastParameter !== undefined) {
|
if (this.lastParameter !== undefined) {
|
||||||
containerParams = this.lastParameter
|
containerParams = this.lastParameter
|
||||||
}
|
}
|
||||||
|
const fieldsNotReady = this.$store.getters.getFieldListEmptyMandatory({
|
||||||
|
containerUuid: containerParams
|
||||||
|
})
|
||||||
|
|
||||||
|
// run process or report
|
||||||
|
if (this.isEmptyValue(fieldsNotReady)) {
|
||||||
let menuParentUuid = this.menuParentUuid
|
let menuParentUuid = this.menuParentUuid
|
||||||
if (this.isEmptyValue(menuParentUuid) && this.$route.params) {
|
if (this.isEmptyValue(menuParentUuid) && this.$route.params) {
|
||||||
if (!this.isEmptyValue(this.$route.params.menuParentUuid)) {
|
if (!this.isEmptyValue(this.$route.params.menuParentUuid)) {
|
||||||
@ -464,40 +499,11 @@ export const contextMixin = {
|
|||||||
this.showNotification({
|
this.showNotification({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
title: this.$t('notifications.emptyValues'),
|
title: this.$t('notifications.emptyValues'),
|
||||||
name: '<b>' + fieldNotReady.name + '.</b> ',
|
name: '<b>' + fieldsNotReady + '.</b> ',
|
||||||
message: this.$t('notifications.fieldMandatory')
|
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) {
|
updateReport(action) {
|
||||||
let instanceUuid = action.instanceUuid
|
let instanceUuid = action.instanceUuid
|
||||||
|
@ -1049,7 +1049,7 @@ const panel = {
|
|||||||
if (row) {
|
if (row) {
|
||||||
value = row[fieldItem.columnName]
|
value = row[fieldItem.columnName]
|
||||||
}
|
}
|
||||||
if (fieldIsDisplayed(fieldItem) && isMandatory && !isEmptyValue(value)) {
|
if (fieldIsDisplayed(fieldItem) && isMandatory && isEmptyValue(value)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -20,7 +20,7 @@ export function hasTranslation(text) {
|
|||||||
* @param {string} name
|
* @param {string} name
|
||||||
* @param {array} logs
|
* @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)
|
title = hasTranslation(title)
|
||||||
if (message) {
|
if (message) {
|
||||||
message = hasTranslation(message)
|
message = hasTranslation(message)
|
||||||
@ -52,10 +52,12 @@ export function showNotification({ type, title, message, summary, name, logs = [
|
|||||||
position: 'bottom-right',
|
position: 'bottom-right',
|
||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
onClick() {
|
onClick() {
|
||||||
|
if (isRedirect) {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'ProcessActivity'
|
name: 'ProcessActivity'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user