stockDeviceList.vue
5.5 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<template>
<v-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>库存管理</el-breadcrumb-item>
<el-breadcrumb-item>设备明细</el-breadcrumb-item>
</template>
<template slot="main">
<div class="ibox">
<!-- 表单查询 -->
<el-form
:inline="true"
ref="form"
:model="searchForm"
>
<el-form-item
v-for="(item, index) in formData"
:key="index"
:label="item.label"
>
<el-input
v-if="item.type === 'input'"
v-model="searchForm[item.name]"
size="small"
:placeholder="'请输入' + item.label"
clearable
></el-input>
<el-select
v-if="item.type === 'select'"
v-model="searchForm[item.name]"
size="small"
:placeholder="'请选择' + item.label"
clearable
>
<el-option
v-for="(subItem, subIndex) in item.options"
:key="subIndex"
:value="subItem.confId"
:label="subItem.confLabel"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="handleSearch"
size="small"
>查询</el-button>
<el-button
@click="handleReset"
size="small"
>重置</el-button>
</el-form-item>
</el-form>
<!-- 表单查询 /-->
</div>
<div class="ibox">
<div class="ibox-title">
<h3 class="pull-left">库存列表</h3>
</div>
<div class="ibox-content">
<el-table
:data="tableData"
border
size="small"
v-loading="loading"
style="width: 100%"
>
<el-table-column
prop="snTypeName"
label="设备类型"
align="center"
></el-table-column>
<el-table-column
prop="snNum"
label="设备号"
align="center"
></el-table-column>
<el-table-column
prop="receiverUser"
label="收货人姓名"
min-width="100"
align="center"
></el-table-column>
<el-table-column
prop="sendProvince"
label="发往省份"
min-width="160"
align="center"
></el-table-column>
<el-table-column
prop="sendCity"
label="市"
min-width="180"
align="center"
></el-table-column>
<el-table-column
prop="stockType"
label="库存类型"
min-width="160"
align="center"
>
<template slot-scope="scope">
<span>{{scope.row.stockType ? stockTypeList.find(item => +item.confId === scope.row.stockType).confLabel : ''}}</span>
</template>
</el-table-column>
</el-table>
<div class="table-page-wrap">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
</div>
</div>
</template>
</v-layout>
</template>
<script>
import { services } from '../../api'
import _ from 'lodash'
const STOCK_SERVICE = services.stock
export default {
data() {
return {
searchForm: {},
tableData: [],
loading: false,
currentPage: 1,
pageSize: 10,
total: 0,
formData: [{
label: '设备类型',
name: 'snTypeName',
type: 'input'
}, {
label: '收货人姓名',
name: 'receiverUser',
type: 'input'
}, {
label: '设备号',
name: 'snNum',
type: 'input'
}, {
label: '发往省份',
name: 'sendProvince',
type: 'input'
}, {
label: '市',
name: 'sendCity',
type: 'input'
}, {
label: '库存类型',
name: 'stockType',
type: 'select',
options: []
}],
stockTypeList: [{
confId: '1',
confLabel: '库存设备'
}, {
confId: '2',
confLabel: '在途设备'
}]
}
},
mounted() {
this.formData.find(item => item.name === 'stockType').options = _.cloneDeep(this.stockTypeList)
this.getList()
},
methods: {
getList() {
this.loading = true
var params = {
currentPage: this.currentPage,
pageSize: this.pageSize,
...this.searchForm
}
STOCK_SERVICE.getDeviceDetailList(params).then(res => {
this.tableData = res.data
this.total = res.recordsTotal
this.loading = false
})
},
handleSearch() {
this.currentPage = 1
this.getList()
},
handleReset() {
this.searchForm = {}
},
handleSizeChange(val) {
this.pageSize = val;
this.getList()
},
handleCurrentChange(val) {
this.currentPage = val;
this.getList()
}
}
}
</script>
<style>
</style>