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,59 +415,7 @@ 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)
|
|
||||||
if (!fieldNotReady) {
|
|
||||||
let containerParams = this.$route.meta.uuid
|
|
||||||
if (this.lastParameter !== undefined) {
|
|
||||||
containerParams = this.lastParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
let menuParentUuid = this.menuParentUuid
|
|
||||||
if (this.isEmptyValue(menuParentUuid) && this.$route.params) {
|
|
||||||
if (!this.isEmptyValue(this.$route.params.menuParentUuid)) {
|
|
||||||
menuParentUuid = this.$route.params.menuParentUuid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.panelType === 'process') {
|
|
||||||
this.$store.dispatch('setTempShareLink', {
|
|
||||||
processId: this.$route.params.processId,
|
|
||||||
href: window.location.href
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let reportFormat = action.reportExportType
|
|
||||||
if (this.isEmptyValue(reportFormat)) {
|
|
||||||
reportFormat = this.$route.query.reportType
|
|
||||||
if (this.isEmptyValue(reportFormat)) {
|
|
||||||
reportFormat = this.$route.meta.reportFormat
|
|
||||||
if (this.isEmptyValue(reportFormat)) {
|
|
||||||
reportFormat = 'html'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.dispatch(action.action, {
|
|
||||||
action,
|
|
||||||
parentUuid: this.containerUuid,
|
|
||||||
containerUuid: containerParams, // EVALUATE IF IS action.uuid
|
|
||||||
panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
|
|
||||||
reportFormat, // this.$route.query.reportType ? this.$route.query.reportType : action.reportExportType,
|
|
||||||
menuParentUuid, // to load relationsList in context menu (report view)
|
|
||||||
routeToDelete: this.$route
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.warn(error)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.showNotification({
|
|
||||||
type: 'warning',
|
|
||||||
title: this.$t('notifications.emptyValues'),
|
|
||||||
name: '<b>' + fieldNotReady.name + '.</b> ',
|
|
||||||
message: this.$t('notifications.fieldMandatory')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (action.type === 'process') {
|
} else if (action.type === 'process') {
|
||||||
// run process associate with view (window or browser)
|
// run process associate with view (window or browser)
|
||||||
this.showModal(action)
|
this.showModal(action)
|
||||||
@ -499,6 +447,64 @@ export const contextMixin = {
|
|||||||
this.updateReport(action)
|
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)) {
|
||||||
|
menuParentUuid = this.$route.params.menuParentUuid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.panelType === 'process') {
|
||||||
|
this.$store.dispatch('setTempShareLink', {
|
||||||
|
processId: this.$route.params.processId,
|
||||||
|
href: window.location.href
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let reportFormat = action.reportExportType
|
||||||
|
if (this.isEmptyValue(reportFormat)) {
|
||||||
|
reportFormat = this.$route.query.reportType
|
||||||
|
if (this.isEmptyValue(reportFormat)) {
|
||||||
|
reportFormat = this.$route.meta.reportFormat
|
||||||
|
if (this.isEmptyValue(reportFormat)) {
|
||||||
|
reportFormat = 'html'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$store.dispatch(action.action, {
|
||||||
|
action,
|
||||||
|
parentUuid: this.containerUuid,
|
||||||
|
containerUuid: containerParams, // EVALUATE IF IS action.uuid
|
||||||
|
panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
|
||||||
|
reportFormat, // this.$route.query.reportType ? this.$route.query.reportType : action.reportExportType,
|
||||||
|
menuParentUuid, // to load relationsList in context menu (report view)
|
||||||
|
routeToDelete: this.$route
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(error)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.showNotification({
|
||||||
|
type: 'warning',
|
||||||
|
title: this.$t('notifications.emptyValues'),
|
||||||
|
name: '<b>' + fieldsNotReady + '.</b> ',
|
||||||
|
message: this.$t('notifications.fieldMandatory'),
|
||||||
|
isRedirect: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
updateReport(action) {
|
updateReport(action) {
|
||||||
let instanceUuid = action.instanceUuid
|
let instanceUuid = action.instanceUuid
|
||||||
if (this.isEmptyValue(instanceUuid)) {
|
if (this.isEmptyValue(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,9 +52,11 @@ export function showNotification({ type, title, message, summary, name, logs = [
|
|||||||
position: 'bottom-right',
|
position: 'bottom-right',
|
||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
onClick() {
|
onClick() {
|
||||||
router.push({
|
if (isRedirect) {
|
||||||
name: 'ProcessActivity'
|
router.push({
|
||||||
})
|
name: 'ProcessActivity'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user