doway-coms 1.9.3 → 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.3",
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"
@@ -269,7 +270,38 @@
269
270
  @preSearch="preSearch"
270
271
  @selectChanged="
271
272
  (rowInfo) => {
272
- 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)
273
305
  }
274
306
  "
275
307
  />
@@ -280,25 +312,26 @@
280
312
  <div class="d-form-item-ghost"></div>
281
313
  </div>
282
314
  </template>
283
-
284
- <script>
285
- import { sysFormState, sysRowState } from "../../utils/enum";
286
- import BaseInput from "../../BaseInput/index";
287
- import BaseCheckbox from "../../BaseCheckbox/index";
288
- import BaseDate from "../../BaseDate/index";
289
- import BaseDatetime from "../../BaseDatetime/index";
290
- import BaseDateWeek from "../../BaseDateWeek/index";
291
- import BaseTextArea from "../../BaseTextArea/index";
292
- import BaseButton from "../../BaseButton/index";
293
- import BaseSelect from "../../BaseSelect/index";
294
- import BaseSelectMulti from "../../BaseSelectMulti/index";
295
- import BaseTime from "../../BaseTime/index";
296
- import BasePulldown from "../../BasePulldown/index";
297
- import BaseIntervalInput from "../../BaseIntervalInput/index";
298
- import BaseNumberInput from "../../BaseNumberInput/index";
299
315
 
