Adjust record page blocks refresh in modal
This commit is contained in:
parent
55dfcb8ab7
commit
8c6c3b8cd9
@ -1067,9 +1067,7 @@ export default {
|
||||
this.$root.$on(`record-line:collect:${this.uniqueID}`, this.resolveRecords)
|
||||
this.$root.$on(`page-block:validate:${this.uniqueID}`, this.validatePageBlock)
|
||||
this.$root.$on(`drill-down-recordList:${this.uniqueID}`, this.setDrillDownFilter)
|
||||
this.$root.$on(`refetch-non-record-blocks:${pageID}`, () => {
|
||||
this.refresh(true)
|
||||
})
|
||||
this.$root.$on(`refetch-non-record-blocks:${pageID}`, this.refreshAndResetPagination)
|
||||
},
|
||||
|
||||
onFilter (filter = []) {
|
||||
@ -1872,15 +1870,17 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
refreshAndResetPagination () {
|
||||
this.refresh(true)
|
||||
},
|
||||
|
||||
destroyEvents () {
|
||||
const { pageID = NoID } = this.page
|
||||
|
||||
this.$root.$off(`record-line:collect:${this.uniqueID}`, this.resolveRecords)
|
||||
this.$root.$off(`page-block:validate:${this.uniqueID}`, this.validatePageBlock)
|
||||
this.$root.$off(`drill-down-recordList:${this.uniqueID}`, this.setDrillDownFilter)
|
||||
this.$root.$off(`refetch-non-record-blocks:${pageID}`, () => {
|
||||
this.refresh(true)
|
||||
})
|
||||
this.$root.$off(`refetch-non-record-blocks:${pageID}`, this.refreshAndResetPagination)
|
||||
},
|
||||
|
||||
handleAddRecord () {
|
||||
|
||||
@ -127,6 +127,7 @@ export default {
|
||||
}),
|
||||
|
||||
loadRecord ({ recordID, recordPageID, values, refRecord }) {
|
||||
this.recordID = recordID
|
||||
this.values = values
|
||||
this.refRecord = refRecord
|
||||
|
||||
@ -162,6 +163,8 @@ export default {
|
||||
},
|
||||
|
||||
onHidden () {
|
||||
this.setDefaultValues()
|
||||
|
||||
setTimeout(() => {
|
||||
this.$router.replace({
|
||||
query: {
|
||||
@ -204,4 +207,10 @@ export default {
|
||||
.position-initial {
|
||||
position: initial;
|
||||
}
|
||||
|
||||
#record-modal .modal-header {
|
||||
h5 {
|
||||
min-height: 27px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -161,19 +161,20 @@ export default {
|
||||
if (this.record.valueErrors.set) {
|
||||
this.toastWarning(this.$t('notification:record.validationWarnings'))
|
||||
} else {
|
||||
this.inCreating = false
|
||||
this.inEditing = false
|
||||
|
||||
if (this.showRecordModal) {
|
||||
this.$emit('handle-record-redirect', { recordID: record.recordID, recordPageID: this.page.pageID })
|
||||
} else {
|
||||
this.$router.push({ name: route, params: { ...this.$route.params, recordID: record.recordID } })
|
||||
}
|
||||
|
||||
// Refresh record
|
||||
this.inCreating = false
|
||||
this.inEditing = false
|
||||
this.record = undefined
|
||||
this.loadRecord().then(() => {
|
||||
if (!isNew) {
|
||||
this.record = record
|
||||
this.determineLayout()
|
||||
})
|
||||
this.$root.$emit(`refetch-non-record-blocks:${this.page.pageID}`)
|
||||
}
|
||||
}
|
||||
|
||||
this.toastSuccess(this.$t(`notification:record.${isNew ? 'create' : 'update'}Success`))
|
||||
|
||||
@ -251,12 +251,16 @@ export default {
|
||||
const { useTitle = false } = config
|
||||
|
||||
if (useTitle) {
|
||||
return evaluatePrefilter(meta.title, {
|
||||
record: this.record,
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
})
|
||||
try {
|
||||
return evaluatePrefilter(meta.title, {
|
||||
record: this.record,
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
})
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
const { name, handle } = this.module
|
||||
@ -277,9 +281,7 @@ export default {
|
||||
immediate: true,
|
||||
handler () {
|
||||
this.record = undefined
|
||||
this.loadRecord().then(() => {
|
||||
this.determineLayout()
|
||||
})
|
||||
this.refresh()
|
||||
},
|
||||
},
|
||||
|
||||
@ -345,7 +347,9 @@ export default {
|
||||
|
||||
return response()
|
||||
.then(record => {
|
||||
this.record = new compose.Record(module, record)
|
||||
setTimeout(() => {
|
||||
this.record = new compose.Record(module, record)
|
||||
}, 300)
|
||||
})
|
||||
.catch(e => {
|
||||
if (!axios.isCancel(e)) {
|
||||
@ -419,8 +423,15 @@ export default {
|
||||
},
|
||||
|
||||
handleView () {
|
||||
this.inEditing = false
|
||||
this.inCreating = false
|
||||
this.processing = true
|
||||
|
||||
this.refresh().then(() => {
|
||||
this.inEditing = false
|
||||
this.inCreating = false
|
||||
this.$root.$emit(`refetch-non-record-blocks:${this.page.pageID}`)
|
||||
}).finally(() => {
|
||||
this.processing = false
|
||||
})
|
||||
},
|
||||
|
||||
handleRedirectToPrevOrNext (recordID) {
|
||||
@ -533,6 +544,12 @@ export default {
|
||||
this.$root.$emit(`refetch-non-record-blocks:${this.page.pageID}`)
|
||||
},
|
||||
|
||||
async refresh () {
|
||||
return this.loadRecord().then(() => {
|
||||
return this.determineLayout()
|
||||
})
|
||||
},
|
||||
|
||||
setDefaultValues () {
|
||||
this.inEditing = false
|
||||
this.inCreating = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user