@bsgoal/common 2.15.2 → 2.15.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/dist/index.mjs +2497 -2440
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +14 -14
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/bsgoal-base-search-table/index.vue +34 -3
- package/src/components/bsgoal-base-table/demo.vue +25 -4
- package/src/components/bsgoal-base-table/index.vue +35 -2
- package/src/components/bsgoal-base-tree-table/demo.vue +27 -5
- package/src/components/bsgoal-base-tree-table/index.vue +44 -5
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-18 17:04:47
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-28 14:19:38
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-search-table\index.vue
|
|
7
7
|
* @Description: 查询+表格 基础组件
|
|
8
8
|
*
|
|
@@ -127,12 +127,13 @@ const props = defineProps({
|
|
|
127
127
|
/**
|
|
128
128
|
* pageSize
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
pageSize: {
|
|
131
131
|
type: [Number],
|
|
132
132
|
default: 20
|
|
133
133
|
}
|
|
134
134
|
})
|
|
135
135
|
|
|
136
|
+
const emits = defineEmits(['select', 'select-all', 'selection-change', 'on-total-change'])
|
|
136
137
|
|
|
137
138
|
const transferFoldStatus = ref(false)
|
|
138
139
|
provide('transferFoldStatus', transferFoldStatus)
|
|
@@ -185,10 +186,36 @@ const refresh = () => {
|
|
|
185
186
|
}
|
|
186
187
|
// ---> E 刷新 <---
|
|
187
188
|
|
|
189
|
+
// ---> S 触发事件 <---
|
|
190
|
+
const triggerSelect = (selection, row) => {
|
|
191
|
+
emits('select', selection, row)
|
|
192
|
+
}
|
|
193
|
+
const triggerSelectAll = (selection) => {
|
|
194
|
+
emits('select-all', selection)
|
|
195
|
+
}
|
|
196
|
+
const triggerSelectionChange = (selection) => {
|
|
197
|
+
emits('selection-change', selection)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const triggerTotalChange = (total = 0) => {
|
|
201
|
+
emits('on-total-change', total)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ---> E 触发事件 <---
|
|
205
|
+
|
|
206
|
+
// ---> S 暴露事件 <---
|
|
207
|
+
|
|
208
|
+
const clearSelection = () => {
|
|
209
|
+
BSGOAL_BASE_TABLE_REF.value.clearSelection()
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ---> E 暴露事件 <---
|
|
213
|
+
|
|
188
214
|
// ---> S 暴露 <---
|
|
189
215
|
|
|
190
216
|
defineExpose({
|
|
191
|
-
refresh
|
|
217
|
+
refresh,
|
|
218
|
+
clearSelection
|
|
192
219
|
})
|
|
193
220
|
// ---> E 暴露 <---
|
|
194
221
|
</script>
|
|
@@ -218,6 +245,10 @@ defineExpose({
|
|
|
218
245
|
:fetch="fetch"
|
|
219
246
|
:call="call"
|
|
220
247
|
:has-page="hasPage"
|
|
248
|
+
@select="triggerSelect"
|
|
249
|
+
@select-all="triggerSelectAll"
|
|
250
|
+
@selection-change="triggerSelectionChange"
|
|
251
|
+
@on-total-change="triggerTotalChange"
|
|
221
252
|
>
|
|
222
253
|
<!-- S 顶部菜单 -->
|
|
223
254
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-10 14:26:44
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-28 13:53:43
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-table\demo.vue
|
|
7
7
|
* @Description: 表格公共组件演示页面
|
|
8
8
|
*
|
|
@@ -16,7 +16,7 @@ import BsgoalBaseSearch from '../bsgoal-base-search/index.vue'
|
|
|
16
16
|
import ComponentTypeEnums from '../../enums/componentTypeEnums.js'
|
|
17
17
|
|
|
18
18
|
defineOptions({
|
|
19
|
-
|
|
19
|
+
name: 'BsgoalBaseTableDemo111'
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
let searchOptions = ref([
|
|
@@ -216,7 +216,7 @@ setTimeout(() => {
|
|
|
216
216
|
const configOptionsTable = ref([
|
|
217
217
|
{
|
|
218
218
|
label: '宽度',
|
|
219
|
-
prop: 'prop1'
|
|
219
|
+
prop: 'prop1'
|
|
220
220
|
// tooltip: true,
|
|
221
221
|
// limit: 3
|
|
222
222
|
},
|
|
@@ -245,12 +245,30 @@ const configOptionsTable = ref([
|
|
|
245
245
|
const clearData = () => {
|
|
246
246
|
data.value = []
|
|
247
247
|
}
|
|
248
|
+
|
|
249
|
+
const triggerSelect = (selection, row) => {
|
|
250
|
+
console.log('select', selection, row)
|
|
251
|
+
}
|
|
252
|
+
const triggerSelectAll = (selection) => {
|
|
253
|
+
console.log('select-all', selection)
|
|
254
|
+
}
|
|
255
|
+
const triggerSelectionChange = (selection) => {
|
|
256
|
+
console.log('selection-change', selection)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const BSGOAL_EL_TABLE_REF = ref(null)
|
|
260
|
+
|
|
261
|
+
const clearSelection = () => {
|
|
262
|
+
BSGOAL_EL_TABLE_REF.value.clearSelection()
|
|
263
|
+
}
|
|
248
264
|
</script>
|
|
249
265
|
<template>
|
|
250
266
|
<div class="bsgoal-base-table-demo">
|
|
267
|
+
<el-button type="primary" @click="clearSelection">清空选择</el-button>
|
|
251
268
|
<!-- <BsgoalBaseSearch :config-options="searchOptions" /> -->
|
|
252
|
-
<el-button type="primary" @click="clearData">设置为空数据</el-button>
|
|
269
|
+
<!-- <el-button type="primary" @click="clearData">设置为空数据</el-button> -->
|
|
253
270
|
<BsgoalBaseTable
|
|
271
|
+
ref="BSGOAL_EL_TABLE_REF"
|
|
254
272
|
operation-width="200"
|
|
255
273
|
operation
|
|
256
274
|
selection
|
|
@@ -258,6 +276,9 @@ const clearData = () => {
|
|
|
258
276
|
:config-options="configOptionsTable"
|
|
259
277
|
:data="data"
|
|
260
278
|
:auto-height="false"
|
|
279
|
+
@select="triggerSelect"
|
|
280
|
+
@select-all="triggerSelectAll"
|
|
281
|
+
@selection-change="triggerSelectionChange"
|
|
261
282
|
>
|
|
262
283
|
<!-- S 操作项 -->
|
|
263
284
|
<template v-slot:operation="{ row }">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-10 11:29:04
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-28 14:17:06
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-table\index.vue
|
|
7
7
|
* @Description:
|
|
8
8
|
*
|
|
@@ -136,6 +136,8 @@ const props = defineProps({
|
|
|
136
136
|
}
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
+
const emits = defineEmits(['select', 'select-all', 'selection-change','on-total-change'])
|
|
140
|
+
|
|
139
141
|
/**
|
|
140
142
|
* @Author: canlong.shen
|
|
141
143
|
* @description:
|
|
@@ -217,6 +219,10 @@ watch(resData, (data) => {
|
|
|
217
219
|
}
|
|
218
220
|
})
|
|
219
221
|
|
|
222
|
+
watchEffect(() => {
|
|
223
|
+
emits('on-total-change', total.value)
|
|
224
|
+
})
|
|
225
|
+
|
|
220
226
|
// 查询
|
|
221
227
|
const refreshList = (params = {}) => {
|
|
222
228
|
searchParams.value = params
|
|
@@ -240,9 +246,32 @@ watch([currentPage, curPageSize], () => {
|
|
|
240
246
|
const TREE_SWITCH_STATUS = inject('TREE_SWITCH_STATUS')
|
|
241
247
|
// ---> E 左侧机构树折叠状态 <---
|
|
242
248
|
|
|
249
|
+
// ---> S 触发事件 <---
|
|
250
|
+
const triggerSelect = (selection, row) => {
|
|
251
|
+
emits('select', selection, row)
|
|
252
|
+
}
|
|
253
|
+
const triggerSelectAll = (selection) => {
|
|
254
|
+
emits('select-all', selection)
|
|
255
|
+
}
|
|
256
|
+
const triggerSelectionChange = (selection) => {
|
|
257
|
+
emits('selection-change', selection)
|
|
258
|
+
}
|
|
259
|
+
// ---> E 触发事件 <---
|
|
260
|
+
|
|
261
|
+
// ---> S 暴露事件 <---
|
|
262
|
+
|
|
263
|
+
const BSGOAL_EL_TABLE_REF = ref(null)
|
|
264
|
+
|
|
265
|
+
const clearSelection = () => {
|
|
266
|
+
BSGOAL_EL_TABLE_REF.value.clearSelection()
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// ---> E 暴露事件 <---
|
|
270
|
+
|
|
243
271
|
// 暴露的属性
|
|
244
272
|
defineExpose({
|
|
245
|
-
refreshList
|
|
273
|
+
refreshList,
|
|
274
|
+
clearSelection
|
|
246
275
|
})
|
|
247
276
|
</script>
|
|
248
277
|
|
|
@@ -257,6 +286,7 @@ defineExpose({
|
|
|
257
286
|
<!-- S 表格区域 -->
|
|
258
287
|
<div ref="EL_TABLE_WRAP_REF">
|
|
259
288
|
<el-table
|
|
289
|
+
ref="BSGOAL_EL_TABLE_REF"
|
|
260
290
|
stripe
|
|
261
291
|
border
|
|
262
292
|
highlight-current-row
|
|
@@ -269,6 +299,9 @@ defineExpose({
|
|
|
269
299
|
color: 'rgba(0,0,0,.85)',
|
|
270
300
|
fontSize: '14px'
|
|
271
301
|
}"
|
|
302
|
+
@select="triggerSelect"
|
|
303
|
+
@select-all="triggerSelectAll"
|
|
304
|
+
@selection-change="triggerSelectionChange"
|
|
272
305
|
>
|
|
273
306
|
<!-- / 无数据展示内容 -->
|
|
274
307
|
<template #empty>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-06-20 09:20:51
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-28 14:22:20
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree-table\demo.vue
|
|
7
7
|
* @Description: 树 + 列表 + 演示
|
|
8
8
|
*
|
|
@@ -779,7 +779,7 @@ setTimeout(() => {
|
|
|
779
779
|
hasIcon: true
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
|
-
key:'label2-2',
|
|
782
|
+
key: 'label2-2',
|
|
783
783
|
label: 'label2-2',
|
|
784
784
|
children: [
|
|
785
785
|
{
|
|
@@ -798,9 +798,27 @@ const test = () => {
|
|
|
798
798
|
BSGOAL_BASE_TREE_TABLE_REF.value.refreshList({})
|
|
799
799
|
}
|
|
800
800
|
|
|
801
|
+
const triggerTableSelect = () => {
|
|
802
|
+
console.log('triggerTableSelect', triggerTableSelect)
|
|
803
|
+
}
|
|
804
|
+
const triggerTableSelectAll = () => {
|
|
805
|
+
console.log('triggerTableSelectAll', triggerTableSelectAll)
|
|
806
|
+
}
|
|
807
|
+
const triggerTableSelectionChange = () => {
|
|
808
|
+
console.log('triggerTableSelectionChange', triggerTableSelectionChange)
|
|
809
|
+
}
|
|
810
|
+
const triggerTableTotalChange = (total = 0) => {
|
|
811
|
+
console.log('triggerTableTotalChange', total)
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
const clearSelection = () => {
|
|
815
|
+
BSGOAL_BASE_TREE_TABLE_REF.value.clearSelection()
|
|
816
|
+
}
|
|
801
817
|
// ---> E 列表 <---
|
|
802
818
|
</script>
|
|
803
819
|
<template>
|
|
820
|
+
<el-button type="primary" @click="clearSelection">清空选择</el-button>
|
|
821
|
+
|
|
804
822
|
<div class="bsgoal-base-tree-table-demo">
|
|
805
823
|
<div class="base_tree_table_demo">
|
|
806
824
|
<!-- <div @click="test">点击</div> -->
|
|
@@ -816,14 +834,18 @@ const test = () => {
|
|
|
816
834
|
:expression="77"
|
|
817
835
|
@on-click-tree="triggerTreeClick"
|
|
818
836
|
@on-add-tree="triggerTreeAddClick"
|
|
837
|
+
@on-select-table="triggerTableSelect"
|
|
838
|
+
@on-select-all-table="triggerTableSelectAll"
|
|
839
|
+
@on-selection-change-table="triggerTableSelectionChange"
|
|
840
|
+
@on-total-change-table="triggerTableTotalChange"
|
|
819
841
|
>
|
|
820
|
-
|
|
842
|
+
<!-- <template #tree="{data}">
|
|
821
843
|
<div>{{ data }}</div>
|
|
822
844
|
</template> -->
|
|
823
|
-
|
|
845
|
+
<!-- <template #prop1="{row}">
|
|
824
846
|
<div>{{ row }}</div>
|
|
825
847
|
</template> -->
|
|
826
|
-
|
|
848
|
+
</BsgoalBaseTreeTable>
|
|
827
849
|
</div>
|
|
828
850
|
</div>
|
|
829
851
|
</template>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-06-20 09:20:44
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-28 14:21:32
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree-table\index.vue
|
|
7
7
|
* @Description: 树结构 + 列表
|
|
8
8
|
*
|
|
@@ -158,7 +158,7 @@ const props = defineProps({
|
|
|
158
158
|
/**
|
|
159
159
|
* 节点的 key
|
|
160
160
|
*/
|
|
161
|
-
|
|
161
|
+
nodeKey: {
|
|
162
162
|
type: [String],
|
|
163
163
|
default: 'key'
|
|
164
164
|
},
|
|
@@ -171,7 +171,15 @@ const props = defineProps({
|
|
|
171
171
|
}
|
|
172
172
|
})
|
|
173
173
|
|
|
174
|
-
const emits = defineEmits([
|
|
174
|
+
const emits = defineEmits([
|
|
175
|
+
'on-click-tree',
|
|
176
|
+
'on-switch-tree',
|
|
177
|
+
'on-add-tree',
|
|
178
|
+
'on-select-table',
|
|
179
|
+
'on-select-all-table',
|
|
180
|
+
'on-selection-change-table',
|
|
181
|
+
'on-total-change-table'
|
|
182
|
+
])
|
|
175
183
|
|
|
176
184
|
// ---> S 注入插槽 <---
|
|
177
185
|
const slots = useSlots()
|
|
@@ -217,9 +225,33 @@ const refreshList = (params = {}) => {
|
|
|
217
225
|
BSGOAL_BASE_SEARCH_TABLE_REF.value.refresh(params)
|
|
218
226
|
}
|
|
219
227
|
|
|
228
|
+
// ---> S 触发事件 <---
|
|
229
|
+
const triggerSelect = (selection = {}, row =[]) => {
|
|
230
|
+
emits('on-select-table', selection, row)
|
|
231
|
+
}
|
|
232
|
+
const triggerSelectAll = (selection = {}) => {
|
|
233
|
+
emits('on-select-all-table', selection)
|
|
234
|
+
}
|
|
235
|
+
const triggerSelectionChange = (selection = {}) => {
|
|
236
|
+
emits('on-selection-change-table', selection)
|
|
237
|
+
}
|
|
238
|
+
const triggerTotalChange = (total = 0) => {
|
|
239
|
+
emits('on-total-change-table', total)
|
|
240
|
+
}
|
|
241
|
+
// ---> E 触发事件 <---
|
|
242
|
+
|
|
243
|
+
// ---> S 暴露事件 <---
|
|
244
|
+
|
|
245
|
+
const clearSelection = () => {
|
|
246
|
+
BSGOAL_BASE_SEARCH_TABLE_REF.value.clearSelection()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ---> E 暴露事件 <---
|
|
250
|
+
|
|
220
251
|
// 暴露的属性
|
|
221
252
|
defineExpose({
|
|
222
|
-
refreshList
|
|
253
|
+
refreshList,
|
|
254
|
+
clearSelection
|
|
223
255
|
})
|
|
224
256
|
|
|
225
257
|
// ---> E 表 <---
|
|
@@ -260,7 +292,14 @@ const tableStyler = computed(() => {
|
|
|
260
292
|
</div>
|
|
261
293
|
<div class="base_tree_table--table" :style="tableStyler">
|
|
262
294
|
<!-- S 列表 -->
|
|
263
|
-
<BsgoalBaseSearchTable
|
|
295
|
+
<BsgoalBaseSearchTable
|
|
296
|
+
ref="BSGOAL_BASE_SEARCH_TABLE_REF"
|
|
297
|
+
v-bind="$props"
|
|
298
|
+
@select="triggerSelect"
|
|
299
|
+
@select-all="triggerSelectAll"
|
|
300
|
+
@selection-change="triggerSelectionChange"
|
|
301
|
+
@on-total-change="triggerTotalChange"
|
|
302
|
+
>
|
|
264
303
|
<template v-for="slotName of slotNames" v-slot:[slotName]="{ row = {} }">
|
|
265
304
|
<slot :name="slotName" :row="row"></slot>
|
|
266
305
|
</template>
|