syntec3-0-ui-components-test 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +5 -0
  2. package/dist/S3_0UC_main.csv +4 -0
  3. package/dist/S3_0UC_sub.csv +2 -0
  4. package/dist/globalVariableS3_0UC.json +1 -0
  5. package/dist/style.css +1 -0
  6. package/dist/syntec3-0-ui-components.es.js +19518 -0
  7. package/dist/syntec3-0-ui-components.es.js.map +1 -0
  8. package/dist/syntec3-0-ui-components.umd.js +23 -0
  9. package/dist/syntec3-0-ui-components.umd.js.map +1 -0
  10. package/dist/vite.svg +1 -0
  11. package/dist/web.config +17 -0
  12. package/package.json +137 -0
  13. package/src/App.vue +31 -0
  14. package/src/assets/fonts/genYoGothicTW-normal.js +7 -0
  15. package/src/assets/image/defaultImage.png +0 -0
  16. package/src/assets/vue.svg +1 -0
  17. package/src/components/Layout/modules/fullPageGlobal.vue +113 -0
  18. package/src/components/Layout/modules/viewFile/config.js +65 -0
  19. package/src/components/Layout/modules/viewFile/createView.vue +1000 -0
  20. package/src/components/Layout/modules/viewFile/filterCriteria.vue +816 -0
  21. package/src/components/Layout/modules/viewFile/viewList.vue +291 -0
  22. package/src/components/Layout/modules/viewFile/viewManageTool.js +271 -0
  23. package/src/components/Layout/modules/viewFile/viewRecord.vue +472 -0
  24. package/src/components/Layout/modules/viewFile/viewTabs.vue +542 -0
  25. package/src/components/Layout/tools/GlobalDialog.vue +115 -0
  26. package/src/components/Pagination.vue +139 -0
  27. package/src/components/columnConfigNext.vue +273 -0
  28. package/src/components/customFilter/customFilter.vue +492 -0
  29. package/src/components/customFilter/filterCriteria.vue +769 -0
  30. package/src/components/customTable/components/headerOperation/index.vue +136 -0
  31. package/src/components/customTable/components/headerTabs/index.vue +171 -0
  32. package/src/components/customTable/components/tableContent/index.vue +440 -0
  33. package/src/components/customTable/index.vue +305 -0
  34. package/src/components/dialog.vue +85 -0
  35. package/src/components/pageContent.vue +48 -0
  36. package/src/components/popover.vue +402 -0
  37. package/src/configFiles/apiFile/baseApiList.json +11 -0
  38. package/src/configFiles/apiFile/coreApiList.json +24 -0
  39. package/src/configFiles/apiFile/mesApiList.json +4 -0
  40. package/src/configFiles/apiFile/mmsApiList.json +3 -0
  41. package/src/configFiles/errorCode.json +291 -0
  42. package/src/configFiles/version.js +2 -0
  43. package/src/i18n/lang/en-us.json +2060 -0
  44. package/src/i18n/lang/errorCodeTranslate.mjs +847 -0
  45. package/src/i18n/lang/zh-cn.json +2062 -0
  46. package/src/i18n/lang/zh-tw.json +2059 -0
  47. package/src/index.js +115 -0
  48. package/src/main.js +51 -0
  49. package/src/plugins/excel.js +88 -0
  50. package/src/router/index.js +41 -0
  51. package/src/scriptFiles/apiConfig/baseApis.js +10 -0
  52. package/src/scriptFiles/apiConfig/mesApis.js +10 -0
  53. package/src/scriptFiles/apiConfig/mmsApis.js +10 -0
  54. package/src/scriptFiles/apiConfig/privateCloudCoreApis.js +13 -0
  55. package/src/scriptFiles/apiConfig/serviceRoute.js +23 -0
  56. package/src/scriptFiles/apis/baseApiFunction.js +63 -0
  57. package/src/scriptFiles/apis/mesApiFunction.js +15 -0
  58. package/src/scriptFiles/apis/mmsApiFunction.js +9 -0
  59. package/src/scriptFiles/apis/privateCloudCoreApiFunction.js +101 -0
  60. package/src/scriptFiles/backendApiFunction.js +11 -0
  61. package/src/scriptFiles/checkApiErrorMechanism.js +137 -0
  62. package/src/scriptFiles/common/objectDataProcessing.js +65 -0
  63. package/src/scss/base/commom.scss +1068 -0
  64. package/src/scss/base/dialog.scss +45 -0
  65. package/src/scss/base/index.scss +3 -0
  66. package/src/scss/base/table.scss +28 -0
  67. package/src/store/index.js +25 -0
  68. package/src/store/module/langStore.js +116 -0
  69. package/src/style.css +52 -0
  70. package/src/utils/excel.js +86 -0
  71. package/src/utils/formula.js +69 -0
  72. package/src/utils/https.js +13 -0
  73. package/src/utils/i18n.js +42 -0
  74. package/src/utils/shiftSelect.js +164 -0
  75. package/src/utils/summation.js +77 -0
  76. package/src/utils/tableWidth.js +29 -0
  77. package/src/utils/toolFun.js +93 -0
  78. package/src/views/productionWorkOrder/components/columnConfig.vue +242 -0
  79. package/src/views/productionWorkOrder/components/docCustomFieldForm.vue +739 -0
  80. package/src/views/productionWorkOrder/components/filePreview.vue +148 -0
  81. package/src/views/productionWorkOrder/components/querySearch.vue +363 -0
  82. package/src/views/productionWorkOrder/configFiles/excelImportErrorCode.json +94 -0
  83. package/src/views/productionWorkOrder/configFiles/pdfDefaultConfig.js +933 -0
  84. package/src/views/productionWorkOrder/configFiles/planMakingScript.js +600 -0
  85. package/src/views/productionWorkOrder/configFiles/productionRelatedScript.js +368 -0
  86. package/src/views/productionWorkOrder/configFiles/rulse.js +23 -0
  87. package/src/views/productionWorkOrder/configFiles/status.js +50 -0
  88. package/src/views/productionWorkOrder/index.vue +2174 -0
  89. package/src/views/productionWorkOrder/productionFlowLabel/component/addCirculationLabel.vue +394 -0
  90. package/src/views/productionWorkOrder/productionFlowLabel/component/circulationLabelTable.vue +124 -0
  91. package/src/views/productionWorkOrder/productionFlowLabel/component/materialPartFilePreview.vue +167 -0
  92. package/src/views/productionWorkOrder/productionFlowLabel/component/workOrderInformation.vue +28 -0
  93. package/src/views/productionWorkOrder/productionFlowLabel/index.vue +604 -0
  94. package/src/views/production_work_order/components/priorityTooltip.vue +53 -0
  95. package/src/views/production_work_order/index.vue +1307 -0
  96. package/src/views/review_record/components/materialInfo.vue +50 -0
  97. package/src/views/review_record/components/rootCause.vue +42 -0
  98. package/src/views/review_record/components/workDetail.vue +115 -0
  99. package/src/views/review_record/index.vue +884 -0
