express.vue
4.93 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
139
140
141
142
143
144
145
146
147
148
149
150
151
<template>
<div class="un-done">
<LayoutFilter>
<FilterItem :label="filters.orderNo.label">
<Input v-model.trim.number="filters.orderNo.model"
:placeholder="filters.orderNo.holder"></Input>
</FilterItem>
<FilterItem :label="filters.expressNo.label">
<Input v-model.trim="filters.expressNo.model"
:placeholder="filters.expressNo.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodCode.label">
<Input v-model.trim.number="filters.prodCode.model"
:placeholder="filters.prodCode.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodBarCode.label">
<Input v-model.trim="filters.prodBarCode.model"
:placeholder="filters.prodBarCode.holder"></Input>
</FilterItem>
<FilterItem>
<Button type="primary" @click="filterSearch">筛选</Button>
<Button @click="clearFilter">清空条件</Button>
</FilterItem>
</LayoutFilter>
<LayoutList>
<Table border :context="self" :columns="table.cols" :data="table.list"></Table>
<Page :total="page.total" :current="page.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</LayoutList>
</div>
</template>
<script>
import _ from 'lodash';
import moment from 'moment';
import service from 'trade-service';
import dataStore from '../store/express';
export default {
name: 'TabDone',
data() {
return {
self: this,
filters: {},
page: {},
table: {},
useFilter: false
};
},
created() {
const store = dataStore();
const params = {
pageNo: 1,
pageSize: 20,
statusList: [2, 3]
};
this.page = store.page;
this.table = store.table;
this.filters = store.filters;
this.getExpList(params);
},
methods: {
getExpList(params) {
service.allotExpressList(params)
.then(res => {
this.handleData(res.data);
});
},
filterSearch() {
this.useFilter = true;
this.getExpList(this.params());
this.page.current = 1;
},
clearFilter() {
this.useFilter = false;
this.getExpList(this.params());
this.page.current = 1;
this.filters = dataStore().filters;
},
pageChange(page) {
let params = this.params();
params.pageNo = page;
this.page.current = page;
this.getExpList(params);
},
params() {
const data = {
pageNo: 1,
pageSize: 20,
statusList: [2, 3]
};
const mapKeys = {
expressNumber: 'expressNo',
sknFactoryCode: 'prodCode',
skuFactoryCode: 'prodBarCode',
proRequisitionFormId: 'orderNo'
};
if (this.useFilter) {
let val;
_.each(mapKeys, (v, k) => {
val = '' + this.filters[v].model;
if (val.length) {
data[k] = this.filters[v].model;
}
});
}
if (typeof data.proRequisitionFormId !== 'undefined' &&
!_.isFinite(+data.proRequisitionFormId)) {
this.$Message.error('入库单号只能是数字', 3);
return;
}
if (typeof data.sknFactoryCode !== 'undefined' &&
!_.isFinite(+data.sknFactoryCode)) {
this.$Message.error('SKN编码只能是数字', 3);
return;
}
return data;
},
goExpDetail(expressNo) {
this.$router.push({
name: 'trade.expdetail',
query: {
expressNo
}
});
},
handleData(data) {
const fmt = 'YYYY-MM-DD HH:mm:ss';
const list = data.records;
_.each(list, i => {
i.createTime = moment.unix(i.createTime).format(fmt);
});
this.table.list = list;
this.page.total = data.totalCount;
}
}
};
</script>
<style lang="scss">
</style>