doway-coms 1.9.2 → 1.9.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doway-coms",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -4,7 +4,8 @@
4
4
  <div
5
5
  class="d-form-item"
6
6
  v-for="col in internalComputedHiddenCols"
7
- :key="col.field" v-show="(hiddenDetail?colIndex===0:true)"
7
+ :key="col.field"
8
+ v-show="hiddenDetail ? colIndex === 0 : true"
8
9
  >
9
10
  <!-- 文本框输入控件 -->
10
11
  <BaseInput
@@ -19,12 +20,12 @@
19
20
  :rules="col.rules"
20
21
  @change="
21
22
  () => {
22
- inputChange(col);
23
+ inputChange(col)
23
24
  }
24
25
  "
25
26
  @blur="
26
27
  () => {
27
- blurChange(col);
28
+ blurChange(col)
28
29
  }
29
30
  "
30
31
  />
@@ -39,7 +40,7 @@
39
40
  @preSearch="preSearch"
40
41
  @handleOk="
41
42
  (value) => {
42
- buttonHandleOk(col, value);
43
+ buttonHandleOk(col, value)
43
44
  }
44
45
  "
45
46
  />
@@ -56,7 +57,7 @@
56
57
  :rules="col.rules"
57
58
  @change="
58
59
  () => {
59
- inputChange(col);
60
+ inputChange(col)
60
61
  }
61
62
  "
62
63
  />
@@ -77,12 +78,12 @@
77
78
  :percent="col.percent"
78
79
  @change="
79
80
  () => {
80
- numberChange(col);
81
+ numberChange(col)
81
82
  }
82
83
  "
83
84
  @blur="
84
85
  () => {
85
- blurChange(col);
86
+ blurChange(col)
86
87
  }
87
88
  "
88
89
  />
@@ -100,7 +101,7 @@
100
101
  :valueType="col.valueType"
101
102
  @change="
102
103
  () => {
103
- numberChange(col);
104
+ numberChange(col)
104
105
  }
105
106
  "
106
107
  />
@@ -119,7 +120,7 @@
119
120
  :disabledDateValue="col.disabledDateValue"
120
121
  @change="
121
122
  () => {
122
- inputChange(col);
123
+ inputChange(col)
123
124
  }
124
125
  "
125
126
  />
@@ -138,7 +139,7 @@
138
139
  :disabledDateValue="col.disabledDateValue"
139
140
  @change="
140
141
  () => {
141
- inputChange(col);
142
+ inputChange(col)
142
143
  }
143
144
  "
144
145
  />
@@ -155,7 +156,7 @@
155
156
  :rules="col.rules"
156
157
  @change="
157
158
  (rowInfo) => {
158
- checkboxChange(col);
159
+ checkboxChange(col)
159
160
  }
160
161
  "
161
162
  />
@@ -171,7 +172,7 @@
171
172
  :rules="col.rules"
172
173
  @change="
173
174
  () => {
174
- inputChange(col);
175
+ inputChange(col)
175
176
  }
176
177
  "
177
178
  />
@@ -187,23 +188,23 @@
187
188
  :rules="col.rules"
188
189
  @change="
189
190
  () => {
190
- inputChange(col);
191
+ inputChange(col)
191
192
  }
192
193
  "
193
194
  />
194
195
  <BaseDateMonth
195
- v-if="
196
+ v-if="
196
197
  col.controlType === 'datemonth' &&
197
198
  (col.isButtonShow == false || col.isButtonShow == undefined)
198
199
  "
199
- :label="col.title"
200
- v-model="row[col.field]"
201
- :edit="col.edit"
202
- :tooltip="col.tooltip"
203
- :rules="col.rules"
204
- @change="
200
+ :label="col.title"
201
+ v-model="row[col.field]"
202
+ :edit="col.edit"
203
+ :tooltip="col.tooltip"
204
+ :rules="col.rules"
205
+ @change="
205
206
  () => {
206
- inputChange(col);
207
+ inputChange(col)
207
208
  }
208
209
  "
209
210
  />
@@ -220,7 +221,7 @@
220
221
  :dataSource="col.dataSource"
221
222
  @change="
222
223
  (rowInfo) => {
223
- selectChange(col);
224
+ selectChange(col)
224
225
  }
225
226
  "
226
227
  />
@@ -236,7 +237,7 @@
236
237
  :rules="col.rules"
237
238
  @change="
238
239
  (rowInfo) => {
239
- selectMultiChange(col);
240
+ selectMultiChange(col)
240
241
  }
241
242
  "
242
243
  :dataSource="col.dataSource"
@@ -265,10 +266,42 @@
265
266
  :columns="col.columns"
266
267
  :pageSize="col.pageSize"
267
268
  :immediate="col.immediate"
269
+ :allowAutoClear="col.allowAutoClear"
268
270
  @preSearch="preSearch"
269
271
  @selectChanged="
270
272
  (rowInfo) => {
271
- pullDownChange(col, rowInfo);
273
+ pullDownChange(col, rowInfo)
274
+ }
275
+ "
276
+ />
277
+ <BaseTreeSelect
278
+ v-if="
279
+ col.controlType === 'treeSelect' &&
280
+ (col.isButtonShow == false || col.isButtonShow == undefined)
281
+ "
282
+ :formRow="formRow"
283
+ :api="col.api"
284
+ :tooltip="col.tooltip"
285
+ :row="row"
286
+ :edit="col.edit"
287
+ :label="col.title"
288
+ :rules="col.rules"
289
+ :route="col.route"
290
+ :field="col.field"
291
+ :columns="col.columns"
292
+ @preSearch="preSearch"
293
+ :replaceFields="col.replaceFields"
294
+ :treeWidth="col.treeWidth"
295
+ :width="col.width"
296
+ :linkedField="col.linkedField"
297
+ :showSearch="col.showSearch"
298
+ :allowClear="col.allowClear"
299
+ :placeholder="col.placeholder"
300
+ :method="col.method"
301
+ v-model="row[col.field]"
302
+ @change="
303
+ () => {
304
+ inputChange(col)
272
305
  }
