SmartCabinetSummaryList.vue
11.9 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
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="货位代码">
<a-input placeholder="请输入货位代码" v-model="queryParam.goodAllocationCode" ></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="货位名称">
<a-input placeholder="请输入货位名称" v-model="queryParam.goodAllocationName" ></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="货位规格">
<a-input placeholder="请输入货位规格" v-model="queryParam.goodAllocationSpecs" ></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button id="search" type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<a-button v-has="'SmartCabinetSummary:export'" type="primary" icon="download" @click="handleExportXls('智能柜库存详情')">导出</a-button>
<!-- table区域-begin -->
<div>
<a-table
ref="table"
size="middle"
:scroll="{ x: true }"
bordered
rowKey="id"
class="j-table-force-nowrap"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="handleTableChange"
>
<span slot="action" slot-scope="text, record">
<a v-has="'material:edit'" @click="updateWaterLevel(record)">修改最低库存</a>
</span>
<span slot="qtySum" slot-scope="text, record">
<a-tag :key="record.id" :color="qtySumColor(record)" style="font-size: 14px;font-weight: normal">
{{ qtySumStatus(record) }}
</a-tag>
</span>
</a-table>
<!-- 页面使用分页组件 -->
<Pagination v-model="ipagination.current" :total="ipagination.total" show-size-changer :page-size="ipagination.pageSize" @onShowSizeChange="onShowSizeChange" :pageSizeOptions="ipagination.pageSizeOptions"/>
</div>
<ExpressStorageModal ref="ExpressStorageModal" @ok="modalFormOk"></ExpressStorageModal>
<ExpressDeliveryModal ref="ExpressDeliveryModal" @ok="modalFormOk"></ExpressDeliveryModal>
<smart-cabinet-water-level ref="SmartCabinetWaterLevelModal" @ok="modalFormOk"></smart-cabinet-water-level>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {getAction, postAction} from '@/api/manage'
import Pagination from '@/components/jeecgbiz/Pagination'
import ExpressStorageModal from "@views/system/monitor/modules/ExpressStorageModal.vue";
import ExpressDeliveryModal from "@views/system/monitor/modules/ExpressDeliveryModal";
import Vue from "vue";
import {ACCESS_TOKEN} from "@/store/mutation-types";
import store from "@/store";
import EmptyInTaskModal from "@views/system/task/modules/EmptyInTaskModal.vue";
import SmartCabinetWaterLevel from "@views/system/inventory/modules/SmartCabinetWaterLevel.vue";
export default {
name: 'SmartCabinetSummaryList',
mixins: [JeecgListMixin, mixinDevice],
components: {
SmartCabinetWaterLevel,
EmptyInTaskModal,
ExpressStorageModal,
ExpressDeliveryModal,
Pagination
},
data() {
return {
newArr: [],
newDataSource: [],
initDateSource: [],
initPageSize: 10,
zoneList: [],
zoneOptions: [],
companyList: [],
firstLoad: 0,
description: '智能柜详情管理页面',
// 表头
columns: [
{
title: '货位名称',
align: 'center',
dataIndex: 'goodAllocationName'
},
{
title: '货位规格',
align: 'center',
dataIndex: 'goodAllocationSpecs'
},
{
title: '货位代码',
align: 'center',
dataIndex: 'goodAllocationCode'
},
{
title: '重量',
align: 'center',
dataIndex: 'weight'
},
{
title: '库存标记',
align: "center",
dataIndex: 'qtySum',
scopedSlots: {customRender: 'qtySum'}
},
{
title: '最低库存',
align: 'center',
dataIndex: 'waterLevel'
},
{
title: '操作',
dataIndex: 'action',
align: "center",
fixed: "right",
width: 147,
scopedSlots: {customRender: 'action'},
}
],
url: {
list: '/inventory/inventoryHeader/smartCabinetSummaryList',
importExcelUrl: '/inventory/SmartCabinet/importExcel',
importPinkuUrl: '/inventory/SmartCabinet/importPinku',
exportXlsUrl: '/inventory/inventoryHeader/export',
},
dictOptions: {},
superFieldList: [],
selectRecord: [],
}
},
created() {
this.initPageSize = this.ipagination.pageSize
this.loadData()
this.loadFrom()
this.getSuperFieldList()
},
mounted() {
if (this.firstLoad == 0) {
this.firstLoad = 1;
return;
}
//页面没加载完,此时methods里的方法找不到,使用定时器模拟点击
// let timeSearch = setInterval(() => {
// let eleSearch = document.getElementById("search");
// if (eleSearch != null) {
// //调用成功,清除定时器
// clearInterval(timeSearch)
// eleSearch.click();
// }
// }, 200)
},
computed: {
},
methods: {
updateWaterLevel(record) {
this.$refs.SmartCabinetWaterLevelModal.edit(record);
this.$refs.SmartCabinetWaterLevelModal.title = "修改水位";
},
qtySumStatus(record) {
if(record.weight <= record.waterLevel){
return " 🠋"
} else {
return " 🠉"
}
},
qtySumColor(record) {
if(record.weight <= record.waterLevel){
return 'red';
} else {
return 'blue'
}
},
loadData(arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
//设置请求的条数为初始值
this.ipagination.pageSize = this.initPageSize
var params = this.getQueryParams() //查询条件
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.initDateSource = res.result.records || res.result
this.newDataSource = res.result.records || res.result
this.dataHandling()
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
}
}
if (res.code === 510) {
this.$message.warning(res.message)
}
this.loading = false
})
},
/*如果分页走这个方法*/
dataHandling() {
//动态新增每页条数
this.ipagination.pageSize = this.initPageSize + 1
this.newArr = []
// var arrs = this.newDataSource
// if (arrs.length > 0) {
// let item = {}
// item.id = '合计'
// var qty = 0
// for (let i = 0; i < arrs.length; i++) {
// qty += arrs[i].qty
// }
// item.qty = qty
// this.newDataSource.push(item)
// }
this.dataSource = Object.values(this.newDataSource)
},
// 分页改变时调用组件里的方法
onShowSizeChange(current, pageSize) {
this.ipagination.current = current
this.ipagination.pageSize = pageSize
//调整每页请求数值
this.initPageSize = this.ipagination.pageSize
this.loadData()
},
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
//这种筛选方式只支持单选
if (filters && Object.keys(filters).length > 0 && filters.containerStatus_dictText) {
this.filters.containerStatus = filters.containerStatus_dictText[0];
}
if (filters && Object.keys(filters).length > 0 && filters.enable_dictText) {
this.filters.enable = filters.enable_dictText[0];
}
if (filters && Object.keys(filters).length > 0 && filters.inventoryStatus_dictText) {
this.filters.inventoryStatus = filters.inventoryStatus_dictText.toString();
}
if (filters && Object.keys(filters).length > 0 && filters.zoneCode) {
this.filters.zoneCode = filters.zoneCode.toString();
}
this.ipagination = pagination;
this.loadData();
},
loadFrom() {
},
onSelectChange(selectedRowKeys, selectionRows) {
if (selectedRowKeys != null && selectedRowKeys.length > 0) {
this.selectedMainId = selectedRowKeys[0].toString();
}
selectedRowKeys = selectedRowKeys.filter((item) => item !== '合计');
this.selectedRowKeys = selectedRowKeys;
this.selectRecord = selectionRows;
},
expressStorage() {
let json = {
"containerCode": null,
"locationCode": null
}
this.$refs.ExpressStorageModal.edit(json);
},
initDictConfig() {
},
getSuperFieldList() {
let fieldList = []
fieldList.push({type: 'string', value: 'companyCode', text: '货主', dictCode: ''})
fieldList.push({type: 'string', value: 'zoneCode', text: '库区', dictCode: ''})
fieldList.push({type: 'string', value: 'containerCode', text: '容器编码', dictCode: ''})
fieldList.push({type: 'string', value: 'locationCode', text: '库位编码', dictCode: ''})
fieldList.push({type: 'string', value: 'materialCode', text: '图号', dictCode: ''})
fieldList.push({type: 'string', value: 'materialName', text: '物料名称', dictCode: ''})
fieldList.push({type: 'string', value: 'materialSpec', text: '物料规格', dictCode: ''})
fieldList.push({type: 'string', value: 'materialUnit', text: '物料单位', dictCode: ''})
fieldList.push({type: 'BigDecimal', value: 'qty', text: '数量', dictCode: ''})
fieldList.push({type: 'BigDecimal', value: 'taskQty', text: '任务锁定数量', dictCode: ''})
fieldList.push({type: 'string', value: 'inventoryStatus', text: '库存状态', dictCode: 'inventory_status'})
fieldList.push({type: 'int', value: 'enable', text: '可用状态', dictCode: 'inventory_enable'})
fieldList.push({type: 'string', value: 'batch', text: '批次', dictCode: ''})
// fieldList.push({type:'string',value:'sn',text:'序列号',dictCode:''})
fieldList.push({type: 'datetime', value: 'receiptDate', text: '入库日期'})
fieldList.push({type: 'int', value: 'inventoryAge', text: '库龄(天)', dictCode: ''})
fieldList.push({type: 'string', value: 'createBy', text: '创建人', dictCode: ''})
fieldList.push({type: 'datetime', value: 'createTime', text: '创建日期'})
fieldList.push({type: 'string', value: 'updateBy', text: '更新人', dictCode: ''})
fieldList.push({type: 'datetime', value: 'updateTime', text: '更新日期'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>