Skip to content

popup生成代码后多选失效 #1373

Closed
@lileltp

Description

@lileltp
版本号:

2.2.0

问题描述:

JPopup在online表单中是多选.当生成代码后.变为单选.在给popup添加属性mutil为true后依然返回是单个数据.如何实现多选功能

截图&代码:

<j-popup v-decorator="['contentNames']" :trigger-change="true" org-fields="id,name" dest-fields="contentIds,contentNames" code="examination_list" :multi="true" @callback="popupCallback" />
友情提示: 未按格式要求发帖,会直接删掉。

Activity

zhangdaiscott

zhangdaiscott commented on Jun 24, 2020

@zhangdaiscott
Member

你确认你的版本是2.2? 2.2版本通过属性mutil为true是可以的
http://doc.jeecg.com/1273913

whoisSixbusy

whoisSixbusy commented on Jun 28, 2020

@whoisSixbusy

你确认你的版本是2.2? 2.2版本通过属性mutil为true是可以的
http://doc.jeecg.com/1273913

确实,遇到这个问题,multi设置为true仅仅可以多选,但返回的数据为先选的第一条数据。并且如果destfields中的字段有隐藏,或列表中不配置的,会报错!

lvdandan16

lvdandan16 commented on Jun 29, 2020

@lvdandan16

已修复,下个版本升级

whoisSixbusy

whoisSixbusy commented on Jun 29, 2020

@whoisSixbusy
lvdandan16

lvdandan16 commented on Jun 30, 2020

@lvdandan16

可修改JPopup.vue 文件的callBack方法
参考
callBack(rows) {
let orgFieldsArr = this.orgFields.split(',')
let destFieldsArr = this.destFields.split(',')
let resetText = false
if (this.field && this.field.length > 0) {
this.showText = ''
resetText = true
}
let res = {}
if (orgFieldsArr.length > 0) {
for (let i = 0; i < orgFieldsArr.length; i++) {
let tempDestArr = []
for(let rw of rows){
let val = rw[orgFieldsArr[i]]
if(!val){
val = ""
}
tempDestArr.push(val)
}
res[destFieldsArr[i]] = tempDestArr.join(",")
}
if (resetText === true) {
let tempText = []
for(let rw of rows){
let val = rw[orgFieldsArr[destFieldsArr.indexOf(this.field)]]
if(!val){
val = ""
}
tempText.push(val)
}
this.showText = tempText.join(",")
}
}
if (this.triggerChange) {
//v-dec时即triggerChange为true时 将整个对象给form页面 让他自己setFieldsValue
this.$emit('callback', res)
} else {
//v-model时 需要传一个参数field 表示当前这个字段 从而根据这个字段的顺序找到原始值
// this.$emit("input",row[orgFieldsArr[destFieldsArr.indexOf(this.field)]])
this.$emit('input', this.showText, res)
}
}

askyy1232008

askyy1232008 commented on Jun 30, 2020

@askyy1232008

项目中就没有 JPopup.vue 这个文件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @zhangdaiscott@lileltp@askyy1232008@whoisSixbusy@lvdandan16

        Issue actions

          popup生成代码后多选失效 · Issue #1373 · jeecgboot/JeecgBoot