273
306
  "
274
307
  />
@@ -279,25 +312,26 @@
279
312
  <div class="d-form-item-ghost"></div>
280
313
  </div>
281
314
  </template>
282
-
283
- <script>
284
- import { sysFormState, sysRowState } from "../../utils/enum";
285
- import BaseInput from "../../BaseInput/index";
286
- import BaseCheckbox from "../../BaseCheckbox/index";
287
- import BaseDate from "../../BaseDate/index";
288
- import BaseDatetime from "../../BaseDatetime/index";
289
- import BaseDateWeek from "../../BaseDateWeek/index";
290
- import BaseTextArea from "../../BaseTextArea/index";
291
- import BaseButton from "../../BaseButton/index";
292
- import BaseSelect from "../../BaseSelect/index";
293
- import BaseSelectMulti from "../../BaseSelectMulti/index";
294
- import BaseTime from "../../BaseTime/index";
295
- import BasePulldown from "../../BasePulldown/index";
296
- import BaseIntervalInput from "../../BaseIntervalInput/index";
297
- import BaseNumberInput from "../../BaseNumberInput/index";
298
315
 
299
- import moment from "moment";
300
- import BaseDateMonth from "../../BaseDateMonth";
316
+ <script>
317
+ import { sysFormState, sysRowState } from '../../utils/enum'
318
+ import BaseInput from '../../BaseInput/index'
319
+ import BaseCheckbox from '../../BaseCheckbox/index'
320
+ import BaseDate from '../../BaseDate/index'
321
+ import BaseDatetime from '../../BaseDatetime/index'
322
+ import BaseDateWeek from '../../BaseDateWeek/index'
323
+ import BaseTextArea from '../../BaseTextArea/index'
324
+ import BaseButton from '../../BaseButton/index'
325
+ import BaseSelect from '../../BaseSelect/index'
326
+ import BaseSelectMulti from '../../BaseSelectMulti/index'
327
+ import BaseTime from '../../BaseTime/index'
328
+ import BasePulldown from '../../BasePulldown/index'
329
+ import BaseIntervalInput from '../../BaseIntervalInput/index'
330
+ import BaseNumberInput from '../../BaseNumberInput/index'
331
+ import BaseTreeSelect from '../../BaseTreeSelect'
332
+
333
+ import moment from 'moment'
334
+ import BaseDateMonth from '../../BaseDateMonth'
301
335
  export default {
302
336
  components: {
303
337
  BaseInput,
@@ -314,14 +348,15 @@ export default {
314
348
  BasePulldown,
315
349
  BaseIntervalInput,
316
350
  BaseNumberInput,
351
+ BaseTreeSelect,
317
352
  },
318
- name: "BaseForm",
353
+ name: 'BaseForm',
319
354
  props: {
320
355
  updateDatas: {
321
356
  // 更新的数据
322
357
  type: Object,
323
358
  default: function () {
324
- return {};
359
+ return {}
325
360
  },
326
361
  },
327
362
  showLoading: {
@@ -337,7 +372,7 @@ export default {
337
372
  valueState: {
338
373
  type: Object,
339
374
  default: function () {
340
- return {};
375
+ return {}
341
376
  },
342
377
  },
343
378
  formState: {
@@ -348,33 +383,33 @@ export default {
348
383
  // 当前页面数据集
349
384
  type: Object,
350
385
  default: () => {
351
- return {};
386
+ return {}
352
387
  },
353
388
  },
354
389
  row: {
355
390
  // 当前行,如果是表单的话当前行和当前页面数据集是一样的
356
391
  type: Object,
357
392
  default: () => {
358
- return {};
393
+ return {}
359
394
  },
360
395
  },
361
396
  columns: {
362
397
  // 表格列信息
363
398
  type: Array,
364
399
  default: function () {
365
- return [];
400
+ return []
366
401
  },
367
402
  },
368
403
  dataName: {
369
404
  type: String,
370
405
  default: function () {
371
- return "";
406
+ return ''
372
407
  },
373
408
  },
374
409
  },
375
410
  computed: {
376
411
  internalComputedHiddenCols: function () {
377
- let vm = this;
412
+ let vm = this
378
413
  return this.columns.filter((item) => {
379
414
  // if (item.isTitle === true) {
380
415
  // // vm.titleCol = item
@@ -384,16 +419,16 @@ export default {
384
419
  // vm.logoCol = item
385
420
  // return false
386
421
  // }
387
- return item.visible === true;
388
- });
422
+ return item.visible === true
423
+ })
389
424
  },
390
425
  },
391
426
  filters: {},
392
427
  data() {
393
428
  return {
394
- hiddenDetail:false,
429
+ hiddenDetail: false,
395
430
  moment,
396
- editFormName: "",
431
+ editFormName: '',
397
432
  internalEdit: false,
398
433
  internalCols: [],
399
434
  internalValueState: {},
@@ -402,8 +437,8 @@ export default {
402
437
  titleCols: [],
403
438
  logoCol: null,
404
439
  isShowEditForm: false,
405
- ref: "",
406
- };
440
+ ref: '',
441
+ }
407
442
  },
408
443
  watch: {
409
444
  // row: {
@@ -441,41 +476,41 @@ export default {
441
476
  // this.titleCols.push(this.columns[i])
442
477
  // continue
443
478
  // }
444
- if (this.columns[i].controlType === "popup") {
479
+ if (this.columns[i].controlType === 'popup') {
445
480
  let formUrl =
446
481
  process.env[
447
- "VUE_APP_" +
482
+ 'VUE_APP_' +
448
483
  this.columns[i].linkModuleData.objectService.toUpperCase() +
449
- "_SERVICE_URL"
484
+ '_SERVICE_URL'
450
485
  ] +
451
- "/" +
486
+ '/' +
452
487
  this.columns[i].linkModuleData.objectApiVersion +
453
- "/" +
488
+ '/' +
454
489
  this.columns[i].linkModuleData.objectName +
455
- "/";
456
- this.columns[i]["api"] = this.columns[i].linkModuleData.objectApiRoute
490
+ '/'
491
+ this.columns[i]['api'] = this.columns[i].linkModuleData.objectApiRoute
457
492
  ? formUrl + this.columns[i].linkModuleData.objectApiRoute
458
- : formUrl + "Search";
493
+ : formUrl + 'Search'
459
494
 
460
- this.columns[i]["columns"] = {};
495
+ this.columns[i]['columns'] = {}
461
496
 
462
497
  for (
463
498
  let x = 0;
464
499
  x < this.columns[i].linkModuleData.moduleFields.length;
465
500
  x++
466
501
  ) {
467
- let tempField = this.columns[i].linkModuleData.moduleFields[x];
468
- this.columns[i]["columns"][tempField.field] = {
502
+ let tempField = this.columns[i].linkModuleData.moduleFields[x]
503
+ this.columns[i]['columns'][tempField.field] = {
469
504
  title: tempField.caption,
470
505
  width: tempField.width,
471
506
  visible: tempField.visible,
472
507
  linkField: tempField.linkValueField,
473
508
  filter: tempField.isFilter,
474
- };
509
+ }
475
510
  if (tempField.field === this.columns[i].linkCaptionField) {
476
- this.columns[i]["columns"][tempField.field].linkField =
477
- this.columns[i].field;
478
- this.columns[i]["columns"][tempField.field].filter = true;
511
+ this.columns[i]['columns'][tempField.field].linkField =
512
+ this.columns[i].field
513
+ this.columns[i]['columns'][tempField.field].filter = true
479
514
  }
480
515
  }
481
516
  }
@@ -493,29 +528,29 @@ export default {
493
528
  mounted() {
494
529
  //let letterLength = this.$refs.content.value
495
530
  //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
496
- window.addEventListener("beforeunload", (e) => this.beforeunloadHandler(e));
531
+ window.addEventListener('beforeunload', (e) => this.beforeunloadHandler(e))
497
532
  },
498
533
  destroyed() {
499
- window.removeEventListener("beforeunload", (e) =>
534
+ window.removeEventListener('beforeunload', (e) =>
500
535
  this.beforeunloadHandler(e)
501
- );
536
+ )
502
537
  },
503
538
  activated() {},
504
539
  methods: {
505
540
  preSearch(searchInfo, repeatRowInfo) {
506
- this.$emit("preSearch", searchInfo, repeatRowInfo);
541
+ this.$emit('preSearch', searchInfo, repeatRowInfo)
507
542
  },
508
543
  beforeunloadHandler(e) {
509
- if (this.formState !== "view") {
510
- e = e || window.event;
511
- e.returnValue = "提示";
512
- return confirm("确认退出");
544
+ if (this.formState !== 'view') {
545
+ e = e || window.event
546
+ e.returnValue = '提示'
547
+ return confirm('确认退出')
513
548
  } else {
514
- return;
549
+ return
515
550
  }
516
551
  },
517
552
  pulldownBtnClick(btnInfo) {
518
- this.$emit("pulldownBtnClick", btnInfo);
553
+ this.$emit('pulldownBtnClick', btnInfo)
519
554
  },
520
555
  showToolTip() {},
521
556
  fieldCaptionClick(col) {
@@ -530,13 +565,13 @@ export default {
530
565
  return (
531
566
  filterItem.meta &&
532
567
  filterItem.meta.moduleId === col.linkModuleData.linkModuleId
533
- );
534
- });
568
+ )
569
+ })
535
570
  if (linkModule.length > 0) {
536
571
  this.$router.pushRoute({
537
572
  name: linkModule[0].name,
538
573
  query: { id: this.row[col.field] },
539
- });
574
+ })
540
575
  }
541
576
  }
542
577
  },
@@ -553,80 +588,82 @@ export default {
553
588
  // this.row['sysRowState'] = sysRowState.update
554
589
  // },
555
590
  pullDownChange(colInfo, row) {
556
- this.$emit("change", colInfo);
591
+ this.$emit('change', colInfo)
557
592
  },
558
593
  selectMultiChange(colInfo, row) {
559
- this.$emit("change", colInfo);
594
+ this.$emit('change', colInfo)
560
595
  },
561
596
  selectChange(colInfo) {
562
- this.$emit("change", colInfo);
597
+ this.$emit('change', colInfo)
563
598
  },
564
599
  checkboxChange(colInfo) {
565
- this.$emit("change", colInfo);
600
+ this.$emit('change', colInfo)
566
601
  },
567
602
  checkBoxChange(col) {
568
- if (col.field.indexOf(".") < 0) {
569
- this.updateDatas[col.field] = this.row[col.field];
603
+ if (col.field.indexOf('.') < 0) {
604
+ this.updateDatas[col.field] = this.row[col.field]
570
605
  }
571
- this.$emit("change", col);
606
+ this.$emit('change', col)
572
607
  if (
573
- this.row["sysRowState"] === sysRowState.add ||
574
- this.row["sysRowState"] === sysRowState.update
608
+ this.row['sysRowState'] === sysRowState.add ||
609
+ this.row['sysRowState'] === sysRowState.update
575
610
  ) {
576
- return;
611
+ return
577
612
  }
578
- this.row["sysRowState"] = sysRowState.update;
613
+ this.row['sysRowState'] = sysRowState.update
579
614
  },
580
615
  dateChange(col) {
581
- if (col.field.indexOf(".") < 0) {
582
- this.updateDatas[col.field] = this.row[col.field];
616
+ if (col.field.indexOf('.') < 0) {
617
+ this.updateDatas[col.field] = this.row[col.field]
583
618
  }
584
- this.$emit("change", col);
619
+ this.$emit('change', col)
585
620
  if (
586
- this.row["sysRowState"] === sysRowState.add ||
587
- this.row["sysRowState"] === sysRowState.update
621
+ this.row['sysRowState'] === sysRowState.add ||
622
+ this.row['sysRowState'] === sysRowState.update
588
623
  ) {
589
- return;
624
+ return
590
625
  }
591
- this.row["sysRowState"] = sysRowState.update;
626
+ this.row['sysRowState'] = sysRowState.update
592
627
  },
593
628
  inputChange(colInfo) {
594
629
  // 输入框改变
595
- this.$emit("change", colInfo);
630
+ this.$emit('change', colInfo)
596
631
  },
597
632
  // 按钮弹出组件返回输入的值
598
633
  buttonHandleOk(colInfo, value) {
599
634
  // 按钮弹出确定改变内容改变
600
- this.$emit("buttonHandleOk", colInfo, value);
635
+ this.$emit('buttonHandleOk', colInfo, value)
601
636
  },
602
637
  blurChange(colInfo) {
603
638
  // 输入框失去焦点
604
- this.$emit("blur", colInfo);
639
+ this.$emit('blur', colInfo)
605
640
  },
606
641
  numberChange(colInfo) {
607
642
  // 输入框改变
608
- this.$emit("change", colInfo);
643
+ this.$emit('change', colInfo)
609
644
  },
610
645
  longtimeChange(data, col) {
611
- this.row[col.field] = data;
612
- this.$emit("change", col);
646
+ this.row[col.field] = data
647
+ this.$emit('change', col)
613
648
  if (
614
- this.row["sysRowState"] === sysRowState.add ||
615
- this.row["sysRowState"] === sysRowState.update
649
+ this.row['sysRowState'] === sysRowState.add ||
650
+ this.row['sysRowState'] === sysRowState.update
616
651
  ) {
617
- return;
652
+ return
618
653
  }
619
- this.row["sysRowState"] = sysRowState.update;
654
+ this.row['sysRowState'] = sysRowState.update
620
655
  },
621
656
  changeControlType(field, controlType) {
622
- let col = this.internalComputedHiddenCols.find(col => col.field === field)
657
+ let col = this.internalComputedHiddenCols.find(
658
+ (col) => col.field === field
659
+ )
623
660
  col.controlType = controlType
624
- }
661
+ },
625
662
  },
626
- };
663
+ }
627
664
  </script>
628
-
629
- <style lang="less" scoped>
665
+
666
+ <style lang="less" scoped>
630
667
  .form-head {
631
668
  display: flex;
632
669
  flex-flow: row wrap;
@@ -684,7 +721,6 @@ export default {
684
721
  margin-left: 30px;
685
722
  }
686
723
  </style>
687
- <style lang="less">
688
- @import "../../styles/default.less";
724
+ <style lang="less">
725
+ @import '../../styles/default.less';
689
726
  </style>
690
-
@@ -0,0 +1,8 @@
1
+ // 导入组件,组件必须声明 name
2
+ import BaseTreeSelect from './src/index.vue'
3
+ // 为组件提供 install 安装方法,供按需引入
4
+ BaseTreeSelect.install = function (Vue) {
5
+ Vue.component(BaseTreeSelect.name, BaseTreeSelect)
6
+ }
7
+ // 默认导出组件
8
+ export default BaseTreeSelect
@@ -0,0 +1,370 @@
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
+ <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
13
+ <img src="../../styles/icon/help.png" alt="" style="width: 14px" />
14
+ </Tooltip>
15
+ </div>
16
+ <div
17
+ :class="{
18
+ 'd-control': showLabel === true,
19
+ 'd-grid-control': showLabel === false,
20
+ }"
21
+ >
22
+ <ValidationProvider
23
+ v-if="edit === true"
24
+ :name="label"
25
+ v-slot="v"
26
+ :rules="rules"
27
+ >
28
+ <TreeSelect
29
+ ref="treeSelectView"
30
+ v-model="currentValue"
31
+ :treeData="treeData"
32
+ tree-data-simple-mode
33
+ :showSearch="showSearch"
34
+ :replaceFields="replaceFields"
35
+ :dropdownMatchSelectWidth="dropdownMatchSelectWidth"
36
+ :treeDefaultExpandAll="treeDefaultExpandAll"
37
+ :size="size"
38
+ :allowClear="allowClear"
39
+ @focus="searchData"
40
+ @select="selectData"
41
+ :dropdownStyle="{
42
+ width: treeWidth + 'px',
43
+ height: '300px',
44
+ ...widthDropdownStyle,
45
+ }"
46
+ treeNodeFilterProp="title"
47
+ :style="{
48
+ width: width + 'px',
49
+ }"
50
+ :placeholder="placeholder"
51
+ ></TreeSelect>
52
+ <div class="d-error-msg">
53
+ {{ v.errors[0] }}
54
+ </div>
55
+ </ValidationProvider>
56
+
57
+ <span v-else>
58
+ <a v-if="route" @click="routeLinkClick">{{ value }}</a>
59
+ <span v-else> {{ value }}</span>
60
+ </span>
61
+ </div>
62
+ </div>
63
+ </template>
64
+
65
+ <script>
66
+ import { Tooltip, TreeSelect } from 'ant-design-vue'
67
+ import request from '../../utils/request'
68
+ import { ValidationProvider } from 'vee-validate'
69
+ export default {
70
+ name: 'BaseTreeSelect',
71
+ components: {
72
+ Tooltip,
73
+ TreeSelect,
74
+ ValidationProvider,
75
+ },
76
+ props: {
77
+ label: {
78
+ type: String,
79
+ },
80
+ showLabel: {
81
+ type: Boolean,
82
+ default: function () {
83
+ return true
84
+ },
85
+ },
86
+ labelWidth: {
87
+ type: Number,
88
+ default: function () {
89
+ return 100
90
+ },
91
+ },
92
+ api: {
93
+ type: String,
94
+ required: true,
95
+ },
96
+ exps: {
97
+ // 条件
98
+ type: Array,
99
+ default: () => {
100
+ return []
101
+ },
102
+ },
103
+ value: {
104
+ type: String,
105
+ default: function () {
106
+ return ''
107
+ },
108
+ },
109
+ tooltip: {
110
+ type: String,
111
+ default: function () {
112
+ return ''
113
+ },
114
+ },
115
+ customTitle: {
116
+ type: Array,
117
+ default: function () {
118
+ return []
119
+ },
120
+ },
121
+ // 输入框宽度
122
+ width: {
123
+ type: Number,
124
+ default: function () {
125
+ return 100
126
+ },
127
+ },
128
+ // 树宽度
129
+ treeWidth: {
130
+ type: Number,
131
+ default: function () {
132
+ return 200
133
+ },
134
+ },
135
+ // 输入框和选择器同宽
136
+ dropdownMatchSelectWidth: {
137
+ type: Boolean,
138
+ default: function () {
139
+ return false
140
+ },
141
+ },
142
+ // 替换展示字段
143
+ replaceFields: {
144
+ type: Object,
145
+ default: function () {
146
+ return {
147
+ children: 'children',
148
+ title: 'title',
149
+ key: 'key',
150
+ value: 'value',
151
+ }
152
+ },
153
+ },
154
+ // 是否默认展开所有树节点
155
+ treeDefaultExpandAll: {
156
+ type: Boolean,
157
+ default: function () {
158
+ return false
159
+ },
160
+ },
161
+ size: {
162
+ type: String,
163
+ default: function () {
164
+ return 'small'
165
+ },
166
+ },
167
+ // 下拉中显示搜索框
168
+ showSearch: {
169
+ type: Boolean,
170
+ default: function () {
171
+ return true
172
+ },
173
+ },
174
+ // 下拉菜单的样式
175
+ widthDropdownStyle: {
176
+ type: Object,
177
+ default: function () {
178
+ return {}
179
+ },
180
+ },
181
+ // 清除按钮
182
+ allowClear: {
183
+ type: Boolean,
184
+ default: function () {
185
+ return true
186
+ },
187
+ },
188
+ placeholder: {
189
+ type: String,
190
+ default: function () {
191
+ return ''
192
+ },
193
+ },
194
+ rules: {
195
+ type: Object,
196
+ default: function () {
197
+ return null
198
+ },
199
+ },
200
+ formRow: {
201
+ type: Object,
202
+ default: function () {
203
+ return {}
204
+ },
205
+ },
206
+ row: {
207
+ type: Object,
208
+ default: function () {
209
+ return {}
210
+ },
211
+ },
212
+ edit: {
213
+ type: Boolean,
214
+ default: function () {
215
+ return false
216
+ },
217
+ },
218
+ field: {
219
+ type: String,
220
+ },
221
+ columns: {
222
+ // 列集合
223
+ type: Array,
224
+ default: () => {
225
+ return []
226
+ },
227
+ },
228
+ propTableData: {
229
+ type: Array,
230
+ default: function () {
231
+ return []
232
+ },
233
+ },
234
+ linkedField: {
235
+ type: String,
236
+ required: true,
237
+ },
238
+ method: {
239
+ type: String,
240
+ default: function () {
241
+ return 'post'
242
+ },
243
+ },
244
+ route: Object,
245
+ },
246
+ data() {
247
+ return {
248
+ treeData: [],
249
+ currentValue: '',
250
+ }
251
+ },
252
+ mounted() {
253
+ // this.searchData()
254
+ this.currentValue = this.row[this.linkedField]
255
+ },
256
+ computed: {},
257
+ methods: {
258
+ /**
259
+ * 查询数据
260
+ */
261
+ searchData() {
262
+ let tempExp = {
263
+ operator: 'or',
264
+ expressions: [],
265
+ }
266
+
267
+ let postExpression = {
268
+ field: this.field,
269
+ expression: tempExp,
270
+ extendParams: {},
271
+ }
272
+ let repeatRowInfo = {
273
+ field: '',
274
+ values: [],
275
+ }
276
+ //查询之前从外部组件构造其他的条件
277
+ this.$emit('preSearch', postExpression, repeatRowInfo, this.row)
278
+ let postData = {
279
+ begin: 1,
280
+ size: 0,
281
+ expression: postExpression.expression,
282
+ sorts: [],
283
+ extendParams: postExpression.extendParams,
284
+ }
285
+ let tempApi = this.getPostApi(postData)
286
+ let vm = this
287
+ vm.gridLoading = true
288
+ request({
289
+ url: tempApi,
290
+ method: this.method,
291
+ data: postData,
292
+ })
293
+ .then((responseData) => {
294
+ vm.treeData = responseData.content
295
+ })
296
+ .catch((error) => {
297
+ console.error(error)
298
+ })
299
+ .finally(() => {
300
+ vm.gridLoading = false
301
+ })
302
+ },
303
+ getPostApi(postData) {
304
+ let tempApi = this.api
305
+ if (this.api.indexOf('?') > 0) {
306
+ tempApi = this.api.substring(0, this.api.indexOf('?'))
307
+ let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
308
+ tempExtenParams = replaceParam(tempExtenParams, this.formRow)
309
+ let tempSplitParams = tempExtenParams.split('&')
310
+ for (let i = 0; i < tempSplitParams.length; i++) {
311
+ let tempSplitValue = tempSplitParams[i].split('=')
312
+ this.$set(postData.extendParams, tempSplitValue[0], tempSplitValue[1])
313
+ }
314
+ }
315
+ return tempApi
316
+ },
317
+ routeLinkClick() {
318
+ //首先需要判断是否有权限
319
+ this.$router.pushRoute({
320
+ name: this.route.name,
321
+ query: { id: this.row[this.route.field] },
322
+ })
323
+ },
324
+ selectData(value, node) {
325
+ // this.row[this.linkedField] = value
326
+ // this.row[this.field] = node.title
327
+ this.$set(this.row, this.linkedField, value)
328
+ this.$set(this.row, this.field, node.title)
329
+ },
330
+ },
331
+ }
332
+ </script>
333
+
334
+ <style lang="scss" scoped>
335
+ // ::v-deep .ant-select-tree-dropdown::-webkit-scrollbar {
336
+ // width: 5px;
337
+ // }
338
+ // ::v-deep .ant-select-tree-dropdown::-webkit-scrollbar-thumb {
339
+ // /*滚动条里面小方块*/
340
+ // border-radius: 10px;
341
+ // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
342
+ // background: #e5e5e5;
343
+ // }
344
+ // ::v-deep .ant-select-tree-dropdown::-webkit-scrollbar-track {
345
+ // /*滚动条里面轨道*/
346
+ // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
347
+ // border-radius: 10px;
348
+ // background: #ffffff;
349
+ // }
350
+ .pulldown-grid {
351
+ min-width: 600px;
352
+ width: auto;
353
+ height: 350px;
354
+ background-color: #fff;
355
+ box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
356
+ }
357
+
358
+ .d-grid-control {
359
+ height: 30px;
360
+ }
361
+ .interceptor-class {
362
+ padding: 10px;
363
+ ::v-deep .ant-btn {
364
+ margin: 10px 10px 0;
365
+ }
366
+ }
367
+ </style>
368
+ <style lang="less">
369
+ @import '../../styles/default.less';
370
+ </style>
package/packages/index.js CHANGED
@@ -1,170 +1,190 @@
1
1
  import Vue from 'vue'
