lw-cdp-ui 1.0.19 → 1.0.21

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 (44) hide show
  1. package/README.md +5 -5
  2. package/dist/components/lwForm/index.vue +312 -312
  3. package/dist/components/lwIconSelect/iconSelect.js +288 -288
  4. package/dist/components/lwIconSelect/index.vue +142 -142
  5. package/dist/components/lwLayout/components/NavMenu.vue +36 -36
  6. package/dist/components/lwLayout/components/aside.vue +291 -295
  7. package/dist/components/lwLayout/components/bu.vue +72 -70
  8. package/dist/components/lwLayout/components/iframeView.vue +57 -57
  9. package/dist/components/lwLayout/components/lang.vue +76 -76
  10. package/dist/components/lwLayout/components/setting.vue +80 -80
  11. package/dist/components/lwLayout/components/sideM.vue +137 -136
  12. package/dist/components/lwLayout/components/tags.vue +329 -329
  13. package/dist/components/lwLayout/components/topbar.vue +70 -70
  14. package/dist/components/lwLayout/components/userbar.vue +210 -209
  15. package/dist/components/lwLayout/index.vue +399 -398
  16. package/dist/components/lwLogin/index.vue +446 -383
  17. package/dist/components/lwSearch/date/date.vue +110 -110
  18. package/dist/components/lwSearch/dateRange/dateRange.vue +110 -110
  19. package/dist/components/lwSearch/dates/dates.vue +366 -366
  20. package/dist/components/lwSearch/index.vue +636 -636
  21. package/dist/components/lwSearch/input/input.vue +54 -54
  22. package/dist/components/lwSearch/locale/en-us.js +10 -10
  23. package/dist/components/lwSearch/locale/zh-cn.js +10 -10
  24. package/dist/components/lwSearch/select/select.vue +57 -57
  25. package/dist/components/lwSvgIcon/index.vue +28 -28
  26. package/dist/components/lwTable/index.js +425 -425
  27. package/dist/components/lwTable/index.scss +229 -229
  28. package/dist/components/lwTable/index.vue +225 -226
  29. package/dist/components/lwTable/locale/en-US.js +26 -26
  30. package/dist/components/lwTable/locale/zh-CN.js +26 -26
  31. package/dist/components/lwTable/useFullscreen.js +73 -73
  32. package/dist/components/lwTableSelect/index.vue +254 -254
  33. package/dist/components/lwTableSelect/tableSelect.js +23 -23
  34. package/dist/components/lwUpload/index.vue +365 -365
  35. package/dist/en-US-YCjgxjEt.js.map +1 -1
  36. package/dist/en-us-CziFtIQi.js.map +1 -1
  37. package/dist/lw-cdp-ui.esm.js +1484 -1459
  38. package/dist/lw-cdp-ui.esm.js.map +1 -1
  39. package/dist/lw-cdp-ui.umd.js +9 -9
  40. package/dist/lw-cdp-ui.umd.js.map +1 -1
  41. package/dist/style.css +1 -1
  42. package/dist/zh-CN-BdDNsX4e.js.map +1 -1
  43. package/dist/zh-cn-DJpQp_O7.js.map +1 -1
  44. package/package.json +45 -45
