Commit 6c362861 by zhangdaiscott

【#3203】JSelectBizComponent columns 建议开放customRender等方法类配置]

parent 2a5ec116
......@@ -62,8 +62,9 @@
import { getAction } from '@/api/manage'
import Ellipsis from '@/components/Ellipsis'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { cloneObject, pushIfNotExist } from '@/utils/util'
import { pushIfNotExist } from '@/utils/util'
import JSelectBizQueryItem from './JSelectBizQueryItem'
import {cloneDeep} from 'lodash'
export default {
name: 'JSelectBizComponentModal',
......@@ -177,11 +178,24 @@
computed: {
// 表头
innerColumns() {
let columns = cloneObject(this.columns)
let columns = cloneDeep(this.columns)
columns.forEach(column => {
// 给所有的列加上过长裁剪
if (this.ellipsisLength !== -1) {
column.customRender = (text) => this.renderEllipsis(text)
// JSelectBizComponent columns 建议开放customRender等方法类配置
// https://github.com/jeecgboot/jeecg-boot/issues/3203
let myCustomRender = column.customRender
column.customRender = (text, record, index) => {
let value = text
if (typeof myCustomRender === 'function') {
// noinspection JSVoidFunctionReturnValueUsed
value = myCustomRender(text, record, index)
}
if (typeof value === 'string') {
return this.renderEllipsis(value)
}
return value
}
}
})
return columns
......@@ -192,7 +206,7 @@
deep: true,
immediate: true,
handler(val) {
this.innerValue = cloneObject(val)
this.innerValue = cloneDeep(val)
this.selectedRowKeys = []
this.valueWatchHandler(val)
this.queryOptionsByValue(val)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment