doway-coms 1.4.91 → 1.4.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.
Files changed (70) hide show
  1. package/.browserslistrc +2 -2
  2. package/README.md +28 -28
  3. package/package.json +52 -52
  4. package/packages/BaseButton/index.js +7 -7
  5. package/packages/BaseButton/src/index.vue +241 -241
  6. package/packages/BaseCheckbox/index.js +7 -7
  7. package/packages/BaseCheckbox/src/index.vue +134 -134
  8. package/packages/BaseDate/index.js +7 -7
  9. package/packages/BaseDate/src/index.vue +197 -197
  10. package/packages/BaseDateWeek/index.js +7 -7
  11. package/packages/BaseDateWeek/src/index.vue +163 -163
  12. package/packages/BaseDatetime/index.js +7 -7
  13. package/packages/BaseDatetime/src/index.vue +196 -196
  14. package/packages/BaseForm/index.js +7 -7
  15. package/packages/BaseForm/src/index.vue +664 -664
  16. package/packages/BaseGantt/index.js +9 -9
  17. package/packages/BaseGantt/src/index.vue +604 -604
  18. package/packages/BaseGrid/index.js +9 -9
  19. package/packages/BaseGrid/src/index.vue +2674 -2674
  20. package/packages/BaseGridAdjust/index.js +9 -9
  21. package/packages/BaseGridAdjust/src/index.vue +455 -455
  22. package/packages/BaseInput/index.js +7 -7
  23. package/packages/BaseInput/src/index.vue +164 -164
  24. package/packages/BaseIntervalInput/index.js +7 -7
  25. package/packages/BaseIntervalInput/src/index.vue +310 -310
  26. package/packages/BaseKanbanEmpty/index.js +7 -7
  27. package/packages/BaseKanbanEmpty/src/index.vue +176 -176
  28. package/packages/BaseNumberInput/index.js +7 -7
  29. package/packages/BaseNumberInput/src/index.vue +229 -229
  30. package/packages/BasePagination/index.js +7 -7
  31. package/packages/BasePagination/src/index.vue +91 -91
  32. package/packages/BasePictureCard/index.js +7 -7
  33. package/packages/BasePictureCard/src/index.vue +561 -561
  34. package/packages/BasePrintPreview/index.js +7 -7
  35. package/packages/BasePrintPreview/src/index.vue +117 -117
  36. package/packages/BasePulldown/index.js +7 -7
  37. package/packages/BasePulldown/src/index.vue +829 -829
  38. package/packages/BaseSearch/index.js +7 -7
  39. package/packages/BaseSearch/src/index.vue +935 -935
  40. package/packages/BaseSelect/index.js +7 -7
  41. package/packages/BaseSelect/src/index.vue +153 -153
  42. package/packages/BaseSelectMulti/index.js +7 -7
  43. package/packages/BaseSelectMulti/src/index.vue +148 -148
  44. package/packages/BaseTextArea/index.js +7 -7
  45. package/packages/BaseTextArea/src/index.vue +178 -178
  46. package/packages/BaseTime/index.js +7 -7
  47. package/packages/BaseTime/src/index.vue +166 -166
  48. package/packages/BaseTool/index.js +7 -7
  49. package/packages/BaseTool/src/index.vue +349 -349
  50. package/packages/BaseToolStatus/index.js +7 -7
  51. package/packages/BaseToolStatus/src/index.vue +383 -383
  52. package/packages/index.js +165 -165
  53. package/packages/styles/default.less +80 -80
  54. package/packages/utils/api.js +45 -45
  55. package/packages/utils/auth.js +38 -38
  56. package/packages/utils/common.js +583 -583
  57. package/packages/utils/dom.js +181 -181
  58. package/packages/utils/enum.js +83 -83
  59. package/packages/utils/filters.js +458 -458
  60. package/packages/utils/gridFormat.js +52 -52
  61. package/packages/utils/msg.js +16 -16
  62. package/packages/utils/patchFiles.js +44 -44
  63. package/packages/utils/request.js +169 -169
  64. package/packages/utils/store.js +246 -246
  65. package/vue.config.js +59 -59
  66. package/dist/css/chunk-vendors.7f83d8f9.css +0 -8
  67. package/dist/css/index.86478f73.css +0 -3
  68. package/dist/favicon.ico +0 -0
  69. package/dist/js/chunk-vendors.307eaa8f.js +0 -347
  70. package/dist/js/index.48e7f7ac.js +0 -2