2
2
  // 导入组件
3
- import BaseInput from './BaseInput/index';
4
- import BaseCheckbox from './BaseCheckbox/index';
5
- import BaseDate from './BaseDate/index';
6
- import BaseDatetime from './BaseDatetime/index';
7
- import BaseDateWeek from './BaseDateWeek/index';
8
- import BaseTextArea from './BaseTextArea/index';
9
- import BaseSelect from './BaseSelect/index';
10
- import BaseSelectMulti from './BaseSelectMulti/index';
11
- import BaseTime from './BaseTime/index';
12
- import BasePagination from './BasePagination/index';
13
- import BaseNumberInput from './BaseNumberInput/index';
14
- import BaseTool from './BaseTool/index';
15
- import BaseToolStatus from './BaseToolStatus/index';
16
- import BasePulldown from './BasePulldown/index';
17
- import BaseIntervalInput from './BaseIntervalInput/index';
18
- import BaseForm from './BaseForm/index';
19
- import BasePictureCard from './BasePictureCard/index';
20
- import BasePrintPreview from './BasePrintPreview/index';
21
- import BaseGantt from "./BaseGantt/index";
22
- import BaseKanbanEmpty from "./BaseKanbanEmpty/index";
23
- import BaseSearch from "./BaseSearch/index";
24
- import BaseButton from "./BaseButton/index";
25
- import LeaveAMessage from "./LeaveAMessage/index";
26
- import AuditsList from "./AuditsList/index";
3
+ import BaseInput from './BaseInput/index'
4
+ import BaseCheckbox from './BaseCheckbox/index'
5
+ import BaseDate from './BaseDate/index'
6
+ import BaseDatetime from './BaseDatetime/index'
7
+ import BaseDateWeek from './BaseDateWeek/index'
8
+ import BaseTextArea from './BaseTextArea/index'
9
+ import BaseSelect from './BaseSelect/index'
10
+ import BaseSelectMulti from './BaseSelectMulti/index'
11
+ import BaseTime from './BaseTime/index'
12
+ import BasePagination from './BasePagination/index'
13
+ import BaseNumberInput from './BaseNumberInput/index'
14
+ import BaseTool from './BaseTool/index'
15
+ import BaseToolStatus from './BaseToolStatus/index'
16
+ import BasePulldown from './BasePulldown/index'
17
+ import BaseIntervalInput from './BaseIntervalInput/index'
18
+ import BaseForm from './BaseForm/index'
19
+ import BasePictureCard from './BasePictureCard/index'
20
+ import BasePrintPreview from './BasePrintPreview/index'
21
+ import BaseGantt from './BaseGantt/index'
22
+ import BaseKanbanEmpty from './BaseKanbanEmpty/index'
23
+ import BaseSearch from './BaseSearch/index'
24
+ import BaseButton from './BaseButton/index'
25
+ import BaseTreeSelect from './BaseTreeSelect/index'
26
+ import LeaveAMessage from './LeaveAMessage/index'
27
+ import AuditsList from './AuditsList/index'
27
28
 
