doway-coms 2.2.18 → 2.2.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 (73) hide show
  1. package/.browserslistrc +2 -2
  2. package/README.md +28 -28
  3. package/package.json +53 -53
  4. package/packages/AuditsList/index.js +7 -7
  5. package/packages/AuditsList/src/index.vue +262 -262
  6. package/packages/BaseButton/index.js +7 -7
  7. package/packages/BaseButton/src/index.vue +241 -241
  8. package/packages/BaseCheckbox/index.js +7 -7
  9. package/packages/BaseCheckbox/src/index.vue +134 -134
  10. package/packages/BaseDate/index.js +7 -7
  11. package/packages/BaseDate/src/index.vue +197 -197
  12. package/packages/BaseDateWeek/index.js +7 -7
  13. package/packages/BaseDateWeek/src/index.vue +163 -163
  14. package/packages/BaseDatetime/index.js +7 -7
  15. package/packages/BaseDatetime/src/index.vue +196 -196
  16. package/packages/BaseForm/index.js +7 -7
  17. package/packages/BaseForm/src/index.vue +728 -728
  18. package/packages/BaseGantt/index.js +9 -9
  19. package/packages/BaseGantt/src/index.vue +608 -608
  20. package/packages/BaseGrid/index.js +9 -9
  21. package/packages/BaseGrid/src/SeqSetting.vue +278 -278
  22. package/packages/BaseGrid/src/index.vue +3580 -3580
  23. package/packages/BaseGridAdjust/index.js +9 -9
  24. package/packages/BaseGridAdjust/src/index.vue +482 -482
  25. package/packages/BaseInput/index.js +7 -7
  26. package/packages/BaseInput/src/index.vue +164 -164
  27. package/packages/BaseIntervalInput/index.js +7 -7
  28. package/packages/BaseIntervalInput/src/index.vue +310 -310
  29. package/packages/BaseKanbanEmpty/index.js +7 -7
  30. package/packages/BaseKanbanEmpty/src/index.vue +176 -176
  31. package/packages/BaseNumberInput/index.js +7 -7
  32. package/packages/BaseNumberInput/src/index.vue +293 -293
  33. package/packages/BasePagination/index.js +7 -7
  34. package/packages/BasePagination/src/index.vue +91 -91
  35. package/packages/BasePictureCard/index.js +7 -7
  36. package/packages/BasePictureCard/src/index.vue +580 -580
  37. package/packages/BasePrintPreview/index.js +7 -7
  38. package/packages/BasePrintPreview/src/index.vue +129 -129
  39. package/packages/BasePulldown/index.js +7 -7
  40. package/packages/BasePulldown/src/index.vue +1265 -1265
  41. package/packages/BaseSearch/index.js +7 -7
  42. package/packages/BaseSearch/src/index.vue +935 -935
  43. package/packages/BaseSelect/index.js +7 -7
  44. package/packages/BaseSelect/src/index.vue +155 -155
  45. package/packages/BaseSelectMulti/index.js +7 -7
  46. package/packages/BaseSelectMulti/src/index.vue +148 -148
  47. package/packages/BaseTextArea/index.js +7 -7
  48. package/packages/BaseTextArea/src/index.vue +178 -178
  49. package/packages/BaseTime/index.js +7 -7
  50. package/packages/BaseTime/src/index.vue +166 -166
  51. package/packages/BaseTool/index.js +7 -7
  52. package/packages/BaseTool/src/index.vue +349 -349
  53. package/packages/BaseToolStatus/index.js +7 -7
  54. package/packages/BaseToolStatus/src/index.vue +388 -388
  55. package/packages/BaseTreeSelect/index.js +8 -8
  56. package/packages/BaseTreeSelect/src/index.vue +437 -416
  57. package/packages/LeaveAMessage/index.js +7 -7
  58. package/packages/LeaveAMessage/src/index.vue +597 -597
  59. package/packages/index.js +191 -191
  60. package/packages/styles/default.css +78 -78
  61. package/packages/styles/default.less +84 -84
  62. package/packages/utils/api.js +107 -107
  63. package/packages/utils/auth.js +38 -38
  64. package/packages/utils/common.js +610 -610
  65. package/packages/utils/dom.js +181 -181
  66. package/packages/utils/enum.js +86 -86
  67. package/packages/utils/filters.js +472 -472
  68. package/packages/utils/gridFormat.js +66 -66
  69. package/packages/utils/msg.js +84 -84
  70. package/packages/utils/patchFiles.js +44 -44
  71. package/packages/utils/request.js +178 -178
  72. package/packages/utils/store.js +305 -303
  73. package/vue.config.js +59 -59
