doway-coms 1.7.5 → 1.7.6

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.
@@ -1,4 +1,4 @@
1
- <template>
1
+ <template>
2
2
  <div class="d-control-container">
3
3
  <div
4
4
  class="d-control-label"
@@ -196,30 +196,30 @@
196
196
  </template>
197
197
 
198
198
  <script>
199
- import XEUtils from "xe-utils";
200
- import { sysRowState, sysFormState, controlType } from "../../utils/enum";
201
- import { replaceParamString, replaceParam } from "../../utils/common";
202
- import request from "../../utils/request";
203
- import { Input, Button, Row, Col, Checkbox } from "ant-design-vue";
204
- import { ValidationProvider } from "vee-validate";
205
- import { Pulldown } from "vxe-table";
206
- import { Tooltip } from "ant-design-vue";
199
+ import XEUtils from 'xe-utils'
200
+ import { sysRowState, sysFormState, controlType } from '../../utils/enum'
201
+ import { replaceParamString, replaceParam } from '../../utils/common'
202
+ import request from '../../utils/request'
203
+ import { Input, Button, Row, Col, Checkbox } from 'ant-design-vue'
204
+ import { ValidationProvider } from 'vee-validate'
205
+ import { Pulldown } from 'vxe-table'
206
+ import { Tooltip } from 'ant-design-vue'
207
207
  export default {
208
- name: "BasePulldown",
208
+ name: 'BasePulldown',
209
209
  components: {
210
- "a-input": Input,
211
- "a-button": Button,
212
- "a-row": Row,
213
- "a-col": Col,
214
- "a-checkbox": Checkbox,
215
- "a-checkbox-group": Checkbox.Group,
210
+ 'a-input': Input,
211
+ 'a-button': Button,
212
+ 'a-row': Row,
213
+ 'a-col': Col,
214
+ 'a-checkbox': Checkbox,
215
+ 'a-checkbox-group': Checkbox.Group,
216
216
  VxePulldown: Pulldown,
217
217
  ValidationProvider,
218
218
  Tooltip,
219
219
  },
220
220
  data() {
221
221
  return {
222
- fetchFields: "",
222
+ fetchFields: '',
223
223
  internalColumns: [],
224
224
  isInputChanged: false,
225
225
  inputTimeout: null,
@@ -234,76 +234,76 @@ export default {
234
234
  sorts: [],
235
235
  defaultSort: [],
236
236
  filterExpression: {
237
- operator: "and",
237
+ operator: 'and',
238
238
  expressions: [],
239
239
  },
240
- };
240
+ }
241
241
  },
242
242
  props: {
243
243
  labelWidth: {
244
244
  type: Number,
245
245
  default: function () {
246
- return 0;
246
+ return 0
247
247
  },
248
248
  },
249
249
  isMultiSelect: {
250
250
  type: Boolean,
251
251
  default: function () {
252
- return false;
252
+ return false
253
253
  },
254
254
  },
255
255
  popupAddName: {
256
256
  type: String,
257
257
  default: function () {
258
- return null;
258
+ return null
259
259
  },
260
260
  },
261
261
  popupAddPath: {
262
262
  type: String,
263
263
  default: function () {
264
- return null;
264
+ return null
265
265
  },
266
266
  },
267
267
  rules: {
268
268
  type: Object,
269
269
  default: function () {
270
- return null;
270
+ return null
271
271
  },
272
272
  },
273
273
  showLabel: {
274
274
  type: Boolean,
275
275
  default: function () {
276
- return true;
276
+ return true
277
277
  },
278
278
  },
279
279
  label: {
280
280
  type: String,
281
281
  default: function () {
282
- return "";
282
+ return ''
283
283
  },
284
284
  },
285
285
  defaultExpression: {
286
286
  type: String,
287
287
  default: function () {
288
- return "";
288
+ return ''
289
289
  },
290
290
  },
291
291
  formRow: {
292
292
  type: Object,
293
293
  default: function () {
294
- return {};
294
+ return {}
295
295
  },
296
296
  },
297
297
  row: {
298
298
  type: Object,
299
299
  default: function () {
300
- return {};
300
+ return {}
301
301
  },
302
302
  },
303
303
  edit: {
304
304
  type: Boolean,
305
305
  default: function () {
306
- return false;
306
+ return false
307
307
  },
308
308
  },
309
309
  route: Object,
@@ -322,48 +322,48 @@ export default {
322
322
  // 分页数量,默认不分页
323
323
  type: Number,
324
324
  default: () => {
325
- return 0;
325
+ return 0
326
326
  },
327
327
  },
328
328
  columns: {
329
329
  // 列集合
330
330
  type: Array,
331
331
  default: () => {
332
- return [];
332
+ return []
333
333
  },
334
334
  },
335
335
  isOld: {
336
336
  // 列集合
337
337
  type: Boolean,
338
338
  default: () => {
339
- return false;
339
+ return false
340
340
  },
341
341
  },
342
342
  exps: {
343
343
  // 条件
344
344
  type: Array,
345
345
  default: () => {
346
- return [];
346
+ return []
347
347
  },
348
348
  },
349
349
  value: {
350
350
  type: String,
351
351
  default: function () {
352
- return "";
352
+ return ''
353
353
  },
354
354
  },
355
355
  optBtns: {
356
356
  // 操作按钮
357
357
  type: Array,
358
358
  default: () => {
359
- return [];
359
+ return []
360
360
  },
361
361
  },
362
362
  gridTable: {
363
363
  // 操作按钮
364
364
  type: Object,
365
365
  default: () => {
366
- return null;
366
+ return null
367
367
  },
368
368
  },
369
369
  immediate: {
@@ -377,13 +377,19 @@ export default {
377
377
  tooltip: {
378
378
  type: String,
379
379
  default: function () {
380
- return "";
380
+ return ''
381
381
  },
382
382
  },
383
383
  propTableData: {
384
384
  type: Array,
385
385
  default: function () {
386
- return [];
386
+ return []
387
+ },
388
+ },
389
+ contrasts: {
390
+ type: Array,
391
+ default: function () {
392
+ return []
387
393
  },
388
394
  },
389
395
  },
@@ -392,10 +398,10 @@ export default {
392
398
  currentValue: {
393
399
  // 动态计算currentValue的值
394
400
  get: function () {
395
- return this.value; // 将props中的value赋值给currentValue
401
+ return this.value // 将props中的value赋值给currentValue
396
402
  },
397
403
  set: function (val) {
398
- this.$emit("input", val); // 通过$emit触发父组件
404
+ this.$emit('input', val) // 通过$emit触发父组件
399
405
  },
400
406
  },
401
407
  },
@@ -406,69 +412,69 @@ export default {
406
412
  // this.$options.components[this.popupAddName] = () =>
407
413
  // import('@/views' + this.popupAddPath + '.vue')
408
414
  // }
409
- this.gridPagerConfig.pageSize = this.pageSize;
415
+ this.gridPagerConfig.pageSize = this.pageSize
410
416
 
411
417
  this.internalColumns.push({
412
- type: "seq",
413
- fixed: "left",
418
+ type: 'seq',
419
+ fixed: 'left',
414
420
  width: 50,
415
- });
421
+ })
416
422
 
417
423
  if (this.isMultiSelect === true) {
418
424
  this.internalColumns.push({
419
- type: "checkbox",
420
- fixed: "left",
425
+ type: 'checkbox',
426
+ fixed: 'left',
421
427
  width: 40,
422
- });
428
+ })
423
429
  }