28
29
  import store from './utils/store'
29
30
  import request from './utils/request'
30
- import BaseGrid from './BaseGrid/index';
31
+ import BaseGrid from './BaseGrid/index'
31
32
 
32
33
  // 存储组件列表
33
34
  const components = [
34
- BaseInput, BaseCheckbox, BaseDate, BaseDatetime, BaseDateWeek,
35
- BaseTextArea, BaseSelect, BaseSelectMulti, BaseTime, BasePagination,
36
- BaseNumberInput, BaseTool, BaseToolStatus, BasePulldown, BaseIntervalInput,
37
- BaseForm, BasePictureCard, BaseGrid, BasePrintPreview, BaseGantt,
38
- BaseKanbanEmpty, BaseSearch, BaseButton,LeaveAMessage,AuditsList
39
- ];
35
+ BaseInput,
36
+ BaseCheckbox,
37
+ BaseDate,
38
+ BaseDatetime,
39
+ BaseDateWeek,
40
+ BaseTextArea,
41
+ BaseSelect,
42
+ BaseSelectMulti,
43
+ BaseTime,
44
+ BasePagination,
45
+ BaseNumberInput,
46
+ BaseTool,
47
+ BaseToolStatus,
48
+ BasePulldown,
49
+ BaseIntervalInput,
50
+ BaseForm,
51
+ BasePictureCard,
52
+ BaseGrid,
53
+ BasePrintPreview,
54
+ BaseGantt,
55
+ BaseKanbanEmpty,
56
+ BaseSearch,
57
+ BaseButton,
58
+ LeaveAMessage,
59
+ AuditsList,
60
+ BaseTreeSelect,
61
+ ]
40
62
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
41
63
 
