mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
feat: Refactor window control vuex module. (#611)
Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
aa79d74f3b
commit
6439dcb2fa
File diff suppressed because it is too large
Load Diff
1080
src/store/modules/ADempiere/windowControl/actions.js
Normal file
1080
src/store/modules/ADempiere/windowControl/actions.js
Normal file
File diff suppressed because it is too large
Load Diff
37
src/store/modules/ADempiere/windowControl/getters.js
Normal file
37
src/store/modules/ADempiere/windowControl/getters.js
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Vuex Module, Window Control
|
||||
* Getters
|
||||
* @author Edwin Betancourt <EdwinBetanc0urt@outlook.com>
|
||||
*/
|
||||
export default {
|
||||
getCurrentRecord: (state) => {
|
||||
return state.currentRecord
|
||||
},
|
||||
|
||||
getInCreate: (state) => (containerUuid) => {
|
||||
return state.inCreate.find(item => item.containerUuid === containerUuid)
|
||||
},
|
||||
|
||||
getReferencesList: (state) => (windowUuid, recordUuid) => {
|
||||
return state.references.find(item => item.windowUuid === windowUuid && item.recordUuid === recordUuid)
|
||||
},
|
||||
|
||||
getReferencesInfo: (state, getters) => ({ windowUuid, recordUuid, referenceUuid }) => {
|
||||
const references = getters.getReferencesList(windowUuid, recordUuid)
|
||||
return references.referencesList.find(item => item.uuid === referenceUuid)
|
||||
},
|
||||
|
||||
getTabSequenceRecord: (state) => {
|
||||
return state.tabSequenceRecord
|
||||
},
|
||||
|
||||
getDataLog: (state) => (containerUuid, recordUuid) => {
|
||||
const current = state.dataLog
|
||||
if (current.containerUuid === containerUuid &&
|
||||
((current.recordUuid === recordUuid) ||
|
||||
(current.eventType === 'DELETE' && recordUuid === 'create-new'))) {
|
||||
return current
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
19
src/store/modules/ADempiere/windowControl/index.js
Normal file
19
src/store/modules/ADempiere/windowControl/index.js
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
import state from './state.js'
|
||||
import mutations from './mutations.js'
|
||||
import actions from './actions.js'
|
||||
import getters from './getters.js'
|
||||
|
||||
/**
|
||||
* Window Control
|
||||
* Vuex Module
|
||||
* @author Edwin Betancourt <EdwinBetanc0urt@outlook.com>
|
||||
*/
|
||||
const windowControl = {
|
||||
state,
|
||||
mutations,
|
||||
actions,
|
||||
getters
|
||||
}
|
||||
|
||||
export default windowControl
|
48
src/store/modules/ADempiere/windowControl/mutations.js
Normal file
48
src/store/modules/ADempiere/windowControl/mutations.js
Normal file
@ -0,0 +1,48 @@
|
||||
import initStateWindowControl from './state.js'
|
||||
|
||||
/**
|
||||
* Window Control Vuex Module
|
||||
* Muttations to commit state
|
||||
* @author Edwin Betancourt <EdwinBetanc0urt@outlook.com>
|
||||
*/
|
||||
export default {
|
||||
setCurrentRecord(state, payload) {
|
||||
state.currentRecord = payload
|
||||
},
|
||||
|
||||
addInCreate(state, payload) {
|
||||
state.inCreate.push(payload)
|
||||
},
|
||||
|
||||
deleteInCreate(state, payload) {
|
||||
state.inCreate = state.inCreate.filter(item => item.containerUuid !== payload.containerUuid)
|
||||
},
|
||||
|
||||
addReferencesList(state, payload) {
|
||||
state.references.push(payload)
|
||||
},
|
||||
|
||||
setDataLog(state, payload) {
|
||||
state.dataLog = payload
|
||||
},
|
||||
|
||||
setWindowOldRoute(state, payload) {
|
||||
state.windowOldRoute = payload
|
||||
},
|
||||
|
||||
setTabSequenceRecord(state, payload) {
|
||||
state.tabSequenceRecord = payload
|
||||
},
|
||||
|
||||
setTotalResponse(state, payload) {
|
||||
state.totalResponse = payload
|
||||
},
|
||||
|
||||
setTotalRequest(state, payload) {
|
||||
state.totalRequest = payload
|
||||
},
|
||||
|
||||
resetStateWindowControl(state) {
|
||||
state = initStateWindowControl
|
||||
}
|
||||
}
|
20
src/store/modules/ADempiere/windowControl/state.js
Normal file
20
src/store/modules/ADempiere/windowControl/state.js
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
/**
|
||||
* Window Control Vuex Module
|
||||
* State (or initial state) from Window Control
|
||||
* @author Edwin Betancourt <EdwinBetanc0urt@outlook.com>
|
||||
*/
|
||||
export default {
|
||||
inCreate: [],
|
||||
references: [],
|
||||
currentRecord: {},
|
||||
windowOldRoute: {
|
||||
path: '',
|
||||
fullPath: '',
|
||||
query: {}
|
||||
},
|
||||
dataLog: {}, // { containerUuid, recordId, tableName, eventType }
|
||||
tabSequenceRecord: [],
|
||||
totalResponse: 0,
|
||||
totalRequest: 0
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user