300
- import moment from "moment";
301
- 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'
302
335
  export default {
303
336
  components: {
304
337
  BaseInput,
@@ -315,14 +348,15 @@ export default {
315
348
  BasePulldown,
316
349
  BaseIntervalInput,
317
350
  BaseNumberInput,
351
+ BaseTreeSelect,
318
352
  },
319
- name: "BaseForm",
353
+ name: 'BaseForm',
320
354
  props: {
321
355
  updateDatas: {
322
356
  // 更新的数据
323
357
  type: Object,
324
358
  default: function () {
325
- return {};
359
+ return {}
326
360
  },
327
361
  },
328
362
  showLoading: {
@@ -338,7 +372,7 @@ export default {
338
372
  valueState: {
339
373
  type: Object,
340
374
  default: function () {
341
- return {};
375
+ return {}
342
376
  },
343
377
  },
344
378
  formState: {
@@ -349,33 +383,33 @@ export default {
349
383
  // 当前页面数据集
350
384
  type: Object,
351
385
  default: () => {
352
- return {};
386
+ return {}
353
387
  },
354
388
  },
355
389
  row: {
356
390
  // 当前行,如果是表单的话当前行和当前页面数据集是一样的
357
391
  type: Object,
358
392
  default: () => {
359
- return {};
393
+ return {}
360
394
  },
361
395
  },
362
396
  columns: {
363
397
  // 表格列信息
364
398
  type: Array,
365
399
  default: function () {
366
- return [];
400
+ return []
367
401
  },
368
402
  },
369
403
  dataName: {
370
404
  type: String,
371
405
  default: function () {
372
- return "";
406
+ return ''
373
407
  },
374
408
  },
375
409
  },
376
410
  computed: {
377
411
  internalComputedHiddenCols: function () {
378
- let vm = this;
412
+ let vm = this
379
413
  return this.columns.filter((item) => {
380
414
  // if (item.isTitle === true) {
381
415
  // // vm.titleCol = item
@@ -385,16 +419,16 @@ export default {
385
419
  // vm.logoCol = item
386
420
  // return false
387
421
  // }
388
- return item.visible === true;
389
- });
422
+ return item.visible === true
423
+ })
390
424
  },
391
425
  },
392
426
  filters: {},
393
427
  data() {
394
428
  return {
395
- hiddenDetail:false,
429
+ hiddenDetail: false,
396
430
  moment,
397
- editFormName: "",
431
+ editFormName: '',
398
432
  internalEdit: false,
399
433
  internalCols: [],
400
434
  internalValueState: {},
@@ -403,8 +437,8 @@ export default {
403
437
  titleCols: [],
404
438
  logoCol: null,
405
439
  isShowEditForm: false,
406
- ref: "",
407
- };
440
+ ref: '',
441
+ }
408
442
  },
409
443
  watch: {
410
444
  // row: {
@@ -442,41 +476,41 @@ export default {
442
476
  // this.titleCols.push(this.columns[i])
443
477
  // continue
444
478
  // }
445
- if (this.columns[i].controlType === "popup") {
479
+ if (this.columns[i].controlType === 'popup') {
446
480
  let formUrl =
447
481
  process.env[
448
- "VUE_APP_" +
482
+ 'VUE_APP_' +
449
483
  this.columns[i].linkModuleData.objectService.toUpperCase() +
450
- "_SERVICE_URL"
484
+ '_SERVICE_URL'
451
485
  ] +
452
- "/" +
486
+ '/' +
453
487
  this.columns[i].linkModuleData.objectApiVersion +
454
- "/" +
488
+ '/' +
455
489
  this.columns[i].linkModuleData.objectName +
456
- "/";
457
- this.columns[i]["api"] = this.columns[i].linkModuleData.objectApiRoute
490
+ '/'
491
+ this.columns[i]['api'] = this.columns[i].linkModuleData.objectApiRoute
458
492
  ? formUrl + this.columns[i].linkModuleData.objectApiRoute
459
- : formUrl + "Search";
493
+ : formUrl + 'Search'
460
494
 
461
- this.columns[i]["columns"] = {};
495
+ this.columns[i]['columns'] = {}
462
496
 
463
497
  for (
464
498
  let x = 0;
465
499
  x < this.columns[i].linkModuleData.moduleFields.length;
466
500
  x++
467
501
  ) {
468
- let tempField = this.columns[i].linkModuleData.moduleFields[x];
469
- this.columns[i]["columns"][tempField.field] = {
502
+ let tempField = this.columns[i].linkModuleData.moduleFields[x]
503
+ this.columns[i]['columns'][tempField.field] = {
470
504
  title: tempField.caption,
471
505
  width: tempField.width,
472
506
  visible: tempField.visible,
473
507
  linkField: tempField.linkValueField,
474
508
  filter: tempField.isFilter,
475
- };
509
+ }
476
510
  if (tempField.field === this.columns[i].linkCaptionField) {
477
- this.columns[i]["columns"][tempField.field].linkField =
478
- this.columns[i].field;
479
- 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
480
514
  }
481
515
  }
482
516
  }
@@ -494,29 +528,29 @@ export default {
494
528
  mounted() {
495
529
  //let letterLength = this.$refs.content.value
496
530
  //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
497
- window.addEventListener("beforeunload", (e) => this.beforeunloadHandler(e));
531
+ window.addEventListener('beforeunload', (e) => this.beforeunloadHandler(e))
498
532
  },
499
533
  destroyed() {
500
- window.removeEventListener("beforeunload", (e) =>
534
+ window.removeEventListener('beforeunload', (e) =>
501
535
  this.beforeunloadHandler(e)
502
- );
536
+ )
503
537
  },
504
538
  activated() {},
505
539
  methods: {
506
540
  preSearch(searchInfo, repeatRowInfo) {
507
- this.$emit("preSearch", searchInfo, repeatRowInfo);
541
+ this.$emit('preSearch', searchInfo, repeatRowInfo)
508
542
  },
509
543
  beforeunloadHandler(e) {
510
- if (this.formState !== "view") {
511
- e = e || window.event;
512
- e.returnValue = "提示";
513
- return confirm("确认退出");
544
+ if (this.formState !== 'view') {
545
+ e = e || window.event
546
+ e.returnValue = '提示'
547
+ return confirm('确认退出')
514
548
  } else {
515
- return;
549
+ return
516
550
  }
517
551
  },
518
552
  pulldownBtnClick(btnInfo) {
519
- this.$emit("pulldownBtnClick", btnInfo);
553
+ this.$emit('pulldownBtnClick', btnInfo)
520
554
  },
521
555
  showToolTip() {},
522
556
  fieldCaptionClick(col) {
@@ -531,13 +565,13 @@ export default {
531
565
  return (
532
566
  filterItem.meta &&
533
567
  filterItem.meta.moduleId === col.linkModuleData.linkModuleId
534
- );
535
- });
568
+ )
569
+ })
536
570
  if (linkModule.length > 0) {
537
571
  this.$router.pushRoute({
538
572
  name: linkModule[0].name,
539
573
  query: { id: this.row[col.field] },
540
- });
574
+ })
541
575
  }
542
576
  }
543
577
  },
@@ -554,80 +588,82 @@ export default {
554
588
  // this.row['sysRowState'] = sysRowState.update
555
589
  // },
556
590
  pullDownChange(colInfo, row) {
557
- this.$emit("change", colInfo);
591
+ this.$emit('change', colInfo)
558
592
  },
559
593
  selectMultiChange(colInfo, row) {
560
- this.$emit("change", colInfo);
594
+ this.$emit('change', colInfo)
561
595
  },
562
596
  selectChange(colInfo) {
563
- this.$emit("change", colInfo);
597
+ this.$emit('change', colInfo)
564
598
  },
565
599
  checkboxChange(colInfo) {
566
- this.$emit("change", colInfo);
600
+ this.$emit('change', colInfo)
567
601
  },
568
602
  checkBoxChange(col) {
569
- if (col.field.indexOf(".") < 0) {
570
- this.updateDatas[col.field] = this.row[col.field];
603
+ if (col.field.indexOf('.') < 0) {
604
+ this.updateDatas[col.field] = this.row[col.field]
571
605
  }
572
- this.$emit("change", col);
606
+ this.$emit('change', col)
573
607
  if (
574
- this.row["sysRowState"] === sysRowState.add ||
575
- this.row["sysRowState"] === sysRowState.update
608
+ this.row['sysRowState'] === sysRowState.add ||
609
+ this.row['sysRowState'] === sysRowState.update
576
610
  ) {
577
- return;
611
+ return
578
612
  }
579
- this.row["sysRowState"] = sysRowState.update;
613
+ this.row['sysRowState'] = sysRowState.update
580
614
  },
581
615
  dateChange(col) {
582
- if (col.field.indexOf(".") < 0) {
583
- this.updateDatas[col.field] = this.row[col.field];
616
+ if (col.field.indexOf('.') < 0) {
617
+ this.updateDatas[col.field] = this.row[col.field]
584
618
  }
585
- this.$emit("change", col);
619
+ this.$emit('change', col)
586
620
  if (
587
- this.row["sysRowState"] === sysRowState.add ||
588
- this.row["sysRowState"] === sysRowState.update
621
+ this.row['sysRowState'] === sysRowState.add ||
622
+ this.row['sysRowState'] === sysRowState.update
589
623
  ) {
590
- return;
624
+ return
591
625
  }
592
- this.row["sysRowState"] = sysRowState.update;
626
+ this.row['sysRowState'] = sysRowState.update
593
627
  },
594
628
  inputChange(colInfo) {
595
629
  // 输入框改变
596
- this.$emit("change", colInfo);
630
+ this.$emit('change', colInfo)
597
631
  },
598
632
  // 按钮弹出组件返回输入的值
599
633
  buttonHandleOk(colInfo, value) {
600
634
  // 按钮弹出确定改变内容改变
601
- this.$emit("buttonHandleOk", colInfo, value);
635
+ this.$emit('buttonHandleOk', colInfo, value)
602
636
  },
603
637
  blurChange(colInfo) {
604
638
  // 输入框失去焦点
605
- this.$emit("blur", colInfo);
639
+ this.$emit('blur', colInfo)
606
640
  },
607
641
  numberChange(colInfo) {
608
642
  // 输入框改变
609
- this.$emit("change", colInfo);
643
+ this.$emit('change', colInfo)
610
644
  },
611
645
  longtimeChange(data, col) {
612
- this.row[col.field] = data;
613
- this.$emit("change", col);
646
+ this.row[col.field] = data
647
+ this.$emit('change', col)
614
648
  if (
615
- this.row["sysRowState"] === sysRowState.add ||
616
- this.row["sysRowState"] === sysRowState.update
649
+ this.row['sysRowState'] === sysRowState.add ||
650
+ this.row['sysRowState'] === sysRowState.update
617
651
  ) {
618
- return;
652
+ return
619
653
  }
620
- this.row["sysRowState"] = sysRowState.update;
654
+ this.row['sysRowState'] = sysRowState.update
621
655
  },
622
656
  changeControlType(field, controlType) {
623
- let col = this.internalComputedHiddenCols.find(col => col.field === field)
657
+ let col = this.internalComputedHiddenCols.find(
658
+ (col) => col.field === field
659
+ )
624
660
  col.controlType = controlType
625
- }
661
+ },
626
662
  },
627
- };
663
+ }
628
664
  </script>
629
-
630
- <style lang="less" scoped>
665
+
666
+ <style lang="less" scoped>
631
667
  .form-head {
632
668
  display: flex;
633
669
  flex-flow: row wrap;
@@ -685,7 +721,6 @@ export default {
685
721
  margin-left: 30px;
686
722
  }
687
723
  </style>
688
- <style lang="less">
689
- @import "../../styles/default.less";
724
+ <style lang="less">
725
+ @import '../../styles/default.less';
690
726
  </style>
691
-
@@ -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',