<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<jsp:include page="/common/common-js.jsp"></jsp:include>
<br>
<br>
<div class="container">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">新增或修改页面</div>
</div>
<div class="panel-body">
<form class="form-horizontal" action="<%=request.getContextPath() %>/memberController/addMember.do" method="post">
<input type="hidden" name="membeId" class="form-control" value="${m.membeId }">
<div class="form-group">
<label class="control-label col-md-3">会员名称</label>
<div class="col-md-5">
<input type="text" name="memberName" class="form-control" value="${m.memberName }">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">会员性别</label>
<div class="col-md-5">
<label class="radio-inline">
<input type="radio" name="memberSex" value="1" ${m.memberSex==1?'checked':'' }>男
</label>
<label class="radio-inline">
<input type="radio" name="memberSex" value="2" ${m.memberSex==2?'checked':'' }>女
</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">会员生日</label>
<div class="col-md-5">
<div class="input-group">
<input type="text" name="memberBirth" class="form-control" id="memberBirth" value="${m.memberBirth }">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">所属部门</label>
<div class="col-md-6" id="span1">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3"></label>
<div class="col-md-5">
<button type="submit" class="btn btn-success">提交</button>
<button type="reset" class="btn btn-danger">重置</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
/* 图片回显 */
var bookLogo = '${m.fileName }';
if(bookLogo=='')
{
initFileInput("fileImg","filePath");
}else
{
initFileInput("fileImg","filePath",['<%=request.getContextPath()%>'+bookLogo]);
}
initDate("memberBirth");
initType();
});
function initType(){
/* 回显 */
var memberdept='${m.memberdept.medeptId }';
$.ajax({
url:"<%=request.getContextPath() %>/memberController/queryMemberdept.do",
type:"post",
data:{
},
success:function(arr){
console.log(arr);
/* 新增下拉框 */
var str = '';
str+='<select name="memberdept.medeptId" class="form-control">';
str+='<option value="-1">请选择</option>';
for (var i = 0; i < arr.length; i++) {
str+='<option value="'+arr[i].medeptId+'" '+(memberdept==arr[i].medeptId?'selected':'')+' >'+arr[i].medeptName+'</option>';
}
$("#span1").html(str);
/*新增单选框*/
/* var tab = '';
for (var i = 0; i < arr.length; i++) {
tab += '<label class="radio-inline">';
tab += ' <input type="radio" '+(brand==arr[i].brandId?'checked':'')+' name="brand.brandId" value="'+arr[i].brandId+'">'+arr[i].brandName;
tab += ' </label>';
}
$("#span1").html(tab); */
/*新增多选框*/
/*var tab = '';
for (var i = 0; i < arr.length; i++) {
tab += '<label class="checkbox-inline">';
tab += ' <input type="checkbox" '+(brand==arr[i].brandId?'checked':'')+' name="brand.brandId" value="'+arr[i].brandId+'">'+arr[i].brandName;
tab += ' </label>';
}
$("#span1").html(tab); */
},
error : function(e) {
console.log(e);
}
});
}