@bsgoal/common 2.9.1 → 2.10.0

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.
@@ -0,0 +1,233 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-06-20 09:20:44
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-06-20 19:33:51
6
+ * @FilePath: \common\src\components\bsgoal-base-tree-table\index.vue
7
+ * @Description: 树结构 + 列表
8
+ *
9
+ -->
10
+ <script setup>
11
+ /* setup模板
12
+ ---------------------------------------------------------------- */
13
+ import { ref, useSlots, computed, provide, unref } from 'vue'
14
+ import BsgoalBaseTree from '../bsgoal-base-tree/index.vue'
15
+ import BsgoalBaseSearchTable from '../bsgoal-base-search-table/index.vue'
16
+
17
+ defineOptions({
18
+ name: 'BsgoalBaseTreeTable'
19
+ })
20
+
21
+ const props = defineProps({
22
+ /**
23
+ * 树结构 的下边距
24
+ */
25
+ gasket: {
26
+ type: [String, Number],
27
+ default: 10
28
+ },
29
+ /**
30
+ * 数据
31
+ */
32
+ data: {
33
+ type: [Object, Array],
34
+ default: () => []
35
+ },
36
+ /**
37
+ * 配置
38
+ */
39
+ treeProps: {
40
+ type: [Object],
41
+ default: () => ({
42
+ label: 'label',
43
+ children: 'children',
44
+ disabled: 'disabled',
45
+ isLeaf: 'isLeaf',
46
+ class: 'class'
47
+ })
48
+ },
49
+ /**
50
+ * 懒加载数据方法
51
+ * () => {
52
+ * return Promise(resolve => resolve([]))
53
+ * }
54
+ */
55
+ lazyLoad: {
56
+ type: [Function],
57
+ default: () => {}
58
+ },
59
+ /**
60
+ * 初始化树节点
61
+ * () => {
62
+ * return Promise(resolve => resolve([]))
63
+ * }
64
+ */
65
+ initNode: {
66
+ type: [Function],
67
+ default: () => {}
68
+ },
69
+
70
+ configOptions: {
71
+ type: [Array],
72
+ default: () => []
73
+ },
74
+
75
+ /**
76
+ * 表格数据
77
+ */
78
+ tableData: {
79
+ type: [Array],
80
+ default: () => []
81
+ },
82
+ /**
83
+ * 是否多选
84
+ */
85
+ selection: {
86
+ type: [Boolean],
87
+ default: false
88
+ },
89
+ /**
90
+ * 是否配置操作列
91
+ */
92
+ operation: {
93
+ type: [Boolean],
94
+ default: false
95
+ },
96
+ /**
97
+ * 操作列宽度
98
+ */
99
+ operationWidth: {
100
+ type: [String, Number],
101
+ default: 100
102
+ },
103
+ /**
104
+ * 请求的 promise
105
+ */
106
+ fetch: {
107
+ type: [Object, Function],
108
+ default: null
109
+ },
110
+ /**
111
+ * 响应的 call
112
+ */
113
+ call: {
114
+ type: [Object, Function],
115
+ default: null
116
+ },
117
+ /**
118
+ * 表格高度 下边距值
119
+ */
120
+ expression: {
121
+ type: [Number],
122
+ default: 75
123
+ },
124
+ /**
125
+ * 映射字段
126
+ */
127
+ mapProps: {
128
+ type: [Object],
129
+ default: () => ({
130
+ currentPage: 'currentPage',
131
+ pageSize: 'pageSize',
132
+ rows: 'rows',
133
+ total: 'total'
134
+ })
135
+ },
136
+ /**
137
+ * 是否显示分页
138
+ */
139
+ hasPage: {
140
+ type: Boolean,
141
+ default: true
142
+ },
143
+ /**
144
+ * 是否显示查询
145
+ */
146
+ hasSearch: {
147
+ type: Boolean,
148
+ default: true
149
+ },
150
+
151
+ /**
152
+ * pageSize
153
+ */
154
+ pageSize: {
155
+ type: [Number],
156
+ default: 0
157
+ }
158
+ })
159
+
160
+ // ---> S 注入分页的值 <---
161
+ const pageSizeValue = unref(props.pageSize)
162
+ if (pageSizeValue) {
163
+ provide('PAGINATION_PAGE_SIZE', ref(props.pageSize))
164
+ }
165
+ // ---> E 注入分页的值 <---
166
+
167
+ // ---> S 注入插槽 <---
168
+ const slots = useSlots()
169
+ const slotNames = ref(Object.keys(slots))
170
+ // ---> E 注入插槽 <---
171
+
172
+ // ---> S 树 <---
173
+ const switchStatus = ref(true)
174
+ const switchTree = (status = '') => {
175
+ switchStatus.value = status
176
+ }
177
+ provide('TREE_SWITCH_STATUS', switchStatus)
178
+
179
+ // ---> E 树 <---
180
+
181
+ const tableStyler = computed(() => {
182
+ const styler = {}
183
+ const switchStatusValue = switchStatus.value
184
+ if (switchStatusValue) {
185
+ styler.maxWidth = 'calc(100% - 250px)'
186
+ } else {
187
+ styler.maxWidth = 'calc(100%)'
188
+ }
189
+
190
+ return styler
191
+ })
192
+ </script>
193
+ <template>
194
+ <div class="bsgoal-base-tree-table">
195
+ <div class="base_tree_table">
196
+ <div class="base_tree_table--tree">
197
+ <!-- S 树 -->
198
+ <BsgoalBaseTree
199
+ v-bind="$props"
200
+ class="base_tree_table--tree"
201
+ @on-switch="switchTree"
202
+ ></BsgoalBaseTree>
203
+ <!-- E 树 -->
204
+ </div>
205
+ <div class="base_tree_table--table" :style="tableStyler">
206
+ <!-- S 列表 -->
207
+ <BsgoalBaseSearchTable v-bind="$props">
208
+ <template v-for="slotName of slotNames" v-slot:[slotName]="{ row = {} }">
209
+ <slot :name="slotName" :row="row"></slot>
210
+ </template>
211
+ </BsgoalBaseSearchTable>
212
+ <!-- E 列表 -->
213
+ </div>
214
+ </div>
215
+ </div>
216
+ </template>
217
+ <style lang="scss">
218
+ /* 覆盖样式
219
+ ---------------------------------------------------------------- */
220
+ .bsgoal-base-tree-table {
221
+ .base_tree_table {
222
+ display: flex;
223
+ }
224
+ .base_tree_table--tree {
225
+ /* flex-basis: 221px; */
226
+ /* flex: auto; */
227
+ }
228
+ .base_tree_table--table {
229
+ /* flex: 1; */
230
+ overflow: hidden;
231
+ }
232
+ }
233
+ </style>
package/src/entry.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-05-11 18:31:55
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-05-29 09:58:19
5
+ * @LastEditTime: 2023-06-20 10:10:26
6
6
  * @FilePath: \common\src\entry.js
