|
@@ -6,7 +6,7 @@ |
|
@@ -6,7 +6,7 @@ |
6
|
:placeholder="filters.subject.holder"></Input>
|
6
|
:placeholder="filters.subject.holder"></Input>
|
7
|
</filter-item>
|
7
|
</filter-item>
|
8
|
<filter-item :label="filters.emergency.label">
|
8
|
<filter-item :label="filters.emergency.label">
|
9
|
- <Select v-model.trim="filters.emergency.model">
|
9
|
+ <Select v-model.trim="filters.emergency.model" clearable>
|
10
|
<Option v-for="option in filters.emergency.options"
|
10
|
<Option v-for="option in filters.emergency.options"
|
11
|
:value="option.value"
|
11
|
:value="option.value"
|
12
|
:key="option.value">{{option.label}}</Option>
|
12
|
:key="option.value">{{option.label}}</Option>
|
|
@@ -16,15 +16,15 @@ |
|
@@ -16,15 +16,15 @@ |
16
|
<select-brand v-model="filters.brand.model"></select-brand>
|
16
|
<select-brand v-model="filters.brand.model"></select-brand>
|
17
|
</filter-item>
|
17
|
</filter-item>
|
18
|
<filter-item :label="filters.status.label">
|
18
|
<filter-item :label="filters.status.label">
|
19
|
- <Select v-model.trim="filters.status.model">
|
19
|
+ <Select v-model.trim="filters.status.model" clearable>
|
20
|
<Option v-for="option in filters.status.options"
|
20
|
<Option v-for="option in filters.status.options"
|
21
|
:value="option.value"
|
21
|
:value="option.value"
|
22
|
:key="option.value">{{option.label}}</Option>
|
22
|
:key="option.value">{{option.label}}</Option>
|
23
|
</Select>
|
23
|
</Select>
|
24
|
</filter-item>
|
24
|
</filter-item>
|
25
|
<filter-item>
|
25
|
<filter-item>
|
26
|
- <Button type="primary" @click="filterSearch">筛选</Button>
|
|
|
27
|
- <Button @click="clearFilter">清空条件</Button>
|
26
|
+ <Button type="primary" @click="doSearch">筛选</Button>
|
|
|
27
|
+ <Button @click="reset">清空条件</Button>
|
28
|
</filter-item>
|
28
|
</filter-item>
|
29
|
</layout-filter>
|
29
|
</layout-filter>
|
30
|
|
30
|
|
|
@@ -37,9 +37,9 @@ |
|
@@ -37,9 +37,9 @@ |
37
|
</template>
|
37
|
</template>
|
38
|
|
38
|
|
39
|
<script>
|
39
|
<script>
|
|
|
40
|
+import _ from 'lodash';
|
40
|
import {list as diffList} from './store';
|
41
|
import {list as diffList} from './store';
|
41
|
import {DiffService} from 'services/repository';
|
42
|
import {DiffService} from 'services/repository';
|
42
|
-import {SelectBrand} from 'components/select';
|
|
|
43
|
|
43
|
|
44
|
export default {
|
44
|
export default {
|
45
|
data() {
|
45
|
data() {
|
|
@@ -47,32 +47,78 @@ export default { |
|
@@ -47,32 +47,78 @@ export default { |
47
|
},
|
47
|
},
|
48
|
created() {
|
48
|
created() {
|
49
|
this.DiffService = new DiffService();
|
49
|
this.DiffService = new DiffService();
|
50
|
-
|
|
|
51
|
- this.DiffService.list()
|
|
|
52
|
- .then(res => {
|
|
|
53
|
- this.$Loading.finish();
|
|
|
54
|
- this.dataList = res.data.records;
|
|
|
55
|
- });
|
50
|
+ this.search(this.params());
|
56
|
},
|
51
|
},
|
57
|
methods: {
|
52
|
methods: {
|
58
|
- clearFilter() {
|
53
|
+ search(params) {
|
|
|
54
|
+ this.$Loading.start();
|
|
|
55
|
+ this.DiffService.list(params)
|
|
|
56
|
+ .then(res => {
|
|
|
57
|
+ this.$Loading.finish();
|
|
|
58
|
+ this.dataList = res.data.records;
|
|
|
59
|
+ this.page.total = res.data.totalCount;
|
|
|
60
|
+ }, () => {
|
|
|
61
|
+ this.$Loading.finish();
|
|
|
62
|
+ });
|
|
|
63
|
+
|
59
|
},
|
64
|
},
|
60
|
- filterSearch() {
|
65
|
+ params() {
|
|
|
66
|
+ const defVal = {
|
|
|
67
|
+ pageNo: 1,
|
|
|
68
|
+ pageSize: 20,
|
|
|
69
|
+ statuses: [3, 21, 22]
|
|
|
70
|
+ };
|
|
|
71
|
+ const keyMap = {
|
|
|
72
|
+ brandId: 'brand',
|
|
|
73
|
+ statuses: 'status',
|
|
|
74
|
+ subject: 'subject',
|
|
|
75
|
+ emergencyDegree: 'emergency'
|
|
|
76
|
+ };
|
|
|
77
|
+
|
|
|
78
|
+ if (this.enableFilter) {
|
|
|
79
|
+ let model;
|
|
|
80
|
+
|
|
|
81
|
+ _.each(keyMap, (val, key) => {
|
|
|
82
|
+ model = this.filters[val].model;
|
|
|
83
|
+
|
|
|
84
|
+ if (('' + model).length) {
|
|
|
85
|
+ if (key === 'statuses') {
|
|
|
86
|
+ defVal[key] = [model];
|
|
|
87
|
+ } else {
|
|
|
88
|
+ defVal[key] = model;
|
|
|
89
|
+ }
|
|
|
90
|
+ }
|
|
|
91
|
+ });
|
|
|
92
|
+ }
|
61
|
|
93
|
|
|
|
94
|
+ return defVal;
|
62
|
},
|
95
|
},
|
63
|
- pageChange() {
|
96
|
+ reset() {
|
|
|
97
|
+ _.each(this.filters, item => {
|
|
|
98
|
+ item.model = '';
|
|
|
99
|
+ });
|
|
|
100
|
+ this.page.current = 1;
|
|
|
101
|
+ this.enableFilter = false;
|
|
|
102
|
+ this.search(this.params());
|
|
|
103
|
+ },
|
|
|
104
|
+ doSearch() {
|
|
|
105
|
+ this.enableFilter = true;
|
|
|
106
|
+ this.search(this.params());
|
64
|
},
|
107
|
},
|
65
|
- goDetail(id) {
|
108
|
+ pageChange(no) {
|
|
|
109
|
+ let params;
|
|
|
110
|
+
|
|
|
111
|
+ params = this.params();
|
|
|
112
|
+ params.pageNo = no;
|
|
|
113
|
+ this.search(params);
|
|
|
114
|
+ this.page.current = no;
|
|
|
115
|
+ },
|
|
|
116
|
+ toDetail(id) {
|
66
|
this.$router.push({
|
117
|
this.$router.push({
|
67
|
- query: {
|
|
|
68
|
- id
|
|
|
69
|
- },
|
118
|
+ query: { id },
|
70
|
name: 'repository.diff.detail',
|
119
|
name: 'repository.diff.detail',
|
71
|
});
|
120
|
});
|
72
|
}
|
121
|
}
|
73
|
- },
|
|
|
74
|
- components: {
|
|
|
75
|
- SelectBrand
|
|
|
76
|
}
|
122
|
}
|
77
|
};
|
123
|
};
|
78
|
</script>
|
124
|
</script>
|