Closed
Description
版本号:
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 commentedon Jun 24, 2020
你确认你的版本是2.2? 2.2版本通过属性mutil为true是可以的
http://doc.jeecg.com/1273913
whoisSixbusy commentedon Jun 28, 2020
确实,遇到这个问题,multi设置为true仅仅可以多选,但返回的数据为先选的第一条数据。并且如果destfields中的字段有隐藏,或列表中不配置的,会报错!
lvdandan16 commentedon Jun 29, 2020
已修复,下个版本升级
whoisSixbusy commentedon Jun 29, 2020
lvdandan16 commentedon Jun 30, 2020
可修改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 commentedon Jun 30, 2020
项目中就没有 JPopup.vue 这个文件