From 6c362861a043c2fba0beeb6dd71055b1d807fe65 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Mon, 6 Dec 2021 00:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90#3203=E3=80=91JSelectBizComponent=20co?= =?UTF-8?q?lumns=20=E5=BB=BA=E8=AE=AE=E5=BC=80=E6=94=BEcustomRender?= =?UTF-8?q?=E7=AD=89=E6=96=B9=E6=B3=95=E7=B1=BB=E9=85=8D=E7=BD=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JSelectBizComponentModal.vue | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue b/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue index c88c8cee..f99ff94f 100644 --- a/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue +++ b/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue @@ -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)