index.vue
12.1 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<template>
<div class="app-container">
<el-row :gutter="24">
<el-col :span="8" :xs="24" style="margin-bottom: 10px; ">
<el-form :model="queryHeaderParams" ref="headerForm" :inline="true">
<el-form-item label="出库单号" prop="code">
<el-input
v-model="queryHeaderParams.code"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="headerQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="small" @click="headerQuery">搜索</el-button>
<!--<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>-->
</el-form-item>
</el-form>
</el-col>
<el-col :span="12" :offset="4" :xs="24" class="info_text">
物料总数:<span>{{HeaderList.length}}</span> 总单据数量:<span>{{billTotal}}</span>已出库数量:<span>{{checkoutTotal}}</span>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12" :xs="24" style="margin: 10px 0">
<el-card shadow="always">
<!--<right-toolbar :showSearch.sync="showHeaderSearch" @queryTable="getHeaderList"></right-toolbar>-->
<el-table v-loading="headerLoading" :data="HeaderList" border @selection-change="headerSelectionChange" highlight-current-row @row-click="handle" ref="table">
<el-table-column label="id" width="55" align="center" prop="id" />
<el-table-column label="物料编码" align="center" prop="materialCode" width="120px"/>
<el-table-column label="物料名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="物料规格" align="center" prop="materialSpec" :show-overflow-tooltip="true" />
<el-table-column label="单据数量" align="center" prop="shipQty" width="78px" />
<el-table-column label="已出数量" align="center" prop="requestQty" width="78px" />
<el-table-column label="库存状态" align="center" prop="inventorySts" :formatter="kcstatusFormat" width="78px">
<template slot-scope="scope">
<el-button size="mini" type="primary" round>{{
kcstatusFormat(scope.row, scope.column)
}}</el-button>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="materialUnit" width="60px" />
</el-table>
<pagination
v-show="headerTotal > 0"
:total="headerTotal"
:page.sync="queryHeaderParams.pageNum"
:limit.sync="queryHeaderParams.pageSize"
@pagination="getHeaderList"
/>
</el-card>
</el-col>
<el-col :span="12" :xs="24" style="margin: 10px 0">
<el-card shadow="always">
<el-form :model="queryDetailParams" ref="detailForm" :rules="detailRules">
<el-form-item label="出库数量" prop="receiveNum">
<el-input
v-model="queryDetailParams.receiveNum"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="detailQuery"
/>
</el-form-item>
</el-form>
<el-table v-loading="detailLoading" :data="DetailList" border @selection-change="detailSelectionChange" ref="table">
<el-table-column fixed="left" label="操作" width="60" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleGroup(scope.row)"
v-hasPermi="['shipment:shippingCombination:combination']"
>组盘</el-button>
</template>
</el-table-column>
<el-table-column label="id" width="55" align="center" prop="id" />
<el-table-column label="货主" width="55" align="center" prop="companyCode" />
<el-table-column label="库位编号" align="center" prop="locationCode" :show-overflow-tooltip="true" />
<el-table-column label="容器编号" align="center" prop="containerCode" :show-overflow-tooltip="true" />
<el-table-column label="数量" width="55" align="center" prop="qty" />
<el-table-column label="物料编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="物料名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="物料规格" align="center" prop="materialSpec" :show-overflow-tooltip="true" />
<el-table-column label="库存状态" width="75" align="center" prop="inventorySts" :formatter="kcstatusFormat">
<template slot-scope="scope">
<el-button size="mini" type="primary" round>{{
kcstatusFormat(scope.row, scope.column)
}}</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="detailTotal > 0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import {listHeader,listDetail,getGroupdisk,delDetail,} from "@/api/shipment/shippingCombination";
export default {
name: "ShippingCombination",
data() {
return {
// 主表遮罩层
headerLoading: true,
// 主表选中数组
headerIds: [],
// 主表非单个禁用
headerSingle: true,
// 主表非多个禁用
headerMultiple: true,
// 主表显示搜索条件
showHeaderSearch: true,
// 主表总条数
headerTotal: 0,
// 主表表格数据
HeaderList: [],
// 主表弹出层标题
headerTitle: "",
// 主表是否显示弹出层
headerOpen: false,
// 主表数据字典
// 主表查询参数
queryHeaderParams: {
pageNum: 1,
pageSize: 10,
code: undefined,
},
// 主表表单参数
headerForm: {},
// 主表表单校验
headerRules: {},
// 明细遮罩层
detailLoading: true,
// 明细选中数组
detailIds: [],
// 明细非单个禁用
detailSingle: true,
// 明细非多个禁用
detailMultiple: true,
// 明细显示搜索条件
showDetailSearch: true,
// 明细总条数
detailTotal: 0,
// 明细表格数据
DetailList: [],
// 明细弹出层标题
detailTitle: "",
// 明细是否显示弹出层
detailOpen: false,
// 明细库存数据字典
kcstatusOptions: [],
// 明细查询参数
queryDetailParams: {
pageNum: 1,
pageSize: 10,
receiveNum:undefined,
id:'',
code:'',
},
groupDiskParams:{
shipmentDetailId:'',
inventoryDetailId:'',
shipQty:'',
},
// 明细表单参数
detailForm: {},
// 明细表单校验
detailRules: {
receiveNum: [
{
pattern: /^[0-9]+$/,
message: "请输入正确的数字",
trigger: ["blur", "change"],
},
],
},
};
},
//计算右上角总单据数量、已出库数量
computed:{
billTotal:function () {
let result = 0
for(let i=0;i<this.HeaderList.length;i++){
result +=this.HeaderList[i].shipQty
}
return result
},
checkoutTotal:function () {
let result = 0
for(let i=0;i<this.HeaderList.length;i++){
result +=this.HeaderList[i].requestQty
}
return result
}
},
created() {
this.queryHeaderParams.code = this.$route.query.shipmentCode;
this.getHeaderList();
// 库存状态字典下拉
this.getDicts("inventorySts").then(response => {
this.kcstatusOptions = response.data;
});
},
// 对路由参数的变化作出监测(解决同步刷新问题)
watch: {
$route(to, from) {
//当参数改变时就会触发比方法,以此达到数据属性
this.queryHeaderParams.code = this.$route.query.shipmentCode;
this.getHeaderList();
}
},
beforeUpdate() {
this.$nextTick(() => {
this.$refs["table"].doLayout();
});
},
methods: {
/** 查询主表列表 */
getHeaderList() {
this.headerLoading = true;
listHeader(this.queryHeaderParams).then((response) => {
this.HeaderList = response.data
this.headerTotal = response.total;
this.headerLoading = false;
});
},
//左表单击选中时触发的事件
handle(row,event,column) {
this.detailLoading = true;
this.queryDetailParams.id = row.id;
this.groupDiskParams.shipmentDetailId = row.id;
this.queryDetailParams.receiveNum = row.shipQty;
this.queryDetailParams.code = this.$route.query.shipmentCode;
this.getDetailList();
},
/** 查询明细列表 */
getDetailList() {
this.detailLoading = true;
listDetail(this.queryDetailParams).then((response) => {
this.DetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
// 明细库存状态字典翻译
kcstatusFormat(row, column) {
return this.selectDictLabel(this.kcstatusOptions, row.inventorySts);
},
/** 主表搜索按钮操作 */
headerQuery() {
this.queryHeaderParams.pageNum = 1;
this.getHeaderList();
},
// 主表多选框选中数据
headerSelectionChange(selection) {
this.headerIds = selection.map((item) => item.id);
this.headerSingle = selection.length != 1;
this.headerMultiple = !selection.length;
},
// 明细多选框选中数据
detailSelectionChange(selection) {
this.detailIds = selection.map((item) => item.id);
this.detailSingle = selection.length != 1;
this.detailMultiple = !selection.length;
},
//右表组盘
handleGroup(row) {
this.groupDiskParams.inventoryDetailId = row.id;
this.groupDiskParams.shipQty = this.queryDetailParams.receiveNum;
getGroupdisk(this.groupDiskParams).then(response => {
this.groupDiskParams.shipQty = '';
if(response.code == 200) {
this.msgSuccess(response.msg);
//数量更改后重新加载左右表
this.getHeaderList();
this.getDetailList();
}
else {
this.msgError(response.msg)
}
})
},
/** 明细删除按钮操作 */
detailDelete(row) {
const detailIds = row.id || this.detailIds;
this.$confirm(
row.id?'是否确认取消该条组盘信息吗?':'是否确认取消选中的' + this.detailIds.length + '条数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delDetail(detailIds);
})
.then(() => {
this.getDetailList();
this.msgSuccess("删除成功");
})
.catch(function () {});
},
},
};
</script>
<style lang="scss" scoped>
.info_text{margin-top: 10px;text-align: right}
.info_text span {
font-size: 20px;
font-weight: bold;
margin-right: 20px;
color: rgb(28,132,198);
}
.el-button--mini.is-round {
padding: 5px 10px;
}
</style>