相关问题及解决办法

功能:添加手机即可绑定人员(前提已经注册),可添加管理门店及信息

类:StoreMemberController 

视图:member_list.ftl、member_edit.ftl

遇到的问题:门店显示、获取ID值、列表通过门店ID显示门店Name



一、门店显示

method:

public void getPowerStores() {
		
		String sql = "select 1 as checked,id,name from store_info where user_id=?";
		
		if(!SH.getUser().getStoreUserId().equals("master")) {
			sql += "and id in (" +
						"select " +
							"store_id " +
						"from store_user_power " +
						"where user_name ='"+SH.getUser().getStoreUserId()+"'" +
				  ")";
		}
		
		List<Record> cates=Db.find(sql, SH.getUser().getUserId());
		this.renderJson(cates);		
	}
ftl:使用angular内置的行选择,模仿原生的checkbox,方便排版

<div class="control-group">
      <label class="control-label" style="width:100px;">可管理门店: </label>
      <div class="controls" style="margin-left:120px;" >
          <span style="cursor:pointer;" ng-repeat="store in stores" ng-click="check(store);">
             <div class="checker"><span ng-class="{checked:(store.checked==1)}"></span></div>
             <lable ng-bind="store.name"></lable>
          </span>
      </div>
</div>
angularJS:
$scope.check=function(store){   //行单击事件
     if(store.checked==1){
	store.checked=0;
	}else{
	  store.checked=1;
	}
};

$http.post("home/member/getPowerStores").success(function(data){
            //alert(angular.toJson(data));                
            $scope.stores = data;
            angular.forEach($scope.stores,function(store){
                if($scope.stores.indexOf(store.id) >=0 ){
                    store.checked == 1;
                }
            });
        });



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值