@bsgoal/common 1.6.4 → 1.6.6
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 +487 -460
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/bsgoal-base-search/index.vue +3 -3
- package/src/components/bsgoal-base-search-table/demo.vue +20 -5
- package/src/components/bsgoal-base-search-table/index.vue +49 -10
- package/src/components/bsgoal-base-table/index.vue +53 -18
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-13 09:38:11
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-
|
|
5
|
+
* @LastEditTime: 2023-05-18 11:25:14
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-search\index.vue
|
|
7
7
|
* @Description: 表格查询 公共组件
|
|
8
8
|
*
|
|
@@ -263,8 +263,9 @@ const triggerOperationFold = (status = false) => {
|
|
|
263
263
|
* @return {*}
|
|
264
264
|
*/
|
|
265
265
|
const triggerValueChange = (type, prop) => {
|
|
266
|
+
|
|
266
267
|
// 触发查询
|
|
267
|
-
|
|
268
|
+
triggerOperationSearch()
|
|
268
269
|
const emitValue = {
|
|
269
270
|
type,
|
|
270
271
|
prop,
|
|
@@ -314,7 +315,6 @@ const triggerValueChange = (type, prop) => {
|
|
|
314
315
|
v-model="model[prop]"
|
|
315
316
|
:placeholder="placeholderSet(type, label, placeholder)"
|
|
316
317
|
:clearable="clearable"
|
|
317
|
-
@change="triggerValueChange(type, prop)"
|
|
318
318
|
/>
|
|
319
319
|
</template>
|
|
320
320
|
<!-- / input 输入框组件 -->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-18 17:04:53
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-05-
|
|
5
|
+
* @LastEditTime: 2023-05-18 10:12:16
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-search-table\demo.vue
|
|
7
7
|
* @Description: 查询 + 表格 组合公共组件
|
|
8
8
|
*
|
|
@@ -705,8 +705,9 @@ const tableDataVal = unref(tableData)
|
|
|
705
705
|
|
|
706
706
|
const fetch = (params) => {
|
|
707
707
|
console.log('params >>>', params)
|
|
708
|
-
return new Promise((resolve
|
|
708
|
+
return new Promise((resolve) => {
|
|
709
709
|
setTimeout(() => {
|
|
710
|
+
// 存在分页
|
|
710
711
|
resolve({
|
|
711
712
|
data: {
|
|
712
713
|
rows: tableDataVal,
|
|
@@ -714,6 +715,11 @@ const fetch = (params) => {
|
|
|
714
715
|
},
|
|
715
716
|
message: '获取数据成功'
|
|
716
717
|
})
|
|
718
|
+
// 不存在分页
|
|
719
|
+
// resolve({
|
|
720
|
+
// data: tableDataVal,
|
|
721
|
+
// message: '获取数据成功'
|
|
722
|
+
// })
|
|
717
723
|
}, 3000)
|
|
718
724
|
})
|
|
719
725
|
}
|
|
@@ -725,15 +731,24 @@ const fetch = (params) => {
|
|
|
725
731
|
<BsgoalBaseSearchTable
|
|
726
732
|
selection
|
|
727
733
|
operation
|
|
728
|
-
:map-props="{
|
|
729
|
-
currentPage:'pageIndex'
|
|
730
|
-
}"
|
|
731
734
|
:call="call"
|
|
732
735
|
:fetch="fetch"
|
|
733
736
|
:config-options="configOptions"
|
|
734
737
|
:expression="75"
|
|
735
738
|
@on-search="triggerSearch"
|
|
736
739
|
>
|
|
740
|
+
<!--
|
|
741
|
+
<BsgoalBaseSearchTable
|
|
742
|
+
selection
|
|
743
|
+
operation
|
|
744
|
+
:has-search="false"
|
|
745
|
+
:has-page="false"
|
|
746
|
+
:call="call"
|
|
747
|
+
:fetch="fetch"
|
|
748
|
+
:config-options="configOptions"
|
|
749
|
+
:expression="75"
|
|
750
|
+
@on-search="triggerSearch"
|
|
751
|
+
> -->
|
|
737
752
|
<template v-slot:menu>
|
|
738
753
|
<el-button type="primary">操作按钮</el-button>
|
|
739
754
|
</template>
|
|
@@ -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-05-
|
|
5
|
+
* @LastEditTime: 2023-05-18 10:13:34
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-search-table\index.vue
|
|
7
7
|
* @Description: 查询+表格 基础组件
|
|
8
8
|
*
|
|
@@ -93,15 +93,15 @@ const props = defineProps({
|
|
|
93
93
|
default: null
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
* 表格高度 下边距值
|
|
97
|
+
*/
|
|
98
98
|
expression: {
|
|
99
99
|
type: [Number],
|
|
100
100
|
default: 75
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
103
|
* 映射字段
|
|
104
|
-
|
|
104
|
+
*/
|
|
105
105
|
mapProps: {
|
|
106
106
|
type: [Object],
|
|
107
107
|
default: () => ({
|
|
@@ -111,6 +111,20 @@ const props = defineProps({
|
|
|
111
111
|
total: 'total'
|
|
112
112
|
})
|
|
113
113
|
},
|
|
114
|
+
/**
|
|
115
|
+
* 是否显示分页
|
|
116
|
+
*/
|
|
117
|
+
hasPage: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: true
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* 是否显示查询
|
|
123
|
+
*/
|
|
124
|
+
hasSearch: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: true
|
|
127
|
+
}
|
|
114
128
|
})
|
|
115
129
|
|
|
116
130
|
const transferFoldStatus = ref(false)
|
|
@@ -120,7 +134,7 @@ const options = unref(props.configOptions)
|
|
|
120
134
|
|
|
121
135
|
// 查询 配置项
|
|
122
136
|
const searchOptions = computed(() => {
|
|
123
|
-
return options.filter(fi => {
|
|
137
|
+
return options.filter((fi) => {
|
|
124
138
|
const { type = '' } = fi
|
|
125
139
|
return !!type
|
|
126
140
|
})
|
|
@@ -128,7 +142,7 @@ const searchOptions = computed(() => {
|
|
|
128
142
|
|
|
129
143
|
// 表格 配置项
|
|
130
144
|
const tableOptions = computed(() => {
|
|
131
|
-
return options.filter(fi => {
|
|
145
|
+
return options.filter((fi) => {
|
|
132
146
|
const { item = false } = fi
|
|
133
147
|
return !item
|
|
134
148
|
})
|
|
@@ -143,17 +157,42 @@ const BSGOAL_BASE_TABLE_REF = ref(null)
|
|
|
143
157
|
const triggerSearch = (searchParams) => {
|
|
144
158
|
BSGOAL_BASE_TABLE_REF.value.refreshList(searchParams)
|
|
145
159
|
}
|
|
160
|
+
|
|
161
|
+
// ---> S 计算expression <---
|
|
162
|
+
const expresionGet = computed(() => {
|
|
163
|
+
const { expression, hasPage } = props
|
|
164
|
+
if (hasPage === false) {
|
|
165
|
+
return 25
|
|
166
|
+
}
|
|
167
|
+
return expression
|
|
168
|
+
})
|
|
169
|
+
// ---> E 计算expression <---
|
|
146
170
|
</script>
|
|
147
171
|
<template>
|
|
148
172
|
<div class="bsgoal-base-search-table">
|
|
149
173
|
<div class="base_search_table">
|
|
150
174
|
<!-- S 查询 -->
|
|
151
|
-
<BsgoalBaseSearch
|
|
175
|
+
<BsgoalBaseSearch
|
|
176
|
+
v-show="hasSearch"
|
|
177
|
+
:config-options="searchOptions"
|
|
178
|
+
@on-search="triggerSearch"
|
|
179
|
+
@on-clear="triggerSearch"
|
|
180
|
+
/>
|
|
152
181
|
<!-- E 查询 -->
|
|
153
182
|
<!-- S 表格 -->
|
|
154
|
-
<BsgoalBaseTable
|
|
155
|
-
|
|
156
|
-
:
|
|
183
|
+
<BsgoalBaseTable
|
|
184
|
+
ref="BSGOAL_BASE_TABLE_REF"
|
|
185
|
+
:map-props="mapProps"
|
|
186
|
+
:operationWidth="operationWidth"
|
|
187
|
+
:config-options="tableOptions"
|
|
188
|
+
:data="tableData"
|
|
189
|
+
:selection="selection"
|
|
190
|
+
:operation="operation"
|
|
191
|
+
:expression="expresionGet"
|
|
192
|
+
:fetch="fetch"
|
|
193
|
+
:call="call"
|
|
194
|
+
:has-page="hasPage"
|
|
195
|
+
>
|
|
157
196
|
<!-- S 顶部菜单 -->
|
|
158
197
|
|
|
159
198
|
<template v-for="slotName of slotNames" v-slot:[slotName]="{ 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-05-
|
|
5
|
+
* @LastEditTime: 2023-05-18 10:05:33
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-table\index.vue
|
|
7
7
|
* @Description:
|
|
8
8
|
*
|
|
@@ -111,7 +111,7 @@ const props = defineProps({
|
|
|
111
111
|
},
|
|
112
112
|
/**
|
|
113
113
|
* 表格高度
|
|
114
|
-
*
|
|
114
|
+
*
|
|
115
115
|
* 默认 : 自动计算
|
|
116
116
|
* 布尔值 : 默认表格高度
|
|
117
117
|
* 字符串 : 直接赋值给 height
|
|
@@ -124,7 +124,7 @@ const props = defineProps({
|
|
|
124
124
|
/**
|
|
125
125
|
* 是否显示分页
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
hasPage: {
|
|
128
128
|
type: Boolean,
|
|
129
129
|
default: true
|
|
130
130
|
}
|
|
@@ -183,21 +183,28 @@ const tableLoading = ref(props.loading)
|
|
|
183
183
|
const tableData = ref(props.data)
|
|
184
184
|
const resData = ref({})
|
|
185
185
|
const ping = () => {
|
|
186
|
-
const { fetch, call } = props
|
|
186
|
+
const { fetch, call, hasPage } = props
|
|
187
187
|
const searchParamsVal = searchParams.value
|
|
188
188
|
const currentPageVal = currentPage.value
|
|
189
189
|
const pageSizeVal = pageSize.value
|
|
190
190
|
const fetchParams = { ...searchParamsVal }
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
// 显示分页的注入分页参数
|
|
192
|
+
if (hasPage) {
|
|
193
|
+
fetchParams[mapPropsFuse.currentPage] = currentPageVal
|
|
194
|
+
fetchParams[mapPropsFuse.pageSize] = pageSizeVal
|
|
195
|
+
}
|
|
194
196
|
|
|
195
197
|
useFetch(fetch(fetchParams), call, tableLoading, resData)
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
watch(resData, (data) => {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
// 存在分页才注入
|
|
202
|
+
if (props.hasPage) {
|
|
203
|
+
tableData.value = data[mapPropsFuse.rows]
|
|
204
|
+
total.value = data[mapPropsFuse.total]
|
|
205
|
+
} else {
|
|
206
|
+
tableData.value = data
|
|
207
|
+
}
|
|
201
208
|
})
|
|
202
209
|
|
|
203
210
|
// 查询
|
|
@@ -235,13 +242,20 @@ defineExpose({
|
|
|
235
242
|
<!-- E 表头操作区域 -->
|
|
236
243
|
<!-- S 表格区域 -->
|
|
237
244
|
<div ref="EL_TABLE_WRAP_REF">
|
|
238
|
-
<el-table
|
|
245
|
+
<el-table
|
|
246
|
+
stripe
|
|
247
|
+
border
|
|
248
|
+
highlight-current-row
|
|
249
|
+
style="width: 100%"
|
|
250
|
+
v-loading="tableLoading"
|
|
251
|
+
:data="tableData"
|
|
239
252
|
:header-cell-style="{
|
|
240
253
|
fontWeight: 'bold',
|
|
241
254
|
backgroundColor: '#EBEEF5',
|
|
242
255
|
color: 'rgba(0,0,0,.85)',
|
|
243
256
|
fontSize: '14px'
|
|
244
|
-
}"
|
|
257
|
+
}"
|
|
258
|
+
>
|
|
245
259
|
<!-- / 无数据展示内容 -->
|
|
246
260
|
<template #empty>
|
|
247
261
|
<BsgoalBaseTableEmpty />
|
|
@@ -251,11 +265,28 @@ defineExpose({
|
|
|
251
265
|
<el-table-column v-if="selection" fixed="left" type="selection" width="40" />
|
|
252
266
|
<!-- / 多选 -->
|
|
253
267
|
<!-- / 表格内容 -->
|
|
254
|
-
<template
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
268
|
+
<template
|
|
269
|
+
v-for="(
|
|
270
|
+
{
|
|
271
|
+
prop = '',
|
|
272
|
+
label = '',
|
|
273
|
+
align = 'center',
|
|
274
|
+
width = '',
|
|
275
|
+
fixed = false,
|
|
276
|
+
tooltip = false,
|
|
277
|
+
limit = 0
|
|
278
|
+
} = {},
|
|
279
|
+
index
|
|
280
|
+
) of configOptionsGet"
|
|
281
|
+
:key="index"
|
|
282
|
+
>
|
|
283
|
+
<el-table-column
|
|
284
|
+
:label="label"
|
|
285
|
+
:align="align"
|
|
286
|
+
:width="width"
|
|
287
|
+
:fixed="fixed"
|
|
288
|
+
:min-width="`${label.length * 14 + 24}px`"
|
|
289
|
+
>
|
|
259
290
|
<template v-slot:default="{ row }">
|
|
260
291
|
<slot :name="prop" :row="row">
|
|
261
292
|
<BsgoalBaseTableContent :limit="limit" :tooltip="tooltip" :data="row[prop]" />
|
|
@@ -270,8 +301,12 @@ defineExpose({
|
|
|
270
301
|
<!-- E 表格区域 -->
|
|
271
302
|
|
|
272
303
|
<!-- S 分页 -->
|
|
273
|
-
<BsgoalBaseTablePagination
|
|
274
|
-
|
|
304
|
+
<BsgoalBaseTablePagination
|
|
305
|
+
v-if="hasPage"
|
|
306
|
+
:total="total"
|
|
307
|
+
@on-current-change="triggerPaginationCurrentChange"
|
|
308
|
+
@on-size-change="triggerPaginationSizeChange"
|
|
309
|
+
/>
|
|
275
310
|
<!-- E 分页 -->
|
|
276
311
|
</div>
|
|
277
312
|
</div>
|