Blame view

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