mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-12 22:29:59 +08:00
fix: Unnecessary request for list of documents. (#590)
Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
70a57c7576
commit
857c37b589
@ -68,6 +68,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
isNewRecord() {
|
||||||
|
return this.isEmptyValue(this.$route.query) ||
|
||||||
|
this.isEmptyValue(this.$route.query.action) ||
|
||||||
|
this.$route.query.action === 'create-new'
|
||||||
|
},
|
||||||
showContextMenu() {
|
showContextMenu() {
|
||||||
return this.$store.state.settings.showContextMenu
|
return this.$store.state.settings.showContextMenu
|
||||||
},
|
},
|
||||||
@ -249,8 +254,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// current record
|
// current record
|
||||||
getRecord() {
|
getRecord() {
|
||||||
const { action } = this.$route.query
|
if (!this.isNewRecord) {
|
||||||
if (!this.isEmptyValue(action) && action !== 'create-new') {
|
const { action } = this.$route.query
|
||||||
return this.getterDataRecords.find(record => {
|
return this.getterDataRecords.find(record => {
|
||||||
return record.UUID === action
|
return record.UUID === action
|
||||||
})
|
})
|
||||||
@ -271,13 +276,17 @@ export default {
|
|||||||
}
|
}
|
||||||
return currentRecord
|
return currentRecord
|
||||||
},
|
},
|
||||||
isDocument() {
|
isDocumentTab() {
|
||||||
const panel = this.$store.getters.getPanel(this.windowMetadata.currentTabUuid)
|
const panel = this.$store.getters.getPanel(this.windowMetadata.currentTabUuid)
|
||||||
return panel.isDocument
|
if (!this.isEmptyValue(panel)) {
|
||||||
|
return panel.isDocument
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.windowMetadata.firstTab.isDocument
|
||||||
},
|
},
|
||||||
isWorkflowBarStatus() {
|
isWorkflowBarStatus() {
|
||||||
const panel = this.$store.getters.getPanel(this.windowMetadata.currentTabUuid)
|
const panel = this.$store.getters.getPanel(this.windowMetadata.currentTabUuid)
|
||||||
if (!this.isEmptyValue(panel) && this.isDocument && this.$route.query.action !== 'create-new') {
|
if (!this.isEmptyValue(panel) && this.isDocumentTab && !this.isNewRecord) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -339,18 +348,18 @@ export default {
|
|||||||
}
|
}
|
||||||
}, () => {})
|
}, () => {})
|
||||||
|
|
||||||
const action = this.$route.query.action
|
|
||||||
let recordUuid
|
let recordUuid
|
||||||
if (!this.isEmptyValue(action) && action !== 'create-new') {
|
if (!this.isNewRecord) {
|
||||||
recordUuid = action
|
recordUuid = this.$route.query.action
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Verify if first tab is document
|
if (this.isDocumentTab) {
|
||||||
this.$store.dispatch('listWorkflowLogs', {
|
this.$store.dispatch('listWorkflowLogs', {
|
||||||
tableName,
|
tableName,
|
||||||
recordUuid,
|
recordUuid,
|
||||||
recordId
|
recordId
|
||||||
})
|
})
|
||||||
|
}
|
||||||
this.$store.dispatch(this.activeInfo, {
|
this.$store.dispatch(this.activeInfo, {
|
||||||
tableName,
|
tableName,
|
||||||
recordId,
|
recordId,
|
||||||
@ -365,10 +374,9 @@ export default {
|
|||||||
tableName = this.getTableName
|
tableName = this.getTableName
|
||||||
}
|
}
|
||||||
|
|
||||||
const action = this.$route.query.action
|
|
||||||
let recordUuid
|
let recordUuid
|
||||||
if (!this.isEmptyValue(action) && action !== 'create-new') {
|
if (!this.isNewRecord) {
|
||||||
recordUuid = action
|
recordUuid = this.$route.query.action
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = this.currentRecord
|
const record = this.currentRecord
|
||||||
@ -411,10 +419,12 @@ export default {
|
|||||||
this.windowMetadata = window
|
this.windowMetadata = window
|
||||||
let isShowRecords = this.isShowedRecordNavigation
|
let isShowRecords = this.isShowedRecordNavigation
|
||||||
if (isShowRecords === undefined) {
|
if (isShowRecords === undefined) {
|
||||||
if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10 && this.$route.query.action !== 'create-new') ||
|
if ((['M', 'Q'].includes(this.windowMetadata.windowType) &&
|
||||||
|
this.getterRecordList >= 10 &&
|
||||||
|
!this.isNewRecord) ||
|
||||||
this.$route.query.action === 'advancedQuery') {
|
this.$route.query.action === 'advancedQuery') {
|
||||||
isShowRecords = true
|
isShowRecords = true
|
||||||
} else if (this.windowMetadata.windowType === 'T' || this.$route.query.action === 'create-new') {
|
} else if (this.windowMetadata.windowType === 'T' || this.isNewRecord) {
|
||||||
isShowRecords = false
|
isShowRecords = false
|
||||||
} else if (this.$route.query.action === 'listRecords') {
|
} else if (this.$route.query.action === 'listRecords') {
|
||||||
isShowRecords = true
|
isShowRecords = true
|
||||||
@ -430,11 +440,14 @@ export default {
|
|||||||
if (!this.isEmptyValue(record)) {
|
if (!this.isEmptyValue(record)) {
|
||||||
recordId = record[tableName + '_ID']
|
recordId = record[tableName + '_ID']
|
||||||
}
|
}
|
||||||
this.$store.dispatch('listDocumentStatus', {
|
|
||||||
tableName,
|
if (this.isDocumentTab) {
|
||||||
recordUuid: this.$route.query.action,
|
this.$store.dispatch('listDocumentStatus', {
|
||||||
recordId
|
tableName,
|
||||||
})
|
recordUuid: this.$route.query.action,
|
||||||
|
recordId
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
handleChangeShowedRecordNavigation(valueToChange) {
|
handleChangeShowedRecordNavigation(valueToChange) {
|
||||||
const panelRight = document.getElementById('PanelRight')
|
const panelRight = document.getElementById('PanelRight')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user