bri-components 1.3.57 → 1.3.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <div class="DshFlatTable">
3
- <!-- 操作按钮 -->
4
- <dsh-buttons
5
- class="DshFlatTable-btns"
6
- itemClass="DshFlatTable-btns-item"
7
- :list="$getOperationList(topOperationBtns)"
8
- @click="$dispatchEvent($event)"
9
- ></dsh-buttons>
3
+ <!-- 顶部 -->
4
+ <dsh-render :render="getTableTopRender()"></dsh-render>
5
+
6
+ <!-- 搜索条件 -->
7
+ <dsh-render
8
+ v-if="!this.isEnlarge"
9
+ :render="topSearchRender"
10
+ ></dsh-render>
10
11
 
11
12
  <!-- 表格 -->
12
13
  <bri-table
@@ -20,19 +21,25 @@
20
21
  ></bri-table>
21
22
 
22
23
  <!-- 添加行 -->
23
- <dsh-buttons
24
- class="DshFlatTable-create"
25
- :list="$getOperationList(['canCreate'])"
26
- @click="$dispatchEvent($event, null, null, allListData)"
27
- ></dsh-buttons>
24
+ <dsh-render :render="createOperationRender"></dsh-render>
28
25
 
29
- <!-- 全屏查看 -->
26
+ <!-- 全屏模式 -->
30
27
  <dsh-modal
28
+ class="DshFlatTable-fullscreen"
31
29
  v-model="isEnlarge"
32
30
  :mode="modalPropsObj.mode"
33
31
  :propsObj="modalPropsObj"
34
32
  >
35
- <template v-if="isEnlargeFlag">
33
+ <div
34
+ v-if="isEnlargeFlag"
35
+ class="DshFlatTable-fullscreen-inner"
36
+ >
37
+ <!-- 顶部 -->
38
+ <dsh-render :render="getTableTopRender(true)"></dsh-render>
39
+
40
+ <!-- 搜索条件 -->
41
+ <dsh-render :render="topSearchRender"></dsh-render>
42
+
36
43
  <!-- 表格 -->
37
44
  <bri-table
38
45
  class="DshFlatTable-main"
@@ -45,29 +52,18 @@
45
52
  ></bri-table>
46
53
 
47
54
  <!-- 添加行 -->
48
- <dsh-buttons
49
- class="DshFlatTable-create"
50
- :list="$getOperationList(['canCreate'])"
51
- @click="$dispatchEvent($event, null, null, allListData)"
52
- ></dsh-buttons>
53
- </template>
55
+ <dsh-render :render="createOperationRender"></dsh-render>
56
+ </div>
54
57
  </dsh-modal>
55
58
 
56
- <!-- 导入模态框 -->
57
- <flat-table-import-modal
58
- v-if="showImportModal"
59
- v-model="showImportModal"
60
- :propsObj="propsObj"
61
- :importParams="importParams"
62
- @importCb="importCb"
63
- ></flat-table-import-modal>
59
+ <!-- 各种模态框共用 -->
60
+ <dsh-render :render="dshRender"></dsh-render>
64
61
  </div>
65
62
  </template>
66
63
 
67
64
  <script>
68
65
  import tableBaseMixin from "./mixins/tableBaseMixin.js";
69
66
  import flatTableMixin from "./mixins/flatTableMixin.js";
70
- import flatTableImportModal from "./common/flatTableImportModal.vue";
71
67
 
72
68
  export default {
73
69
  name: "DshFlatTable",
@@ -75,9 +71,7 @@
75
71
  tableBaseMixin,
76
72
  flatTableMixin
77
73
  ],
78
- components: {
79
- flatTableImportModal
80
- },
74
+ components: {},
81
75
  props: {},
82
76
  data () {
83
77
  return {};
@@ -90,23 +84,16 @@
90
84
 
91
85
  <style lang="less" scoped>
92
86
  .DshFlatTable {
93
- &-btns {
94
- margin-bottom: 3px;
95
- text-align: right;
96
- color: @textColor;
97
-
98
- &-item {
99
-
100
- }
101
- }
102
87
 
103
88
  &-main {
104
89
  width: 100%;
105
90
  height: auto;
106
91
  }
107
92
 
108
- &-create {
109
- margin-top: 3px;
93
+ &-fullscreen {
94
+ &-inner {
95
+ padding: 10px 20px;
96
+ }
110
97
  }
111
98
  }
112
99
  </style>
@@ -1,38 +1,13 @@
1
1
  <template>
2
2
  <div class="DshTreeTable">
3
- <div class="DshTreeTable-top">
4
- <div class="DshTreeTable-top-status">
5
- <span class="summary">{{ rowsNumStr }};</span>
6
-
7
- <div
8
- v-if="searchFormList.length"
9
- class="logic"
10
- >
11
- <div class="logic-title">{{ selfLogicPropsObj._name }}:</div>
12
- <dsh-select
13
- class="logic-option"
14
- :value="dftAdvSearch"
15
- :propsObj="selfLogicPropsObj"
16
- ></dsh-select>
17
- </div>
18
- </div>
19
-
20
- <dsh-buttons
21
- class="DshTreeTable-top-btns"
22
- itemClass="DshTreeTable-top-btns-item"
23
- :list="$getOperationList(topOperationBtns)"
24
- @click="$dispatchEvent($event)"
25
- ></dsh-buttons>
26
- </div>
3
+ <!-- 顶部 -->
4
+ <dsh-render :render="getTableTopRender()"></dsh-render>
27
5
 
28
6
  <!-- 搜索条件 -->
29
- <dsh-default-search
30
- v-if="searchFormList.length && !isEnlarge"
31
- :formList="searchFormList"
32
- :initValue="dftAdvSearch.conditions"
33
- :labelWidth="searchLabelWidth"
34
- @change="searchCb"
35
- ></dsh-default-search>
7
+ <dsh-render
8
+ v-if="!this.isEnlarge"
9
+ :render="topSearchRender"
10
+ ></dsh-render>
36
11
 
37
12
  <!-- 表格 -->
38
13
  <bri-table
@@ -46,12 +21,7 @@
46
21
  ></bri-table>
47
22
 
48
23
  <!-- 添加行 -->
49
- <dsh-buttons
50
- v-if="!isSearching"
51
- class="DshTreeTable-create"
52
- :list="$getOperationList(['canCreate'])"
53
- @click="$dispatchEvent($event)"
54
- ></dsh-buttons>
24
+ <dsh-render :render="createOperationRender"></dsh-render>
55
25
 
56
26
  <!-- 全屏模式 -->
57
27
  <dsh-modal
@@ -64,33 +34,11 @@
64
34
  v-if="isEnlargeFlag"
65
35
  class="DshTreeTable-fullscreen-inner"
66
36
  >
67
- <div class="DshTreeTable-top">
68
- <div class="DshTreeTable-top-status">
69
- <span class="summary">{{ rowsNumStr }};</span>
70
-
71
- <div
72
- v-if="searchFormList.length"
73
- class="logic"
74
- >
75
- <div class="logic-title">{{ selfLogicPropsObj._name }}:</div>
76
- <dsh-select
77
- class="logic-option"
78
- :value="dftAdvSearch"
79
- :propsObj="selfLogicPropsObj"
80
- ></dsh-select>
81
- </div>
82
- </div>
83
- </div>
37
+ <!-- 顶部 -->
38
+ <dsh-render :render="getTableTopRender(true)"></dsh-render>
84
39
 
85
40
  <!-- 搜索条件 -->
86
- <template v-if="searchFormList.length">
87
- <dsh-default-search
88
- :formList="searchFormList"
89
- :initValue="dftAdvSearch.conditions"
90
- :labelWidth="searchLabelWidth"
91
- @change="searchCb"
92
- ></dsh-default-search>
93
- </template>
41
+ <dsh-render :render="topSearchRender"></dsh-render>
94
42
 
95
43
  <!-- 表格 -->
96
44
  <bri-table
@@ -104,11 +52,7 @@
104
52
  ></bri-table>
105
53
 
106
54
  <!-- 添加行 -->
107
- <dsh-buttons
108
- class="DshTreeTable-create"
109
- :list="$getOperationList(['canCreate'])"
110
- @click="$dispatchEvent($event)"
111
- ></dsh-buttons>
55
+ <dsh-render :render="createOperationRender"></dsh-render>
112
56
  </div>
113
57
  </dsh-modal>
114
58
 
@@ -153,39 +97,9 @@
153
97
  return this.getCalcuedTree(this.data, this.columns);
154
98
  },
155
99
  allListData () {
100
+ console.log("allListData");
156
101
  return this.$getTreeFlatArr(this.allTreeData);
157
102
  },
158
- renderedListData () {
159
- return this.allListData.filter(row => {
160
- if (this.isSearching) {
161
- const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
162
-
163
- // 重置
164
- row.__isSearchShow__ = false;
165
- if (bool) {
166
- row.__isRendered__ = true;
167
- row.__isSearchShow__ = true;
168
- }
169
-
170
- return bool || row.__isRendered__;
171
- } else {
172
- return row.__isRendered__;
173
- }
174
- });
175
- },
176
- showListData () {
177
- return this.renderedListData.filter(row =>
178
- this.isSearching ? !!row.__isSearchShow__ : !!row.__isShow__
179
- );
180
- },
181
- rowsNum () {
182
- return this.isSearching
183
- ? this.showListData.length
184
- : this.allListData.length;
185
- },
186
- rowsNumStr () {
187
- return `当前范围“${this.isSearching ? "筛选" : "全部"}”, 共 ${this.rowsNum} 行`;
188
- },
189
103
  footerData () {
190
104
  console.log("footerData");
191
105
  return this.isSearching
@@ -576,58 +490,12 @@
576
490
 
577
491
  <style lang="less" scoped>
578
492
  .DshTreeTable {
579
- &-top {
580
- margin-bottom: 3px;
581
- display: flex;
582
- flex-direction: row;
583
- justify-content: space-between;
584
- align-items: center;
585
-
586
- &-status {
587
- display: flex;
588
- flex-direction: row;
589
- align-items: center;
590
-
591
- .summary {
592
- font-weight: 500;
593
- }
594
-
595
- .logic {
596
- display: flex;
597
- flex-direction: row;
598
- align-items: center;
599
- margin-left: 16px;
600
-
601
- &-title {
602
-
603
- }
604
-
605
- &-option {
606
- margin-left: 8px;
607
- margin-top: -4px;
608
- }
609
- }
610
- }
611
-
612
- &-btns {
613
- text-align: right;
614
- color: @textColor;
615
-
616
- &-item {
617
-
618
- }
619
- }
620
- }
621
493
 
622
494
  &-main {
623
495
  width: 100%;
624
496
  height: auto;
625
497
  }
626
498
 
627
- &-create {
628
- margin-top: 3px;
629
- }
630
-
631
499
  &-fullscreen {
632
500
  &-inner {
633
501
  padding: 10px 20px;
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="flatTableImportModal">
2
+ <div class="importModal">
3
3
  <dsh-modal
4
- class="flatTableImportModal-modal"
4
+ class="importModal-modal"
5
5
  v-model="showModal"
6
6
  :mode="modalPropsObj.mode"
7
7
  :propsObj="modalPropsObj"
@@ -34,10 +34,10 @@
34
34
  </Upload>
35
35
 
36
36
  <div v-if="file !== null">
37
- <div class="flatTableImportModal-file">
37
+ <div class="importModal-file">
38
38
  <span>文件名称: {{ file.name }}</span>
39
39
  <Icon
40
- class="flatTableImportModal-file-cancel"
40
+ class="importModal-file-cancel"
41
41
  type="ios-close"
42
42
  @click="cacelUpload"
43
43
  />
@@ -75,7 +75,7 @@
75
75
 
76
76
  <script>
77
77
  export default {
78
- name: "flatTableImportModal",
78
+ name: "importModal",
79
79
  props: {
80
80
  value: {
81
81
  type: Boolean,
@@ -237,7 +237,7 @@
237
237
  </script>
238
238
 
239
239
  <style lang="less">
240
- .flatTableImportModal {
240
+ .importModal {
241
241
 
242
242
  }
243
243
  </style>
@@ -9,10 +9,6 @@ export default {
9
9
  }
10
10
  }
11
11
  },
12
- model: {
13
- prop: "data",
14
- event: "change"
15
- },
16
12
  data () {
17
13
  return {};
18
14
  },
@@ -121,7 +117,8 @@ export default {
121
117
  created () { },
122
118
  methods: {
123
119
  // 点击 -添加行
124
- clickCreate (operationItem, row, rowIndex, list) {
120
+ clickCreate (operationItem, row, rowIndex) {
121
+ const list = this.allListData;
125
122
  const newRow = {
126
123
  ...this.$deepCopy(this.selfRowDefault),
127
124
  _id: this.$ObjectID().str
@@ -1,10 +1,12 @@
1
1
  import DshListUnit from "../../unit/DshListUnit.vue";
2
+ import importModal from "../common/importModal.vue";
2
3
  import quoteListModal from "../common/quoteListModal.vue";
3
4
 
4
5
  export default {
5
6
  mixins: [],
6
7
  components: {
7
8
  DshListUnit,
9
+ importModal,
8
10
  quoteListModal
9
11
  },
10
12
  props: {
@@ -298,7 +300,42 @@ export default {
298
300
  isSearching () {
299
301
  return this.$isAdvSearching(this.finalTableAdvSearch);
300
302
  },
303
+ rowsNum () {
304
+ return this.showListData.length;
305
+ },
306
+ rowsNumStr () {
307
+ return `当前“${this.isSearching ? "筛选" : "全部"}”范围, 共 ${this.rowsNum} 行`;
308
+ },
309
+
310
+ showListData () {
311
+ console.log("showListData");
312
+ return this.allListData.filter(row => {
313
+ if (this.isSearching) {
314
+ const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
315
+
316
+ // 重置
317
+ row.__isSearchShow__ = false;
318
+ if (bool) {
319
+ row.__isRendered__ = true;
320
+ row.__isSearchShow__ = true;
321
+ }
301
322
 
323
+ return bool;
324
+ } else {
325
+ return true;
326
+ }
327
+ });
328
+ },
329
+ renderedListData () {
330
+ console.log("renderedListData");
331
+ return this.allListData.filter(row =>
332
+ row.__isRendered__ || (
333
+ this.isSearching
334
+ ? this.$isAdvRelyAccord(this.finalTableAdvSearch, row)
335
+ : false
336
+ )
337
+ );
338
+ },
302
339
  parentDataId () {
303
340
  return this.parentObj._id;
304
341
  },
@@ -347,7 +384,11 @@ export default {
347
384
  quoteParams () {
348
385
  return {
349
386
  screenKey: this.allScreenKey,
350
- fields: [...this.quoteListFields, this.controlKey, "createdAt"],
387
+ fields: [
388
+ ...this.quoteListFields,
389
+ this.controlKey,
390
+ "createdAt"
391
+ ],
351
392
  advSearch: {
352
393
  logic: "and",
353
394
  conditions: [
@@ -369,6 +410,7 @@ export default {
369
410
  },
370
411
 
371
412
  filterColumns () {
413
+ console.log("filterColumns");
372
414
  return this.columns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
373
415
  },
374
416
  contentColumns () {
@@ -501,7 +543,7 @@ export default {
501
543
  methods: {
502
544
  baseInit () {
503
545
  this.dftAdvSearch = {
504
- logic: this.tableAdvSearch.logic || "and",
546
+ logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
505
547
  conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
506
548
  this.searchListFields.includes(conditionItem.fieldKey)
507
549
  )
@@ -534,24 +576,17 @@ export default {
534
576
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
535
577
  this.change("changeVal", col, row, rowIndex, ...params);
536
578
  },
537
- // 点击引用
538
- clickQuote () {
539
- this.dshRenderName = "quoteModalRender";
540
- this.showQuoteModal = true;
541
- },
542
- // 点击导入
543
- clickImport () {
544
- this.showImportModal = true;
545
- },
546
- // 点击导出
547
- clickExport (operationItem) {
548
- this.handleExport(operationItem);
549
- },
550
579
  // 打开全屏模态框
551
580
  clickEnlarge (operationItem) {
552
581
  this.isEnlarge = true;
553
582
  },
554
583
 
584
+ /* ----------- 引用 ---------- */
585
+ // 点击引用
586
+ clickQuote () {
587
+ this.dshRenderName = "quoteModalRender";
588
+ this.showQuoteModal = true;
589
+ },
555
590
  // 引用模态框渲染函数
556
591
  quoteModalRender (h, params) {
557
592
  return this.showQuoteModal
@@ -591,7 +626,7 @@ export default {
591
626
  const loop = (list = []) =>
592
627
  list.map(item => ({
593
628
  ...item,
594
- children: item.children && item.children.length ? loop(item.children) : item.children,
629
+ children: item.children ? loop(item.children) : item.children,
595
630
  __isQuote__: true
596
631
  }));
597
632
 
@@ -626,11 +661,42 @@ export default {
626
661
  this.$Message.error("未选择引用数据!");
627
662
  }
628
663
  },
664
+
665
+ /* ----------- 导入 ---------- */
666
+ // 点击导入
667
+ clickImport () {
668
+ this.dshRenderName = "importModalRender";
669
+ this.showImportModal = true;
670
+ },
671
+ // 导入模态框渲染函数
672
+ importModalRender (h, params) {
673
+ return this.showImportModal
674
+ ? h("import-modal", {
675
+ props: {
676
+ value: this.showImportModal,
677
+ propsObj: this.propsObj,
678
+ listParams: this.importParams
679
+ },
680
+ on: {
681
+ input: bool => {
682
+ this.showImportModal = bool;
683
+ },
684
+ importCb: this.importCb
685
+ }
686
+ })
687
+ : undefined;
688
+ },
629
689
  // 导入回调
630
690
  importCb (dataObj) {
631
691
  this.parentObj[this.controlKey] = dataObj;
632
692
  this.change("import");
633
693
  },
694
+
695
+ /* ----------- 导出 ---------- */
696
+ // 点击导出
697
+ clickExport (operationItem) {
698
+ this.handleExport(operationItem);
699
+ },
634
700
  // 接口 -导出
635
701
  handleExport (operationItem) {
636
702
  operationItem.disabled = true;
@@ -682,7 +748,118 @@ export default {
682
748
  });
683
749
  },
684
750
 
685
- /* --------------- 工具方法 ------------- */
751
+ /* ----------- 渲染函数 ---------- */
752
+ getTableTopRender (isEnlarge = false) {
753
+ return (h, params) => {
754
+ return h("div", {
755
+ style: {
756
+ "margin-bottom": "3px",
757
+ "display": "flex",
758
+ "flex-direction": "row",
759
+ "justify-content": "space-between",
760
+ "align-items": "center"
761
+ }
762
+ }, [
763
+ // 左 -统计,逻辑
764
+ this.topSummaryRender(h, params),
765
+
766
+ // 右 -功能按钮
767
+ isEnlarge ? undefined : this.topOperationRender(h, params)
768
+ ]);
769
+ };
770
+ },
771
+ topSearchRender (h, params) {
772
+ return this.searchFormList.length
773
+ ? h("dsh-default-search", {
774
+ props: {
775
+ formList: this.searchFormList,
776
+ initValue: this.dftAdvSearch.conditions,
777
+ labelWidth: this.searchLabelWidth
778
+ },
779
+ on: {
780
+ change: this.searchCb
781
+ }
782
+ })
783
+ : undefined;
784
+ },
785
+ topSummaryRender (h, params) {
786
+ return h("div", {
787
+ style: {
788
+ "display": "flex",
789
+ "flex-direction": "row",
790
+ "align-items": "center"
791
+ }
792
+ }, [
793
+ h("span", {
794
+ style: {
795
+ "font-weight": "500"
796
+ }
797
+ }, this.rowsNumStr + ";"),
798
+
799
+ this.searchFormList.length
800
+ ? h("div", {
801
+ style: {
802
+ "display": "flex",
803
+ "flex-direction": "row",
804
+ "align-items": "center",
805
+ "margin-left": "16px"
806
+ }
807
+ }, [
808
+ h("div", {
809
+ style: {
810
+ "font-weight": "500"
811
+ }
812
+ }, this.selfLogicPropsObj._name + ":"),
813
+ h("dsh-select", {
814
+ style: {
815
+ "margin-left": "8px",
816
+ "margin-top": "-4px"
817
+ },
818
+ props: {
819
+ value: this.dftAdvSearch,
820
+ propsObj: this.selfLogicPropsObj
821
+ }
822
+ })
823
+ ])
824
+ : undefined
825
+ ]);
826
+ },
827
+ topOperationRender (h, params) {
828
+ return h("dsh-buttons", {
829
+ style: {
830
+ "text-align": "right"
831
+ },
832
+ props: {
833
+ itemClass: undefined,
834
+ list: this.$getOperationList(this.topOperationBtns)
835
+ },
836
+ on: {
837
+ click: (event) => {
838
+ this.$dispatchEvent(event);
839
+ }
840
+ }
841
+ });
842
+ },
843
+ createOperationRender (h, params) {
844
+ return !this.isSearching
845
+ ? h("dsh-buttons", {
846
+ style: {
847
+ "margin-top": "3px"
848
+ },
849
+ props: {
850
+ itemClass: undefined,
851
+ list: this.$getOperationList(["canCreate"])
852
+ },
853
+ on: {
854
+ click: (event) => {
855
+ this.$dispatchEvent(event);
856
+ }
857
+ }
858
+ })
859
+ : undefined;
860
+ },
861
+
862
+ /* ----------- 工具方法 ---------- */
686
863
  resetCol (col, row) {
687
864
  let resetMap = {
688
865
  select: {