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,394 @@
1
+ <template>
2
+ <div class="circulationLabel" data-test-id="DIV-4R8Tdg">
3
+ <el-form
4
+ ref="formRef"
5
+ :model="addTagNumber"
6
+ label-width="auto"
7
+ label-position="right"
8
+ :rules="tagNumberRules"
9
+ data-test-id="EL-FORM-4A0VHk"
10
+ >
11
+ <span class="labelItem" data-test-id="SPAN-6lRKVk"> {{ t('manuallyAddCirculationLabels') }} </span>
12
+ <el-form-item prop="circulationTagNumber" data-test-id="EL-FORM-ITEM-XroJGE">
13
+ <template #label>
14
+ <el-tooltip
15
+ v-if="t('circulationTagNumber').length > 7"
16
+ effect="dark"
17
+ :content="t('circulationTagNumber')"
18
+ placement="top"
19
+ data-test-id="EL-TOOLTIP-7KucIu"
20
+ >
21
+ <template #default>
22
+ <span data-test-id="SPAN-fcvPiz">{{ `${t('circulationTagNumber').slice(0, 7)}...` }}</span>
23
+ </template>
24
+ </el-tooltip>
25
+ <span v-else data-test-id="SPAN-se3k8m"> {{ t('circulationTagNumber') }} </span>
26
+ </template>
27
+ <el-input
28
+ ref="circulationTagNumber"
29
+ v-model="addTagNumber.circulationTagNumber"
30
+ :disabled="labelType !== 'issue'"
31
+ class="formInput"
32
+ data-test-id="EL-INPUT-KcVFkQ"
33
+ @keyup.enter="keyDown(formRef)"
34
+ />
35
+ </el-form-item>
36
+ <el-form-item prop="numberOfTags" data-test-id="EL-FORM-ITEM-MxMhjN">
37
+ <template #label>
38
+ <el-tooltip
39
+ v-if="t('numberOfTags').length > 7"
40
+ effect="dark"
41
+ :content="t('numberOfTags')"
42
+ placement="top"
43
+ data-test-id="EL-TOOLTIP-T0lfIe"
44
+ >
45
+ <template #default>
46
+ <span data-test-id="SPAN-vbvBt4">{{ `${t('numberOfTags').slice(0, 7)}...` }}</span>
47
+ </template>
48
+ </el-tooltip>
49
+ <span v-else data-test-id="SPAN-NEIGqn"> {{ t('numberOfTags') }} </span>
50
+ </template>
51
+ <el-input
52
+ v-model="addTagNumber.numberOfTags"
53
+ :disabled="labelType !== 'issue'"
54
+ class="formInput"
55
+ data-test-id="EL-INPUT-bIumKF"
56
+ />
57
+ <el-button
58
+ size="default"
59
+ type="primary"
60
+ class="ml-5"
61
+ :loading="props.buttonLoading"
62
+ :disabled="labelInformation.newQuantity === 0 || labelType !== 'issue'"
63
+ data-test-id="EL-BUTTON-zvetBI"
64
+ @click="keyDown(formRef)"
65
+ >
66
+ <v-icon class="mdi mdi-plus" data-test-id="V-ICON-DLLK8e" />{{ t('add') }}
67
+ </el-button>
68
+ </el-form-item>
69
+ </el-form>
70
+ </div>
71
+ <div class="circulationLabel" data-test-id="DIV-rqlF9H">
72
+ <el-form
73
+ ref="formRefIssue"
74
+ :rules="issueTabNumberRules"
75
+ :model="issueTagNumber"
76
+ label-width="auto"
77
+ label-position="right"
78
+ data-test-id="EL-FORM-GqWUM9"
79
+ >
80
+ <span class="labelItem" data-test-id="SPAN-SJqDoL"> {{ t('batchIssuanceOfCirculationLabels') }} </span>
81
+ <el-form-item prop="numberRuleName" data-test-id="EL-FORM-ITEM-ZiV3pY">
82
+ <template #label>
83
+ <el-tooltip
84
+ v-if="t('numberRuleName').length > 7"
85
+ effect="dark"
86
+ :content="t('numberRuleName')"
87
+ placement="top"
88
+ data-test-id="EL-TOOLTIP-aSm7aX"
89
+ >
90
+ <template #default>
91
+ <span data-test-id="SPAN-V8L3Qh">{{ `${t('numberRuleName').slice(0, 7)}...` }}</span>
92
+ </template>
93
+ </el-tooltip>
94
+ <span v-else data-test-id="SPAN-huBVhp"> {{ t('numberRuleName') }} </span>
95
+ </template>
96
+ <el-select
97
+ v-model="issueTagNumber.numberRuleName"
98
+ :disabled="labelType !== 'issue'"
99
+ class="formInput"
100
+ data-test-id="EL-SELECT-UKzdTp"
101
+ @change="handleSelectChange"
102
+ >
103
+ <el-option
104
+ v-for="item in props.systemNumber"
105
+ :key="item.numberName"
106
+ :label="item.numberName"
107
+ :value="item"
108
+ data-test-id="EL-OPTION-ulbYwl"
109
+ />
110
+ </el-select>
111
+ </el-form-item>
112
+ <el-form-item prop="previewOfNumberingRules" data-test-id="EL-FORM-ITEM-qzVO40">
113
+ <template #label>
114
+ <el-tooltip
115
+ v-if="t('previewOfNumberingRules').length > 7"
116
+ effect="dark"
117
+ :content="t('previewOfNumberingRules')"
118
+ placement="top"
119
+ data-test-id="EL-TOOLTIP-hSzpS6"
120
+ >
121
+ <template #default>
122
+ <span data-test-id="SPAN-sug7y3">{{ `${t('previewOfNumberingRules').slice(0, 7)}...` }}</span>
123
+ </template>
124
+ </el-tooltip>
125
+ <span v-else data-test-id="SPAN-Brqkv2"> {{ t('previewOfNumberingRules') }} </span>
126
+ </template>
127
+ <el-input
128
+ v-model="issueTagNumber.previewOfNumberingRules"
129
+ readonly
130
+ class="formInput"
131
+ data-test-id="EL-INPUT-iA50VF"
132
+ />
133
+ </el-form-item>
134
+ <el-form-item prop="numberOfTags" data-test-id="EL-FORM-ITEM-uIHEPm">
135
+ <template #label>
136
+ <el-tooltip
137
+ v-if="t('numberOfTags').length > 7"
138
+ effect="dark"
139
+ :content="t('numberOfTags')"
140
+ placement="top"
141
+ data-test-id="EL-TOOLTIP-YhGGL5"
142
+ >
143
+ <template #default>
144
+ <span data-test-id="SPAN-bviC0x">{{ `${t('numberOfTags').slice(0, 7)}...` }}</span>
145
+ </template>
146
+ </el-tooltip>
147
+ <span v-else data-test-id="SPAN-8Dgj3D"> {{ t('numberOfTags') }} </span>
148
+ </template>
149
+ <el-input
150
+ v-model="issueTagNumber.numberOfTags"
151
+ :disabled="labelType !== 'issue'"
152
+ class="formInput"
153
+ data-test-id="EL-INPUT-isu6K4"
154
+ />
155
+ </el-form-item>
156
+ <el-form-item prop="batchIssuanceQuantity" data-test-id="EL-FORM-ITEM-K6zl5U">
157
+ <template #label>
158
+ <el-tooltip
159
+ v-if="t('batchIssuanceQuantity').length > 7"
160
+ effect="dark"
161
+ :content="t('batchIssuanceQuantity')"
162
+ placement="top"
163
+ data-test-id="EL-TOOLTIP-ByG4hS"
164
+ >
165
+ <template #default>
166
+ <span data-test-id="SPAN-i3QsOD">{{ `${t('batchIssuanceQuantity').slice(0, 7)}...` }}</span>
167
+ </template>
168
+ </el-tooltip>
169
+ <span v-else data-test-id="SPAN-IFc3ek"> {{ t('batchIssuanceQuantity') }} </span>
170
+ </template>
171
+ <el-input
172
+ v-model="issueTagNumber.batchIssuanceQuantity"
173
+ :disabled="labelType !== 'issue'"
174
+ class="formInput"
175
+ data-test-id="EL-INPUT-pXb3Wj"
176
+ />
177
+ <el-button
178
+ size="default"
179
+ type="primary"
180
+ class="ml-5"
181
+ :loading="props.buttonLoading"
182
+ :disabled="labelInformation.newQuantity === 0 || labelType !== 'issue'"
183
+ data-test-id="EL-BUTTON-2CkaaK"
184
+ @click="handleIssue(formRefIssue)"
185
+ >
186
+ <v-icon class="mdi mdi-shape-square-plus" data-test-id="V-ICON-3eJRX9" />{{ t('generate') }}
187
+ </el-button>
188
+ </el-form-item>
189
+ </el-form>
190
+ </div>
191
+ </template>
192
+
193
+ <script setup>
194
+ import { ElMessage } from 'element-plus';
195
+ import { onMounted, ref, inject, reactive, computed, watch, nextTick } from 'vue';
196
+ import { useI18n } from 'vue-i18n';
197
+
198
+ const { t } = useI18n();
199
+ /* 通信 */
200
+ const props = defineProps({
201
+ addInformation: Object || Array,
202
+ systemNumber: Array,
203
+ buttonLoading: Boolean,
204
+ });
205
+ const emits = defineEmits(['updateAddInformation', 'issueAddInformation']);
206
+ const labelType = inject('type');
207
+ const labelInformation = inject('labelInformation');
208
+
209
+ /* 手动新增相关相关 */
210
+ const formRef = ref(null);
211
+ const addTagNumber = ref({
212
+ circulationTagNumber: null,
213
+ numberOfTags: 1,
214
+ });
215
+
216
+ /* 验证规则相关 */
217
+ // 验证规则:流转标签号
218
+ const circulationTagNumberRules = (rule, value, callback) => {
219
+ if ((value ?? '') === '') {
220
+ return callback(new Error(t('requiredField')));
221
+ }
222
+ const regex = /^(?!\s)(?!.*\s$)[A-Za-z0-9]{1,50}$/;
223
+ if (!regex.test(value)) {
224
+ return callback(new Error(t('flowLabelSpecification')));
225
+ }
226
+ return callback();
227
+ };
228
+ // 验证规则:每张流转卡数量
229
+ const numberOfTagsRules = (rule, value, callback) => {
230
+ if ((value ?? '') === '') {
231
+ return callback(new Error(t('requiredField')));
232
+ }
233
+ const regex = /^(?!0+$)(?!^\s|\s$)[1-9][0-9]*$/;
234
+ if (!regex.test(value)) {
235
+ return callback(new Error(t('onlySupportsPositiveIntegers')));
236
+ }
237
+ if (Number(value) - labelInformation.newQuantity > 0) {
238
+ return callback(new Error(t('remainingBindingQuantity') + labelInformation.newQuantity));
239
+ }
240
+ return callback();
241
+ };
242
+ const tagNumberRules = reactive({
243
+ circulationTagNumber: [{ validator: circulationTagNumberRules }],
244
+ numberOfTags: [{ validator: numberOfTagsRules }],
245
+ });
246
+
247
+ const circulationTagNumber = ref(null);
248
+ /**
249
+ * 提交及回车事件
250
+ */
251
+ const keyDown = (formEl) => {
252
+ if (!formEl) return;
253
+ formEl.validate((valid) => {
254
+ if (valid) {
255
+ circulationTagNumber.value.focus();
256
+ //判断是否重复
257
+ const isRepeat = props.addInformation.filter(
258
+ (item) => item.circulationTagNumber === addTagNumber.value.circulationTagNumber,
259
+ );
260
+ if (isRepeat.length !== 0) {
261
+ ElMessage.error(t('theCirculationTagNumberIsAUniqueCodeAndCannotBeDuplicated'));
262
+ return;
263
+ }
264
+ emits('updateAddInformation', { ...addTagNumber.value, status: 1 });
265
+ labelInformation.newQuantity -= Number(addTagNumber.value.numberOfTags);
266
+ addTagNumber.value.circulationTagNumber = null;
267
+ formRef.value?.clearValidate();
268
+ }
269
+ });
270
+ };
271
+
272
+ /* 批量发行相关 */
273
+ const formRefIssue = ref(null);
274
+ const issueTagNumber = ref({
275
+ numberRuleName: null,
276
+ previewOfNumberingRules: null,
277
+ numberOfTags: 1,
278
+ batchIssuanceQuantity: null,
279
+ });
280
+ const maxIssuanceQuantity = computed(() => Math.ceil(labelInformation.newQuantity / issueTagNumber.value.numberOfTags));
281
+ issueTagNumber.value.batchIssuanceQuantity = maxIssuanceQuantity.value;
282
+ /* 监听发行部分每张流转卡数量,改变时更改相应批量发行数量 */
283
+ watch(
284
+ () => issueTagNumber.value.numberOfTags,
285
+ () => {
286
+ issueTagNumber.value.batchIssuanceQuantity = maxIssuanceQuantity.value;
287
+ },
288
+ );
289
+ /* 监听可以新增数量,实时更新 */
290
+ watch(
291
+ () => labelInformation.newQuantity,
292
+ () => {
293
+ issueTagNumber.value.batchIssuanceQuantity = maxIssuanceQuantity.value;
294
+ },
295
+ );
296
+
297
+ /* 批量发行验证规则 */
298
+ //编号规则名称
299
+ const numberRuleNameRules = (rule, value, callback) => {
300
+ if ((value ?? '') === '') {
301
+ return callback(new Error(t('thereIsNoCirculationLabelNumberingRule')));
302
+ }
303
+ return callback();
304
+ };
305
+ //每张流转卡数量
306
+ const numberOfTagsRulesIssue = (rule, value, callback) => {
307
+ if ((value ?? '') === '') {
308
+ return callback(new Error(t('requiredField')));
309
+ }
310
+ const regex = /^(?!0+$)(?!^\s|\s$)[1-9][0-9]*$/;
311
+ if (!regex.test(value)) {
312
+ return callback(new Error(t('onlySupportsPositiveIntegers')));
313
+ }
314
+ if (Number(value) - labelInformation.newQuantity > 0) {
315
+ return callback(new Error(t('remainingBindingQuantity') + labelInformation.newQuantity));
316
+ }
317
+ return callback();
318
+ };
319
+ //批量发行数量
320
+ const batchIssuanceQuantityRules = (rule, value, callback) => {
321
+ if ((value ?? '') === '') {
322
+ return callback(new Error(t('requiredField')));
323
+ }
324
+ const regex = /^(?!0+$)(?!^\s|\s$)[1-9][0-9]*$/;
325
+ if (!regex.test(value)) {
326
+ return callback(new Error(t('onlySupportsPositiveIntegers')));
327
+ }
328
+ if (Number(value) - maxIssuanceQuantity.value > 0) {
329
+ return callback(new Error(t('insufficientRemainingIssuableQuantity')));
330
+ }
331
+ return callback();
332
+ };
333
+ const issueTabNumberRules = reactive({
334
+ numberOfTags: [{ validator: numberOfTagsRulesIssue }],
335
+ batchIssuanceQuantity: [{ validator: batchIssuanceQuantityRules }],
336
+ numberRuleName: [{ validator: numberRuleNameRules }],
337
+ });
338
+
339
+ /**
340
+ * 下拉选择修改预览
341
+ * @param val 下拉选择项
342
+ */
343
+ const handleSelectChange = (val) => {
344
+ issueTagNumber.value.previewOfNumberingRules = val.previewNumber;
345
+ };
346
+ /**
347
+ * 获取编号规则-页面初始状态下默认选中一条
348
+ */
349
+ const handleSystemNumber = (val) => {
350
+ if (val.length > 0) {
351
+ issueTagNumber.value.numberRuleName = val[0];
352
+ issueTagNumber.value.previewOfNumberingRules = val[0].previewNumber;
353
+ }
354
+ };
355
+ /**
356
+ * 生成按钮
357
+ * @param formEl formRef
358
+ */
359
+ const handleIssue = (formEl) => {
360
+ if (!formEl) return;
361
+ formEl.validate((valid) => {
362
+ if (valid) {
363
+ if (!issueTagNumber.value.numberRuleName) {
364
+ ElMessage.error(t('thereIsNoCirculationLabelNumberingRule'));
365
+ return;
366
+ }
367
+ emits('issueAddInformation', { ...issueTagNumber.value, status: 0 });
368
+ }
369
+ });
370
+ };
371
+ onMounted(() => {
372
+ nextTick(async () => {
373
+ if (labelType === 'issue') {
374
+ handleSystemNumber(props.systemNumber);
375
+ circulationTagNumber.value?.focus();
376
+ }
377
+ });
378
+ });
379
+ </script>
380
+
381
+ <style lang="scss" scoped>
382
+ .circulationLabel {
383
+ padding: 50px 10px 0px 10px;
384
+ }
385
+ .labelItem {
386
+ line-height: 3rem;
387
+ font-size: 1rem;
388
+ font-weight: 600;
389
+ color: #205b8f;
390
+ }
391
+ .formInput {
392
+ max-width: 65%;
393
+ }
394
+ </style>
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <el-table
3
+ v-loading="props.tableLoading"
4
+ :data="tableData"
5
+ border
6
+ style="height: calc(100vh - 11rem)"
7
+ header-row-class-name="tableHeader"
8
+ header-cell-class-name="tableHeaderCell"
9
+ data-test-id="EL-TABLE-iJBS6G"
10
+ @selection-change="handleSelectionChange"
11
+ >
12
+ <el-table-column align="center" type="selection" width="55" data-test-id="EL-TABLE-COLUMN-X3f0xk" />
13
+ <el-table-column
14
+ prop="index"
15
+ :label="t('itemIndex')"
16
+ width="100"
17
+ align="center"
18
+ data-test-id="EL-TABLE-COLUMN-GTWbL9"
19
+ >
20
+ <template #default="scope">{{ scope.$index + 1 }}</template>
21
+ </el-table-column>
22
+ <el-table-column
23
+ v-for="item in tableColumns"
24
+ :key="item.value"
25
+ :prop="item.value"
26
+ :label="item.text"
27
+ show-overflow-tooltip
28
+ align="center"
29
+ data-test-id="EL-TABLE-COLUMN-aZ0Wkn"
30
+ >
31
+ <template #default="{ row, column }">
32
+ <span data-test-id="SPAN-LYFZXL">
33
+ {{ row[column.property] ?? '-' }}
34
+ </span>
35
+ </template>
36
+ </el-table-column>
37
+ <el-table-column
38
+ v-if="labelType === 'issue'"
39
+ align="center"
40
+ width="100"
41
+ :label="t('action')"
42
+ data-test-id="EL-TABLE-COLUMN-YdBefU"
43
+ >
44
+ <template #default="scope">
45
+ <el-tooltip
46
+ v-if="scope.row.status === 1"
47
+ effect="dark"
48
+ :content="t('delete')"
49
+ placement="top"
50
+ data-test-id="EL-TOOLTIP-8M9Okr"
51
+ >
52
+ <el-button link type="primary" data-test-id="EL-BUTTON-YQDipD" @click="deleteItem(scope.$index, scope.row)">
53
+ <v-icon class="mdi mdi-delete" data-test-id="V-ICON-zPe0Jb" />
54
+ </el-button>
55
+ </el-tooltip>
56
+ <el-tooltip v-else effect="dark" :content="t('unbinded')" placement="top" data-test-id="EL-TOOLTIP-tnCOjd">
57
+ <el-button link type="primary" data-test-id="EL-BUTTON-sKP7px" @click="unbindedItem(scope.$index, scope.row)">
58
+ <v-icon class="mdi mdi-link" data-test-id="V-ICON-gLd3HR" />
59
+ </el-button>
60
+ </el-tooltip>
61
+ </template>
62
+ </el-table-column>
63
+ </el-table>
64
+ </template>
65
+
66
+ <script setup>
67
+ import { ElMessageBox } from 'element-plus';
68
+ import { computed, inject } from 'vue';
69
+ import { useI18n } from 'vue-i18n';
70
+
71
+ const { t } = useI18n();
72
+
73
+ const props = defineProps({
74
+ addInformation: Object || Array,
75
+ tableLoading: Boolean,
76
+ });
77
+ const emits = defineEmits(['deleteItem', 'unbindedItem', 'selectRowList']);
78
+ const labelType = inject('type');
79
+ /* 表格相关 */
80
+ const tableColumns = computed(() => [
81
+ {
82
+ text: t('circulationTagNumber'),
83
+ value: 'circulationTagNumber',
84
+ },
85
+ {
86
+ text: t('countOfTags'),
87
+ value: 'numberOfTags',
88
+ },
89
+ ]);
90
+ const tableData = computed(() => props.addInformation);
91
+
92
+ /**
93
+ * 删除
94
+ * @param index 索引
95
+ * @param row 行数据
96
+ */
97
+ const deleteItem = (index, row) => {
98
+ emits('deleteItem', index, row);
99
+ };
100
+ /**
101
+ * 解绑
102
+ * @param index 索引
103
+ * @param row 行数据
104
+ */
105
+ const unbindedItem = (index, row) => {
106
+ ElMessageBox.confirm(t('areYouSureToUnbind'), t('warning'), {
107
+ confirmButtonText: t('confirm'),
108
+ cancelButtonText: t('cancel'),
109
+ type: 'warning',
110
+ }).then(async () => {
111
+ emits('unbindedItem', index, row);
112
+ });
113
+ };
114
+
115
+ /**
116
+ * 表格行选择事件
117
+ * @param item 勾选项
118
+ */
119
+ const handleSelectionChange = (item) => {
120
+ emits('selectRowList', item);
121
+ };
122
+ </script>
123
+
124
+ <style scoped lang="scss"></style>
@@ -0,0 +1,167 @@
1
+ <template>
2
+ <el-dialog
3
+ v-model="showDialog"
4
+ :title="t('filePreview')"
5
+ width="50%"
6
+ destroy-on-close
7
+ center
8
+ align-center
9
+ :close-on-click-modal="false"
10
+ :close-on-press-escape="false"
11
+ :modal-append-to-body="true"
12
+ :append-to-body="true"
13
+ style="border-radius: 6px"
14
+ data-test-id="EL-DIALOG-OUDw27-productionWorkOrder-materialPartFilePreview"
15
+ >
16
+ <div data-test-id="DIV-GzCoGO-productionWorkOrder-materialPartFilePreview">
17
+ <el-table
18
+ v-loading="tableLoading"
19
+ :data="previewData"
20
+ height="60vh"
21
+ header-row-class-name="tableHeader"
22
+ header-cell-class-name="tableHeaderCell"
23
+ :border="true"
24
+ scrollbar-always-on
25
+ show-overflow-tooltip
26
+ data-test-id="EL-TABLE-xcakfh-productionWorkOrder-materialPartFilePreview"
27
+ >
28
+ <el-table-column
29
+ width="60"
30
+ :align="tableAlign"
31
+ label="#"
32
+ data-test-id="EL-TABLE-COLUMN-8KX1B4-productionWorkOrder-materialPartFilePreview"
33
+ >
34
+ <template #default="scope">{{ scope.$index + 1 }}</template>
35
+ </el-table-column>
36
+ <el-table-column
37
+ :align="tableAlign"
38
+ prop="fileName"
39
+ :label="t('fileName')"
40
+ data-test-id="EL-TABLE-COLUMN-EnR3wc-productionWorkOrder-materialPartFilePreview"
41
+ >
42
+ </el-table-column>
43
+ <el-table-column
44
+ width="100"
45
+ :align="tableAlign"
46
+ :label="t('action')"
47
+ data-test-id="EL-TABLE-COLUMN-5PxQoE-productionWorkOrder-materialPartFilePreview"
48
+ >
49
+ <template #default="scope">
50
+ <el-tooltip
51
+ :content="t('preview')"
52
+ placement="top"
53
+ :enterable="false"
54
+ :data-test-id="`EL-TOOLTIP-Ki6eYC-${scope.$index}-productionWorkOrder-materialPartFilePreview`"
55
+ >
56
+ <el-button
57
+ type="primary"
58
+ link
59
+ :disabled="scope.row.isDisabled"
60
+ :data-test-id="`EL-BUTTON-x8VH7g-${scope.$index}-productionWorkOrder-materialPartFilePreview`"
61
+ @click="handleClickPreview(scope.row)"
62
+ >
63
+ <v-icon
64
+ class="mdi mdi-file-eye"
65
+ :data-test-id="`V-ICON-pu9AWO-${scope.$index}-productionWorkOrder-materialPartFilePreview`"
66
+ />
67
+ </el-button>
68
+ </el-tooltip>
69
+ </template>
70
+ </el-table-column>
71
+ </el-table>
72
+ </div>
73
+ <template #footer>
74
+ <el-button
75
+ type="primary"
76
+ data-test-id="EL-BUTTON-RFLfJQ-productionWorkOrder-materialPartFilePreview"
77
+ @click="showDialog = false"
78
+ >
79
+ {{ $t('close') }}
80
+ </el-button>
81
+ </template>
82
+ <el-image
83
+ ref="imgViewRef"
84
+ style="width: 100px; height: 100px; display: none"
85
+ :src="previewUrl"
86
+ :zoom-rate="1.2"
87
+ :preview-teleported="true"
88
+ :preview-src-list="[previewUrl]"
89
+ :initial-index="1"
90
+ fit="cover"
91
+ data-test-id="EL-IMAGE-XDsHgs-productionWorkOrder-materialPartFilePreview"
92
+ />
93
+ </el-dialog>
94
+ </template>
95
+
96
+ <script setup>
97
+ import { ref } from 'vue';
98
+ import { ElMessage } from 'element-plus';
99
+ import apiFunction from '@/scriptFiles/checkApiErrorMechanism.js';
100
+ import { useI18n } from 'vue-i18n';
101
+ const { t } = useI18n();
102
+
103
+ const tableLoading = ref(false);
104
+ const previewUrl = ref('');
105
+ const imgViewRef = ref(null);
106
+ const previewData = ref([]);
107
+ const tableAlign = ref('center');
108
+ const showDialog = ref(false);
109
+
110
+ // 打开弹窗
111
+ const handleOpenDialog = (list) => {
112
+ previewUrl.value = '';
113
+ tableLoading.value = false;
114
+ previewData.value =
115
+ list && list.length
116
+ ? list.map((item) => {
117
+ const fileType = item.plmFileName
118
+ ? item.plmFileName.includes('.')
119
+ ? item.plmFileName.split('.').pop().toLowerCase()
120
+ : ''
121
+ : '';
122
+ const isDisabled = !['jpeg', 'gif', 'jpg', 'png', 'pdf'].includes(fileType);
123
+ return { ...item, fileType, isDisabled, fileName: item.plmFileName };
124
+ })
125
+ : [];
126
+ showDialog.value = true;
127
+ };
128
+
129
+ // 预览
130
+ const handleClickPreview = async (rowObj) => {
131
+ const { fileName, plmFileVersionId } = rowObj;
132
+ tableLoading.value = true;
133
+ previewUrl.value = '';
134
+ let res;
135
+ if (rowObj.fileType === 'pdf') {
136
+ res = await apiFunction
137
+ .downloadPlm({ plmFileVersionId })
138
+ .finally(() => (tableLoading.value = false))
139
+ .catch(() => ElMessage.error(t('apiError')));
140
+ } else {
141
+ res = await apiFunction
142
+ .getPlmFilePreviewStream({
143
+ plmFileVersionId,
144
+ })
145
+ .finally(() => (tableLoading.value = false))
146
+ .catch(() => ElMessage.error(t('apiError')));
147
+ }
148
+ if (res.status === 200) {
149
+ tableLoading.value = false;
150
+ const blob = new Blob([res.data], { type: res.data.type });
151
+ if (['jpeg', 'gif', 'jpg', 'png'].includes(rowObj.fileType)) {
152
+ previewUrl.value = URL.createObjectURL(blob);
153
+ setTimeout(() => imgViewRef.value.$el.children[0].click(), 0);
154
+ }
155
+ if (rowObj.fileType === 'pdf') {
156
+ const pdfBlob = new Blob([res.data], { type: 'application/pdf' });
157
+ const tempUrl = URL.createObjectURL(pdfBlob);
158
+ window.open(tempUrl, fileName);
159
+ }
160
+ }
161
+ };
162
+
163
+ defineExpose({ handleOpenDialog });
164
+ </script>
165
+ <style scoped lang="scss">
166
+ @use '/src/scss/base/table.scss';
167
+ </style>