doway-coms 1.1.91 → 1.1.92

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.
@@ -0,0 +1,937 @@
1
+ <template>
2
+ <div>
3
+ <div class="search-view-items">
4
+ <div
5
+ class="search-view-item"
6
+ v-for="(loopColValue, loopColKey) in internalCols"
7
+ :key="loopColKey"
8
+ >
9
+ <div style="position: absolute" class="label-text">
10
+ {{ loopColValue.title }}
11
+ </div>
12
+ <!-- 下拉多选 -->
13
+ <div v-if="loopColValue.controlType === controlType.dropmulti">
14
+ <Select
15
+ mode="multiple"
16
+ :size="controlSize"
17
+ placeholder="请选择"
18
+ @change="dropChange"
19
+ v-model="loopColValue.values"
20
+ style="
21
+ width: 100%;
22
+ padding-left: 80px;
23
+ min-height: 24px;
24
+ border-radius: 4px;
25
+ border-color: rgb(217, 217, 217);
26
+ "
27
+ >
28
+ <SelectOption
29
+ v-for="loopSource in loopColValue.dataSource"
30
+ :key="loopSource.value"
31
+ >
32
+ {{ loopSource.caption }}
33
+ </SelectOption>
34
+ </Select>
35
+ </div>
36
+ <!-- 远程下拉多选 -->
37
+ <div v-if="loopColValue.controlType === controlType.remotedropmulti">
38
+ <Select
39
+ mode="multiple"
40
+ :filter-option="false"
41
+ :size="controlSize"
42
+ placeholder="请选择"
43
+ v-model="loopColValue.values"
44
+ @search="remoteDropSearch"
45
+ :not-found-content="fetching ? undefined : null"
46
+ @dropdownVisibleChange="remoteDropdownVisibleChange"
47
+ style="
48
+ width: 100%;
49
+ padding-left: 80px;
50
+ min-height: 24px;
51
+ border-radius: 4px;
52
+ border-color: rgb(217, 217, 217);
53
+ "
54
+ >
55
+ </Select>
56
+ </div>
57
+ <!-- 日期范围选择 -->
58
+ <div v-else-if="loopColValue.controlType === controlType.daterange">
59
+ <div style="padding-left: 80px">
60
+ <div class="input-box">
61
+ <span
62
+ v-for="(loopValue, loopValueIndex) in loopColValue.values"
63
+ :key="loopValue.key"
64
+ ><RangePicker
65
+ valueFormat="YYYY-MM-DD"
66
+ v-model="loopValue.value"
67
+ ><Tag
68
+ closable
69
+ class="Tags"
70
+ @close="
71
+ closeTagPreventDefault(
72
+ loopColValue,
73
+ loopValueIndex,
74
+ $event
75
+ )
76
+ "
77
+ >
78
+ {{ loopValue.value[0] }}到{{ loopValue.value[1] }}
79
+ </Tag></RangePicker
80
+ ></span
81
+ >
82
+ <!-- 循环结束的位置 -->
83
+ <RangePicker
84
+ valueFormat="YYYY-MM-DD"
85
+ v-model="dateRangeValue"
86
+ @change="
87
+ (date, dateString) =>
88
+ dateRangeChange(loopColValue, date, dateString)
89
+ "
90
+ ><Icon
91
+ type="plus"
92
+ style="color: #1890ff; cursor: pointer"
93
+ ></Icon
94
+ ></RangePicker>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ <!-- 日期选择 -->
99
+ <div v-else-if="loopColValue.controlType === controlType.date">
100
+ <div style="padding-left: 80px">
101
+ <div class="input-box">
102
+ <span
103
+ v-for="(loopValue, loopValueIndex) in loopColValue.values"
104
+ :key="loopValue.key"
105
+ ><DatePicker
106
+ valueFormat="YYYY-MM-DD"
107
+ v-model="loopValue.value"
108
+ ><Tag
109
+ closable
110
+ class="Tags"
111
+ @close="
112
+ closeTagPreventDefault(
113
+ loopColValue,
114
+ loopValueIndex,
115
+ $event
116
+ )
117
+ "
118
+ >{{ loopValue.value }}</Tag
119
+ ></DatePicker
120
+ ></span
121
+ >
122
+ <!-- 内容循环结束 -->
123
+ <DatePicker
124
+ valueFormat="YYYY-MM-DD"
125
+ v-model="dateValue"
126
+ @change="
127
+ (date, dateString) =>
128
+ datePickerChange(loopColValue, date, dateString)
129
+ "
130
+ >
131
+ <Icon
132
+ type="plus"
133
+ style="color: #1890ff; cursor: pointer"
134
+ ></Icon>
135
+ </DatePicker>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ <!-- 字符串文本框输入 -->
140
+ <div v-else-if="loopColValue.controlType === controlType.text">
141
+ <div style="padding-left: 80px">
142
+ <div class="input-box">
143
+ <span
144
+ v-for="(loopValue, loopValueIndex) in loopColValue.values"
145
+ :key="loopValue.key"
146
+ style="max-width: 96%; margin-top: 2px; display: inline-block"
147
+ >
148
+ <Popconfirm
149
+ placement="bottom"
150
+ @confirm="textEditEnter(loopValue)"
151
+ v-model="loopValue.visible"
152
+ @visibleChange="
153
+ (visible) =>
154
+ editPopupVisibleChange(
155
+ loopColKey,
156
+ loopValue,
157
+ loopValueIndex,
158
+ visible
159
+ )
160
+ "
161
+ >
162
+ <Tag
163
+ class="text-wrap-Tag"
164
+ closable
165
+ @close="
166
+ closeTagPreventDefault(
167
+ loopColValue,
168
+ loopValueIndex,
169
+ $event
170
+ )
171
+ "
172
+ >{{ loopValue.value }}</Tag
173
+ >
174
+ <template slot="icon">
175
+ <Input
176
+ @pressEnter="textEditEnter(loopValue)"
177
+ :ref="loopColKey + '_edit_' + loopValueIndex"
178
+ v-model="textValue"
179
+ ></Input>
180
+ </template>
181
+ </Popconfirm>
182
+ </span>
183
+ <!-- 输入框内容循环结尾 -->
184
+ <Popconfirm
185
+ placement="bottom"
186
+ v-model="loopColValue.popupAddVisible"
187
+ @visibleChange="
188
+ (visible) => addPopupVisibleChange(loopColKey, visible)
189
+ "
190
+ @confirm="addTextExp(loopColValue)"
191
+ >
192
+ <template slot="icon">
193
+ <Input
194
+ :ref="loopColKey + '_add'"
195
+ v-model="textValue"
196
+ @pressEnter="textAddEnter(loopColValue)"
197
+ style="height: 26px !important"
198
+ ></Input>
199
+ </template>
200
+ <Icon
201
+ type="plus"
202
+ style="color: #1890ff; cursor: pointer"
203
+ ></Icon>
204
+ </Popconfirm>
205
+ </div>
206
+ </div>
207
+ </div>
208
+ <!-- 数字范围 -->
209
+ <div v-else-if="loopColValue.controlType === controlType.numberrange">
210
+ <div style="padding-left: 80px">
211
+ <div class="input-box">
212
+ <span
213
+ v-for="(loopValue, loopValueIndex) in loopColValue.values"
214
+ :key="loopValue.key"
215
+ >
216
+ <Popconfirm
217
+ placement="bottom"
218
+ @confirm="numberRangeEditMaxEnter(loopValue)"
219
+ @visibleChange="
220
+ (visible) =>
221
+ editNumberRangeVisibleChange(
222
+ loopColKey,
223
+ loopValue,
224
+ loopValueIndex,
225
+ visible
226
+ )
227
+ "
228
+ v-model="loopValue.visible"
229
+ >
230
+ <Tag
231
+ class="Tags"
232
+ closable
233
+ @close="
234
+ closeTagPreventDefault(
235
+ loopColValue,
236
+ loopValueIndex,
237
+ $event
238
+ )
239
+ "
240
+ >{{ loopValue.value.min }}到{{ loopValue.value.max }}</Tag
241
+ >
242
+ <template slot="icon">
243
+ <InputGroup style="width: 260px" compact>
244
+ <InputNumber
245
+ :precision="0"
246
+ :ref="loopColKey + '_edit_' + loopValueIndex"
247
+ @pressEnter="
248
+ numberRangeEditMinEnter(loopColKey, loopValueIndex)
249
+ "
250
+ class="InputNumber"
251
+ v-model="numberRangeValue.min"
252
+ placeholder="最小"
253
+ /><br />
254
+ <Input
255
+ class="InputNumber-mid"
256
+ placeholder="~"
257
+ disabled
258
+ />
259
+ <InputNumber
260
+ :precision="0"
261
+ class="InputNumber"
262
+ :ref="loopColKey + '_edit_' + loopValueIndex + '_max'"
263
+ @pressEnter="numberRangeEditMaxEnter(loopValue)"
264
+ v-model="numberRangeValue.max"
265
+ placeholder="最大"
266
+ />
267
+ </InputGroup>
268
+ </template>
269
+ </Popconfirm>
270
+ </span>
271
+ <!-- 标签循环结束 -->
272
+ <Popconfirm
273
+ placement="bottom"
274
+ v-model="loopColValue.popupAddVisible"
275
+ @visibleChange="
276
+ (visible) => addPopupVisibleChange(loopColKey, visible)
277
+ "
278
+ @confirm="addNumberRangeExp(loopColValue)"
279
+ >
280
+ <template slot="icon">
281
+ <InputGroup>
282
+ <InputNumber
283
+ :ref="loopColKey + '_add'"
284
+ :precision="0"
285
+ class="InputNumber"
286
+ v-model="numberRangeValue.min"
287
+ placeholder="最小"
288
+ />
289
+ <Input
290
+ class="InputNumber-mid"
291
+ placeholder="~"
292
+ disabled
293
+ />
294
+ <InputNumber
295
+ :ref="loopColKey + '_add_max'"
296
+ class="InputNumber"
297
+ :precision="0"
298
+ v-model="numberRangeValue.max"
299
+ placeholder="最大"
300
+ />
301
+ </InputGroup>
302
+ </template>
303
+ <Icon
304
+ type="plus"
305
+ style="color: #1890ff; cursor: pointer"
306
+ ></Icon>
307
+ </Popconfirm>
308
+ </div>
309
+ </div>
310
+ </div>
311
+ </div>
312
+ <div class="search-view-item">
313
+ <Button type="primary" size="small" @click="btnSearchClick">
314
+ 搜索
315
+ </Button>
316
+ <Button size="small" @click="btnClearClick" style="margin-left: 5px">
317
+ 清空
318
+ </Button>
319
+ <slot name="otherButtons"></slot>
320
+ </div>
321
+ <div class="search-view-item-ghost"></div>
322
+ <div class="search-view-item-ghost"></div>
323
+ <div class="search-view-item-ghost"></div>
324
+ <div class="search-view-item-ghost"></div>
325
+ <div class="search-view-item-ghost"></div>
326
+ <div class="search-view-item-ghost"></div>
327
+ <div class="search-view-item-ghost"></div>
328
+ <div class="search-view-item-ghost"></div>
329
+ </div>
330
+ <div></div>
331
+ </div>
332
+ </template>
333
+
334
+ <script>
335
+ import {
336
+ Button,
337
+ Icon,
338
+ Select,
339
+ SelectOption,
340
+ RangePicker,
341
+ Tag,
342
+ DatePicker,
343
+ Tag,
344
+ DatePicker,
345
+ InputGroup,
346
+ Input,
347
+ InputNumber,
348
+ } from 'ant-design-vue'
349
+ import { controlType } from "@/utils/enum";
350
+ import moment from "moment";
351
+ import { mapGetters } from "vuex";
352
+ export default {
353
+ name: "BaseSearch",
354
+ components: {
355
+ Button,
356
+ Icon,
357
+ Select,
358
+ SelectOption,
359
+ RangePicker,
360
+ Tag,
361
+ DatePicker,
362
+ InputGroup,
363
+ Input,
364
+ InputNumber,
365
+ },
366
+ computed: {
367
+ ...mapGetters(["controlSize"]),
368
+ visibleBtns() {
369
+ return this.internalBtns.filter((filterItem) => {
370
+ return filterItem.isShow === true;
371
+ });
372
+ },
373
+ },
374
+ data() {
375
+ return {
376
+ tempVisible: false,
377
+ moment,
378
+ controlType: controlType,
379
+ searchRow: {},
380
+ dropFields: [],
381
+ testVisible: true,
382
+ numberRangeValue: { min: 0, max: 0 },
383
+ textValue: "",
384
+ dateRangeValue: [],
385
+ dateValue: null,
386
+ expCols: [],
387
+ waitingSelectLeave: false, //是否等待选择框离开
388
+ internalCols: {}, //搜索字段信息
389
+ };
390
+ },
391
+ props: {
392
+ searchCols: {
393
+ //搜索框列集合
394
+ type: Array,
395
+ default: () => {
396
+ return [];
397
+ },
398
+ deep: true,
399
+ },
400
+ btns: {
401
+ type: Array,
402
+ default: () => {
403
+ return [];
404
+ },
405
+ },
406
+ },
407
+ watch: {},
408
+ created() {
409
+ let tempCols = {};
410
+ for (let colProp in this.searchCols) {
411
+ let tempSearchCol = this.searchCols[colProp];
412
+ if (tempSearchCol.visible === false) {
413
+ continue;
414
+ }
415
+ let tempValues = [];
416
+ if (
417
+ tempSearchCol.defaultValues &&
418
+ tempSearchCol.defaultValues.length > 0
419
+ ) {
420
+ for (let j = 0; j < tempSearchCol.defaultValues.length; j++) {
421
+ if (tempSearchCol.controlType === controlType.dropmulti) {
422
+ tempValues.push(tempSearchCol.defaultValues[j]);
423
+ } else {
424
+ tempValues.push({
425
+ key: colProp + "_" + j,
426
+ title: this.getValueTitle(
427
+ tempSearchCol.defaultValues[j],
428
+ tempSearchCol.controlType
429
+ ),
430
+ valueIndex: j,
431
+ value: tempSearchCol.defaultValues[j],
432
+ });
433
+ }
434
+ }
435
+ }
436
+ //赋值属性,防止页面不渲染,没有绑定到页面
437
+ this.$set(tempSearchCol, "popupAddVisible", false);
438
+ this.$set(tempSearchCol, "values", tempValues);
439
+ this.$set(this.internalCols, tempSearchCol.field, tempSearchCol);
440
+ }
441
+ },
442
+ mounted() {},
443
+ methods: {
444
+ dropChange() {
445
+ this.$emit("searchBtnClick", null);
446
+ },
447
+ editNumberRangeVisibleChange(editKey, originValue, valueIndex, visible) {
448
+ if (visible === true) {
449
+ let vm = this;
450
+ this.numberRangeValue.min = originValue.value.min;
451
+ this.numberRangeValue.max = originValue.value.max;
452
+ setTimeout(() => {
453
+ vm.$refs[editKey + "_edit_" + valueIndex][0].focus();
454
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el
455
+ .getElementsByTagName("input")[0]
456
+ .select();
457
+ }, 10);
458
+ }
459
+ },
460
+ editPopupVisibleChange(editKey, originValue, valueIndex, visible) {
461
+ if (visible === true) {
462
+ let vm = this;
463
+ this.textValue = originValue.value;
464
+ setTimeout(() => {
465
+ console.debug(vm.$refs[editKey + "_edit_" + valueIndex][0]);
466
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el.focus();
467
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el.select();
468
+ }, 10);
469
+ }
470
+ },
471
+ addPopupVisibleChange(addKey, visible) {
472
+ if (visible === true) {
473
+ this.textValue = "";
474
+ let vm = this;
475
+ setTimeout(() => {
476
+ vm.$refs[addKey + "_add"][0].$el.focus();
477
+ }, 50);
478
+ }
479
+ },
480
+ textAddEnter(colValue) {
481
+ if (this.textValue) {
482
+ colValue.popupAddVisible = false;
483
+ this.addExpValue(colValue, this.textValue);
484
+ this.textValue = "";
485
+ }
486
+ this.$emit("searchBtnClick", null);
487
+ },
488
+ textEditEnter(valueInfo) {
489
+ if (this.textValue) {
490
+ valueInfo.visible = false;
491
+ valueInfo.value = this.textValue;
492
+ this.textValue = "";
493
+ }
494
+ this.$emit("searchBtnClick", null);
495
+ },
496
+ numberRangeEditMinEnter(loopColKey, loopValueIndex) {
497
+ let maxKey = loopColKey + "_edit_" + loopValueIndex + "_max";
498
+ this.$refs[maxKey][0].focus();
499
+ this.$refs[maxKey][0].$el.getElementsByTagName("input")[0].select();
500
+ },
501
+ numberRangeEditMaxEnter(valueInfo) {
502
+ valueInfo.visible = false;
503
+ valueInfo.value.min = this.numberRangeValue.min;
504
+ valueInfo.value.max = this.numberRangeValue.max;
505
+ this.numberRangeValue.min = 0;
506
+ this.numberRangeValue.max = 0;
507
+ },
508
+ showMoreFilter() {
509
+ for (let loopKey in this.internalCols) {
510
+ this.internalCols[loopKey].visible = true;
511
+ }
512
+ },
513
+ testClick() {
514
+ this.$refs.testConfirm[0].setVisible(false);
515
+ },
516
+ closeTagPreventDefault(colValue, valueIndex, event) {
517
+ colValue.values.splice(valueIndex, 1);
518
+ event.preventDefault();
519
+ this.$emit("searchBtnClick", null);
520
+ },
521
+ /**
522
+ * 日期改变事件
523
+ */
524
+ datePickerChange(colValue, date, dateString) {
525
+ this.addExpValue(colValue, dateString);
526
+ this.dateValue = null;
527
+ this.$emit("searchBtnClick", null);
528
+ },
529
+ /**
530
+ * 日期范围改变事件
531
+ */
532
+ dateRangeChange(colValue, date, dateString) {
533
+ this.addExpValue(colValue, dateString);
534
+ this.dateRangeValue = null;
535
+ this.$emit("searchBtnClick", null);
536
+ },
537
+ /**
538
+ * 添加文本框条件
539
+ */
540
+ addTextExp(colValue) {
541
+ if (this.textValue) {
542
+ this.addExpValue(colValue, this.textValue);
543
+ this.textValue = "";
544
+ }
545
+ this.$emit("searchBtnClick", null);
546
+ },
547
+ /**
548
+ * 添加数字范围条件
549
+ */
550
+ addNumberRangeExp(colValue) {
551
+ this.addExpValue(colValue, {
552
+ min: this.numberRangeValue.min,
553
+ max: this.numberRangeValue.max,
554
+ });
555
+ this.numberRangeValue.min = 0;
556
+ this.numberRangeValue.max = 0;
557
+ },
558
+ addExpValue(colValue, dateString) {
559
+ let valueLength = colValue.values.length;
560
+ let lastValueIndex = -1;
561
+ if (valueLength > 0) {
562
+ lastValueIndex = colValue.values[valueLength - 1].valueIndex;
563
+ }
564
+ let newValueIndex = lastValueIndex + 1;
565
+ let newValueKey = colValue.field + "_" + newValueIndex;
566
+ let newAddValue = {
567
+ key: newValueKey,
568
+ value: dateString,
569
+ valueIndex: newValueIndex,
570
+ visible: false,
571
+ };
572
+ colValue.values.push(newAddValue);
573
+ },
574
+ /**
575
+ * 输入框点击事件
576
+ */
577
+ inputDivClick(colValue) {
578
+ this.$refs["pulldown_" + colValue.field][0].togglePanel();
579
+ let vm = this;
580
+ let lastInputValue = colValue.values[colValue.values.length - 1];
581
+ setTimeout(() => {
582
+ vm.$refs[lastInputValue.key][0].focus();
583
+ }, 10);
584
+ },
585
+ remoteDropSearch(value) {
586
+ console.debug(value);
587
+ },
588
+ remoteDropdownVisibleChange(open) {
589
+ console.debug(open);
590
+ },
591
+ /**
592
+ * 下拉面板隐藏事件
593
+ */
594
+ pulldownHiden(colValue) {
595
+ let currentValues = colValue.values;
596
+ for (let i = 0; i < currentValues.length; i++) {
597
+ currentValues[i].title = this.getValueTitle(
598
+ currentValues[i].value,
599
+ colValue.controlType
600
+ );
601
+ }
602
+ },
603
+ /**
604
+ * 列添加条件
605
+ */
606
+ addColExp(colValue) {
607
+ let valueLength = colValue.values.length;
608
+ let lastValueIndex = colValue.values[valueLength - 1].valueIndex;
609
+ let newValueIndex = lastValueIndex + 1;
610
+ let newValueKey = colValue.field + "_" + newValueIndex;
611
+ let newAddValue = {
612
+ key: newValueKey,
613
+ value: this.getDefaultValue(colValue.controlType),
614
+ title: "",
615
+ valueIndex: newValueIndex,
616
+ };
617
+ colValue.values.push(newAddValue);
618
+ let vm = this;
619
+ setTimeout(() => {
620
+ vm.$refs[newAddValue.key][0].focus();
621
+ }, 10);
622
+ },
623
+ getDefaultValue(inControlType) {
624
+ if (
625
+ inControlType === controlType.daterange ||
626
+ inControlType === controlType.dropmulti
627
+ ) {
628
+ return [];
629
+ } else if (inControlType === controlType.numberrange) {
630
+ return { min: null, max: null };
631
+ } else {
632
+ return "";
633
+ }
634
+ },
635
+ clearExp(colValue, colValueIndex) {
636
+ if (colValue.values.length <= 1) {
637
+ return;
638
+ }
639
+ colValue.values.splice(colValueIndex, 1);
640
+ },
641
+ getValueTitle(colValue, inControlType) {
642
+ let tempTitle = "";
643
+ if (inControlType === controlType.daterange) {
644
+ tempTitle = colValue[0] + "到" + colValue[1];
645
+ } else if (inControlType === controlType.numberrange) {
646
+ tempTitle = colValue.min + "到" + colValue.max;
647
+ } else {
648
+ tempTitle = colValue;
649
+ }
650
+ return tempTitle;
651
+ },
652
+ /**
653
+ * 临时调用兼容C#,以后会剔除
654
+ */
655
+ getTempExp() {
656
+ let tempAndExps = [];
657
+ for (let loopProp in this.internalCols) {
658
+ let tempControlType = this.internalCols[loopProp].controlType;
659
+ let tempExp = "";
660
+ if (tempControlType === controlType.text) {
661
+ // 文本框
662
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
663
+ if (i == 0) {
664
+ tempExp = tempExp + " ( ";
665
+ }
666
+ tempExp =
667
+ tempExp +
668
+ loopProp +
669
+ '.contains("' +
670
+ this.internalCols[loopProp].values[i].value +
671
+ '")';
672
+ if (i < this.internalCols[loopProp].values.length - 1) {
673
+ tempExp = tempExp + " or ";
674
+ } else {
675
+ tempExp = tempExp + " ) ";
676
+ }
677
+ }
678
+ } else if (tempControlType === controlType.date) {
679
+ //日期
680
+ console.debug(this.internalCols[loopProp]);
681
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
682
+ if (i == 0) {
683
+ tempExp = tempExp + " ( ";
684
+ }
685
+ tempExp =
686
+ tempExp +
687
+ loopProp +
688
+ ' = "' +
689
+ this.internalCols[loopProp].values[i].value +
690
+ '"';
691
+ if (i < this.internalCols[loopProp].values.length - 1) {
692
+ tempExp = tempExp + " or ";
693
+ } else {
694
+ tempExp = tempExp + " ) ";
695
+ }
696
+ }
697
+ } else if (tempControlType === controlType.daterange) {
698
+ //日期范围
699
+ console.debug(this.internalCols[loopProp]);
700
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
701
+ if (i == 0) {
702
+ tempExp = tempExp + " ( ";
703
+ }
704
+ tempExp =
705
+ tempExp +
706
+ "(" +
707
+ loopProp +
708
+ ' >= "' +
709
+ this.internalCols[loopProp].values[i].value[0] +
710
+ '" and ' +
711
+ loopProp +
712
+ '<="' +
713
+ this.internalCols[loopProp].values[i].value[1] +
714
+ '")';
715
+
716
+ if (i < this.internalCols[loopProp].values.length - 1) {
717
+ tempExp = tempExp + " or ";
718
+ } else {
719
+ tempExp = tempExp + " ) ";
720
+ }
721
+ }
722
+ } else if (tempControlType === controlType.dropmulti) {
723
+ //下拉多选
724
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
725
+ if (i == 0) {
726
+ tempExp = tempExp + " ( ";
727
+ }
728
+ tempExp =
729
+ tempExp +
730
+ loopProp +
731
+ ' = "' +
732
+ this.internalCols[loopProp].values[i] +
733
+ '"';
734
+ if (i < this.internalCols[loopProp].values.length - 1) {
735
+ tempExp = tempExp + " or ";
736
+ } else {
737
+ tempExp = tempExp + " ) ";
738
+ }
739
+ }
740
+ }
741
+
742
+ if (tempExp) {
743
+ tempAndExps.push(tempExp);
744
+ }
745
+ }
746
+ let tempStr = "";
747
+ for (let i = 0; i < tempAndExps.length; i++) {
748
+ tempStr = tempStr + " ( " + tempAndExps[i] + " ) ";
749
+ if (i < tempAndExps.length - 1) {
750
+ tempStr = tempStr + " and ";
751
+ }
752
+ }
753
+ return tempStr;
754
+ },
755
+ getExpTags() {
756
+ //构造查询条件
757
+ let returnExp = {
758
+ operator: "and",
759
+ expressions: [],
760
+ };
761
+ for (let loopProp in this.internalCols) {
762
+ let tempExpTag = {
763
+ expressions: [],
764
+ operator: "or",
765
+ };
766
+ let tempControlType = this.internalCols[loopProp].controlType;
767
+ let tempIsAddTime = this.internalCols[loopProp].isAddTime;
768
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
769
+ let tempValue = this.internalCols[loopProp].values[i];
770
+ if (tempControlType === controlType.text) {
771
+ // 文本框
772
+ tempExpTag.expressions.push({
773
+ field: loopProp,
774
+ operator: "CO",
775
+ value: tempValue.value,
776
+ });
777
+ } else if (tempControlType === controlType.date) {
778
+ //日期
779
+ if (tempExpTag.value) {
780
+ tempExpTag.value.push(tempValue.value);
781
+ } else {
782
+ tempExpTag.value = [tempValue.value];
783
+ tempExpTag.operator = "IN";
784
+ tempExpTag.field = loopProp;
785
+ }
786
+ } else if (tempControlType === controlType.numberrange) {
787
+ // 数字范围
788
+ tempExpTag.expressions.push({
789
+ field: loopProp,
790
+ operator: "RA",
791
+ value: [tempValue.value.min, tempValue.value.max],
792
+ });
793
+ } else if (tempControlType === controlType.daterange) {
794
+ //日期范围
795
+ if (tempIsAddTime === true) {
796
+ tempExpTag.expressions.push({
797
+ field: loopProp,
798
+ operator: "RA",
799
+ value: [
800
+ tempValue.value[0] + " 00:00:00",
801
+ tempValue.value[1] + " 23:59:59",
802
+ ],
803
+ });
804
+ } else {
805
+ tempExpTag.expressions.push({
806
+ field: loopProp,
807
+ operator: "RA",
808
+ value: tempValue.value,
809
+ });
810
+ }
811
+ } else if (tempControlType === controlType.dropmulti) {
812
+ //下拉多选
813
+ tempExpTag.expressions.push({
814
+ field: loopProp,
815
+ operator: "IN",
816
+ value: this.internalCols[loopProp].values,
817
+ });
818
+ break;
819
+ }
820
+ }
821
+ // console.debug(tempExpTag)
822
+ if (tempExpTag.expressions.length > 0 || tempExpTag.field) {
823
+ returnExp.expressions.push(tempExpTag);
824
+ }
825
+ }
826
+
827
+ return returnExp;
828
+ },
829
+ /**
830
+ * 搜索
831
+ */
832
+ btnSearchClick() {
833
+ this.$emit("searchBtnClick", null);
834
+ },
835
+ /**
836
+ * 清空条件
837
+ */
838
+ btnClearClick() {
839
+ for (let loopProp in this.internalCols) {
840
+ this.internalCols[loopProp].values = [];
841
+ }
842
+ this.$emit("searchBtnClick", null);
843
+ },
844
+ },
845
+ };
846
+ </script>
847
+ <style lang="scss" scoped>
848
+ .search-view-items {
849
+ display: flex;
850
+ flex-flow: row wrap;
851
+ justify-content: flex-start;
852
+ padding: 8px 8px 8px 8px;
853
+ overflow-y: auto;
854
+ position: relative;
855
+ .search-view-item-ghost {
856
+ visibility: hidden;
857
+ height: 0;
858
+ min-height: 0px !important;
859
+ flex-grow: 1;
860
+ flex-shrink: 1;
861
+ flex-basis: auto;
862
+ border: 1px solid #9ad4dc;
863
+ min-width: 150px;
864
+ width: 300px;
865
+ margin-right: 8px;
866
+ margin-left: 8px;
867
+ border-radius: 6px;
868
+ }
869
+ .search-view-item {
870
+ width: 300px;
871
+ flex-grow: 1;
872
+ flex-shrink: 1;
873
+ flex-basis: auto;
874
+ margin-top: 0px;
875
+ margin-right: 8px;
876
+ margin-bottom: 0px;
877
+ margin-left: 8px;
878
+ padding: 6px 8px 6px 8px;
879
+ min-width: 150px;
880
+ border-radius: 6px;
881
+ .search-view-icon {
882
+ float: left;
883
+ width: 64px;
884
+ height: 64px;
885
+ }
886
+ }
887
+ }
888
+ .ant-popover-message-title {
889
+ padding-left: 0 !important;
890
+ }
891
+ .ant-input-group {
892
+ display: flex;
893
+ }
894
+ .InputNumber {
895
+ border-radius: 3px;
896
+ width: 40%;
897
+ }
898
+ // 两个数字input框中间的文本
899
+ .InputNumber-mid {
900
+ width: 30px;
901
+ pointer-events: none;
902
+ background-color: #fff;
903
+ border: 0;
904
+ margin: 0 3px;
905
+ }
906
+ // 最外层的input样式
907
+ .input-box {
908
+ width: 100%;
909
+ border: 1px solid;
910
+ min-height: 24px;
911
+ border-radius: 4px;
912
+ border-color: rgb(217, 217, 217);
913
+ padding-left: 5px;
914
+ line-height: 24px !important;
915
+ }
916
+ // ant tags
917
+ .Tags {
918
+ min-height: 14px;
919
+ line-height: 14px;
920
+ margin-top: 3px;
921
+ }
922
+ // 文本自动换行的ant input组件
923
+ .text-wrap-Tag {
924
+ min-height: 14px;
925
+ line-height: 16px;
926
+ max-width: 100%;
927
+ letter-spacing: 1px;
928
+ padding: 2px;
929
+ text-overflow: ellipsis !important;
930
+ white-space: normal !important;
931
+ }
932
+ .label-text {
933
+ line-height: 26px;
934
+ font-weight: bold;
935
+ }
936
+ </style>
937
+