yangys
2025-09-08 76aee3bfa5a1e703fde16408d92b71c4fe2cdeb8
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!--
 * @Date: 2025-06-18 09:17:09
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-08-17 08:46:49
 * @FilePath: /mdmweb/src/views/flowmgr/processQuery2.vue
-->
<template>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud"
            @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
            @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
            @selection-change="selectionChange">
            
            <template #menu-left>
                
            </template>
            <template #menu="scope">
                <el-button type="primary" text size="default" @click.stop="handleConfirmTable(scope.row, scope.index, 0)">下载确认表
                </el-button>
               
            </template>
        </avue-crud>
 
    </basic-container>
</template>
 
<script>
import { getConfirmTableList } from '@/api/statreport/confirmtable.js';
import { getAssignee, } from '@/api/flow/todolist';
import { exportBlobPost } from '@/api/common';
import NProgress from 'nprogress';
import { downloadFile } from '@/utils/util';
import 'nprogress/nprogress.css';
 
export default {
    name: 'MachineReturnFileOp',
    data() {
        return {
            tableData: [],
            viewRow: {},
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            form: {},
            query: {},
            loading: true,
            data: [],
            option: {
                addBtn: false,
                editBtn: false,
                delBtn: false,
                viewBtn: false,
                columnBtn: false,
                tip: false,
                searchShow: true,
                searchMenuSpan: 7,
                searchEnter:true,
                dialogWidth: '70%',
                // tree: true,
                border: true,
                index: true,
                selection: false,
                menuWidth: 100,
                // menu: false,
                labelWidth: 90,
                menuSpan: 6,
                dialogClickModal: false,
                column: [
                    
                    {
                        label: '创建时间',
                        prop: 'createTime',
                        type: 'datetime',
                        format: 'YYYY-MM-DD HH:mm:ss',
                        valueFormat: 'YYYY-MM-DD HH:mm:ss',
                        search: true,
                        searchRange: true,
                        hide: true,
                    },
                    {
                        label: '关键字',
                        prop: 'keyword',
                        search: true,
                        searchType: 'input',
                        hide: true,
                        viewDisplay: false,
                    },
                    
                    {
                        label: '批次号',
                        prop: 'variables.craftEdition',
                        width: 80,
                        render: ({ row }) => {
                            return h('span', {}, row?.variables?.craftEdition || '');
                        }
                    },
                     {
                        label: '零组件号',
                        prop: 'drawingNo',
                        width: 80,
                        render: ({ row }) => {
                            return h('span', {}, row?.variables?.drawingNo || '');
                        }
                    },
                    {
                        label: '工序号',
                        prop: 'processNo',
                        width: 80,
                        render: ({ row }) => {
                            return h('span', {}, row?.variables?.processNo || '');
                        }
                    },
                    {
                        label: '工序名称',
                        prop: 'processName',
                        width: 80,
                        render: ({ row }) => {
                            return h('span', {}, row?.variables?.processName || '');
                        }
                    },
                    {
                        label: '工序版次',
                        prop: 'processEdition',
                        width: 80,
                        render: ({ row }) => {
                            return h('span', {}, row?.variables?.processEdition || '');
                        }
                    },
                   
                    {
                        label: '任务车间',
                        prop: 'workshop',
                        width: 80,
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.workshop || '');
                        }
                    },
                    {
                        label: '过程卡号',
                        prop: '',
                        width: 80,
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.processCard || '');
                        },
                    },
                    {
                        label: '图号',
                        prop: '',
                        width: 100,
                        render: ({ row }) => {
                            return h('p',
                                {
                                    attrs: {},
                                    class: {},
                                    style: {},
                                }, row?.variables?.drawingNo)
                        },
                        renderForm: ({ row }) => {
                            return h('span', {
                                attrs: {},
                                class: {},
                                style: {},
                            }, row?.variables?.drawingNo || '');
                        }
                    },
                    {
                        label: '产品型号',
                        prop: '',
                        width: 100,
                        render: ({ row }) => {
                            return h('p',
                                {
                                    attrs: {},
                                    class: {},
                                    style: {},
                                }, row?.variables?.productModel)
                        },
                        renderForm: ({ row }) => {
                            return h('span', {
                                attrs: {},
                                class: {},
                                style: {},
                            }, row?.variables?.productModel || '');
                        }
                    },
                    
                    {
                        label: '机床',
                        prop: '',
                        render: ({ row }) => {
                            return h('p',
                                {
                                    attrs: {},
                                    class: {},
                                    style: {},
                                }, row?.variables?.machineCode)
                        },
                        renderForm: ({ row }) => {
                            return h('span', {
                                attrs: {},
                                class: {},
                                style: {},
                            }, row?.variables?.machineCode || '');
                        }
                    },
                    {
                        label: '创建时间',
                        prop: 'processCreateTime',
                    },
                ],
            },
            viewFormOption: {
                emptyBtn: false,
                submitBtn: false,
                menuBtn: false,
                labelWidth: 100,
                span: 8,
                column: [
                    {
                        label: '流程名称',
                        prop: '',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables.myProcessName)
                        }
                    },
                    {
                        label: '创建时间',
                        prop: 'createTime',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.createTime)
                        },
                    },
                    {
                        label: '标题',
                        prop: 'variables.title',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.title)
                        }
                    },
                    
                    {
                        label: '批次号',
                        prop: 'variables.craftEdition',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.craftEdition || '');
                        }
                    },
                    {
                        label: '工序号',
                        prop: 'processNo',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.processNo || '');
                        }
                    },
                    {
                        label: '工序名称',
                        prop: 'processName',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.processName || '');
                        }
                    },
                    {
                        label: '工序版次',
                        prop: 'processEdition',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.processEdition || '');
                        }
                    },
                    {
                        label: '零组件号',
                        prop: 'drawingNo',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.drawingNo || '');
                        }
                    },
                    {
                        label: '任务车间',
                        prop: 'workshop',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.workshop || '');
                        }
                    },
                    {
                        label: '过程卡号',
                        prop: '',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.processCard || '');
                        }
                    },
                    {
                        label: '图号',
                        prop: 'drawingNo',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.drawingNo)
                        }
                    },
                    {
                        label: '产品型号',
                        prop: 'productModel',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.productModel)
                        }
                    },                    
                    {
                        label: '机床',
                        prop: 'machineCode',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.machineCode)
                        }
                    },
                    {
                        label: '创建人',
                        prop: 'startUserName',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.startUserName)
                        }
                    },
                    {
                        label: '创建时间',
                        prop: 'processCreateTime',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.processCreateTime)
                        }
                    },
                    {
                        label: '当前节点',
                        prop: 'taskName',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.taskName)
                        }
                    },
                    {
                        label: '计划加工时间',
                        prop: 'planStartTime',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.planStartTime || '');
                        }
                    },
                    {
                        label: '程序包名',
                        prop: 'programPackageName',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.programPackageName || '');
                        }
                    },
                    {
                        label: '偏离单号',
                        prop: '',
                        render: ({ row }) => {
                            return h('p',{'class': 'margin0'}, row?.variables?.deviation || '');
                        }
                    },
                ],
            },
            selectedList: [],
            dialogVisible: false,
            reassignBox: false,
            reassignForm: {},
            reassignOption: {
                submitBtn: true,
                emptyBtn: false,
                column: [
                    {
                        label: '发送给',
                        prop: 'newAssigneeId',
                        type: 'select',
                        // dicUrl: `/blade-mdm/flow/flow-user-list?deptId=0`,
                        // dicFlag: true,
                        props: {
                            label: 'name',
                            value: 'id',
                        },
                        span: 24,
                        disabled: false,
                        dicData: [
 
                        ],
                        rules: [{ required: true, message: '请输入选择', trigger: 'blur' }],
                    },
                    {
                        label: '备注',
                        span: 24,
                        prop: 'comment',
                        type: 'textarea',
                        rules: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
                    },
                ],
            },
        }
    },
    mounted() {
        getAssignee().then(res => {
            this.reassignOption.column[0].dicData = res.data.data;
        })
    },
    methods: {
        customView(row) {
            this.viewRow = {...row};
            axios({
                url: '/blade-mdm/flow/mgr/process-trace',
                method: 'get',
                params: {processInstanceId: row.processInstanceId}
            }).then(
              res => {
                this.tableData = res.data.data;
            });
            this.dialogVisible = true;
        },
        
        handleConfirmTable(row, index,) {
           //确认表下载
            this.$confirm('是否导出确认表1?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                
                NProgress.start();
                exportBlobPost(
                    `/blade-mdm/statreport/tableprint/export-confirm-table`,
                    { processInstanceId: row.processInstanceId }
                ).then(res => {
                    let name = res.headers['content-disposition'].split('filename=')[1]
                    console.log(res.headers['content-disposition'].split('filename=')[1]);
                    name = decodeURI(name)
                    downloadFile(res.data, `${name}`);
                    NProgress.done();
                });
            });
            
 
        },
        
        selectionChange(list) {
            console.log('selectionChange', list);
            this.selectedList = list;
        },
        
        searchChange(params, done) {
            let data = {}
            this.query = params;
            this.page.currentPage = 1;
            console.log('searchChange', params);
            params.createTimeBegin = params?.createTime?.[0] || '';
            params.createTimeEnd = params?.createTime?.[1] || '';
            console.log(params);
            // data = {
            //     createTimeBegin: dayjs(params.createTimeBegin).isValid() ? dayjs(params.createTimeBegin).format('YYYY-MM-DD') : '',
            //     createTimeEnd: dayjs(params.createTimeEnd).isValid() ? dayjs(params.createTimeEnd).format('YYYY-MM-DD') : '',
            //     keyword: params.keyword || ''
            // }
            data = {
                createTimeBegin: params.createTimeBegin || undefined,
                createTimeEnd: params.createTimeEnd || undefined,
                keyword: params.keyword || undefined,
                myProcessName: params.myProcessName || undefined
            }
            this.query = data
            this.onLoad(this.page, data);
            done();
        },
        searchReset() {
            let data = {}
            this.query = data;
            this.page.currentPage = 1;
            data = {
                createTimeBegin: params.createTimeBegin,
                createTimeEnd: params.createTimeEnd,
                keyword: params.keyword || '',
                myProcessName: params.myProcessName || ''
            }
            this.onLoad(this.page, data);
            done();
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
            // this.onLoad();
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
        },
        /** * 页面加载时获取数据
         */
        onLoad(page, params = {}) {
            console.log('onLoad', page, params);
            const data = {
                ...this.query,
                createTimeBegin: params.createTimeBegin,
                createTimeEnd: params.createTimeEnd,
                keyword: params.keyword || '',
                myProcessName: params.myProcessName || ''
            };
            this.loading = true;
            getConfirmTableList(page.currentPage, page.pageSize, Object.assign(data, params)).then(res => {
                const data = res.data.data
                this.page.total = data.total;
                this.data = data.records.map(v=> {
                    return {
                        ...v,
                    }
                });
                this.loading = false;
            }, () => {
                this.data = [];
                this.loading = false;
            }).catch(err => {
                this.data = [];
                this.loading = false;
            });
        }
    }
};
</script>
 
<style lang="scss">
.margin0 {
    margin: 0
}
.viewRowForm .el-form-item--default {
    margin-bottom: 0
}
</style>