jit.vue
4.44 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
128
129
130
131
132
133
134
135
136
137
138
<template>
<LayoutBody>
<LayoutFilter>
<FilterItem :label="filters.sknCode.label">
<Input v-model.trim="filters.sknCode.model"
:placeholder="filters.sknCode.holder"></Input>
</FilterItem>
<FilterItem label="选择类目">
<SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>
</FilterItem>
<FilterItem label="选择品牌">
<SelectBrand v-model="filters.brand.model"></SelectBrand>
</FilterItem>
<FilterItem>
<Button type="primary" @click="filterSearch">筛选</Button>
<Button @click="clearFilter">清空条件</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>
<EditStore ref="showStoreEdit"></EditStore>
</LayoutBody>
</template>
<script>
import _ from 'lodash';
import service from 'jit-service';
import {SelectBrand, SelectCategory} from 'components/select';
import EditStore from './views/edit-store';
import {tableCols, tableData, pageData} from './store';
export default {
data() {
return {
self: this,
tableCols,
tableData,
pageData,
categoryValue: [],
filters: {
sknCode: {
label: 'SKN编码',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
},
brand: {
label: '选择品牌',
model: -1
},
maxSortId: null,
middleSortId: null,
smallSortId: null,
}
}
},
mounted() {
this.getProduct();
},
methods: {
editStore(row) {
this.$refs.showStoreEdit.show(row);
},
filterParams() {
let productSkn = this.filters.sknCode.model;
let brandId = this.filters.brand.model === -1 ? null: this.filters.brand.model;
let maxSortId = this.filters.maxSortId;
let middleSortId = this.filters.middleSortId;
let smallSortId = this.filters.smallSortId;
let pageNo = this.pageData.current;
let pageSize = this.pageData.pageSize;
return {
productSkn,
brandId,
maxSortId,
middleSortId,
smallSortId,
pageNo,
pageSize
};
},
filterSearch() {
this.productList();
},
clearFilter() {
this.filters.sknCode.model = null;
this.filters.brand.model = null;
this.filters.maxSortId = null;
this.filters.middleSortId = null;
this.filters.smallSortId = null;
this.pageData.current = 1;
this.getProduct();
},
pageChange(page) {
this.pageData.current = page;
this.getProduct();
},
getProduct() {
let params = this.filterParams();
service.listProduct(params).then((result) => {
if (result.code === 200) {
this.tableData = result.data.records;
this.pageData.total = result.data.totalCount;
this.pageData.current = result.data.pageNo;
}
});
},
sortChange(sort) {
this.filters.maxSortId = sort.max;
this.filters.middleSortId = sort.mid;
this.filters.smallSortId = sort.min;
}
},
components: {
SelectBrand,
SelectCategory,
EditStore
}
}
</script>
<style lang="scss">
.btn-row-space {
margin-top: 10px;
}
</style>