42
64
  import 'vxe-table/lib/style.css'
43
65
  import VXETable from 'vxe-table'
44
66
 
45
-
46
67
  const popupInterceptor = (params) => {
47
- // 比如点击了某个组件的弹出层面板之后,此时被激活单元格不应该被自动关闭,通过返回 false 可以阻止默认的行为。
48
- let parentElement = (params.$event.target.shadowRoot && params.$event.composed) ?
49
- (params.$event.composedPath()[0] || params.$event.target) : params.$event.target
50
- while (true) {
51
- // console.debug(parentElement)
52
- if (
53
- parentElement &&
54
- (parentElement.className.indexOf('vxe-modal--wrapper') > -1 ||
55
- parentElement.className.indexOf('ant-calendar') > -1 ||
56
- parentElement.className.indexOf('ant-select-dropdown-menu-item') > -1 ||
57
- parentElement.className.indexOf('interceptor-class') > -1 ||
58
- parentElement.className.indexOf('ant-time-picker-panel') > -1)
59
- ) {
60
- //定义网格弹出框不能对焦问题
61
- return false
62
- }
63
- if (parentElement.parentElement) {
64
- parentElement = parentElement.parentElement
65
- } else {
66
- break
67
- }
68
- }
69
-
68
+ // 比如点击了某个组件的弹出层面板之后,此时被激活单元格不应该被自动关闭,通过返回 false 可以阻止默认的行为。
69
+ let parentElement =
70
+ params.$event.target.shadowRoot && params.$event.composed
71
+ ? params.$event.composedPath()[0] || params.$event.target
72
+ : params.$event.target
73
+ while (true) {
74
+ // console.debug(parentElement)
75
+ if (
76
+ parentElement &&
77
+ (parentElement.className.indexOf('vxe-modal--wrapper') > -1 ||
78
+ parentElement.className.indexOf('ant-calendar') > -1 ||
79
+ parentElement.className.indexOf('ant-select-dropdown-menu-item') > -1 ||
80
+ parentElement.className.indexOf('interceptor-class') > -1 ||
81
+ parentElement.className.indexOf('ant-time-picker-panel') > -1)
82
+ ) {
83
+ //定义网格弹出框不能对焦问题
84
+ return false
85
+ }
86
+ if (parentElement.parentElement) {
87
+ parentElement = parentElement.parentElement
88
+ } else {
89
+ break
90
+ }
91
+ }
70
92
  }
