index.js
1.96 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export default {
namespaced: true,
state: {
goodsSource: [], // 财务商品来源
goodsSourceReconciliation: [] // 对账
},
mutations: {
/**
* @description 合计商品来源
* @param {Object} goodsSource 商品来源
* @param {Boolean} tabIndex tab索引
*/
setGoodsSource(state, { goodsSource, tabIndex }) {
// console.log("setGoodsSource", goodsSource, tabIndex, state)
if (goodsSource) {
state.goodsSource[tabIndex] = goodsSource
state.goodsSource = [...state.goodsSource]
}
},
/**
* @description 删除商品来源
* @param {Object} goodsSource 商品来源
* @param {Boolean} tabIndex tab索引
*/
delGoodsSource(state, { goodsSource, tabIndex }) {
state.goodsSource = state.goodsSource.splice(1, tabIndex)
},
/**
* @description 合计对账商品来源
* @param {Object} goodsSource 商品来源
* @param {Boolean} tabIndex tab索引
*/
setGoodsSourceReconciliation(state, { goodsSource, tabIndex }) {
// console.log("setGoodsSource", goodsSource, tabIndex, state)
if (goodsSource) {
state.goodsSourceReconciliation[tabIndex] = goodsSource
state.goodsSourceReconciliation = [...state.goodsSourceReconciliation]
}
},
/**
* @description 删除对账商品来源
* @param {Object} goodsSource 商品来源
* @param {Boolean} tabIndex tab索引
*/
delGoodsSourceReconciliation(state, { goodsSource, tabIndex }) {
state.goodsSourceReconciliation = state.goodsSourceReconciliation.splice(
1,
tabIndex
)
}
},
actions: {},
getters: {
// 财务商品来源去重
goodsSourceSet(state) {
return [...new Set(state.goodsSource)]
},
// 对账商品来源去重
goodsSourceReconciliationSet(state) {
return [...new Set(state.goodsSourceReconciliation)]
}
}
}