store.vue
3.59 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
<LayoutBody>
<LayoutFilter>
<FilterItem label="供应商">
<SelectSupplier>
</SelectSupplier>
</FilterItem>
<FilterItem label="品牌">
<SelectBrand>
</SelectBrand>
</FilterItem>
<FilterItem label="日期">
<Date-picker type="date" placeholder="选择日期" style="width: 170px"></Date-picker>
</FilterItem>
<FilterItem label="">
<Date-picker type="date" placement="bottom-end" placeholder="选择日期" style="width: 170px"></Date-picker>
</FilterItem>
<FilterItem>
<Button type="primary" @click="">筛选</Button>
<Button @click="">打印</Button>
</FilterItem>
</LayoutFilter>
<LayoutList>
<Table border :context="self" :columns="tableCols" :data="tableData"></Table>
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</LayoutList>
</LayoutBody>
</template>
<script>
import Vue from 'vue';
import service from 'finance-service';
import {SelectSupplier, SelectBrand} from 'finance/filter-select';
import {filterFields, initialFields, tableCols, tableData, pageData} from './detail';
export default {
data() {
return {
self: this,
tableCols,
tableData,
pageData,
filters: '',
};
},
created() {
this.filters = JSON.parse(initialFields);
},
methods: {
filterParams() {
const fts = this.filters;
const data = {
productSkn: fts.sknCode.model
};
return data;
},
filterSearch() {
const params = this.filterParams();
this.useFilterSign = true;
this.productList(params);
this.pageData.current = 1;
},
clearFilter() {
this.filters = JSON.parse(initialFields);
this.productList();
this.useFilterSign = false;
this.pageData.current = 1;
},
productList(params) {
if (_.isObject(params) &&
params.productSkn !== undefined &&
!_.isFinite(+params.productSkn)) {
this.$Message.error('SKN编码只能是数字', 3);
return;
}
service.productList(
_.merge(params || {}, {
shelfStatus: 1,
size: 20
}))
.then(res => {
if (res.code === 200) {
this.updateStore(res.data);
}
});
},
pageChange(page) {
this.pageData.current = page;
let params = {};
if (this.useFilterSign) {
params = this.filterParams();
}
_.merge(params, {
page,
size: 20,
productStatusStr: 1
});
this.productList(params);
},
},
components: {
SelectBrand,
SelectSupplier
}
};
</script>
<style lang="scss" scoped>
</style>