424
430
 
425
431
  for (let i = 0; i < this.columns.length; i++) {
426
- this.fetchFields = this.fetchFields + this.columns[i].field + ",";
427
- this.columns[i]["params"] = {
432
+ this.fetchFields = this.fetchFields + this.columns[i].field + ','
433
+ this.columns[i]['params'] = {
428
434
  dataSource: [],
429
- };
435
+ }
430
436
  if (this.columns[i].dataSource) {
431
- this.columns[i]["params"].dataSource = this.columns[i].dataSource;
437
+ this.columns[i]['params'].dataSource = this.columns[i].dataSource
432
438
  }
433
439
  if (!this.columns[i].width) {
434
- this.columns[i]["width"] = 100;
440
+ this.columns[i]['width'] = 100
435
441
  }
436
442
  if (this.columns[i].isCheckbox === true) {
437
- this.columns[i]["type"] = "checkbox";
443
+ this.columns[i]['type'] = 'checkbox'
438
444
  }
439
445
  if (!this.columns[i].controlType) {
440
- this.columns[i].controlType = "text";
446
+ this.columns[i].controlType = 'text'
441
447
  }
442
448
  // 设置字段的过滤插槽
443
449
  if (this.columns[i].filter) {
444
- this.columns[i]["filterMultiple"] = false;
450
+ this.columns[i]['filterMultiple'] = false
445
451
 
446
452
  switch (this.columns[i].controlType) {
447
- case "checkbox":
448
- this.columns[i]["slots"] = {
453
+ case 'checkbox':
454
+ this.columns[i]['slots'] = {
449
455
  filter: `checkbox_filter`,
450
- };
451
- break;
452
- case "select":
453
- this.columns[i]["slots"] = {
456
+ }
457
+ break
458
+ case 'select':
459
+ this.columns[i]['slots'] = {
454
460
  filter: `select_filter`,
455
- };
456
- this.columns[i]["filters"] = [
461
+ }
462
+ this.columns[i]['filters'] = [
457
463
  {
458
464
  data: [],
459
465
  },
460
- ];
461
- break;
466
+ ]
467
+ break
462
468
  default:
463
- this.columns[i]["slots"] = {
469
+ this.columns[i]['slots'] = {
464
470
  filter: `text_filter`,
465
- };
466
- this.columns[i]["filters"] = [
471
+ }
472
+ this.columns[i]['filters'] = [
467
473
  {
468
- data: "",
474
+ data: '',
469
475
  },
470
- ];
471
- break;
476
+ ]
477
+ break
472
478
  }
473
479
  }
474
480
  // 默认排序
@@ -476,26 +482,26 @@ export default {
476
482
  this.defaultSort.push({
477
483
  field: this.columns[i].field,
478
484
  order: this.columns[i].defaultSort,
479
- });
480
- this.sorts.push([this.columns[i].field, this.columns[i].defaultSort]);
485
+ })
486
+ this.sorts.push([this.columns[i].field, this.columns[i].defaultSort])
481
487
  }
