|
1
2
3
4
5
6
|
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
|
|
7
|
<a-col :md="6" :sm="8">
|
|
8
9
10
11
12
13
|
<a-form-item label="项目名称">
<a-select
show-search
placeholder="请输入项目名称"
option-filter-prop="children"
:filter-option="filterOption"
|
|
14
|
v-model="queryParam.projectName"
|
|
15
16
17
18
19
|
>
<a-select-option v-for="item in projectNameList" :key="item" :value="item">{{ item }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
|
|
20
|
<a-col :md="6" :sm="8">
|
|
21
22
23
24
25
26
|
<a-form-item label="项目编码">
<a-select
show-search
placeholder="请输入项目编码"
option-filter-prop="children"
:filter-option="filterOption"
|
|
27
|
v-model="queryParam.projectNo"
|
|
28
29
30
31
32
|
>
<a-select-option v-for="item in projectNoList" :key="item" :value="item">{{ item }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
|
|
33
|
<a-col :md="6" :sm="8">
|
|
34
35
36
37
38
39
|
<a-form-item label="工作令号">
<a-select
show-search
placeholder="请输入工作令号"
option-filter-prop="children"
:filter-option="filterOption"
|
|
40
|
v-model="queryParam.workNo"
|
|
41
42
43
44
45
|
>
<a-select-option v-for="item in workNoList" :key="item" :value="item">{{ item }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
|
|
46
|
<a-col :md="6" :sm="8">
|
|
47
|
<a-form-item label="bomId">
|
|
48
49
50
51
52
53
54
|
<a-select
show-search
placeholder="请选择BOM"
option-filter-prop="children"
:filter-option="filterOption"
@change="handleBomChange"
v-model="queryParam.bomId"
|
|
55
|
default-value="defaultValue"
|
|
56
57
58
|
>
<a-select-option v-for="item in bomIdList" :key="item" :value="item">{{ item }}</a-select-option>
</a-select>
|
|
59
60
|
</a-form-item>
</a-col>
|
|
61
|
<a-col :md="6" :sm="8">
|
|
62
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
63
|
<a-button type="primary" @click="query" icon="search">查询</a-button>
|
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i>已选择 <a style="font-weight: 600">{{
selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
:columns="columns"
:scroll="{x: 1500}"
size="middle"
|
|
84
85
|
:dataSource="treeDataSource"
:loading="planLoading"
|
|
86
87
88
89
|
:expandedRowKeys="expandedRowKeys"
@expandedRowsChange="handleExpandedRowsChange">
<span slot="action" slot-scope="text, record">
|
|
90
|
<a @click="handleEdit(record)">编辑</a>
|
|
91
92
93
|
</span>
<!-- 字符串超长截取省略号显示 -->
<span slot="url" slot-scope="text">
|
|
94
|
<j-ellipsis :value="text" :length="25" />
|
|
95
96
97
|
</span>
<!-- 字符串超长截取省略号显示-->
<span slot="component" slot-scope="text">
|
|
98
|
<j-ellipsis :value="text" />
|
|
99
100
101
|
</span>
</a-table>
|
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<div class="table-page-search-wrapper" style="margin-top: 20px">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-input v-model="queryParam.bomId" v-show="false"></a-input>
<a-col :md="6" :sm="8">
<a-form-item label="工作令号">
<a-input placeholder="请输入工作令号" v-model="queryParam.workNo"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="物料编码">
<a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="物料名称">
<a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input>
</a-form-item>
</a-col>
|
|
121
122
123
124
125
126
127
128
129
130
|
<a-col :md="6" :sm="8">
<a-form-item label="状态">
<a-select
v-model="queryParam.status" placeholder="请选择状态" >
<a-select-option v-for="item in statusList" :key="item.value" :value="item.value">{{ item.text }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
|
|
131
132
|
<a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
133
|
<a-button type="primary" @click="queryPurchaseIn" icon="search">查询</a-button>
|
|
134
135
136
137
138
139
140
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
|
|
141
|
<span style="float: left;" class="table-page-search-submitButtons">
|
|
142
|
<a-button type="primary" @click="print()" icon="printer">打印</a-button>
|
|
143
|
</span>
|
|
144
145
146
147
148
149
150
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
:action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
</span>
<span>
|
|
151
152
|
<a-button type="primary" @click="batchEditOpen()" icon="edit" style="margin-left: 8px">批量编辑</a-button>
</span>
|
|
153
|
</div>
|
|
154
155
156
157
158
159
|
<a-table
ref="table"
bordered
size="middle"
rowKey="id"
:columns="planColumns"
|
|
160
|
:dataSource="dataSource"
|
|
161
162
163
164
165
|
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
|
|
166
|
<span slot="status" slot-scope="status">
|
|
167
|
<a-tag :key="status" :color="solutionPurchaseColor(status)">
|
|
168
169
170
171
|
{{ solutionPurchaseStatus(status) }}
</a-tag>
</span>
|
|
172
173
174
175
176
177
178
179
180
181
|
<span slot="flag" slot-scope="flag">
<a-tag :key="flag" :color="longTermColor(flag)">
{{ longTerm(flag) }}
</a-tag>
</span>
<span slot="tradeTime" slot-scope="time">
{{ timeFormat(time) }}
</span>
|
|
182
|
<span slot="action" slot-scope="text, record">
|
|
183
|
<a @click="handleEdit(record)">变更计划时间</a>
|
|
184
|
<a-divider type="vertical" />
|
|
185
|
<!-- <a @click="merge(record)">合并</a>-->
|
|
186
|
</span>
|
|
187
188
189
190
|
</a-table>
</div>
<!-- table区域-end -->
|
|
191
|
<purchase-in-modal ref="modalForm" @ok="modalFormOk"></purchase-in-modal>
|
|
192
|
<purchase-in-batch-modal ref="batchModalForm"></purchase-in-batch-modal>
|
|
193
|
<merge-modal ref="mergeModal"></merge-modal>
|
|
194
|
<purchase-in-print-modal ref="purchaseInPrintModal"></purchase-in-print-modal>
|
|
195
196
|
</a-card>
|
|
197
|
|
|
198
199
200
|
</template>
<script>
|
|
201
|
import { JeecgListMixin } from '../../mixins/JeecgListMixin'
|
|
202
203
204
205
206
207
208
|
import {
getProjectName,
getWorkNo,
getProjectNo,
getBomTree,
getPurchase,
getBomIdList,
|
|
209
|
getBomId,
|
|
210
|
ajaxGetDictItems
|
|
211
212
|
} from '../../api/api'
import PurchaseInModal from './modules/PurchaseInModal'
|
|
213
|
import PurchaseInBatchModal from './modules/PurchaseInBatchModal'
|
|
214
|
import PurchaseInPrintModal from './modules/PurchaseInPrintModal'
|
|
215
216
|
import moment from 'moment'
import MergeModal from './modules/mergeModal'
|
|
217
|
|
|
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
const columns = [
{
title: '图号',
dataIndex: 'drawingNo',
key: 'drawingNo'
},
{
// title: 'BOM',
// dataIndex: 'bomId',
// key: 'bomId'
// }, {
title: '物料编码',
dataIndex: 'code',
key: 'code'
}, {
title: '物料名称',
dataIndex: 'name',
key: 'name'
|
|
236
|
}, {
|
|
237
238
239
240
241
242
243
|
title: '物料单位',
dataIndex: 'unit',
key: 'unit'
}, {
title: '用量',
dataIndex: 'number',
key: 'number'
|
|
244
|
}, {
|
|
245
246
247
|
title: '状态',
dataIndex: 'status',
key: 'status'
|
|
248
|
}, {
|
|
249
250
251
|
title: '制造方式',
dataIndex: 'method',
key: 'method'
|
|
252
|
}, {
|
|
253
254
255
|
title: '设计类型',
dataIndex: 'designType',
key: 'designType'
|
|
256
|
}, {
|
|
257
258
259
|
title: 'WIP属性',
dataIndex: 'wipType',
key: 'wipType'
|
|
260
|
}, {
|
|
261
262
263
264
265
266
267
268
269
270
|
title: '品牌',
dataIndex: 'brand',
key: 'brand'
}, {
title: '分类',
dataIndex: 'categories',
key: 'categories'
}
]
export default {
|
|
271
|
name: 'PurchaseIn',
|
|
272
273
|
mixins: [JeecgListMixin],
components: {
|
|
274
|
PurchaseInPrintModal,
|
|
275
|
MergeModal,
|
|
276
277
|
PurchaseInModal,
PurchaseInBatchModal
|
|
278
279
280
|
},
data() {
return {
|
|
281
|
disableMixinCreated: true,
|
|
282
283
|
ids: '',
printVisible: false,
|
|
284
|
confirmLoading: false,
|
|
285
|
planLoading: false,
|
|
286
|
description: '这是采购入库页面',
|
|
287
|
defaultValue: '',
|
|
288
289
|
purchasedStatusList: [],
treeDataSource: [],
|
|
290
291
292
293
294
|
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
|
|
295
296
|
printDataSource: [],
printLoading: false,
|
|
297
298
299
300
|
queryParam: [],
projectNameList: [],
workNoList: [],
projectNoList: [],
|
|
301
|
statusList:[],
|
|
302
303
|
pagination: {
defaultPageSize: 5,
|
|
304
|
showTotal: total => `共 ${total} 条数据`,
|
|
305
|
showSizeChanger: true,
|
|
306
|
pageSizeOptions: ['5', '10', '15', '20'],
|
|
307
|
onShowSizeChange: (current, pageSize) => this.pageSize = pageSize
|
|
308
|
},
|
|
309
|
bomIdList: [],
|
|
310
|
batchForm: this.$form.createForm(this),
|
|
311
312
|
planColumns: [
{
|
|
313
314
315
316
|
title: '采购单号',
dataIndex: 'code',
key: 'code'
}, {
|
|
317
|
title: '物料编码',
|
|
318
|
dataIndex: 'materialCode',
|
|
319
|
key: 'materialCode'
|
|
320
321
|
}, {
title: '物料名称',
|
|
322
|
dataIndex: 'materialName',
|
|
323
|
key: 'materialName'
|
|
324
|
}, {
|
|
325
326
327
328
329
330
331
|
title: '物料单位',
dataIndex: 'unit',
key: 'unit'
}, {
title: '数量',
dataIndex: 'qty',
key: 'qty'
|
|
332
333
334
335
336
337
338
339
|
},{
title: '已到货数量',
dataIndex: 'inQty',
key: 'inQty'
}, {
title: '已发货数量',
dataIndex: 'outQty',
key: 'outQty'
|
|
340
|
}, {
|
|
341
342
343
344
345
346
|
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
scopedSlots: { customRender: 'status' }
}, {
|
|
347
348
349
350
|
title: '供应商',
dataIndex: 'supplier',
key: 'supplier'
}, {
|
|
351
352
353
354
|
title: '联系人',
dataIndex: 'contact',
key: 'contact'
}, {
|
|
355
356
357
|
title: '联系方式',
dataIndex: 'phone',
key: 'phone'
|
|
358
359
360
361
362
|
// },{
// title: '计划开始时间',
// dataIndex: 'planStartTime',
// key: 'planStartTime'
}, {
|
|
363
|
title: '初次计划完成时间',
|
|
364
|
dataIndex: 'planEndTime',
|
|
365
366
367
368
369
|
key: 'planEndTime',
align: 'center',
scopedSlots: {
customRender: 'tradeTime'
}
|
|
370
371
372
373
374
375
376
|
}, {
title: '变更计划完成时间',
dataIndex: 'changePlanEndTime',
key: 'changePlanEndTime',
scopedSlots: {
customRender: 'tradeTime'
}
|
|
377
378
379
|
}, {
title: '实际完成时间',
dataIndex: 'actualEndTime',
|
|
380
381
382
383
384
|
key: 'actualEndTime',
align: 'center',
scopedSlots: {
customRender: 'tradeTime'
}
|
|
385
|
}, {
|
|
386
387
|
title: '是否为长周期件',
dataIndex: 'flag',
|
|
388
389
390
|
key: 'flag',
align: 'center',
scopedSlots: { customRender: 'flag' },
|
|
391
|
}, {
|
|
392
393
394
|
title: '备注',
dataIndex: 'remark',
key: 'remark'
|
|
395
|
}, {
|
|
396
397
398
399
400
401
402
|
title: '操作',
dataIndex: 'action',
fixed: 'right',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
|
|
403
404
405
|
],
url: {
list: '/material/purchase/list',
|
|
406
|
importExcelUrl: '/material/purchase/importExcel',
|
|
407
|
}
|
|
408
409
410
411
|
}
},
created() {
this.loadFrom()
|
|
412
|
this.getPurchaseStatus()
|
|
413
414
415
|
},
methods: {
loadFrom() {
|
|
416
417
418
419
420
|
ajaxGetDictItems('purchased_status').then((res)=> {
if (res.success) {
this.statusList = res.result
}
})
|
|
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
getProjectName().then((res) => {
if (res.success) {
this.projectNameList = res.result
}
})
getWorkNo().then((res) => {
if (res.success) {
this.workNoList = res.result
}
})
getProjectNo().then((res) => {
if (res.success) {
this.projectNoList = res.result
}
})
|
|
436
437
438
439
440
|
getBomIdList().then((res) => {
if (res.success) {
this.bomIdList = res.result
}
})
|
|
441
442
443
444
|
},
filterOption(input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
445
|
)
|
|
446
|
},
|
|
447
|
loadTreeData(tree) {
|
|
448
449
|
this.planLoading = false
this.treeDataSource = tree
|
|
450
451
452
453
454
|
},
handleExpandedRowsChange(expandedRows) {
this.expandedRowKeys = expandedRows
},
|
|
455
|
handleBomChange(value) {
|
|
456
|
this.initBomTree(value)
|
|
457
|
},
|
|
458
|
query() {
|
|
459
460
|
this.planLoading = true
this.loading = true
|
|
461
|
let params = {
|
|
462
463
464
465
|
'bomId': this.queryParam.bomId,
'projectName': this.queryParam.projectName,
'projectNo': this.queryParam.projectNo,
'workNo': this.queryParam.workNo
|
|
466
467
|
}
getBomId(params).then((res) => {
|
|
468
|
this.bomIdList = []
|
|
469
|
if (res.success) {
|
|
470
471
472
|
for (let i = 0; i < res.result.length; i++) {
this.bomIdList.push(res.result[i])
}
|
|
473
|
this.initBomTree(this.bomIdList[0])
|
|
474
475
476
477
|
} else {
this.$message.warning(res.message)
this.loading = false
this.planLoading = false
|
|
478
479
|
}
})
|
|
480
|
},
|
|
481
482
483
484
485
|
queryPurchaseIn() {
this.loading = true
let params = {
'workNo': this.queryParam.workNo,
'materialCode': this.queryParam.materialCode,
|
|
486
487
|
'materialName': this.queryParam.materialName,
'status': this.queryParam.status
|
|
488
489
490
|
}
this.getPurchaseList(params)
},
|
|
491
492
493
494
495
496
497
498
|
batchEditOpen() {
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
this.ids = ''
for (var a = 0; a < this.selectedRowKeys.length; a++) {
this.ids += this.selectedRowKeys[a] + ','
}
|
|
499
|
this.$refs.batchModalForm.edit(this.ids)
|
|
500
501
|
}
},
|
|
502
|
initBomTree(bomId) {
|
|
503
|
let params = {
|
|
504
|
'bomId': bomId
|
|
505
|
}
|
|
506
|
this.queryParam.bomId = bomId
|
|
507
508
|
getBomTree(params).then((res) => {
if (res.success) {
|
|
509
|
this.loadTreeData(res.result)
|
|
510
511
|
} else {
this.$message.warning(res.message)
|
|
512
513
|
}
})
|
|
514
515
516
|
this.getPurchaseList(params)
},
getPurchaseList(params) {
|
|
517
|
getPurchase(params).then((res) => {
|
|
518
|
if (res.success) {
|
|
519
520
|
this.loading = false
this.dataSource = res.result.records
|
|
521
522
523
524
|
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
|
|
525
526
527
|
}
}
})
|
|
528
529
|
},
print() {
|
|
530
531
532
533
|
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
return "";
}
|
|
534
|
this.$refs.purchaseInPrintModal.open(this.selectedRowKeys)
|
|
535
536
|
},
handleCancel(e) {
|
|
537
|
this.printVisible = false
|
|
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
|
},
getPurchaseStatus() {
ajaxGetDictItems('purchased_status').then((res) => {
if (res.success) {
this.purchasedStatusList = res.result
}
})
},
solutionPurchaseStatus(value) {
var actions = []
Object.keys(this.purchasedStatusList).some((key) => {
if (this.purchasedStatusList[key].value == ('' + value)) {
actions.push(this.purchasedStatusList[key].text)
return true
}
})
return actions.join('')
},
|
|
556
|
solutionPurchaseColor(value) {
|
|
557
558
559
560
561
562
563
|
var actions = ''
Object.keys(this.purchasedStatusList).some((key) => {
if (this.purchasedStatusList[key].value == ('' + value)) {
actions = this.purchasedStatusList[key].color
}
})
return actions
|
|
564
565
566
567
568
569
|
},
longTerm(flag) {
if (flag == '0') {
return "否"
} else {
return "是"
|
|
570
|
}
|
|
571
572
573
574
575
576
|
},
longTermColor(flag) {
if (flag == '0') {
return "volcano"
} else {
return "blue"
|
|
577
|
}
|
|
578
579
|
},
timeFormat(val) {
|
|
580
581
582
583
584
|
if(val==undefined){
return "";
}else{
return moment(val).format('YYYY-MM-DD')
}
|
|
585
586
587
|
},
merge(record) {
this.$refs.mergeModal.open(record)
|
|
588
|
}
|
|
589
590
|
},
computed: {
|
|
591
592
|
importExcelUrl: function() {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
|
|
593
594
595
596
597
598
599
600
|
}
}
}
</script>
<style scoped>
</style>
|