1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

fix: Navigation duplicated. (#504)

This commit is contained in:
Edwin Betancourt 2020-05-25 14:54:07 -04:00 committed by GitHub
parent cea6e5858e
commit 85639ae586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 10 deletions

View File

@ -79,7 +79,7 @@
"vue-i18n": "8.17.4",
"vue-multipane": "^0.9.5",
"vue-resize": "^0.5.0",
"vue-router": "3.1.6",
"vue-router": "3.2.0",
"vue-shortkey": "^3.1.7",
"vue-split-panel": "^1.0.4",
"vue-splitpane": "1.0.6",

View File

@ -858,15 +858,20 @@ export default {
// disabled rollback when change route
this.$store.dispatch('setDataLog', {})
}
const tableName = this.getterPanel.tableName
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
action: row.UUID
},
params: {
tableName: this.getterPanel.tableName,
recordId: row[`${this.getterPanel.tableName}_ID`]
...this.$router.params,
tableName,
recordId: row[`${tableName}_ID`]
}
}).catch(error => {
console.info(`DataTable Component: ${error.name}, ${error.message}`)
})
} else {
if (!row.isEdit) {

View File

@ -446,7 +446,11 @@ export default {
if (!Object.prototype.hasOwnProperty.call(route.params, 'isReadParameters') || route.params.isReadParameters) {
this.getData(parameters)
}
this.setTagsViewTitle(route.query.action)
let viewTitle = ''
if (route.query && !this.isEmptyValue(route.query.action)) {
viewTitle = route.query.action
}
this.setTagsViewTitle(viewTitle)
} else {
if (this.panelType === 'table' && route.query.action === 'advancedQuery') {
// TODO: use action notifyPanelChange with isShowedField in true
@ -513,6 +517,8 @@ export default {
.then(response => {
if (response.length && !parameters.isNewRecord) {
this.dataRecords = response[0]
const recordId = this.dataRecords[`${this.metadata.tableName}_ID`]
if (this.$route.query.action === 'criteria') {
this.$router.push({
name: this.$route.name,
@ -523,9 +529,12 @@ export default {
params: {
...this.$route.params,
tableName: this.metadata.tableName,
recordId: this.dataRecords[`${this.metadata.tableName}_ID`]
recordId
}
}).catch(error => {
console.info(`Panel Component: ${error.name}, ${error.message}`)
})
this.$store.dispatch('notifyPanelChange', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
@ -542,10 +551,14 @@ export default {
...this.$route.query
},
params: {
...this.$route.params,
tableName: this.metadata.tableName,
recordId: this.dataRecords[`${this.metadata.tableName}_ID`]
recordId
}
}).catch(error => {
console.info(`Panel Component: ${error.name}, ${error.message}`)
})
this.$store.dispatch('notifyPanelChange', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
@ -560,10 +573,16 @@ export default {
query: {
...this.$route.query,
action: this.dataRecords.UUID
},
params: {
...this.$route.params,
tableName: this.metadata.tableName,
recordId
}
}).catch(error => {
console.info(`Panel Component: ${error.name}, ${error.message}`)
})
this.$route.params['tableName'] = this.metadata.tableName
this.$route.params['recordId'] = this.dataRecords[`${this.metadata.tableName}_ID`]
this.$store.dispatch('notifyPanelChange', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
@ -574,7 +593,11 @@ export default {
panelType: this.panelType
})
}
this.setTagsViewTitle(this.$route.query.action)
let viewTitle = ''
if (this.$route.query && !this.isEmptyValue(this.$route.query.action)) {
viewTitle = this.$route.query.action
}
this.setTagsViewTitle(viewTitle)
this.isLoadRecord = true
} else {
this.$router.push({
@ -582,6 +605,8 @@ export default {
...this.$route.query,
action: 'create-new'
}
}).catch(error => {
console.info(`Panel Component: ${error.name}, ${error.message}`)
})
}
})
@ -703,7 +728,7 @@ export default {
}
}
this.setTagsViewTitle(uuidRecord)
if (this.$route.query.action === 'create-new') {
if (this.$route.query && this.$route.query.action === 'create-new') {
this.setFocus()
}
const currentRecord = this.getterDataStore.record.find(record => record.UUID === uuidRecord)