482
- this.internalColumns.push(this.columns[i]);
488
+ this.internalColumns.push(this.columns[i])
483
489
  if (this.columns[i].filter === true) {
484
- this.filterCols.push(this.columns[i]);
490
+ this.filterCols.push(this.columns[i])
485
491
  }
486
492
  }
487
493
  },
488
494
  methods: {
489
495
  gridRowStyle(scope) {
490
496
  if (scope.row.sysRepeat === true) {
491
- return "row--pending";
497
+ return 'row--pending'
492
498
  }
493
499
  // if(scope.row.)
494
500
  },
495
501
  clearInputValue() {
496
502
  if (this.isInputChanged === true) {
497
- this.setLinkValue(null, this.row);
498
- this.$emit("selectChanged", null);
503
+ this.setLinkValue(null, this.row)
504
+ this.$emit('selectChanged', null)
499
505
  }
500
506
  },
501
507
  routeLinkClick() {
@@ -511,19 +517,19 @@ export default {
511
517
  this.$router.pushRoute({
512
518
  name: this.route.name,
513
519
  query: { id: this.row[this.route.field] },
514
- });
520
+ })
515
521
  },
516
522
  /**
517
523
  * 输入框改变事件
518
524
  */
519
525
  inputChangeEvent(event) {
520
- this.isInputChanged = true;
521
- if (event.type === "click" && event.pointerType === "mouse") {
526
+ this.isInputChanged = true
527
+ if (event.type === 'click' && event.pointerType === 'mouse') {
522
528
  //点击了清空按钮
523
529
  this.$nextTick(() => {
524
- this.clearInputValue();
525
- this.inputClickEvent(null);
526
- });
530
+ this.clearInputValue()
531
+ this.inputClickEvent(null)
532
+ })
527
533
  }
528
534
  },
529
535
  inputBlurEvent(event) {},