@@ -1,636 +1,636 @@
1
- <template>
2
- <div id="search-wrap">
3
- <div class="search-content">
4
- <el-form ref="searchForm" :model="form" @submit.prevent :label-align="labelAlign" style="width: 100%">
5
- <el-row :class="(options.length - expandNumber === 0) ? 'expand-row' : (options.length - expandNumber < columnNumber) ? '' : isExpandStatus ? ((options.length % columnNumber === 0) ? 'expand-row' : '') : (options.length >= expandNumber ? 'expand-row' : '')" type="flex" justify="start" :gutter="0">
6
- <template v-for="(item, index) in options" :key="item.prop">
7
- <el-col :class="(!isExpandStatus && item.isExpand) ? '' : (options.length - expandNumber < columnNumber) ? '' : (!isExpandStatus && index > (expandNumber - 1) ? 'hide' : '')" :span="columnNumber ? 24/columnNumber : (item.span || 8)">
8
- <el-form-item :label-width="hideLabel ? 0 : labelWidth" :required="item.required" :label="hideLabel ? '' : $t(item.label)">
9
- <template v-if="item.dateSection && item.prop && item.prop.length === 2">
10
- <el-row :gutter="10" class="date-section">
11
- <el-col :span="12" :style="{ width: '45%', flex: '0 0 45%' }">
12
- <component :is="setComponent(item.renderType)" :disabled="item.disabled" :item="item" v-model="form[item.prop[0]]" :disabled-date="(date) => disabledDate(date, 'prev', form[item.prop[1]])" :propValueFormat="item.valueFormat || 'YYYY-MM-DD 00:00:00'" />
13
- </el-col>
14
- <span class="date-section-line"> - </span>
15
- <el-col :span="12" :style="{ width: '45%', flex: '0 0 45%' }">
16
- <component :is="setComponent(item.renderType)" :disabled="item.disabled" :item="item" v-model="form[item.prop[1]]" :disabled-date="(date) => disabledDate(date, 'next', form[item.prop[0]])" :propValueFormat="item.valueFormat || 'YYYY-MM-DD 23:59:59'" />
17
- </el-col>
18
- </el-row>
19
- </template>
20
- <template v-else>
21
- <component v-model="form[item.prop]" :is="setComponent(item.renderType)" :disabled="item.disabled" :item="item" style="width: 100%" />
22
- </template>
23
- </el-form-item>
24
- </el-col>
25
- </template>
26
- </el-row>
27
-
28
- <div class="control" :style="{bottom: ((options.length%columnNumber === 0) ? '0px' : '16px')}">
29
- <el-button class="reset" @click="resetForm('searchForm')">
30
- {{$t('btn.reset')}}
31
- </el-button>
32
- <el-button class="submit" type="primary" @click="submitForm('searchForm')">
33
- {{$t('btn.query')}}
34
- </el-button>
35
-
36
- <div :class="options.length - expandNumber >= columnNumber ? 'expand-button' : 'hidden'" @click="isExpandStatus = !isExpandStatus">
37
- <span>{{ isExpandStatus ? "收起" : "展开" }}</span>
38
- </div>
39
- </div>
40
- </el-form>
41
- </div>
42
- </div>
43
- </template>
44
-
45
- <script>
46
- import SearchInput from "./input/input.vue";
47
- import SearchSelect from "./select/select.vue";
48
- import SearchDate from "./date/date.vue";
49
- import SearchDates from "./dates/dates.vue";
50
- import SearchDateRange from "./dateRange/dateRange.vue";
51
- import dayjs from "dayjs";
52
-
53
- export default {
54
- components: {
55
- SearchInput,
56
- SearchSelect,
57
- SearchDate,
58
- SearchDates,
59
- SearchDateRange,
60
- },
61
- name: "lwSearch",
62
- props: {
63
- options: {
64
- // 配置项
65
- type: Array,
66
- default: () => [],
67
- },
68
- modelValue: {
69
- // 绑定的结果对象
70
- type: Object,
71
- default: () => ({}),
72
- },
73
- labelWidth: {
74
- // label全局宽度
75
- type: String,
76
- default: "70px",
77
- },
78
- labelPosition: {
79
- // label全局位置
80
- type: String,
81
- default: "left",
82
- },
83
- columnNumber: {
84
- // 每行列数量
85
- type: Number,
86
- default: 4,
87
- },
88
- isSave: {
89
- // 是否保存功能
90
- type: Boolean,
91
- default: false,
92
- },
93
- isCloud: {
94
- // 是否保存功能
95
- type: Boolean,
96
- default: false,
97
- },
98
- saveKey: {
99
- // 保存功能指定localStorage searchSaveData对象中key
100
- type: String,
101
- default: "",
102
- },
103
- isExpand: {
104
- // 默认是否展开
105
- type: Boolean,
106
- default: false,
107
- },
108
- expandNumber: {
109
- // 默认收起展示数量
110
- type: Number,
111
- default: 4,
112
- },
113
- hasExpandAll: {
114
- // 默认收起展示数量
115
- type: Boolean,
116
- default: false,
117
- },
118
- hideLabel: {
119
- // 是否隐藏标签
120
- type: Boolean,
121
- default: false,
122
- },
123
- labelAlign: {
124
- //标签对齐方式
125
- type: String,
126
- default: "right",
127
- },
128
- },
129
- data() {
130
- return {
131
- form: {}, // 内部维护数据
132
- defaultForm: {}, // 原始数据
133
- isExpandStatus: false, // 是否展开搜索条件
134
- isChange: false, // 是否展示变式下拉框
135
- saveList: [], // 搜索保存数据列表
136
- saveFormName: "", // 当前保存数据名称
137
- isSaveShow: false, // 是否展示保存操作
138
- isSelectShow: false, // 是否展示选择操作
139
- selectForm: "", // 当前选中数据
140
- currentExpandNumber: 4, // 当前收起展示数量
141
- isExpandAll: true,
142
- currentTemplate: {},
143
- variantList: [],
144
- varianId: [],
145
- systemName: "shopManagement",
146
- };
147
- },
148
- watch: {
149
- modelValue: {
150
- handler(newVal) {
151
- if (JSON.stringify(newVal) !== JSON.stringify(this.form)) {
152
- this.form = JSON.parse(JSON.stringify(newVal));
153
- }
154
- },
155
- deep: true,
156
- },
157
- form: {
158
- handler(newVal) {
159
- if (JSON.stringify(newVal) !== JSON.stringify(this.modelValue)) {
160
- this.$emit("update:modelValue", newVal);
161
- }
162
- },
163
- deep: true,
164
- },
165
- },
166
- mounted() {
167
- this.isExpandStatus = this.isExpand;
168
- this.currentExpandNumber = this.expandNumber || this.columnNumber;
169
- this.form = JSON.parse(JSON.stringify(this.modelValue));
170
- this.defaultForm =
171
- JSON.stringify(this.defaultForm) === "{}"
172
- ? JSON.parse(JSON.stringify(this.modelValue))
173
- : this.defaultForm;
174
- },
175
- methods: {
176
- // 根据renderType设置对应组件
177
- setComponent(type) {
178
- const typeList = {
179
- input: "SearchInput",
180
- select: "SearchSelect",
181
- date: "SearchDate",
182
- dates: "SearchDates",
183
- dateRange: "SearchDateRange",
184
- };
185
- return typeList[type] || "SearchInput";
186
- },
187
- // 触发提交
188
- submitForm(formEl) {
189
- if (!this.$refs[formEl]) return;
190
- this.$refs[formEl].validate((valid) => {
191
- if (valid) {
192
- this.$emit("search");
193
- }
194
- });
195
- },
196
- // 重置条件
197
- resetForm(formEl) {
198
- if (!this.$refs[formEl]) return;
199
- this.$refs[formEl].resetFields();
200
- this.form = JSON.parse(JSON.stringify(this.defaultForm));
201
- // 保留页面table分页数据
202
- this.form.size = this.modelValue.size;
203
- this.form.page = this.modelValue.page;
204
- this.$emit("reset");
205
- },
206
-
207
- // 关闭变式
208
- handleChangeHide(vis) {
209
- if (vis === false) {
210
- this.isChange = false;
211
- this.isSaveShow = false;
212
- this.isSelectShow = false;
213
- this.saveFormName = "";
214
- this.selectForm = "";
215
- }
216
- },
217
- // 保存搜索表单
218
- handleSaveSearchForm() {
219
- if (this.saveKey && this.isSave) {
220
- if (Object.keys(this.form).length === 0) {
221
- this.$message.error("搜索条件为空!");
222
- return;
223
- }
224
- let tempObj = Object.assign({}, this.form, {
225
- searchSaveName: this.saveFormName,
226
- id: dayjs().valueOf() + Math.random() + "",
227
- });
228
- let obj = {
229
- route: this.$route.name,
230
- system: this.systemName,
231
- variant: [tempObj],
232
- };
233
- let resObj = this.variantList.find((it) => {
234
- return it.route === this.$route.name;
235
- });
236
- if (resObj) {
237
- resObj.variant.push(tempObj);
238
- } else {
239
- this.variantList.push(obj);
240
- }
241
- if (this.isCloud) {
242
- let params = {
243
- id: this.varianId,
244
- username: JSON.parse(sessionStorage.userAuthInfo).username,
245
- system: this.systemName,
246
- menu: this.saveKey,
247
- content: JSON.stringify(this.variantList),
248
- };
249
- } else {
250
- localStorage.setItem("variantList", JSON.stringify(this.variantList));
251
- }
252
- }
253
- },
254
- // 选择保存过的搜索历史
255
- handleSearchSelect(val) {
256
- let obj = this.saveList.find((it) => {
257
- return it.id === val;
258
- });
259
- if (obj) {
260
- let rObj = JSON.parse(JSON.stringify(obj));
261
- delete rObj.id;
262
- delete rObj.searchSaveName;
263
- this.$emit("update:modelValue", rObj);
264
- }
265
- },
266
- // 删除保存过的搜索历史
267
- handleDeleteSearchList(index) {
268
- let tempList = JSON.parse(JSON.stringify(this.saveList));
269
- tempList.splice(index, 1);
270
- if (this.saveKey && this.isSave) {
271
- // 更新逻辑,视具体API而定
272
- }
273
- },
274
- // 禁止选择日期
275
- disabledDate(date, currentSource, limitDate = "") {
276
- if (limitDate) {
277
- if (currentSource === "prev") {
278
- return dayjs(date.getTime()).isAfter(dayjs(limitDate), "day");
279
- }
280
- if (currentSource === "next") {
281
- return dayjs(date.getTime()).isBefore(dayjs(limitDate), "day");
282
- }
283
- }
284
- },
285
- // 一键收缩展开
286
- expandAll() {
287
- this.isExpandAll = !this.isExpandAll;
288
- },
289
- },
290
- };
291
- </script>
292
- <style lang="scss" scoped>
293
- @keyframes slide-animation {
294
- from {
295
- width: 100%;
296
- height: auto;
297
- margin-top: 0;
298
- padding: 15px 60px 0 15px;
299
- // transform: scale(1);
300
- opacity: 1;
301
- }
302
-
303
- to {
304
- width: 0;
305
- height: 0;
306
- margin-top: -10px;
307
- padding: 0;
308
- // transform: scale(0);
309
- opacity: 0;
310
- }
311
- }
312
-
313
- #search-wrap {
314
- width: 100%;
315
- background: var(--color-bg-2);
316
- // position: relative;
317
- overflow: hidden;
318
- .arco-col {
319
- margin: 5px 0;
320
- padding: 0 !important;
321
- }
322
-
323
- .arco-form-item-label {
324
- padding-right: 10px;
325
- }
326
-
327
- .el-col-6 {
328
- margin: 5px 0;
329
- padding: 0 10px !important;
330
- }
331
- .el-col-6:first-child {
332
- padding-left: 0px !important;
333
- }
334
-
335
- .el-col-6:nth-child(4n) {
336
- padding-right: 0px !important;
337
- }
338
-
339
- .control-button {
340
- position: absolute;
341
- top: 10px;
342
- right: 20px;
343
- z-index: 99;
344
- cursor: pointer;
345
-
346
- .expand-img {
347
- width: 24px;
348
- height: 24px;
349
- cursor: pointer;
350
- transition: all 0.5s linear;
351
-
352
- &.close {
353
- transform: rotate(180deg);
354
- }
355
- }
356
- }
357
-
358
- .arco-form-item-content-flex {
359
- display: block;
360
- }
361
-
362
- .search-content {
363
- position: relative;
364
- // border: 1px solid #e5e5e5;
365
- box-sizing: border-box;
366
- width: 100%;
367
- // transition: width .3s linear;
368
- margin-top: 0;
369
- padding: 0 0 0px 0;
370
-
371
- &.close {
372
- width: 0;
373
- height: 0;
374
- margin-top: -10px;
375
- padding: 0;
376
- overflow: hidden;
377
- opacity: 0;
378
- animation: slide-animation 0.3s;
379
- }
380
-
381
- .expand-row {
382
- padding-bottom: 44px;
383
- }
384
-
385
- .control {
386
- position: absolute;
387
- right: 0;
388
- bottom: 5px;
389
- z-index: 9;
390
- display: flex;
391
- justify-content: flex-end;
392
- align-items: flex-end;
393
- .reset {
394
- width: 90px;
395
- height: 32px;
396
- margin-right: 0px;
397
- border: none;
398
- background-color: #eeeefc;
399
- color: #3d3ad9;
400
- border-radius: 2px;
401
- font-size: 12px;
402
- & > span {
403
- display: flex;
404
- align-items: center;
405
- justify-content: center;
406
-
407
- .el-icon--left {
408
- margin-right: 5px;
409
- }
410
- }
411
- }
412
-
413
- .submit {
414
- width: 90px;
415
- height: 32px;
416
- background-color: #3d3ad9;
417
- border: none;
418
- border-radius: 2px;
419
- & > span {
420
- display: flex;
421
- align-items: center;
422
- justify-content: center;
423
-
424
- .el-icon--left {
425
- margin-right: 5px;
426
- }
427
- }
428
- }
429
-
430
- .expand-button {
431
- display: flex;
432
- align-items: center;
433
- justify-content: flex-end;
434
- box-sizing: border-box;
435
- width: 40px;
436
- padding-right: 5px;
437
- cursor: pointer;
438
-
439
- & > span {
440
- color: #505050;
441
- font-size: 12px;
442
- }
443
- }
444
-
445
- .hidden {
446
- visibility: hidden;
447
- width: 0px;
448
- }
449
-
450
- .save {
451
- position: relative;
452
- // width: 84px;
453
- height: 30px;
454
- padding: 0;
455
- padding: 0 10px;
456
- // background: #bda87c;
457
-
458
- .save-text {
459
- display: flex;
460
- align-items: center;
461
- justify-content: center;
462
- width: 84px;
463
- height: 30px;
464
-
465
- & > span {
466
- padding-right: 10px;
467
- padding-left: 10px;
468
- border-right: 1px solid #fff;
469
- }
470
-
471
- & > i {
472
- padding-left: 10px;
473
- }
474
- }
475
- }
476
- }
477
-
478
- .el-form {
479
- position: relative;
480
- }
481
-
482
- .el-form-item {
483
- margin-bottom: 10px;
484
-
485
- .el-form-item__label {
486
- padding-right: 5px;
487
- font-size: 12px;
488
- user-select: none;
489
- }
490
- // .arco-select__tags-text {
491
- // max-width: 80px !important;
492
- // }
493
- .select-trigger {
494
- width: 100%;
495
-
496
- .el-select__tags {
497
- // max-width: calc(100% - 0px) !important;
498
- & > span {
499
- max-width: 100%;
500
-
501
- .el-tag--info {
502
- max-width: 100% !important;
503
-
504
- &:first-child {
505
- .el-select__tags-text {
506
- max-width: 100% !important;
507
- }
508
- }
509
-
510
- &:nth-child(2) {
511
- // display: none;
512
- .arco-select__tags-text {
513
- max-width: 100% !important;
514
- }
515
- }
516
- }
517
- }
518
- }
519
- }
520
-
521
- .el-date-editor.el-input,
522
- .el-date-editor.el-input__inner {
523
- width: 100%;
524
- }
525
-
526
- .el-select .el-select__tags {
527
- display: flex;
528
- flex-wrap: nowrap;
529
-
530
- & > span {
531
- display: flex;
532
- flex-wrap: nowrap;
533
- }
534
- }
535
-
536
- .date-section {
537
- position: relative;
538
- margin-bottom: 0 !important;
539
-
540
- .el-input--small .el-input__inner {
541
- padding-right: 20px;
542
- padding-left: 15px;
543
- }
544
-
545
- .el-input__prefix {
546
- display: none;
547
- }
548
-
549
- .date-section-line {
550
- position: absolute;
551
- top: 50%;
552
- left: 50%;
553
- transform: translate(-50%, -50%);
554
- }
555
- }
556
- }
557
- }
558
- }
559
-
560
- .hide {
561
- display: none !important;
562
- }
563
-
564
- .search-panel-popover {
565
- // background: red;
566
- box-sizing: border-box;
567
- position: relative;
568
- .save-controls {
569
- & > div {
570
- & > span {
571
- cursor: pointer;
572
- display: block;
573
- padding: 5px 0;
574
- &:hover {
575
- color: #155752;
576
- }
577
- }
578
- }
579
- .save-form {
580
- width: 160px;
581
- height: 40px;
582
- background: #ffffff;
583
- display: flex;
584
- align-items: center;
585
- justify-content: flex-start;
586
- transform: translateX(-14px);
587
- .save-form-button {
588
- margin-left: 10px;
589
- }
590
- .save-form-input {
591
- width: 84px;
592
- }
593
- .el-button--primary.is-disabled {
594
- background: #155752;
595
- opacity: 0.6;
596
- }
597
- .save-form-select {
598
- width: 160px;
599
- }
600
- }
601
- }
602
- }
603
-
604
- .select-popper {
605
- .el-select-dropdown__item {
606
- padding: 0 10px;
607
- }
608
- .select-content {
609
- display: flex;
610
- align-items: center;
611
- justify-content: space-between;
612
- box-sizing: border-box;
613
- .select-content-button {
614
- border: none;
615
- background: none;
616
- flex-shrink: 0;
617
- box-sizing: border-box;
618
- padding: 7px;
619
- border-radius: 100%;
620
- &:hover {
621
- .el-icon--close {
622
- opacity: 1;
623
- }
624
- }
625
- .el-icon--close {
626
- opacity: 0.6;
627
- display: block;
628
- color: #155752;
629
- width: 12px;
630
- height: 12px;
631
- }
632
- }
633
- }
634
- }
635
- </style>
636
-
1
+ <template>
2
+ <div id="search-wrap">
3
+ <div class="search-content">
4
+ <el-form ref="searchForm" :model="form" @submit.prevent :label-align="labelAlign" style="width: 100%">
5
+ <el-row :class="(options.length - expandNumber === 0) ? 'expand-row' : (options.length - expandNumber < columnNumber) ? '' : isExpandStatus ? ((options.length % columnNumber === 0) ? 'expand-row' : '') : (options.length >= expandNumber ? 'expand-row' : '')" type="flex" justify="start" :gutter="0">
6
+ <template v-for="(item, index) in options" :key="item.prop">
7
+ <el-col :class="(!isExpandStatus && item.isExpand) ? '' : (options.length - expandNumber < columnNumber) ? '' : (!isExpandStatus && index > (expandNumber - 1) ? 'hide' : '')" :span="columnNumber ? 24/columnNumber : (item.span || 8)">
8
+ <el-form-item :label-width="hideLabel ? 0 : labelWidth" :required="item.required" :label="hideLabel ? '' : $t(item.label)">
9
+ <template v-if="item.dateSection && item.prop && item.prop.length === 2">
10
+ <el-row :gutter="10" class="date-section">
11
+ <el-col :span="12" :style="{ width: '45%', flex: '0 0 45%' }">
12
+ <component :is="setComponent(item.renderType)" :disabled="item.disabled" :item="item" v-model="form[item.prop[0]]" :disabled-date="(date) => disabledDate(date, 'prev', form[item.prop[1]])" :propValueFormat="item.valueFormat || 'YYYY-MM-DD 00:00:00'" />
13
+ </el-col>
14
+ <span class="date-section-line"> - </span>
15
+ <el-col :span="12" :style="{ width: '45%', flex: '0 0 45%' }">
16
+ <component :is="setComponent(item.renderType)" :disabled="item.disabled" :item="item" v-model="form[item.prop[1]]" :disabled-date="(date) => disabledDate(date, 'next', form[item.prop[0]])" :propValueFormat="item.valueFormat || 'YYYY-MM-DD 23:59:59'" />
17
+ </el-col>
18
+ </el-row>
19
+ </template>
20
+ <template v-else>
21
+ <component v-model="form[item.prop]" :is="setComponent(item.renderType)" :disabled="item.disabled" :item="item" style="width: 100%" />
22
+ </template>
23
+ </el-form-item>
24
+ </el-col>
25
+ </template>
26
+ </el-row>
27
+
28
+ <div class="control" :style="{bottom: ((options.length%columnNumber === 0) ? '0px' : '16px')}">
29
+ <el-button class="reset" @click="resetForm('searchForm')">
30
+ {{$t('btn.reset')}}
31
+ </el-button>
32
+ <el-button class="submit" type="primary" @click="submitForm('searchForm')">
33
+ {{$t('btn.query')}}
34
+ </el-button>
35
+
36
+ <div :class="options.length - expandNumber >= columnNumber ? 'expand-button' : 'hidden'" @click="isExpandStatus = !isExpandStatus">
37
+ <span>{{ isExpandStatus ? "收起" : "展开" }}</span>
38
+ </div>
39
+ </div>
40
+ </el-form>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ import SearchInput from "./input/input.vue";
47
+ import SearchSelect from "./select/select.vue";
48
+ import SearchDate from "./date/date.vue";
49
+ import SearchDates from "./dates/dates.vue";
50
+ import SearchDateRange from "./dateRange/dateRange.vue";
51
+ import dayjs from "dayjs";
52
+
53
+ export default {
54
+ components: {
55
+ SearchInput,
56
+ SearchSelect,
57
+ SearchDate,
58
+ SearchDates,
59
+ SearchDateRange,
60
+ },
61
+ name: "lwSearch",
62
+ props: {
63
+ options: {
64
+ // 配置项
65
+ type: Array,
66
+ default: () => [],
67
+ },
68
+ modelValue: {
69
+ // 绑定的结果对象
70
+ type: Object,
71
+ default: () => ({}),
72
+ },
73
+ labelWidth: {
74
+ // label全局宽度
75
+ type: String,
76
+ default: "70px",
77
+ },
78
+ labelPosition: {
79
+ // label全局位置
80
+ type: String,
81
+ default: "left",
82
+ },
83
+ columnNumber: {
84
+ // 每行列数量
85
+ type: Number,
86
+ default: 4,
87
+ },
88
+ isSave: {
89
+ // 是否保存功能
90
+ type: Boolean,
91
+ default: false,
92
+ },
93
+ isCloud: {
94
+ // 是否保存功能
95
+ type: Boolean,
96
+ default: false,
97
+ },
98
+ saveKey: {
99
+ // 保存功能指定localStorage searchSaveData对象中key
100
+ type: String,
101
+ default: "",
102
+ },
103
+ isExpand: {
104
+ // 默认是否展开
105
+ type: Boolean,
106
+ default: false,
107
+ },
108
+ expandNumber: {
109
+ // 默认收起展示数量
110
+ type: Number,
111
+ default: 4,
112
+ },
113
+ hasExpandAll: {
114
+ // 默认收起展示数量
115
+ type: Boolean,
116
+ default: false,
117
+ },
118
+ hideLabel: {
119
+ // 是否隐藏标签
120
+ type: Boolean,
121
+ default: false,
122
+ },
123
+ labelAlign: {
124
+ //标签对齐方式
125
+ type: String,
126
+ default: "right",
127
+ },
128
+ },
129
+ data() {
130
+ return {
131
+ form: {}, // 内部维护数据
132
+ defaultForm: {}, // 原始数据
133
+ isExpandStatus: false, // 是否展开搜索条件
134
+ isChange: false, // 是否展示变式下拉框
135
+ saveList: [], // 搜索保存数据列表
136
+ saveFormName: "", // 当前保存数据名称
137
+ isSaveShow: false, // 是否展示保存操作
138
+ isSelectShow: false, // 是否展示选择操作
139
+ selectForm: "", // 当前选中数据
140
+ currentExpandNumber: 4, // 当前收起展示数量
141
+ isExpandAll: true,
142
+ currentTemplate: {},
143
+ variantList: [],
144
+ varianId: [],
145
+ systemName: "shopManagement",
146
+ };
147
+ },
148
+ watch: {
149
+ modelValue: {
150
+ handler(newVal) {
151
+ if (JSON.stringify(newVal) !== JSON.stringify(this.form)) {
152
+ this.form = JSON.parse(JSON.stringify(newVal));
153
+ }
154
+ },
155
+ deep: true,
156
+ },
157
+ form: {
158
+ handler(newVal) {
159
+ if (JSON.stringify(newVal) !== JSON.stringify(this.modelValue)) {
160
+ this.$emit("update:modelValue", newVal);
161
+ }
162
+ },
163
+ deep: true,
164
+ },
165
+ },
166
+ mounted() {
167
+ this.isExpandStatus = this.isExpand;
168
+ this.currentExpandNumber = this.expandNumber || this.columnNumber;
169
+ this.form = JSON.parse(JSON.stringify(this.modelValue));
170
+ this.defaultForm =
171
+ JSON.stringify(this.defaultForm) === "{}"
172
+ ? JSON.parse(JSON.stringify(this.modelValue))
173
+ : this.defaultForm;
174
+ },
175
+ methods: {
176
+ // 根据renderType设置对应组件
177
+ setComponent(type) {
178
+ const typeList = {
179
+ input: "SearchInput",
180
+ select: "SearchSelect",
181
+ date: "SearchDate",
182
+ dates: "SearchDates",
183
+ dateRange: "SearchDateRange",
184
+ };
185
+ return typeList[type] || "SearchInput";
186
+ },
187
+ // 触发提交
188
+ submitForm(formEl) {
189
+ if (!this.$refs[formEl]) return;
190
+ this.$refs[formEl].validate((valid) => {
191
+ if (valid) {
192
+ this.$emit("search");
193
+ }
194
+ });
195
+ },
196
+ // 重置条件
197
+ resetForm(formEl) {
198
+ if (!this.$refs[formEl]) return;
199
+ this.$refs[formEl].resetFields();
200
+ this.form = JSON.parse(JSON.stringify(this.defaultForm));
201
+ // 保留页面table分页数据
202
+ this.form.size = this.modelValue.size;
203
+ this.form.page = this.modelValue.page;
204
+ this.$emit("reset");
205
+ },
206
+
207
+ // 关闭变式
208
+ handleChangeHide(vis) {
209
+ if (vis === false) {
210
+ this.isChange = false;
211
+ this.isSaveShow = false;
212
+ this.isSelectShow = false;
213
+ this.saveFormName = "";
214
+ this.selectForm = "";
215
+ }
216
+ },
217
+ // 保存搜索表单
218
+ handleSaveSearchForm() {
219
+ if (this.saveKey && this.isSave) {
220
+ if (Object.keys(this.form).length === 0) {
221
+ this.$message.error("搜索条件为空!");
222
+ return;
223
+ }
224
+ let tempObj = Object.assign({}, this.form, {
225
+ searchSaveName: this.saveFormName,
226
+ id: dayjs().valueOf() + Math.random() + "",
227
+ });
228
+ let obj = {
229
+ route: this.$route.name,
230
+ system: this.systemName,
231
+ variant: [tempObj],
232
+ };
233
+ let resObj = this.variantList.find((it) => {
234
+ return it.route === this.$route.name;
235
+ });
236
+ if (resObj) {
237
+ resObj.variant.push(tempObj);
238
+ } else {
239
+ this.variantList.push(obj);
240
+ }
241
+ if (this.isCloud) {
242
+ let params = {
243
+ id: this.varianId,
244
+ username: JSON.parse(sessionStorage.userAuthInfo).username,
245
+ system: this.systemName,
246
+ menu: this.saveKey,
247
+ content: JSON.stringify(this.variantList),
248
+ };
249
+ } else {
250
+ localStorage.setItem("variantList", JSON.stringify(this.variantList));
251
+ }
252
+ }
253
+ },
254
+ // 选择保存过的搜索历史
255
+ handleSearchSelect(val) {
256
+ let obj = this.saveList.find((it) => {
257
+ return it.id === val;
258
+ });
259
+ if (obj) {
260
+ let rObj = JSON.parse(JSON.stringify(obj));
261
+ delete rObj.id;
262
+ delete rObj.searchSaveName;
263
+ this.$emit("update:modelValue", rObj);
264
+ }
265
+ },
266
+ // 删除保存过的搜索历史
267
+ handleDeleteSearchList(index) {
268
+ let tempList = JSON.parse(JSON.stringify(this.saveList));
269
+ tempList.splice(index, 1);
270
+ if (this.saveKey && this.isSave) {
271
+ // 更新逻辑,视具体API而定
272
+ }
273
+ },
274
+ // 禁止选择日期
275
+ disabledDate(date, currentSource, limitDate = "") {
276
+ if (limitDate) {
277
+ if (currentSource === "prev") {
278
+ return dayjs(date.getTime()).isAfter(dayjs(limitDate), "day");
279
+ }
280
+ if (currentSource === "next") {
281
+ return dayjs(date.getTime()).isBefore(dayjs(limitDate), "day");
282
+ }
283
+ }
284
+ },
285
+ // 一键收缩展开
286
+ expandAll() {
287
+ this.isExpandAll = !this.isExpandAll;
288
+ },
289
+ },
290
+ };
291
+ </script>
292
+ <style lang="scss" scoped>
293
+ @keyframes slide-animation {
294
+ from {
295
+ width: 100%;
296
+ height: auto;
297
+ margin-top: 0;
298
+ padding: 15px 60px 0 15px;
299
+ // transform: scale(1);
300
+ opacity: 1;
301
+ }
302
+
303
+ to {
304
+ width: 0;
305
+ height: 0;
306
+ margin-top: -10px;
307
+ padding: 0;
308
+ // transform: scale(0);
309
+ opacity: 0;
310
+ }
311
+ }
312
+
313
+ #search-wrap {
314
+ width: 100%;
315
+ background: var(--color-bg-2);
316
+ // position: relative;
317
+ overflow: hidden;
318
+ .arco-col {
319
+ margin: 5px 0;
320
+ padding: 0 !important;
321
+ }
322
+
323
+ .arco-form-item-label {
324
+ padding-right: 10px;
325
+ }
326
+
327
+ .el-col-6 {
328
+ margin: 5px 0;
329
+ padding: 0 10px !important;
330
+ }
331
+ .el-col-6:first-child {
332
+ padding-left: 0px !important;
333
+ }
334
+
335
+ .el-col-6:nth-child(4n) {
336
+ padding-right: 0px !important;
337
+ }
338
+
339
+ .control-button {
340
+ position: absolute;
341
+ top: 10px;
342
+ right: 20px;
343
+ z-index: 99;
344
+ cursor: pointer;
345
+
346
+ .expand-img {
347
+ width: 24px;
348
+ height: 24px;
349
+ cursor: pointer;
350
+ transition: all 0.5s linear;
351
+
352
+ &.close {
353
+ transform: rotate(180deg);
354
+ }
355
+ }
356
+ }
357
+
358
+ .arco-form-item-content-flex {
359
+ display: block;
360
+ }
361
+
362
+ .search-content {
363
+ position: relative;
364
+ // border: 1px solid #e5e5e5;
365
+ box-sizing: border-box;
366
+ width: 100%;
367
+ // transition: width .3s linear;
368
+ margin-top: 0;
369
+ padding: 0 0 0px 0;
370
+
371
+ &.close {
372
+ width: 0;
373
+ height: 0;
374
+ margin-top: -10px;
375
+ padding: 0;
376
+ overflow: hidden;
377
+ opacity: 0;
378
+ animation: slide-animation 0.3s;
379
+ }
380
+
381
+ .expand-row {
382
+ padding-bottom: 44px;
383
+ }
384
+
385
+ .control {
386
+ position: absolute;
387
+ right: 0;
388
+ bottom: 5px;
389
+ z-index: 9;
390
+ display: flex;
391
+ justify-content: flex-end;
392
+ align-items: flex-end;
393
+ .reset {
394
+ width: 90px;
395
+ height: 32px;
396
+ margin-right: 0px;
397
+ border: none;
398
+ background-color: #eeeefc;
399
+ color: #3d3ad9;
400
+ border-radius: 2px;
401
+ font-size: 12px;
402
+ & > span {
403
+ display: flex;
404
+ align-items: center;
405
+ justify-content: center;
406
+
407
+ .el-icon--left {
408
+ margin-right: 5px;
409
+ }
410
+ }
411
+ }
412
+
413
+ .submit {
414
+ width: 90px;
415
+ height: 32px;
416
+ background-color: #3d3ad9;
417
+ border: none;
418
+ border-radius: 2px;
419
+ & > span {
420
+ display: flex;
421
+ align-items: center;
422
+ justify-content: center;
423
+
424
+ .el-icon--left {
425
+ margin-right: 5px;
426
+ }
427
+ }
428
+ }
429
+
430
+ .expand-button {
431
+ display: flex;
432
+ align-items: center;
433
+ justify-content: flex-end;
434
+ box-sizing: border-box;
435
+ width: 40px;
436
+ padding-right: 5px;
437
+ cursor: pointer;
438
+
439
+ & > span {
440
+ color: #505050;
441
+ font-size: 12px;
442
+ }
443
+ }
444
+
445
+ .hidden {
446
+ visibility: hidden;
447
+ width: 0px;
448
+ }
449
+
450
+ .save {
451
+ position: relative;
452
+ // width: 84px;
453
+ height: 30px;
454
+ padding: 0;
455
+ padding: 0 10px;
456
+ // background: #bda87c;
457
+
458
+ .save-text {
459
+ display: flex;
460
+ align-items: center;
461
+ justify-content: center;
462
+ width: 84px;
463
+ height: 30px;
464
+
465
+ & > span {
466
+ padding-right: 10px;
467
+ padding-left: 10px;
468
+ border-right: 1px solid #fff;
469
+ }
470
+
471
+ & > i {
472
+ padding-left: 10px;
473
+ }
474
+ }
475
+ }
476
+ }
477
+
478
+ .el-form {
479
+ position: relative;
480
+ }
481
+
482
+ .el-form-item {
483
+ margin-bottom: 10px;
484
+
485
+ .el-form-item__label {
486
+ padding-right: 5px;
487
+ font-size: 12px;
488
+ user-select: none;
489
+ }
490
+ // .arco-select__tags-text {
491
+ // max-width: 80px !important;
492
+ // }
493
+ .select-trigger {
494
+ width: 100%;
495
+
496
+ .el-select__tags {
497
+ // max-width: calc(100% - 0px) !important;
498
+ & > span {
499
+ max-width: 100%;
500
+
501
+ .el-tag--info {
502
+ max-width: 100% !important;
503
+
504
+ &:first-child {
505
+ .el-select__tags-text {
506
+ max-width: 100% !important;
507
+ }
508
+ }
509
+
510
+ &:nth-child(2) {
511
+ // display: none;
512
+ .arco-select__tags-text {
513
+ max-width: 100% !important;
514
+ }
515
+ }
516
+ }
517
+ }
518
+ }
519
+ }
520
+
521
+ .el-date-editor.el-input,
522
+ .el-date-editor.el-input__inner {
523
+ width: 100%;
524
+ }
525
+
526
+ .el-select .el-select__tags {
527
+ display: flex;
528
+ flex-wrap: nowrap;
529
+
530
+ & > span {
531
+ display: flex;
532
+ flex-wrap: nowrap;
533
+ }
534
+ }
535
+
536
+ .date-section {
537
+ position: relative;
538
+ margin-bottom: 0 !important;
539
+
540
+ .el-input--small .el-input__inner {
541
+ padding-right: 20px;
542
+ padding-left: 15px;
543
+ }
544
+
545
+ .el-input__prefix {
546
+ display: none;
547
+ }
548
+
549
+ .date-section-line {
550
+ position: absolute;
551
+ top: 50%;
552
+ left: 50%;
553
+ transform: translate(-50%, -50%);
554
+ }
555
+ }
556
+ }
557
+ }
558
+ }
559
+
560
+ .hide {
561
+ display: none !important;
562
+ }
563
+
564
+ .search-panel-popover {
565
+ // background: red;
566
+ box-sizing: border-box;
567
+ position: relative;
568
+ .save-controls {
569
+ & > div {
570
+ & > span {
571
+ cursor: pointer;
572
+ display: block;
573
+ padding: 5px 0;
574
+ &:hover {
575
+ color: #155752;
576
+ }
577
+ }
578
+ }
579
+ .save-form {
580
+ width: 160px;
581
+ height: 40px;
582
+ background: #ffffff;
583
+ display: flex;
584
+ align-items: center;
585
+ justify-content: flex-start;
586
+ transform: translateX(-14px);
587
+ .save-form-button {
588
+ margin-left: 10px;
589
+ }
590
+ .save-form-input {
591
+ width: 84px;
592
+ }
593
+ .el-button--primary.is-disabled {
594
+ background: #155752;
595
+ opacity: 0.6;
596
+ }
597
+ .save-form-select {
598
+ width: 160px;
599
+ }
600
+ }
601
+ }
602
+ }
603
+
604
+ .select-popper {
605
+ .el-select-dropdown__item {
606
+ padding: 0 10px;
607
+ }
608
+ .select-content {
609
+ display: flex;
610
+ align-items: center;
611
+ justify-content: space-between;
612
+ box-sizing: border-box;
613
+ .select-content-button {
614
+ border: none;
615
+ background: none;
616
+ flex-shrink: 0;
617
+ box-sizing: border-box;
618
+ padding: 7px;
619
+ border-radius: 100%;
620
+ &:hover {
621
+ .el-icon--close {
622
+ opacity: 1;
623
+ }
624
+ }
625
+ .el-icon--close {
626
+ opacity: 0.6;
627
+ display: block;
628
+ color: #155752;
629
+ width: 12px;
630
+ height: 12px;
631
+ }
632
+ }
633
+ }
634
+ }
635
+ </style>
636
+