71
93
  //网格弹出点击拦截器
72
94
  VXETable.interceptor.add('event.clearActived', (params) => {
73
- return popupInterceptor(params)
95
+ return popupInterceptor(params)
74
96
  })
75
97
  //网格筛选点击拦截器
76
98
  VXETable.interceptor.add('event.clearFilter', (params) => {
77
- return popupInterceptor(params)
99
+ return popupInterceptor(params)
78
100
  })
79
101
 
80
102
  //表格自定义格式化
81
103
  import './utils/gridFormat'
82
104
  // 右键菜单插件
83
- import Contextmenu from "vue-contextmenujs"
105
+ import Contextmenu from 'vue-contextmenujs'
84
106
 
85
- Vue.use(Contextmenu);
107
+ Vue.use(Contextmenu)
86
108
 
87
109
  const install = function (Vue) {
88
- //注册grid组件
89
- Vue.use(VXETable)
90
- // 遍历注册全局组件
91
- components.forEach((component) => {
92
- Vue.component(component.name, component);
93
- });
94
- };
110
+ //注册grid组件
111
+ Vue.use(VXETable)
112
+ // 遍历注册全局组件
113
+ components.forEach((component) => {
114
+ Vue.component(component.name, component)
115
+ })
116
+ }
95
117
 
