@bsgoal/common 2.15.8 → 2.15.10

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.8",
3
+ "version": "2.15.10",
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-29 14:35:56
5
+ * @LastEditTime: 2023-06-30 10:12:43
6
6
  * @FilePath: \common\src\components\bsgoal-base-search-table\index.vue
7
7
  * @Description: 查询+表格 基础组件
8
8
  *
@@ -137,6 +137,13 @@ const props = defineProps({
137
137
  showSummary: {
138
138
  type: [Boolean],
139
139
  default: false
140
+ },
141
+ /**
142
+ * 合计的列
143
+ */
144
+ summaryProps: {
145
+ type: [Array],
146
+ default: () => []
140
147
  }
141
148
  })
142
149
 
@@ -253,6 +260,7 @@ defineExpose({
253
260
  :fetch="fetch"
254
261
  :call="call"
255
262
  :has-page="hasPage"
263
+ :summary-props="summaryProps"
256
264
  @select="triggerSelect"
257
265
  @select-all="triggerSelectAll"
258
266
  @selection-change="triggerSelectionChange"
@@ -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-29 17:34:31
5
+ * @LastEditTime: 2023-06-30 10:04:04
6
6
  * @FilePath: \common\src\components\bsgoal-base-table\demo.vue
7
7
  * @Description: 表格公共组件演示页面
8
8
  *
@@ -276,6 +276,7 @@ const clearSelection = () => {
276
276
  :config-options="configOptionsTable"
277
277
  :data="data"
278
278
  :auto-height="false"
279
+ :summary-props="['prop1', 'prop2', 'prop3', 'prop4', 'prop5', 'prop6']"
279
280
  @select="triggerSelect"
280
281
  @select-all="triggerSelectAll"
281
282
  @selection-change="triggerSelectionChange"
@@ -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-30 08:40:07
5
+ * @LastEditTime: 2023-06-30 10:33:45
6
6
  * @FilePath: \common\src\components\bsgoal-base-table\index.vue
7
7
  * @Description:
8
8
  *
@@ -140,6 +140,13 @@ const props = defineProps({
140
140
  showSummary: {
141
141
  type: [Boolean],
142
142
  default: false
143
+ },
144
+ /**
145
+ * 合计的列
146
+ */
147
+ summaryProps: {
148
+ type: [Array],
149
+ default: () => []
143
150
  }
144
151
  })
145
152
 
@@ -278,22 +285,20 @@ const clearSelection = () => {
278
285
  // ---> S 表格绑定的方法 <---
279
286
 
280
287
  const summaryMethod = (columns = '') => {
288
+ const { summaryProps = [] } = props
281
289
  const dataList = columns.data
282
290
  const calcResultList = []
283
291
 
284
- dataList.forEach((fi = {}) => {
285
- let calcIndex = 0
286
- for (const [prop, value] of Object.entries(fi)) {
287
- const cellValue = calcResultList[calcIndex]
288
- const cellValueInt = parseInt(cellValue) || 0
289
- const valueInt = parseInt(value) || 0
290
- calcResultList[calcIndex] = cellValueInt + valueInt
291
- calcIndex++
292
- }
292
+ summaryProps.forEach((prop = '', index = 0) => {
293
+ let sum = 0
294
+ const propDataList = dataList.map((mi) => mi[prop])
295
+ propDataList.forEach((pfi) => {
296
+ const valueInt = parseInt(pfi) || 0
297
+ sum += valueInt
298
+ })
299
+ calcResultList[index] = sum
293
300
  })
294
-
295
-
296
- return ['合计', ...calcResultList.slice(1)]
301
+ return ['合计', ...calcResultList]
297
302
  }
298
303
 
299
304
  // ---> E 表格绑定的方法 <---
@@ -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-29 14:37:18
5
+ * @LastEditTime: 2023-06-30 10:13:58
6
6
  * @FilePath: \common\src\components\bsgoal-base-tree-table\index.vue
7
7
  * @Description: 树结构 + 列表
8
8
  *
@@ -172,9 +172,16 @@ const props = defineProps({
172
172
  /**
173
173
  * 是否显示合计
174
174
  */
175
- showSummary: {
175
+ showSummary: {
176
176
  type: [Boolean],
177
177
  default: false
178
+ },
179
+ /**
180
+ * 合计的列
181
+ */
182
+ summaryProps: {
183
+ type: [Array],
184
+ default: () => []
178
185
  }
179
186
  })
180
187
 
@@ -233,7 +240,7 @@ const refreshList = (params = {}) => {
233
240
  }
234
241
 
235
242
  // ---> S 触发事件 <---
236
- const triggerSelect = (selection = {}, row =[]) => {
243
+ const triggerSelect = (selection = {}, row = []) => {
237
244
  emits('on-select-table', selection, row)
238
245
  }
239
246
  const triggerSelectAll = (selection = {}) => {
@@ -303,6 +310,7 @@ const tableStyler = computed(() => {
303
310
  ref="BSGOAL_BASE_SEARCH_TABLE_REF"
304
311
  v-bind="$props"
305
312
  :show-summary="showSummary"
313
+ :summary-props="summaryProps"
306
314
  @select="triggerSelect"
307
315
  @select-all="triggerSelectAll"
308
316
  @selection-change="triggerSelectionChange"