enhance.js
820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import Vue from 'vue'
const enhance = {
state: {
enhanceJs:{
}
},
mutations: {
ADD_TABLE_ENHANCE: (state, record) => {
if(!state.enhanceJs){
let obj = {}
let arr = []
arr.push({...record})
obj[record.code] = arr
state.enhanceJs = obj
}else{
if(!state.enhanceJs[record.code]){
let arr = []
arr.push({...record})
state.enhanceJs[record.code] = arr
}
state.enhanceJs[record.code].push({...record})
}
let arr = state.enhanceJs[record.code]
while(arr.length>16){
arr.shift()
}
Vue.ls.set('enhance_'+record['code'], arr)
}
},
actions: {
addEhanceRecord({ commit }, record) {
commit('ADD_TABLE_ENHANCE', record)
}
}
}
export default enhance