@@ -1,936 +1,936 @@
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
- Tag,
341
- DatePicker,
342
- InputGroup,
343
- Input,
344
- InputNumber,
345
- Popconfirm,
346
- } from 'ant-design-vue'
347
- import { controlType } from "../../utils/enum";
348
- import moment from "moment";
349
- import { mapGetters } from "vuex";
350
- export default {
351
- name: "BaseSearch",
352
- components: {
353
- Button,
354
- Icon,
355
- Select,
356
- SelectOption: Select.Option,
357
- Tag,
358
- DatePicker,
359
- RangePicker: DatePicker.RangePicker,
360
- Input,
361
- InputGroup: Input.Group,
362
- InputNumber,
363
- Popconfirm,
364
- },
365
- computed: {
366
- ...mapGetters(["controlSize"]),
367
- visibleBtns() {
368
- return this.internalBtns.filter((filterItem) => {
369
- return filterItem.isShow === true;
370
- });
371
- },
372
- },
373
- data() {
374
- return {
375
- tempVisible: false,
376
- moment,
377
- controlType: controlType,
378
- searchRow: {},
379
- dropFields: [],
380
- testVisible: true,
381
- numberRangeValue: { min: 0, max: 0 },
382
- textValue: "",
383
- dateRangeValue: [],
384
- dateValue: null,
385
- expCols: [],
386
- waitingSelectLeave: false, //是否等待选择框离开
387
- internalCols: {}, //搜索字段信息
388
- };
389
- },
390
- props: {
391
- searchCols: {
392
- //搜索框列集合
393
- type: Array,
394
- default: () => {
395
- return [];
396
- },
397
- deep: true,
398
- },
399
- btns: {
400
- type: Array,
401
- default: () => {
402
- return [];
403
- },
404
- },
405
- },
406
- watch: {},
407
- created() {
408
- let tempCols = {};
409
- for (let colProp in this.searchCols) {
410
- let tempSearchCol = this.searchCols[colProp];
411
- if (tempSearchCol.visible === false) {
412
- continue;
413
- }
414
- let tempValues = [];
415
- if (
416
- tempSearchCol.defaultValues &&
417
- tempSearchCol.defaultValues.length > 0
418
- ) {
419
- for (let j = 0; j < tempSearchCol.defaultValues.length; j++) {
420
- if (tempSearchCol.controlType === controlType.dropmulti) {
421
- tempValues.push(tempSearchCol.defaultValues[j]);
422
- } else {
423
- tempValues.push({
424
- key: colProp + "_" + j,
425
- title: this.getValueTitle(
426
- tempSearchCol.defaultValues[j],
427
- tempSearchCol.controlType
428
- ),
429
- valueIndex: j,
430
- value: tempSearchCol.defaultValues[j],
431
- });
432
- }
433
- }
434
- }
435
- //赋值属性,防止页面不渲染,没有绑定到页面
436
- this.$set(tempSearchCol, "popupAddVisible", false);
437
- this.$set(tempSearchCol, "values", tempValues);
438
- this.$set(this.internalCols, tempSearchCol.field, tempSearchCol);
439
- }
440
- },
441
- mounted() {},
442
- methods: {
443
- dropChange() {
444
- this.$emit("searchBtnClick", null);
445
- },
446
- editNumberRangeVisibleChange(editKey, originValue, valueIndex, visible) {
447
- if (visible === true) {
448
- let vm = this;
449
- this.numberRangeValue.min = originValue.value.min;
450
- this.numberRangeValue.max = originValue.value.max;
451
- setTimeout(() => {
452
- vm.$refs[editKey + "_edit_" + valueIndex][0].focus();
453
- vm.$refs[editKey + "_edit_" + valueIndex][0].$el
454
- .getElementsByTagName("input")[0]
455
- .select();
456
- }, 10);
457
- }
458
- },
459
- editPopupVisibleChange(editKey, originValue, valueIndex, visible) {
460
- if (visible === true) {
461
- let vm = this;
462
- this.textValue = originValue.value;
463
- setTimeout(() => {
464
- console.debug(vm.$refs[editKey + "_edit_" + valueIndex][0]);
465
- vm.$refs[editKey + "_edit_" + valueIndex][0].$el.focus();
466
- vm.$refs[editKey + "_edit_" + valueIndex][0].$el.select();
467
- }, 10);
468
- }
469
- },
470
- addPopupVisibleChange(addKey, visible) {
471
- if (visible === true) {
472
- this.textValue = "";
473
- let vm = this;
474
- setTimeout(() => {
475
- vm.$refs[addKey + "_add"][0].$el.focus();
476
- }, 50);
477
- }
478
- },
479
- textAddEnter(colValue) {
480
- if (this.textValue) {
481
- colValue.popupAddVisible = false;
482
- this.addExpValue(colValue, this.textValue);
483
- this.textValue = "";
484
- }
485
- this.$emit("searchBtnClick", null);
486
- },
487
- textEditEnter(valueInfo) {
488
- if (this.textValue) {
489
- valueInfo.visible = false;
490
- valueInfo.value = this.textValue;
491
- this.textValue = "";
492
- }
493
- this.$emit("searchBtnClick", null);
494
- },
495
- numberRangeEditMinEnter(loopColKey, loopValueIndex) {
496
- let maxKey = loopColKey + "_edit_" + loopValueIndex + "_max";
497
- this.$refs[maxKey][0].focus();
498
- this.$refs[maxKey][0].$el.getElementsByTagName("input")[0].select();
499
- },
500
- numberRangeEditMaxEnter(valueInfo) {
501
- valueInfo.visible = false;
502
- valueInfo.value.min = this.numberRangeValue.min;
503
- valueInfo.value.max = this.numberRangeValue.max;
504
- this.numberRangeValue.min = 0;
505
- this.numberRangeValue.max = 0;
506
- },
507
- showMoreFilter() {
508
- for (let loopKey in this.internalCols) {
509
- this.internalCols[loopKey].visible = true;
510
- }
511
- },
512
- testClick() {
513
- this.$refs.testConfirm[0].setVisible(false);
514
- },
515
- closeTagPreventDefault(colValue, valueIndex, event) {
516
- colValue.values.splice(valueIndex, 1);
517
- event.preventDefault();
518
- this.$emit("searchBtnClick", null);
519
- },
520
- /**
521
- * 日期改变事件
522
- */
523
- datePickerChange(colValue, date, dateString) {
524
- this.addExpValue(colValue, dateString);
525
- this.dateValue = null;
526
- this.$emit("searchBtnClick", null);
527
- },
528
- /**
529
- * 日期范围改变事件
530
- */
531
- dateRangeChange(colValue, date, dateString) {
532
- this.addExpValue(colValue, dateString);
533
- this.dateRangeValue = null;
534
- this.$emit("searchBtnClick", null);
535
- },
536
- /**
537
- * 添加文本框条件
538
- */
539
- addTextExp(colValue) {
540
- if (this.textValue) {
541
- this.addExpValue(colValue, this.textValue);
542
- this.textValue = "";
543
- }
544
- this.$emit("searchBtnClick", null);
545
- },
546
- /**
547
- * 添加数字范围条件
548
- */
549
- addNumberRangeExp(colValue) {
550
- this.addExpValue(colValue, {
551
- min: this.numberRangeValue.min,
552
- max: this.numberRangeValue.max,
553
- });
554
- this.numberRangeValue.min = 0;
555
- this.numberRangeValue.max = 0;
556
- },
557
- addExpValue(colValue, dateString) {
558
- let valueLength = colValue.values.length;
559
- let lastValueIndex = -1;
560
- if (valueLength > 0) {
561
- lastValueIndex = colValue.values[valueLength - 1].valueIndex;
562
- }
563
- let newValueIndex = lastValueIndex + 1;
564
- let newValueKey = colValue.field + "_" + newValueIndex;
565
- let newAddValue = {
566
- key: newValueKey,
567
- value: dateString,
568
- valueIndex: newValueIndex,
569
- visible: false,
570
- };
571
- colValue.values.push(newAddValue);
572
- },
573
- /**
574
- * 输入框点击事件
575
- */
576
- inputDivClick(colValue) {
577
- this.$refs["pulldown_" + colValue.field][0].togglePanel();
578
- let vm = this;
579
- let lastInputValue = colValue.values[colValue.values.length - 1];
580
- setTimeout(() => {
581
- vm.$refs[lastInputValue.key][0].focus();
582
- }, 10);
583
- },
584
- remoteDropSearch(value) {
585
- console.debug(value);
586
- },
587
- remoteDropdownVisibleChange(open) {
588
- console.debug(open);
589
- },
590
- /**
591
- * 下拉面板隐藏事件
592
- */
593
- pulldownHiden(colValue) {
594
- let currentValues = colValue.values;
595
- for (let i = 0; i < currentValues.length; i++) {
596
- currentValues[i].title = this.getValueTitle(
597
- currentValues[i].value,
598
- colValue.controlType
599
- );
600
- }
601
- },
602
- /**
603
- * 列添加条件
604
- */
605
- addColExp(colValue) {
606
- let valueLength = colValue.values.length;
607
- let lastValueIndex = colValue.values[valueLength - 1].valueIndex;
608
- let newValueIndex = lastValueIndex + 1;
609
- let newValueKey = colValue.field + "_" + newValueIndex;
610
- let newAddValue = {
611
- key: newValueKey,
612
- value: this.getDefaultValue(colValue.controlType),
613
- title: "",
614
- valueIndex: newValueIndex,
615
- };
616
- colValue.values.push(newAddValue);
617
- let vm = this;
618
- setTimeout(() => {
619
- vm.$refs[newAddValue.key][0].focus();
620
- }, 10);
621
- },
622
- getDefaultValue(inControlType) {
623
- if (
624
- inControlType === controlType.daterange ||
625
- inControlType === controlType.dropmulti
626
- ) {
627
- return [];
628
- } else if (inControlType === controlType.numberrange) {
629
- return { min: null, max: null };
630
- } else {
631
- return "";
632
- }
633
- },
634
- clearExp(colValue, colValueIndex) {
635
- if (colValue.values.length <= 1) {
636
- return;
637
- }
638
- colValue.values.splice(colValueIndex, 1);
639
- },
640
- getValueTitle(colValue, inControlType) {
641
- let tempTitle = "";
642
- if (inControlType === controlType.daterange) {
643
- tempTitle = colValue[0] + "到" + colValue[1];
644
- } else if (inControlType === controlType.numberrange) {
645
- tempTitle = colValue.min + "到" + colValue.max;
646
- } else {
647
- tempTitle = colValue;
648
- }
649
- return tempTitle;
650
- },
651
- /**
652
- * 临时调用兼容C#,以后会剔除
653
- */
654
- getTempExp() {
655
- let tempAndExps = [];
656
- for (let loopProp in this.internalCols) {
657
- let tempControlType = this.internalCols[loopProp].controlType;
658
- let tempExp = "";
659
- if (tempControlType === controlType.text) {
660
- // 文本框
661
- for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
662
- if (i == 0) {
663
- tempExp = tempExp + " ( ";
664
- }
665
- tempExp =
666
- tempExp +
667
- loopProp +
668
- '.contains("' +
669
- this.internalCols[loopProp].values[i].value +
670
- '")';
671
- if (i < this.internalCols[loopProp].values.length - 1) {
672
- tempExp = tempExp + " or ";
673
- } else {
674
- tempExp = tempExp + " ) ";
675
- }
676
- }
677
- } else if (tempControlType === controlType.date) {
678
- //日期
679
- console.debug(this.internalCols[loopProp]);
680
- for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
681
- if (i == 0) {
682
- tempExp = tempExp + " ( ";
683
- }
684
- tempExp =
685
- tempExp +
686
- loopProp +
687
- ' = "' +
688
- this.internalCols[loopProp].values[i].value +
689
- '"';
690
- if (i < this.internalCols[loopProp].values.length - 1) {
691
- tempExp = tempExp + " or ";
692
- } else {
693
- tempExp = tempExp + " ) ";
694
- }
695
- }
696
- } else if (tempControlType === controlType.daterange) {
697
- //日期范围
698
- console.debug(this.internalCols[loopProp]);
699
- for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
700
- if (i == 0) {
701
- tempExp = tempExp + " ( ";
702
- }
703
- tempExp =
704
- tempExp +
705
- "(" +
706
- loopProp +
707
- ' >= "' +
708
- this.internalCols[loopProp].values[i].value[0] +
709
- '" and ' +
710
- loopProp +
711
- '<="' +
712
- this.internalCols[loopProp].values[i].value[1] +
713
- '")';
714
-
715
- if (i < this.internalCols[loopProp].values.length - 1) {
716
- tempExp = tempExp + " or ";
717
- } else {
718
- tempExp = tempExp + " ) ";
719
- }
720
- }
721
- } else if (tempControlType === controlType.dropmulti) {
722
- //下拉多选
723
- for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
724
- if (i == 0) {
725
- tempExp = tempExp + " ( ";
726
- }
727
- tempExp =
728
- tempExp +
729
- loopProp +
730
- ' = "' +
731
- this.internalCols[loopProp].values[i] +
732
- '"';
733
- if (i < this.internalCols[loopProp].values.length - 1) {
734
- tempExp = tempExp + " or ";
735
- } else {
736
- tempExp = tempExp + " ) ";
737
- }
738
- }
739
- }
740
-
741
- if (tempExp) {
742
- tempAndExps.push(tempExp);
743
- }
744
- }
745
- let tempStr = "";
746
- for (let i = 0; i < tempAndExps.length; i++) {
747
- tempStr = tempStr + " ( " + tempAndExps[i] + " ) ";
748
- if (i < tempAndExps.length - 1) {
749
- tempStr = tempStr + " and ";
750
- }
751
- }
752
- return tempStr;
753
- },
754
- getExpTags() {
755
- //构造查询条件
756
- let returnExp = {
757
- operator: "and",
758
- expressions: [],
759
- };
760
- for (let loopProp in this.internalCols) {
761
- let tempExpTag = {
762
- expressions: [],
763
- operator: "or",
764
- };
765
- let tempControlType = this.internalCols[loopProp].controlType;
766
- let tempIsAddTime = this.internalCols[loopProp].isAddTime;
767
- for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
768
- let tempValue = this.internalCols[loopProp].values[i];
769
- if (tempControlType === controlType.text) {
770
- // 文本框
771
- tempExpTag.expressions.push({
772
- field: loopProp,
773
- operator: "CO",
774
- value: tempValue.value,
775
- });
776
- } else if (tempControlType === controlType.date) {
777
- //日期
778
- if (tempExpTag.value) {
779
- tempExpTag.value.push(tempValue.value);
780
- } else {
781
- tempExpTag.value = [tempValue.value];
782
- tempExpTag.operator = "IN";
783
- tempExpTag.field = loopProp;
784
- }
785
- } else if (tempControlType === controlType.numberrange) {
786
- // 数字范围
787
- tempExpTag.expressions.push({
788
- field: loopProp,
789
- operator: "RA",
790
- value: [tempValue.value.min, tempValue.value.max],
791
- });
792
- } else if (tempControlType === controlType.daterange) {
793
- //日期范围
794
- if (tempIsAddTime === true) {
795
- tempExpTag.expressions.push({
796
- field: loopProp,
797
- operator: "RA",
798
- value: [
799
- tempValue.value[0] + " 00:00:00",
800
- tempValue.value[1] + " 23:59:59",
801
- ],
802
- });
803
- } else {
804
- tempExpTag.expressions.push({
805
- field: loopProp,
806
- operator: "RA",
807
- value: tempValue.value,
808
- });
809
- }
810
- } else if (tempControlType === controlType.dropmulti) {
811
- //下拉多选
812
- tempExpTag.expressions.push({
813
- field: loopProp,
814
- operator: "IN",
815
- value: this.internalCols[loopProp].values,
816
- });
817
- break;
818
- }
819
- }
820
- // console.debug(tempExpTag)
821
- if (tempExpTag.expressions.length > 0 || tempExpTag.field) {
822
- returnExp.expressions.push(tempExpTag);
823
- }
824
- }
825
-
826
- return returnExp;
827
- },
828
- /**
829
- * 搜索
830
- */
831
- btnSearchClick() {
832
- this.$emit("searchBtnClick", null);
833
- },
834
- /**
835
- * 清空条件
836
- */
837
- btnClearClick() {
838
- for (let loopProp in this.internalCols) {
839
- this.internalCols[loopProp].values = [];
840
- }
841
- this.$emit("searchBtnClick", null);
842
- },
843
- },
844
- };
845
- </script>
846
- <style lang="scss" scoped>
847
- .search-view-items {
848
- display: flex;
849
- flex-flow: row wrap;
850
- justify-content: flex-start;
851
- padding: 8px 8px 8px 8px;
852
- overflow-y: auto;
853
- position: relative;
854
- .search-view-item-ghost {
855
- visibility: hidden;
856
- height: 0;
857
- min-height: 0px !important;
858
- flex-grow: 1;
859
- flex-shrink: 1;
860
- flex-basis: auto;
861
- border: 1px solid #9ad4dc;
862
- min-width: 150px;
863
- width: 300px;
864
- margin-right: 8px;
865
- margin-left: 8px;
866
- border-radius: 6px;
867
- }
868
- .search-view-item {
869
- width: 300px;
870
- flex-grow: 1;
871
- flex-shrink: 1;
872
- flex-basis: auto;
873
- margin-top: 0px;
874
- margin-right: 8px;
875
- margin-bottom: 0px;
876
- margin-left: 8px;
877
- padding: 6px 8px 6px 8px;
878
- min-width: 150px;
879
- border-radius: 6px;
880
- .search-view-icon {
881
- float: left;
882
- width: 64px;
883
- height: 64px;
884
- }
885
- }
886
- }
887
- .ant-popover-message-title {
888
- padding-left: 0 !important;
889
- }
890
- .ant-input-group {
891
- display: flex;
892
- }
893
- .InputNumber {
894
- border-radius: 3px;
895
- width: 40%;
896
- }
897
- // 两个数字input框中间的文本
898
- .InputNumber-mid {
899
- width: 30px;
900
- pointer-events: none;
901
- background-color: #fff;
902
- border: 0;
903
- margin: 0 3px;
904
- }
905
- // 最外层的input样式
906
- .input-box {
907
- width: 100%;
908
- border: 1px solid;
909
- min-height: 24px;
910
- border-radius: 4px;
911
- border-color: rgb(217, 217, 217);
912
- padding-left: 5px;
913
- line-height: 24px !important;
914
- }
915
- // ant tags
916
- .Tags {
917
- min-height: 14px;
918
- line-height: 14px;
919
- margin-top: 3px;
920
- }
921
- // 文本自动换行的ant input组件
922
- .text-wrap-Tag {
923
- min-height: 14px;
924
- line-height: 16px;
925
- max-width: 100%;
926
- letter-spacing: 1px;
927
- padding: 2px;
928
- text-overflow: ellipsis !important;
929
- white-space: normal !important;
930
- }
931
- .label-text {
932
- line-height: 26px;
933
- font-weight: bold;
934
- }
935
- </style>
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
+ Tag,
341
+ DatePicker,
342
+ InputGroup,
343
+ Input,
344
+ InputNumber,
345
+ Popconfirm,
346
+ } from 'ant-design-vue'
347
+ import { controlType } from "../../utils/enum";
348
+ import moment from "moment";
349
+ import { mapGetters } from "vuex";
350
+ export default {
351
+ name: "BaseSearch",
352
+ components: {
353
+ Button,
354
+ Icon,
355
+ Select,
356
+ SelectOption: Select.Option,
357
+ Tag,
358
+ DatePicker,
359
+ RangePicker: DatePicker.RangePicker,
360
+ Input,
361
+ InputGroup: Input.Group,
362
+ InputNumber,
363
+ Popconfirm,
364
+ },
365
+ computed: {
366
+ ...mapGetters(["controlSize"]),
367
+ visibleBtns() {
368
+ return this.internalBtns.filter((filterItem) => {
369
+ return filterItem.isShow === true;
370
+ });
371
+ },
372
+ },
373
+ data() {
374
+ return {
375
+ tempVisible: false,
376
+ moment,
377
+ controlType: controlType,
378
+ searchRow: {},
379
+ dropFields: [],
380
+ testVisible: true,
381
+ numberRangeValue: { min: 0, max: 0 },
382
+ textValue: "",
383
+ dateRangeValue: [],
384
+ dateValue: null,
385
+ expCols: [],
386
+ waitingSelectLeave: false, //是否等待选择框离开
387
+ internalCols: {}, //搜索字段信息
388
+ };
389
+ },
390
+ props: {
391
+ searchCols: {
392
+ //搜索框列集合
393
+ type: Array,
394
+ default: () => {
395
+ return [];
396
+ },
397
+ deep: true,
398
+ },
399
+ btns: {
400
+ type: Array,
401
+ default: () => {
402
+ return [];
403
+ },
404
+ },
405
+ },
406
+ watch: {},
407
+ created() {
408
+ let tempCols = {};
409
+ for (let colProp in this.searchCols) {
410
+ let tempSearchCol = this.searchCols[colProp];
411
+ if (tempSearchCol.visible === false) {
412
+ continue;
413
+ }
414
+ let tempValues = [];
415
+ if (
416
+ tempSearchCol.defaultValues &&
417
+ tempSearchCol.defaultValues.length > 0
418
+ ) {
419
+ for (let j = 0; j < tempSearchCol.defaultValues.length; j++) {
420
+ if (tempSearchCol.controlType === controlType.dropmulti) {
421
+ tempValues.push(tempSearchCol.defaultValues[j]);
422
+ } else {
423
+ tempValues.push({
424
+ key: colProp + "_" + j,
425
+ title: this.getValueTitle(
426
+ tempSearchCol.defaultValues[j],
427
+ tempSearchCol.controlType
428
+ ),
429
+ valueIndex: j,
430
+ value: tempSearchCol.defaultValues[j],
431
+ });
432
+ }
433
+ }
434
+ }
435
+ //赋值属性,防止页面不渲染,没有绑定到页面
436
+ this.$set(tempSearchCol, "popupAddVisible", false);
437
+ this.$set(tempSearchCol, "values", tempValues);
438
+ this.$set(this.internalCols, tempSearchCol.field, tempSearchCol);
439
+ }
440
+ },
441
+ mounted() {},
442
+ methods: {
443
+ dropChange() {
444
+ this.$emit("searchBtnClick", null);
445
+ },
446
+ editNumberRangeVisibleChange(editKey, originValue, valueIndex, visible) {
447
+ if (visible === true) {
448
+ let vm = this;
449
+ this.numberRangeValue.min = originValue.value.min;
450
+ this.numberRangeValue.max = originValue.value.max;
451
+ setTimeout(() => {
452
+ vm.$refs[editKey + "_edit_" + valueIndex][0].focus();
453
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el
454
+ .getElementsByTagName("input")[0]
455
+ .select();
456
+ }, 10);
457
+ }
458
+ },
459
+ editPopupVisibleChange(editKey, originValue, valueIndex, visible) {
460
+ if (visible === true) {
461
+ let vm = this;
462
+ this.textValue = originValue.value;
463
+ setTimeout(() => {
464
+ console.debug(vm.$refs[editKey + "_edit_" + valueIndex][0]);
465
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el.focus();
466
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el.select();
467
+ }, 10);
468
+ }
469
+ },
470
+ addPopupVisibleChange(addKey, visible) {
471
+ if (visible === true) {
472
+ this.textValue = "";
473
+ let vm = this;
474
+ setTimeout(() => {
475
+ vm.$refs[addKey + "_add"][0].$el.focus();
476
+ }, 50);
477
+ }
478
+ },
479
+ textAddEnter(colValue) {
480
+ if (this.textValue) {
481
+ colValue.popupAddVisible = false;
482
+ this.addExpValue(colValue, this.textValue);
483
+ this.textValue = "";
484
+ }
485
+ this.$emit("searchBtnClick", null);
486
+ },
487
+ textEditEnter(valueInfo) {
488
+ if (this.textValue) {
489
+ valueInfo.visible = false;
490
+ valueInfo.value = this.textValue;
491
+ this.textValue = "";
492
+ }
493
+ this.$emit("searchBtnClick", null);
494
+ },
495
+ numberRangeEditMinEnter(loopColKey, loopValueIndex) {
496
+ let maxKey = loopColKey + "_edit_" + loopValueIndex + "_max";
497
+ this.$refs[maxKey][0].focus();
498
+ this.$refs[maxKey][0].$el.getElementsByTagName("input")[0].select();
499
+ },
500
+ numberRangeEditMaxEnter(valueInfo) {
501
+ valueInfo.visible = false;
502
+ valueInfo.value.min = this.numberRangeValue.min;
503
+ valueInfo.value.max = this.numberRangeValue.max;
504
+ this.numberRangeValue.min = 0;
505
+ this.numberRangeValue.max = 0;
506
+ },
507
+ showMoreFilter() {
508
+ for (let loopKey in this.internalCols) {
509
+ this.internalCols[loopKey].visible = true;
510
+ }
511
+ },
512
+ testClick() {
513
+ this.$refs.testConfirm[0].setVisible(false);
514
+ },
515
+ closeTagPreventDefault(colValue, valueIndex, event) {
516
+ colValue.values.splice(valueIndex, 1);
517
+ event.preventDefault();
518
+ this.$emit("searchBtnClick", null);
519
+ },
520
+ /**
521
+ * 日期改变事件
522
+ */
523
+ datePickerChange(colValue, date, dateString) {
524
+ this.addExpValue(colValue, dateString);
525
+ this.dateValue = null;
526
+ this.$emit("searchBtnClick", null);
527
+ },
528
+ /**
529
+ * 日期范围改变事件
530
+ */
531
+ dateRangeChange(colValue, date, dateString) {
532
+ this.addExpValue(colValue, dateString);
533
+ this.dateRangeValue = null;
534
+ this.$emit("searchBtnClick", null);
535
+ },
536
+ /**
537
+ * 添加文本框条件
538
+ */
539
+ addTextExp(colValue) {
540
+ if (this.textValue) {
541
+ this.addExpValue(colValue, this.textValue);
542
+ this.textValue = "";
543
+ }
544
+ this.$emit("searchBtnClick", null);
545
+ },
546
+ /**
547
+ * 添加数字范围条件
548
+ */
549
+ addNumberRangeExp(colValue) {
550
+ this.addExpValue(colValue, {
551
+ min: this.numberRangeValue.min,
552
+ max: this.numberRangeValue.max,
553
+ });
554
+ this.numberRangeValue.min = 0;
555
+ this.numberRangeValue.max = 0;
556
+ },
557
+ addExpValue(colValue, dateString) {
558
+ let valueLength = colValue.values.length;
559
+ let lastValueIndex = -1;
560
+ if (valueLength > 0) {
561
+ lastValueIndex = colValue.values[valueLength - 1].valueIndex;
562
+ }
563
+ let newValueIndex = lastValueIndex + 1;
564
+ let newValueKey = colValue.field + "_" + newValueIndex;
565
+ let newAddValue = {
566
+ key: newValueKey,
567
+ value: dateString,
568
+ valueIndex: newValueIndex,
569
+ visible: false,
570
+ };
571
+ colValue.values.push(newAddValue);
572
+ },
573
+ /**
574
+ * 输入框点击事件
575
+ */
576
+ inputDivClick(colValue) {
577
+ this.$refs["pulldown_" + colValue.field][0].togglePanel();
578
+ let vm = this;
579
+ let lastInputValue = colValue.values[colValue.values.length - 1];
580
+ setTimeout(() => {
581
+ vm.$refs[lastInputValue.key][0].focus();
582
+ }, 10);
583
+ },
584
+ remoteDropSearch(value) {
585
+ console.debug(value);
586
+ },
587
+ remoteDropdownVisibleChange(open) {
588
+ console.debug(open);
589
+ },
590
+ /**
591
+ * 下拉面板隐藏事件
592
+ */
593
+ pulldownHiden(colValue) {
594
+ let currentValues = colValue.values;
595
+ for (let i = 0; i < currentValues.length; i++) {
596
+ currentValues[i].title = this.getValueTitle(
597
+ currentValues[i].value,
598
+ colValue.controlType
599
+ );
600
+ }
601
+ },
602
+ /**
603
+ * 列添加条件
604
+ */
605
+ addColExp(colValue) {
606
+ let valueLength = colValue.values.length;
607
+ let lastValueIndex = colValue.values[valueLength - 1].valueIndex;
608
+ let newValueIndex = lastValueIndex + 1;
609
+ let newValueKey = colValue.field + "_" + newValueIndex;
610
+ let newAddValue = {
611
+ key: newValueKey,
612
+ value: this.getDefaultValue(colValue.controlType),
613
+ title: "",
614
+ valueIndex: newValueIndex,
615
+ };
616
+ colValue.values.push(newAddValue);
617
+ let vm = this;
618
+ setTimeout(() => {
619
+ vm.$refs[newAddValue.key][0].focus();
620
+ }, 10);
621
+ },
622
+ getDefaultValue(inControlType) {
623
+ if (
624
+ inControlType === controlType.daterange ||
625
+ inControlType === controlType.dropmulti
626
+ ) {
627
+ return [];
628
+ } else if (inControlType === controlType.numberrange) {
629
+ return { min: null, max: null };
630
+ } else {
631
+ return "";
632
+ }
633
+ },
634
+ clearExp(colValue, colValueIndex) {
635
+ if (colValue.values.length <= 1) {
636
+ return;
637
+ }
638
+ colValue.values.splice(colValueIndex, 1);
639
+ },
640
+ getValueTitle(colValue, inControlType) {
641
+ let tempTitle = "";
642
+ if (inControlType === controlType.daterange) {
643
+ tempTitle = colValue[0] + "到" + colValue[1];
644
+ } else if (inControlType === controlType.numberrange) {
645
+ tempTitle = colValue.min + "到" + colValue.max;
646
+ } else {
647
+ tempTitle = colValue;
648
+ }
649
+ return tempTitle;
650
+ },
651
+ /**
652
+ * 临时调用兼容C#,以后会剔除
653
+ */
654
+ getTempExp() {
655
+ let tempAndExps = [];
656
+ for (let loopProp in this.internalCols) {
657
+ let tempControlType = this.internalCols[loopProp].controlType;
658
+ let tempExp = "";
659
+ if (tempControlType === controlType.text) {
660
+ // 文本框
661
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
662
+ if (i == 0) {
663
+ tempExp = tempExp + " ( ";
664
+ }
665
+ tempExp =
666
+ tempExp +
667
+ loopProp +
668
+ '.contains("' +
669
+ this.internalCols[loopProp].values[i].value +
670
+ '")';
671
+ if (i < this.internalCols[loopProp].values.length - 1) {
672
+ tempExp = tempExp + " or ";
673
+ } else {
674
+ tempExp = tempExp + " ) ";
675
+ }
676
+ }
677
+ } else if (tempControlType === controlType.date) {
678
+ //日期
679
+ console.debug(this.internalCols[loopProp]);
680
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
681
+ if (i == 0) {
682
+ tempExp = tempExp + " ( ";
683
+ }
684
+ tempExp =
685
+ tempExp +
686
+ loopProp +
687
+ ' = "' +
688
+ this.internalCols[loopProp].values[i].value +
689
+ '"';
690
+ if (i < this.internalCols[loopProp].values.length - 1) {
691
+ tempExp = tempExp + " or ";
692
+ } else {
693
+ tempExp = tempExp + " ) ";
694
+ }
695
+ }
696
+ } else if (tempControlType === controlType.daterange) {
697
+ //日期范围
698
+ console.debug(this.internalCols[loopProp]);
699
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
700
+ if (i == 0) {
701
+ tempExp = tempExp + " ( ";
702
+ }
703
+ tempExp =
704
+ tempExp +
705
+ "(" +
706
+ loopProp +
707
+ ' >= "' +
708
+ this.internalCols[loopProp].values[i].value[0] +
709
+ '" and ' +
710
+ loopProp +
711
+ '<="' +
712
+ this.internalCols[loopProp].values[i].value[1] +
713
+ '")';
714
+
715
+ if (i < this.internalCols[loopProp].values.length - 1) {
716
+ tempExp = tempExp + " or ";
717
+ } else {
718
+ tempExp = tempExp + " ) ";
719
+ }
720
+ }
721
+ } else if (tempControlType === controlType.dropmulti) {
722
+ //下拉多选
723
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
724
+ if (i == 0) {
725
+ tempExp = tempExp + " ( ";
726
+ }
727
+ tempExp =
728
+ tempExp +
729
+ loopProp +
730
+ ' = "' +
731
+ this.internalCols[loopProp].values[i] +
732
+ '"';
733
+ if (i < this.internalCols[loopProp].values.length - 1) {
734
+ tempExp = tempExp + " or ";
735
+ } else {
736
+ tempExp = tempExp + " ) ";
737
+ }
738
+ }
739
+ }
740
+
741
+ if (tempExp) {
742
+ tempAndExps.push(tempExp);
743
+ }
744
+ }
745
+ let tempStr = "";
746
+ for (let i = 0; i < tempAndExps.length; i++) {
747
+ tempStr = tempStr + " ( " + tempAndExps[i] + " ) ";
748
+ if (i < tempAndExps.length - 1) {
749
+ tempStr = tempStr + " and ";
750
+ }
751
+ }
752
+ return tempStr;
753
+ },
754
+ getExpTags() {
755
+ //构造查询条件
756
+ let returnExp = {
757
+ operator: "and",
758
+ expressions: [],
759
+ };
760
+ for (let loopProp in this.internalCols) {
761
+ let tempExpTag = {
762
+ expressions: [],
763
+ operator: "or",
764
+ };
765
+ let tempControlType = this.internalCols[loopProp].controlType;
766
+ let tempIsAddTime = this.internalCols[loopProp].isAddTime;
767
+ for (let i = 0; i < this.internalCols[loopProp].values.length; i++) {
768
+ let tempValue = this.internalCols[loopProp].values[i];
769
+ if (tempControlType === controlType.text) {
770
+ // 文本框
771
+ tempExpTag.expressions.push({
772
+ field: loopProp,
773
+ operator: "CO",
774
+ value: tempValue.value,
775
+ });
776
+ } else if (tempControlType === controlType.date) {
777
+ //日期
778
+ if (tempExpTag.value) {
779
+ tempExpTag.value.push(tempValue.value);
780
+ } else {
781
+ tempExpTag.value = [tempValue.value];
782
+ tempExpTag.operator = "IN";
783
+ tempExpTag.field = loopProp;
784
+ }
785
+ } else if (tempControlType === controlType.numberrange) {
786
+ // 数字范围
787
+ tempExpTag.expressions.push({
788
+ field: loopProp,
789
+ operator: "RA",
790
+ value: [tempValue.value.min, tempValue.value.max],
791
+ });
792
+ } else if (tempControlType === controlType.daterange) {
793
+ //日期范围
794
+ if (tempIsAddTime === true) {
795
+ tempExpTag.expressions.push({
796
+ field: loopProp,
797
+ operator: "RA",
798
+ value: [
799
+ tempValue.value[0] + " 00:00:00",
800
+ tempValue.value[1] + " 23:59:59",
801
+ ],
802
+ });
803
+ } else {
804
+ tempExpTag.expressions.push({
805
+ field: loopProp,
806
+ operator: "RA",
807
+ value: tempValue.value,
808
+ });
809
+ }
810
+ } else if (tempControlType === controlType.dropmulti) {
811
+ //下拉多选
812
+ tempExpTag.expressions.push({
813
+ field: loopProp,
814
+ operator: "IN",
815
+ value: this.internalCols[loopProp].values,
816
+ });
817
+ break;
818
+ }
819
+ }
820
+ // console.debug(tempExpTag)
821
+ if (tempExpTag.expressions.length > 0 || tempExpTag.field) {
822
+ returnExp.expressions.push(tempExpTag);
823
+ }
824
+ }
825
+
826
+ return returnExp;
827
+ },
828
+ /**
829
+ * 搜索
830
+ */
831
+ btnSearchClick() {
832
+ this.$emit("searchBtnClick", null);
833
+ },
834
+ /**
835
+ * 清空条件
836
+ */
837
+ btnClearClick() {
838
+ for (let loopProp in this.internalCols) {
839
+ this.internalCols[loopProp].values = [];
840
+ }
841
+ this.$emit("searchBtnClick", null);
842
+ },
843
+ },
844
+ };
845
+ </script>
846
+ <style lang="scss" scoped>
847
+ .search-view-items {
848
+ display: flex;
849
+ flex-flow: row wrap;
850
+ justify-content: flex-start;
851
+ padding: 8px 8px 8px 8px;
852
+ overflow-y: auto;
853
+ position: relative;
854
+ .search-view-item-ghost {
855
+ visibility: hidden;
856
+ height: 0;
857
+ min-height: 0px !important;
858
+ flex-grow: 1;
859
+ flex-shrink: 1;
860
+ flex-basis: auto;
861
+ border: 1px solid #9ad4dc;
862
+ min-width: 150px;
863
+ width: 300px;
864
+ margin-right: 8px;
865
+ margin-left: 8px;
866
+ border-radius: 6px;
867
+ }
868
+ .search-view-item {
869
+ width: 300px;
870
+ flex-grow: 1;
871
+ flex-shrink: 1;
872
+ flex-basis: auto;
873
+ margin-top: 0px;
874
+ margin-right: 8px;
875
+ margin-bottom: 0px;
876
+ margin-left: 8px;
877
+ padding: 6px 8px 6px 8px;
878
+ min-width: 150px;
879
+ border-radius: 6px;
880
+ .search-view-icon {
881
+ float: left;
882
+ width: 64px;
883
+ height: 64px;
884
+ }
885
+ }
886
+ }
887
+ .ant-popover-message-title {
888
+ padding-left: 0 !important;
889
+ }
890
+ .ant-input-group {
891
+ display: flex;
892
+ }
893
+ .InputNumber {
894
+ border-radius: 3px;
895
+ width: 40%;
896
+ }
897
+ // 两个数字input框中间的文本
898
+ .InputNumber-mid {
899
+ width: 30px;
900
+ pointer-events: none;
901
+ background-color: #fff;
902
+ border: 0;
903
+ margin: 0 3px;
904
+ }
905
+ // 最外层的input样式
906
+ .input-box {
907
+ width: 100%;
908
+ border: 1px solid;
909
+ min-height: 24px;
910
+ border-radius: 4px;
911
+ border-color: rgb(217, 217, 217);
912
+ padding-left: 5px;
913
+ line-height: 24px !important;
914
+ }
915
+ // ant tags
916
+ .Tags {
917
+ min-height: 14px;
918
+ line-height: 14px;
919
+ margin-top: 3px;
920
+ }
921
+ // 文本自动换行的ant input组件
922
+ .text-wrap-Tag {
923
+ min-height: 14px;
924
+ line-height: 16px;
925
+ max-width: 100%;
926
+ letter-spacing: 1px;
927
+ padding: 2px;
928
+ text-overflow: ellipsis !important;
929
+ white-space: normal !important;
930
+ }
931
+ .label-text {
932
+ line-height: 26px;
933
+ font-weight: bold;
934
+ }
935
+ </style>
936
936