@@ -531,7 +537,7 @@ export default {
531
537
  * 输入框获取焦点事件
532
538
  */
533
539
  inputFocusEvent(event) {
534
- event.currentTarget.select();
540
+ event.currentTarget.select()
535
541
  // this.$refs.pulldownRef.showPanel()
536
542
  // this.searchData()
537
543
  },
@@ -541,17 +547,17 @@ export default {
541
547
  inputKeydownEvent(event) {
542
548
  if (event.keyCode === 9) {
543
549
  //tab事件
544
- this.$refs.pulldownRef.hidePanel();
545
- this.clearInputValue();
550
+ this.$refs.pulldownRef.hidePanel()
551
+ this.clearInputValue()
546
552
  }
547
553
  },
548
554
  inputClickEvent(event) {
549
555
  if (this.$refs.pulldownRef.isPanelVisible() === false) {
550
- this.$refs.pulldownRef.showPanel();
551
- this.clearColumnFilter();
552
- this.searchData();
556
+ this.$refs.pulldownRef.showPanel()
557
+ this.clearColumnFilter()
558
+ this.searchData()
553
559
  } else {
554
- this.$refs.pulldownRef.hidePanel();
560
+ this.$refs.pulldownRef.hidePanel()
555
561
  // 点击输入框隐藏panel时清空输入框
556
562
  this.currentValue = ''
557
563
  }
@@ -562,19 +568,19 @@ export default {
562
568
  inputKeyupEvent(event) {
563
569
  //好像ok
564
570
  if (!this.immediate && event.keyCode !== 13) {
565
- console.debug("davistest");
571
+ console.debug('davistest')
566
572
  } else {
567
573
  if (this.inputTimeout) {
568
- clearTimeout(this.inputTimeout);
574
+ clearTimeout(this.inputTimeout)
569
575
  }
570
- let vm = this;
576
+ let vm = this
571
577
  this.inputTimeout = setTimeout(() => {
572
578
  //判断面板是否打开
573
579
  if (vm.$refs.pulldownRef.isPanelVisible() === false) {
574
- vm.$refs.pulldownRef.showPanel();
580
+ vm.$refs.pulldownRef.showPanel()
575
581
  }
576
- vm.searchData();
577
- }, 500);
582
+ vm.searchData()
583
+ }, 500)
578
584
  }
579
585
  },
580
586
  /**
@@ -582,21 +588,21 @@ export default {
582
588
  */
583
589
  gridCellClick({ row, column }) {
584
590
  if (row.sysRepeat === true) {
585
- return;
591
+ return
586
592
  }
587
- if (column.type === "seq" || column.type === "checkbox") {
588
- return;
593
+ if (column.type === 'seq' || column.type === 'checkbox') {
594
+ return
589
595
  }
590
- this.isInputChanged = false;
591
- this.setLinkValue(row, this.row);
592
- this.$emit("selectChanged", row);
593
- this.$refs.pulldownRef.hidePanel();
596
+ this.isInputChanged = false
597
+ this.setLinkValue(row, this.row)
598
+ this.$emit('selectChanged', row)
599
+ this.$refs.pulldownRef.hidePanel()
594
600
  },
595
601
  setLinkValue(pulldownRow, oriRow) {
596
602
  for (let i = 0; i < this.internalColumns.length; i++) {
597
603
  if (this.internalColumns[i].linkField) {
598
- let tempLinkFields = this.internalColumns[i].linkField.split(".");
599
- let tempRow = oriRow;
604
+ let tempLinkFields = this.internalColumns[i].linkField.split('.')
605
+ let tempRow = oriRow
600
606
  // for(let j=0;j<tempLinkFields.length;j++){
601
607
  // let tempField = tempLinkFields[j]
602
608
  // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
@@ -628,69 +634,69 @@ export default {
628
634
  //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
629
635
  if (!(this.internalColumns[i].linkField in oriRow)) {
630
636
  this.$antwarning(
631
- "赋值字段[" + this.internalColumns[i].linkField + "]不存在"
632
- );
633
- continue;
637
+ '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
638
+ )
639
+ continue
634
640
  }
635
641
  if (pulldownRow === null) {
636
642
  if (this.internalColumns[i].nullClear === false) {
637
643
  //是否空值清楚数据,用于可选可输入的控件
638
- continue;
644
+ continue
639
645
  }
640
- this.$set(oriRow, this.internalColumns[i].linkField, null);
646
+ this.$set(oriRow, this.internalColumns[i].linkField, null)
641
647
  } else {
642
648
  this.$set(
643
649
  oriRow,
644
650
  this.internalColumns[i].linkField,
645
651
  this.getLinkValue(this.internalColumns[i].field, pulldownRow)
646
- );
652
+ )
647
653
  }
648
654
  }
649
655
  }
650
656
  },
651
657
  getLinkValue(field, row) {
652
- let linkField = field.split(".");
658
+ let linkField = field.split('.')
653
659
  if (linkField.length > 1) {
654
- let fieldValue = row;
660
+ let fieldValue = row
655
661
  for (let i = 0; i < linkField.length; i++) {
656
662
  if (
657
663
  fieldValue[linkField[i]] === undefined ||
658
664
  fieldValue[linkField[i]] === null
659
665
  ) {
660
- return null;
666
+ return null
661
667
  }
662
- fieldValue = fieldValue[linkField[i]];
668
+ fieldValue = fieldValue[linkField[i]]
663
669
  }
664
- return fieldValue;
670
+ return fieldValue
665
671
  }
666
- return row[field];
672
+ return row[field]
667
673
  },
668
674
  /**
669
675
  * 左下角按钮点击事件
670
676
  */
671
677
  pagerBtnClick(btn) {
672
- this.$refs.pupupAddView.show();
678
+ this.$refs.pupupAddView.show()
673
679
  // this.$emit('pulldownBtnClick', btn)
674
- this.$refs.pulldownRef.hidePanel();
680
+ this.$refs.pulldownRef.hidePanel()
675
681
  },
676
682
  // 多选内容时,若数据不满足条件,不可选中
677
683
  checkMethod({ row }) {
678
684
  if (row.sysRepeat) {
679
- return false;
685
+ return false
680
686
  }
681
- return true;
687
+ return true
682
688
  },
683
689
  /**
684
690
  * 确认多选
685
691
  */
686
692
  multiSelectConfirm() {
687
- this.isInputChanged = false;
693
+ this.isInputChanged = false
688
694
  this.$emit(
689
- "confirmMultiSelect",
695
+ 'confirmMultiSelect',
690
696
  this,
691
697
  this.$refs.pupupGridView.getCheckboxRecords(true)
692
- );
693
- this.$refs.pulldownRef.hidePanel();
698
+ )
699
+ this.$refs.pulldownRef.hidePanel()
694
700
  },
695
701
  popupSaveAfter(pupupAddRowInfo) {
696
702
  let postData = {
@@ -698,58 +704,58 @@ export default {
698
704
  begin: 1,
699
705
  size: 1,
700
706
  expression: {},
701
- sorts: "",
702
- };
707
+ sorts: '',
708
+ }
703
709
  let tempKeyExp = XEUtils.find(
704
710
  this.internalColumns,
705
711
  (item) => item.isKey === true
706
- );
712
+ )
707
713
  postData.expression = {
708
- operator: "and",
714
+ operator: 'and',
709
715
  expressions: [
710
716
  {
711
- operator: "and",
717
+ operator: 'and',
712
718
  expressions: [
713
719
  {
714
720
  field: tempKeyExp.field,
715
- operator: "EQ",
716
- value: pupupAddRowInfo["id"],
721
+ operator: 'EQ',
722
+ value: pupupAddRowInfo['id'],
717
723
  },
718
724
  ],
719
725
  },
720
726
  ],
721
- };
722
- let vm = this;
723
- let tempApi = this.getPostApi(postData);
727
+ }
728
+ let vm = this
729
+ let tempApi = this.getPostApi(postData)
724
730
  request({
725
731
  url: tempApi,
726
- method: "post",
732
+ method: 'post',
727
733
  data: postData,
728
734
  })
