doway-coms 1.1.52 → 1.1.55

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