ol-base-components 2.8.20 → 2.9.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.
package/src/App.vue CHANGED
@@ -1,583 +1,603 @@
1
- <template>
2
- <div id="app">
3
- <div>table组件案例</div>
4
- <ol-search
5
- :form-search-data="formSearchData"
6
- @handleSearch="handleSearch"
7
- @handleReset="handleReset"
8
- url="/api/app/admission-info/paged-result"
9
- />
10
- <!-- url="/api/app/admission-info/paged-result" -->
11
-
12
- <ol-table
13
- :paginations="paginations"
14
- :empty-img="tableData.emptyImg"
15
- :btnlist="[]"
16
- url="/api/app/bind-record/bind-record-detail-pages"
17
- :table-data="tableData"
18
- :multiple-selection="multipleSelection"
19
- @SelectionChange="SelectionChange"
20
- @handleSizeChange="handleSizeChange"
21
- @handleindexChange="handleindexChange"
22
- ></ol-table>
23
- <el-button @click="handlePrint">接口</el-button>
24
- <el-button @click="onAdd">新建</el-button>
25
- <el-button @click="onEdit">编辑</el-button>
26
-
27
- <!-- 编辑,查看弹窗 -->
28
- <el-dialog :title="`${this.form.title}`" :visible.sync="dialogVisible" width="80%">
29
- <ol-form
30
- v-if="dialogVisible"
31
- url="/api/app/admission-info/admission-info"
32
- :form="form"
33
- @onCancel="dialogVisible = false"
34
- @onSubmit="onSubmit"
35
- />
36
- </el-dialog>
37
-
38
- <!-- <el-button @click="handlePrint">接口</el-button>
39
-
40
- <div
41
- class="ellipsis-container"
42
- id="ellipsis-container"
43
- v-for="item in 5"
44
- :key="item"
45
- >如何处理文本溢出如何实现单行文本溢出显示省略号</div>
46
-
47
- <div class="triangle-up"></div>
48
- <div class="grid-content">
49
- <div>11</div>
50
- <div>11</div>
51
- </div>
52
-
53
- <div class="container">
54
- <div class="item">1</div>
55
- <div class="item item2">2</div>
56
- <div class="item">3</div>
57
- </div>
58
-
59
- <div class="square-container">
60
- <div class="square"></div>
61
- </div> -->
62
- <div>
63
- <CountCom v-model="quantity" />
64
- </div>
65
- </div>
66
- </template>
67
-
68
- <script>
69
- import CountCom from "@/component/countCom.vue";
70
- export default {
71
- name: "App",
72
- components: {
73
- CountCom,
74
- },
75
- data() {
76
- return {
77
- quantity: 0,
78
- multipleSelection: [],
79
- tableData: {
80
- loading: false,
81
- emptyImg: true,
82
- options: {
83
- selection: true, // 多选框
84
- index: false, // 序号EmployeeInfoCode
85
- headTool: true, // 开启头部工具栏
86
- refreshBtn: true, // 开启表格头部刷新按钮
87
- downloadBtn: true, // 开启表格头部下载按钮
88
- }, // 序号和复选框
89
- rows: [
90
- {
91
- bindStateEnum: "11",
92
- tagNumber: "22",
93
- },
94
- ], // 表数据
95
- columns: [
96
- {
97
- prop: "unit",
98
- show: false,
99
- },
100
- {
101
- label: "一级表头",
102
- beforeProp: "qty", // 位置
103
- show: true,
104
- children: [
105
- {
106
- label: "二级表头",
107
- children: [
108
- {
109
- prop: "creationTime",
110
- },
111
- {
112
- prop: "orginalBillNo",
113
- },
114
- ],
115
- },
116
- {
117
- prop: "roadWayCode",
118
- },
119
- {
120
- prop: "batch",
121
- },
122
- ],
123
- },
124
- {
125
- label: "一级表头-1",
126
- beforeProp: "containerType", // 位置
127
- children: [
128
- {
129
- prop: "regionCode",
130
- },
131
- {
132
- prop: "taskNo",
133
- },
134
- ],
135
- },
136
- ],
137
- operates: [], // 表格里面的操作按钮
138
- tableHeightDiff: 300,
139
- },
140
- paginations: {
141
- page: 1, // 当前位于那页面
142
- total: 10, // 总数
143
- limit: 30, // 一页显示多少条
144
- pagetionShow: true,
145
- },
146
-
147
- formSearchData: {
148
- reset: true, // 重置
149
- expendShow: true, // 展开
150
- tableSearchSlice: 5,
151
- value: {
152
- DocNo: null, // 对应输入框的value字段
153
- QualityCheckStateType: null,
154
- QualityCheckState: null,
155
- timer: [],
156
- },
157
- tableSearch: [
158
- // {
159
- // label: "标签号",
160
- // value: "carBodyTagNumber",
161
- // inputType: "text"
162
- // },
163
- // {
164
- // label: "车架号",
165
- // value: "frameNumber",
166
- // inputType: "text"
167
- // // value: "QualityCheckStateType",
168
- // // inputType: "select",
169
- // // children: this.SET_enumsSelect({
170
- // // keyword: "qualityCheckTypeEnum",
171
- // // }),
172
- // },
173
- // {
174
- // label: "项目号",
175
- // value: "projectCode",
176
- // inputType: "text"
177
- // },
178
- // {
179
- // label: "状态描述",
180
- // value: "statusDescription",
181
- // inputType: "select",
182
- // // 0整车/1白车身/2碰撞加固车身/3爆破切割车身/4侧面切割下车身
183
- // children: [
184
- // {
185
- // key: 0,
186
- // value: "整车"
187
- // },
188
- // {
189
- // key: 1,
190
- // value: "白车身"
191
- // },
192
- // {
193
- // key: 2,
194
- // value: "碰撞加固车身"
195
- // },
196
- // {
197
- // key: 3,
198
- // value: "爆破切割车身"
199
- // },
200
- // {
201
- // key: 4,
202
- // value: "侧面切割下车身"
203
- // }
204
- // ]
205
- // },
206
- // {
207
- // label: "实验状态",
208
- // value: "experimentStatus",
209
- // inputType: "select",
210
- // // 0实验前 1实验中 2实验后
211
- // children: [
212
- // {
213
- // key: 0,
214
- // value: "实验前"
215
- // },
216
- // {
217
- // key: 1,
218
- // value: "实验中"
219
- // },
220
- // {
221
- // key: 2,
222
- // value: "实验后"
223
- // }
224
- // ]
225
- // },
226
- // {
227
- // label: "状态",
228
- // value: "tagStatus",
229
- // inputType: "select",
230
- // children: []
231
- // },
232
- // {
233
- // label: "车身类型",
234
- // value: "bodyWorkType",
235
- // inputType: "select",
236
- // children: []
237
- // },
238
- // {
239
- // label: "项目名称",
240
- // value: "projectName",
241
- // inputType: "text"
242
- // },
243
- // {
244
- // label: "入场日期",
245
- // inputType: "picker",
246
- // value: "admissionDate",
247
- // props: {
248
- // valueFormat: "yyyy-MM-dd",
249
- // format: "yyyy/MM/dd"
250
- // }
251
- // },
252
- // {
253
- // label: "打印次数",
254
- // value: "tagPrintNumber",
255
- // inputType: "number"
256
- // },
257
- // {
258
- // label: "创建时间",
259
- // value: "createdTime",
260
- // inputType: "picker",
261
- // props: {
262
- // type: "datetimerange",
263
- // startPlaceholder: "开始时间",
264
- // endPlaceholder: "结束时间",
265
- // placeholder: "选择时间范围",
266
- // valueFormat: "yyyy-MM-dd HH:mm:ss",
267
- // format: "yyyy/MM/dd HH:mm:ss"
268
- // }
269
- // },
270
- // {
271
- // label: "虚拟项目",
272
- // value: "tempProject",
273
- // inputType: "text"
274
- // }
275
- ],
276
- },
277
-
278
- form: {
279
- type: 0, // 0详情,1新增, 2编辑
280
- title: "",
281
- // 默认值
282
- defaultValue: {},
283
- value: {},
284
- model: [
285
- // {
286
- // prop: "warehouseCode",
287
- // },
288
- {
289
- label: "项目名称",
290
- type: "input",
291
- prop: "projectName",
292
- },
293
- {
294
- label: "项目状态",
295
- type: "select",
296
- prop: "projectStatus",
297
- child: [
298
- {
299
- value: "正常",
300
- key: 0,
301
- },
302
- {
303
- value: "保密一级",
304
- key: 1,
305
- },
306
- {
307
- value: "保密二级",
308
- key: 2,
309
- },
310
- ],
311
- },
312
- ],
313
- rules: {
314
- // employeePhoneNumber: [
315
- // {
316
- // required: true,
317
- // message: "手机号不能为空",
318
- // trigger: "blur",
319
- // },
320
- // {
321
- // pattern: /^1[3-9]\d{9}$/,
322
- // message: "请输入有效的手机号",
323
- // trigger: "blur",
324
- // },
325
- // ],
326
- projectCode: [
327
- {
328
- required: true,
329
- message: "项目号不能为空",
330
- trigger: "blur",
331
- },
332
- ],
333
- projectName: [
334
- {
335
- required: true,
336
- message: "项目名称不能为空",
337
- trigger: "blur",
338
- },
339
- ],
340
- projectStatus: [
341
- {
342
- required: true,
343
- message: "项目状态不能为空",
344
- trigger: "blur",
345
- },
346
- ],
347
- // productCode: [
348
- // {
349
- // required: true,
350
- // message: "ALV零件号不能为空",
351
- // trigger: "blur",
352
- // },
353
- // ],
354
- productName: [
355
- {
356
- required: true,
357
- message: "零件名称不能为空",
358
- trigger: "blur",
359
- },
360
- ],
361
- qty: [
362
- {
363
- required: true,
364
- message: "收货数量不能为空",
365
- trigger: "blur",
366
- },
367
- ],
368
- receivedBatch: [
369
- {
370
- required: true,
371
- message: "收货批次不能为空",
372
- trigger: "blur",
373
- },
374
- ],
375
- employeeInfoId: [
376
- {
377
- required: true,
378
- message: "接收人不能为空",
379
- trigger: "blur",
380
- },
381
- ],
382
- // storageLocation: [
383
- // {
384
- // required: true,
385
- // message: "外仓编码不能为空",
386
- // trigger: "blur"
387
- // }
388
- // ]
389
- },
390
- attrs: {
391
- labelWidth: "100px",
392
- },
393
- },
394
- dialogVisible: false,
395
- };
396
- },
397
- // onMounted() {
398
-
399
- // },
400
- mounted() {
401
- // const el = document.getElementById("ellipsis-container");
402
- // this.truncateMiddleByWidth(el)
403
- },
404
- methods: {
405
- SelectionChange(row) {
406
- this.multipleSelection = row;
407
- },
408
- handleSearch(from) {
409
- this.formSearchData.value = { ...from };
410
- this.paginations.page = 1;
411
- this.getTable();
412
- },
413
- handleReset() {},
414
- handleSizeChange(val) {
415
- this.paginations.page = 1;
416
- this.paginations.limit = val;
417
- this.getTable();
418
- },
419
- handleindexChange(val) {
420
- this.paginations.page = val;
421
- this.getTable();
422
- },
423
- async handlePrint() {
424
- const newColumns = JSON.parse(JSON.stringify(this.tableData.columns));
425
- const temp = newColumns.find(e => e.label == "多级表头");
426
- // temp.children[0].label = "3333";
427
- // temp.children[0].show = false
428
- this.$set(temp.children[0], "show", false);
429
- this.tableData.columns = newColumns;
430
- // this.$set(temp.children[0], 'show', false)
431
- // temp.children.push({
432
- // prop: 'containerType',
433
- // label: '容器类型',
434
- // show: true
435
- // })
436
- // this.tableData.columns.push({
437
- // prop: 'aaaa',
438
- // label: 'aaaa',
439
- // show: true
440
- // })
441
- },
442
- // ================
443
- getTable() {},
444
- handleSearch(from) {
445
- this.formSearchData.value = { ...from };
446
- this.paginations.page = 1;
447
- this.getTable();
448
- },
449
- handleReset() {
450
- for (let key in this.formSearchData.value) {
451
- this.formSearchData.value[key] = null;
452
- }
453
- this.paginations.page = 1;
454
- },
455
- truncateMiddleByWidth(el) {
456
- let text = el.textContent;
457
- if (el.scrollWidth <= el.clientWidth) return;
458
- const suffix = text.slice(-3);
459
- let left = 0;
460
- let right = text.length - 3;
461
- let result = "";
462
- while (left <= right) {
463
- let mid = Math.floor((left + right) / 2);
464
- const temp = text.slice(0, mid) + "..." + suffix;
465
- el.textContent = temp;
466
- if (el.scrollWidth <= el.clientWidth) {
467
- result = temp;
468
- left = mid + 1;
469
- } else {
470
- right = mid - 1;
471
- }
472
- }
473
- el.textContent = result;
474
- },
475
- onAdd() {
476
- this.form.type = 1;
477
- this.dialogVisible = true;
478
- },
479
- onEdit() {
480
- this.form.type = 2;
481
- this.dialogVisible = true;
482
- },
483
- async onSubmit(form) {
484
- const { type } = this.form;
485
- if (type === 1) {
486
- // putAdmissioninfoByAdmissionId
487
- // 新增
488
- this.post({
489
- url: StockIn.addStockIn,
490
- data: this.form.value,
491
- isLoading: true,
492
- }).then(res => {
493
- this.$message({ type: "success", message: "操作成功!" });
494
- this.dialogVisible = false;
495
- this.init();
496
- });
497
- } else if (type === 2) {
498
- // 编辑
499
- this.put({
500
- url: `${StockIn.editStockIn}/${this.form.value.id}`,
501
- data: this.form.value,
502
- isLoading: true,
503
- }).then(res => {
504
- this.init();
505
- this.dialogVisible = false;
506
- this.message({ type: "success", message: "操作成功!" });
507
- });
508
- }
509
- },
510
- },
511
- };
512
- </script>
513
-
514
- <style lang="scss" scoped>
515
- /* #app {
516
- font-family: Avenir, Helvetica, Arial, sans-serif;
517
- -webkit-font-smoothing: antialiased;
518
- -moz-osx-font-smoothing: grayscale;
519
- text-align: center;
520
- color: #2c3e50;
521
- margin-top: 60px;
522
- } */
523
- .grid-content {
524
- display: grid;
525
- // grid-template-columns: repeat(2, 1fr);
526
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
527
- // align-items: center;
528
- // justify-items: center;
529
- // justify-content: center;
530
- align-content: center;
531
- height: 300px; /* 你想要的高度 */
532
- gap: 10px;
533
- div {
534
- background-color: aqua;
535
- }
536
- }
537
-
538
- .container {
539
- display: flex;
540
- align-items: center; /* 默认让所有子项在垂直方向居中 */
541
- height: 200px;
542
- background: #eee;
543
- }
544
- .item {
545
- width: 60px;
546
- height: 60px;
547
- background: orange;
548
- margin: 5px;
549
- }
550
- .item2 {
551
- align-self: flex-start; /* 只让这个item到底部对齐 */
552
- }
553
-
554
- .triangle-up {
555
- margin-left: 400px;
556
- width: 100px;
557
- height: 100px;
558
- background-color: purple;
559
- clip-path: polygon(50% 0%, 0% 0%, 0% 100%, 100% 100%);
560
- }
561
-
562
- .square-container {
563
- width: 100px; /* 控制容器宽度 */
564
- }
565
-
566
- .square {
567
- width: 100%;
568
- aspect-ratio: 1 / 1;
569
- background-color: red;
570
- }
571
-
572
- .ellipsis-container {
573
- width: 200px;
574
- // height: 100px;
575
- border: 1px solid #ccc;
576
- overflow: hidden;
577
- white-space: nowrap;
578
- // text-overflow: ellipsis;
579
- // display: -webkit-box;
580
- // -webkit-line-clamp: 4; /* 设置行数,例如3行 */
581
- // -webkit-box-orient: vertical;
582
- }
583
- </style>
1
+ <template>
2
+ <div id="app">
3
+ <div>table组件案例</div>
4
+ <ol-search
5
+ :form-search-data="formSearchData"
6
+ @handleSearch="handleSearch"
7
+ @handleReset="handleReset"
8
+ url="/api/app/admission-info/paged-result"
9
+ />
10
+ <!-- url="/api/app/admission-info/paged-result" -->
11
+
12
+ <ol-table
13
+ :paginations="paginations"
14
+ :empty-img="tableData.emptyImg"
15
+ :btnlist="[]"
16
+ url="/api/app/bind-record/bind-record-detail-pages"
17
+ :table-data="tableData"
18
+ :multiple-selection="multipleSelection"
19
+ @SelectionChange="SelectionChange"
20
+ @handleSizeChange="handleSizeChange"
21
+ @handleindexChange="handleindexChange"
22
+ ></ol-table>
23
+ <el-button @click="handlePrint">接口</el-button>
24
+ <el-button @click="onAdd">新建</el-button>
25
+ <el-button @click="onEdit">编辑</el-button>
26
+
27
+ <!-- 编辑,查看弹窗 -->
28
+ <el-dialog :title="`${this.form.title}`" :visible.sync="dialogVisible" width="80%">
29
+ <ol-form
30
+ v-if="dialogVisible"
31
+ url="/api/app/admission-info/admission-info"
32
+ :form="form"
33
+ @onCancel="dialogVisible = false"
34
+ @onSubmit="onSubmit"
35
+ />
36
+ </el-dialog>
37
+
38
+ <!-- <el-button @click="handlePrint">接口</el-button>
39
+
40
+ <div
41
+ class="ellipsis-container"
42
+ id="ellipsis-container"
43
+ v-for="item in 5"
44
+ :key="item"
45
+ >如何处理文本溢出如何实现单行文本溢出显示省略号</div>
46
+
47
+ <div class="triangle-up"></div>
48
+ <div class="grid-content">
49
+ <div>11</div>
50
+ <div>11</div>
51
+ </div>
52
+
53
+ <div class="container">
54
+ <div class="item">1</div>
55
+ <div class="item item2">2</div>
56
+ <div class="item">3</div>
57
+ </div>
58
+
59
+ <div class="square-container">
60
+ <div class="square"></div>
61
+ </div> -->
62
+ </div>
63
+ </template>
64
+
65
+ <script>
66
+ export default {
67
+ name: "App",
68
+ data() {
69
+ return {
70
+ quantity: 0,
71
+ multipleSelection: [],
72
+ tableData: {
73
+ loading: false,
74
+ emptyImg: true,
75
+ options: {
76
+ selection: true, // 多选框
77
+ index: false, // 序号EmployeeInfoCode
78
+ headTool: true, // 开启头部工具栏
79
+ refreshBtn: true, // 开启表格头部刷新按钮
80
+ downloadBtn: true, // 开启表格头部下载按钮
81
+ }, // 序号和复选框
82
+ rows: [
83
+ {
84
+ bindStateEnum: "11",
85
+ tagNumber: "22",
86
+ },
87
+ ], // 表数据
88
+ columns: [
89
+ {
90
+ prop: "unit",
91
+ show: false,
92
+ },
93
+ {
94
+ label: "一级表头",
95
+ beforeProp: "qty", // 位置
96
+ show: true,
97
+ children: [
98
+ {
99
+ label: "二级表头",
100
+ children: [
101
+ {
102
+ prop: "creationTime",
103
+ },
104
+ {
105
+ prop: "orginalBillNo",
106
+ },
107
+ ],
108
+ },
109
+ {
110
+ prop: "roadWayCode",
111
+ },
112
+ {
113
+ prop: "batch",
114
+ },
115
+ ],
116
+ },
117
+ {
118
+ label: "一级表头-1",
119
+ beforeProp: "containerType", // 位置
120
+ children: [
121
+ {
122
+ prop: "regionCode",
123
+ },
124
+ {
125
+ prop: "taskNo",
126
+ },
127
+ ],
128
+ },
129
+ ],
130
+ operates: [], // 表格里面的操作按钮
131
+ tableHeightDiff: 300,
132
+ },
133
+ paginations: {
134
+ page: 1, // 当前位于那页面
135
+ total: 10, // 总数
136
+ limit: 30, // 一页显示多少条
137
+ pagetionShow: true,
138
+ },
139
+
140
+ formSearchData: {
141
+ reset: true, // 重置
142
+ expendShow: true, // 展开
143
+ tableSearchSlice: 5,
144
+ value: {
145
+ DocNo: null, // 对应输入框的value字段
146
+ QualityCheckStateType: null,
147
+ QualityCheckState: null,
148
+ timer: [],
149
+ range: [10, 200],
150
+ },
151
+ tableSearch: [
152
+ {
153
+ label: "数字区间",
154
+ value: "range",
155
+ inputType: "numberRange",
156
+ originalFields: {
157
+ begin: "begin123",
158
+ end: "end123",
159
+ },
160
+ listeners: {
161
+ change: e => {
162
+ const {
163
+ val: [start, end],
164
+ } = e;
165
+ this.formSearchData.value.rang1 = start;
166
+ this.formSearchData.value.rang2 = end;
167
+ console.log(this.formSearchData, e);
168
+ },
169
+ },
170
+ },
171
+ // {
172
+ // label: "标签号",
173
+ // value: "carBodyTagNumber",
174
+ // inputType: "text"
175
+ // },
176
+ // {
177
+ // label: "车架号",
178
+ // value: "frameNumber",
179
+ // inputType: "text"
180
+ // // value: "QualityCheckStateType",
181
+ // // inputType: "select",
182
+ // // children: this.SET_enumsSelect({
183
+ // // keyword: "qualityCheckTypeEnum",
184
+ // // }),
185
+ // },
186
+ // {
187
+ // label: "项目号",
188
+ // value: "projectCode",
189
+ // inputType: "text"
190
+ // },
191
+ // {
192
+ // label: "状态描述",
193
+ // value: "statusDescription",
194
+ // inputType: "select",
195
+ // // 0整车/1白车身/2碰撞加固车身/3爆破切割车身/4侧面切割下车身
196
+ // children: [
197
+ // {
198
+ // key: 0,
199
+ // value: "整车"
200
+ // },
201
+ // {
202
+ // key: 1,
203
+ // value: "白车身"
204
+ // },
205
+ // {
206
+ // key: 2,
207
+ // value: "碰撞加固车身"
208
+ // },
209
+ // {
210
+ // key: 3,
211
+ // value: "爆破切割车身"
212
+ // },
213
+ // {
214
+ // key: 4,
215
+ // value: "侧面切割下车身"
216
+ // }
217
+ // ]
218
+ // },
219
+ // {
220
+ // label: "实验状态",
221
+ // value: "experimentStatus",
222
+ // inputType: "select",
223
+ // // 0实验前 1实验中 2实验后
224
+ // children: [
225
+ // {
226
+ // key: 0,
227
+ // value: "实验前"
228
+ // },
229
+ // {
230
+ // key: 1,
231
+ // value: "实验中"
232
+ // },
233
+ // {
234
+ // key: 2,
235
+ // value: "实验后"
236
+ // }
237
+ // ]
238
+ // },
239
+ // {
240
+ // label: "状态",
241
+ // value: "tagStatus",
242
+ // inputType: "select",
243
+ // children: []
244
+ // },
245
+ // {
246
+ // label: "车身类型",
247
+ // value: "bodyWorkType",
248
+ // inputType: "select",
249
+ // children: []
250
+ // },
251
+ // {
252
+ // label: "项目名称",
253
+ // value: "projectName",
254
+ // inputType: "text"
255
+ // },
256
+ // {
257
+ // label: "入场日期",
258
+ // inputType: "picker",
259
+ // value: "admissionDate",
260
+ // props: {
261
+ // valueFormat: "yyyy-MM-dd",
262
+ // format: "yyyy/MM/dd"
263
+ // }
264
+ // },
265
+ // {
266
+ // label: "打印次数",
267
+ // value: "tagPrintNumber",
268
+ // inputType: "number"
269
+ // },
270
+ // {
271
+ // label: "创建时间",
272
+ // value: "createdTime",
273
+ // inputType: "picker",
274
+ // props: {
275
+ // type: "datetimerange",
276
+ // startPlaceholder: "开始时间",
277
+ // endPlaceholder: "结束时间",
278
+ // placeholder: "选择时间范围",
279
+ // valueFormat: "yyyy-MM-dd HH:mm:ss",
280
+ // format: "yyyy/MM/dd HH:mm:ss"
281
+ // }
282
+ // },
283
+ // {
284
+ // label: "虚拟项目",
285
+ // value: "tempProject",
286
+ // inputType: "text"
287
+ // }
288
+ ],
289
+ },
290
+
291
+ form: {
292
+ type: 0, // 0详情,1新增, 2编辑
293
+ title: "",
294
+ // 默认值
295
+ defaultValue: {},
296
+ value: {},
297
+ model: [
298
+ // {
299
+ // prop: "warehouseCode",
300
+ // },
301
+ {
302
+ label: "数量范围",
303
+ type: "numberRange",
304
+ prop: "range",
305
+ },
306
+ {
307
+ label: "项目名称",
308
+ type: "input",
309
+ prop: "projectName",
310
+ },
311
+ {
312
+ label: "项目状态",
313
+ type: "select",
314
+ prop: "projectStatus",
315
+ child: [
316
+ {
317
+ value: "正常",
318
+ key: 0,
319
+ },
320
+ {
321
+ value: "保密一级",
322
+ key: 1,
323
+ },
324
+ {
325
+ value: "保密二级",
326
+ key: 2,
327
+ },
328
+ ],
329
+ },
330
+ ],
331
+ rules: {
332
+ // employeePhoneNumber: [
333
+ // {
334
+ // required: true,
335
+ // message: "手机号不能为空",
336
+ // trigger: "blur",
337
+ // },
338
+ // {
339
+ // pattern: /^1[3-9]\d{9}$/,
340
+ // message: "请输入有效的手机号",
341
+ // trigger: "blur",
342
+ // },
343
+ // ],
344
+ projectCode: [
345
+ {
346
+ required: true,
347
+ message: "项目号不能为空",
348
+ trigger: "blur",
349
+ },
350
+ ],
351
+ projectName: [
352
+ {
353
+ required: true,
354
+ message: "项目名称不能为空",
355
+ trigger: "blur",
356
+ },
357
+ ],
358
+ projectStatus: [
359
+ {
360
+ required: true,
361
+ message: "项目状态不能为空",
362
+ trigger: "blur",
363
+ },
364
+ ],
365
+ // productCode: [
366
+ // {
367
+ // required: true,
368
+ // message: "ALV零件号不能为空",
369
+ // trigger: "blur",
370
+ // },
371
+ // ],
372
+ productName: [
373
+ {
374
+ required: true,
375
+ message: "零件名称不能为空",
376
+ trigger: "blur",
377
+ },
378
+ ],
379
+ qty: [
380
+ {
381
+ required: true,
382
+ message: "收货数量不能为空",
383
+ trigger: "blur",
384
+ },
385
+ ],
386
+ receivedBatch: [
387
+ {
388
+ required: true,
389
+ message: "收货批次不能为空",
390
+ trigger: "blur",
391
+ },
392
+ ],
393
+ employeeInfoId: [
394
+ {
395
+ required: true,
396
+ message: "接收人不能为空",
397
+ trigger: "blur",
398
+ },
399
+ ],
400
+ // storageLocation: [
401
+ // {
402
+ // required: true,
403
+ // message: "外仓编码不能为空",
404
+ // trigger: "blur"
405
+ // }
406
+ // ]
407
+ },
408
+ attrs: {
409
+ labelWidth: "100px",
410
+ },
411
+ },
412
+ dialogVisible: false,
413
+ };
414
+ },
415
+ // onMounted() {
416
+
417
+ // },
418
+ mounted() {
419
+ // const el = document.getElementById("ellipsis-container");
420
+ // this.truncateMiddleByWidth(el)
421
+ },
422
+ methods: {
423
+ SelectionChange(row) {
424
+ this.multipleSelection = row;
425
+ },
426
+ handleSearch(from) {
427
+ this.formSearchData.value = { ...from };
428
+ this.paginations.page = 1;
429
+ this.getTable();
430
+ },
431
+ handleReset() {},
432
+ handleSizeChange(val) {
433
+ this.paginations.page = 1;
434
+ this.paginations.limit = val;
435
+ this.getTable();
436
+ },
437
+ handleindexChange(val) {
438
+ this.paginations.page = val;
439
+ this.getTable();
440
+ },
441
+ async handlePrint() {
442
+ const newColumns = JSON.parse(JSON.stringify(this.tableData.columns));
443
+ const temp = newColumns.find(e => e.label == "多级表头");
444
+ // temp.children[0].label = "3333";
445
+ // temp.children[0].show = false
446
+ this.$set(temp.children[0], "show", false);
447
+ this.tableData.columns = newColumns;
448
+ // this.$set(temp.children[0], 'show', false)
449
+ // temp.children.push({
450
+ // prop: 'containerType',
451
+ // label: '容器类型',
452
+ // show: true
453
+ // })
454
+ // this.tableData.columns.push({
455
+ // prop: 'aaaa',
456
+ // label: 'aaaa',
457
+ // show: true
458
+ // })
459
+ },
460
+ // ================
461
+ getTable() {
462
+ console.log("getTable参数", this.formSearchData.value);
463
+ },
464
+ handleSearch(from) {
465
+ this.formSearchData.value = { ...from };
466
+ this.paginations.page = 1;
467
+ this.getTable();
468
+ },
469
+ handleReset() {
470
+ for (let key in this.formSearchData.value) {
471
+ this.formSearchData.value[key] = null;
472
+ }
473
+ this.paginations.page = 1;
474
+ },
475
+ truncateMiddleByWidth(el) {
476
+ let text = el.textContent;
477
+ if (el.scrollWidth <= el.clientWidth) return;
478
+ const suffix = text.slice(-3);
479
+ let left = 0;
480
+ let right = text.length - 3;
481
+ let result = "";
482
+ while (left <= right) {
483
+ let mid = Math.floor((left + right) / 2);
484
+ const temp = text.slice(0, mid) + "..." + suffix;
485
+ el.textContent = temp;
486
+ if (el.scrollWidth <= el.clientWidth) {
487
+ result = temp;
488
+ left = mid + 1;
489
+ } else {
490
+ right = mid - 1;
491
+ }
492
+ }
493
+ el.textContent = result;
494
+ },
495
+ onAdd() {
496
+ this.form.type = 1;
497
+ this.dialogVisible = true;
498
+ },
499
+ onEdit() {
500
+ this.form.type = 2;
501
+ this.dialogVisible = true;
502
+ },
503
+ async onSubmit(form) {
504
+ const { type } = this.form;
505
+ if (type === 1) {
506
+ // putAdmissioninfoByAdmissionId
507
+ // 新增
508
+ this.post({
509
+ url: StockIn.addStockIn,
510
+ data: this.form.value,
511
+ isLoading: true,
512
+ }).then(res => {
513
+ this.$message({ type: "success", message: "操作成功!" });
514
+ this.dialogVisible = false;
515
+ this.init();
516
+ });
517
+ } else if (type === 2) {
518
+ // 编辑
519
+ this.put({
520
+ url: `${StockIn.editStockIn}/${this.form.value.id}`,
521
+ data: this.form.value,
522
+ isLoading: true,
523
+ }).then(res => {
524
+ this.init();
525
+ this.dialogVisible = false;
526
+ this.message({ type: "success", message: "操作成功!" });
527
+ });
528
+ }
529
+ },
530
+ },
531
+ };
532
+ </script>
533
+
534
+ <style lang="scss" scoped>
535
+ /* #app {
536
+ font-family: Avenir, Helvetica, Arial, sans-serif;
537
+ -webkit-font-smoothing: antialiased;
538
+ -moz-osx-font-smoothing: grayscale;
539
+ text-align: center;
540
+ color: #2c3e50;
541
+ margin-top: 60px;
542
+ } */
543
+ .grid-content {
544
+ display: grid;
545
+ // grid-template-columns: repeat(2, 1fr);
546
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
547
+ // align-items: center;
548
+ // justify-items: center;
549
+ // justify-content: center;
550
+ align-content: center;
551
+ height: 300px; /* 你想要的高度 */
552
+ gap: 10px;
553
+ div {
554
+ background-color: aqua;
555
+ }
556
+ }
557
+
558
+ .container {
559
+ display: flex;
560
+ align-items: center; /* 默认让所有子项在垂直方向居中 */
561
+ height: 200px;
562
+ background: #eee;
563
+ }
564
+ .item {
565
+ width: 60px;
566
+ height: 60px;
567
+ background: orange;
568
+ margin: 5px;
569
+ }
570
+ .item2 {
571
+ align-self: flex-start; /* 只让这个item到底部对齐 */
572
+ }
573
+
574
+ .triangle-up {
575
+ margin-left: 400px;
576
+ width: 100px;
577
+ height: 100px;
578
+ background-color: purple;
579
+ clip-path: polygon(50% 0%, 0% 0%, 0% 100%, 100% 100%);
580
+ }
581
+
582
+ .square-container {
583
+ width: 100px; /* 控制容器宽度 */
584
+ }
585
+
586
+ .square {
587
+ width: 100%;
588
+ aspect-ratio: 1 / 1;
589
+ background-color: red;
590
+ }
591
+
592
+ .ellipsis-container {
593
+ width: 200px;
594
+ // height: 100px;
595
+ border: 1px solid #ccc;
596
+ overflow: hidden;
597
+ white-space: nowrap;
598
+ // text-overflow: ellipsis;
599
+ // display: -webkit-box;
600
+ // -webkit-line-clamp: 4; /* 设置行数,例如3行 */
601
+ // -webkit-box-orient: vertical;
602
+ }
603
+ </style>