EasyUi 方法传递多个参数值得方法

1.项目中需要传递多个参数值

function actionFtt(value, row, index) {
    //传递查询需要的参数
    var customerId = row.customerId;//竞买人ID
    var bailClass = row.bailClass;//保证金类别
    
    
    var agencyId = row.agencyId;//市场ID
    
  //使用合理的方式隔开 var detail
= '<a href="#" onclick="detail(\'' + customerId + '\',\''+ bailClass + '\',\''+ agencyId + '\')">详情</a>'; if(top.checkRole(['LOCK_FORFEITRUE'])){ return detail; } return ""; }

 

 

2.在使用easyui dialog 方法的时候传值问题

/**
 * 保证金明细的详情信息
 * 竞买人id()
 * --- 通用   bailClass
 * --- 专项   bailClass agencyId
 */
function detail(customerId,bailClass,agencyId){
    //DIV对象
    var detailLog= $('#dialog-alarm-detail').dialog(
            {
                title: '保证金明细详情',
                width: '60%',
                height:'60%',
                modal: true,
                closable:true,
                href: parent.parent.baseUrl+"customer/bail/bailInfo",
                onLoad: function () {
                     $.ajax({  
                         type: "POST",  
                         async: false,  
                         success: function (result) {
                             //新创建的格式化的表格
                             $('#detail').datagrid({
                                idField : 'id', // 只要创建数据表格 就必须要加 ifField
//                                title : '保证金明细详情',
                                width: '100%',
                                height:'100%',
                                url : parent.parent.baseUrl+'customer/bail/bailDetailsInfo?customerId='+customerId+'&&bailClass='+bailClass+'&&agencyId='+agencyId,
                                method : 'GET',
                                fitColumns : true,
                                striped : true, // 隔行变色特性
                                nowrap : false,
                                loadMsg : '数据正在加载,请耐心的等待...',
                                rownumbers : true,
                                sortName : 'crtTime',
                                sortOrder : 'desc',
                                rowStyler : function(index, record) {},
                                columns : [ [{
                                    field : 'updTime',
                                    title : '冻结时间',
                                    width : 50,
                                    align : 'center',
                                }, {
                                    field : 'bailStatus',
                                    title : '保证金冻结状态',
                                    width : 50,
                                    align : 'center',
                                    formatter : statusFot
                                }, {
                                    field : 'lockBail',
                                    title : '保证金冻结金额',
                                    width : 80,
                                    align : 'center'
                                }, {
                                    field : 'goodsName',
                                    title : '拍卖名称',
                                    width : 80,
                                    align : 'center'
                                }]],
                                pagination : false,
                                pageSize : 10,
                                pageList : [ 5, 10, 15, 20, 50 ],
                            });
                             
                         }
                     });
                 },
            buttons : [ {
                text : "关闭",
                handler : function() {
                    detailLog.dialog('close');
                }
            } ]
   });
    
}

 

3.后台的web层代码

/**
     * 查询保证金的明细的详情
     * customerId
     * bailClass
     * agencyId
     * 
     */
    @RequestMapping(value = "/bailDetailsInfo", method = RequestMethod.GET, produces = { "application/json" })
    @ResponseBody
    public ListWithTotalCount<BailLockDTO> bailDetailsInfo(Long customerId,int bailClass,String agencyId) {
        
        if (logger.isDebugEnabled()) {
            logger.debug("bailDetailsInfo, customerId:{}", customerId);
        }
        
        List<BailLockDTO> retList = new ArrayList<BailLockDTO>();
        BailLockDTO bailLockDto = null;
        
        if (bailClass == 1) {
            Specification<BailLock> spec = (root, query, cb) -> {
                List<Predicate> predicates = new ArrayList<Predicate>();
                Predicate predicate1 = cb.equal(root.get(BailLock_.customerId), customerId);// 当前登录用户的id
                predicates.add(predicate1);
                Predicate predicate2 = cb.equal(root.get(BailLock_.bailClass), BailPay.BAIL_CLASS_TONGYONG);//通用
                predicates.add(predicate2);
                if (!predicates.isEmpty()) {
                    return cb.and(predicates.toArray(new Predicate[0]));
                } else {
                    return null;
                }
            };
            
            List<BailLock> bailLockList = bailLockRepository.findAll(spec);
            if(bailLockList != null && bailLockList.size()>0){
                for (BailLock bailLock : bailLockList) {
                    if (bailLock != null) {
                        String aucLotId = bailLock.aucLotId();
                        
                        AucLot aucLot = aucLotRepository.findOne(aucLotId);
                        
                        //定义返回的信息值
                        bailLockDto = new BailLockDTO(bailLock.bailStatus(),aucLot.goodsName(),bailLock.lockBail(),bailLock.updTime());
                        retList.add(bailLockDto);
                    }
                }
            }
            
        } else {
            
            Specification<BailLock> spec = (root, query, cb) -> {
                List<Predicate> predicates = new ArrayList<Predicate>();
                Predicate predicate1 = cb.equal(root.get(BailLock_.customerId), customerId);// 当前登录用户的id
                predicates.add(predicate1);
                Predicate predicate2 = cb.equal(root.get(BailLock_.bailClass), BailPay.BAIL_CLASS_ZHUANXIANG);//专项
                predicates.add(predicate2);
                Predicate predicate3 = cb.equal(root.get(BailLock_.agencyId), agencyId);//机构id
                predicates.add(predicate3);
                if (!predicates.isEmpty()) {
                    return cb.and(predicates.toArray(new Predicate[0]));
                } else {
                    return null;
                }
            };
            
            List<BailLock> bailLockList = bailLockRepository.findAll(spec);
            if(bailLockList != null && bailLockList.size()>0){
                for (BailLock bailLock : bailLockList) {
                    if (bailLock != null) {
                        String aucLotId = bailLock.aucLotId();
                        
                        AucLot aucLot = aucLotRepository.findOne(aucLotId);
                        
                        //定义返回的信息值
                        bailLockDto = new BailLockDTO(bailLock.bailStatus(),aucLot.goodsName(),bailLock.lockBail(),bailLock.updTime());
                        retList.add(bailLockDto);
                    }
                }
            }
            
        }
        
        return new ListWithTotalCount<BailLockDTO>(retList,100);
    }

 

上一篇:Shell编程之通配符


下一篇:调试台自动多出现一个'' ,我 用uploadify上传图片时,在给页面写入一个返回值为图片名称的变量的值的时候值的前面始终多出现一个''