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,2174 @@
1
+ <template>
2
+ <div data-test-id="DIV-CHFzZk">
3
+ <pageContent v-loading="loadingShow" :is-tab="false" :is-view="true" data-test-id="PAGECONTENT-izX8Nl">
4
+ <template #viewContent>
5
+ <viewTabs
6
+ ref="viewTabsRef"
7
+ :key="tabKey"
8
+ :page-data="permissionData"
9
+ :view-type="isCanOperation"
10
+ :tabs="allViewTabs"
11
+ :view-id-from-list="viewIdFromList"
12
+ data-test-id="VIEWTABS-Q9kTH3"
13
+ @tabClick="handleTabClick"
14
+ @openLogDrawer="openViewRecordDrawer"
15
+ @openViewDrawer="openViewListDrawer"
16
+ @tabUpdate="handleTabUpdate"
17
+ />
18
+ </template>
19
+ <template #searchContent>
20
+ <customFilter
21
+ ref="querySearchRef"
22
+ :can-edit-headers="canEditHeaders"
23
+ data-test-id="CUSTOMFILTER-7SqxcZ"
24
+ :permission-code="'PMC_101000'"
25
+ @filterSearch="query"
26
+ @parentSaveData="saveData"
27
+ />
28
+ </template>
29
+ <template #headerContent>
30
+ <div
31
+ v-for="item in topButtons.filter((it) => !it.isFold && !it.isBatch && !it.isAdvanced)"
32
+ :key="item.key"
33
+ data-test-id="DIV-PSkh9W"
34
+ >
35
+ <el-button link type="primary" data-test-id="EL-BUTTON-W21EYJ" @click="item.func()">
36
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-u6sfaW" />
37
+ {{ t(item.describe) }}
38
+ </el-button>
39
+ </div>
40
+ <!-- 批量操作 -->
41
+ <el-dropdown
42
+ v-if="topButtons.filter((it) => it.isBatch).length"
43
+ ref="dropdownRef"
44
+ :hide-on-click="false"
45
+ trigger="click"
46
+ data-test-id="EL-DROPDOWN-KOLxvB"
47
+ >
48
+ <el-button link type="primary" data-test-id="EL-BUTTON-uL3lAP">
49
+ <v-icon class="mdi mdi-format-list-bulleted" style="margin-right: 0.5rem" data-test-id="V-ICON-6WYKtV" />
50
+ {{ t('batchOperation') }}
51
+ </el-button>
52
+ <template #dropdown>
53
+ <el-dropdown-menu data-test-id="EL-DROPDOWN-MENU-fP2RDK">
54
+ <el-dropdown-item
55
+ v-for="item in topButtons.filter((it) => it.isBatch).sort((a, b) => a.order - b.order)"
56
+ :key="item.key"
57
+ data-test-id="EL-DROPDOWN-ITEM-BHWWZO"
58
+ >
59
+ <el-button link type="primary" data-test-id="EL-BUTTON-tirddF" @click="item.func(item.type)">
60
+ <div
61
+ v-if="!conditionalRequirements(item)"
62
+ style="display: flex; align-items: center"
63
+ data-test-id="DIV-pPQOZG"
64
+ >
65
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-5ULA2e" />
66
+ {{ t(item.describe) }}
67
+ </div>
68
+ <el-tooltip
69
+ v-else
70
+ :content="conditionalRequirements(item)"
71
+ placement="top"
72
+ :enterable="false"
73
+ data-test-id="EL-TOOLTIP-06r65V"
74
+ >
75
+ <div style="display: flex; align-items: center" data-test-id="DIV-MrnYf0">
76
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-gBKlq2" />
77
+ {{ t(item.describe) }}
78
+ </div>
79
+ </el-tooltip>
80
+ </el-button>
81
+ </el-dropdown-item>
82
+ </el-dropdown-menu>
83
+ </template>
84
+ </el-dropdown>
85
+ <!-- 更多操作 -->
86
+ <el-dropdown
87
+ v-if="topButtons.filter((it) => it.isFold).length"
88
+ ref="dropdownRef"
89
+ :hide-on-click="false"
90
+ trigger="click"
91
+ data-test-id="EL-DROPDOWN-EJWfJj"
92
+ >
93
+ <el-button link type="primary" data-test-id="EL-BUTTON-2AAYEN">
94
+ <v-icon
95
+ class="mdi mdi-dots-horizontal-circle-outline"
96
+ style="margin-right: 0.5rem"
97
+ data-test-id="V-ICON-5TLIK9"
98
+ />
99
+ {{ t('moreActions') }}
100
+ </el-button>
101
+ <template #dropdown>
102
+ <el-dropdown-menu data-test-id="EL-DROPDOWN-MENU-yjg6mt">
103
+ <el-dropdown-item
104
+ v-for="item in topButtons.filter((it) => it.isFold === true).sort((a, b) => a.order - b.order)"
105
+ :key="item.key"
106
+ data-test-id="EL-DROPDOWN-ITEM-m1enDJ"
107
+ >
108
+ <el-button link type="primary" data-test-id="EL-BUTTON-WJ2TmP" @click="item.func(item.type)">
109
+ <div
110
+ v-if="!conditionalRequirements(item)"
111
+ style="display: flex; align-items: center"
112
+ data-test-id="DIV-OZ8ZH4"
113
+ >
114
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-FFdWil" />
115
+ {{ t(item.describe) }}
116
+ </div>
117
+ <el-tooltip
118
+ v-else
119
+ :content="conditionalRequirements(item)"
120
+ placement="top"
121
+ :enterable="false"
122
+ data-test-id="EL-TOOLTIP-3i726d"
123
+ >
124
+ <div style="display: flex; align-items: center" data-test-id="DIV-gke81Q">
125
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-s8xdOz" />
126
+ {{ t(item.describe) }}
127
+ </div>
128
+ </el-tooltip>
129
+ </el-button>
130
+ </el-dropdown-item>
131
+ </el-dropdown-menu>
132
+ </template>
133
+ </el-dropdown>
134
+ <!-- 进阶操作 -->
135
+ <el-dropdown
136
+ v-if="topButtons.filter((it) => it.isAdvanced).length"
137
+ ref="dropdownRef"
138
+ :hide-on-click="false"
139
+ trigger="click"
140
+ data-test-id="EL-DROPDOWN-RK0HII"
141
+ >
142
+ <el-button link type="primary" data-test-id="EL-BUTTON-BPBjDD">
143
+ <v-icon class="mdi mdi-format-list-bulleted" style="margin-right: 0.5rem" data-test-id="V-ICON-hGQVCU" />
144
+ {{ t('advancedOperation') }}
145
+ </el-button>
146
+ <template #dropdown>
147
+ <el-dropdown-menu data-test-id="EL-DROPDOWN-MENU-EmB3sR">
148
+ <el-dropdown-item
149
+ v-for="item in topButtons.filter((it) => it.isAdvanced).sort((a, b) => a.order - b.order)"
150
+ :key="item.key"
151
+ data-test-id="EL-DROPDOWN-ITEM-n7j8U8"
152
+ >
153
+ <el-button link type="primary" data-test-id="EL-BUTTON-tirddF" @click="item.func()">
154
+ <div
155
+ v-if="!conditionalRequirements(item)"
156
+ style="display: flex; align-items: center"
157
+ data-test-id="DIV-UfDjKO"
158
+ >
159
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-mn4JnI" />
160
+ {{ t(item.describe) }}
161
+ </div>
162
+ <el-tooltip
163
+ v-else
164
+ :content="conditionalRequirements(item)"
165
+ placement="top"
166
+ :enterable="false"
167
+ data-test-id="EL-TOOLTIP-Qvpo5M"
168
+ >
169
+ <div style="display: flex; align-items: center" data-test-id="DIV-BkjGeh">
170
+ <v-icon :class="item.icon" style="margin-right: 0.5rem" data-test-id="V-ICON-a7Ae5f" />
171
+ {{ t(item.describe) }}
172
+ </div>
173
+ </el-tooltip>
174
+ </el-button>
175
+ </el-dropdown-item>
176
+ </el-dropdown-menu>
177
+ </template>
178
+ </el-dropdown>
179
+ </template>
180
+ <template #tableContent>
181
+ <el-table
182
+ ref="multipleTableRef"
183
+ v-loading="tableLoading"
184
+ v-shift-select:multipleTableRef
185
+ border
186
+ style="margin-bottom: 1rem"
187
+ :data="dessertsList"
188
+ height="100%"
189
+ header-row-class-name="tableHeader"
190
+ header-cell-class-name="tableHeaderCell"
191
+ scrollbar-always-on
192
+ data-test-id="EL-TABLE-iLns7K"
193
+ :summary-method="
194
+ function (param) {
195
+ return summation.getSummaries(param, customFieldsList, [
196
+ 'productionOrderRequiredThroughput',
197
+ 'inboundQuantity',
198
+ 'returnQuantity',
199
+ 'inboundRemain',
200
+ ]);
201
+ }
202
+ "
203
+ show-summary
204
+ :default-sort="{ prop: 'consDate', order: 'descending' }"
205
+ @selection-change="handleSelectionChange"
206
+ @cell-mouse-enter="handleCellMouseEnter"
207
+ @cell-mouse-Leave="handleCellMouseLeave"
208
+ @sort-change="handleSortChange"
209
+ @row-click="handleRowClick"
210
+ >
211
+ <el-table-column
212
+ align="center"
213
+ fixed="left"
214
+ type="selection"
215
+ width="60"
216
+ data-test-id="EL-TABLE-COLUMN-EV5MI4"
217
+ />
218
+ <el-table-column
219
+ align="center"
220
+ label="#"
221
+ fixed
222
+ type="index"
223
+ width="70"
224
+ show-overflow-tooltip
225
+ data-test-id="EL-TABLE-COLUMN-OPEP89"
226
+ >
227
+ <template #default="scope">
228
+ <span data-test-id="SPAN-XdHSqC">{{ calcIndex(scope.$index) }}</span>
229
+ </template>
230
+ </el-table-column>
231
+ <el-table-column
232
+ v-for="item in tableHeaders"
233
+ :key="String(item.value)"
234
+ :prop="String(item.value)"
235
+ :fixed="item.isFixed ? 'left' : false"
236
+ :label="item.text"
237
+ :sortable="
238
+ [
239
+ 'consDate',
240
+ 'modiDate',
241
+ 'orderExpectedDue',
242
+ 'productionOrderExpectedStartDate',
243
+ 'productionOrderExpectedDueDate',
244
+ ].includes(item.value)
245
+ ? 'custom'
246
+ : false
247
+ "
248
+ align="center"
249
+ show-overflow-tooltip
250
+ :min-width="
251
+ ['orderExpectedDue', 'productionOrderExpectedStartDate', 'productionOrderExpectedDueDate'].includes(
252
+ item.value,
253
+ )
254
+ ? 140
255
+ : 120
256
+ "
257
+ :width="item.isCustom ? getColumnWidth(item.text, String(item.value), dessertsList, 200) : 'auto'"
258
+ data-test-id="EL-TABLE-COLUMN-SRbkra"
259
+ >
260
+ <template #header>
261
+ <span v-if="item.value === 'productionOrderPriority'" data-test-id="SPAN-xb7qiL">
262
+ {{ item.text }}
263
+ <el-tooltip placement="top" effect="light" data-test-id="EL-TOOLTIP-FB51l8">
264
+ <i class="mdi mdi-information" data-test-id="I-LHAacq" />
265
+ <template #content>
266
+ <div v-for="(value, key, index) in priorityStatus" :key="index" data-test-id="DIV-RFpwHc">
267
+ <v-icon
268
+ :class="getPriorityIcon(value)"
269
+ :style="`color: ${getPriorityColor(value)};`"
270
+ data-test-id="V-ICON-ZdtNsf"
271
+ />
272
+ <span style="color: black; padding: 5px" data-test-id="SPAN-oEOumL">{{ t(`${key}`) }}</span>
273
+ </div>
274
+ </template>
275
+ </el-tooltip>
276
+ </span>
277
+ <span v-else-if="item.text.length > 16" data-test-id="SPAN-3cIjB7">
278
+ <el-tooltip :content="item.text" placement="top" :enterable="false" data-test-id="EL-TOOLTIP-r1wgMI">
279
+ {{ item.text.slice(0, 16) }}...
280
+ </el-tooltip>
281
+ </span>
282
+ <span v-else data-test-id="SPAN-snsDYW">
283
+ {{ item.text }}
284
+ <el-tooltip
285
+ v-if="item.fieldTypeId === 9"
286
+ data-test-id="EL-TOOLTIP-SADWo"
287
+ class="box-item"
288
+ effect="dark"
289
+ :content="fieldToText(item)"
290
+ placement="top"
291
+ >
292
+ <v-icon class="mdi mdi-information" data-test-id="V-ICON-ASDWD-DWDAq" />
293
+ </el-tooltip>
294
+ </span>
295
+ </template>
296
+ <template #default="scope">
297
+ <span v-if="item.isCustom" data-test-id="SPAN-RWld6r">
298
+ <span
299
+ v-if="item.fieldTypeId === 5"
300
+ data-test-id="SPAN-SELaOu"
301
+ @click="handleClickPreview(item.customFieldId, scope.row.docCustomFieldAndValues)"
302
+ >
303
+ <div
304
+ v-for="(fileItem, fileItemIndex) in getValue(item.customFieldId, scope.row.docCustomFieldAndValues)"
305
+ :key="fileItemIndex"
306
+ :style="
307
+ getValue(item.customFieldId, scope.row.docCustomFieldAndValues) === '-'
308
+ ? {}
309
+ : { color: '#125088', cursor: 'pointer' }
310
+ "
311
+ class="ellipsis-single-line"
312
+ data-test-id="DIV-EU7OcV"
313
+ >
314
+ {{ fileItem
315
+ }}<span
316
+ v-if="fileItemIndex < getValue(item.customFieldId, scope.row.docCustomFieldAndValues).length - 1"
317
+ data-test-id="SPAN-3XEGH8"
318
+ >,
319
+ </span>
320
+ </div>
321
+ </span>
322
+ <span
323
+ v-else-if="
324
+ item.fieldTypeId === 6 && getValue(item.customFieldId, scope.row.docCustomFieldAndValues) !== '-'
325
+ "
326
+ class="a-text-class"
327
+ data-test-id="SPAN-MhG75h"
328
+ @click="hyperLinkClick(item, scope.row.docCustomFieldAndValues)"
329
+ >
330
+ {{ getValue(item.customFieldId, scope.row.docCustomFieldAndValues) }}
331
+ </span>
332
+ <span
333
+ v-else-if="
334
+ item.fieldTypeId === 7 && getValue(item.customFieldId, scope.row.docCustomFieldAndValues) !== '-'
335
+ "
336
+ data-test-id="SPAN-qOqzQw"
337
+ >
338
+ <el-tag type="info" style="margin-right: 0.5rem" round data-test-id="EL-TAG-UOwz6R">
339
+ {{ getValue(item.customFieldId, scope.row.docCustomFieldAndValues) }}
340
+ </el-tag>
341
+ </span>
342
+ <span
343
+ v-else-if="
344
+ item.fieldTypeId === 8 && getValue(item.customFieldId, scope.row.docCustomFieldAndValues) !== '-'
345
+ "
346
+ data-test-id="SPAN-xCDH3f"
347
+ >
348
+ <el-tag
349
+ v-for="(multipleItem, multipleItemIndex) in getValue(
350
+ item.customFieldId,
351
+ scope.row.docCustomFieldAndValues,
352
+ )"
353
+ :key="multipleItemIndex"
354
+ type="info"
355
+ style="margin-right: 0.5rem"
356
+ round
357
+ data-test-id="EL-TAG-6Tq8m3"
358
+ >
359
+ {{ multipleItem }}
360
+ </el-tag>
361
+ </span>
362
+ <span v-else-if="item.fieldTypeId === 9" data-test-id="SPAN-uyqrrqwftkV">
363
+ {{ getValue(item.customFieldId, scope.row.docCustomFieldAndValues) }}
364
+ </span>
365
+ <span v-else data-test-id="SPAN-uyqrkV">
366
+ {{ getValue(item.customFieldId, scope.row.docCustomFieldAndValues) }}
367
+ </span>
368
+ </span>
369
+ <span v-if="item.value === 'originalOrderType'" data-test-id="SPAN-yJo5oK">
370
+ {{
371
+ scope.row[item.value] === 1
372
+ ? t('productionPlanList')
373
+ : scope.row[item.value] === 2
374
+ ? t('saleOrder')
375
+ : '-'
376
+ }}
377
+ </span>
378
+ <span v-if="item.value === 'originalOrderNumber'" data-test-id="SPAN-i9U4Uc">
379
+ {{ scope.row.productionPlanNumber ? scope.row.productionPlanNumber : '-' }}
380
+ </span>
381
+ <span v-if="item.value === 'orderExpectedDue'" data-test-id="SPAN-uN7zIj">
382
+ {{ scope.row.orderExpectedDue ? dayjs(scope.row.orderExpectedDue).format('YYYY-MM-DD') : '--' }}
383
+ </span>
384
+ <span v-if="item.value === 'productionOrderExpectedStartDate'" data-test-id="SPAN-gSzuJR">
385
+ {{
386
+ scope.row.productionOrderExpectedStartDate
387
+ ? dayjs(scope.row.productionOrderExpectedStartDate).format('YYYY-MM-DD')
388
+ : '--'
389
+ }}
390
+ </span>
391
+ <span v-if="item.value === 'productionOrderStatus'" data-test-id="SPAN-STqv4M">
392
+ <el-tag
393
+ :style="`color:${tagStatusColor(scope.row.productionOrderStatus)}`"
394
+ style="margin-left: 4px"
395
+ :color="getChipStatusColor(scope.row.productionOrderStatus)"
396
+ data-test-id="EL-TAG-mfRiQa"
397
+ >
398
+ {{ t(getStatusKeys(scope.row.productionOrderStatus)) }}
399
+ </el-tag>
400
+ </span>
401
+ <span v-if="item.value === 'productionOrderExpectedDueDate'" data-test-id="SPAN-c7MzLy">
402
+ {{
403
+ scope.row.productionOrderExpectedDueDate
404
+ ? dayjs(scope.row.productionOrderExpectedDueDate).format('YYYY-MM-DD')
405
+ : '--'
406
+ }}
407
+ </span>
408
+ <span v-if="item.value === 'consDate'" data-test-id="SPAN-jYeTU7">
409
+ {{ scope.row.consDate ? dayjs(scope.row.consDate).format('YYYY-MM-DD HH:mm:ss') : '--' }}
410
+ </span>
411
+ <span v-if="item.value === 'modiDate'" data-test-id="SPAN-oGaJQq">
412
+ {{ scope.row.modiDate ? dayjs(scope.row.modiDate).format('YYYY-MM-DD HH:mm:ss') : '--' }}
413
+ </span>
414
+ <!-- 物料档案栏位 -->
415
+ <span
416
+ v-if="item.value === 'productionOrderMaterialFileList'"
417
+ :data-test-id="`SPAN-3fw4dN-productionWorkOrder-${scope.$index}`"
418
+ >
419
+ <span
420
+ v-if="getMaterialFileValue(scope.row.productionOrderMaterialFileList) !== '-'"
421
+ :data-test-id="`SPAN-AtTCmZ-productionWorkOrder-${scope.$index}`"
422
+ @click="handleClickPreviewOfMaterialPart(scope.row.productionOrderMaterialFileList)"
423
+ >
424
+ <div
425
+ v-for="(fileItem, fileItemIndex) in getMaterialFileValue(scope.row.productionOrderMaterialFileList)"
426
+ :key="fileItemIndex"
427
+ :style="
428
+ getMaterialFileValue(scope.row.productionOrderMaterialFileList) === '-'
429
+ ? {}
430
+ : { color: '#125088', cursor: 'pointer' }
431
+ "
432
+ class="ellipsis-single-line"
433
+ :data-test-id="`DIV-YHhYGn-productionWorkOrder-${scope.$index}-${fileItemIndex}`"
434
+ >
435
+ {{ fileItem
436
+ }}<span
437
+ v-if="fileItemIndex < getMaterialFileValue(scope.row.productionOrderMaterialFileList).length - 1"
438
+ :data-test-id="`SPAN-rY5kit-productionWorkOrder-${scope.$index}-${fileItemIndex}`"
439
+ >,
440
+ </span>
441
+ </div>
442
+ </span>
443
+ <span v-else :data-test-id="`SPAN-nTsmtc-productionWorkOrder-${scope.$index}`">--</span>
444
+ </span>
445
+ <span v-if="item.value === 'materialSpec'" data-test-id="SPAN-3fw4dN">
446
+ {{ !scope.row.materialSpec && scope.row.materialSpec !== 0 ? '--' : scope.row.materialSpec }}
447
+ </span>
448
+ <span v-if="item.value === 'productionOrderPriority'" data-test-id="SPAN-qfLcCp">
449
+ <div class="mr-2" data-test-id="DIV-bVkCru">
450
+ <v-icon
451
+ :class="getPriorityIcon(scope.row.productionOrderPriority)"
452
+ :style="`color: ${getPriorityColor(scope.row.productionOrderPriority)};`"
453
+ data-test-id="V-ICON-qSsT49"
454
+ />
455
+ </div>
456
+ </span>
457
+ <span v-if="item.value === 'inboundRemain'" data-test-id="SPAN-dfgdfs-inboundRemain">
458
+ {{ scope.row.inboundRemain < 0 ? 0 : scope.row.inboundRemain }}
459
+ </span>
460
+ </template>
461
+ </el-table-column>
462
+ <el-table-column
463
+ align="center"
464
+ fixed="right"
465
+ width="120"
466
+ :label="t('action')"
467
+ data-test-id="EL-TABLE-COLUMN-y1IHkd"
468
+ >
469
+ <template #default="scope">
470
+ <div style="display: flex; justify-content: space-evenly" data-test-id="DIV-4r7bpj">
471
+ <el-tooltip
472
+ v-if="checkButtonisExist('PMC_101000_012')"
473
+ :content="t('edit')"
474
+ placement="top"
475
+ :enterable="false"
476
+ data-test-id="EL-TOOLTIP-wcany6"
477
+ >
478
+ <el-button link type="primary" data-test-id="EL-BUTTON-fhOy3W" @click="editem(scope.row)">
479
+ <i class="mdi mdi-pencil" style="font-size: 1.5rem" data-test-id="I-wtPm5k" />
480
+ </el-button>
481
+ </el-tooltip>
482
+ <el-dropdown
483
+ v-if="
484
+ checkButtonArrisExist([
485
+ 'PMC_101000_013',
486
+ 'PMC_101000_014',
487
+ 'PMC_101000_015',
488
+ 'PMC_101000_020',
489
+ 'PMC_101000_021',
490
+ ])
491
+ "
492
+ data-test-id="EL-DROPDOWN-zlO8h4"
493
+ >
494
+ <el-button link type="primary" data-test-id="EL-BUTTON-uA7w8w">
495
+ <i class="mdi mdi-cog" style="font-size: 1.5rem" data-test-id="I-8yTjsa" />
496
+ </el-button>
497
+ <template #dropdown>
498
+ <el-dropdown-menu data-test-id="EL-DROPDOWN-MENU-leueH8">
499
+ <el-dropdown-item
500
+ v-if="checkButtonisExist('PMC_101000_013')"
501
+ data-test-id="EL-DROPDOWN-ITEM-IqLtY5"
502
+ @click="printBtnClick(scope.row)"
503
+ >
504
+ <el-button link type="primary" data-test-id="EL-BUTTON-XEHczv">
505
+ <v-icon
506
+ class="mdi mdi-cloud-print"
507
+ style="margin-right: 0.5rem"
508
+ data-test-id="V-ICON-hu3Q4h"
509
+ />
510
+ {{ t('print') }}
511
+ </el-button>
512
+ </el-dropdown-item>
513
+ <el-dropdown-item data-test-id="EL-DROPDOWN-ITEM-Hlkvk9">
514
+ <el-button
515
+ v-if="checkButtonisExist('PMC_101000_014')"
516
+ link
517
+ type="primary"
518
+ data-test-id="EL-BUTTON-LU2sQs"
519
+ @click="workOrderClosed(scope.row)"
520
+ >
521
+ <v-icon
522
+ class="mdi mdi-close-circle"
523
+ style="margin-right: 0.5rem"
524
+ data-test-id="V-ICON-u2o1UR"
525
+ />
526
+ {{ t('close') }}
527
+ </el-button>
528
+ </el-dropdown-item>
529
+ <el-dropdown-item
530
+ v-if="checkButtonisExist('PMC_101000_015')"
531
+ data-test-id="EL-DROPDOWN-ITEM-wWCuKw"
532
+ @click="showWorkOrderDetail(scope.row)"
533
+ >
534
+ <el-button link type="primary" data-test-id="EL-BUTTON-9t8rJa">
535
+ <v-icon
536
+ class="mdi mdi-eye-settings-outline"
537
+ style="margin-right: 0.5rem"
538
+ data-test-id="V-ICON-snEXEY"
539
+ />
540
+ {{ t('progressCheck') }}
541
+ </el-button>
542
+ </el-dropdown-item>
543
+ <el-dropdown-item
544
+ v-if="checkButtonisExist('PMC_101000_020')"
545
+ data-test-id="EL-DROPDOWN-ITEM-ZEnxLP"
546
+ @click="copyFun(scope.row)"
547
+ >
548
+ <el-button link type="primary" data-test-id="EL-BUTTON-8BDib9">
549
+ <v-icon
550
+ class="mdi mdi-content-copy"
551
+ style="margin-right: 0.5rem"
552
+ data-test-id="V-ICON-QJVUIS"
553
+ />
554
+ {{ t('copy') }}
555
+ </el-button>
556
+ </el-dropdown-item>
557
+ <!-- 功能预留-->
558
+ <el-dropdown-item
559
+ v-if="checkButtonisExist('PMC_101000_021')"
560
+ data-test-id="EL-DROPDOWN-ITEM-JtNJob"
561
+ @click="deleteFun(scope.row)"
562
+ >
563
+ <el-button link type="primary" data-test-id="EL-BUTTON-kevoIa">
564
+ <v-icon
565
+ class="mdi mdi-delete-outline"
566
+ style="margin-right: 0.5rem"
567
+ data-test-id="V-ICON-z8u679"
568
+ />
569
+ {{ t('delete') }}
570
+ </el-button>
571
+ </el-dropdown-item>
572
+ </el-dropdown-menu>
573
+ </template>
574
+ </el-dropdown>
575
+ </div>
576
+ </template>
577
+ </el-table-column>
578
+ </el-table>
579
+ <pagination
580
+ style="background-color: transparent; padding-bottom: 0.625rem; padding-top: 1.25rem"
581
+ :total="page.total"
582
+ :current-page="page.currentPage"
583
+ :page-size="page.pageSize"
584
+ :selected-num="workOredrList.length"
585
+ :current-count="dessertsList.length"
586
+ :has-selected="true"
587
+ permission-code="PMC_101000"
588
+ :data-test-id="`PAGINATION-msjXvX`"
589
+ @changePage="changePage"
590
+ />
591
+ </template>
592
+ </pageContent>
593
+ <GloablePopover
594
+ v-if="hidePopover"
595
+ :key="dayjs()"
596
+ v-model="hidePopover"
597
+ :pop-information="popoverInfo"
598
+ :pop-strategies="popoverStrategies"
599
+ :virtual-ref="materialPartNumberRef"
600
+ virtual-triggering
601
+ data-test-id="GLOABLEPOPOVER-87O67J"
602
+ />
603
+ <FilePreview ref="PreviewDialogRef" data-test-id="FILEPREVIEW-kI9dkJ" />
604
+
605
+ <!-- 物料档案预览弹窗组件 -->
606
+ <materialPartFilePreview
607
+ ref="materialPartFilePreviewRef"
608
+ virtual-triggering
609
+ data-test-id="FILEPREVIEW-kI9dkJ-materialPartFilePreview--productionWorkOrder"
610
+ />
611
+ <!-- 视图列表抽屉组件 -->
612
+ <viewListDrawer
613
+ ref="viewListDrawerRef"
614
+ :permission-data="permissionData"
615
+ data-test-id="VIEWLISTDRAWER-9zQnTJ"
616
+ @updateViewTabs="updateViewTabs"
617
+ />
618
+ <!-- 视图操作记录 -->
619
+ <viewRecord ref="viewRecordDrawerRef" :page-data="permissionData" data-test-id="VIEWRECORD-AVwDVS" />
620
+ <createView
621
+ ref="createViewRef"
622
+ :permission-data="permissionData"
623
+ data-test-id="CREATEVIEW-B5WTn0"
624
+ @updataView="getViewTabList"
625
+ />
626
+ </div>
627
+ </template>
628
+ <script setup>
629
+ import { ref, computed, onMounted, nextTick, watch } from 'vue';
630
+ import pageContent from '@/components/pageContent.vue';
631
+ import { useI18n } from 'vue-i18n';
632
+ import apiFunction from '@/scriptFiles/checkApiErrorMechanism';
633
+ import { ElMessage, ElMessageBox } from 'element-plus';
634
+ import pagination from '@/components/Pagination.vue';
635
+ import dayjs from 'dayjs';
636
+ import untils from '@/plugins/excel';
637
+ import prodRelatedScript from './configFiles/productionRelatedScript';
638
+ import orderStatus from './configFiles/status';
639
+ import GloablePopover from '@/components/popover.vue';
640
+ import viewTabs from '@/components/Layout/modules/viewFile/viewTabs.vue';
641
+ import { isArray } from 'lodash';
642
+ import FilePreview from './components/filePreview.vue';
643
+ import materialPartFilePreview from './productionFlowLabel/component/materialPartFilePreview.vue';
644
+ import viewListDrawer from '@/components/Layout/modules/viewFile/viewList.vue';
645
+ import createView from '@/components/Layout/modules/viewFile/createView.vue';
646
+ import viewRecord from '@/components/Layout/modules/viewFile/viewRecord.vue';
647
+ import customFilter from '@/components/customFilter/customFilter.vue';
648
+ import summation from '@/utils/summation';
649
+ import { getColumnWidth } from '@/utils/tableWidth';
650
+ const viewTabsRef = ref(null); // 视图tabref
651
+ const createViewRef = ref(null); // 创建视图ref
652
+ const permissionData = ref({
653
+ permissionCode: 'PMC_101000',
654
+ docCode: 'doc_5',
655
+ });
656
+ const viewId = ref(''); //视图id
657
+ const loadingShow = ref(false); // 全局loading
658
+ const tableLoading = ref(false); // 表格loading
659
+ const multipleTableRef = ref(null);
660
+ const { t } = useI18n();
661
+ const querySearchRef = ref(null); // 搜索
662
+ const priorityStatus = ref({
663
+ topPriority: 4, // 最优先
664
+ priority: 3, // 优先
665
+ normal: 2, // 正常
666
+ secondary: 1, // 次要
667
+ leastImportant: 0, // 最次要
668
+ });
669
+ const dropdownRef = ref(null);
670
+ const selectedProdOrders = ref([]);
671
+ // 分页
672
+ const page = ref({
673
+ total: null,
674
+ currentPage: 1,
675
+ pageSize: 20,
676
+ });
677
+ // 视图管理
678
+ const isCanOperation = ref(false);
679
+ // 物料信息
680
+ const querySearchMaterialList = ref([]);
681
+ // 表头固定字段
682
+ const allHeaders = computed(() => [
683
+ {
684
+ text: t('workOrderStatus'),
685
+ value: 'productionOrderStatus',
686
+ isFixed: false,
687
+ isShown: true,
688
+ disabled: false,
689
+ freeze: false,
690
+ customizeFields: false,
691
+ },
692
+ {
693
+ text: t('productionOrderNumber'),
694
+ value: 'productionOrderNumber',
695
+ isFixed: false,
696
+ isShown: true,
697
+ disabled: false,
698
+ freeze: false,
699
+ customizeFields: false,
700
+ },
701
+ {
702
+ text: t('partNumber'),
703
+ value: 'partNumber',
704
+ isFixed: false,
705
+ isShown: true,
706
+ disabled: false,
707
+ freeze: false,
708
+ customizeFields: false,
709
+ },
710
+ {
711
+ text: t('productName'),
712
+ value: 'productName',
713
+ isFixed: false,
714
+ isShown: true,
715
+ disabled: false,
716
+ freeze: false,
717
+ customizeFields: false,
718
+ },
719
+ {
720
+ text: t('materialCategory'),
721
+ value: 'materialCategoryName',
722
+ isFixed: false,
723
+ isShown: true,
724
+ disabled: false,
725
+ freeze: false,
726
+ customizeFields: false,
727
+ },
728
+ {
729
+ text: t('materialFile'),
730
+ value: 'productionOrderMaterialFileList',
731
+ isFixed: false,
732
+ isShown: true,
733
+ disabled: false,
734
+ freeze: false,
735
+ customizeFields: false,
736
+ },
737
+ {
738
+ text: t('materialSpec'),
739
+ value: 'materialSpec',
740
+ isFixed: false,
741
+ isShown: true,
742
+ disabled: false,
743
+ freeze: false,
744
+ customizeFields: false,
745
+ },
746
+ {
747
+ text: t('workOrderRequirementsNumber'),
748
+ value: 'productionOrderRequiredThroughput',
749
+ isFixed: false,
750
+ isShown: true,
751
+ disabled: false,
752
+ freeze: false,
753
+ customizeFields: false,
754
+ },
755
+ {
756
+ text: t('craftPath'),
757
+ value: 'craftPathName',
758
+ isFixed: false,
759
+ isShown: true,
760
+ disabled: false,
761
+ freeze: false,
762
+ customizeFields: false,
763
+ },
764
+ {
765
+ text: t('salesOrderNumber'),
766
+ value: 'orderNumber',
767
+ isFixed: false,
768
+ isShown: true,
769
+ disabled: false,
770
+ freeze: false,
771
+ customizeFields: false,
772
+ },
773
+ {
774
+ text: t('sourceOrderType'),
775
+ value: 'originalOrderType',
776
+ isFixed: false,
777
+ isShown: true,
778
+ disabled: false,
779
+ freeze: false,
780
+ customizeFields: false,
781
+ },
782
+ {
783
+ text: t('sourceOrderNo'),
784
+ value: 'originalOrderNumber',
785
+ isFixed: false,
786
+ isShown: true,
787
+ disabled: false,
788
+ freeze: false,
789
+ customizeFields: false,
790
+ },
791
+ {
792
+ text: t('customerNameDigiwin'),
793
+ value: 'orderDemander',
794
+ isFixed: false,
795
+ isShown: true,
796
+ disabled: false,
797
+ freeze: false,
798
+ customizeFields: false,
799
+ },
800
+ {
801
+ text: t('orderExpectedDue'),
802
+ value: 'orderExpectedDue',
803
+ isFixed: false,
804
+ isShown: true,
805
+ disabled: false,
806
+ freeze: false,
807
+ customizeFields: false,
808
+ },
809
+ {
810
+ text: t('startDate'),
811
+ value: 'productionOrderExpectedStartDate',
812
+ isFixed: false,
813
+ isShown: true,
814
+ disabled: false,
815
+ freeze: false,
816
+ customizeFields: false,
817
+ },
818
+ {
819
+ text: t('finishDate'),
820
+ value: 'productionOrderExpectedDueDate',
821
+ isFixed: false,
822
+ isShown: true,
823
+ disabled: false,
824
+ freeze: false,
825
+ customizeFields: false,
826
+ },
827
+ {
828
+ text: t('importantSort'),
829
+ value: 'productionOrderPriority',
830
+ isFixed: false,
831
+ isShown: true,
832
+ disabled: false,
833
+ freeze: false,
834
+ customizeFields: false,
835
+ },
836
+ {
837
+ text: t('creator'),
838
+ value: 'consUserName',
839
+ isFixed: false,
840
+ isShown: true,
841
+ disabled: false,
842
+ freeze: false,
843
+ customizeFields: false,
844
+ },
845
+ {
846
+ text: t('createTime'),
847
+ value: 'consDate',
848
+ isFixed: false,
849
+ isShown: true,
850
+ disabled: false,
851
+ freeze: false,
852
+ customizeFields: false,
853
+ },
854
+ {
855
+ text: t('updatePerson'),
856
+ value: 'modiUserName',
857
+ isFixed: false,
858
+ isShown: true,
859
+ disabled: false,
860
+ freeze: false,
861
+ customizeFields: false,
862
+ },
863
+ {
864
+ text: t('updateTime'),
865
+ value: 'modiDate',
866
+ isFixed: false,
867
+ isShown: true,
868
+ disabled: false,
869
+ freeze: false,
870
+ customizeFields: false,
871
+ },
872
+ {
873
+ text: t('inventoryStorageQuantity'),
874
+ value: 'inboundQuantity',
875
+ isFixed: false,
876
+ isShown: true,
877
+ disabled: false,
878
+ freeze: false,
879
+ customizeFields: false,
880
+ },
881
+ {
882
+ text: t('returnQuantity'),
883
+ value: 'returnQuantity',
884
+ isFixed: false,
885
+ isShown: true,
886
+ disabled: false,
887
+ freeze: false,
888
+ customizeFields: false,
889
+ },
890
+ {
891
+ text: t('inboundRemain'),
892
+ value: 'inboundRemain',
893
+ isFixed: false,
894
+ isShown: true,
895
+ disabled: false,
896
+ freeze: false,
897
+ customizeFields: false,
898
+ },
899
+ {
900
+ text: t('description'),
901
+ value: 'remark',
902
+ isFixed: false,
903
+ isShown: true,
904
+ disabled: false,
905
+ freeze: false,
906
+ customizeFields: false,
907
+ },
908
+ {
909
+ text: t('shutdownReason'),
910
+ value: 'closeReason',
911
+ isFixed: false,
912
+ isShown: false,
913
+ disabled: false,
914
+ freeze: false,
915
+ customizeFields: false,
916
+ },
917
+ ]);
918
+ // 表格内容
919
+ const dessertsList = ref([]);
920
+ // 存储生产工单自定义字段
921
+ const fieldList = ref([]);
922
+ // 获取自定义字段信息
923
+ const customFieldsList = ref([]);
924
+ // 表格行选择内容记录
925
+ const workOredrList = ref([]);
926
+ const columnConfig = ref([]);
927
+
928
+ const canEditHeaders = computed(() => {
929
+ const allHeaderList = [
930
+ ...allHeaders.value.map((item) => ({
931
+ ...item,
932
+ isCustom: false,
933
+ columnKey: item.text,
934
+ })),
935
+ ...customFieldsList.value.map((item) => ({
936
+ ...item,
937
+ columnKey: item.fieldName,
938
+ isCustom: true,
939
+ })),
940
+ ];
941
+ const list = [];
942
+ if (!columnConfig.value?.length) {
943
+ return allHeaderList;
944
+ }
945
+ const notExistsList = [];
946
+ allHeaderList.forEach((ite) => {
947
+ const filterItem = columnConfig.value.find((el) => el.value === ite.value);
948
+ if (filterItem) {
949
+ list.push({
950
+ ...ite,
951
+ order: filterItem.order,
952
+ fixed: filterItem.freeze,
953
+ freeze: filterItem.freeze,
954
+ isFixed: filterItem.freeze,
955
+ disabled: false,
956
+ isShown: filterItem.isShown,
957
+ });
958
+ } else {
959
+ notExistsList.push({
960
+ ...ite,
961
+ fixed: false, // 是否固定列
962
+ freeze: false, // 是否冻结列
963
+ disabled: false, // 是否禁用
964
+ isShown: false, // 是否显示隐藏
965
+ });
966
+ }
967
+ });
968
+ console.log([...list.sort((a, b) => a.order - b.order), ...notExistsList]);
969
+ return [...list.sort((a, b) => a.order - b.order), ...notExistsList];
970
+ });
971
+ // 表头字段
972
+ const tableHeaders = computed(() => {
973
+ const allHeaderList = [...allHeaders.value, ...customFieldsList.value];
974
+ const list = [];
975
+ if (columnConfig.value?.length) {
976
+ columnConfig.value.forEach((item) => {
977
+ if (item.isShown) {
978
+ if (!item.isCustom) {
979
+ const filterItem = allHeaderList.find((i) => i.value === item.columnKey);
980
+ if (filterItem) {
981
+ list.push({
982
+ ...filterItem,
983
+ ...item,
984
+ text: filterItem.text,
985
+ });
986
+ }
987
+ } else {
988
+ const filterItem = customFieldsList.value.find((i) => i.value === item.customFieldId);
989
+ if (filterItem) {
990
+ list.push({
991
+ text: filterItem.customFieldName,
992
+ value: String(filterItem.columnKey),
993
+ ...filterItem,
994
+ ...item,
995
+ sortable: false,
996
+ class: 'parentTabColor white--text',
997
+ });
998
+ }
999
+ }
1000
+ }
1001
+ });
1002
+ return [...list];
1003
+ }
1004
+ return [...allHeaderList.filter((item) => !!item.isShown)];
1005
+ });
1006
+ // 失败弹窗
1007
+ function openErrorDialog(title = t('requestError')) {
1008
+ ElMessage({
1009
+ message: title,
1010
+ type: 'error',
1011
+ });
1012
+ }
1013
+ // 查询主页数据
1014
+ const userInfo = ref(false);
1015
+ const downloadParam = ref({});
1016
+ // 排序字段
1017
+ const orderSettingList = ref([
1018
+ {
1019
+ orderSettingID: 5,
1020
+ orderSettingType: 1,
1021
+ },
1022
+ {
1023
+ orderSettingID: 6,
1024
+ orderSettingType: 1,
1025
+ },
1026
+ ]);
1027
+ const query = async (item) => {
1028
+ let index = viewId.value;
1029
+ downloadParam.value = JSON.parse(JSON.stringify(item));
1030
+ try {
1031
+ nextTick(async () => {
1032
+ if (!userInfo.value) {
1033
+ page.value.currentPage = 1;
1034
+ }
1035
+ tableLoading.value = true;
1036
+ dessertsList.value = [];
1037
+ const params = {
1038
+ ...item,
1039
+ isPc: true,
1040
+ orderSettingList: orderSettingList.value,
1041
+ count: page.value.pageSize,
1042
+ startIndex: page.value.currentPage !== 1 ? (page.value.currentPage - 1) * page.value.pageSize : 0,
1043
+ viewId: viewId.value ? Number(viewId.value) : 0,
1044
+ };
1045
+ const { data } = await apiFunction.planFormulationQuery(params);
1046
+ if (data.code === 0 && data.content.totalCount && index === viewId.value) {
1047
+ dessertsList.value = data.content.data.map((item) => {
1048
+ const obj = {};
1049
+ if (item.mesCustomFieldAndValueList?.length) {
1050
+ item.mesCustomFieldAndValueList.forEach((i) => {
1051
+ obj[i.mesCustomFieldID] = i.mesCustomFieldValue;
1052
+ });
1053
+ }
1054
+ return {
1055
+ ...item,
1056
+ ...obj,
1057
+ };
1058
+ });
1059
+ page.value.total = data.content.totalCount;
1060
+ querySearchMaterialList.value = data.content?.materialList || [];
1061
+ tableLoading.value = false;
1062
+ } else {
1063
+ tableLoading.value = false;
1064
+ page.value.total = 0;
1065
+ }
1066
+ userInfo.value = false;
1067
+ });
1068
+ } catch (error) {
1069
+ console.error('Error in query:', error);
1070
+ tableLoading.value = false;
1071
+ openErrorDialog(t('apiError'));
1072
+ }
1073
+ };
1074
+ // 字段转文字
1075
+ const fieldToText = (string) => {
1076
+ const str = string.dmlDocCustomFormulaSettingsDTO.formulaExpression;
1077
+ const data = str.replace(/\$\{([^}]+)\}/g, (match, fullPath) => {
1078
+ const propertyName = fullPath.split('.').pop();
1079
+ const propertyField = propertyName.split('_');
1080
+ if (propertyField.length === 2 && !isNaN(propertyField[1])) {
1081
+ const fIndexData = fieldList.value.find((res) => res.docCustomId === Number(propertyField[1]));
1082
+ return '${' + t('productionPlan') + '.' + fIndexData.fieldName + '}';
1083
+ } else {
1084
+ if (propertyName === 'PORequiredThroughput') {
1085
+ return '${' + t('productionPlan') + '.' + t('productionOrderRequiredThroughput') + '}';
1086
+ } else if (propertyName === 'InboundQuantity') {
1087
+ return '${' + t('productionPlan') + '.' + t('inboundQuantity') + '}';
1088
+ } else if (propertyName === 'ReturnQuantity') {
1089
+ return '${' + t('productionPlan') + '.' + t('returnQuantity') + '}';
1090
+ } else if (propertyName === 'InboundRemain') {
1091
+ return '${' + t('productionPlan') + '.' + t('inboundRemain') + '}';
1092
+ } else {
1093
+ return '${' + t('productionPlan') + '.' + t(propertyName) + '}';
1094
+ }
1095
+ }
1096
+ });
1097
+ return data;
1098
+ };
1099
+ // 查询回调方法
1100
+ const filterSearch = () => {
1101
+ querySearchRef.value.handleSearch();
1102
+ };
1103
+ // 表头排序
1104
+ const handleSortChange = (val) => {
1105
+ const mapping = {
1106
+ productionOrderExpectedStartDate: 3,
1107
+ productionOrderExpectedDueDate: 4,
1108
+ consDate: 6,
1109
+ orderExpectedDue: 7,
1110
+ modiDate: 8,
1111
+ };
1112
+ const orderSettingID = mapping[val.prop];
1113
+ const orderSettingType = val.order === 'descending' ? 1 : 0;
1114
+ if (orderSettingList.value.length === 2) {
1115
+ orderSettingList.value.splice(1, 1);
1116
+ }
1117
+ if (val.order) {
1118
+ orderSettingList.value.push({
1119
+ orderSettingID,
1120
+ orderSettingType,
1121
+ });
1122
+ }
1123
+ querySearchRef.value.handleSearch();
1124
+ };
1125
+ // 序号列
1126
+ const calcIndex = (index) => {
1127
+ return Number(index) + 1 + Number(page.value.pageSize * (page.value.currentPage - 1));
1128
+ };
1129
+ // 表格行选择事件
1130
+ const handleSelectionChange = (item) => {
1131
+ workOredrList.value = item;
1132
+ };
1133
+ /**
1134
+ * 行点击
1135
+ * @param row 行数据
1136
+ */
1137
+ const handleRowClick = (row) => {
1138
+ if (row) {
1139
+ multipleTableRef.value.toggleRowSelection(row, undefined, false);
1140
+ } else {
1141
+ multipleTableRef.value.clearSelection();
1142
+ }
1143
+ };
1144
+ // 获取选中的数据是否符合每个按钮的需求
1145
+ const conditionalRequirements = (item) => {
1146
+ let flag = false;
1147
+ flag = workOredrList.value.some((item) => item.productionOrderStatus === 5);
1148
+ if (item.key === 'multiTaskEdit' && (workOredrList.value.length > 20 || flag)) {
1149
+ return !flag ? t('maxSupportedSimultaneousEdits') : t('unableToEditClosedTickets');
1150
+ }
1151
+ flag = workOredrList.value.some((item) => item.productionOrderStatus !== 5);
1152
+ if (item.key === 'antiClose' && flag) {
1153
+ return t('supportReopenClosedTickets');
1154
+ }
1155
+ flag = workOredrList.value.some((item) => item.productionOrderStatus !== 0);
1156
+ if (item.key === 'distribution' && flag) {
1157
+ return t('undistributedOrder');
1158
+ }
1159
+ flag = workOredrList.value.some((item) => item.productionOrderStatus !== 1);
1160
+ if (item.key === 'returnWorkOrder' && flag) {
1161
+ return t('unstartedOrderSupportsReturn');
1162
+ }
1163
+ flag = workOredrList.value.some((item) => item.productionOrderStatus === 5);
1164
+ if (item.key === 'workOrderClosed' && flag) {
1165
+ return t('closeNonClosedTickets');
1166
+ }
1167
+ return false;
1168
+ };
1169
+ // // 工单状态颜色
1170
+ const tagStatusColor = (item) => {
1171
+ return prodRelatedScript.orderTagStatusColor(item);
1172
+ };
1173
+ const getChipStatusColor = (item) => {
1174
+ return prodRelatedScript.orderGetChipStatusColor(item);
1175
+ };
1176
+ const getStatusKeys = (item) => {
1177
+ return Object.keys(orderStatus.orderPlanStatus).find((key) => orderStatus.orderPlanStatus[key] === item);
1178
+ };
1179
+ // 取得重要程度顏色
1180
+ const getPriorityColor = (item) => {
1181
+ return prodRelatedScript.priorityColor(item);
1182
+ };
1183
+ // 取得重要程度Icon
1184
+ const getPriorityIcon = (item) => {
1185
+ return prodRelatedScript.priorityIcon(item);
1186
+ };
1187
+ const formatThousands = (num) => {
1188
+ // 先处理数字,分离整数和小数部分
1189
+ const parts = num.toString().split('.');
1190
+ const integerPart = parts[0];
1191
+ const decimalPart = parts[1] ? '.' + parts[1] : '';
1192
+
1193
+ // 为整数部分添加千分位
1194
+ const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
1195
+
1196
+ return formattedInteger + decimalPart;
1197
+ };
1198
+
1199
+ // 表格自定义字段展示
1200
+ const getValue = (fieldId, list) => {
1201
+ const field = fieldList.value.find((item) => item.customFieldId === fieldId);
1202
+ const i = list?.find((item) => item.docCustomId === fieldId);
1203
+ if (list && field && i) {
1204
+ // 日期
1205
+ if (field.fieldTypeId === 3) {
1206
+ if (i.writeValue && i.writeValue !== 'null') {
1207
+ return dayjs(Number(i.writeValue)).format('YYYY-MM-DD HH:mm:ss');
1208
+ }
1209
+ return '-';
1210
+ }
1211
+ // 日期区间
1212
+ if (field.fieldTypeId === 4) {
1213
+ try {
1214
+ if (i.writeValue) {
1215
+ const val = JSON.parse(i.writeValue);
1216
+ return `${dayjs(Number(val[0])).format('YYYY-MM-DD HH:mm:ss')} ~ ${dayjs(Number(val[1])).format('YYYY-MM-DD HH:mm:ss')}`;
1217
+ }
1218
+ return '-';
1219
+ } catch (error) {
1220
+ return '-';
1221
+ }
1222
+ }
1223
+ // 附件
1224
+ if (field.fieldTypeId === 5) {
1225
+ return i.fileData.map((ite) => ite.fileName).length ? i.fileData.map((ite) => ite.fileName) : '-';
1226
+ }
1227
+ // 复选框
1228
+ if (field.fieldTypeId === 8) {
1229
+ return i.writeValue ? JSON.parse(i.writeValue) : '-';
1230
+ }
1231
+ if (field.fieldTypeId === 9) {
1232
+ if (field.dmlDocCustomFormulaSettingsDTO.isThousandSeparator && i.writeValue) {
1233
+ return formatThousands(i.writeValue);
1234
+ } else {
1235
+ return i.writeValue || '-';
1236
+ }
1237
+ }
1238
+ return i.writeValue || '-';
1239
+ }
1240
+ return '-';
1241
+ };
1242
+ // 档案预览
1243
+ const PreviewDialogRef = ref(null);
1244
+ const handleClickPreview = (fieldId, list) => {
1245
+ if (list && list.length && fieldList.value.find((item) => item.customFieldId === fieldId)) {
1246
+ const findItem = list?.find((item) => item.docCustomId === fieldId);
1247
+ if (findItem && findItem.fileData && findItem.fileData.length)
1248
+ PreviewDialogRef.value.handleOpenDialog(findItem.fileData, findItem.docCustomId);
1249
+ }
1250
+ };
1251
+ // 新增
1252
+ const addPlan = () => {
1253
+ ElMessage.info(t('add'));
1254
+ };
1255
+ // 编辑
1256
+ const editem = (val) => {
1257
+ if (val && val.productionOrderStatus === 5) {
1258
+ openErrorDialog(t('currentTicketClosed'));
1259
+ return;
1260
+ }
1261
+ nextTick(() => {
1262
+ ElMessage.info(t('edit'));
1263
+ });
1264
+ };
1265
+ // 多工单编辑
1266
+ const multiTaskEdit = () => {
1267
+ if (!workOredrList.value.length) {
1268
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1269
+ return;
1270
+ }
1271
+ if (workOredrList.value.length > 20) {
1272
+ openErrorDialog(t('maxSupportedSimultaneousEdits'));
1273
+ return;
1274
+ }
1275
+ if (workOredrList.value.some((ite) => ite.productionOrderStatus === 5)) {
1276
+ openErrorDialog(t('unableToEditClosedTickets'));
1277
+ return;
1278
+ }
1279
+ ElMessage.info(t('multiTaskEdit'));
1280
+ };
1281
+ const notOkProductionOrderIDList = ref([]);
1282
+ // 派送工单
1283
+ const distribution = () => {
1284
+ notOkProductionOrderIDList.value = [];
1285
+ if (!workOredrList.value.length) {
1286
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1287
+ return;
1288
+ }
1289
+ if (workOredrList.value.some((item) => item.productionOrderStatus !== 0)) {
1290
+ openErrorDialog(t('undistributedOrder'));
1291
+ return;
1292
+ }
1293
+ ElMessage.info(t('distribution'));
1294
+ };
1295
+ // 退回工单
1296
+ const returnWorkOrder = () => {
1297
+ if (!workOredrList.value.length) {
1298
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1299
+ return;
1300
+ }
1301
+ if (workOredrList.value.some((item) => item.productionOrderStatus !== 1)) {
1302
+ openErrorDialog(t('unstartedOrderSupportsReturn'));
1303
+ return;
1304
+ }
1305
+ ElMessage.info(t('returnWorkOrder'));
1306
+ };
1307
+
1308
+ // 下推
1309
+ const pushDown = () => {
1310
+ if (workOredrList.value.length === 0) {
1311
+ ElMessage.error(t('pleaseSelectDownFirst'));
1312
+ return;
1313
+ }
1314
+ if (workOredrList.value.length > 1) {
1315
+ ElMessage.error(t('crossDocumentNotSupported'));
1316
+ return;
1317
+ }
1318
+ // 工单状态:0-未派工,1-未开工,2-已开工,3-已完工,4-已逾期,5-已关闭
1319
+ if (workOredrList.value[0].productionOrderStatus === 5) {
1320
+ ElMessage.error(t('downFailedDocumentsClosedState'));
1321
+ return;
1322
+ }
1323
+ dropdownRef.value.handleClose();
1324
+ ElMessage.info(t('pushDown'));
1325
+ };
1326
+ // 关联查询
1327
+ const associativeQueries = () => {
1328
+ if (workOredrList.value.length === 0) {
1329
+ ElMessage.error(t('pleaseFirstSelectQuery'));
1330
+ return;
1331
+ }
1332
+ if (workOredrList.value.length > 1) {
1333
+ ElMessage.error(t('crossDocumentQueryNotSupported'));
1334
+ return;
1335
+ }
1336
+ dropdownRef.value.handleClose();
1337
+ ElMessage.info(t('associativeQueries'));
1338
+ };
1339
+ // 关闭工单
1340
+ const workOrderClosed = (val) => {
1341
+ if (!workOredrList.value.length && !val) {
1342
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1343
+ return;
1344
+ }
1345
+ if (val && val.productionOrderStatus === 5) {
1346
+ openErrorDialog(t('currentTicketClosed'));
1347
+ return;
1348
+ }
1349
+ if (!val && workOredrList.value.some((item) => item.productionOrderStatus === 5)) {
1350
+ openErrorDialog(t('closeNonClosedTickets'));
1351
+ return;
1352
+ }
1353
+ dropdownRef.value.handleClose();
1354
+ ElMessage.info(t('workOrderClosed'));
1355
+ };
1356
+ // 反关闭
1357
+ const antiClose = () => {
1358
+ if (!workOredrList.value.length) {
1359
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1360
+ return;
1361
+ }
1362
+ if (workOredrList.value.some((item) => item.productionOrderStatus !== 5)) {
1363
+ openErrorDialog(t('supportReopenClosedTickets'));
1364
+ return;
1365
+ }
1366
+ ElMessage.info(t('antiClose'));
1367
+ };
1368
+ // 批量更新
1369
+ const batchUpdate = () => {
1370
+ if (!workOredrList.value.length) {
1371
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1372
+ return;
1373
+ }
1374
+ if (workOredrList.value.some((ite) => ite.productionOrderStatus === 5)) {
1375
+ openErrorDialog(t('closedTicketsUpdate'));
1376
+ return;
1377
+ }
1378
+ ElMessage.info(t('batchUpdate'));
1379
+ };
1380
+ //标签发行
1381
+ function labelingIssuance() {
1382
+ if (!workOredrList.value.length) {
1383
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1384
+ return;
1385
+ } else if (workOredrList.value.length > 1) {
1386
+ openErrorDialog(t('onlyUseOneTag'));
1387
+ return;
1388
+ }
1389
+ if (workOredrList.value[0].productionOrderStatus === 5) {
1390
+ openErrorDialog(t('closedTicketsNotIssueTags'));
1391
+ return;
1392
+ }
1393
+ dropdownRef.value.handleClose();
1394
+ ElMessage.info(t('labelingIssuance'));
1395
+ }
1396
+ // 订单分享
1397
+ const orderSharing = () => {
1398
+ if (workOredrList.value.length > 0) {
1399
+ dropdownRef.value.handleClose();
1400
+ selectedProdOrders.value = workOredrList.value;
1401
+ const isEquation = selectedProdOrders.value.every(
1402
+ (element) => element.orderNumber === selectedProdOrders.value[0].orderNumber,
1403
+ );
1404
+ if (isEquation) {
1405
+ ElMessage.info(t('orderSharing'));
1406
+ } else {
1407
+ openErrorDialog(t('errorDifferentOrders'));
1408
+ }
1409
+ } else {
1410
+ openErrorDialog(t('sharedSelectOrder'));
1411
+ }
1412
+ };
1413
+ // 工时推算
1414
+ const workingHoursCaculate = async () => {
1415
+ if (!workOredrList.value.length) {
1416
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1417
+ return;
1418
+ } else {
1419
+ ElMessage.info(t('workingHoursCaculate'));
1420
+ }
1421
+ };
1422
+
1423
+ // 获取导出的数据
1424
+ const downloadData = ref([]);
1425
+ const downloadIndex = ref(0);
1426
+ const initDownloadData = async () => {
1427
+ const param = {
1428
+ ...downloadParam.value,
1429
+ isPc: true,
1430
+ count: 200,
1431
+ startIndex: downloadIndex.value,
1432
+ orderSettingList: orderSettingList.value,
1433
+ viewId: viewId.value ? Number(viewId.value) : 0,
1434
+ };
1435
+ const res = await apiFunction.planFormulationQuery(param).catch(() => ElMessage.error(t('apiError')));
1436
+ const {
1437
+ data: { code, content, message },
1438
+ } = res;
1439
+ if (code === 0) {
1440
+ const contentData =
1441
+ content && content.data && content.data.length
1442
+ ? content.data.map((item) => {
1443
+ const customData = {};
1444
+ if (item.docCustomFieldAndValues && item.docCustomFieldAndValues.length)
1445
+ item.docCustomFieldAndValues.forEach((customItem) => {
1446
+ customData[customItem.docCustomId] = customItem;
1447
+ });
1448
+ return { ...item, ...customData };
1449
+ })
1450
+ : [];
1451
+ downloadData.value = [...downloadData.value, ...contentData];
1452
+ if (downloadData.value.length < content.totalCount) {
1453
+ downloadIndex.value += 200;
1454
+ await initDownloadData();
1455
+ }
1456
+ } else ElMessage.error(t(message));
1457
+ };
1458
+
1459
+ const initPriorityStatusText = (value) =>
1460
+ Object.keys(priorityStatus.value).find((item) => (priorityStatus.value[item] === value ? item : ''));
1461
+
1462
+ // Excel汇出
1463
+ const handleExport = async () => {
1464
+ tableLoading.value = true;
1465
+ downloadData.value = [];
1466
+ downloadIndex.value = 0;
1467
+ // 表头
1468
+ const title = [tableHeaders.value.map(({ text }) => text)];
1469
+ downloadData.value = [];
1470
+ await initDownloadData();
1471
+ const body = downloadData.value.map((bodyItem) => {
1472
+ return tableHeaders.value.map((headerItem) => {
1473
+ const value = bodyItem[headerItem.value];
1474
+ if (headerItem.value === 'originalOrderType') return value === 1 ? t('productionPlanList') : '';
1475
+ else if (headerItem.value === 'productionOrderMaterialFileList')
1476
+ return bodyItem.productionOrderMaterialFileList?.length
1477
+ ? bodyItem.productionOrderMaterialFileList?.map((ite) => ite.plmFileName).join()
1478
+ : '';
1479
+ // 物料档案
1480
+ else if (headerItem.value === 'productionOrderPriority') return t(initPriorityStatusText(value));
1481
+ else if (headerItem.value === 'originalOrderNumber') return bodyItem.productionPlanNumber;
1482
+ else if (headerItem.value === 'productionOrderStatus') return t(getStatusKeys(value)) || '';
1483
+ else if (
1484
+ headerItem.value === 'orderExpectedDue' ||
1485
+ headerItem.value === 'productionOrderExpectedStartDate' ||
1486
+ headerItem.value === 'productionOrderExpectedDueDate'
1487
+ )
1488
+ return value ? dayjs(value).format('YYYY-MM-DD') : '';
1489
+ else if (headerItem.value === 'consDate' || headerItem.value === 'modiDate')
1490
+ return value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '';
1491
+ else if (headerItem.value === 'inboundRemain') return bodyItem.inboundRemain < 0 ? 0 : value;
1492
+ else if (headerItem.isCustom) {
1493
+ if (value?.fieldTypeId === 3 && (value?.writeValue ?? '') !== '') {
1494
+ return value?.writeValue ? dayjs(Number(value?.writeValue)).format('YYYY-MM-DD HH:mm:ss') : '';
1495
+ } else if (value?.fieldTypeId === 4 && (value?.writeValue ?? '') !== '') {
1496
+ return value?.writeValue && isArray(JSON.parse(value?.writeValue)) && JSON.parse(value?.writeValue).length
1497
+ ? `${dayjs(JSON.parse(value?.writeValue)[0]).format('YYYY-MM-DD HH:mm:ss')} ~ ${dayjs(JSON.parse(value?.writeValue)[1]).format('YYYY-MM-DD HH:mm:ss')}`
1498
+ : '';
1499
+ } else if (value?.fieldTypeId === 5) {
1500
+ return value.fileData && value.fileData.length ? value.fileData.map((item) => item.fileName).join(',') : '';
1501
+ } else if (value?.fieldTypeId === 8 && (value?.writeValue ?? '') !== '') {
1502
+ return JSON.parse(value?.writeValue).join(',');
1503
+ } else {
1504
+ return value?.writeValue;
1505
+ }
1506
+ } else return value;
1507
+ });
1508
+ });
1509
+ tableLoading.value = false;
1510
+ untils.exportFromArray({
1511
+ title,
1512
+ body,
1513
+ name: t('productionWorkOrderRemittance'),
1514
+ suffix: 'xlsx',
1515
+ sheetName: t('productionWorkOrderRemittance'),
1516
+ wscols: body[0].map(() => ({ wch: 20 })),
1517
+ });
1518
+ };
1519
+ // 进度查看
1520
+ const showWorkOrderDetail = (item) => {
1521
+ console.log('item:', item);
1522
+ ElMessage.info(t('progressView'));
1523
+ };
1524
+ // 复制
1525
+ const copyFun = (val) => {
1526
+ console.log('val:', val);
1527
+ ElMessage.info(t('copy'));
1528
+ };
1529
+ // 删除
1530
+ const deleteFun = (val) => {
1531
+ if (val.productionOrderStatus !== 0) {
1532
+ ElMessage.error(t('unassignedWorkOrderCanDelete'));
1533
+ return;
1534
+ }
1535
+ ElMessageBox.confirm(t('ticketDeleteConfirmation'), t('warning'), {
1536
+ confirmButtonText: t('confirm'),
1537
+ cancelButtonText: t('cancel'),
1538
+ type: 'warning',
1539
+ })
1540
+ .then(() => {
1541
+ ElMessage.info(t('delete'));
1542
+ })
1543
+ .catch(() => {
1544
+ // 用户点击取消的操作
1545
+ loadingShow.value = false;
1546
+ });
1547
+ };
1548
+ // 打开汇入弹窗
1549
+ const handleImport = () => {
1550
+ ElMessage.info(t('import'));
1551
+ };
1552
+ const getCustomFields = async () => {
1553
+ const params = {
1554
+ docCode: 'doc_5',
1555
+ status: 1,
1556
+ fieldName: '',
1557
+ consDate: [],
1558
+ startIndex: 0,
1559
+ count: 100,
1560
+ };
1561
+ await apiFunction
1562
+ .querySetting(params)
1563
+ .then((res) => {
1564
+ if (res.data.code === 0) {
1565
+ const customFieldData = res.data.content.data.map((ite) => ({
1566
+ ...ite,
1567
+ customFieldName: ite.fieldName,
1568
+ columnKey: ite.fieldName,
1569
+ customFieldId: ite.docCustomId,
1570
+ isCustom: true,
1571
+ isFixed: false,
1572
+ isShown: true,
1573
+ disabled: false,
1574
+ freeze: false,
1575
+ customizeFields: true,
1576
+ }));
1577
+ fieldList.value = customFieldData;
1578
+ customFieldsList.value = customFieldData.map((item) => ({
1579
+ ...item,
1580
+ text: item.customFieldName,
1581
+ columnKey: item.customFieldName,
1582
+ align: 'index',
1583
+ sortable: false,
1584
+ value: item.customFieldId,
1585
+ class: 'parentTabColor white--text',
1586
+ width: '170px',
1587
+ customFieldId: item.docCustomId,
1588
+ fieldTypeId: item.fieldTypeId,
1589
+ }));
1590
+ } else {
1591
+ openErrorDialog(t(res.data.message));
1592
+ }
1593
+ })
1594
+ .catch(() => {
1595
+ openErrorDialog(t('apiError'));
1596
+ });
1597
+ };
1598
+ // 列配置信息获取
1599
+ const getColumnConfig = async () => {
1600
+ columnConfig.value = [];
1601
+ await apiFunction
1602
+ .queryColumnSettingNext({
1603
+ displayIds: [101000201],
1604
+ })
1605
+ .then((res) => {
1606
+ if (res.data.code === 0) {
1607
+ const dataList = res.data.content.data;
1608
+ if (dataList[0].displayId === 101000201 && dataList[0].configJson) {
1609
+ columnConfig.value = dataList[0].configJson.columnSetting;
1610
+ }
1611
+ const fIndex = columnConfig.value.findIndex((item) => item.columnKey === 'productName');
1612
+ const someFlag = columnConfig.value.some((item) => item.columnKey === 'materialCategoryName');
1613
+ if (columnConfig.value && columnConfig.value.length && !someFlag)
1614
+ columnConfig.value.splice(fIndex + 1, 0, {
1615
+ columnKey: 'materialCategoryName',
1616
+ customizeFields: false,
1617
+ disabled: false,
1618
+ fixed: false,
1619
+ freeze: false,
1620
+ isCustom: false,
1621
+ isFixed: false,
1622
+ isShown: true,
1623
+ text: t('materialCategory'),
1624
+ value: 'materialCategoryName',
1625
+ });
1626
+ } else {
1627
+ columnConfig.value = [];
1628
+ }
1629
+ })
1630
+ .catch(() => {
1631
+ tableLoading.value = false;
1632
+ columnConfig.value = [];
1633
+ });
1634
+ };
1635
+ const saveData = async (val) => {
1636
+ tableLoading.value = true;
1637
+ const list = val.map((item, index) => ({
1638
+ ...item,
1639
+ order: index + 1,
1640
+ columnKey: item.isCustom ? item.columnKey : item.value,
1641
+ isShown: item.isShown,
1642
+ }));
1643
+ await apiFunction
1644
+ .updateColumnSettingNext({
1645
+ data: [
1646
+ {
1647
+ displayId: 101000201,
1648
+ configJson: {
1649
+ displayId: 101000201,
1650
+ columnSetting: list,
1651
+ },
1652
+ },
1653
+ ],
1654
+ })
1655
+ .then((res) => {
1656
+ tableLoading.value = false;
1657
+ if (res.data.code !== 0) {
1658
+ ElMessage.error(t(res.data.message));
1659
+ } else {
1660
+ columnConfig.value = list;
1661
+ }
1662
+ })
1663
+ .catch(() => {
1664
+ tableLoading.value = false;
1665
+ });
1666
+ };
1667
+ // 分页方法
1668
+ const changePage = async (val) => {
1669
+ page.value.currentPage = val.page;
1670
+ page.value.pageSize = val.size;
1671
+ userInfo.value = true;
1672
+ filterSearch();
1673
+ };
1674
+
1675
+ /* popover显示物料详情 虚拟触发 */
1676
+ // 虚拟触发绑定的ref
1677
+ const materialPartNumberRef = ref();
1678
+ //popover传入信息
1679
+ const popoverInfo = ref();
1680
+ //控制popover显隐
1681
+ const hidePopover = ref(false);
1682
+ //不同路由下的字段映射策略
1683
+ const popoverStrategies = ref({
1684
+ numberField: 'partNumber',
1685
+ nameField: 'productName',
1686
+ specField: 'materialSpec',
1687
+ });
1688
+ //移入事件,移入时传入相应信息
1689
+ const handleCellMouseEnter = (row, column, event) => {
1690
+ if (column.property === 'partNumber') {
1691
+ popoverInfo.value = row;
1692
+ materialPartNumberRef.value = event.children[0];
1693
+ hidePopover.value = true;
1694
+ }
1695
+ };
1696
+ //移出事件,刷新组件
1697
+ const handleCellMouseLeave = () => {
1698
+ return;
1699
+ };
1700
+ function moveDBeforeB(arr) {
1701
+ const newArr = [...arr];
1702
+ const indexA = newArr.findIndex((item) => item.permissionCode === 'PMC_101000_023');
1703
+ const indexB = newArr.findIndex((item) => item.permissionCode === 'PMC_101000_009');
1704
+
1705
+ if (indexA === -1 || indexB === -1 || indexA < indexB) {
1706
+ return newArr;
1707
+ }
1708
+
1709
+ // 一步完成移除和插入
1710
+ const dElement = newArr[indexA];
1711
+ return [...newArr.slice(0, indexB), dElement, ...newArr.slice(indexB, indexA), ...newArr.slice(indexA + 1)];
1712
+ }
1713
+ // 按钮
1714
+ const buttonList = ref([]);
1715
+ const topButtons = ref([]);
1716
+ async function getButtons() {
1717
+ await apiFunction
1718
+ .QueryMyPermission({
1719
+ permissionSource: 'web',
1720
+ permissionCode: 'PMC_101000',
1721
+ })
1722
+ .then((res) => {
1723
+ if (res.data?.code === 0) {
1724
+ buttonList.value = moveDBeforeB(res.data.content);
1725
+ } else {
1726
+ ElMessage.error(t(res.data.message));
1727
+ }
1728
+ })
1729
+ .catch()
1730
+ .finally(() => {
1731
+ loadingShow.value = false;
1732
+ });
1733
+ }
1734
+ const hyperLinkClick = (item, docCustomFieldAndValues) => {
1735
+ const hyperLinkUrlStr = docCustomFieldAndValues.filter((ite) => ite.docCustomId === item.customFieldId)[0].writeValue;
1736
+ window.open(hyperLinkUrlStr, '_blank');
1737
+ };
1738
+
1739
+ function checkButtonisExist(id) {
1740
+ let findArr = buttonList.value.filter((it) => id === it.permissionCode);
1741
+ if (findArr.length) {
1742
+ return true;
1743
+ } else {
1744
+ return false;
1745
+ }
1746
+ }
1747
+ function checkButtonArrisExist(arr) {
1748
+ let findArr = buttonList.value.filter((it) => arr.some((item) => item === it.permissionCode));
1749
+ if (findArr.length) {
1750
+ return true;
1751
+ } else {
1752
+ return false;
1753
+ }
1754
+ }
1755
+ // 打印的工单行数据
1756
+ const printSelectRowData = ref([]);
1757
+ // 打印按钮的点击方法
1758
+ function printBtnClick(row) {
1759
+ printSelectRowData.value = [row.productionOrderNumber];
1760
+ }
1761
+ // 批量打印方法
1762
+ function batchPrint(type) {
1763
+ console.log('type:', type);
1764
+ if (workOredrList.value.length === 0) {
1765
+ openErrorDialog(t('pleaseSelectOrder'));
1766
+ return;
1767
+ }
1768
+ ElMessage.info(t('批量打印/预览'));
1769
+ }
1770
+
1771
+ //操作日志
1772
+ function operationLog() {
1773
+ ElMessage.info(t('操作日志'));
1774
+ }
1775
+ //完工
1776
+ function toBeFinished() {
1777
+ if (workOredrList.value.length === 0) {
1778
+ openErrorDialog(t('pleaseSelectWorkOrder'));
1779
+ return;
1780
+ }
1781
+ let arr = [2, 4];
1782
+ let flag = workOredrList.value.some((item) => !arr.includes(item.productionOrderStatus));
1783
+ if (flag) {
1784
+ openErrorDialog(t('toBeFinishedTips'));
1785
+ } else {
1786
+ ElMessageBox.confirm(t('toBeFinishedConfirmTips'), t('warning'), {
1787
+ confirmButtonText: t('confirm'),
1788
+ cancelButtonText: t('cancel'),
1789
+ type: 'warning',
1790
+ })
1791
+ .then(() => {
1792
+ ElMessage.info(t('toBeFinished'));
1793
+ })
1794
+ .catch(() => {
1795
+ // 用户点击取消的操作
1796
+ loadingShow.value = false;
1797
+ });
1798
+ }
1799
+ }
1800
+ watch(
1801
+ () => buttonList.value,
1802
+ () => {
1803
+ if (buttonList.value && buttonList.value.length > 0) {
1804
+ topButtons.value = [];
1805
+ buttonList.value.map((it) => {
1806
+ switch (it.permissionCode) {
1807
+ // 新增
1808
+ case 'PMC_101000_001':
1809
+ topButtons.value.push({
1810
+ describe: 'add',
1811
+ key: 'add',
1812
+ icon: 'mdi mdi-plus',
1813
+ func: addPlan,
1814
+ isFold: false,
1815
+ isBatch: false,
1816
+ isAdvanced: false,
1817
+ });
1818
+ break;
1819
+ // 批量汇入
1820
+ case 'PMC_101000_002':
1821
+ topButtons.value.push({
1822
+ describe: 'batchImport',
1823
+ key: 'import',
1824
+ icon: 'mdi mdi-import',
1825
+ func: handleImport,
1826
+ isFold: false,
1827
+ isBatch: true,
1828
+ isAdvanced: false,
1829
+ order: 1,
1830
+ });
1831
+ break;
1832
+ // 批量汇出
1833
+ case 'PMC_101000_003':
1834
+ topButtons.value.push({
1835
+ describe: 'batchExport',
1836
+ key: 'export',
1837
+ icon: 'mdi mdi-export',
1838
+ func: handleExport,
1839
+ isFold: false,
1840
+ isBatch: true,
1841
+ isAdvanced: false,
1842
+ order: 2,
1843
+ });
1844
+ break;
1845
+ // 多工单编辑
1846
+ case 'PMC_101000_004':
1847
+ topButtons.value.push({
1848
+ describe: 'multiTaskEdit',
1849
+ key: 'multiTaskEdit',
1850
+ icon: 'mdi mdi-table-edit',
1851
+ func: multiTaskEdit,
1852
+ isFold: true,
1853
+ isBatch: false,
1854
+ isAdvanced: false,
1855
+ order: 1,
1856
+ });
1857
+ break;
1858
+ // 批量打印
1859
+ case 'PMC_101000_019':
1860
+ topButtons.value.push({
1861
+ describe: 'batchPrint',
1862
+ key: 'batchPrint',
1863
+ icon: 'mdi mdi-cloud-print',
1864
+ func: batchPrint,
1865
+ type: 2,
1866
+ isFold: false,
1867
+ isBatch: true,
1868
+ isAdvanced: false,
1869
+ order: 4,
1870
+ });
1871
+ break;
1872
+ // 批量更新
1873
+ case 'PMC_101000_005':
1874
+ topButtons.value.push({
1875
+ describe: 'batchUpdate',
1876
+ key: 'batchUpdate',
1877
+ icon: 'mdi mdi-file-document-refresh-outline',
1878
+ func: batchUpdate,
1879
+ isFold: false,
1880
+ isBatch: true,
1881
+ isAdvanced: false,
1882
+ order: 3,
1883
+ });
1884
+ break;
1885
+ // 派送工单
1886
+ case 'PMC_101000_006':
1887
+ topButtons.value.push({
1888
+ describe: 'deliveryOrder',
1889
+ key: 'distribution',
1890
+ icon: 'mdi mdi-sync',
1891
+ func: distribution,
1892
+ isFold: false,
1893
+ isBatch: false,
1894
+ isAdvanced: false,
1895
+ order: 2,
1896
+ });
1897
+ break;
1898
+ // 退回工单
1899
+ case 'PMC_101000_007':
1900
+ topButtons.value.push({
1901
+ describe: 'returnWorkOrder',
1902
+ key: 'returnWorkOrder',
1903
+ icon: 'mdi mdi-arrow-left-circle',
1904
+ func: returnWorkOrder,
1905
+ isFold: true,
1906
+ isBatch: false,
1907
+ isAdvanced: false,
1908
+ order: 3,
1909
+ });
1910
+ break;
1911
+ // 订单分享
1912
+ case 'PMC_101000_008':
1913
+ topButtons.value.push({
1914
+ describe: 'orderSharing',
1915
+ key: 'orderSharing',
1916
+ icon: 'mdi mdi-share',
1917
+ func: orderSharing,
1918
+ isFold: true,
1919
+ isBatch: false,
1920
+ isAdvanced: false,
1921
+ order: 4,
1922
+ });
1923
+ break;
1924
+ // 批量关闭
1925
+ case 'PMC_101000_009':
1926
+ topButtons.value.push({
1927
+ describe: 'batchClose',
1928
+ key: 'workOrderClosed',
1929
+ icon: 'mdi mdi-close-circle',
1930
+ func: workOrderClosed,
1931
+ isFold: false,
1932
+ isBatch: true,
1933
+ isAdvanced: false,
1934
+ order: 5,
1935
+ });
1936
+ break;
1937
+ // 反关闭
1938
+ case 'PMC_101000_010':
1939
+ topButtons.value.push({
1940
+ describe: 'antiClose',
1941
+ key: 'antiClose',
1942
+ icon: 'mdi mdi-minus-circle-off',
1943
+ func: antiClose,
1944
+ isFold: true,
1945
+ isBatch: false,
1946
+ isAdvanced: false,
1947
+ order: 6,
1948
+ });
1949
+ break;
1950
+ // 标签发行
1951
+ case 'PMC_101000_011':
1952
+ topButtons.value.push({
1953
+ describe: 'labelingIssuance',
1954
+ key: 'labelingIssuance',
1955
+ icon: 'mdi mdi-label-multiple',
1956
+ func: labelingIssuance,
1957
+ isFold: false,
1958
+ isBatch: false,
1959
+ isAdvanced: true,
1960
+ order: 1,
1961
+ });
1962
+ break;
1963
+ // 下推
1964
+ case 'PMC_101000_016':
1965
+ topButtons.value.push({
1966
+ describe: 'pushDown',
1967
+ key: 'pushDown',
1968
+ icon: 'mdi mdi-download-box',
1969
+ func: pushDown,
1970
+ isFold: false,
1971
+ isBatch: false,
1972
+ isAdvanced: true,
1973
+ order: 3,
1974
+ });
1975
+ break;
1976
+ // 关联查询
1977
+ case 'PMC_101000_017':
1978
+ topButtons.value.push({
1979
+ describe: 'associativeQueries',
1980
+ key: 'associativeQueries',
1981
+ icon: 'mdi mdi-tag-search',
1982
+ func: associativeQueries,
1983
+ isFold: false,
1984
+ isBatch: false,
1985
+ isAdvanced: true,
1986
+ order: 2,
1987
+ });
1988
+ break;
1989
+ // 工时推算
1990
+ case 'PMC_101000_018':
1991
+ topButtons.value.push({
1992
+ describe: 'workingHoursCaculate',
1993
+ key: 'workingHoursCaculate',
1994
+ icon: 'mdi mdi-pencil-box-multiple-outline',
1995
+ func: workingHoursCaculate,
1996
+ isFold: false,
1997
+ isBatch: false,
1998
+ isAdvanced: true,
1999
+ order: 4,
2000
+ });
2001
+ break;
2002
+ // 打印预览
2003
+ case 'PMC_101000_024':
2004
+ topButtons.value.push({
2005
+ describe: 'printPreview',
2006
+ key: 'printPreview',
2007
+ icon: 'mdi mdi-pencil-box-multiple-outline',
2008
+ func: batchPrint,
2009
+ type: 1,
2010
+ isFold: true,
2011
+ isBatch: false,
2012
+ isAdvanced: false,
2013
+ order: 7,
2014
+ });
2015
+ break;
2016
+ // 操作日志
2017
+ case 'PMC_101000_022':
2018
+ topButtons.value.push({
2019
+ describe: 'operationLog',
2020
+ key: 'operationLog',
2021
+ icon: 'mdi mdi-clock-outline',
2022
+ func: operationLog,
2023
+ isFold: false,
2024
+ isBatch: false,
2025
+ isAdvanced: true,
2026
+ order: 5,
2027
+ });
2028
+ break;
2029
+ // 完工
2030
+ case 'PMC_101000_023':
2031
+ topButtons.value.push({
2032
+ describe: 'toBeFinished',
2033
+ key: 'toBeFinished',
2034
+ icon: 'mdi mdi-checkbox-marked-circle',
2035
+ func: toBeFinished,
2036
+ isFold: true,
2037
+ isBatch: false,
2038
+ isAdvanced: false,
2039
+ order: 5,
2040
+ });
2041
+ break;
2042
+ default:
2043
+ break;
2044
+ }
2045
+ });
2046
+ // obtainProcessedBtnList();
2047
+ }
2048
+ },
2049
+ { deep: true, immediate: true },
2050
+ );
2051
+ // 得到物料档案显示值
2052
+ function getMaterialFileValue(list) {
2053
+ // 附件
2054
+ if (list?.length) {
2055
+ return list.map((ite) => ite.plmFileName).length ? list.map((ite) => ite.plmFileName) : '-';
2056
+ }
2057
+ return '-';
2058
+ }
2059
+ // 物料档案预览
2060
+ const materialPartFilePreviewRef = ref(null);
2061
+ function handleClickPreviewOfMaterialPart(list) {
2062
+ if (list && list.length) {
2063
+ materialPartFilePreviewRef.value.handleOpenDialog(list);
2064
+ }
2065
+ }
2066
+
2067
+ /**
2068
+ * 视图管理
2069
+ */
2070
+ const allViewTabs = ref([]);
2071
+ const tabKey = ref(1);
2072
+ const viewIdFromList = ref(null);
2073
+ //获取页面的管理视图列表
2074
+ async function getViewTabList() {
2075
+ loadingShow.value = true;
2076
+ await apiFunction
2077
+ .getViewOnlyReadList({
2078
+ permissionCode: permissionData.value.permissionCode,
2079
+ })
2080
+ .then((res) => {
2081
+ if (res.data?.code === 0) {
2082
+ allViewTabs.value = [...res.data.content];
2083
+ } else {
2084
+ ElMessage.error(t(res.data.message));
2085
+ }
2086
+ })
2087
+ .catch()
2088
+ .finally(() => {
2089
+ loadingShow.value = false;
2090
+ viewIdFromList.value = null;
2091
+ });
2092
+ }
2093
+ function handleTabUpdate() {
2094
+ getViewTabList();
2095
+ }
2096
+ // 定义视图列表抽屉组件ref
2097
+ const viewListDrawerRef = ref(null);
2098
+ /**
2099
+ * 打开视图列表抽屉
2100
+ */
2101
+ function openViewListDrawer() {
2102
+ viewListDrawerRef.value.open();
2103
+ }
2104
+ // 父组件:切换tab页 接收子组件传递的完整 Tab 数据
2105
+ function handleTabClick(id, type) {
2106
+ if (id === viewId.value && !type) {
2107
+ return;
2108
+ }
2109
+ if (type === 'edit') {
2110
+ createViewRef.value.open(id, 0);
2111
+ return;
2112
+ }
2113
+ if (type === 'copy') {
2114
+ createViewRef.value.open(id, 2);
2115
+ return;
2116
+ }
2117
+ viewId.value = id;
2118
+ page.value.currentPage = 1;
2119
+ filterSearch();
2120
+ }
2121
+
2122
+ /**
2123
+ * 视图操作记录
2124
+ */
2125
+ const viewRecordDrawerRef = ref(null); // 视图记录ref
2126
+ // 打开视图操作记录抽屉
2127
+ function openViewRecordDrawer() {
2128
+ viewRecordDrawerRef.value.open();
2129
+ }
2130
+ // 更新viewTabs
2131
+ function updateViewTabs(newTabOrderList, viewId) {
2132
+ tabKey.value++;
2133
+ allViewTabs.value = [...newTabOrderList];
2134
+ viewIdFromList.value = viewId;
2135
+ getViewTabList();
2136
+ }
2137
+
2138
+ onMounted(async () => {
2139
+ downloadParam.value = {};
2140
+ loadingShow.value = true;
2141
+ await getButtons();
2142
+ await getCustomFields();
2143
+ await getColumnConfig();
2144
+ // querySearchRef.value.init();
2145
+ //判断视图管理权限或者操作权限,如果存在视图 则有视图管理权限(调用视图管理权限接口),不存在则调用操作权限接口(隐藏 编辑复制删除 添加 操作记录功能)
2146
+ isCanOperation.value = buttonList.value.some((it) => it.permissionCode === 'PMC_101000_025');
2147
+ getViewTabList();
2148
+ });
2149
+ </script>
2150
+ <style scoped lang="scss">
2151
+ @use '@/scss/base/table.scss';
2152
+
2153
+ .statusColor {
2154
+ min-width: 100px;
2155
+ height: 40px;
2156
+ text-align: center;
2157
+ line-height: 40px;
2158
+ }
2159
+
2160
+ .a-text-class {
2161
+ color: #409eff;
2162
+ cursor: pointer;
2163
+ text-decoration: underline;
2164
+ }
2165
+
2166
+ .ellipsis-single-line {
2167
+ white-space: nowrap;
2168
+ /* 禁止换行 */
2169
+ overflow: hidden;
2170
+ /* 隐藏超出内容 */
2171
+ text-overflow: ellipsis;
2172
+ /* 显示省略号 */
2173
+ }
2174
+ </style>