729
735
  .then((responseData) => {
730
736
  if (responseData.content.length > 0) {
731
- vm.setLinkValue(responseData.content[0], vm.row);
732
- vm.$emit("selectChanged", responseData.content[0]);
737
+ vm.setLinkValue(responseData.content[0], vm.row)
738
+ vm.$emit('selectChanged', responseData.content[0])
733
739
  }
734
740
  })
735
741
  .catch((error) => {
736
- console.error(error);
742
+ console.error(error)
737
743
  })
738
- .finally(() => {});
744
+ .finally(() => {})
739
745
  },
740
746
  /**
741
747
  * 分页改变事件
742
748
  */
743
749
  pageChangeEvent({ currentPage, pageSize }) {
744
- this.gridPagerConfig.currentPage = currentPage;
745
- this.gridPagerConfig.pageSize = pageSize;
746
- this.searchData();
750
+ this.gridPagerConfig.currentPage = currentPage
751
+ this.gridPagerConfig.pageSize = pageSize
752
+ this.searchData()
747
753
  },
748
754
  /**
749
755
  * 面板隐藏事件
750
756
  */
751
757
  pullDownHideEvent({ $event }) {
752
- this.clearInputValue();
758
+ this.clearInputValue()
753
759
  },
754
760
  /**
755
761
  * 查询数据
@@ -759,22 +765,22 @@ export default {
759
765
  let tempSearch = {
760
766
  value: this.currentValue,
761
767
  dataSource: [],
762
- };
763
- this.$emit("preSearch", tempSearch);
764
- this.searchRows = tempSearch.dataSource;
765
- this.gridPagerConfig.total = tempSearch.dataSource.length;
766
- return;
768
+ }
769
+ this.$emit('preSearch', tempSearch)
770
+ this.searchRows = tempSearch.dataSource
771
+ this.gridPagerConfig.total = tempSearch.dataSource.length
772
+ return
767
773
  }
768
774
 
769
775
  let tempExp = {
770
- operator: "or",
776
+ operator: 'or',
771
777
  expressions: [],
772
- };
778
+ }
773
779
  if (this.isOld === true) {
774
- tempExp = "";
780
+ tempExp = ''
775
781
  }
776
782
  if (this.filterExpression.expressions.length > 0) {
777
- tempExp.expressions.push(this.filterExpression);
783
+ tempExp.expressions.push(this.filterExpression)
778
784
  } else if (this.currentValue) {
779
785
  for (let i = 0; i < this.filterCols.length; i++) {
780
786
  if (this.isOld === true) {
@@ -783,29 +789,29 @@ export default {
783
789
  this.filterCols[i].field +
784
790
  '.contains("' +
785
791
  this.currentValue +
786
- '")';
792
+ '")'
787
793
  if (i < this.filterCols.length - 1) {
788
- tempExp = tempExp + " or ";
794
+ tempExp = tempExp + ' or '
789
795
  }
790
796
  } else {
791
- if (this.filterCols[i].controlType == "number") {
797
+ if (this.filterCols[i].controlType == 'number') {
792
798
  tempExp.expressions.push({
793
799
  field: this.filterCols[i].field,
794
- operator: "EQ",
800
+ operator: 'EQ',
795
801
  value: Number(this.currentValue),
796
- });
802
+ })
797
803
  } else {
798
804
  tempExp.expressions.push({
799
805
  field: this.filterCols[i].field,
800
- operator: "CO",
806
+ operator: 'CO',
801
807
  value: this.currentValue,
802
- });
808
+ })
803
809
  }
804
810
  }
805
811
  }
806
812
  }
807
813
  if (this.isOld === true && tempExp.length > 0) {
808
- tempExp = "(" + tempExp + ")";
814
+ tempExp = '(' + tempExp + ')'
809
815
  }
810
816
 
811
817
  if (this.defaultExpression) {
@@ -813,12 +819,12 @@ export default {
813
819
  this.defaultExpression,
814
820
  this.formRow,
815
821
  this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
816
- );
822
+ )
817
823
 
818
824
  if (tempExp) {
819
- tempExp = tempExp + " and (" + tempDefault + ")";
825
+ tempExp = tempExp + ' and (' + tempDefault + ')'
820
826
  } else {
821
- tempExp = tempDefault;
827
+ tempExp = tempDefault
822
828
  }
823
829
  }
824
830
 
@@ -826,13 +832,13 @@ export default {
826
832
  field: this.field,
827
833
  expression: tempExp,
828
834
  extendParams: {},
829
- };
835
+ }
830
836
  let repeatRowInfo = {
831
- field: "",
837
+ field: '',
832
838
  values: [],
833
- };
839
+ }
834
840
  //查询之前从外部组件构造其他的条件
835
- this.$emit("preSearch", postExpression, repeatRowInfo);
841
+ this.$emit('preSearch', postExpression, repeatRowInfo)
836
842
  let postData = {
837
843
  fields: this.fetchFields,
838
844
  begin:
@@ -843,9 +849,9 @@ export default {
843
849
  expression: postExpression.expression,
844
850
  sorts: this.sorts,
845
851
  extendParams: postExpression.extendParams,
846
- };
852
+ }
847
853
  // console.log(postData.sorts);
848
- let tempApi = this.getPostApi(postData);
854
+ let tempApi = this.getPostApi(postData)
849
855
 
850
856
  // let tempApi = this.api
851
857
  // if (this.api.indexOf('?') > 0) {
@@ -862,21 +868,21 @@ export default {
862
868
  // )
863
869
  // }
864
870
  // }
865
- let vm = this;
866
- vm.gridLoading = true;
871
+ let vm = this
872
+ vm.gridLoading = true
867
873
  request({
868
874
  url: tempApi,
869
- method: "post",
875
+ method: 'post',
870
876
  data: postData,
871
877
  })
872
878
  .then((responseData) => {
873
879
  if (vm.isOld === true) {
874
- vm.searchRows = responseData.data;
875
- vm.gridPagerConfig.total = responseData.extData.totalRows;
880
+ vm.searchRows = responseData.data
881
+ vm.gridPagerConfig.total = responseData.extData.totalRows
876
882
  } else {
877
- vm.searchRows = responseData.content;
878
- vm.$refs.pupupGridView.loadData(vm.searchRows);
879
- vm.gridPagerConfig.total = responseData.otherContent.totalRows;
883
+ vm.searchRows = responseData.content
884
+ vm.$refs.pupupGridView.loadData(vm.searchRows)
885
+ vm.gridPagerConfig.total = responseData.otherContent.totalRows
880
886
  }
881
887
  if (repeatRowInfo.field) {
882
888
  //设置重复值
@@ -887,15 +893,15 @@ export default {
887
893
  item[repeatRowInfo.field]
888
894
  ) > -1
889
895
  ) {
890
- item["sysRepeat"] = true;
896
+ item['sysRepeat'] = true
891
897
  } else {
892
- item["sysRepeat"] = false;
898
+ item['sysRepeat'] = false
893
899
  }
894
- });
900
+ })
895
901
  }
896
902
  // 若当前表格内只有一行,则不进行判断
897
903
  if (vm.propTableData.length == 1) {
898
- return;
904
+ return
899
905
  }
900
906
  // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
901
907
  let fieldNames = vm.columns
@@ -904,213 +910,225 @@ export default {
904
910
  return {
905
911
  field: y.field,
906
912
  linkField: y.linkField,
907
- };
908
- });
913
+ }
914
+ })
909
915
  if (fieldNames.length) {
910
916
  vm.searchRows.forEach((info) => {
911
917
  // 当一次创建多行时,过滤需特定字段不可为空的
912
918
  // 获取数组对象,根据选定字段,过滤选定字段都为空的
913
919
  let tempArr = vm.propTableData.filter((currentInfo) => {
914
- let tempD = [];
920
+ let tempD = []
915
921
  fieldNames.forEach((z) => {
916
922
  // 字段的值若为null、undefined,记录过滤掉
917
923
  if (!currentInfo[z.linkField]) {
918
- tempD.push(true);
924
+ tempD.push(true)
919
925
  }
920
- });
921
- return tempD.length !== fieldNames.length;
922
- });
926
+ })
927
+ return tempD.length !== fieldNames.length
928
+ })
923
929
  // 分为有参查询和无参查询
924
930
  if (tempExp.expressions.length && fieldNames.length == 1) {
925
931
  for (let j = 0; j < fieldNames.length; j++) {
926
932
  let mapArr = tempArr.map(
927
933
  (item) => item[fieldNames[j].linkField]
928
- );
929
- let setArr = new Set(mapArr);
934
+ )
935
+ let setArr = new Set(mapArr)
930
936
  if (setArr.size < mapArr.length) {
931
- arr.push(true);
937
+ arr.push(true)
932
938
  }
933
939
  }
934
940
  if (fieldNames.length === arr.length) {
935
- info.sysRepeat = true;
941
+ info.sysRepeat = true
936
942
  }
937
943
  } else {
938
944
  tempArr.forEach((item) => {
939
945
  // 接口字段可能和表字段field不一致,linkField一致
940
- let arr = [];
946
+ let arr = []
941
947
  for (let j = 0; j < fieldNames.length; j++) {
942
948
  if (
943
949
  info[fieldNames[j].field] == item[fieldNames[j].linkField]
944
950
  ) {
945
- arr.push(true);
951
+ arr.push(true)
946
952
  }
947
953
  }
948
954
  if (fieldNames.length === arr.length) {
949
- info.sysRepeat = true;
955
+ info.sysRepeat = true
956
+ }
957
+ })
958
+ }
959
+ if (info.sysRepeat && this.contrasts.length) {
960
+ let flag = 0
961
+ info.sysRepeat = false
962
+ XEUtils.arrayEach(this.propTableData, (item) => {
963
+ if (item[this.field] === info[this.field]) {
964
+ XEUtils.arrayEach(this.contrasts, (loop) => {
965
+ if (item[loop] === this.row[loop]) {
966
+ flag++
967
+ }
968
+ })
950
969
  }
951
- });
970
+ })
971
+ if (flag === this.contrasts.length) {
972
+ info.sysRepeat = true
973
+ }
952
974
  }
953
975
  })
954
976
  }
955
977
  })
956
978
  .catch((error) => {
957
- console.error(error);
979
+ console.error(error)
958
980
  })
959
981
  .finally(() => {
960
- vm.gridLoading = false;
961
- });
982
+ vm.gridLoading = false
983
+ })
962
984
  },
963
985
  getPostApi(postData) {
964
- let tempApi = this.api;
965
- if (this.api.indexOf("?") > 0) {
966
- tempApi = this.api.substring(0, this.api.indexOf("?"));
967
- let tempExtenParams = this.api.substring(this.api.indexOf("?") + 1);
968
- tempExtenParams = replaceParam(tempExtenParams, this.formRow);
969
- let tempSplitParams = tempExtenParams.split("&");
986
+ let tempApi = this.api
987
+ if (this.api.indexOf('?') > 0) {
988
+ tempApi = this.api.substring(0, this.api.indexOf('?'))
989
+ let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
990
+ tempExtenParams = replaceParam(tempExtenParams, this.formRow)
991
+ let tempSplitParams = tempExtenParams.split('&')
970
992
  for (let i = 0; i < tempSplitParams.length; i++) {
971
- let tempSplitValue = tempSplitParams[i].split("=");
972
- this.$set(
973
- postData.extendParams,
974
- tempSplitValue[0],
975
- tempSplitValue[1]
976
- );
993
+ let tempSplitValue = tempSplitParams[i].split('=')
994
+ this.$set(postData.extendParams, tempSplitValue[0], tempSplitValue[1])
977
995
  }
978
996
  }
979
- return tempApi;
997
+ return tempApi
980
998
  },
981
999
  sortChange({ column, property, order, sortBy, sortList, $event }) {
982
1000
  let currentSort = sortList.map((x) => {
983
- return [x.field, x.order];
984
- });
985
- this.sorts = currentSort;
986
- this.searchData();
1001
+ return [x.field, x.order]
1002
+ })
1003
+ this.sorts = currentSort
1004
+ this.searchData()
987
1005
  },
988
1006
 
989
1007
  // 下拉容器筛选条件被触发
990
1008
  filterVisible({ column }) {
991
1009
  XEUtils.remove(column.filters, (item) => {
992
- return item.data === "";
993
- });
1010
+ return item.data === ''
1011
+ })
994
1012
  if (column.filters.length === 0) {
995
1013
  column.filters.push({
996
- data: "",
997
- });
1014
+ data: '',
1015
+ })
998
1016
  }
999
1017
  },
1000
1018
  filterConfirm(column) {
1001
- let vm = this;
1019
+ let vm = this
1002
1020
  this.filterExpression = {
1003
- operator: "and",
1021
+ operator: 'and',
1004
1022
  expressions: [],
1005
- };
1006
- let col = this.columns.find((x) => x.field === column.field);
1023
+ }
1024
+ let col = this.columns.find((x) => x.field === column.field)
1007
1025
  switch (col.controlType) {
1008
- case "select":
1009
- column.filters[0].checked = column.filters[0].data.length > 0;
1010
- break;
1026
+ case 'select':
1027
+ column.filters[0].checked = column.filters[0].data.length > 0
1028
+ break
1011
1029
  default:
1012
- column.filters[0].checked = column.filters[0].data !== "";
1013
- break;
1030
+ column.filters[0].checked = column.filters[0].data !== ''
1031
+ break
1014
1032
  }
1015
1033
  //通知外部筛选改变事件
1016
- let columns = this.$refs.pupupGridView.getTableColumn().collectColumn;
1034
+ let columns = this.$refs.pupupGridView.getTableColumn().collectColumn
1017
1035
  XEUtils.each(columns, (item) => {
1018
1036
  let filterExpression = {
1019
- operator: "or",
1037
+ operator: 'or',
1020
1038
  expressions: [],
1021
- };
1039
+ }
1022
1040
  if (!col.controlType) {
1023
- col.controlType = "text";
1041
+ col.controlType = 'text'
1024
1042
  }
1025
1043
  switch (col.controlType) {
1026
- case "select":
1044
+ case 'select':
1027
1045
  if (item.filters && item.filters[0].checked) {
1028
1046
  XEUtils.each(item.filters[0].data, (loopItem) => {
1029
1047
  filterExpression.expressions.push({
1030
1048
  field: item.field,
1031
- operator: "EQ",
1049
+ operator: 'EQ',
1032
1050
  value: loopItem,
1033
- });
1034
- });
1051
+ })
1052
+ })
1035
1053
  if (filterExpression.expressions.length > 0) {
1036
- vm.filterExpression.expressions.push(filterExpression);
1054
+ vm.filterExpression.expressions.push(filterExpression)
1037
1055
  }
1038
1056
  }
1039
- break;
1057
+ break
1040
1058
  default:
1041
1059
  if (item.filters && item.filters[0].checked) {
1042
1060
  XEUtils.each(item.filters, (loopItem) => {
1043
1061
  if (loopItem.data) {
1044
1062
  filterExpression.expressions.push({
1045
1063
  field: item.field,
1046
- operator: "CO",
1064
+ operator: 'CO',
1047
1065
  value: loopItem.data,
1048
- });
1066
+ })
1049
1067
  }
1050
- });
1068
+ })
1051
1069
  if (filterExpression.expressions.length > 0) {
1052
- vm.filterExpression.expressions.push(filterExpression);
1070
+ vm.filterExpression.expressions.push(filterExpression)
1053
1071
  }
1054
1072
  }
1055
- break;
1073
+ break
1056
1074
  }
1057
- });
1058
- this.gridPagerConfig.currentPage = 1;
1059
- this.searchData();
1060
- this.$refs.pupupGridView.closeFilter();
1075
+ })
1076
+ this.gridPagerConfig.currentPage = 1
1077
+ this.searchData()
1078
+ this.$refs.pupupGridView.closeFilter()
1061
1079
  },
1062
1080
  // 添加筛选条件
1063
1081
  filterAddExp(column) {
1064
- column["filters"].push({
1065
- data: "",
1066
- });
1082
+ column['filters'].push({
1083
+ data: '',
1084
+ })
1067
1085
  },
1068
1086
 
1069
1087
  // 清除筛选条件
1070
1088
  clearColumnFilter() {
1071
- let columns = [];
1072
- let vm = this;
1089
+ let columns = []
1090
+ let vm = this
1073
1091
  try {
1074
- columns = this.$refs.pupupGridView.getTableColumn().collectColumn;
1092
+ columns = this.$refs.pupupGridView.getTableColumn().collectColumn
1075
1093
  } catch (err) {
1076
- console.debug(err);
1094
+ console.debug(err)
1077
1095
  }
1078
1096
  XEUtils.each(columns, (item) => {
1079
- let col = vm.columns.find((x) => x.field === item.field);
1097
+ let col = vm.columns.find((x) => x.field === item.field)
1080
1098
  if (!col) {
1081
- return;
1099
+ return
1082
1100
  }
1083
1101
  if (!col.controlType) {
1084
- col.controlType = "text";
1102
+ col.controlType = 'text'
1085
1103
  }
1086
1104
  switch (col.controlType) {
1087
- case "select":
1105
+ case 'select':
1088
1106
  if (item.filters && item.filters[0].checked) {
1089
1107
  item.filters = [
1090
1108
  {
1091
1109
  data: [],
1092
1110
  },
1093
- ];
1111
+ ]
1094
1112
  }
1095
- break;
1113
+ break
1096
1114
  default:
1097
1115
  if (item.filters && item.filters[0].checked) {
1098
1116
  item.filters = [
1099
1117
  {
1100
- data: "",
1118
+ data: '',
1101
1119
  },
1102
- ];
1120
+ ]
1103
1121
  }
1104
- break;
1122
+ break
1105
1123
  }
1106
- });
1124
+ })
1107
1125
  this.filterExpression = {
1108
- operator: "and",
1126
+ operator: 'and',
1109
1127
  expressions: [],
1110
- };
1128
+ }
1111
1129
  },
1112
1130
  },
1113
- };
1131
+ }
1114
1132
  </script>
1115
1133
 
1116
1134
  <style lang="scss" scoped>
@@ -1133,7 +1151,6 @@ export default {
1133
1151
  }
1134
1152
  </style>
1135
1153
 
1136
-
1137
1154
  <style lang="less">
1138
- @import "../../styles/default.less";
1139
- </style>
1155
+ @import '../../styles/default.less';
1156
+ </style>