@@ -0,0 +1,1307 @@
1
+ <template>
2
+ <workContentVue
3
+ ref="productionRef"
4
+ v-model="pageData.dataList"
5
+ :table-loading="pageData.tableLoading"
6
+ :table-columns="canEditHeaders"
7
+ :total="pageData.total"
8
+ :custom-fields-list="pageData.customFieldsList"
9
+ permission-code="PMC_101000"
10
+ :permission-data="permissionData"
11
+ :select-options="selectOptions"
12
+ :default-create-time-string="defaultCreateTimeString"
13
+ :default-sort="{ prop: 'consDate', order: 'descending' }"
14
+ :top-buttons="topButtons"
15
+ :auto="false"
16
+ data-test-id="WORKCONTENTVUE-hIS0ao"
17
+ :show-summary="true"
18
+ :summary-method="getSummaries"
19
+ :selectable="selectable"
20
+ @columnsSaveData="saveData"
21
+ @columnsChildSaveData="saveChildData"
22
+ @reload="onReload"
23
+ @sortChange="onSortChange"
24
+ @selectionChange="onSelectionChange"
25
+ @cellClick="onCellClick"
26
+ @update:permissionData="handlePermissionDataUpdate"
27
+ @filterSearch="handleFilterSearch"
28
+ >
29
+ <!-- 可以访问row和index -->
30
+ <!-- 根据数据行状态自定义显示操作按钮 -->
31
+ <template #tableActions="{ row, index }">
32
+ <el-tooltip effect="dark" :content="t('edit')" placement="top" :data-test-id="`EL-TOOLTIP-ZRq1eI-${index}`">
33
+ <el-button link :data-test-id="`EL-BUTTON-JrhNjc-${index}`" @click.stop="handleEdit(row, index)">
34
+ <v-icon class="mdi mdi-18px mdi-pencil" :data-test-id="`V-ICON-GK3rzB-${index}`" />
35
+ </el-button>
36
+ </el-tooltip>
37
+ <el-tooltip effect="dark" :content="t('add')" placement="top" :data-test-id="`EL-TOOLTIP-YEVWfA-${index}`">
38
+ <el-button link :data-test-id="`EL-BUTTON-BwYnBQ-${index}`" @click.stop="handleAdd(row, index)">
39
+ <v-icon class="mdi mdi-18px mdi-plus-circle-outline" :data-test-id="`V-ICON-BGbIod-${index}`" />
40
+ </el-button>
41
+ </el-tooltip>
42
+ </template>
43
+ </workContentVue>
44
+ </template>
45
+
46
+ <script setup>
47
+ import { ref, computed, reactive, onMounted, watch, h } from 'vue';
48
+ import { ElMessage } from 'element-plus';
49
+ import { useI18n } from 'vue-i18n';
50
+ import dayjs from 'dayjs';
51
+ import apiFunction from '@/scriptFiles/checkApiErrorMechanism';
52
+ // 组件导入
53
+ import workContentVue from '@/components/customTable/index.vue';
54
+ import priorityTooltip from './components/priorityTooltip.vue';
55
+ const { t } = useI18n();
56
+ const productionRef = ref();
57
+ const pageData = reactive({
58
+ tableLoading: false, // table加载状态
59
+ dataList: [], // 当前页table数据
60
+ total: 0, // 总数
61
+ columnConfig: [], // 列配置
62
+ customFieldsList: [],
63
+ orderSettingList: [
64
+ {
65
+ orderSettingID: 5,
66
+ orderSettingType: 1,
67
+ },
68
+ {
69
+ orderSettingID: 6,
70
+ orderSettingType: 1,
71
+ },
72
+ ], // 自定义排序参数
73
+ viewId: '', // 视图ID
74
+ });
75
+ const internalColumnConfig = ref([]);
76
+ // 格式化工单状态
77
+ function formatStatus(status) {
78
+ switch (status) {
79
+ case 0:
80
+ return {
81
+ bgColor: 'grey',
82
+ textColor: '#eeeeee',
83
+ text: t('noDispatch'), // 未派工
84
+ };
85
+ case 1:
86
+ return {
87
+ bgColor: '#1E88E5',
88
+ textColor: '#E3F2FD',
89
+ text: t('noStart'), // 未开工
90
+ };
91
+ case 2:
92
+ return {
93
+ bgColor: '#ffffff',
94
+ textColor: '#1b9600',
95
+ text: t('underExecution'), // 已开工
96
+ };
97
+ case 3:
98
+ return {
99
+ bgColor: '#009688',
100
+ textColor: '#E0F2F1',
101
+ text: t('finished'), // 已完工
102
+ };
103
+ case 4:
104
+ return {
105
+ bgColor: 'grey',
106
+ textColor: '#eeeeee',
107
+ text: t('alreadyOverdue'), // 已逾期
108
+ };
109
+ case 5:
110
+ return {
111
+ bgColor: '#EF5350',
112
+ textColor: '#FFEBEE',
113
+ text: t('closed'), // 已关闭
114
+ };
115
+ default:
116
+ break;
117
+ }
118
+ }
119
+ // 格式化重要排序
120
+ function formatPriority(value) {
121
+ switch (value) {
122
+ case 0:
123
+ return {
124
+ value, // 最次要
125
+ icon: 'mdi mdi-chevron-triple-down',
126
+ color: 'grey',
127
+ text: t('leastImportant'),
128
+ };
129
+ case 1:
130
+ return {
131
+ value, // 次要
132
+ icon: 'mdi mdi-chevron-double-down',
133
+ color: '#4481b8',
134
+ text: t('secondary'),
135
+ };
136
+ case 2:
137
+ return {
138
+ value, // 正常
139
+ icon: 'mdi mdi-equal',
140
+ color: 'green',
141
+ text: t('normal'),
142
+ };
143
+ case 3:
144
+ return {
145
+ value, // 优先
146
+ icon: 'mdi mdi-chevron-double-up',
147
+ color: 'orange',
148
+ text: t('priority'),
149
+ };
150
+ case 4:
151
+ return {
152
+ value, // 最优先
153
+ icon: 'mdi mdi-star-circle',
154
+ color: 'red',
155
+ text: t('topPriority'),
156
+ };
157
+ default:
158
+ break;
159
+ }
160
+ }
161
+ // 固定列配置
162
+ const tableColumns = computed(() => [
163
+ {
164
+ text: t('workOrderStatus'),
165
+ value: 'productionOrderStatus',
166
+ isFixed: false, // 是否固定列
167
+ isShown: true, // 是否显示隐藏
168
+ disabled: false, // 是否禁用
169
+ freeze: false, // 是否冻结列
170
+ customizeFields: false,
171
+ formatterType: 'tags',
172
+ formatter: (row) => formatStatus(row.productionOrderStatus), // 格式化tag格式的数据项
173
+ },
174
+ {
175
+ text: t('productionOrderNumber'),
176
+ value: 'productionOrderNumber',
177
+ isFixed: false,
178
+ isShown: true,
179
+ disabled: false,
180
+ freeze: false,
181
+ customizeFields: false,
182
+ },
183
+ {
184
+ text: t('partNumber'),
185
+ value: 'partNumber',
186
+ isFixed: false,
187
+ isShown: true,
188
+ disabled: false,
189
+ freeze: false,
190
+ customizeFields: false,
191
+ // 用于模拟a链接类型的格式化
192
+ // link格式化格式: {
193
+ // link: '链接地址',
194
+ // name: '链接名称,用于列表显示',
195
+ // }
196
+ // 如果没有name则显示link,如果都没有则显示占位符
197
+ // formatterType: 'link',
198
+ // formatter: () => {
199
+ // return {
200
+ // link: 'https://gitee.com/',
201
+ // name: 'gitee.com',
202
+ // underline: 'always',
203
+ // color: '#409eff',
204
+ // };
205
+ // },
206
+ },
207
+ {
208
+ text: t('productName'),
209
+ value: 'productName',
210
+ isFixed: false,
211
+ isShown: true,
212
+ disabled: false,
213
+ freeze: false,
214
+ customizeFields: false,
215
+ },
216
+ {
217
+ text: t('materialCategory'),
218
+ value: 'materialCategoryName',
219
+ isFixed: false,
220
+ isShown: true,
221
+ disabled: false,
222
+ freeze: false,
223
+ customizeFields: false,
224
+ },
225
+ {
226
+ text: t('materialFile'),
227
+ value: 'productionOrderMaterialFileList',
228
+ isFixed: false,
229
+ isShown: true,
230
+ disabled: false,
231
+ freeze: false,
232
+ customizeFields: false,
233
+ // 用于模拟测试文件类型的格式化
234
+ // file格式化格式: [{
235
+ // file: '文件地址',
236
+ // name: '文件名称,用于列表显示',
237
+ // }]
238
+ // 如果没有name则显示file,如果都没有则显示占位符
239
+ formatterType: 'file',
240
+ formatter: (row) => {
241
+ return row.productionOrderMaterialFileList.map((elem) => {
242
+ return {
243
+ ...elem,
244
+ name: elem.plmFileName,
245
+ };
246
+ });
247
+ },
248
+ },
249
+ {
250
+ text: t('materialSpec'),
251
+ value: 'materialSpec',
252
+ isFixed: false,
253
+ isShown: true,
254
+ disabled: false,
255
+ freeze: false,
256
+ customizeFields: false,
257
+ },
258
+ {
259
+ text: t('workOrderRequirementsNumber'),
260
+ value: 'productionOrderRequiredThroughput',
261
+ isFixed: false,
262
+ isShown: true,
263
+ disabled: false,
264
+ freeze: false,
265
+ customizeFields: false,
266
+ },
267
+ {
268
+ text: t('craftPath'),
269
+ value: 'craftPathName',
270
+ isFixed: false,
271
+ isShown: true,
272
+ disabled: false,
273
+ freeze: false,
274
+ customizeFields: false,
275
+ },
276
+ {
277
+ text: t('salesOrderNumber'),
278
+ value: 'orderNumber',
279
+ isFixed: false,
280
+ isShown: true,
281
+ disabled: false,
282
+ freeze: false,
283
+ customizeFields: false,
284
+ },
285
+ {
286
+ text: t('sourceOrderType'),
287
+ value: 'originalOrderType',
288
+ isFixed: false,
289
+ isShown: true,
290
+ disabled: false,
291
+ freeze: false,
292
+ customizeFields: false,
293
+ },
294
+ {
295
+ text: t('sourceOrderNo'),
296
+ value: 'originalOrderNumber',
297
+ isFixed: false,
298
+ isShown: true,
299
+ disabled: false,
300
+ freeze: false,
301
+ customizeFields: false,
302
+ },
303
+ {
304
+ text: t('customerNameDigiwin'),
305
+ value: 'orderDemander',
306
+ isFixed: false,
307
+ isShown: true,
308
+ disabled: false,
309
+ freeze: false,
310
+ customizeFields: false,
311
+ },
312
+ {
313
+ text: t('orderExpectedDue'),
314
+ value: 'orderExpectedDue',
315
+ isFixed: false,
316
+ isShown: true,
317
+ disabled: false,
318
+ freeze: false,
319
+ customizeFields: false,
320
+ minWidth: 160, // 列最小宽度
321
+ sortable: 'custom', // 自定义排序
322
+ formatter: (row) => (row.orderExpectedDue ? dayjs(row.orderExpectedDue).format('YYYY-MM-DD') : '--'),
323
+ },
324
+ {
325
+ text: t('startDate'),
326
+ value: 'productionOrderExpectedStartDate',
327
+ isFixed: false,
328
+ isShown: true,
329
+ disabled: false,
330
+ freeze: false,
331
+ customizeFields: false,
332
+ sortable: 'custom', // 自定义排序
333
+ minWidth: 140,
334
+ formatter: (row) =>
335
+ row.productionOrderExpectedStartDate ? dayjs(row.productionOrderExpectedStartDate).format('YYYY-MM-DD') : '--',
336
+ },
337
+ {
338
+ text: t('finishDate'),
339
+ value: 'productionOrderExpectedDueDate',
340
+ isFixed: false,
341
+ isShown: true,
342
+ disabled: false,
343
+ freeze: false,
344
+ customizeFields: false,
345
+ sortable: 'custom', // 自定义排序
346
+ minWidth: 140,
347
+ formatter: (row) =>
348
+ row.productionOrderExpectedDueDate ? dayjs(row.productionOrderExpectedDueDate).format('YYYY-MM-DD') : '--',
349
+ },
350
+ {
351
+ text: t('importantSort'),
352
+ value: 'productionOrderPriority',
353
+ isFixed: false,
354
+ isShown: true,
355
+ disabled: false,
356
+ freeze: false,
357
+ customizeFields: false,
358
+ formatterType: 'icon',
359
+ formatter: (row) => formatPriority(row.productionOrderPriority),
360
+ // leftSlot: priorityTooltip, // thead列文本左侧插槽, 根据需求显示组件。
361
+ rightSlot: priorityTooltip, // thead列文本右侧插槽
362
+ // columntSlot: priorityTooltip, // tbody列插槽, 根据需求显示组件。如果同时配置formatter和columntSlot则columntSlot优先显示
363
+ },
364
+ {
365
+ text: t('creator'),
366
+ value: 'consUserName',
367
+ isFixed: false,
368
+ isShown: true,
369
+ disabled: false,
370
+ freeze: false,
371
+ customizeFields: false,
372
+ },
373
+ {
374
+ text: t('createTime'),
375
+ value: 'consDate',
376
+ isFixed: false,
377
+ isShown: true,
378
+ disabled: false,
379
+ freeze: false,
380
+ customizeFields: false,
381
+ sortable: 'custom', // 自定义排序
382
+ formatter: (row) => (row.consDate ? dayjs(row.consDate).format('YYYY-MM-DD HH:mm:ss') : '--'),
383
+ },
384
+ {
385
+ text: t('updatePerson'),
386
+ value: 'modiUserName',
387
+ isFixed: false,
388
+ isShown: true,
389
+ disabled: false,
390
+ freeze: false,
391
+ customizeFields: false,
392
+ },
393
+ {
394
+ text: t('updateTime'),
395
+ value: 'modiDate',
396
+ isFixed: false,
397
+ isShown: true,
398
+ disabled: false,
399
+ freeze: false,
400
+ customizeFields: false,
401
+ sortable: 'custom', // 自定义排序
402
+ formatter: (row) => (row.modiDate ? dayjs(row.modiDate).format('YYYY-MM-DD HH:mm:ss') : '--'),
403
+ },
404
+ {
405
+ text: t('inventoryStorageQuantity'),
406
+ value: 'inboundQuantity',
407
+ isFixed: false,
408
+ isShown: true,
409
+ disabled: false,
410
+ freeze: false,
411
+ customizeFields: false,
412
+ },
413
+ {
414
+ text: t('returnQuantity'),
415
+ value: 'returnQuantity',
416
+ isFixed: false,
417
+ isShown: true,
418
+ disabled: false,
419
+ freeze: false,
420
+ customizeFields: false,
421
+ },
422
+ {
423
+ text: t('inboundRemain'),
424
+ value: 'inboundRemain',
425
+ isFixed: false,
426
+ isShown: true,
427
+ disabled: false,
428
+ freeze: false,
429
+ customizeFields: false,
430
+ },
431
+ {
432
+ text: t('description'),
433
+ value: 'remark',
434
+ isFixed: false,
435
+ isShown: true,
436
+ disabled: false,
437
+ freeze: false,
438
+ customizeFields: false,
439
+ },
440
+ {
441
+ text: t('shutdownReason'),
442
+ value: 'closeReason',
443
+ isFixed: false,
444
+ isShown: false,
445
+ disabled: false,
446
+ freeze: false,
447
+ customizeFields: false,
448
+ },
449
+ ]); // 方法
450
+
451
+ // 远程table列配置
452
+ function getColumnConfig() {
453
+ apiFunction
454
+ .queryColumnSettingNext({
455
+ displayIds: [101000201],
456
+ })
457
+ .then((res) => {
458
+ if (res.data.code === 0) {
459
+ const dataList = res.data.content.data;
460
+ if (dataList[0].displayId === 101000201 && dataList[0].configJson) {
461
+ pageData.columnConfig = dataList[0].configJson.columnSetting;
462
+ }
463
+ // 根据不同情况处理某一项数据列
464
+ const fIndex = pageData.columnConfig.findIndex((item) => item.columnKey === 'productName');
465
+ const someFlag = pageData.columnConfig.some((item) => item.columnKey === 'materialCategoryName');
466
+ if (pageData.columnConfig && pageData.columnConfig.length && !someFlag)
467
+ pageData.columnConfig.splice(fIndex + 1, 0, {
468
+ columnKey: 'materialCategoryName',
469
+ customizeFields: false,
470
+ disabled: false,
471
+ fixed: false,
472
+ freeze: false,
473
+ isCustom: false,
474
+ isFixed: false,
475
+ isShown: true,
476
+ text: t('materialCategory'),
477
+ value: 'materialCategoryName',
478
+ });
479
+ } else {
480
+ pageData.columnConfig = [];
481
+ }
482
+ })
483
+ .catch(() => {
484
+ pageData.columnConfig = [];
485
+ });
486
+ }
487
+ // 获取表格数据
488
+ async function onReload(params) {
489
+ try {
490
+ const paramsData = JSON.parse(JSON.stringify(params));
491
+ paramsData.orderSettingList = pageData.orderSettingList;
492
+ pageData.tableLoading = true;
493
+ paramsData.viewId = pageData.viewId;
494
+ paramsData.isPc = true;
495
+ const res = await apiFunction.planFormulationQuery(paramsData);
496
+ if (res.data.code === 0) {
497
+ const { data, totalCount } = res.data.content;
498
+ productionRef.value.complete(data);
499
+ pageData.total = totalCount;
500
+ } else {
501
+ ElMessage.error(res.data.detail || '获取数据失败');
502
+ pageData.total = 0;
503
+ }
504
+ } catch (error) {
505
+ console.error('加载表格数据失败:', error);
506
+ ElMessage.error('网络请求失败');
507
+ pageData.total = 0;
508
+ } finally {
509
+ pageData.tableLoading = false;
510
+ }
511
+ }
512
+ // 自定义排序
513
+ function onSortChange(val) {
514
+ console.log(val, 333333);
515
+ const mapping = {
516
+ productionOrderExpectedStartDate: 3,
517
+ productionOrderExpectedDueDate: 4,
518
+ consDate: 6,
519
+ orderExpectedDue: 7,
520
+ modiDate: 8,
521
+ };
522
+ const orderSettingID = mapping[val.prop];
523
+ const orderSettingType = val.order === 'descending' ? 1 : 0;
524
+ if (pageData.orderSettingList.length === 2) {
525
+ pageData.orderSettingList.splice(1, 1);
526
+ }
527
+ if (val.order) {
528
+ pageData.orderSettingList.push({
529
+ orderSettingID,
530
+ orderSettingType,
531
+ });
532
+ }
533
+ productionRef.value.reload();
534
+ }
535
+ const getCustomFields = async () => {
536
+ const params = {
537
+ docCode: 'doc_5',
538
+ status: 1,
539
+ fieldName: '',
540
+ consDate: [],
541
+ startIndex: 0,
542
+ count: 100,
543
+ };
544
+ await apiFunction.querySetting(params).then((res) => {
545
+ if (res.data.code === 0) {
546
+ const customFieldData = res.data.content.data.map((ite) => ({
547
+ ...ite,
548
+ customFieldName: ite.fieldName,
549
+ columnKey: ite.fieldName,
550
+ customFieldId: ite.docCustomId,
551
+ isCustom: true,
552
+ isFixed: false,
553
+ isShown: true,
554
+ disabled: false,
555
+ freeze: false,
556
+ customizeFields: true,
557
+ }));
558
+ pageData.customFieldsList = customFieldData.map((item) => ({
559
+ ...item,
560
+ text: item.customFieldName,
561
+ columnKey: item.customFieldName,
562
+ align: 'index',
563
+ sortable: false,
564
+ value: item.customFieldId,
565
+ class: 'parentTabColor white--text',
566
+ width: '170px',
567
+ customFieldId: item.docCustomId,
568
+ fieldTypeId: item.fieldTypeId,
569
+ }));
570
+ }
571
+ });
572
+ };
573
+ // 行选中数据
574
+ function onSelectionChange(e) {
575
+ console.log(e);
576
+ }
577
+ // 单元格点击事件,返回row和cell
578
+ function onCellClick(e) {
579
+ console.log(e);
580
+ }
581
+ // 操作列-编辑
582
+ function handleEdit(row, index) {
583
+ console.log('edit', index, row);
584
+ }
585
+ // 操作列-新增
586
+ function handleAdd(row, index) {
587
+ console.log('add', index, row);
588
+ }
589
+ // 合并列格式化
590
+ const getSummaries = (param) => {
591
+ const { columns, data } = param;
592
+ const sums = [];
593
+ columns.forEach((column, index) => {
594
+ if (index === 0) {
595
+ sums[index] = h('div', {}, ['合计']);
596
+ return;
597
+ }
598
+ const values = data.map((item) => Number(item[column.property]));
599
+ if (!values.every((value) => Number.isNaN(value)) && column.rawColumnKey === 'productionOrderRequiredThroughput') {
600
+ sums[index] = `${values.reduce((prev, curr) => {
601
+ const value = Number(curr);
602
+ if (!Number.isNaN(value)) {
603
+ return prev + curr;
604
+ } else {
605
+ return prev;
606
+ }
607
+ }, 0)}`;
608
+ }
609
+ });
610
+
611
+ return sums;
612
+ };
613
+ // 选择列禁用规则
614
+ const selectable = (row) => row.productionOrderStatus !== 5;
615
+ const canEditHeaders = computed(() => {
616
+ const allHeaderList = [
617
+ ...tableColumns.value.map((item) => ({
618
+ ...item,
619
+ isCustom: false,
620
+ columnKey: item.text,
621
+ })),
622
+ ...pageData.customFieldsList.map((item) => ({
623
+ ...item,
624
+ columnKey: item.fieldName,
625
+ isCustom: true,
626
+ })),
627
+ ];
628
+ const list = [];
629
+ if (!internalColumnConfig.value?.length) {
630
+ return allHeaderList;
631
+ }
632
+ const notExistsList = [];
633
+ allHeaderList.forEach((ite) => {
634
+ const filterItem = internalColumnConfig.value.find((el) => el.value === ite.value);
635
+ if (filterItem) {
636
+ list.push({
637
+ ...ite,
638
+ order: filterItem.order,
639
+ fixed: filterItem.freeze,
640
+ freeze: filterItem.freeze,
641
+ isFixed: filterItem.freeze,
642
+ disabled: false,
643
+ isShown: filterItem.isShown,
644
+ });
645
+ } else {
646
+ notExistsList.push({
647
+ ...ite,
648
+ fixed: false, // 是否固定列
649
+ freeze: false, // 是否冻结列
650
+ disabled: false, // 是否禁用
651
+ isShown: false, // 是否显示隐藏
652
+ });
653
+ }
654
+ });
655
+ return [...list.sort((a, b) => a.order - b.order), ...notExistsList];
656
+ });
657
+ const saveData = async (val) => {
658
+ const list = val.map((item, index) => ({
659
+ ...item,
660
+ order: index + 1,
661
+ columnKey: item.isCustom ? item.columnKey : item.value,
662
+ isShown: item.isShown,
663
+ }));
664
+ await apiFunction
665
+ .updateColumnSettingNext({
666
+ data: [
667
+ {
668
+ displayId: '101000201',
669
+ configJson: {
670
+ displayId: '101000201',
671
+ columnSetting: list,
672
+ },
673
+ },
674
+ ],
675
+ })
676
+ .then((res) => {
677
+ if (res.data.code !== 0) {
678
+ ElMessage.error(t(res.data.message));
679
+ } else {
680
+ productionRef.value.reload();
681
+ internalColumnConfig.value = list;
682
+ }
683
+ });
684
+ };
685
+ const saveChildData = async (val) => {
686
+ console.log(val);
687
+ };
688
+ // 视图管理相关数据
689
+ const permissionData = ref({
690
+ permissionCode: 'PMC_101000',
691
+ docCode: 'doc_5',
692
+ });
693
+ const defaultCreateTimeString = ref('consDate');
694
+ // 初始化selectOptions
695
+ const selectOptions = ref({
696
+ // 默认操作符选项,确保即使API调用失败也能有基本功能
697
+ operatorOptions: [
698
+ { value: 1, label: 'greaterThan', sql: '>' },
699
+ { value: 2, label: 'greaterThanOrEqualTo', sql: '>=' },
700
+ { value: 3, label: 'lessThan', sql: '<' },
701
+ { value: 4, label: 'lessThanOrEqualTo', sql: '<=' },
702
+ { value: 5, label: 'equalTo', sql: '=' },
703
+ { value: 6, label: 'notEqualTo', sql: '!=' },
704
+ { value: 7, label: 'contains', sql: 'LIKE' },
705
+ { value: 8, label: 'notContains', sql: 'NOT LIKE' },
706
+ { value: 9, label: 'yesEmpty', sql: 'is' },
707
+ { value: 10, label: 'notEmpty', sql: 'is not' },
708
+ { value: 11, label: 'selectRange', sql: 'BETWEEN' },
709
+ { value: 12, label: 'dynamicFiltering', sql: 'BETWEEN' },
710
+ { value: 13, label: 'inRange', sql: 'BETWEEN' },
711
+ { value: 14, label: 'notInRange', sql: 'NOT BETWEEN' },
712
+ { value: 15, label: 'isOneOf', sql: 'IN' },
713
+ { value: 16, label: 'notAnyOf', sql: 'NOT IN' },
714
+ ],
715
+ fieldList: [], // 视图筛选字段列表
716
+ // 以下是需要下拉的字段名称,获取数据源渲染
717
+ // 命名方式为fieldList字段里的fieldKey+'Options'
718
+ materialCategoryOptions: [], // 物料类别选项
719
+ consUserNameOptions: [], // 员工选项
720
+ modiUserNameOptions: [], // 员工选项
721
+ });
722
+ // 获取视图筛选字段列表
723
+ const getViewFilterList = async () => {
724
+ try {
725
+ // 调用/V1/Internal/View/GetFieldList接口获取字段列表
726
+ const response = await apiFunction.getViewFilterList({
727
+ permissionCode: permissionData.value.permissionCode,
728
+ });
729
+
730
+ // 检查响应结构
731
+ if (!response || !response.data || response.data.code !== 0) {
732
+ ElMessage.error(response?.data?.message || '获取字段列表失败');
733
+ return;
734
+ }
735
+
736
+ const content = response.data.content;
737
+
738
+ // 调用querySetting接口获取自定义字段配置
739
+ const params = {
740
+ docCode: permissionData.value.docCode,
741
+ status: 1,
742
+ fieldName: '',
743
+ consDate: [],
744
+ startIndex: 0,
745
+ count: 100,
746
+ };
747
+ const customResponse = await apiFunction.querySetting(params);
748
+ // 解析系统字段列表
749
+ const fieldSettings = content.map((item) => {
750
+ // 解析JSON字符串格式的fieldSelectOptions
751
+ let fieldSelectOptions = [];
752
+ if (item.fieldSelectOptions) {
753
+ try {
754
+ fieldSelectOptions = JSON.parse(item.fieldSelectOptions);
755
+ } catch (error) {
756
+ fieldSelectOptions = [];
757
+ }
758
+ }
759
+ return {
760
+ fieldName: item.fieldName, // 使用fieldName作为显示名称
761
+ fieldKey: item.fieldKey,
762
+ fieldTypeId: item.fieldTypeId,
763
+ fieldSelectOptions: fieldSelectOptions,
764
+ key: item.fieldKey,
765
+ isDoc: false,
766
+ };
767
+ });
768
+ // 处理自定义字段
769
+ let docCustomSettings = [];
770
+ if (customResponse && customResponse.data && customResponse.data.code === 0 && customResponse.data.content.data) {
771
+ docCustomSettings = customResponse.data.content.data
772
+ .filter((it) => it.fieldTypeId !== 9) // 排除字段类型9
773
+ .map((item) => {
774
+ // 解析自定义字段的选项
775
+ let fieldSelectOptions = [];
776
+ if (item.fieldSelectOptions) {
777
+ try {
778
+ fieldSelectOptions = JSON.parse(item.fieldSelectOptions);
779
+ } catch (error) {
780
+ fieldSelectOptions = [];
781
+ }
782
+ }
783
+ return {
784
+ fieldName: item.fieldName,
785
+ fieldTypeId: item.fieldTypeId,
786
+ fieldSelectOptions: fieldSelectOptions,
787
+ key: item.docCustomId,
788
+ isDoc: true,
789
+ };
790
+ });
791
+ }
792
+
793
+ // 合并系统字段和自定义字段
794
+ const fieldList = [...fieldSettings, ...docCustomSettings];
795
+
796
+ // 构建第三列值选项
797
+ const valueOptions = {};
798
+
799
+ // 处理每个字段的选择选项
800
+ fieldList.forEach((field) => {
801
+ if (field.fieldSelectOptions && field.fieldSelectOptions.length > 0) {
802
+ // 格式化选择选项,同时支持对象数组和字符串数组两种格式
803
+ valueOptions[field.key] = field.fieldSelectOptions.map((option) => {
804
+ // 检查option的类型
805
+ if (typeof option === 'string') {
806
+ // 如果是字符串数组格式,使用字符串同时作为label和value
807
+ return {
808
+ label: option,
809
+ value: option,
810
+ };
811
+ } else {
812
+ // 如果是对象数组格式,使用key和value属性
813
+ return {
814
+ label: option.key,
815
+ value: option.value,
816
+ };
817
+ }
818
+ });
819
+ }
820
+ });
821
+
822
+ // 设置完整的selectOptions
823
+ selectOptions.value = {
824
+ ...selectOptions.value,
825
+ fieldList,
826
+ ...valueOptions,
827
+ };
828
+ console.log('数据源selectOptions初始化完成:', selectOptions.value);
829
+ } catch (error) {
830
+ console.error('获取数据源失败:', error);
831
+ ElMessage.error('获取数据源失败,请检查控制台日志');
832
+ }
833
+ };
834
+
835
+ // 获取物料类别数据
836
+ const initMaterialCategory = async () => {
837
+ try {
838
+ const {
839
+ data: { code, content, message },
840
+ } = await apiFunction.materialCategoryLastLevel();
841
+ if (code === 0) {
842
+ selectOptions.value.materialCategoryOptions =
843
+ content && content.length
844
+ ? content.map(({ id: value, materialCategoryName: label }) => ({ label, value }))
845
+ : [];
846
+ } else {
847
+ ElMessage.error(message);
848
+ }
849
+ } catch (error) {
850
+ console.error('获取物料类别数据失败:', error);
851
+ ElMessage.error('获取物料类别数据失败');
852
+ }
853
+ };
854
+
855
+ /* 获取全部人员 */
856
+ const getEmployeeList = async () => {
857
+ try {
858
+ let allData = [];
859
+ let totalCount = 0;
860
+ let currentPage = 0;
861
+ const pageSize = 200; // 每页数量
862
+ do {
863
+ const {
864
+ data: { code, content, message },
865
+ } = await apiFunction.getEmployeeList({
866
+ count: pageSize,
867
+ startIndex: currentPage * pageSize,
868
+ queryFilters: [],
869
+ });
870
+ if (code === 0) {
871
+ totalCount = content.totalCount;
872
+ allData = [...allData, ...content.data];
873
+ currentPage++;
874
+ } else {
875
+ ElMessage.error(message);
876
+ break;
877
+ }
878
+ } while (allData.length < totalCount);
879
+ selectOptions.value.consUserNameOptions = allData.map((item) => ({
880
+ label: `${item.name}/${item.account}`,
881
+ value: item.empID,
882
+ }));
883
+ selectOptions.value.consUserNameOptions.unshift({ label: '当前用户', value: '[-1]' });
884
+ selectOptions.value.modiUserNameOptions = allData.map((item) => ({
885
+ label: `${item.name}/${item.account}`,
886
+ value: item.empID,
887
+ }));
888
+ selectOptions.value.modiUserNameOptions.unshift({ label: '当前用户', value: '[-1]' });
889
+ } catch (error) {
890
+ console.error('获取全部人员失败:', error);
891
+ ElMessage.error('获取全部人员失败');
892
+ }
893
+ };
894
+ // 添加事件处理函数
895
+ const handlePermissionDataUpdate = (updatedPermissionData) => {
896
+ // 打印接收到的数据
897
+ pageData.viewId = updatedPermissionData.viewId;
898
+ productionRef.value.reload();
899
+ };
900
+ // 筛选查询
901
+ const handleFilterSearch = (filterData) => {
902
+ console.log('筛选条件数据:', filterData);
903
+ productionRef.value.reload();
904
+ };
905
+ // 顶部按钮--动态数据格式示例
906
+ const topButtons = ref([]);
907
+ const buttonList = ref([]);
908
+ // 调整按钮顺序的辅助函数
909
+ function moveDBeforeB(arr) {
910
+ const newArr = [...arr];
911
+ const indexA = newArr.findIndex((item) => item.permissionCode === 'PMC_101000_023');
912
+ const indexB = newArr.findIndex((item) => item.permissionCode === 'PMC_101000_009');
913
+
914
+ if (indexA === -1 || indexB === -1 || indexA < indexB) {
915
+ return newArr;
916
+ }
917
+
918
+ // 一步完成移除和插入
919
+ const dElement = newArr[indexA];
920
+ return [...newArr.slice(0, indexB), dElement, ...newArr.slice(indexB, indexA), ...newArr.slice(indexA + 1)];
921
+ }
922
+ // 获取按钮权限
923
+ async function getButtons() {
924
+ try {
925
+ const res = await apiFunction.QueryMyPermission({
926
+ permissionSource: 'web',
927
+ permissionCode: 'PMC_101000',
928
+ });
929
+ if (res.data?.code === 0) {
930
+ buttonList.value = moveDBeforeB(res.data.content);
931
+ } else {
932
+ ElMessage.error(t(res.data.message));
933
+ }
934
+ } catch (error) {
935
+ console.error('获取按钮权限失败:', error);
936
+ ElMessage.error('获取按钮权限失败');
937
+ }
938
+ }
939
+ // 按钮点击事件处理函数(需要根据实际业务实现)
940
+ const addPlan = () => {
941
+ console.log('新增按钮点击');
942
+ };
943
+
944
+ const handleImport = () => {
945
+ console.log('批量汇入按钮点击');
946
+ };
947
+
948
+ const handleExport = () => {
949
+ console.log('批量汇出按钮点击');
950
+ };
951
+
952
+ const multiTaskEdit = () => {
953
+ console.log('多工单编辑按钮点击');
954
+ };
955
+
956
+ const batchPrint = () => {
957
+ console.log('批量打印按钮点击');
958
+ };
959
+
960
+ const batchUpdate = () => {
961
+ console.log('批量更新按钮点击');
962
+ };
963
+
964
+ const deliveryOrder = () => {
965
+ console.log('派送工单按钮点击');
966
+ };
967
+
968
+ const returnWorkOrder = () => {
969
+ console.log('退回工单按钮点击');
970
+ };
971
+
972
+ const orderSharing = () => {
973
+ console.log('订单分享按钮点击');
974
+ };
975
+
976
+ const workOrderClosed = () => {
977
+ console.log('批量关闭按钮点击');
978
+ };
979
+
980
+ const antiClose = () => {
981
+ console.log('反关闭按钮点击');
982
+ };
983
+
984
+ const labelingIssuance = () => {
985
+ console.log('标签发行按钮点击');
986
+ };
987
+
988
+ const pushDown = () => {
989
+ console.log('下推按钮点击');
990
+ };
991
+
992
+ const associativeQueries = () => {
993
+ console.log('关联查询按钮点击');
994
+ };
995
+
996
+ const workingHoursCaculate = () => {
997
+ console.log('工时推算按钮点击');
998
+ };
999
+ const toBeFinished = () => {
1000
+ console.log('完工按钮点击');
1001
+ };
1002
+
1003
+ const printPreview = () => {
1004
+ console.log('打印预览按钮点击');
1005
+ };
1006
+
1007
+ const operationLog = () => {
1008
+ console.log('操作日志按钮点击');
1009
+ };
1010
+ // 监听按钮权限变化,动态生成按钮
1011
+ watch(
1012
+ () => buttonList.value,
1013
+ () => {
1014
+ if (buttonList.value && buttonList.value.length > 0) {
1015
+ // 临时存储不同类型的按钮
1016
+ const normalButtons = [];
1017
+ const batchButtons = [];
1018
+ const moreButtons = [];
1019
+ const advancedButtons = [];
1020
+
1021
+ // 根据权限生成按钮
1022
+ buttonList.value.forEach((it) => {
1023
+ switch (it.permissionCode) {
1024
+ // 新增
1025
+ case 'PMC_101000_001':
1026
+ normalButtons.push({
1027
+ key: 'add',
1028
+ label: t('add'),
1029
+ icon: 'mdi mdi-plus',
1030
+ type: 'primary',
1031
+ link: true,
1032
+ func: addPlan,
1033
+ });
1034
+ break;
1035
+ // 批量汇入
1036
+ case 'PMC_101000_002':
1037
+ batchButtons.push({
1038
+ key: 'batchImport',
1039
+ label: t('batchImport'),
1040
+ icon: 'mdi mdi-import',
1041
+ type: 'primary',
1042
+ link: true,
1043
+ func: handleImport,
1044
+ order: 1,
1045
+ });
1046
+ break;
1047
+ // 批量汇出
1048
+ case 'PMC_101000_003':
1049
+ batchButtons.push({
1050
+ key: 'batchExport',
1051
+ label: t('batchExport'),
1052
+ icon: 'mdi mdi-export',
1053
+ func: handleExport,
1054
+ type: 'primary',
1055
+ link: true,
1056
+ order: 2,
1057
+ });
1058
+ break;
1059
+ // 多工单编辑
1060
+ case 'PMC_101000_004':
1061
+ moreButtons.push({
1062
+ key: 'multiTaskEdit',
1063
+ label: t('multiTaskEdit'),
1064
+ icon: 'mdi mdi-table-edit',
1065
+ func: multiTaskEdit,
1066
+ type: 'primary',
1067
+ link: true,
1068
+ order: 1,
1069
+ });
1070
+ break;
1071
+ // 批量打印
1072
+ case 'PMC_101000_019':
1073
+ batchButtons.push({
1074
+ key: 'batchPrint',
1075
+ label: t('batchPrint'),
1076
+ icon: 'mdi mdi-cloud-print',
1077
+ func: batchPrint,
1078
+ type: 'primary',
1079
+ link: true,
1080
+ order: 4,
1081
+ });
1082
+ break;
1083
+ // 批量更新
1084
+ case 'PMC_101000_005':
1085
+ batchButtons.push({
1086
+ key: 'batchUpdate',
1087
+ label: t('batchUpdate'),
1088
+ icon: 'mdi mdi-file-document-refresh-outline',
1089
+ func: batchUpdate,
1090
+ type: 'primary',
1091
+ link: true,
1092
+ order: 3,
1093
+ });
1094
+ break;
1095
+ // 派送工单
1096
+ case 'PMC_101000_006':
1097
+ normalButtons.push({
1098
+ key: 'deliveryOrder',
1099
+ label: t('deliveryOrder'),
1100
+ icon: 'mdi mdi-sync',
1101
+ func: deliveryOrder,
1102
+ type: 'primary',
1103
+ link: true,
1104
+ order: 2,
1105
+ });
1106
+ break;
1107
+ // 退回工单
1108
+ case 'PMC_101000_007':
1109
+ moreButtons.push({
1110
+ key: 'returnWorkOrder',
1111
+ label: t('returnWorkOrder'),
1112
+ icon: 'mdi mdi-arrow-left-circle',
1113
+ func: returnWorkOrder,
1114
+ type: 'primary',
1115
+ link: true,
1116
+ order: 3,
1117
+ });
1118
+ break;
1119
+ // 订单分享
1120
+ case 'PMC_101000_008':
1121
+ moreButtons.push({
1122
+ key: 'orderSharing',
1123
+ label: t('orderSharing'),
1124
+ icon: 'mdi mdi-share',
1125
+ func: orderSharing,
1126
+ type: 'primary',
1127
+ link: true,
1128
+ order: 4,
1129
+ });
1130
+ break;
1131
+ // 批量关闭
1132
+ case 'PMC_101000_009':
1133
+ batchButtons.push({
1134
+ key: 'batchClose',
1135
+ label: t('batchClose'),
1136
+ icon: 'mdi mdi-close-circle',
1137
+ func: workOrderClosed,
1138
+ isFold: false,
1139
+ isBatch: true,
1140
+ type: 'primary',
1141
+ link: true,
1142
+ order: 5,
1143
+ });
1144
+ break;
1145
+ // 反关闭
1146
+ case 'PMC_101000_010':
1147
+ moreButtons.push({
1148
+ key: 'antiClose',
1149
+ label: t('antiClose'),
1150
+ icon: 'mdi mdi-minus-circle-off',
1151
+ func: antiClose,
1152
+ type: 'primary',
1153
+ link: true,
1154
+ order: 6,
1155
+ });
1156
+ break;
1157
+ // 标签发行
1158
+ case 'PMC_101000_011':
1159
+ advancedButtons.push({
1160
+ key: 'labelingIssuance',
1161
+ label: t('labelingIssuance'),
1162
+ icon: 'mdi mdi-label-multiple',
1163
+ func: labelingIssuance,
1164
+ type: 'primary',
1165
+ link: true,
1166
+ order: 1,
1167
+ });
1168
+ break;
1169
+ // 下推
1170
+ case 'PMC_101000_016':
1171
+ advancedButtons.push({
1172
+ key: 'pushDown',
1173
+ label: t('pushDown'),
1174
+ icon: 'mdi mdi-download-box',
1175
+ func: pushDown,
1176
+ type: 'primary',
1177
+ link: true,
1178
+ order: 3,
1179
+ });
1180
+ break;
1181
+ // 关联查询
1182
+ case 'PMC_101000_017':
1183
+ advancedButtons.push({
1184
+ key: 'associativeQueries',
1185
+ label: t('associativeQueries'),
1186
+ icon: 'mdi mdi-tag-search',
1187
+ func: associativeQueries,
1188
+ type: 'primary',
1189
+ link: true,
1190
+ order: 2,
1191
+ });
1192
+ break;
1193
+ // 工时推算
1194
+ case 'PMC_101000_018':
1195
+ advancedButtons.push({
1196
+ key: 'workingHoursCaculate',
1197
+ label: t('workingHoursCaculate'),
1198
+ icon: 'mdi mdi-pencil-box-multiple-outline',
1199
+ func: workingHoursCaculate,
1200
+ type: 'primary',
1201
+ link: true,
1202
+ order: 4,
1203
+ });
1204
+ break;
1205
+ // 完工
1206
+ case 'PMC_101000_020':
1207
+ moreButtons.push({
1208
+ key: 'toBeFinished',
1209
+ label: t('toBeFinished'),
1210
+ icon: 'mdi mdi-check-circle',
1211
+ func: toBeFinished,
1212
+ type: 'primary',
1213
+ link: true,
1214
+ order: 5,
1215
+ });
1216
+ break;
1217
+ // 打印预览
1218
+ case 'PMC_101000_021':
1219
+ moreButtons.push({
1220
+ key: 'printPreview',
1221
+ label: t('printPreview'),
1222
+ icon: 'mdi mdi-pencil-box-multiple-outline',
1223
+ func: printPreview,
1224
+ type: 'primary',
1225
+ link: true,
1226
+ order: 7,
1227
+ });
1228
+ break;
1229
+ // 操作日志
1230
+ case 'PMC_101000_022':
1231
+ advancedButtons.push({
1232
+ key: 'operationLog',
1233
+ label: t('operationLog'),
1234
+ icon: 'mdi mdi-history',
1235
+ func: operationLog,
1236
+ type: 'primary',
1237
+ link: true,
1238
+ order: 5,
1239
+ });
1240
+ break;
1241
+ // 可以根据实际需求添加更多按钮
1242
+ }
1243
+ });
1244
+
1245
+ // 生成最终的按钮配置
1246
+ topButtons.value = [];
1247
+
1248
+ // 添加普通按钮
1249
+ normalButtons.sort((a, b) => (a.order || 0) - (b.order || 0));
1250
+ topButtons.value.push(...normalButtons);
1251
+
1252
+ // 添加批量操作下拉菜单
1253
+ if (batchButtons.length > 0) {
1254
+ // 按order排序
1255
+ batchButtons.sort((a, b) => (a.order || 0) - (b.order || 0));
1256
+ topButtons.value.push({
1257
+ key: 'batchAction',
1258
+ label: t('batchAction'),
1259
+ icon: 'mdi mdi-format-list-bulleted',
1260
+ type: 'primary',
1261
+ link: true,
1262
+ dropdownItems: batchButtons,
1263
+ });
1264
+ }
1265
+
1266
+ // 添加更多操作下拉菜单
1267
+ if (moreButtons.length > 0) {
1268
+ // 按order排序
1269
+ moreButtons.sort((a, b) => (a.order || 0) - (b.order || 0));
1270
+ topButtons.value.push({
1271
+ key: 'moreActions',
1272
+ label: t('moreActions'),
1273
+ icon: 'mdi mdi-dots-horizontal-circle-outline',
1274
+ type: 'primary',
1275
+ link: true,
1276
+ dropdownItems: moreButtons,
1277
+ });
1278
+ }
1279
+
1280
+ // 添加三阶操作下拉菜单
1281
+ if (advancedButtons.length > 0) {
1282
+ // 按order排序
1283
+ advancedButtons.sort((a, b) => (a.order || 0) - (b.order || 0));
1284
+ topButtons.value.push({
1285
+ key: 'advancedOperation',
1286
+ label: t('advancedOperation'),
1287
+ icon: 'mdi mdi-format-list-bulleted',
1288
+ type: 'primary',
1289
+ link: true,
1290
+ dropdownItems: advancedButtons,
1291
+ });
1292
+ }
1293
+
1294
+ console.log('生成的按钮配置:', topButtons.value);
1295
+ }
1296
+ },
1297
+ { immediate: true },
1298
+ );
1299
+ onMounted(() => {
1300
+ getColumnConfig();
1301
+ getCustomFields();
1302
+ getViewFilterList();
1303
+ initMaterialCategory();
1304
+ getEmployeeList();
1305
+ getButtons();
1306
+ });
1307
+ </script>