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,28 @@
1
+ <template>
2
+ <el-form inline data-test-id="EL-FORM-pc6sNQ">
3
+ <el-form-item
4
+ v-for="i in Object.entries(labelInformation)"
5
+ :key="i"
6
+ :label="`${t(i[0])}:`"
7
+ data-test-id="EL-FORM-ITEM-UG0QBp"
8
+ >
9
+ <span style="font-size: 1rem; font-weight: 600" data-test-id="SPAN-70loCf">
10
+ {{ i[1] }}
11
+ </span>
12
+ </el-form-item>
13
+ </el-form>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { inject } from 'vue';
18
+ import { useI18n } from 'vue-i18n';
19
+
20
+ const { t } = useI18n();
21
+ const labelInformation = inject('labelInformation');
22
+ </script>
23
+
24
+ <style lang="scss" scoped>
25
+ .el-form-item {
26
+ margin-bottom: 5px;
27
+ }
28
+ </style>
@@ -0,0 +1,604 @@
1
+ <template>
2
+ <fullPageGlobal
3
+ v-model="dialogShow"
4
+ v-loading="loading"
5
+ :global-props="pageTitle"
6
+ data-test-id="FULLPAGEGLOBAL-A7yL2s"
7
+ @submit="submit"
8
+ @close="close"
9
+ >
10
+ <template #head_button>
11
+ <div v-for="b in buttonConfiguration" :key="b" style="display: inline" class="mr-3" data-test-id="DIV-6C3Jzz">
12
+ <el-dropdown v-if="b?.children" class="mr-1" data-test-id="EL-DROPDOWN-oVXKZ6">
13
+ <el-button
14
+ class="button_item_porcess"
15
+ type="primary"
16
+ link
17
+ :disabled="b.disabled"
18
+ data-test-id="EL-BUTTON-9rINep"
19
+ @click="b.func"
20
+ >
21
+ <i :class="b.icon" style="margin-right: 0.5rem" data-test-id="I-ivaMGQ" />
22
+ {{ b.text }}
23
+ </el-button>
24
+ <template #dropdown>
25
+ <el-dropdown-menu data-test-id="EL-DROPDOWN-MENU-iFIQs2">
26
+ <el-dropdown-item v-for="d in b.children" :key="d" data-test-id="EL-DROPDOWN-ITEM-YSFJTJ">
27
+ <el-upload
28
+ v-if="d.text === t('excelImport')"
29
+ action="#"
30
+ :auto-upload="false"
31
+ :on-change="d.func"
32
+ :show-file-list="false"
33
+ accept=".xls,.xlsx"
34
+ data-test-id="EL-UPLOAD-bc6rEM"
35
+ >
36
+ <el-button
37
+ class="button_item_porcess"
38
+ type="primary"
39
+ link
40
+ :disabled="d.disabled"
41
+ data-test-id="EL-BUTTON-rypkgr"
42
+ >
43
+ <i :class="d.icon" style="margin-right: 0.5rem" data-test-id="I-OBeBJJ" />
44
+ {{ d.text }}
45
+ </el-button>
46
+ </el-upload>
47
+ <el-button
48
+ v-else
49
+ class="button_item_porcess"
50
+ type="primary"
51
+ link
52
+ :disabled="d.disabled"
53
+ data-test-id="EL-BUTTON-u8TeWQ"
54
+ @click="d.func"
55
+ >
56
+ <i :class="d.icon" style="margin-right: 0.5rem" data-test-id="I-PAp2ms" />
57
+ {{ d.text }}
58
+ </el-button>
59
+ </el-dropdown-item>
60
+ </el-dropdown-menu>
61
+ </template>
62
+ </el-dropdown>
63
+ <el-button
64
+ v-else
65
+ class="button_item_porcess"
66
+ type="primary"
67
+ link
68
+ :disabled="b.disabled"
69
+ data-test-id="EL-BUTTON-G5qsSe"
70
+ @click="b.func"
71
+ >
72
+ <i :class="b.icon" style="margin-right: 0.5rem" data-test-id="I-RRpVrn" />
73
+ {{ b.text }}
74
+ </el-button>
75
+ </div>
76
+ </template>
77
+ <div style="height: 100vh" data-test-id="DIV-DjuZAi">
78
+ <el-row class="panel_row" :gutter="20" data-test-id="EL-ROW-7Eq4yZ">
79
+ <el-col :span="12" data-test-id="EL-COL-XucTfL">
80
+ <workOrderInformation data-test-id="WORKORDERINFORMATION-00Y4Jr" />
81
+ <div v-loading="!systemNumberStatus" class="panel_left" data-test-id="DIV-hUIPZQ">
82
+ <addCirculationLabel
83
+ v-if="systemNumberStatus"
84
+ :add-information="addInformation"
85
+ :system-number="systemNumber"
86
+ :button-loading="buttonLoading"
87
+ data-test-id="ADDCIRCULATIONLABEL-G7NwFp"
88
+ @update-add-information="updateAddInformation"
89
+ @issue-add-information="issueAddInformation"
90
+ />
91
+ </div>
92
+ </el-col>
93
+ <el-col :span="12" data-test-id="EL-COL-Bp9Zzs">
94
+ <div class="table_name" data-test-id="DIV-4occB3">
95
+ <el-row data-test-id="EL-ROW-X2y9qm">
96
+ <el-col :span="14" data-test-id="EL-COL-dm1vmj">
97
+ <i class="mdi mdi-watermark mr-1" style="color: #2a69a2" data-test-id="I-5F8kxm" />
98
+ <span data-test-id="SPAN-rALqNw">{{ t('bindFlowLabelList') }}</span>
99
+ </el-col>
100
+ <el-col :span="6" data-test-id="EL-COL-fArVtC">
101
+ <el-select
102
+ v-model="searchModel"
103
+ class="mb-2 mt-2"
104
+ filterable
105
+ multiple
106
+ collapse-tags
107
+ collapse-tags-tooltip
108
+ clearable
109
+ :placeholder="t('selectTheCirculationTagNumber')"
110
+ data-test-id="EL-SELECT-tWANHh"
111
+ >
112
+ <el-option
113
+ v-for="item in searchOptions"
114
+ :key="item.value"
115
+ :label="item.label"
116
+ :value="item.value"
117
+ data-test-id="EL-OPTION-Q41ToU"
118
+ />
119
+ </el-select>
120
+ </el-col>
121
+ <el-col :span="1" data-test-id="EL-COL-a8qPCK"> </el-col>
122
+ <el-col :span="3" data-test-id="EL-COL-YaxqSA">
123
+ <el-button
124
+ :loading="tableLoading"
125
+ class="mb-2 mt-2"
126
+ type="primary"
127
+ style="float: right"
128
+ data-test-id="EL-BUTTON-qKNXcD"
129
+ @click="handleSearch"
130
+ >
131
+ <v-icon class="mdi mdi-magnify" data-test-id="V-ICON-Le3Qa9" />{{ t('query') }}
132
+ </el-button>
133
+ </el-col>
134
+ </el-row>
135
+ </div>
136
+ <div class="panel_right" data-test-id="DIV-5EhGuY">
137
+ <circulationLabelTable
138
+ :add-information="addInformation"
139
+ :table-loading="tableLoading"
140
+ data-test-id="CIRCULATIONLABELTABLE-Cwfb3r"
141
+ @delete-item="deleteItem"
142
+ @unbinded-item="unbindedItem"
143
+ @select-row-list="selectTableData"
144
+ @show-table-loading="tableLoading = !tableLoading"
145
+ />
146
+ </div>
147
+ </el-col>
148
+ </el-row>
149
+ </div>
150
+ </fullPageGlobal>
151
+ </template>
152
+
153
+ <script setup>
154
+ import { computed, onMounted, provide, ref, watch } from 'vue';
155
+ import { useI18n } from 'vue-i18n';
156
+ import fullPageGlobal from '@/components/Layout/modules/fullPageGlobal.vue';
157
+ import addCirculationLabel from './component/addCirculationLabel.vue';
158
+ import workOrderInformation from './component/workOrderInformation.vue';
159
+ import circulationLabelTable from './component/circulationLabelTable.vue';
160
+ import { ElMessage, ElMessageBox } from 'element-plus';
161
+ import untils from '@/plugins/excel';
162
+ import apiFunction from '@/scriptFiles/checkApiErrorMechanism.js';
163
+
164
+ const { t } = useI18n();
165
+ /* 页面loading */
166
+ const loading = ref(false);
167
+ /* 通信 */
168
+ const props = defineProps({
169
+ value: Boolean,
170
+ labelInformation: Object,
171
+ });
172
+ const emits = defineEmits(['closeProductionFlowLabel']);
173
+ const dialogShow = computed({
174
+ get: () => props.value,
175
+ set: () => emits('closeProductionFlowLabel'),
176
+ });
177
+ /* 表格信息 status=0-绑定 status=1-新增 */
178
+ const addInformation = ref([]);
179
+ addInformation.value = [
180
+ { circulationTagNumber: 'lzbqt1', numberOfTags: 1, status: 0 },
181
+ { circulationTagNumber: 'lzbqt2', numberOfTags: 1, status: 0 },
182
+ { circulationTagNumber: 'lzbqt3', numberOfTags: 1, status: 0 },
183
+ { circulationTagNumber: 'lzbqt4', numberOfTags: 2, status: 0 },
184
+ ];
185
+
186
+ /* 页面标题,通过进入时的type判断 */
187
+ const pageTitle = computed(() => (props.labelInformation.type === 'issue' ? t('labelingIssuance') : t('tagPreview')));
188
+ /* table部分子组件及新增部分子组件loading */
189
+ const [tableLoading, buttonLoading] = [ref(false), ref(false)];
190
+
191
+ /* 查询相关 */
192
+ const searchModel = ref([]);
193
+ const searchOptions = [
194
+ {
195
+ value: 'abc',
196
+ key: 'a',
197
+ },
198
+ {
199
+ value: 'bca',
200
+ key: 'b',
201
+ },
202
+ {
203
+ value: 'c',
204
+ key: 'c',
205
+ },
206
+ {
207
+ value: 'd',
208
+ key: 'd',
209
+ },
210
+ {
211
+ value: 'e',
212
+ key: 'e',
213
+ },
214
+ ];
215
+ /**
216
+ * 模糊查询筛选列表
217
+ */
218
+ const handleSearch = async () => {
219
+ tableLoading.value = true;
220
+ await new Promise((resolve) => setTimeout(resolve, 2000));
221
+ tableLoading.value = false;
222
+ };
223
+
224
+ const systemNumber = ref([]);
225
+ const systemNumberStatus = ref(false); //用于确认是否加载完。加载完后渲染组件
226
+ /**
227
+ * 获取编号规则
228
+ */
229
+ const fetchSystemNumber = async () => {
230
+ try {
231
+ const param = {
232
+ startIndex: 0,
233
+ count: 200,
234
+ numberName: null,
235
+ targetForm: '3',
236
+ };
237
+ const { data } = await apiFunction.getSystemNumber(param);
238
+ if (data) {
239
+ systemNumber.value = data.content.data;
240
+ }
241
+ } catch (error) {
242
+ ElMessage.error(t('apiError'));
243
+ } finally {
244
+ systemNumberStatus.value = true;
245
+ }
246
+ };
247
+
248
+ /**
249
+ * 新增流转标签时将参数传递至父组件再转而更新表格数据
250
+ * @param {Object|Array} val 新增流转标签传递参数
251
+ */
252
+ const updateAddInformation = (val) => {
253
+ addInformation.value = Array.isArray(val) ? [...val, ...addInformation.value] : [val, ...addInformation.value];
254
+ };
255
+ /**
256
+ * 生成流转标签时将参数传递至父组件再转而更新表格数据
257
+ * @param {Object} val 生成流转标签传递参数
258
+ */
259
+ const issueAddInformation = async (val) => {
260
+ tableLoading.value = true;
261
+ buttonLoading.value = true;
262
+ try {
263
+ await new Promise((resolve) => setTimeout(resolve, 2000));
264
+ const data = val;
265
+ console.log('[data]:', data);
266
+ ElMessage.success(t('successfullyGenerated'));
267
+ } catch (error) {
268
+ ElMessage.error(t('apiError'));
269
+ } finally {
270
+ tableLoading.value = false;
271
+ buttonLoading.value = false;
272
+ }
273
+ };
274
+ /**
275
+ * 表格行删除事件
276
+ * @param row 删除行数据
277
+ */
278
+ const deleteItem = (index, row) => {
279
+ ElMessage.success(t('deleteSuccess'));
280
+ addInformation.value = addInformation.value.filter((item) => item.circulationTagNumber !== row.circulationTagNumber);
281
+ // eslint-disable-next-line no-use-before-define
282
+ productionWorkOrderInformation.value.newQuantity += Number(row.numberOfTags);
283
+ };
284
+ /**
285
+ * 表格行解绑事件
286
+ * @param row 解绑行数据
287
+ */
288
+ const unbindedItem = async (index, row) => {
289
+ tableLoading.value = true;
290
+ await new Promise((resolve) => setTimeout(resolve, 2000));
291
+ tableLoading.value = false;
292
+ ElMessage.success(t('unbindSuccessfully'));
293
+ addInformation.value.splice(index, 1);
294
+ // eslint-disable-next-line no-use-before-define
295
+ productionWorkOrderInformation.value.boundQuantity -= Number(row.numberOfTags);
296
+ };
297
+ /**
298
+ * @param val 批量勾选数据
299
+ */
300
+ const extractTableData = ref([]);
301
+ const selectTableData = (val) => {
302
+ extractTableData.value = val;
303
+ };
304
+
305
+ /**
306
+ * 关闭dialog
307
+ */
308
+ const close = () => {
309
+ if (props.labelInformation.type !== 'issue') {
310
+ dialogShow.value = false;
311
+ return;
312
+ }
313
+ ElMessageBox.confirm(t('closeAddTagNumber'), t('warning'), {
314
+ confirmButtonText: t('confirm'),
315
+ cancelButtonText: t('cancel'),
316
+ type: 'warning',
317
+ }).then(() => {
318
+ dialogShow.value = false;
319
+ });
320
+ };
321
+
322
+ /* 生产工单信息 */
323
+ const productionWorkOrderInformation = ref({
324
+ productionOrderNumber: props.labelInformation.info.productionOrderNumber || '--',
325
+ partNumber: props.labelInformation.info.partNumber || '--',
326
+ productName: props.labelInformation.info.productName || '--',
327
+ materialSpec: props.labelInformation.info.materialSpec || '--',
328
+ productionOrderRequiredThroughput: props.labelInformation.info.productionOrderRequiredThroughput ?? '--',
329
+ boundQuantity: addInformation.value.map((item) => item['numberOfTags']).reduce((acc, curr) => acc + curr, 0),
330
+ });
331
+ productionWorkOrderInformation.value = {
332
+ ...productionWorkOrderInformation.value,
333
+ newQuantity:
334
+ productionWorkOrderInformation.value.productionOrderRequiredThroughput -
335
+ productionWorkOrderInformation.value.boundQuantity,
336
+ };
337
+ /* 监听解绑时的操作,按照解绑的标签数量修改剩余可以新增的标签数量 */
338
+ watch(
339
+ () => productionWorkOrderInformation.value.boundQuantity,
340
+ (newValue, oldValue) => {
341
+ productionWorkOrderInformation.value.newQuantity += oldValue - newValue;
342
+ },
343
+ );
344
+ provide('labelInformation', productionWorkOrderInformation.value);
345
+ provide('type', props.labelInformation.type);
346
+ /**
347
+ * 标签发行--模板汇出
348
+ */
349
+ const exportLabelIssuanceTemplate = () => {
350
+ const title = [[`*${t('circulationTagNumber')}`, t('countOfTags')]];
351
+ const templateArr = [];
352
+ templateArr[0] = {
353
+ title: [],
354
+ name: t('fillingInstructions'),
355
+ sheetName: t('fillingInstructions'),
356
+ body: [[t('exportLabelIssuanceTemplate')]],
357
+ wsmerges: [
358
+ { s: { r: 0, c: 0 }, e: { r: 0, c: 6 } },
359
+ { s: { r: 1, c: 0 }, e: { r: 1, c: 6 } },
360
+ { s: { r: 2, c: 0 }, e: { r: 2, c: 6 } },
361
+ { s: { r: 3, c: 0 }, e: { r: 3, c: 6 } },
362
+ { s: { r: 4, c: 0 }, e: { r: 4, c: 6 } },
363
+ { s: { r: 5, c: 0 }, e: { r: 5, c: 6 } },
364
+ { s: { r: 6, c: 0 }, e: { r: 6, c: 6 } },
365
+ { s: { r: 7, c: 0 }, e: { r: 7, c: 6 } },
366
+ ],
367
+ wscols: [{ wch: 30 }, { wch: 30 }, { wch: 30 }, { wch: 30 }, { wch: 30 }, { wch: 30 }],
368
+ };
369
+ templateArr[1] = {
370
+ title,
371
+ body: [],
372
+ name: t('excelTemplate'),
373
+ sheetName: t('excelTemplate'),
374
+ wscols: [{ wch: 30 }, { wch: 30 }],
375
+ };
376
+ untils.exportBatchFromArray(templateArr, t('excelTemplate'));
377
+ };
378
+
379
+ /**
380
+ * 将excel导入的数组对象转成相应格式
381
+ * @param data 传入数组对象
382
+ */
383
+ const transformData = (data) => {
384
+ return data.map((item) => {
385
+ // 解构原始对象的值
386
+ const { [`*${t('circulationTagNumber')}`]: circulationTagNumber, [t('countOfTags')]: numberOfTags } = item;
387
+
388
+ // 返回转换后的对象
389
+ return {
390
+ circulationTagNumber,
391
+ numberOfTags: numberOfTags || 1, //标签数量若不填写则默认为1
392
+ status: 1, // 新增的 status 字段
393
+ };
394
+ });
395
+ };
396
+ /**
397
+ * excel导入
398
+ * @param file 导入文件
399
+ */
400
+ const importLabelIssuanceTemplate = async (file) => {
401
+ loading.value = true;
402
+ try {
403
+ //判断是否符合格式
404
+ const fileData = file.raw;
405
+ if (fileData.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
406
+ ElMessage.error(t('fileTypeErrorAndUploadXlsx'));
407
+ return;
408
+ }
409
+ //判断文件大小是否不超过5MB
410
+ if (fileData.size > 5 * 1024 * 1024) {
411
+ ElMessage.error(t('theFileSizeCannotExceed5Mb'));
412
+ return;
413
+ }
414
+ //判断资料是否为空
415
+ const importData = await untils.importInstructionsFromLocal(fileData);
416
+ if (importData.length === 0) {
417
+ ElMessage.error(t('excelImportNoData'));
418
+ return;
419
+ }
420
+ //判断流转标签是否符合规范
421
+ const importCirculationTagNumber = transformData(importData.body).map((item) =>
422
+ item.circulationTagNumber.toString(),
423
+ );
424
+ const regex = /^(?!\s)(?!.*\s$)[A-Za-z0-9]{1,50}$/;
425
+ const isSpecifications = importCirculationTagNumber.every((item) => regex.test(item));
426
+ if (!isSpecifications) {
427
+ ElMessage.error(t('flowLabelSpecification'));
428
+ return;
429
+ }
430
+ //判断资料中是否存在重复流转标签号
431
+ if (new Set(importCirculationTagNumber).size !== importCirculationTagNumber.length) {
432
+ ElMessage.error(t('duplicateCirculationTagNumber'));
433
+ return;
434
+ }
435
+ //判断流转标签号与表格内已有数据是否重复
436
+ const isRepeat = importCirculationTagNumber.some(
437
+ (item) => addInformation.value.filter((arr) => arr.circulationTagNumber === item).length > 0,
438
+ );
439
+ if (isRepeat) {
440
+ ElMessage.error(t('duplicateCirculationTagNumberWithNewlyAddedData'));
441
+ return;
442
+ }
443
+ //判断资料是否符合标签数量
444
+ const importTagNumber = transformData(importData.body).map((item) => item.numberOfTags);
445
+ const regexTagNumber = /^(?!0+$)(?!^\s|\s$)[1-9][0-9]*$/;
446
+ const isPositiveInteger = importTagNumber.every((item) => regexTagNumber.test(item));
447
+ if (!isPositiveInteger) {
448
+ ElMessage.error(t('onlySupportsPositiveIntegers'));
449
+ return;
450
+ }
451
+ if (importTagNumber.reduce((acc, curr) => acc + curr, 0) > productionWorkOrderInformation.value.newQuantity) {
452
+ ElMessage.error(t('insufficientNumberOfBindingsAvailable'));
453
+ return;
454
+ }
455
+
456
+ transformData(importData.body).map((item) => {
457
+ //全部判断完成,填入数据
458
+ productionWorkOrderInformation.value.newQuantity -= item.numberOfTags;
459
+ });
460
+ updateAddInformation(transformData(importData.body));
461
+ ElMessage.success(t('successfullyImported'));
462
+ } catch (error) {
463
+ ElMessage.error(t('importFail'));
464
+ } finally {
465
+ loading.value = false;
466
+ }
467
+ };
468
+
469
+ /* 按钮配置 */
470
+ const disabledBtn = ref(props.labelInformation.type === 'issue' ? false : true);
471
+ /**
472
+ * 判断批量解绑及批量删除时,勾选情况
473
+ * @param data 勾选数据
474
+ * @param status 是否绑定 0-绑定 1-未绑定
475
+ * @param errorMessage 错误提示信息
476
+ */
477
+ const checkSelection = (data, status, errorMessage) => {
478
+ if (data.length === 0) {
479
+ ElMessage.error(t(errorMessage));
480
+ return false;
481
+ }
482
+ const filteredItems = data.filter((item) => item.status === status);
483
+ if (filteredItems.length === 0) {
484
+ ElMessage.error(t(errorMessage));
485
+ return false;
486
+ }
487
+ return filteredItems;
488
+ };
489
+ const buttonConfiguration = computed(() => [
490
+ {
491
+ text: t('importExcelData'),
492
+ icon: 'mdi mdi-export',
493
+ disabled: disabledBtn.value,
494
+ children: [
495
+ {
496
+ text: t('exportTemplate'),
497
+ icon: 'mdi mdi-table-arrow-right',
498
+ disabled: disabledBtn.value,
499
+ func: exportLabelIssuanceTemplate,
500
+ },
501
+ {
502
+ text: t('excelImport'),
503
+ icon: 'mdi mdi-file-upload-outline',
504
+ disabled: disabledBtn.value,
505
+ func: importLabelIssuanceTemplate,
506
+ },
507
+ ],
508
+ },
509
+ {
510
+ text: t('batchUnbinding'),
511
+ icon: 'mdi mdi-link-off',
512
+ disabled: disabledBtn.value,
513
+ func: () => {
514
+ const selectedItems = checkSelection(extractTableData.value, 0, t('pleaseSelectTheBoundLabelFirst'));
515
+ if (!selectedItems) return;
516
+
517
+ ElMessageBox.confirm(t('areYouSureToUnbind'), t('warning'), {
518
+ confirmButtonText: t('confirm'),
519
+ cancelButtonText: t('cancel'),
520
+ type: 'warning',
521
+ }).then(async () => {
522
+ selectedItems.forEach((item) => {
523
+ addInformation.value = addInformation.value.filter(
524
+ (arr) => arr.circulationTagNumber !== item.circulationTagNumber,
525
+ );
526
+ productionWorkOrderInformation.value.boundQuantity -= Number(item.numberOfTags);
527
+ });
528
+ tableLoading.value = true;
529
+ await new Promise((resolve) => setTimeout(resolve, 2000));
530
+ tableLoading.value = false;
531
+ extractTableData.value = [];
532
+ ElMessage.success(t('batchUnbindingSuccessful'));
533
+ });
534
+ },
535
+ },
536
+ {
537
+ text: t('fileMassDelete'),
538
+ icon: 'mdi mdi-delete-off',
539
+ disabled: disabledBtn.value,
540
+ func: () => {
541
+ const selectedItems = checkSelection(extractTableData.value, 1, t('pleaseSelectUnboundTagsFirst'));
542
+ if (!selectedItems) return;
543
+
544
+ selectedItems.forEach((item) => {
545
+ addInformation.value = addInformation.value.filter(
546
+ (arr) => arr.circulationTagNumber !== item.circulationTagNumber,
547
+ );
548
+ productionWorkOrderInformation.value.newQuantity += Number(item.numberOfTags);
549
+ });
550
+ extractTableData.value = [];
551
+ ElMessage.success(t('batchDeletionSuccessful'));
552
+ },
553
+ },
554
+ ]);
555
+
556
+ /**
557
+ * 保存
558
+ */
559
+ const submit = async () => {
560
+ loading.value = true;
561
+ try {
562
+ if (props.labelInformation.type !== 'issue') {
563
+ ElMessage.error(t('cannotSaveInPreviewState'));
564
+ return;
565
+ }
566
+ await new Promise((resolve) => setTimeout(resolve, 2000));
567
+ ElMessage.success(t('saveSuccess'));
568
+ } catch (error) {
569
+ ElMessage.error(t('apiError'));
570
+ } finally {
571
+ loading.value = false;
572
+ }
573
+ };
574
+
575
+ onMounted(async () => {
576
+ loading.value = true;
577
+ await fetchSystemNumber();
578
+ await handleSearch();
579
+ loading.value = false;
580
+ });
581
+ </script>
582
+
583
+ <style lang="scss" scoped>
584
+ .panel_row {
585
+ width: 100%;
586
+ height: 100%;
587
+ }
588
+ .panel_left {
589
+ height: calc(100vh - 12.75rem);
590
+ background-color: #edf3f8;
591
+ display: flex;
592
+ flex-direction: column;
593
+ }
594
+ .panel_right {
595
+ height: 100vh;
596
+ display: flex;
597
+ flex-direction: column;
598
+ }
599
+ .table_name {
600
+ line-height: 2rem;
601
+ font-size: 1rem;
602
+ font-weight: 600;
603
+ }
604
+ </style>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div>
3
+ <el-tooltip placement="top" effect="light">
4
+ <i class="mdi mdi-information" data-test-id="I-LHAacq" />
5
+ <template #content>
6
+ <div v-for="(item, index) in priorityStatus" :key="index" data-test-id="DIV-RFpwHc">
7
+ <v-icon :class="item.icon" :style="`color: ${item.color};`" data-test-id="V-ICON-ZdtNsf" />
8
+ <span style="color: black; padding: 5px" data-test-id="SPAN-oEOumL"> {{ item.text }}</span>
9
+ </div>
10
+ </template>
11
+ </el-tooltip>
12
+ </div>
13
+ </template>
14
+
15
+ <script setup>
16
+ import { ref } from 'vue';
17
+ import { useI18n } from 'vue-i18n';
18
+ const { t } = useI18n();
19
+ const priorityStatus = ref([
20
+ {
21
+ value: 4, // 最优先
22
+ text: t('topPriority'),
23
+ icon: 'mdi mdi-star-circle',
24
+ color: 'red',
25
+ },
26
+ {
27
+ value: 3, // 优先
28
+ text: t('priority'),
29
+ color: 'orange',
30
+ icon: 'mdi mdi-chevron-double-up',
31
+ },
32
+ {
33
+ value: 2, // 正常
34
+ text: t('normal'),
35
+ icon: 'mdi mdi-equal',
36
+ color: 'green',
37
+ },
38
+ {
39
+ value: 1, // 次要
40
+ text: t('secondary'),
41
+ icon: 'mdi mdi-chevron-double-down',
42
+ color: '#4481b8',
43
+ },
44
+ {
45
+ value: 0, // 最次要
46
+ text: t('leastImportant'),
47
+ icon: 'mdi mdi-chevron-triple-down',
48
+ color: 'grey',
49
+ },
50
+ ]);
51
+ </script>
52
+
53
+ <style></style>