@@ -1,830 +1,830 @@
1
- <template>
2
- <div class="d-control-container">
3
- <div
4
- class="d-control-label"
5
- v-if="showLabel === true"
6
- :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
7
- >
8
- {{ label
9
- }}
10
- <span v-if="rules && rules['required']" class="d-control-label-required"
11
- >*</span
12
- >
13
- <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
14
- <img src="../../styles/icon/help.png" alt="" style="width: 14px">
15
- </Tooltip>
16
- </div>
17
- <div
18
- :class="{
19
- 'd-control': showLabel === true,
20
- 'd-grid-control': showLabel === false
21
- }"
22
- >
23
- <VxePulldown
24
- style="width:100%"
25
- @hide-panel="pullDownHideEvent"
26
- ref="pulldownRef"
27
- v-if="edit === true"
28
- transfer
29
- >
30
- <template #default>
31
- <ValidationProvider :name="label" v-slot="v" :rules="rules">
32
- <a-input
33
- :size="'small'"
34
- allow-clear
35
- @change="inputChangeEvent"
36
- class="inner-cell-control"
37
- v-model="currentValue"
38
- @click="inputClickEvent"
39
- @focus="inputFocusEvent"
40
- @blur="inputBlurEvent"
41
- @keydown="inputKeydownEvent"
42
- @keyup="inputKeyupEvent"
43
- :class="{ 'd-error-input': v.errors.length > 0 }"
44
- ></a-input>
45
- <div class="d-error-msg">
46
- {{ v.errors[0] }}
47
- </div>
48
- </ValidationProvider>
49
- </template>
50
- <template #dropdown>
51
- <div class="pulldown-grid interceptor-class">
52
- <vxe-grid
53
- size="mini"
54
- border
55
- :row-class-name="gridRowStyle"
56
- highlight-current-row
57
- :keyboard-config="{ isArrow: true }"
58
- highlight-hover-row
59
- auto-resize
60
- resizable
61
- :loading="gridLoading"
62
- height="auto"
63
- ref="pupupGridView"
64
- :data="searchRows"
65
- @cell-click="gridCellClick"
66
- :columns="internalColumns"
67
- >
68
- <!-- :pager-config="gridPagerConfig" -->
69
- <!-- @page-change="pageChangeEvent" -->
70
- <template #matCode_header="{column}">
71
- <div class="first-col">
72
- <div class="first-col-top">
73
- {{ column.title }}
74
- </div>
75
- <div class="first-col-bottom">
76
- <input style="width:100%" />
77
- </div>
78
- </div>
79
- </template>
80
- <template #pager>
81
- <a-row>
82
- <a-col :span="8">
83
- <a-button
84
- v-if="isMultiSelect === true"
85
- type="primary"
86
- size="small"
87
- style="margin: 5px"
88
- @click="multiSelectConfirm"
89
- >
90
- 确认选择
91
- </a-button>
92
- <a-button
93
- v-if="popupAddName"
94
- type="primary"
95
- size="small"
96
- style="margin: 5px"
97
- @click="pagerBtnClick(btn)"
98
- >
99
- 新增
100
- </a-button>
101
-
102
- <template v-if="optBtns.length > 0">
103
- <a-button
104
- v-for="btn in optBtns"
105
- :key="btn.field"
106
- type="primary"
107
- size="small"
108
- style="margin: 5px"
109
- @click="pagerBtnClick(btn)"
110
- >
111
- {{ btn.name }}
112
- </a-button>
113
- </template>
114
- </a-col>
115
- <a-col :span="16">
116
- <vxe-pager
117
- align="right"
118
- size="mini"
119
- :current-page.sync="gridPagerConfig.currentPage"
120
- :page-size.sync="gridPagerConfig.pageSize"
121
- :total="gridPagerConfig.total"
122
- @page-change="pageChangeEvent"
123
- >
124
- </vxe-pager>
125
- </a-col>
126
- </a-row>
127
- </template>
128
- </vxe-grid>
129
- </div>
130
- </template>
131
- </VxePulldown>
132
- <span v-if="edit === false">
133
- <a v-if="route" @click="routeLinkClick">{{ currentValue }}</a>
134
- <span v-else> {{ currentValue }}</span>
135
- </span>
136
- </div>
137
-
138
- <keep-alive>
139
- <div
140
- :is="popupAddName"
141
- ref="pupupAddView"
142
- @popupSaveAfter="popupSaveAfter"
143
- ></div>
144
- </keep-alive>
145
- </div>
146
- </template>
147
-
148
- <script>
149
- import XEUtils from 'xe-utils'
150
- import { sysRowState, sysFormState, controlType } from '../../utils/enum'
151
- import { replaceParamString, replaceParam } from '../../utils/common'
152
- import request from '../../utils/request'
153
- import { Input,Button,Row,Col } from 'ant-design-vue'
154
- import { ValidationProvider } from 'vee-validate'
155
- import {Pulldown} from 'vxe-table'
156
- import { Tooltip } from 'ant-design-vue'
157
- export default {
158
- name: 'BasePulldown',
159
- components:{
160
- 'a-input':Input,
161
- 'a-button':Button,
162
- 'a-row':Row,
163
- 'a-col':Col,
164
- 'VxePulldown':Pulldown,
165
- ValidationProvider,
166
- Tooltip,
167
-
168
- },
169
- data() {
170
- return {
171
- fetchFields: '',
172
- internalColumns: [],
173
- isInputChanged: false,
174
- inputTimeout: null,
175
- searchRows: [],
176
- filterCols: [],
177
- gridLoading: false,
178
- gridPagerConfig: {
179
- total: 0,
180
- currentPage: 1,
181
- pageSize: 10
182
- }
183
- }
184
- },
185
- props: {
186
- labelWidth: {
187
- type: Number,
188
- default: function() {
189
- return 0
190
- }
191
- },
192
- isMultiSelect: {
193
- type: Boolean,
194
- default: function() {
195
- return false
196
- }
197
- },
198
- popupAddName: {
199
- type: String,
200
- default: function() {
201
- return null
202
- }
203
- },
204
- popupAddPath: {
205
- type: String,
206
- default: function() {
207
- return null
208
- }
209
- },
210
- rules: {
211
- type: Object,
212
- default: function() {
213
- return null
214
- }
215
- },
216
- showLabel: {
217
- type: Boolean,
218
- default: function() {
219
- return true
220
- }
221
- },
222
- label: {
223
- type: String,
224
- default: function() {
225
- return ''
226
- }
227
- },
228
- defaultExpression: {
229
- type: String,
230
- default: function() {
231
- return ''
232
- }
233
- },
234
- formRow: {
235
- type: Object,
236
- default: function() {
237
- return {}
238
- }
239
- },
240
- row: {
241
- type: Object,
242
- default: function() {
243
- return {}
244
- }
245
- },
246
- edit: {
247
- type: Boolean,
248
- default: function() {
249
- return false
250
- }
251
- },
252
- route: Object,
253
- placeholder: {
254
- // 提示信息
255
- type: String
256
- },
257
- api: {
258
- // api接口
259
- type: String
260
- },
261
- field: {
262
- type: String
263
- },
264
- pageSize: {
265
- // 分页数量,默认不分页
266
- type: Number,
267
- default: () => {
268
- return 0
269
- }
270
- },
271
- columns: {
272
- // 列集合
273
- type: Array,
274
- default: () => {
275
- return []
276
- }
277
- },
278
- isOld: {
279
- // 列集合
280
- type: Boolean,
281
- default: () => {
282
- return false
283
- }
284
- },
285
- exps: {
286
- // 条件
287
- type: Array,
288
- default: () => {
289
- return []
290
- }
291
- },
292
- value: {
293
- type: String,
294
- default: function() {
295
- return ''
296
- }
297
- },
298
- optBtns: {
299
- // 操作按钮
300
- type: Array,
301
- default: () => {
302
- return []
303
- }
304
- },
305
- gridTable: {
306
- // 操作按钮
307
- type: Object,
308
- default: () => {
309
- return null
310
- }
311
- },
312
- immediate: {
313
- type: Boolean,
314
- default: true
315
- },
316
- isLocalData: {
317
- type: Boolean,
318
- default: false
319
- },
320
- tooltip: {
321
- type: String,
322
- default: function() {
323
- return ''
324
- }
325
- }
326
- },
327
- watch: {},
328
- computed: {
329
- currentValue: {
330
- // 动态计算currentValue的值
331
- get: function() {
332
- return this.value // 将props中的value赋值给currentValue
333
- },
334
- set: function(val) {
335
- this.$emit('input', val) // 通过$emit触发父组件
336
- }
337
- }
338
- },
339
- created() {
340
- // if (this.popupAddName && !this.$options.components[this.popupAddName]) {
341
- // // const tempRequire = require('@/views' + this.popupAddPath + '.vue').default
342
- // // this.$options.components[this.popupAddName] = tempRequire
343
- // this.$options.components[this.popupAddName] = () =>
344
- // import('@/views' + this.popupAddPath + '.vue')
345
- // }
346
- this.gridPagerConfig.pageSize = this.pageSize
347
-
348
- this.internalColumns.push({
349
- type: 'seq',
350
- fixed: 'left',
351
- width: 50
352
- })
353
-
354
- if (this.isMultiSelect === true) {
355
- this.internalColumns.push({
356
- type: 'checkbox',
357
- fixed: 'left',
358
- width: 40
359
- })
360
- }
361
-
362
- for (let i = 0; i < this.columns.length; i++) {
363
- this.fetchFields = this.fetchFields + this.columns[i].field + ','
364
- this.columns[i]['params'] = {
365
- dataSource: []
366
- }
367
- if (this.columns[i].dataSource) {
368
- this.columns[i]['params'].dataSource = this.columns[i].dataSource
369
- }
370
- if (!this.columns[i].width) {
371
- this.columns[i]['width'] = 100
372
- }
373
- if (this.columns[i].isCheckbox === true) {
374
- this.columns[i]['type'] = 'checkbox'
375
- // colInfo['field'] = 'matCode'
376
- }
377
- // if(this.columns[i].formatter){
378
- // this.columns[i].formatter=
379
-
380
- // }
381
- this.internalColumns.push(this.columns[i])
382
- if (this.columns[i].filter === true) {
383
- this.filterCols.push(this.columns[i])
384
- }
385
- }
386
- },
387
- methods: {
388
- gridRowStyle(scope) {
389
- if (scope.row.sysRepeat === true) {
390
- return 'row--pending'
391
- }
392
- // if(scope.row.)
393
- },
394
- clearInputValue() {
395
- if (this.isInputChanged === true) {
396
- this.setLinkValue(null, this.row)
397
- this.$emit('selectChanged', null)
398
- }
399
- },
400
- routeLinkClick() {
401
- //首先需要判断是否有权限
402
- // let treeModule = XEUtils.findTree(
403
- // this.$store.getters.addRouters,
404
- // item => item.name === this.route.name
405
- // )
406
- // if (!treeModule) {
407
- // this.$antwarning('没有权限')
408
- // return
409
- // }
410
- this.$router.pushRoute({
411
- name: this.route.name,
412
- query: { id: this.row[this.route.field] }
413
- })
414
- },
415
- /**
416
- * 输入框改变事件
417
- */
418
- inputChangeEvent(event) {
419
- this.isInputChanged = true
420
- if (event.type === 'click' && event.pointerType === 'mouse') {
421
- //点击了清空按钮
422
- this.$nextTick(() => {
423
- this.clearInputValue()
424
- this.inputClickEvent(null)
425
- })
426
- }
427
- },
428
- inputBlurEvent(event) {},
429
- /**
430
- * 输入框获取焦点事件
431
- */
432
- inputFocusEvent(event) {
433
- event.currentTarget.select()
434
- // this.$refs.pulldownRef.showPanel()
435
- // this.searchData()
436
- },
437
- /**
438
- * Tab键隐藏面板
439
- */
440
- inputKeydownEvent(event) {
441
- if (event.keyCode === 9) {
442
- //tab事件
443
- this.$refs.pulldownRef.hidePanel()
444
- this.clearInputValue()
445
- }
446
- },
447
- inputClickEvent(event) {
448
- if (this.$refs.pulldownRef.isPanelVisible() === false) {
449
- this.$refs.pulldownRef.showPanel()
450
- this.searchData()
451
- } else {
452
- this.$refs.pulldownRef.hidePanel()
453
- }
454
- },
455
- /**
456
- * 输入库输入事件
457
- */
458
- inputKeyupEvent(event) {
459
- //好像ok
460
- if (!this.immediate && event.keyCode !== 13) {
461
- console.debug('davistest')
462
- } else {
463
- if (this.inputTimeout) {
464
- clearTimeout(this.inputTimeout)
465
- }
466
- let vm = this
467
- this.inputTimeout = setTimeout(() => {
468
- //判断面板是否打开
469
- if (vm.$refs.pulldownRef.isPanelVisible() === false) {
470
- vm.$refs.pulldownRef.showPanel()
471
- }
472
- vm.searchData()
473
- }, 500)
474
- }
475
- },
476
- /**
477
- * 网格列选中事件
478
- */
479
- gridCellClick({ row, column }) {
480
- if (row.sysRepeat === true) {
481
- return
482
- }
483
- if (column.type === 'seq' || column.type === 'checkbox') {
484
- return
485
- }
486
- this.isInputChanged = false
487
- this.setLinkValue(row, this.row)
488
- this.$emit('selectChanged', row)
489
- this.$refs.pulldownRef.hidePanel()
490
- },
491
- setLinkValue(pulldownRow, oriRow) {
492
- for (let i = 0; i < this.internalColumns.length; i++) {
493
- if (this.internalColumns[i].linkField) {
494
- let tempLinkFields = this.internalColumns[i].linkField.split('.')
495
- let tempRow = oriRow
496
- // for(let j=0;j<tempLinkFields.length;j++){
497
- // let tempField = tempLinkFields[j]
498
- // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
499
- // if (!(tempField in tempRow)) {
500
- // this.$antwarning(
501
- // '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
502
- // )
503
- // break
504
- // }
505
- // if(j===tempLinkFields.length-1){
506
- // if (pulldownRow === null) {
507
- // if (this.internalColumns[i].nullClear === false) {
508
- // //是否空值清除数据,用于可选可输入的控件
509
- // continue
510
- // }
511
- // this.$set(tempRow, tempField, null)
512
- // } else {
513
- // this.$set(
514
- // tempRow,
515
- // tempField,
516
- // this.getLinkValue(tempField, pulldownRow)
517
- // )
518
- // }
519
- // }else{
520
- // tempRow = tempRow[tempField]
521
- // }
522
- // }
523
-
524
- //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
525
- if (!(this.internalColumns[i].linkField in oriRow)) {
526
- this.$antwarning(
527
- '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
528
- )
529
- continue
530
- }
531
- if (pulldownRow === null) {
532
- if (this.internalColumns[i].nullClear === false) {
533
- //是否空值清楚数据,用于可选可输入的控件
534
- continue
535
- }
536
- this.$set(oriRow, this.internalColumns[i].linkField, null)
537
- } else {
538
- this.$set(
539
- oriRow,
540
- this.internalColumns[i].linkField,
541
- this.getLinkValue(this.internalColumns[i].field, pulldownRow)
542
- )
543
- }
544
- }
545
- }
546
- },
547
- getLinkValue(field, row) {
548
- let linkField = field.split('.')
549
- if (linkField.length > 1) {
550
- let fieldValue = row
551
- for (let i = 0; i < linkField.length; i++) {
552
- if (
553
- fieldValue[linkField[i]] === undefined ||
554
- fieldValue[linkField[i]] === null
555
- ) {
556
- return null
557
- }
558
- fieldValue = fieldValue[linkField[i]]
559
- }
560
- return fieldValue
561
- }
562
- return row[field]
563
- },
564
- /**
565
- * 左下角按钮点击事件
566
- */
567
- pagerBtnClick(btn) {
568
- this.$refs.pupupAddView.show()
569
- // this.$emit('pulldownBtnClick', btn)
570
- this.$refs.pulldownRef.hidePanel()
571
- },
572
- /**
573
- * 确认多选
574
- */
575
- multiSelectConfirm() {
576
- this.isInputChanged = false
577
- this.$emit(
578
- 'confirmMultiSelect',
579
- this,
580
- this.$refs.pupupGridView.getCheckboxRecords(true)
581
- )
582
- this.$refs.pulldownRef.hidePanel()
583
- },
584
- popupSaveAfter(pupupAddRowInfo) {
585
- let postData = {
586
- fields: null,
587
- begin: 1,
588
- size: 1,
589
- expression: {},
590
- sort: ''
591
- }
592
- let tempKeyExp = XEUtils.find(
593
- this.internalColumns,
594
- item => item.isKey === true
595
- )
596
- postData.expression = {
597
- operator: 'and',
598
- expressions: [
599
- {
600
- operator: 'and',
601
- expressions: [
602
- {
603
- field: tempKeyExp.field,
604
- operator: 'EQ',
605
- value: pupupAddRowInfo['id']
606
- }
607
- ]
608
- }
609
- ]
610
- }
611
- let vm = this
612
- let tempApi = this.getPostApi(postData)
613
- request({
614
- url: tempApi,
615
- method: 'post',
616
- data: postData
617
- })
618
- .then(responseData => {
619
- if (responseData.content.length > 0) {
620
- vm.setLinkValue(responseData.content[0], vm.row)
621
- vm.$emit('selectChanged', responseData.content[0])
622
- }
623
- })
624
- .catch(error => {
625
- console.error(error)
626
- })
627
- .finally(() => {})
628
- },
629
- /**
630
- * 分页改变事件
631
- */
632
- pageChangeEvent({ currentPage, pageSize }) {
633
- this.gridPagerConfig.currentPage = currentPage
634
- this.gridPagerConfig.pageSize = pageSize
635
- this.searchData()
636
- },
637
- /**
638
- * 面板隐藏事件
639
- */
640
- pullDownHideEvent({ $event }) {
641
- this.clearInputValue()
642
- },
643
- /**
644
- * 查询数据
645
- */
646
- searchData() {
647
- if (this.isLocalData === true) {
648
- let tempSearch = {
649
- value: this.currentValue,
650
- dataSource: []
651
- }
652
- this.$emit('preSearch', tempSearch)
653
- this.searchRows = tempSearch.dataSource
654
- this.gridPagerConfig.total = tempSearch.dataSource.length
655
- return
656
- }
657
-
658
- let tempExp = {
659
- operator: 'or',
660
- expressions: []
661
- }
662
- if (this.isOld === true) {
663
- tempExp = ''
664
- }
665
- if (this.currentValue) {
666
- for (let i = 0; i < this.filterCols.length; i++) {
667
- if (this.isOld === true) {
668
- tempExp =
669
- tempExp +
670
- this.filterCols[i].field +
671
- '.contains("' +
672
- this.currentValue +
673
- '")'
674
- if (i < this.filterCols.length - 1) {
675
- tempExp = tempExp + ' or '
676
- }
677
- } else {
678
- if (this.filterCols[i].controlType == 'number') {
679
- tempExp.expressions.push({
680
- field: this.filterCols[i].field,
681
- operator: 'EQ',
682
- value: Number(this.currentValue)
683
- })
684
- } else {
685
- tempExp.expressions.push({
686
- field: this.filterCols[i].field,
687
- operator: 'CO',
688
- value: this.currentValue
689
- })
690
- }
691
- }
692
- }
693
- }
694
- if (this.isOld === true && tempExp.length > 0) {
695
- tempExp = '(' + tempExp + ')'
696
- }
697
-
698
- if (this.defaultExpression) {
699
- let tempDefault = replaceParamString(
700
- this.defaultExpression,
701
- this.formRow,
702
- this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
703
- )
704
-
705
- if (tempExp) {
706
- tempExp = tempExp + ' and (' + tempDefault + ')'
707
- } else {
708
- tempExp = tempDefault
709
- }
710
- }
711
-
712
- let postExpression = {
713
- field: this.field,
714
- expression: tempExp,
715
- extendParams: {}
716
- }
717
- let repeatRowInfo = {
718
- field: '',
719
- values: []
720
- }
721
- //查询之前从外部组件构造其他的条件
722
- this.$emit('preSearch', postExpression, repeatRowInfo)
723
- let postData = {
724
- fields: this.fetchFields,
725
- begin:
726
- (this.gridPagerConfig.currentPage - 1) *
727
- this.gridPagerConfig.pageSize +
728
- 1,
729
- size: this.gridPagerConfig.pageSize,
730
- expression: postExpression.expression,
731
- sort: '',
732
- extendParams: postExpression.extendParams
733
- }
734
-
735
- let tempApi = this.getPostApi(postData)
736
-
737
- // let tempApi = this.api
738
- // if (this.api.indexOf('?') > 0) {
739
- // tempApi = this.api.substring(0, this.api.indexOf('?'))
740
- // let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
741
- // tempExtenParams = replaceParam(tempExtenParams, this.formRow)
742
- // let tempSplitParams = tempExtenParams.split('&')
743
- // for (let i = 0; i < tempSplitParams.length; i++) {
744
- // let tempSplitValue = tempSplitParams[i].split('=')
745
- // this.$set(
746
- // postData.extendParams,
747
- // tempSplitValue[0],
748
- // tempSplitValue[1]
749
- // )
750
- // }
751
- // }
752
- let vm = this
753
- vm.gridLoading = true
754
- request({
755
- url: tempApi,
756
- method: 'post',
757
- data: postData
758
- })
759
- .then(responseData => {
760
- if (vm.isOld === true) {
761
- vm.searchRows = responseData.data
762
- vm.gridPagerConfig.total = responseData.extData.totalRows
763
- } else {
764
- vm.searchRows = responseData.content
765
- vm.gridPagerConfig.total = responseData.otherContent.totalRows
766
- }
767
- if (repeatRowInfo.field) {
768
- //设置重复值
769
- XEUtils.arrayEach(vm.searchRows, item => {
770
- if (
771
- XEUtils.arrayIndexOf(
772
- repeatRowInfo.values,
773
- item[repeatRowInfo.field]
774
- ) > -1
775
- ) {
776
- item['sysRepeat'] = true
777
- } else {
778
- item['sysRepeat'] = false
779
- }
780
- })
781
- }
782
- })
783
- .catch(error => {
784
- console.error(error)
785
- })
786
- .finally(() => {
787
- vm.gridLoading = false
788
- })
789
- },
790
- getPostApi(postData) {
791
- let tempApi = this.api
792
- if (this.api.indexOf('?') > 0) {
793
- tempApi = this.api.substring(0, this.api.indexOf('?'))
794
- let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
795
- tempExtenParams = replaceParam(tempExtenParams, this.formRow)
796
- let tempSplitParams = tempExtenParams.split('&')
797
- for (let i = 0; i < tempSplitParams.length; i++) {
798
- let tempSplitValue = tempSplitParams[i].split('=')
799
- this.$set(
800
- postData.extendParams,
801
- tempSplitValue[0],
802
- tempSplitValue[1]
803
- )
804
- }
805
- }
806
- return tempApi
807
- }
808
- }
809
- }
810
- </script>
811
-
812
- <style lang="scss" scoped>
813
- .pulldown-grid {
814
- min-width: 600px;
815
- width: auto;
816
- height: 350px;
817
- background-color: #fff;
818
- box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
819
- }
820
-
821
- .d-grid-control {
822
- width: 100%;
823
- height: 30px;
824
- }
825
- </style>
826
-
827
-
828
- <style lang="less">
829
- @import '../../styles/default.less';
1
+ <template>
2
+ <div class="d-control-container">
3
+ <div
4
+ class="d-control-label"
5
+ v-if="showLabel === true"
6
+ :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
7
+ >
8
+ {{ label
9
+ }}
10
+ <span v-if="rules && rules['required']" class="d-control-label-required"
11
+ >*</span
12
+ >
13
+ <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
14
+ <img src="../../styles/icon/help.png" alt="" style="width: 14px">
15
+ </Tooltip>
16
+ </div>
17
+ <div
18
+ :class="{
19
+ 'd-control': showLabel === true,
20
+ 'd-grid-control': showLabel === false
21
+ }"
22
+ >
23
+ <VxePulldown
24
+ style="width:100%"
25
+ @hide-panel="pullDownHideEvent"
26
+ ref="pulldownRef"
27
+ v-if="edit === true"
28
+ transfer
29
+ >
30
+ <template #default>
31
+ <ValidationProvider :name="label" v-slot="v" :rules="rules">
32
+ <a-input
33
+ :size="'small'"
34
+ allow-clear
35
+ @change="inputChangeEvent"
36
+ class="inner-cell-control"
37
+ v-model="currentValue"
38
+ @click="inputClickEvent"
39
+ @focus="inputFocusEvent"
40
+ @blur="inputBlurEvent"
41
+ @keydown="inputKeydownEvent"
42
+ @keyup="inputKeyupEvent"
43
+ :class="{ 'd-error-input': v.errors.length > 0 }"
44
+ ></a-input>
45
+ <div class="d-error-msg">
46
+ {{ v.errors[0] }}
47
+ </div>
48
+ </ValidationProvider>
49
+ </template>
50
+ <template #dropdown>
51
+ <div class="pulldown-grid interceptor-class">
52
+ <vxe-grid
53
+ size="mini"
54
+ border
55
+ :row-class-name="gridRowStyle"
56
+ highlight-current-row
57
+ :keyboard-config="{ isArrow: true }"
58
+ highlight-hover-row
59
+ auto-resize
60
+ resizable
61
+ :loading="gridLoading"
62
+ height="auto"
63
+ ref="pupupGridView"
64
+ :data="searchRows"
65
+ @cell-click="gridCellClick"
66
+ :columns="internalColumns"
67
+ >
68
+ <!-- :pager-config="gridPagerConfig" -->
69
+ <!-- @page-change="pageChangeEvent" -->
70
+ <template #matCode_header="{column}">
71
+ <div class="first-col">
72
+ <div class="first-col-top">
73
+ {{ column.title }}
74
+ </div>
75
+ <div class="first-col-bottom">
76
+ <input style="width:100%" />
77
+ </div>
78
+ </div>
79
+ </template>
80
+ <template #pager>
81
+ <a-row>
82
+ <a-col :span="8">
83
+ <a-button
84
+ v-if="isMultiSelect === true"
85
+ type="primary"
86
+ size="small"
87
+ style="margin: 5px"
88
+ @click="multiSelectConfirm"
89
+ >
90
+ 确认选择
91
+ </a-button>
92
+ <a-button
93
+ v-if="popupAddName"
94
+ type="primary"
95
+ size="small"
96
+ style="margin: 5px"
97
+ @click="pagerBtnClick(btn)"
98
+ >
99
+ 新增
100
+ </a-button>
101
+
102
+ <template v-if="optBtns.length > 0">
103
+ <a-button
104
+ v-for="btn in optBtns"
105
+ :key="btn.field"
106
+ type="primary"
107
+ size="small"
108
+ style="margin: 5px"
109
+ @click="pagerBtnClick(btn)"
110
+ >
111
+ {{ btn.name }}
112
+ </a-button>
113
+ </template>
114
+ </a-col>
115
+ <a-col :span="16">
116
+ <vxe-pager
117
+ align="right"
118
+ size="mini"
119
+ :current-page.sync="gridPagerConfig.currentPage"
120
+ :page-size.sync="gridPagerConfig.pageSize"
121
+ :total="gridPagerConfig.total"
122
+ @page-change="pageChangeEvent"
123
+ >
124
+ </vxe-pager>
125
+ </a-col>
126
+ </a-row>
127
+ </template>
128
+ </vxe-grid>
129
+ </div>
130
+ </template>
131
+ </VxePulldown>
132
+ <span v-if="edit === false">
133
+ <a v-if="route" @click="routeLinkClick">{{ currentValue }}</a>
134
+ <span v-else> {{ currentValue }}</span>
135
+ </span>
136
+ </div>
137
+
138
+ <keep-alive>
139
+ <div
140
+ :is="popupAddName"
141
+ ref="pupupAddView"
142
+ @popupSaveAfter="popupSaveAfter"
143
+ ></div>
144
+ </keep-alive>
145
+ </div>
146
+ </template>
147
+
148
+ <script>
149
+ import XEUtils from 'xe-utils'
150
+ import { sysRowState, sysFormState, controlType } from '../../utils/enum'
151
+ import { replaceParamString, replaceParam } from '../../utils/common'
152
+ import request from '../../utils/request'
153
+ import { Input,Button,Row,Col } from 'ant-design-vue'
154
+ import { ValidationProvider } from 'vee-validate'
155
+ import {Pulldown} from 'vxe-table'
156
+ import { Tooltip } from 'ant-design-vue'
157
+ export default {
158
+ name: 'BasePulldown',
159
+ components:{
160
+ 'a-input':Input,
161
+ 'a-button':Button,
162
+ 'a-row':Row,
163
+ 'a-col':Col,
164
+ 'VxePulldown':Pulldown,
165
+ ValidationProvider,
166
+ Tooltip,
167
+
168
+ },
169
+ data() {
170
+ return {
171
+ fetchFields: '',
172
+ internalColumns: [],
173
+ isInputChanged: false,
174
+ inputTimeout: null,
175
+ searchRows: [],
176
+ filterCols: [],
177
+ gridLoading: false,
178
+ gridPagerConfig: {
179
+ total: 0,
180
+ currentPage: 1,
181
+ pageSize: 10
182
+ }
183
+ }
184
+ },
185
+ props: {
186
+ labelWidth: {
187
+ type: Number,
188
+ default: function() {
189
+ return 0
190
+ }
191
+ },
192
+ isMultiSelect: {
193
+ type: Boolean,
194
+ default: function() {
195
+ return false
196
+ }
197
+ },
198
+ popupAddName: {
199
+ type: String,
200
+ default: function() {
201
+ return null
202
+ }
203
+ },
204
+ popupAddPath: {
205
+ type: String,
206
+ default: function() {
207
+ return null
208
+ }
209
+ },
210
+ rules: {
211
+ type: Object,
212
+ default: function() {
213
+ return null
214
+ }
215
+ },
216
+ showLabel: {
217
+ type: Boolean,
218
+ default: function() {
219
+ return true
220
+ }
221
+ },
222
+ label: {
223
+ type: String,
224
+ default: function() {
225
+ return ''
226
+ }
227
+ },
228
+ defaultExpression: {
229
+ type: String,
230
+ default: function() {
231
+ return ''
232
+ }
233
+ },
234
+ formRow: {
235
+ type: Object,
236
+ default: function() {
237
+ return {}
238
+ }
239
+ },
240
+ row: {
241
+ type: Object,
242
+ default: function() {
243
+ return {}
244
+ }
245
+ },
246
+ edit: {
247
+ type: Boolean,
248
+ default: function() {
249
+ return false
250
+ }
251
+ },
252
+ route: Object,
253
+ placeholder: {
254
+ // 提示信息
255
+ type: String
256
+ },
257
+ api: {
258
+ // api接口
259
+ type: String
260
+ },
261
+ field: {
262
+ type: String
263
+ },
264
+ pageSize: {
265
+ // 分页数量,默认不分页
266
+ type: Number,
267
+ default: () => {
268
+ return 0
269
+ }
270
+ },
271
+ columns: {
272
+ // 列集合
273
+ type: Array,
274
+ default: () => {
275
+ return []
276
+ }
277
+ },
278
+ isOld: {
279
+ // 列集合
280
+ type: Boolean,
281
+ default: () => {
282
+ return false
283
+ }
284
+ },
285
+ exps: {
286
+ // 条件
287
+ type: Array,
288
+ default: () => {
289
+ return []
290
+ }
291
+ },
292
+ value: {
293
+ type: String,
294
+ default: function() {
295
+ return ''
296
+ }
297
+ },
298
+ optBtns: {
299
+ // 操作按钮
300
+ type: Array,
301
+ default: () => {
302
+ return []
303
+ }
304
+ },
305
+ gridTable: {
306
+ // 操作按钮
307
+ type: Object,
308
+ default: () => {
309
+ return null
310
+ }
311
+ },
312
+ immediate: {
313
+ type: Boolean,
314
+ default: true
315
+ },
316
+ isLocalData: {
317
+ type: Boolean,
318
+ default: false
319
+ },
320
+ tooltip: {
321
+ type: String,
322
+ default: function() {
323
+ return ''
324
+ }
325
+ }
326
+ },
327
+ watch: {},
328
+ computed: {
329
+ currentValue: {
330
+ // 动态计算currentValue的值
331
+ get: function() {
332
+ return this.value // 将props中的value赋值给currentValue
333
+ },
334
+ set: function(val) {
335
+ this.$emit('input', val) // 通过$emit触发父组件
336
+ }
337
+ }
338
+ },
339
+ created() {
340
+ // if (this.popupAddName && !this.$options.components[this.popupAddName]) {
341
+ // // const tempRequire = require('@/views' + this.popupAddPath + '.vue').default
342
+ // // this.$options.components[this.popupAddName] = tempRequire
343
+ // this.$options.components[this.popupAddName] = () =>
344
+ // import('@/views' + this.popupAddPath + '.vue')
345
+ // }
346
+ this.gridPagerConfig.pageSize = this.pageSize
347
+
348
+ this.internalColumns.push({
349
+ type: 'seq',
350
+ fixed: 'left',
351
+ width: 50
352
+ })
353
+
354
+ if (this.isMultiSelect === true) {
355
+ this.internalColumns.push({
356
+ type: 'checkbox',
357
+ fixed: 'left',
358
+ width: 40
359
+ })
360
+ }
361
+
362
+ for (let i = 0; i < this.columns.length; i++) {
363
+ this.fetchFields = this.fetchFields + this.columns[i].field + ','
364
+ this.columns[i]['params'] = {
365
+ dataSource: []
366
+ }
367
+ if (this.columns[i].dataSource) {
368
+ this.columns[i]['params'].dataSource = this.columns[i].dataSource
369
+ }
370
+ if (!this.columns[i].width) {
371
+ this.columns[i]['width'] = 100
372
+ }
373
+ if (this.columns[i].isCheckbox === true) {
374
+ this.columns[i]['type'] = 'checkbox'
375
+ // colInfo['field'] = 'matCode'
376
+ }
377
+ // if(this.columns[i].formatter){
378
+ // this.columns[i].formatter=
379
+
380
+ // }
381
+ this.internalColumns.push(this.columns[i])
382
+ if (this.columns[i].filter === true) {
383
+ this.filterCols.push(this.columns[i])
384
+ }
385
+ }
386
+ },
387
+ methods: {
388
+ gridRowStyle(scope) {
389
+ if (scope.row.sysRepeat === true) {
390
+ return 'row--pending'
391
+ }
392
+ // if(scope.row.)
393
+ },
394
+ clearInputValue() {
395
+ if (this.isInputChanged === true) {
396
+ this.setLinkValue(null, this.row)
397
+ this.$emit('selectChanged', null)
398
+ }
399
+ },
400
+ routeLinkClick() {
401
+ //首先需要判断是否有权限
402
+ // let treeModule = XEUtils.findTree(
403
+ // this.$store.getters.addRouters,
404
+ // item => item.name === this.route.name
405
+ // )
406
+ // if (!treeModule) {
407
+ // this.$antwarning('没有权限')
408
+ // return
409
+ // }
410
+ this.$router.pushRoute({
411
+ name: this.route.name,
412
+ query: { id: this.row[this.route.field] }
413
+ })
414
+ },
415
+ /**
416
+ * 输入框改变事件
417
+ */
418
+ inputChangeEvent(event) {
419
+ this.isInputChanged = true
420
+ if (event.type === 'click' && event.pointerType === 'mouse') {
421
+ //点击了清空按钮
422
+ this.$nextTick(() => {
423
+ this.clearInputValue()
424
+ this.inputClickEvent(null)
425
+ })
426
+ }
427
+ },
428
+ inputBlurEvent(event) {},
429
+ /**
430
+ * 输入框获取焦点事件
431
+ */
432
+ inputFocusEvent(event) {
433
+ event.currentTarget.select()
434
+ // this.$refs.pulldownRef.showPanel()
435
+ // this.searchData()
436
+ },
437
+ /**
438
+ * Tab键隐藏面板
439
+ */
440
+ inputKeydownEvent(event) {
441
+ if (event.keyCode === 9) {
442
+ //tab事件
443
+ this.$refs.pulldownRef.hidePanel()
444
+ this.clearInputValue()
445
+ }
446
+ },
447
+ inputClickEvent(event) {
448
+ if (this.$refs.pulldownRef.isPanelVisible() === false) {
449
+ this.$refs.pulldownRef.showPanel()
450
+ this.searchData()
451
+ } else {
452
+ this.$refs.pulldownRef.hidePanel()
453
+ }
454
+ },
455
+ /**
456
+ * 输入库输入事件
457
+ */
458
+ inputKeyupEvent(event) {
459
+ //好像ok
460
+ if (!this.immediate && event.keyCode !== 13) {
461
+ console.debug('davistest')
462
+ } else {
463
+ if (this.inputTimeout) {
464
+ clearTimeout(this.inputTimeout)
465
+ }
466
+ let vm = this
467
+ this.inputTimeout = setTimeout(() => {
468
+ //判断面板是否打开
469
+ if (vm.$refs.pulldownRef.isPanelVisible() === false) {
470
+ vm.$refs.pulldownRef.showPanel()
471
+ }
472
+ vm.searchData()
473
+ }, 500)
474
+ }
475
+ },
476
+ /**
477
+ * 网格列选中事件
478
+ */
479
+ gridCellClick({ row, column }) {
480
+ if (row.sysRepeat === true) {
481
+ return
482
+ }
483
+ if (column.type === 'seq' || column.type === 'checkbox') {
484
+ return
485
+ }
486
+ this.isInputChanged = false
487
+ this.setLinkValue(row, this.row)
488
+ this.$emit('selectChanged', row)
489
+ this.$refs.pulldownRef.hidePanel()
490
+ },
491
+ setLinkValue(pulldownRow, oriRow) {
492
+ for (let i = 0; i < this.internalColumns.length; i++) {
493
+ if (this.internalColumns[i].linkField) {
494
+ let tempLinkFields = this.internalColumns[i].linkField.split('.')
495
+ let tempRow = oriRow
496
+ // for(let j=0;j<tempLinkFields.length;j++){
497
+ // let tempField = tempLinkFields[j]
498
+ // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
499
+ // if (!(tempField in tempRow)) {
500
+ // this.$antwarning(
501
+ // '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
502
+ // )
503
+ // break
504
+ // }
505
+ // if(j===tempLinkFields.length-1){
506
+ // if (pulldownRow === null) {
507
+ // if (this.internalColumns[i].nullClear === false) {
508
+ // //是否空值清除数据,用于可选可输入的控件
509
+ // continue
510
+ // }
511
+ // this.$set(tempRow, tempField, null)
512
+ // } else {
513
+ // this.$set(
514
+ // tempRow,
515
+ // tempField,
516
+ // this.getLinkValue(tempField, pulldownRow)
517
+ // )
518
+ // }
519
+ // }else{
520
+ // tempRow = tempRow[tempField]
521
+ // }
522
+ // }
523
+
524
+ //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
525
+ if (!(this.internalColumns[i].linkField in oriRow)) {
526
+ this.$antwarning(
527
+ '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
528
+ )
529
+ continue
530
+ }
531
+ if (pulldownRow === null) {
532
+ if (this.internalColumns[i].nullClear === false) {
533
+ //是否空值清楚数据,用于可选可输入的控件
534
+ continue
535
+ }
536
+ this.$set(oriRow, this.internalColumns[i].linkField, null)
537
+ } else {
538
+ this.$set(
539
+ oriRow,
540
+ this.internalColumns[i].linkField,
541
+ this.getLinkValue(this.internalColumns[i].field, pulldownRow)
542
+ )
543
+ }
544
+ }
545
+ }
546
+ },
547
+ getLinkValue(field, row) {
548
+ let linkField = field.split('.')
549
+ if (linkField.length > 1) {
550
+ let fieldValue = row
551
+ for (let i = 0; i < linkField.length; i++) {
552
+ if (
553
+ fieldValue[linkField[i]] === undefined ||
554
+ fieldValue[linkField[i]] === null
555
+ ) {
556
+ return null
557
+ }
558
+ fieldValue = fieldValue[linkField[i]]
559
+ }
560
+ return fieldValue
561
+ }
562
+ return row[field]
563
+ },
564
+ /**
565
+ * 左下角按钮点击事件
566
+ */
567
+ pagerBtnClick(btn) {
568
+ this.$refs.pupupAddView.show()
569
+ // this.$emit('pulldownBtnClick', btn)
570
+ this.$refs.pulldownRef.hidePanel()
571
+ },
572
+ /**
573
+ * 确认多选
574
+ */
575
+ multiSelectConfirm() {
576
+ this.isInputChanged = false
577
+ this.$emit(
578
+ 'confirmMultiSelect',
579
+ this,
580
+ this.$refs.pupupGridView.getCheckboxRecords(true)
581
+ )
582
+ this.$refs.pulldownRef.hidePanel()
583
+ },
584
+ popupSaveAfter(pupupAddRowInfo) {
585
+ let postData = {
586
+ fields: null,
587
+ begin: 1,
588
+ size: 1,
589
+ expression: {},
590
+ sort: ''
591
+ }
592
+ let tempKeyExp = XEUtils.find(
593
+ this.internalColumns,
594
+ item => item.isKey === true
595
+ )
596
+ postData.expression = {
597
+ operator: 'and',
598
+ expressions: [
599
+ {
600
+ operator: 'and',
601
+ expressions: [
602
+ {
603
+ field: tempKeyExp.field,
604
+ operator: 'EQ',
605
+ value: pupupAddRowInfo['id']
606
+ }
607
+ ]
608
+ }
609
+ ]
610
+ }
611
+ let vm = this
612
+ let tempApi = this.getPostApi(postData)
613
+ request({
614
+ url: tempApi,
615
+ method: 'post',
616
+ data: postData
617
+ })
618
+ .then(responseData => {
619
+ if (responseData.content.length > 0) {
620
+ vm.setLinkValue(responseData.content[0], vm.row)
621
+ vm.$emit('selectChanged', responseData.content[0])
622
+ }
623
+ })
624
+ .catch(error => {
625
+ console.error(error)
626
+ })
627
+ .finally(() => {})
628
+ },
629
+ /**
630
+ * 分页改变事件
631
+ */
632
+ pageChangeEvent({ currentPage, pageSize }) {
633
+ this.gridPagerConfig.currentPage = currentPage
634
+ this.gridPagerConfig.pageSize = pageSize
635
+ this.searchData()
636
+ },
637
+ /**
638
+ * 面板隐藏事件
639
+ */
640
+ pullDownHideEvent({ $event }) {
641
+ this.clearInputValue()
642
+ },
643
+ /**
644
+ * 查询数据
645
+ */
646
+ searchData() {
647
+ if (this.isLocalData === true) {
648
+ let tempSearch = {
649
+ value: this.currentValue,
650
+ dataSource: []
651
+ }
652
+ this.$emit('preSearch', tempSearch)
653
+ this.searchRows = tempSearch.dataSource
654
+ this.gridPagerConfig.total = tempSearch.dataSource.length
655
+ return
656
+ }
657
+
658
+ let tempExp = {
659
+ operator: 'or',
660
+ expressions: []
661
+ }
662
+ if (this.isOld === true) {
663
+ tempExp = ''
664
+ }
665
+ if (this.currentValue) {
666
+ for (let i = 0; i < this.filterCols.length; i++) {
667
+ if (this.isOld === true) {
668
+ tempExp =
669
+ tempExp +
670
+ this.filterCols[i].field +
671
+ '.contains("' +
672
+ this.currentValue +
673
+ '")'
674
+ if (i < this.filterCols.length - 1) {
675
+ tempExp = tempExp + ' or '
676
+ }
677
+ } else {
678
+ if (this.filterCols[i].controlType == 'number') {
679
+ tempExp.expressions.push({
680
+ field: this.filterCols[i].field,
681
+ operator: 'EQ',
682
+ value: Number(this.currentValue)
683
+ })
684
+ } else {
685
+ tempExp.expressions.push({
686
+ field: this.filterCols[i].field,
687
+ operator: 'CO',
688
+ value: this.currentValue
689
+ })
690
+ }
691
+ }
692
+ }
693
+ }
694
+ if (this.isOld === true && tempExp.length > 0) {
695
+ tempExp = '(' + tempExp + ')'
696
+ }
697
+
698
+ if (this.defaultExpression) {
699
+ let tempDefault = replaceParamString(
700
+ this.defaultExpression,
701
+ this.formRow,
702
+ this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
703
+ )
704
+
705
+ if (tempExp) {
706
+ tempExp = tempExp + ' and (' + tempDefault + ')'
707
+ } else {
708
+ tempExp = tempDefault
709
+ }
710
+ }
711
+
712
+ let postExpression = {
713
+ field: this.field,
714
+ expression: tempExp,
715
+ extendParams: {}
716
+ }
717
+ let repeatRowInfo = {
718
+ field: '',
719
+ values: []
720
+ }
721
+ //查询之前从外部组件构造其他的条件
722
+ this.$emit('preSearch', postExpression, repeatRowInfo)
723
+ let postData = {
724
+ fields: this.fetchFields,
725
+ begin:
726
+ (this.gridPagerConfig.currentPage - 1) *
727
+ this.gridPagerConfig.pageSize +
728
+ 1,
729
+ size: this.gridPagerConfig.pageSize,
730
+ expression: postExpression.expression,
731
+ sort: '',
732
+ extendParams: postExpression.extendParams
733
+ }
734
+
735
+ let tempApi = this.getPostApi(postData)
736
+
737
+ // let tempApi = this.api
738
+ // if (this.api.indexOf('?') > 0) {
739
+ // tempApi = this.api.substring(0, this.api.indexOf('?'))
740
+ // let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
741
+ // tempExtenParams = replaceParam(tempExtenParams, this.formRow)
742
+ // let tempSplitParams = tempExtenParams.split('&')
743
+ // for (let i = 0; i < tempSplitParams.length; i++) {
744
+ // let tempSplitValue = tempSplitParams[i].split('=')
745
+ // this.$set(
746
+ // postData.extendParams,
747
+ // tempSplitValue[0],
748
+ // tempSplitValue[1]
749
+ // )
750
+ // }
751
+ // }
752
+ let vm = this
753
+ vm.gridLoading = true
754
+ request({
755
+ url: tempApi,
756
+ method: 'post',
757
+ data: postData
758
+ })
759
+ .then(responseData => {
760
+ if (vm.isOld === true) {
761
+ vm.searchRows = responseData.data
762
+ vm.gridPagerConfig.total = responseData.extData.totalRows
763
+ } else {
764
+ vm.searchRows = responseData.content
765
+ vm.gridPagerConfig.total = responseData.otherContent.totalRows
766
+ }
767
+ if (repeatRowInfo.field) {
768
+ //设置重复值
769
+ XEUtils.arrayEach(vm.searchRows, item => {
770
+ if (
771
+ XEUtils.arrayIndexOf(
772
+ repeatRowInfo.values,
773
+ item[repeatRowInfo.field]
774
+ ) > -1
775
+ ) {
776
+ item['sysRepeat'] = true
777
+ } else {
778
+ item['sysRepeat'] = false
779
+ }
780
+ })
781
+ }
782
+ })
783
+ .catch(error => {
784
+ console.error(error)
785
+ })
786
+ .finally(() => {
787
+ vm.gridLoading = false
788
+ })
789
+ },
790
+ getPostApi(postData) {
791
+ let tempApi = this.api
792
+ if (this.api.indexOf('?') > 0) {
793
+ tempApi = this.api.substring(0, this.api.indexOf('?'))
794
+ let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
795
+ tempExtenParams = replaceParam(tempExtenParams, this.formRow)
796
+ let tempSplitParams = tempExtenParams.split('&')
797
+ for (let i = 0; i < tempSplitParams.length; i++) {
798
+ let tempSplitValue = tempSplitParams[i].split('=')
799
+ this.$set(
800
+ postData.extendParams,
801
+ tempSplitValue[0],
802
+ tempSplitValue[1]
803
+ )
804
+ }
805
+ }
806
+ return tempApi
807
+ }
808
+ }
809
+ }
810
+ </script>
811
+
812
+ <style lang="scss" scoped>
813
+ .pulldown-grid {
814
+ min-width: 600px;
815
+ width: auto;
816
+ height: 350px;
817
+ background-color: #fff;
818
+ box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
819
+ }
820
+
821
+ .d-grid-control {
822
+ width: 100%;
823
+ height: 30px;
824
+ }
825
+ </style>
826
+
827
+
828
+ <style lang="less">
829
+ @import '../../styles/default.less';
830
830
  </style>