@bsgoal/common 2.15.2 → 2.15.3

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": "@bsgoal/common",
3
- "version": "2.15.2",
3
+ "version": "2.15.3",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -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-26 11:53:22
5
+ * @LastEditTime: 2023-06-28 13:57:46
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
- pageSize: {
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'])
136
137
 
137
138
  const transferFoldStatus = ref(false)
138
139
  provide('transferFoldStatus', transferFoldStatus)
@@ -185,10 +186,31 @@ 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
+ // ---> E 触发事件 <---
200
+
201
+ // ---> S 暴露事件 <---
202
+
203
+ const clearSelection = () => {
204
+ BSGOAL_BASE_TABLE_REF.value.clearSelection()
205
+ }
206
+
207
+ // ---> E 暴露事件 <---
208
+
188
209
  // ---> S 暴露 <---
189
210
 
190
211
  defineExpose({
191
- refresh
212
+ refresh,
213
+ clearSelection
192
214
  })
193
215
  // ---> E 暴露 <---
194
216
  </script>
@@ -218,6 +240,9 @@ defineExpose({
218
240
  :fetch="fetch"
219
241
  :call="call"
220
242
  :has-page="hasPage"
243
+ @select="triggerSelect"
244
+ @select-all="triggerSelectAll"
245
+ @selection-change="triggerSelectionChange"
221
246
  >
222
247
  <!-- S 顶部菜单 -->
223
248
 
@@ -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-25 17:11:30
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
- name:'BsgoalBaseTableDemo111'
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-25 17:14:14
5
+ * @LastEditTime: 2023-06-28 13:49:07
6
6
  * @FilePath: \common\src\components\bsgoal-base-table\index.vue
7
7
  * @Description:
8
8
  *
@@ -136,6 +136,9 @@ const props = defineProps({
136
136
  }
137
137
  })
138
138
 
139
+ const emits = defineEmits(['select','select-all','selection-change'])
140
+
141
+
139
142
  /**
140
143
  * @Author: canlong.shen
141
144
  * @description:
@@ -240,9 +243,33 @@ watch([currentPage, curPageSize], () => {
240
243
  const TREE_SWITCH_STATUS = inject('TREE_SWITCH_STATUS')
241
244
  // ---> E 左侧机构树折叠状态 <---
242
245
 
246
+ // ---> S 触发事件 <---
247
+ const triggerSelect = (selection, row) => {
248
+ emits('select', selection, row)
249
+ }
250
+ const triggerSelectAll = (selection) => {
251
+ emits('select-all', selection)
252
+ }
253
+ const triggerSelectionChange = (selection) => {
254
+ emits('selection-change', selection)
255
+ }
256
+ // ---> E 触发事件 <---
257
+
258
+ // ---> S 暴露事件 <---
259
+
260
+ const BSGOAL_EL_TABLE_REF = ref(null)
261
+
262
+ const clearSelection = () => {
263
+ BSGOAL_EL_TABLE_REF.value.clearSelection()
264
+ }
265
+
266
+ // ---> E 暴露事件 <---
267
+
268
+
243
269
  // 暴露的属性
244
270
  defineExpose({
245
- refreshList
271
+ refreshList,
272
+ clearSelection
246
273
  })
247
274
  </script>
248
275
 
@@ -257,6 +284,7 @@ defineExpose({
257
284
  <!-- S 表格区域 -->
258
285
  <div ref="EL_TABLE_WRAP_REF">
259
286
  <el-table
287
+ ref="BSGOAL_EL_TABLE_REF"
260
288
  stripe
261
289
  border
262
290
  highlight-current-row
@@ -269,6 +297,9 @@ defineExpose({
269
297
  color: 'rgba(0,0,0,.85)',
270
298
  fontSize: '14px'
271
299
  }"
300
+ @select="triggerSelect"
301
+ @select-all="triggerSelectAll"
302
+ @selection-change="triggerSelectionChange"
272
303
  >
273
304
  <!-- / 无数据展示内容 -->
274
305
  <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-27 11:27:35
5
+ * @LastEditTime: 2023-06-28 14:04:55
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,24 @@ 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
+
811
+ const clearSelection = () => {
812
+ BSGOAL_BASE_TREE_TABLE_REF.value.clearSelection()
813
+ }
801
814
  // ---> E 列表 <---
802
815
  </script>
803
816
  <template>
817
+ <el-button type="primary" @click="clearSelection">清空选择</el-button>
818
+
804
819
  <div class="bsgoal-base-tree-table-demo">
805
820
  <div class="base_tree_table_demo">
806
821
  <!-- <div @click="test">点击</div> -->
@@ -816,14 +831,17 @@ const test = () => {
816
831
  :expression="77"
817
832
  @on-click-tree="triggerTreeClick"
818
833
  @on-add-tree="triggerTreeAddClick"
834
+ @on-select-table="triggerTableSelect"
835
+ @on-select-all-table="triggerTableSelectAll"
836
+ @on-selection-change-table="triggerTableSelectionChange"
819
837
  >
820
- <!-- <template #tree="{data}">
838
+ <!-- <template #tree="{data}">
821
839
  <div>{{ data }}</div>
822
840
  </template> -->
823
- <!-- <template #prop1="{row}">
841
+ <!-- <template #prop1="{row}">
824
842
  <div>{{ row }}</div>
825
843
  </template> -->
826
- </BsgoalBaseTreeTable>
844
+ </BsgoalBaseTreeTable>
827
845
  </div>
828
846
  </div>
829
847
  </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-27 13:54:17
5
+ * @LastEditTime: 2023-06-28 14:01:30
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
- nodeKey: {
161
+ nodeKey: {
162
162
  type: [String],
163
163
  default: 'key'
164
164
  },
@@ -171,7 +171,14 @@ const props = defineProps({
171
171
  }
172
172
  })
173
173
 
174
- const emits = defineEmits(['on-click-tree', 'on-switch-tree', 'on-add-tree'])
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
+ ])
175
182
 
176
183
  // ---> S 注入插槽 <---
177
184
  const slots = useSlots()
@@ -217,9 +224,30 @@ const refreshList = (params = {}) => {
217
224
  BSGOAL_BASE_SEARCH_TABLE_REF.value.refresh(params)
218
225
  }
219
226
 
227
+ // ---> S 触发事件 <---
228
+ const triggerSelect = (selection, row) => {
229
+ emits('on-select-table', selection, row)
230
+ }
231
+ const triggerSelectAll = (selection) => {
232
+ emits('on-select-all-table', selection)
233
+ }
234
+ const triggerSelectionChange = (selection) => {
235
+ emits('on-selection-change-table', selection)
236
+ }
237
+ // ---> E 触发事件 <---
238
+
239
+ // ---> S 暴露事件 <---
240
+
241
+ const clearSelection = () => {
242
+ BSGOAL_BASE_SEARCH_TABLE_REF.value.clearSelection()
243
+ }
244
+
245
+ // ---> E 暴露事件 <---
246
+
220
247
  // 暴露的属性
221
248
  defineExpose({
222
- refreshList
249
+ refreshList,
250
+ clearSelection
223
251
  })
224
252
 
225
253
  // ---> E 表 <---
@@ -260,7 +288,13 @@ const tableStyler = computed(() => {
260
288
  </div>
261
289
  <div class="base_tree_table--table" :style="tableStyler">
262
290
  <!-- S 列表 -->
263
- <BsgoalBaseSearchTable ref="BSGOAL_BASE_SEARCH_TABLE_REF" v-bind="$props">
291
+ <BsgoalBaseSearchTable
292
+ ref="BSGOAL_BASE_SEARCH_TABLE_REF"
293
+ v-bind="$props"
294
+ @select="triggerSelect"
295
+ @select-all="triggerSelectAll"
296
+ @selection-change="triggerSelectionChange"
297
+ >
264
298
  <template v-for="slotName of slotNames" v-slot:[slotName]="{ row = {} }">
265
299
  <slot :name="slotName" :row="row"></slot>
266
300
  </template>