7
7
  * @Description: 打包 入口文件
8
8
  *
@@ -27,6 +27,7 @@ import BsgoalBaseTimeRange from '@/components/bsgoal-base-time-range/index.vue'
27
27
  import BsgoalBaseSwitch from '@/components/bsgoal-base-switch/index.vue'
28
28
  import BsgoalBaseItem from '@/components/bsgoal-base-item/index.vue'
29
29
  import BsgoalBaseInput from '@/components/bsgoal-base-input/index.vue'
30
+ import BsgoalBaseTreeTable from '@/components/bsgoal-base-tree-table/index.vue'
30
31
  import componentTypeEnums from '@/enums/componentTypeEnums.js'
31
32
  import { useFetch } from '@/combines/useFetchs.js'
32
33
 
@@ -56,6 +57,7 @@ export default {
56
57
  BsgoalBaseSwitch,
57
58
  BsgoalBaseItem,
58
59
  BsgoalBaseInput,
60
+ BsgoalBaseTreeTable
59
61
  }
60
62
 
61
63
  for (const [name, component] of Object.entries(componentsMap)) {
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-04-10 10:41:52
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-05-29 09:57:18
5
+ * @LastEditTime: 2023-06-20 10:07:27
6
6
  * @FilePath: \common\src\router\index.js
7
7
  * @Description: 路由配置
8
8
  *
@@ -128,6 +128,11 @@ const router = createRouter({
128
128
  name: '表单项',
129
129
  component: import('@/components/bsgoal-base-item/demo.vue')
130
130
  },
131
+ {
132
+ path: 'bsgoal-base-tree-table-demo',
133
+ name: '树 + 查询 + 表格',
134
+ component: import('@/components/bsgoal-base-tree-table/demo.vue')
135
+ },
131
136
  ]
132
137
  }
133
138
  ]
@@ -1,2 +0,0 @@
1
- [0531/134940.513:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
2
- [0531/140033.816:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)