lw-cdp-ui 1.3.19 → 1.3.21
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/components/lwFlow/index.vue +0 -1
- package/dist/components/lwTable/components/TableColumn.vue +54 -7
- package/dist/lw-cdp-ui.esm.js +3675 -3638
- package/dist/lw-cdp-ui.umd.js +13 -13
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -57,8 +57,7 @@
|
|
|
57
57
|
{{ col.title }}
|
|
58
58
|
<el-tooltip v-if="col.tips">
|
|
59
59
|
<template #content>
|
|
60
|
-
<span
|
|
61
|
-
style="max-width: 300px; display: inline-block;">{{ col.tips }}</span>
|
|
60
|
+
<span style="max-width: 300px; display: inline-block;">{{ col.tips }}</span>
|
|
62
61
|
</template>
|
|
63
62
|
<el-icon>
|
|
64
63
|
<component :is="col.icon || 'el-icon-question-filled'" />
|
|
@@ -210,6 +209,32 @@
|
|
|
210
209
|
</slot>
|
|
211
210
|
</template>
|
|
212
211
|
|
|
212
|
+
<!-- 枚举 options -->
|
|
213
|
+
<template v-else-if="col.options?.length">
|
|
214
|
+
<template v-if="col?.isEdit">
|
|
215
|
+
<el-select class="select-select number"
|
|
216
|
+
v-model="scope.row[col.dataIndex]"
|
|
217
|
+
placeholder="请选择"
|
|
218
|
+
clearable
|
|
219
|
+
filterable
|
|
220
|
+
@change="(val) => col.callback?.(val, scope.row)">
|
|
221
|
+
<el-option v-for="item in col.options"
|
|
222
|
+
:key="item[col.optionsValue || 'value']"
|
|
223
|
+
:label="item[col.optionsLabel || 'label']"
|
|
224
|
+
:value="item[col.optionsValue || 'value']" />
|
|
225
|
+
</el-select>
|
|
226
|
+
</template>
|
|
227
|
+
<template v-else>
|
|
228
|
+
{{ getEnumLabel(scope.row, col) }}
|
|
229
|
+
</template>
|
|
230
|
+
</template>
|
|
231
|
+
|
|
232
|
+
<!-- 链接跳转 -->
|
|
233
|
+
<template v-else-if="col.link">
|
|
234
|
+
<span class="el-button el-button--primary el-button--small is-text"
|
|
235
|
+
@click="col.clickFun?.(scope.row, scope.$index, tableData)"> {{ scope.row[col.dataIndex] || '' }}</span>
|
|
236
|
+
</template>
|
|
237
|
+
|
|
213
238
|
<!-- 其他简单渲染 -->
|
|
214
239
|
<template v-else>
|
|
215
240
|
{{ getChildName(scope.row, col) }}
|
|
@@ -247,7 +272,7 @@ export default {
|
|
|
247
272
|
*/
|
|
248
273
|
filterOperations(operations, row) {
|
|
249
274
|
return (
|
|
250
|
-
operations?.filter(
|
|
275
|
+
operations?.filter(o => {
|
|
251
276
|
const hasAuth = !o.auth || this.checkAuth(o.auth)
|
|
252
277
|
const isVisible = !o.isShow || o.isShow(row)
|
|
253
278
|
return hasAuth && isVisible
|
|
@@ -258,12 +283,12 @@ export default {
|
|
|
258
283
|
* 检查权限
|
|
259
284
|
*/
|
|
260
285
|
checkAuth(auth) {
|
|
261
|
-
const {
|
|
286
|
+
const {menus = [], authorities = []} = JSON.parse(localStorage.getItem('userAuthInfo') || '{}')
|
|
262
287
|
const allPermissions = [...menus]
|
|
263
288
|
|
|
264
289
|
if (!auth) return true
|
|
265
290
|
if (Array.isArray(auth)) {
|
|
266
|
-
return auth.some(
|
|
291
|
+
return auth.some(permission => allPermissions.includes(permission))
|
|
267
292
|
}
|
|
268
293
|
return allPermissions.includes(auth)
|
|
269
294
|
},
|
|
@@ -271,9 +296,31 @@ export default {
|
|
|
271
296
|
* 渲染多层级数据
|
|
272
297
|
*/
|
|
273
298
|
getChildName(item, col) {
|
|
274
|
-
if (!col.dataIndex) return ''
|
|
275
|
-
const value = col.dataIndex.split('.').reduce((obj, key) => obj?.[key], item)
|
|
299
|
+
if (!col.dataIndex) return ''
|
|
300
|
+
const value = col.dataIndex.split('.').reduce((obj, key) => obj?.[key], item)
|
|
276
301
|
return value ?? (value === 0 ? '0' : '')
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* 返回枚举label
|
|
305
|
+
*/
|
|
306
|
+
getEnumLabel(item, col) {
|
|
307
|
+
if (!col.dataIndex) return ''
|
|
308
|
+
const value = col.dataIndex.split('.').reduce((obj, key) => obj?.[key], item)
|
|
309
|
+
|
|
310
|
+
if (!col || !Array.isArray(col.options) || col.options.length === 0) {
|
|
311
|
+
return ''
|
|
312
|
+
}
|
|
313
|
+
const {options, optionsLabel = 'label', optionsValue = 'value'} = col
|
|
314
|
+
// 统一处理为数组
|
|
315
|
+
let values = Array.isArray(value) ? value : typeof value === 'string' ? value.split(',') : [value]
|
|
316
|
+
// 获取匹配的 labels
|
|
317
|
+
let labels = values
|
|
318
|
+
.map(val => {
|
|
319
|
+
const option = options.find(opt => opt[optionsValue] == val)
|
|
320
|
+
return option ? option[optionsLabel] : ''
|
|
321
|
+
})
|
|
322
|
+
.filter(label => label !== '')
|
|
323
|
+
return labels.join(', ') || '--'
|
|
277
324
|
}
|
|
278
325
|
}
|
|
279
326
|
}
|