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,884 @@
1
+ <template>
2
+ <div data-test-id="DIV-tAwtQk">
3
+ <workContentVue
4
+ ref="productionRef"
5
+ :table-loading="pageData.tableLoading"
6
+ :table-columns="canEditHeaders"
7
+ :total="pageData.total"
8
+ :custom-fields-list="pageData.customFieldsList"
9
+ :show-index="false"
10
+ permission-code="SFC_102011"
11
+ :permission-data="permissionData"
12
+ :select-options="selectOptions"
13
+ :default-create-time-string="defaultCreateTimeString"
14
+ :top-buttons="topButtons"
15
+ data-test-id="WORKCONTENTVUE-0n4eV4"
16
+ @columnsSaveData="saveData"
17
+ @columnsChildSaveData="saveChildData"
18
+ @reload="onReload"
19
+ @sortChange="onSortChange"
20
+ @selectionChange="onSelectionChange"
21
+ @cellClick="onCellClick"
22
+ @update:permissionData="handlePermissionDataUpdate"
23
+ @filterSearch="handleFilterSearch"
24
+ >
25
+ <!-- 可以访问row和index -->
26
+ <!-- 根据数据行状态自定义显示操作按钮 -->
27
+ <template #tableActions="{ row, index }">
28
+ <el-button
29
+ type="primary"
30
+ disabled
31
+ link
32
+ :data-test-id="`EL-BUTTON-zIjD0T-${index}`"
33
+ @click.stop="handleEdit(row, index)"
34
+ >
35
+ 编辑
36
+ </el-button>
37
+ <el-button type="info" link :data-test-id="`EL-BUTTON-prrEsr-${index}`" @click.stop="handleAdd(row, index)">
38
+ 详情
39
+ </el-button>
40
+ </template>
41
+ </workContentVue>
42
+ <workDetail ref="workDetailRef" data-test-id="WORKDETAIL-2aY0wA" />
43
+ </div>
44
+ </template>
45
+
46
+ <script setup>
47
+ import { ref, computed, reactive, onMounted, nextTick } from 'vue';
48
+ import { ElMessage } from 'element-plus';
49
+ import dayjs from 'dayjs';
50
+ import apiFunction from '@/scriptFiles/checkApiErrorMechanism';
51
+ // 组件导入
52
+ import workContentVue from '@/components/customTable/index.vue';
53
+ import materialInfo from './components/materialInfo.vue';
54
+ import rootCause from './components/rootCause.vue';
55
+ import workDetail from './components/workDetail.vue';
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
+ viewId: '', // 视图ID
70
+ });
71
+ // 视图管理相关数据
72
+ const permissionData = ref({
73
+ permissionCode: 'SFC_102011',
74
+ docCode: 'doc_6',
75
+ });
76
+ const internalColumnConfig = ref([]);
77
+ const workDetailRef = ref();
78
+ // 格式化工单状态
79
+ function formatStatus(status) {
80
+ switch (status) {
81
+ case 1:
82
+ return {
83
+ bgColor: '#1E88E5',
84
+ textColor: '#E3F2FD',
85
+ text: '待审核',
86
+ };
87
+ case 2:
88
+ return {
89
+ bgColor: 'rgb(224, 242, 241)',
90
+ textColor: 'rgb(96, 189, 181)',
91
+ text: '审核通过',
92
+ };
93
+ case 3:
94
+ return {
95
+ bgColor: 'rgb(238, 238, 238)',
96
+ textColor: 'rgb(167, 167, 167)',
97
+ text: '审核不通过',
98
+ };
99
+ default:
100
+ break;
101
+ }
102
+ }
103
+ function formatReportType(status) {
104
+ switch (status) {
105
+ case 1:
106
+ return '人工报工';
107
+ case 2:
108
+ return '设备报工';
109
+ default:
110
+ break;
111
+ }
112
+ }
113
+ const tableColumns = computed(() => [
114
+ {
115
+ text: '审核状态',
116
+ value: 'status',
117
+ isFixed: true, // 是否固定列
118
+ isShown: true, // 是否显示隐藏
119
+ disabled: true, // 是否禁用
120
+ freeze: false, // 是否冻结列
121
+ customizeFields: false,
122
+ formatterType: 'tags',
123
+ formatter: (row) => formatStatus(row.status),
124
+ },
125
+ {
126
+ text: '报工人员',
127
+ value: 'reportEmp',
128
+ isFixed: true, // 是否固定列
129
+ isShown: true, // 是否显示隐藏
130
+ disabled: true, // 是否禁用
131
+ freeze: false, // 是否冻结列
132
+ customizeFields: false,
133
+ },
134
+ {
135
+ text: '报工时间',
136
+ value: 'reportTime',
137
+ isFixed: false, // 是否固定列
138
+ isShown: true, // 是否显示隐藏
139
+ disabled: false, // 是否禁用
140
+ freeze: false, // 是否冻结列
141
+ customizeFields: false,
142
+ formatter: (row) => (row.reportTime ? dayjs(row.reportTime).format('YYYY-MM-DD HH:mm:ss') : '--'),
143
+ },
144
+ {
145
+ text: '报工方式',
146
+ value: 'reportType',
147
+ isFixed: false, // 是否固定列
148
+ isShown: true, // 是否显示隐藏
149
+ disabled: false, // 是否禁用
150
+ freeze: false, // 是否冻结列
151
+ customizeFields: false,
152
+ formatter: (row) => formatReportType(row.reportType),
153
+ },
154
+ {
155
+ text: '报工类型',
156
+ value: 'reportMethod',
157
+ isFixed: false, // 是否固定列
158
+ isShown: true, // 是否显示隐藏
159
+ disabled: false, // 是否禁用
160
+ freeze: false, // 是否冻结列
161
+ customizeFields: false,
162
+ },
163
+ {
164
+ text: '生产工单号',
165
+ value: 'orderNumber',
166
+ isFixed: false, // 是否固定列
167
+ isShown: true, // 是否显示隐藏
168
+ disabled: false, // 是否禁用
169
+ freeze: false, // 是否冻结列
170
+ customizeFields: false,
171
+ },
172
+ {
173
+ text: '生产数量',
174
+ value: 'partCount',
175
+ isFixed: false, // 是否固定列
176
+ isShown: true, // 是否显示隐藏
177
+ disabled: false, // 是否禁用
178
+ freeze: false, // 是否冻结列
179
+ customizeFields: false,
180
+ },
181
+ {
182
+ text: '良品数',
183
+ value: 'qualifiedNumber',
184
+ isFixed: false, // 是否固定列
185
+ isShown: true, // 是否显示隐藏
186
+ disabled: false, // 是否禁用
187
+ freeze: false, // 是否冻结列
188
+ customizeFields: false,
189
+ },
190
+ {
191
+ text: '不良品数',
192
+ value: 'defectiveNumber',
193
+ isFixed: false, // 是否固定列
194
+ isShown: true, // 是否显示隐藏
195
+ disabled: false, // 是否禁用
196
+ freeze: false, // 是否冻结列
197
+ customizeFields: false,
198
+ },
199
+ {
200
+ text: '报工开始时间',
201
+ value: 'startTime',
202
+ isFixed: false, // 是否固定列
203
+ isShown: true, // 是否显示隐藏
204
+ disabled: false, // 是否禁用
205
+ freeze: false, // 是否冻结列
206
+ customizeFields: false,
207
+ formatter: (row) => (row.startTime ? dayjs(row.startTime).format('YYYY-MM-DD HH:mm:ss') : '--'),
208
+ },
209
+ {
210
+ text: '报工结束时间',
211
+ value: 'endTime',
212
+ isFixed: false, // 是否固定列
213
+ isShown: true, // 是否显示隐藏
214
+ disabled: false, // 是否禁用
215
+ freeze: false, // 是否冻结列
216
+ customizeFields: false,
217
+ formatter: (row) =>
218
+ row.startTimeOfJobApplication ? dayjs(row.startTimeOfJobApplication).format('YYYY-MM-DD HH:mm:ss') : '--',
219
+ },
220
+ {
221
+ text: '流转标签号',
222
+ value: 'runCardNumber',
223
+ isFixed: false, // 是否固定列
224
+ isShown: true, // 是否显示隐藏
225
+ disabled: false, // 是否禁用
226
+ freeze: false, // 是否冻结列
227
+ customizeFields: false,
228
+ },
229
+ {
230
+ text: '产线/工段',
231
+ value: 'organizationName',
232
+ isFixed: false, // 是否固定列
233
+ isShown: true, // 是否显示隐藏
234
+ disabled: false, // 是否禁用
235
+ freeze: false, // 是否冻结列
236
+ customizeFields: false,
237
+ },
238
+ {
239
+ text: '工位代码',
240
+ value: 'workStationCode',
241
+ isFixed: false, // 是否固定列
242
+ isShown: true, // 是否显示隐藏
243
+ disabled: false, // 是否禁用
244
+ freeze: false, // 是否冻结列
245
+ customizeFields: false,
246
+ },
247
+ {
248
+ text: '工位名称',
249
+ value: 'workStationName',
250
+ isFixed: false, // 是否固定列
251
+ isShown: true, // 是否显示隐藏
252
+ disabled: false, // 是否禁用
253
+ freeze: false, // 是否冻结列
254
+ customizeFields: false,
255
+ },
256
+ {
257
+ text: '设备名称',
258
+ value: 'equipName',
259
+ isFixed: false, // 是否固定列
260
+ isShown: true, // 是否显示隐藏
261
+ disabled: false, // 是否禁用
262
+ freeze: false, // 是否冻结列
263
+ customizeFields: false,
264
+ },
265
+ {
266
+ text: '物料编号',
267
+ value: 'partNumber',
268
+ isFixed: false, // 是否固定列
269
+ isShown: true, // 是否显示隐藏
270
+ disabled: false, // 是否禁用
271
+ freeze: false, // 是否冻结列
272
+ customizeFields: false,
273
+ columntSlot: materialInfo, // tbody列插槽, 根据需求显示组件。如果同时配置formatter和columntSlot则columntSlot优先显示
274
+ },
275
+ {
276
+ text: '物料名称',
277
+ value: 'partName',
278
+ isFixed: false, // 是否固定列
279
+ isShown: true, // 是否显示隐藏
280
+ disabled: false, // 是否禁用
281
+ freeze: false, // 是否冻结列
282
+ customizeFields: false,
283
+ },
284
+ {
285
+ text: '规格型号',
286
+ value: 'materialSpec',
287
+ isFixed: false, // 是否固定列
288
+ isShown: true, // 是否显示隐藏
289
+ disabled: false, // 是否禁用
290
+ freeze: false, // 是否冻结列
291
+ customizeFields: false,
292
+ },
293
+ {
294
+ text: '工艺路线',
295
+ value: 'craftPathName',
296
+ isFixed: false, // 是否固定列
297
+ isShown: true, // 是否显示隐藏
298
+ disabled: false, // 是否禁用
299
+ freeze: false, // 是否冻结列
300
+ customizeFields: false,
301
+ },
302
+ {
303
+ text: '工序顺序',
304
+ value: 'processNumber',
305
+ isFixed: false, // 是否固定列
306
+ isShown: true, // 是否显示隐藏
307
+ disabled: false, // 是否禁用
308
+ freeze: false, // 是否冻结列
309
+ customizeFields: false,
310
+ },
311
+ {
312
+ text: '工序代码',
313
+ value: 'processCode',
314
+ isFixed: false, // 是否固定列
315
+ isShown: true, // 是否显示隐藏
316
+ disabled: false, // 是否禁用
317
+ freeze: false, // 是否冻结列
318
+ customizeFields: false,
319
+ },
320
+ {
321
+ text: '工序名称',
322
+ value: 'processName',
323
+ isFixed: false, // 是否固定列
324
+ isShown: true, // 是否显示隐藏
325
+ disabled: false, // 是否禁用
326
+ freeze: false, // 是否冻结列
327
+ customizeFields: false,
328
+ },
329
+ {
330
+ text: '工序需求数',
331
+ value: 'requiredThroughput',
332
+ isFixed: false, // 是否固定列
333
+ isShown: true, // 是否显示隐藏
334
+ disabled: false, // 是否禁用
335
+ freeze: false, // 是否冻结列
336
+ customizeFields: false,
337
+ },
338
+ {
339
+ text: '预计开工日(工序)',
340
+ value: 'expectedStartDate',
341
+ isFixed: false, // 是否固定列
342
+ isShown: true, // 是否显示隐藏
343
+ disabled: false, // 是否禁用
344
+ freeze: false, // 是否冻结列
345
+ customizeFields: false,
346
+ minWidth: 160,
347
+ formatter: (row) => (row.expectedStartDate ? dayjs(row.expectedStartDate).format('YYYY-MM-DD HH:mm:ss') : '--'),
348
+ },
349
+ {
350
+ text: '预计完工日(工序)',
351
+ value: 'expectedDueDate',
352
+ isFixed: false, // 是否固定列
353
+ isShown: true, // 是否显示隐藏
354
+ disabled: false, // 是否禁用
355
+ freeze: false, // 是否冻结列
356
+ customizeFields: false,
357
+ minWidth: 160,
358
+ formatter: (row) => (row.expectedDueDate ? dayjs(row.expectedDueDate).format('YYYY-MM-DD HH:mm:ss') : '--'),
359
+ },
360
+ {
361
+ text: '不良原因及数量',
362
+ value: 'defectiveProducts',
363
+ isFixed: false, // 是否固定列
364
+ isShown: true, // 是否显示隐藏
365
+ disabled: false, // 是否禁用
366
+ freeze: false, // 是否冻结列
367
+ customizeFields: false,
368
+ columntSlot: rootCause, // tbody列插槽, 根据需求显示组件。如果同时配置formatter和columntSlot则columntSlot优先显示
369
+ },
370
+ {
371
+ text: '审核人员',
372
+ value: 'reviewEmp',
373
+ isFixed: false, // 是否固定列
374
+ isShown: true, // 是否显示隐藏
375
+ disabled: false, // 是否禁用
376
+ freeze: false, // 是否冻结列
377
+ customizeFields: false,
378
+ },
379
+ {
380
+ text: '审核时间',
381
+ value: 'reviewTime',
382
+ isFixed: false, // 是否固定列
383
+ isShown: true, // 是否显示隐藏
384
+ disabled: false, // 是否禁用
385
+ freeze: false, // 是否冻结列
386
+ customizeFields: false,
387
+ formatter: (row) => (row.reviewTime ? dayjs(row.reviewTime).format('YYYY-MM-DD HH:mm:ss') : '--'),
388
+ },
389
+ {
390
+ text: '换料时间',
391
+ value: '1',
392
+ isFixed: false, // 是否固定列
393
+ isShown: true, // 是否显示隐藏
394
+ disabled: false, // 是否禁用
395
+ freeze: false, // 是否冻结列
396
+ customizeFields: false,
397
+ },
398
+ {
399
+ text: '调试时间',
400
+ value: '2',
401
+ isFixed: false, // 是否固定列
402
+ isShown: true, // 是否显示隐藏
403
+ disabled: false, // 是否禁用
404
+ freeze: false, // 是否冻结列
405
+ customizeFields: false,
406
+ },
407
+ {
408
+ text: '故障时间',
409
+ value: '3',
410
+ isFixed: false, // 是否固定列
411
+ isShown: true, // 是否显示隐藏
412
+ disabled: false, // 是否禁用
413
+ freeze: false, // 是否冻结列
414
+ customizeFields: false,
415
+ },
416
+ {
417
+ text: '待料时间',
418
+ value: '4',
419
+ isFixed: false, // 是否固定列
420
+ isShown: true, // 是否显示隐藏
421
+ disabled: false, // 是否禁用
422
+ freeze: false, // 是否冻结列
423
+ customizeFields: false,
424
+ },
425
+ {
426
+ text: '备注',
427
+ value: '5',
428
+ isFixed: false, // 是否固定列
429
+ isShown: true, // 是否显示隐藏
430
+ disabled: false, // 是否禁用
431
+ freeze: false, // 是否冻结列
432
+ customizeFields: false,
433
+ },
434
+ {
435
+ text: '标准工时',
436
+ value: '6',
437
+ isFixed: false, // 是否固定列
438
+ isShown: true, // 是否显示隐藏
439
+ disabled: false, // 是否禁用
440
+ freeze: false, // 是否冻结列
441
+ customizeFields: false,
442
+ },
443
+ {
444
+ text: '重量',
445
+ value: '7',
446
+ isFixed: false, // 是否固定列
447
+ isShown: true, // 是否显示隐藏
448
+ disabled: false, // 是否禁用
449
+ freeze: false, // 是否冻结列
450
+ customizeFields: false,
451
+ },
452
+ ]);
453
+ // 远程table列配置
454
+ function getColumnConfig() {
455
+ apiFunction
456
+ .queryColumnSettingNext({
457
+ displayIds: [102011201],
458
+ })
459
+ .then((res) => {
460
+ if (res.data.code === 0) {
461
+ const dataList = res.data.content.data;
462
+ if (dataList[0].displayId === 102011201 && dataList[0].configJson) {
463
+ pageData.columnConfig = dataList[0].configJson.columnSetting;
464
+ }
465
+ } else {
466
+ pageData.columnConfig = [];
467
+ }
468
+ })
469
+ .catch(() => {
470
+ pageData.columnConfig = [];
471
+ });
472
+ }
473
+ // 获取表格数据
474
+ async function onReload(params) {
475
+ try {
476
+ const paramsData = JSON.parse(JSON.stringify(params));
477
+ paramsData.orderSettingList = pageData.orderSettingList;
478
+ pageData.tableLoading = true;
479
+ paramsData.viewId = pageData.viewId;
480
+ const res = await apiFunction.GetReviewRecord(paramsData);
481
+ if (res.data.code === 0) {
482
+ const { result, count } = res.data.content;
483
+ productionRef.value.complete(result);
484
+ pageData.total = count.all;
485
+ } else {
486
+ ElMessage.error(res.data.detail || '获取数据失败');
487
+ pageData.total = 0;
488
+ }
489
+ } catch (error) {
490
+ console.error('加载表格数据失败:', error);
491
+ ElMessage.error('网络请求失败');
492
+ pageData.total = 0;
493
+ } finally {
494
+ pageData.tableLoading = false;
495
+ }
496
+ }
497
+ // 自定义排序
498
+ function onSortChange(val) {
499
+ const mapping = {
500
+ productionOrderExpectedStartDate: 3,
501
+ productionOrderExpectedDueDate: 4,
502
+ consDate: 6,
503
+ orderExpectedDue: 7,
504
+ modiDate: 8,
505
+ };
506
+ const orderSettingID = mapping[val.prop];
507
+ const orderSettingType = val.order === 'descending' ? 1 : 0;
508
+ if (pageData.orderSettingList.length === 2) {
509
+ pageData.orderSettingList.splice(1, 1);
510
+ }
511
+ if (val.order) {
512
+ pageData.orderSettingList.push({
513
+ orderSettingID,
514
+ orderSettingType,
515
+ });
516
+ }
517
+ productionRef.value.reload();
518
+ }
519
+ // const getCustomFields = async () => {
520
+ // const params = {
521
+ // docCode: 'doc_5',
522
+ // status: 1,
523
+ // fieldName: '',
524
+ // consDate: [],
525
+ // startIndex: 0,
526
+ // count: 100,
527
+ // };
528
+ // await apiFunction.querySetting(params).then((res) => {
529
+ // if (res.data.code === 0) {
530
+ // const customFieldData = res.data.content.data.map((ite) => ({
531
+ // ...ite,
532
+ // customFieldName: ite.fieldName,
533
+ // columnKey: ite.fieldName,
534
+ // customFieldId: ite.docCustomId,
535
+ // isCustom: true,
536
+ // isFixed: false,
537
+ // isShown: true,
538
+ // disabled: false,
539
+ // freeze: false,
540
+ // customizeFields: true,
541
+ // }));
542
+ // pageData.customFieldsList = customFieldData.map((item) => ({
543
+ // ...item,
544
+ // text: item.customFieldName,
545
+ // columnKey: item.customFieldName,
546
+ // align: 'index',
547
+ // sortable: false,
548
+ // value: item.customFieldId,
549
+ // class: 'parentTabColor white--text',
550
+ // width: '170px',
551
+ // customFieldId: item.docCustomId,
552
+ // fieldTypeId: item.fieldTypeId,
553
+ // }));
554
+ // }
555
+ // });
556
+ // };
557
+ // 行选中数据
558
+ function onSelectionChange(e) {
559
+ console.log(e);
560
+ }
561
+ // 单元格点击事件,返回row和cell
562
+ function onCellClick(e) {
563
+ console.log(e);
564
+ }
565
+ // 操作列-编辑
566
+ function handleEdit(row, index) {
567
+ console.log('edit', index, row);
568
+ }
569
+ // 操作列-新增
570
+ function handleAdd(row, index) {
571
+ workDetailRef.value.open();
572
+ console.log('add', index, row);
573
+ }
574
+ const canEditHeaders = computed(() => {
575
+ const allHeaderList = [
576
+ ...tableColumns.value.map((item) => ({
577
+ ...item,
578
+ isCustom: false,
579
+ columnKey: item.text,
580
+ })),
581
+ ...pageData.customFieldsList.map((item) => ({
582
+ ...item,
583
+ columnKey: item.fieldName,
584
+ isCustom: true,
585
+ })),
586
+ ];
587
+ const list = [];
588
+ if (!internalColumnConfig.value?.length) {
589
+ return allHeaderList;
590
+ }
591
+ const notExistsList = [];
592
+ allHeaderList.forEach((ite) => {
593
+ const filterItem = internalColumnConfig.value.find((el) => el.value === ite.value);
594
+ if (filterItem) {
595
+ list.push({
596
+ ...ite,
597
+ order: filterItem.order,
598
+ fixed: filterItem.freeze,
599
+ freeze: filterItem.freeze,
600
+ isFixed: filterItem.freeze,
601
+ disabled: false,
602
+ isShown: filterItem.isShown,
603
+ });
604
+ } else {
605
+ notExistsList.push({
606
+ ...ite,
607
+ fixed: false, // 是否固定列
608
+ freeze: false, // 是否冻结列
609
+ disabled: false, // 是否禁用
610
+ isShown: false, // 是否显示隐藏
611
+ });
612
+ }
613
+ });
614
+ return [...list.sort((a, b) => a.order - b.order), ...notExistsList];
615
+ });
616
+ // 列配置目前只做了显示,修改没处理
617
+ const saveData = async () => {
618
+ // const list = val.map((item, index) => ({
619
+ // ...item,
620
+ // order: index + 1,
621
+ // columnKey: item.isCustom ? item.columnKey : item.value,
622
+ // isShown: item.isShown,
623
+ // }));
624
+ // await apiFunction
625
+ // .updateColumnSettingNext({
626
+ // data: [
627
+ // {
628
+ // displayId: '102011201',
629
+ // configJson: {
630
+ // displayId: '102011201',
631
+ // columnSetting: list,
632
+ // },
633
+ // },
634
+ // ],
635
+ // })
636
+ // .then((res) => {
637
+ // if (res.data.code !== 0) {
638
+ // ElMessage.error(t(res.data.message));
639
+ // } else {
640
+ // productionRef.value.reload();
641
+ // }
642
+ // });
643
+ };
644
+ const saveChildData = async (val) => {
645
+ console.log(val);
646
+ };
647
+ // 初始化selectOptions
648
+ const defaultCreateTimeString = 'createTime';
649
+ const selectOptions = ref({
650
+ // 默认操作符选项,确保即使API调用失败也能有基本功能
651
+ operatorOptions: [
652
+ { value: 1, label: 'greaterThan', sql: '>' },
653
+ { value: 2, label: 'greaterThanOrEqualTo', sql: '>=' },
654
+ { value: 3, label: 'lessThan', sql: '<' },
655
+ { value: 4, label: 'lessThanOrEqualTo', sql: '<=' },
656
+ { value: 5, label: 'equalTo', sql: '=' },
657
+ { value: 6, label: 'notEqualTo', sql: '!=' },
658
+ { value: 7, label: 'contains', sql: 'LIKE' },
659
+ { value: 8, label: 'notContains', sql: 'NOT LIKE' },
660
+ { value: 9, label: 'yesEmpty', sql: 'is' },
661
+ { value: 10, label: 'notEmpty', sql: 'is not' },
662
+ { value: 11, label: 'selectRange', sql: 'BETWEEN' },
663
+ { value: 12, label: 'dynamicFiltering', sql: 'BETWEEN' },
664
+ { value: 13, label: 'inRange', sql: 'BETWEEN' },
665
+ { value: 14, label: 'notInRange', sql: 'NOT BETWEEN' },
666
+ { value: 15, label: 'isOneOf', sql: 'IN' },
667
+ { value: 16, label: 'notAnyOf', sql: 'NOT IN' },
668
+ ],
669
+ fieldList: [
670
+ {
671
+ fieldName: '创建时间',
672
+ fieldKey: 'createTime',
673
+ fieldTypeId: 3,
674
+ fieldSelectOptions: [],
675
+ key: 'createTime',
676
+ isDoc: false,
677
+ },
678
+ ], // 视图筛选字段列表
679
+ // 以下是需要下拉的字段名称,获取数据源渲染
680
+ // 命名方式为fieldList字段里的fieldKey+'Options'
681
+ reportEmpOptions: [], // 员工选项
682
+ reviewPersonOptions: [], // 员工选项
683
+ });
684
+ // 获取视图筛选字段列表
685
+ const getViewFilterList = async () => {
686
+ try {
687
+ // 调用/V1/Internal/View/GetFieldList接口获取字段列表
688
+ const response = await apiFunction.getViewFilterList({
689
+ permissionCode: permissionData.value.permissionCode,
690
+ });
691
+
692
+ // 检查响应结构
693
+ if (!response || !response.data || response.data.code !== 0) {
694
+ ElMessage.error(response?.data?.message || '获取字段列表失败');
695
+ return;
696
+ }
697
+
698
+ const content = response.data.content;
699
+
700
+ // 调用querySetting接口获取自定义字段配置
701
+ const params = {
702
+ docCode: permissionData.value.docCode,
703
+ status: 1,
704
+ fieldName: '',
705
+ consDate: [],
706
+ startIndex: 0,
707
+ count: 100,
708
+ };
709
+ const customResponse = await apiFunction.querySetting(params);
710
+ // 解析系统字段列表
711
+ const fieldSettings = content.map((item) => {
712
+ // 解析JSON字符串格式的fieldSelectOptions
713
+ let fieldSelectOptions = [];
714
+ if (item.fieldSelectOptions) {
715
+ try {
716
+ fieldSelectOptions = JSON.parse(item.fieldSelectOptions);
717
+ } catch (error) {
718
+ fieldSelectOptions = [];
719
+ }
720
+ }
721
+ return {
722
+ fieldName: item.fieldName, // 使用fieldName作为显示名称
723
+ fieldKey: item.fieldKey,
724
+ fieldTypeId: item.fieldTypeId,
725
+ fieldSelectOptions: fieldSelectOptions,
726
+ key: item.fieldKey,
727
+ isDoc: false,
728
+ };
729
+ });
730
+ // 处理自定义字段
731
+ let docCustomSettings = [];
732
+ if (customResponse && customResponse.data && customResponse.data.code === 0 && customResponse.data.content.data) {
733
+ docCustomSettings = customResponse.data.content.data
734
+ .filter((it) => it.fieldTypeId !== 9) // 排除字段类型9
735
+ .map((item) => {
736
+ // 解析自定义字段的选项
737
+ let fieldSelectOptions = [];
738
+ if (item.fieldSelectOptions) {
739
+ try {
740
+ fieldSelectOptions = JSON.parse(item.fieldSelectOptions);
741
+ } catch (error) {
742
+ fieldSelectOptions = [];
743
+ }
744
+ }
745
+ return {
746
+ fieldName: item.fieldName,
747
+ fieldTypeId: item.fieldTypeId,
748
+ fieldSelectOptions: fieldSelectOptions,
749
+ key: item.docCustomId,
750
+ isDoc: true,
751
+ };
752
+ });
753
+ }
754
+
755
+ // 合并系统字段和自定义字段
756
+ const fieldList = [...fieldSettings, ...docCustomSettings];
757
+
758
+ // 构建第三列值选项
759
+ const valueOptions = {};
760
+
761
+ // 处理每个字段的选择选项
762
+ fieldList.forEach((field) => {
763
+ if (field.fieldSelectOptions && field.fieldSelectOptions.length > 0) {
764
+ // 格式化选择选项,同时支持对象数组和字符串数组两种格式
765
+ valueOptions[field.key] = field.fieldSelectOptions.map((option) => {
766
+ // 检查option的类型
767
+ if (typeof option === 'string') {
768
+ // 如果是字符串数组格式,使用字符串同时作为label和value
769
+ return {
770
+ label: option,
771
+ value: option,
772
+ };
773
+ } else {
774
+ // 如果是对象数组格式,使用key和value属性
775
+ return {
776
+ label: option.key,
777
+ value: option.value,
778
+ };
779
+ }
780
+ });
781
+ }
782
+ });
783
+
784
+ // 设置完整的selectOptions
785
+ selectOptions.value = {
786
+ ...selectOptions.value,
787
+ fieldList,
788
+ ...valueOptions,
789
+ };
790
+ console.log('数据源selectOptions初始化完成:', selectOptions.value);
791
+ } catch (error) {
792
+ console.error('获取数据源失败:', error);
793
+ ElMessage.error('获取数据源失败,请检查控制台日志');
794
+ }
795
+ };
796
+ /* 获取全部人员 */
797
+ const getEmployeeList = async () => {
798
+ try {
799
+ let allData = [];
800
+ let totalCount = 0;
801
+ let currentPage = 0;
802
+ const pageSize = 200; // 每页数量
803
+ do {
804
+ const {
805
+ data: { code, content, message },
806
+ } = await apiFunction.getEmployeeList({
807
+ count: pageSize,
808
+ startIndex: currentPage * pageSize,
809
+ queryFilters: [],
810
+ });
811
+ if (code === 0) {
812
+ totalCount = content.totalCount;
813
+ allData = [...allData, ...content.data];
814
+ currentPage++;
815
+ } else {
816
+ ElMessage.error(message);
817
+ break;
818
+ }
819
+ } while (allData.length < totalCount);
820
+ selectOptions.value.reportEmpOptions = allData.map((item) => ({
821
+ label: `${item.name}/${item.account}`,
822
+ value: item.empID,
823
+ }));
824
+ selectOptions.value.reportEmpOptions.unshift({ label: '当前用户', value: '[-1]' });
825
+ selectOptions.value.reviewPersonOptions = allData.map((item) => ({
826
+ label: `${item.name}/${item.account}`,
827
+ value: item.empID,
828
+ }));
829
+ selectOptions.value.reviewPersonOptions.unshift({ label: '当前用户', value: '[-1]' });
830
+ } catch (error) {
831
+ console.error('获取全部人员失败:', error);
832
+ ElMessage.error('获取全部人员失败');
833
+ }
834
+ };
835
+ // 添加事件处理函数
836
+ const handlePermissionDataUpdate = (updatedPermissionData) => {
837
+ // 打印接收到的数据
838
+ pageData.viewId = updatedPermissionData.viewId;
839
+ productionRef.value.reload();
840
+ };
841
+ // 筛选查询
842
+ const handleFilterSearch = (filterData) => {
843
+ console.log('筛选条件数据:', filterData);
844
+ productionRef.value.reload();
845
+ };
846
+ const topButtons = [
847
+ {
848
+ label: '审核通过',
849
+ icon: '',
850
+ link: true,
851
+ func: () => {
852
+ console.log('审核通过');
853
+ },
854
+ },
855
+ {
856
+ label: '审核不通过',
857
+ icon: '',
858
+ link: true,
859
+ func: () => {
860
+ console.log('审核不通过');
861
+ },
862
+ },
863
+ {
864
+ label: 'Excel导出',
865
+ icon: '',
866
+ link: true,
867
+ func: () => {
868
+ console.log('Excel导出');
869
+ },
870
+ },
871
+ ];
872
+
873
+ onMounted(() => {
874
+ getColumnConfig();
875
+ // getCustomFields();
876
+ getViewFilterList();
877
+ getEmployeeList();
878
+ nextTick(() => {
879
+ const tableContent = productionRef.value.tableContentRef;
880
+ const tableRef = tableContent.tableRef;
881
+ console.log(tableRef);
882
+ });
883
+ });
884
+ </script>