96
118
  // 环境监测
97
- // 判断是否是直接引入文件
119
+ // 判断是否是直接引入文件
98
120
  if (typeof window !== 'undefined' && window.Vue) {
99
- install(window.Vue);
121
+ install(window.Vue)
100
122
  }
101
123
 
102
124
  import XEUtils from 'xe-utils'
103
125
  //表单输入框验证
104
- import {
105
- extend,
106
- localize
107
- } from 'vee-validate'
126
+ import { extend, localize } from 'vee-validate'
108
127
  //引入校验规则 安装所有规则
109
128
  import * as rules from 'vee-validate/dist/rules'
110
- Object.keys(rules).forEach(rule => {
111
- extend(rule, rules[rule])
129
+ Object.keys(rules).forEach((rule) => {
130
+ extend(rule, rules[rule])
112
131
  })
113
132
 
114
133
  extend('gt', (value, min) => {
115
- if (XEUtils.toNumber(value) > min) {
116
- return true
117
- }
118
- return `必须大于${min}`
134
+ if (XEUtils.toNumber(value) > min) {
135
+ return true
136
+ }
137
+ return `必须大于${min}`
119
138
  })
120
139
 
121
140
  localize({
122
- en: {
123
- messages: {
124
- required: '必填',
125
- min: '不能小于 {length} 个字符',
126
- max: (_, { length }) => `不能大于 ${length} 个字符`,
127
- email: '邮箱输入不符合规则'
128
- }
129
- }
141
+ en: {
142
+ messages: {
143
+ required: '必填',
144
+ min: '不能小于 {length} 个字符',
145
+ max: (_, { length }) => `不能大于 ${length} 个字符`,
146
+ email: '邮箱输入不符合规则',
147
+ },
148
+ },
130
149
  })
131
150
 
132
151
  export default {
133
- // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
134
- install
135
- // 以下是具体的组件列表
136
- };
152
+ // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
153
+ install,
154
+ // 以下是具体的组件列表
155
+ }
137
156
  export * from './utils/enum'
138
157
  export * from './utils/common'
139
158
  export * from './utils/filters'
140
159
  export * from './utils/msg'
141
160
 
142
161
  export {
143
- BaseInput,
144
- BaseCheckbox,
145
- BaseDate,
146
- BaseDatetime,
147
- BaseDateWeek,
148
- BaseTextArea,
149
- BaseSelect,
150
- BaseSelectMulti,
151
- BaseTime,
152
- BasePagination,
153
- BaseNumberInput,
154
- BaseTool,
155
- BaseToolStatus,
156
- BasePulldown,
157
- BaseIntervalInput,
158
- BaseForm,
159
- BaseGrid,
160
- BasePictureCard,
161
- BasePrintPreview,
162
- BaseGantt,
163
- BaseKanbanEmpty,
164
- BaseSearch,
165
- BaseButton,
166
- LeaveAMessage,
167
- AuditsList,
168
- store,
169
- request,
170
- }
162
+ BaseInput,
163
+ BaseCheckbox,
164
+ BaseDate,
165
+ BaseDatetime,
166
+ BaseDateWeek,
167
+ BaseTextArea,
168
+ BaseSelect,
169
+ BaseSelectMulti,
170
+ BaseTime,
171
+ BasePagination,
172
+ BaseNumberInput,
173
+ BaseTool,
174
+ BaseToolStatus,
175
+ BasePulldown,
176
+ BaseIntervalInput,
177
+ BaseForm,
178
+ BaseGrid,
179
+ BasePictureCard,
180
+ BasePrintPreview,
181
+ BaseGantt,
182
+ BaseKanbanEmpty,
183
+ BaseSearch,
184
+ BaseTreeSelect,
185
+ BaseButton,
186
+ LeaveAMessage,
187
+ AuditsList,
188
+ store,
189
+ request,
190
+ }
@@ -59,7 +59,8 @@ export const sysRowState = {
59
59
  datemonth: 'datemonth',
60
60
  x_axis: 'x_axis',
61
61
  y_axis: 'y_axis',
62
- series: 'series'
62
+ series: 'series',
63
+ treeSelect: 'treeSelect'
63
64
  }
64
65
  export const dataType = {
65
66
  frame: 'frame',