doway-coms 1.9.3 → 1.9.5

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.5",
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,39 @@
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
+ :linkedTitle="col.linkedTitle"
301
+ :method="col.method"
302
+ v-model="row[col.field]"
303
+ @change="
304
+ () => {
305
+ inputChange(col)
273
306
  }
274
307
  "
275
308
  />
@@ -280,25 +313,26 @@
280
313
  <div class="d-form-item-ghost"></div>
281
314
  </div>
282
315
  </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
316
 
300
- import moment from "moment";
301
- import BaseDateMonth from "../../BaseDateMonth";
317
+ <script>
318
+ import { sysFormState, sysRowState } from '../../utils/enum'
319
+ import BaseInput from '../../BaseInput/index'
320
+ import BaseCheckbox from '../../BaseCheckbox/index'
321
+ import BaseDate from '../../BaseDate/index'
322
+ import BaseDatetime from '../../BaseDatetime/index'
323
+ import BaseDateWeek from '../../BaseDateWeek/index'
324
+ import BaseTextArea from '../../BaseTextArea/index'
325
+ import BaseButton from '../../BaseButton/index'
326
+ import BaseSelect from '../../BaseSelect/index'
327
+ import BaseSelectMulti from '../../BaseSelectMulti/index'
328
+ import BaseTime from '../../BaseTime/index'
329
+ import BasePulldown from '../../BasePulldown/index'
330
+ import BaseIntervalInput from '../../BaseIntervalInput/index'
331
+ import BaseNumberInput from '../../BaseNumberInput/index'
332
+ import BaseTreeSelect from '../../BaseTreeSelect'
333
+
334
+ import moment from 'moment'
335
+ import BaseDateMonth from '../../BaseDateMonth'
302
336
  export default {
303
337
  components: {
304
338
  BaseInput,
@@ -315,14 +349,15 @@ export default {
315
349
  BasePulldown,
316
350
  BaseIntervalInput,
317
351
  BaseNumberInput,
352
+ BaseTreeSelect,
318
353
  },
319
- name: "BaseForm",
354
+ name: 'BaseForm',
320
355
  props: {
321
356
  updateDatas: {
322
357
  // 更新的数据
323
358
  type: Object,
324
359
  default: function () {
325
- return {};
360
+ return {}
326
361
  },
327
362
  },
328
363
  showLoading: {
@@ -338,7 +373,7 @@ export default {
338
373
  valueState: {
339
374
  type: Object,
340
375
  default: function () {
341
- return {};
376
+ return {}
342
377
  },
343
378
  },
344
379
  formState: {
@@ -349,33 +384,33 @@ export default {
349
384
  // 当前页面数据集
350
385
  type: Object,
351
386
  default: () => {
352
- return {};
387
+ return {}
353
388
  },
354
389
  },
355
390
  row: {
356
391
  // 当前行,如果是表单的话当前行和当前页面数据集是一样的
357
392
  type: Object,
358
393
  default: () => {
359
- return {};
394
+ return {}
360
395
  },
361
396
  },
362
397
  columns: {
363
398
  // 表格列信息
364
399
  type: Array,
365
400
  default: function () {
366
- return [];
401
+ return []
367
402
  },
368
403
  },
369
404
  dataName: {
370
405
  type: String,
371
406
  default: function () {
372
- return "";
407
+ return ''
373
408
  },
374
409
  },
375
410
  },
376
411
  computed: {
377
412
  internalComputedHiddenCols: function () {
378
- let vm = this;
413
+ let vm = this
379
414
  return this.columns.filter((item) => {
380
415
  // if (item.isTitle === true) {
381
416
  // // vm.titleCol = item
@@ -385,16 +420,16 @@ export default {
385
420
  // vm.logoCol = item
386
421
  // return false
387
422
  // }
388
- return item.visible === true;
389
- });
423
+ return item.visible === true
424
+ })
390
425
  },
391
426
  },
392
427
  filters: {},
393
428
  data() {
394
429
  return {
395
- hiddenDetail:false,
430
+ hiddenDetail: false,
396
431
  moment,
397
- editFormName: "",
432
+ editFormName: '',
398
433
  internalEdit: false,
399
434
  internalCols: [],
400
435
  internalValueState: {},
@@ -403,8 +438,8 @@ export default {
403
438
  titleCols: [],
404
439
  logoCol: null,
405
440
  isShowEditForm: false,
406
- ref: "",
407
- };
441
+ ref: '',
442
+ }
408
443
  },
409
444
  watch: {
410
445
  // row: {
@@ -442,41 +477,41 @@ export default {
442
477
  // this.titleCols.push(this.columns[i])
443
478
  // continue
444
479
  // }
445
- if (this.columns[i].controlType === "popup") {
480
+ if (this.columns[i].controlType === 'popup') {
446
481
  let formUrl =
447
482
  process.env[
448
- "VUE_APP_" +
483
+ 'VUE_APP_' +
449
484
  this.columns[i].linkModuleData.objectService.toUpperCase() +
450
- "_SERVICE_URL"
485
+ '_SERVICE_URL'
451
486
  ] +
452
- "/" +
487
+ '/' +
453
488
  this.columns[i].linkModuleData.objectApiVersion +
454
- "/" +
489
+ '/' +
455
490
  this.columns[i].linkModuleData.objectName +
456
- "/";
457
- this.columns[i]["api"] = this.columns[i].linkModuleData.objectApiRoute
491
+ '/'
492
+ this.columns[i]['api'] = this.columns[i].linkModuleData.objectApiRoute
458
493
  ? formUrl + this.columns[i].linkModuleData.objectApiRoute
459
- : formUrl + "Search";
494
+ : formUrl + 'Search'
460
495
 
461
- this.columns[i]["columns"] = {};
496
+ this.columns[i]['columns'] = {}
462
497
 
463
498
  for (
464
499
  let x = 0;
465
500
  x < this.columns[i].linkModuleData.moduleFields.length;
466
501
  x++
467
502
  ) {
468
- let tempField = this.columns[i].linkModuleData.moduleFields[x];
469
- this.columns[i]["columns"][tempField.field] = {
503
+ let tempField = this.columns[i].linkModuleData.moduleFields[x]
504
+ this.columns[i]['columns'][tempField.field] = {
470
505
  title: tempField.caption,
471
506
  width: tempField.width,
472
507
  visible: tempField.visible,
473
508
  linkField: tempField.linkValueField,
474
509
  filter: tempField.isFilter,
475
- };
510
+ }
476
511
  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;
512
+ this.columns[i]['columns'][tempField.field].linkField =
513
+ this.columns[i].field
514
+ this.columns[i]['columns'][tempField.field].filter = true
480
515
  }
481
516
  }
482
517
  }
@@ -494,29 +529,29 @@ export default {
494
529
  mounted() {
495
530
  //let letterLength = this.$refs.content.value
496
531
  //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
497
- window.addEventListener("beforeunload", (e) => this.beforeunloadHandler(e));
532
+ window.addEventListener('beforeunload', (e) => this.beforeunloadHandler(e))
498
533
  },
499
534
  destroyed() {
500
- window.removeEventListener("beforeunload", (e) =>
535
+ window.removeEventListener('beforeunload', (e) =>
501
536
  this.beforeunloadHandler(e)
502
- );
537
+ )
503
538
  },
504
539
  activated() {},
505
540
  methods: {
506
541
  preSearch(searchInfo, repeatRowInfo) {
507
- this.$emit("preSearch", searchInfo, repeatRowInfo);
542
+ this.$emit('preSearch', searchInfo, repeatRowInfo)
508
543
  },
509
544
  beforeunloadHandler(e) {
510
- if (this.formState !== "view") {
511
- e = e || window.event;
512
- e.returnValue = "提示";
513
- return confirm("确认退出");
545
+ if (this.formState !== 'view') {
546
+ e = e || window.event
547
+ e.returnValue = '提示'
548
+ return confirm('确认退出')
514
549
  } else {
515
- return;
550
+ return
516
551
  }
517
552
  },
518
553
  pulldownBtnClick(btnInfo) {
519
- this.$emit("pulldownBtnClick", btnInfo);
554
+ this.$emit('pulldownBtnClick', btnInfo)
520
555
  },
521
556
  showToolTip() {},
522
557
  fieldCaptionClick(col) {
@@ -531,13 +566,13 @@ export default {
531
566
  return (
532
567
  filterItem.meta &&
533
568
  filterItem.meta.moduleId === col.linkModuleData.linkModuleId
534
- );
535
- });
569
+ )
570
+ })
536
571
  if (linkModule.length > 0) {
537
572
  this.$router.pushRoute({
538
573
  name: linkModule[0].name,
539
574
  query: { id: this.row[col.field] },
540
- });
575
+ })
541
576
  }
542
577
  }
543
578
  },
@@ -554,80 +589,82 @@ export default {
554
589
  // this.row['sysRowState'] = sysRowState.update
555
590
  // },
556
591
  pullDownChange(colInfo, row) {
557
- this.$emit("change", colInfo);
592
+ this.$emit('change', colInfo)
558
593
  },
559
594
  selectMultiChange(colInfo, row) {
560
- this.$emit("change", colInfo);
595
+ this.$emit('change', colInfo)
561
596
  },
562
597
  selectChange(colInfo) {
563
- this.$emit("change", colInfo);
598
+ this.$emit('change', colInfo)
564
599
  },
565
600
  checkboxChange(colInfo) {
566
- this.$emit("change", colInfo);
601
+ this.$emit('change', colInfo)
567
602
  },
568
603
  checkBoxChange(col) {
569
- if (col.field.indexOf(".") < 0) {
570
- this.updateDatas[col.field] = this.row[col.field];
604
+ if (col.field.indexOf('.') < 0) {
605
+ this.updateDatas[col.field] = this.row[col.field]
571
606
  }
572
- this.$emit("change", col);
607
+ this.$emit('change', col)
573
608
  if (
574
- this.row["sysRowState"] === sysRowState.add ||
575
- this.row["sysRowState"] === sysRowState.update
609
+ this.row['sysRowState'] === sysRowState.add ||
610
+ this.row['sysRowState'] === sysRowState.update
576
611
  ) {
577
- return;
612
+ return
578
613
  }
579
- this.row["sysRowState"] = sysRowState.update;
614
+ this.row['sysRowState'] = sysRowState.update
580
615
  },
581
616
  dateChange(col) {
582
- if (col.field.indexOf(".") < 0) {
583
- this.updateDatas[col.field] = this.row[col.field];
617
+ if (col.field.indexOf('.') < 0) {
618
+ this.updateDatas[col.field] = this.row[col.field]
584
619
  }
585
- this.$emit("change", col);
620
+ this.$emit('change', col)
586
621
  if (
587
- this.row["sysRowState"] === sysRowState.add ||
588
- this.row["sysRowState"] === sysRowState.update
622
+ this.row['sysRowState'] === sysRowState.add ||
623
+ this.row['sysRowState'] === sysRowState.update
589
624
  ) {
590
- return;
625
+ return
591
626
  }
592
- this.row["sysRowState"] = sysRowState.update;
627
+ this.row['sysRowState'] = sysRowState.update
593
628
  },
594
629
  inputChange(colInfo) {
595
630
  // 输入框改变
596
- this.$emit("change", colInfo);
631
+ this.$emit('change', colInfo)
597
632
  },
598
633
  // 按钮弹出组件返回输入的值
599
634
  buttonHandleOk(colInfo, value) {
600
635
  // 按钮弹出确定改变内容改变
601
- this.$emit("buttonHandleOk", colInfo, value);
636
+ this.$emit('buttonHandleOk', colInfo, value)
602
637
  },
603
638
  blurChange(colInfo) {
604
639
  // 输入框失去焦点
605
- this.$emit("blur", colInfo);
640
+ this.$emit('blur', colInfo)
606
641
  },
607
642
  numberChange(colInfo) {
608
643
  // 输入框改变
609
- this.$emit("change", colInfo);
644
+ this.$emit('change', colInfo)
610
645
  },
611
646
  longtimeChange(data, col) {
612
- this.row[col.field] = data;
613
- this.$emit("change", col);
647
+ this.row[col.field] = data
648
+ this.$emit('change', col)
614
649
  if (
615
- this.row["sysRowState"] === sysRowState.add ||
616
- this.row["sysRowState"] === sysRowState.update
650
+ this.row['sysRowState'] === sysRowState.add ||
651
+ this.row['sysRowState'] === sysRowState.update
617
652
  ) {
618
- return;
653
+ return
619
654
  }
620
- this.row["sysRowState"] = sysRowState.update;
655
+ this.row['sysRowState'] = sysRowState.update
621
656
  },
622
657
  changeControlType(field, controlType) {
623
- let col = this.internalComputedHiddenCols.find(col => col.field === field)
658
+ let col = this.internalComputedHiddenCols.find(
659
+ (col) => col.field === field
660
+ )
624
661
  col.controlType = controlType
625
- }
662
+ },
626
663
  },
627
- };
664
+ }
628
665
  </script>
629
-
630
- <style lang="less" scoped>
666
+
667
+ <style lang="less" scoped>
631
668
  .form-head {
632
669
  display: flex;
633
670
  flex-flow: row wrap;
@@ -685,7 +722,6 @@ export default {
685
722
  margin-left: 30px;
686
723
  }
687
724
  </style>
688
- <style lang="less">
689
- @import "../../styles/default.less";
725
+ <style lang="less">
726
+ @import '../../styles/default.less';
690
727
  </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,400 @@
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 XEUtils from 'xe-utils'
69
+ import { ValidationProvider } from 'vee-validate'
70
+ export default {
71
+ name: 'BaseTreeSelect',
72
+ components: {
73
+ Tooltip,
74
+ TreeSelect,
75
+ ValidationProvider,
76
+ },
77
+ props: {
78
+ label: {
79
+ type: String,
80
+ },
81
+ showLabel: {
82
+ type: Boolean,
83
+ default: function () {
84
+ return true
85
+ },
86
+ },
87
+ labelWidth: {
88
+ type: Number,
89
+ default: function () {
90
+ return 100
91
+ },
92
+ },
93
+ api: {
94
+ type: String,
95
+ required: true,
96
+ },
97
+ exps: {
98
+ // 条件
99
+ type: Array,
100
+ default: () => {
101
+ return []
102
+ },
103
+ },
104
+ value: {
105
+ type: String,
106
+ default: function () {
107
+ return ''
108
+ },
109
+ },
110
+ tooltip: {
111
+ type: String,
112
+ default: function () {
113
+ return ''
114
+ },
115
+ },
116
+ customTitle: {
117
+ type: Array,
118
+ default: function () {
119
+ return []
120
+ },
121
+ },
122
+ // 输入框宽度
123
+ width: {
124
+ type: Number,
125
+ default: function () {
126
+ return 100
127
+ },
128
+ },
129
+ // 树宽度
130
+ treeWidth: {
131
+ type: Number,
132
+ default: function () {
133
+ return 200
134
+ },
135
+ },
136
+ // 输入框和选择器同宽
137
+ dropdownMatchSelectWidth: {
138
+ type: Boolean,
139
+ default: function () {
140
+ return false
141
+ },
142
+ },
143
+ // 替换展示字段
144
+ replaceFields: {
145
+ type: Object,
146
+ default: function () {
147
+ return {
148
+ children: 'children',
149
+ title: 'title',
150
+ key: 'key',
151
+ value: 'value',
152
+ }
153
+ },
154
+ },
155
+ // 是否默认展开所有树节点
156
+ treeDefaultExpandAll: {
157
+ type: Boolean,
158
+ default: function () {
159
+ return false
160
+ },
161
+ },
162
+ size: {
163
+ type: String,
164
+ default: function () {
165
+ return 'small'
166
+ },
167
+ },
168
+ // 下拉中显示搜索框
169
+ showSearch: {
170
+ type: Boolean,
171
+ default: function () {
172
+ return true
173
+ },
174
+ },
175
+ // 下拉菜单的样式
176
+ widthDropdownStyle: {
177
+ type: Object,
178
+ default: function () {
179
+ return {}
180
+ },
181
+ },
182
+ // 清除按钮
183
+ allowClear: {
184
+ type: Boolean,
185
+ default: function () {
186
+ return true
187
+ },
188
+ },
189
+ placeholder: {
190
+ type: String,
191
+ default: function () {
192
+ return ''
193
+ },
194
+ },
195
+ rules: {
196
+ type: Object,
197
+ default: function () {
198
+ return null
199
+ },
200
+ },
201
+ formRow: {
202
+ type: Object,
203
+ default: function () {
204
+ return {}
205
+ },
206
+ },
207
+ row: {
208
+ type: Object,
209
+ default: function () {
210
+ return {}
211
+ },
212
+ },
213
+ edit: {
214
+ type: Boolean,
215
+ default: function () {
216
+ return false
217
+ },
218
+ },
219
+ field: {
220
+ type: String,
221
+ },
222
+ columns: {
223
+ // 列集合
224
+ type: Array,
225
+ default: () => {
226
+ return []
227
+ },
228
+ },
229
+ propTableData: {
230
+ type: Array,
231
+ default: function () {
232
+ return []
233
+ },
234
+ },
235
+ linkedField: {
236
+ type: String,
237
+ required: true,
238
+ },
239
+ linkedTitle: {
240
+ type: [],
241
+ default: function () {
242
+ return []
243
+ },
244
+ },
245
+ method: {
246
+ type: String,
247
+ default: function () {
248
+ return 'post'
249
+ },
250
+ },
251
+ route: Object,
252
+ },
253
+ data() {
254
+ return {
255
+ treeData: [],
256
+ currentValue: '',
257
+ }
258
+ },
259
+ mounted() {
260
+ // this.searchData()
261
+
262
+ if (this.treeData.length) {
263
+ this.currentValue = this.row[this.linkedField]
264
+ } else {
265
+ this.currentValue = this.value
266
+ }
267
+ },
268
+ watch: {
269
+ treeData(val) {
270
+ if (this.treeData.length) {
271
+ this.currentValue = this.row[this.linkedField]
272
+ } else {
273
+ this.currentValue = this.value
274
+ }
275
+ },
276
+ },
277
+ computed: {},
278
+ methods: {
279
+ /**
280
+ * 查询数据
281
+ */
282
+ searchData() {
283
+ let tempExp = {
284
+ operator: 'or',
285
+ expressions: [],
286
+ }
287
+
288
+ let postExpression = {
289
+ field: this.field,
290
+ expression: tempExp,
291
+ extendParams: {},
292
+ }
293
+ let repeatRowInfo = {
294
+ field: '',
295
+ values: [],
296
+ }
297
+ //查询之前从外部组件构造其他的条件
298
+ this.$emit('preSearch', postExpression, repeatRowInfo, this.row)
299
+ let postData = {
300
+ begin: 1,
301
+ size: 0,
302
+ expression: postExpression.expression,
303
+ sorts: [],
304
+ extendParams: postExpression.extendParams,
305
+ }
306
+ let tempApi = this.getPostApi(postData)
307
+ let vm = this
308
+ vm.gridLoading = true
309
+ request({
310
+ url: tempApi,
311
+ method: this.method,
312
+ data: postData,
313
+ })
314
+ .then((responseData) => {
315
+ vm.treeData = responseData.content
316
+ if (this.linkedTitle.length) {
317
+ XEUtils.eachTree(vm.treeData, (item) => {
318
+ let title = ''
319
+ XEUtils.arrayEach(this.linkedTitle, (newTitle) => {
320
+ title = title + item[newTitle] + '-'
321
+ })
322
+ item[this.replaceFields.title] = title.slice(0, -1)
323
+ })
324
+ }
325
+ })
326
+ .catch((error) => {
327
+ console.error(error)
328
+ })
329
+ .finally(() => {
330
+ vm.gridLoading = false
331
+ })
332
+ },
333
+ getPostApi(postData) {
334
+ let tempApi = this.api
335
+ if (this.api.indexOf('?') > 0) {
336
+ tempApi = this.api.substring(0, this.api.indexOf('?'))
337
+ let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
338
+ tempExtenParams = replaceParam(tempExtenParams, this.formRow)
339
+ let tempSplitParams = tempExtenParams.split('&')
340
+ for (let i = 0; i < tempSplitParams.length; i++) {
341
+ let tempSplitValue = tempSplitParams[i].split('=')
342
+ this.$set(postData.extendParams, tempSplitValue[0], tempSplitValue[1])
343
+ }
344
+ }
345
+ return tempApi
346
+ },
347
+ routeLinkClick() {
348
+ //首先需要判断是否有权限
349
+ this.$router.pushRoute({
350
+ name: this.route.name,
351
+ query: { id: this.row[this.route.field] },
352
+ })
353
+ },
354
+ selectData(value, node) {
355
+ // this.row[this.linkedField] = value
356
+ // this.row[this.field] = node.title
357
+ this.$set(this.row, this.linkedField, value)
358
+ this.$set(this.row, this.field, node.title)
359
+ },
360
+ },
361
+ }
362
+ </script>
363
+
364
+ <style lang="scss" scoped>
365
+ // ::v-deep .ant-select-tree-dropdown::-webkit-scrollbar {
366
+ // width: 5px;
367
+ // }
368
+ // ::v-deep .ant-select-tree-dropdown::-webkit-scrollbar-thumb {
369
+ // /*滚动条里面小方块*/
370
+ // border-radius: 10px;
371
+ // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
372
+ // background: #e5e5e5;
373
+ // }
374
+ // ::v-deep .ant-select-tree-dropdown::-webkit-scrollbar-track {
375
+ // /*滚动条里面轨道*/
376
+ // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
377
+ // border-radius: 10px;
378
+ // background: #ffffff;
379
+ // }
380
+ .pulldown-grid {
381
+ min-width: 600px;
382
+ width: auto;
383
+ height: 350px;
384
+ background-color: #fff;
385
+ box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
386
+ }
387
+
388
+ .d-grid-control {
389
+ height: 30px;
390
+ }
391
+ .interceptor-class {
392
+ padding: 10px;
393
+ ::v-deep .ant-btn {
394
+ margin: 10px 10px 0;
395
+ }
396
+ }
397
+ </style>
398
+ <style lang="less">
399
+ @import '../../styles/default.less';
400
+ </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',