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

fix: Is read only record with different client id. (#676)

Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
Edwin Betancourt 2021-03-17 11:20:07 -04:00 committed by GitHub
parent 837135030e
commit 1c928e238f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 9 deletions

View File

@ -207,6 +207,15 @@ export default {
}
return this.field.isMandatory || this.field.isMandatoryFromLogic
},
isPanelWindow() {
return this.field.panelType === 'window'
},
preferenceClientId() {
if (this.isPanelWindow) {
return this.$store.getters.getPreferenceClientId
}
return undefined
},
/**
* Idicate if field is read only
* TODO: Create common method to evaluate isReadOnly
@ -228,7 +237,15 @@ export default {
const isUpdateableAllFields = this.field.isReadOnly || this.field.isReadOnlyFromLogic
if (this.field.panelType === 'window') {
if (this.isPanelWindow) {
// TODO: Evaluate record uuid without route.action
// edit mode is diferent to create new
let isWithRecord = this.field.recordUuid !== 'create-new'
// evaluate context
if ((this.preferenceClientId !== this.metadataField.clientId) && isWithRecord) {
return true
}
if (isLogColumns) {
return true
}
@ -240,9 +257,6 @@ export default {
return true
}
// TODO: Evaluate record uuid without route.action
// edit mode is diferent to create new
let isWithRecord = this.field.recordUuid !== 'create-new'
if (this.inTable) {
isWithRecord = !this.isEmptyValue(this.field.recordUuid)
}
@ -315,7 +329,7 @@ export default {
return newSizes
}
if (this.field.panelType === 'window') {
if (this.isPanelWindow) {
// TODO: Add FieldYesNo and name.length > 12 || 14
if (this.field.componentPath === 'FieldTextLong') {
return sizeField
@ -353,7 +367,7 @@ export default {
return this.$store.getters.getOrders
},
isDocuemntStatus() {
if (this.field.panelType === 'window' && !this.isAdvancedQuery) {
if (this.isPanelWindow && !this.isAdvancedQuery) {
if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) {
return true
}
@ -361,7 +375,7 @@ export default {
return false
},
isContextInfo() {
if (this.field.panelType !== 'window') {
if (!this.isPanelWindow) {
return false
}
return Boolean(this.field.contextInfo && this.field.contextInfo.isActive) ||

View File

@ -80,22 +80,38 @@ export default {
recordUuid: this.uuidRecord,
optionCRUD: this.optionCRUD,
isShowedRecordNavigation: this.isShowedRecordNavigation,
clientId: this.getContainerClientId,
isProcessingContext: this.getContainerProcessing,
isProcessedContext: this.getContainerProcessed
}
},
getContainerProcessing() {
if (this.panelType === 'window' && !this.isAdvancedQuery) {
if (this.isPanelWindow && !this.isAdvancedQuery) {
return this.$store.getters.getContainerProcessing(this.parentUuid)
}
return false
},
getContainerProcessed() {
if (this.panelType === 'window' && !this.isAdvancedQuery) {
if (this.isPanelWindow && !this.isAdvancedQuery) {
return this.$store.getters.getContainerProcessed(this.parentUuid)
}
return false
},
getContainerClientId() {
let clientId = null
if (this.isPanelWindow && !this.isAdvancedQuery) {
// client id from current record
clientId = this.$store.getters.getValueOfField({
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
columnName: 'AD_Client_ID'
})
if (!this.isEmptyValue(clientId)) {
return parseInt(clientId, 10)
}
}
return clientId
},
getterPanel() {
return this.$store.getters.getPanel(this.containerUuid)
},