Commit b826ece5 authored by liuchao's avatar liuchao

no message

parent 3c59d26c
...@@ -464,10 +464,22 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -464,10 +464,22 @@ public class RainbowPlanWebController extends BaseController<Object>{
cells = rows.createCell(10); cells = rows.createCell(10);
if (data.getVolunteer()!=null) { if (data.getVolunteer()!=null) {
String tel = data.getVolunteer().getConnectTel(); String tel = data.getVolunteer().getConnectTel();
tel = tel==null ? "" : "\n" + tel; tel = tel==null ? " " + data.getVolunteer().getPhone() : " " + tel;
String addr = data.getVolunteer().getReceiveAddress(); String addr = data.getVolunteer().getReceiveAddress();
addr = addr==null ? "" : "\n" + addr; addr = addr==null ? "" : "\n" + addr;
cells.setCellValue(data.getVolunteer().getName() + tel + addr); Integer helpType = data.getHelpType();
String express = "";
String expressCompany = data.getExpressCompany();
expressCompany = expressCompany==null ? "" : expressCompany;
String expressCode = data.getExpressCode();
expressCode = expressCode==null ? "" : expressCode;
if (helpType==2 || helpType==0) {
express = "\n" + expressCompany + " " + expressCode;
} else if (helpType==1) {
express = "\n自送";
}
cells.setCellValue(data.getVolunteer().getName() + tel + addr + express);
} else { } else {
cells.setCellValue(""); cells.setCellValue("");
} }
......
package com.qiankun.dao; package com.qiankun.dao;
import java.util.List;
import com.qiankun.dao.core.Hints; import com.qiankun.dao.core.Hints;
import com.qiankun.dao.core.IDao; import com.qiankun.dao.core.IDao;
import com.qiankun.entity.User; import com.qiankun.entity.User;
...@@ -20,4 +22,9 @@ public interface UserDao extends IDao<User, String> { ...@@ -20,4 +22,9 @@ public interface UserDao extends IDao<User, String> {
Boolean validateUserExistByUserName(String userName); Boolean validateUserExistByUserName(String userName);
User findByOpenid(String openid); User findByOpenid(String openid);
User findByPaperId(String paperId);
List<User> findUserPage(String name, String paperId, String start, String end, String bloodId,
String startbloodId, String endbloodId, String order, String sort, Hints hints);
} }
package com.qiankun.dao; package com.qiankun.dao;
import java.util.List;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.qiankun.dao.core.AbsDao; import com.qiankun.dao.core.AbsDao;
...@@ -11,21 +13,23 @@ import com.qiankun.pages.PageListImpl; ...@@ -11,21 +13,23 @@ import com.qiankun.pages.PageListImpl;
@Repository @Repository
public class UserDaoImpl extends AbsDao<User, String> implements UserDao { public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
private static final String FIND = "from User where "; private static final String FIND_USER_PAGE = " from User where (mobile like ? or paperId like ? or name like ? or userName like ?) and remove=false ";
private static final String FIND_USER_PAGE = " from User where (mobile like ? or paperId like ? or name like ? or userName like ?) ";
// private static final String FIND_LASTUSER_BY_GROUP = " from User where groups = ? order by createTime desc"; // private static final String FIND_LASTUSER_BY_GROUP = " from User where groups = ? order by createTime desc";
private static final String LOGIN = " from User where mobile = ? and pwd = ? and isRemove=false"; private static final String LOGIN = " from User where mobile = ? and pwd = ? and remove=false";
private static final String VALIDATE_PAPERID = " from User where paperId = ?"; private static final String VALIDATE_PAPERID = " from User where paperId = ?";
private static final String VALIDATE_USERNAME = " from User where userName = ?"; private static final String VALIDATE_USERNAME = " from User where userName = ?";
private static final String VALIDATE_PWD = " from User where id = ? and pwd = ? and isRemove=false"; private static final String VALIDATE_PWD = " from User where id = ? and pwd = ? and remove=false ";
private static final String FIND_BY_OPENID = "from User where openid = ?"; private static final String FIND_BY_OPENID = "from User where openid = ? and remove=false ";
private static final String FIND_BY_PAPERID = "from User where paperId = ? and paperType = ?"; private static final String FIND_BY_PAPERID_PAPERTYPE = "from User where paperId = ? and paperType = ? and remove=false ";
private static final String FIND_BY_PAPERID = "from User where paperId = ? ";
private static final String FIND_USER_PAGE_EXPORT = " select user from User user join user.blood blood where remove=false ";
@Override @Override
public Boolean validateUserExistByPaperId(String paperId) { public Boolean validateUserExistByPaperId(String paperId) {
...@@ -62,34 +66,46 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao { ...@@ -62,34 +66,46 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
@Override @Override
public IPageList<User> findUserPage(String searchStr, String role, String status,String order, String sort, Hints hints) { public List<User> findUserPage(String name, String paperId, String start, String end, String bloodId, String startbloodId, String endbloodId, String order, String sort, Hints hints) {
if (order == null){ if (order == null){
order = " createTime "; order = " user.createTime ";
} }
if (sort == null){ if (sort == null){
sort=" desc "; sort=" desc ";
} }
String hql = ""; String hql = "";
if (role != null){ if (name != null){
hql += " and role = '" +role+ "' "; hql += " and user.name = '" +name+ "' ";
} }
if (status != null){ if (paperId != null){
hql += " and status = '" +status+ "' "; hql += " and user.paperId = '" +paperId+ "' ";
} }
if (searchStr == null) { if (bloodId != null){
searchStr = "%"; hql += " and blood.bloodId = '" +bloodId+ "' ";
} }
String param = "%" + searchStr + "%";
IPageList<User> users = new PageListImpl<User>();
users.setRecords(find(FIND_USER_PAGE + hql + sortHQL(order, sort), hints, param, param, param, param));
users.setRecordTotal(findCount(" select count(*) " + FIND_USER_PAGE + hql, param, param, param, param));
if (startbloodId != null){
hql += " and blood.bloodId > '" +startbloodId+ "' ";
}
return users; if (endbloodId != null){
hql += " and blood.bloodId < '" +endbloodId+ "' ";
}
if (start != null){
hql += " and blood.updateTime > '" +start+ "' ";
}
if (end != null){
hql += " and blood.updateTime < '" +end+ "' ";
}
return find(FIND_USER_PAGE_EXPORT + hql + sortHQL(order, sort), hints);
} }
...@@ -115,6 +131,43 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao { ...@@ -115,6 +131,43 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
@Override @Override
public User findByPaperId(String paperId, String paperType) { public User findByPaperId(String paperId, String paperType) {
return findUnique(FIND_BY_PAPERID,new Hints(),paperId,paperType); return findUnique(FIND_BY_PAPERID_PAPERTYPE,new Hints(),paperId,paperType);
}
@Override
public User findByPaperId(String paperId) {
return findUnique(FIND_BY_PAPERID,new Hints(),paperId);
}
@Override
public IPageList<User> findUserPage(String searchStr, String role, String status,String order, String sort, Hints hints) {
if (order == null){
order = " createTime ";
}
if (sort == null){
sort=" desc ";
}
String hql = "";
if (role != null){
hql += " and role = '" +role+ "' ";
}
if (status != null){
hql += " and status = '" +status+ "' ";
}
if (searchStr == null) {
searchStr = "%";
}
String param = "%" + searchStr + "%";
IPageList<User> users = new PageListImpl<User>();
users.setRecords(find(FIND_USER_PAGE + hql + sortHQL(order, sort), hints, param, param, param, param));
users.setRecordTotal(findCount(" select count(*) " + FIND_USER_PAGE + hql, param, param, param, param));
return users;
} }
} }
...@@ -33,12 +33,12 @@ public class Blood { ...@@ -33,12 +33,12 @@ public class Blood {
private String bloodId; //采样编号 private String bloodId; //采样编号
private String bloodCollect; //采血者
@Lob @Lob
private String bloodAddr; //采血地点 private String bloodAddr; //采血地点
@ManyToOne private String review; //数据初审者;
private User review; //数据初审者;
@ManyToOne @ManyToOne
private User user = new User(); private User user = new User();
...@@ -71,11 +71,11 @@ public class Blood { ...@@ -71,11 +71,11 @@ public class Blood {
this.bloodAddr = bloodAddr; this.bloodAddr = bloodAddr;
} }
public User getReview() { public String getReview() {
return review; return review;
} }
public void setReview(User review) { public void setReview(String review) {
this.review = review; this.review = review;
} }
...@@ -102,4 +102,14 @@ public class Blood { ...@@ -102,4 +102,14 @@ public class Blood {
public void setActivity(Activity activity) { public void setActivity(Activity activity) {
this.activity = activity; this.activity = activity;
} }
public String getBloodCollect() {
return bloodCollect;
}
public void setBloodCollect(String bloodCollect) {
this.bloodCollect = bloodCollect;
}
} }
...@@ -62,7 +62,7 @@ public class User { ...@@ -62,7 +62,7 @@ public class User {
@Lob @Lob
private String remark; //备注 private String remark; //备注
private String origin; //用户来源 private String origin; //用户来源 小程序1 后台新增2 导入3
private String referrals; //推荐人 private String referrals; //推荐人
private String pwd; //密码 private String pwd; //密码
...@@ -73,9 +73,13 @@ public class User { ...@@ -73,9 +73,13 @@ public class User {
private String avatarImage; //头像 private String avatarImage; //头像
private String cerfificatePath;//证书图片路径 private String cerfificatePath;//证书图片路径
private String marrowCode; //骨髓编号
private Date createTime = new Date(); private Date createTime = new Date();
private Date updateTime = new Date(); private Date updateTime = new Date();
private boolean remove = false;
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user") @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user")
@JsonIgnore @JsonIgnore
private Set<Contacts> contacts = new HashSet<Contacts>(); private Set<Contacts> contacts = new HashSet<Contacts>();
...@@ -84,10 +88,6 @@ public class User { ...@@ -84,10 +88,6 @@ public class User {
@JsonIgnore @JsonIgnore
private Set<Blood> blood = new HashSet<Blood>(); private Set<Blood> blood = new HashSet<Blood>();
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "review")
@JsonIgnore
private Set<Blood> review = new HashSet<Blood>();
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user") @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user")
@JsonIgnore @JsonIgnore
private Set<Points> points = new HashSet<Points>(); private Set<Points> points = new HashSet<Points>();
...@@ -294,12 +294,7 @@ public class User { ...@@ -294,12 +294,7 @@ public class User {
public void setBlood(Set<Blood> blood) { public void setBlood(Set<Blood> blood) {
this.blood = blood; this.blood = blood;
} }
public Set<Blood> getReview() {
return review;
}
public void setReview(Set<Blood> review) {
this.review = review;
}
public String getStatus() { public String getStatus() {
return status; return status;
} }
...@@ -370,4 +365,18 @@ public class User { ...@@ -370,4 +365,18 @@ public class User {
public void setCerfificatePath(String cerfificatePath) { public void setCerfificatePath(String cerfificatePath) {
this.cerfificatePath = cerfificatePath; this.cerfificatePath = cerfificatePath;
} }
public boolean isRemove() {
return remove;
}
public void setRemove(boolean remove) {
this.remove = remove;
}
public String getMarrowCode() {
return marrowCode;
}
public void setMarrowCode(String marrowCode) {
this.marrowCode = marrowCode;
}
} }
package com.qiankun.service; package com.qiankun.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -61,4 +63,18 @@ public class UserService { ...@@ -61,4 +63,18 @@ public class UserService {
public User findByPaperId(String paperId, String paperType) { public User findByPaperId(String paperId, String paperType) {
return userDao.findByPaperId(paperId,paperType); return userDao.findByPaperId(paperId,paperType);
} }
public User findByPaperId(String paperId) {
return userDao.findByPaperId(paperId);
}
public List<User> findUserPage(String name, String paperId, String start, String end, String bloodId,
String startbloodId, String endbloodId, String order, String sort, Hints hints) {
List<User> users = userDao.findUserPage(name, paperId, start, end, bloodId, startbloodId, endbloodId,
order, sort, hints);
return users;
}
} }
...@@ -148,6 +148,28 @@ public class UserUtils { ...@@ -148,6 +148,28 @@ public class UserUtils {
return addTexts; return addTexts;
} }
public static String get18Ic(String identifyCard) {
String retId = "";
String id17 = "";
int sum = 0;
int y = 0; // 定义数组加权因子
int[] wf = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; // 定义数组存放校验码
String[] cc = { "1", "0", "x", "9", "8", "7", "6", "5", "4", "3", "2" }; // 在原15位数身份证的第六位数后面插入19
id17 = identifyCard.substring(0, 6) + "19" + identifyCard.substring(6); // 17位数字和系数相乘,结果相加
for (int i = 0; i < 17; i++) {
sum = sum + Integer.valueOf(id17.substring(i, i + 1)) * wf[i];
} // 计算余数
y = sum % 11; // 通过模获得对应的校验码cc[yy];
retId = id17 + cc[y];
return retId;
}
public static void main(String[] args){
System.out.print(get18Ic("120105850126422"));
}
/* /*
public static void main(String[] args){ public static void main(String[] args){
try { try {
......
package com.qiankun.vo; package com.qiankun.vo;
import java.util.Date;
public class UserVo { public class UserVo {
private String id; private String id;
...@@ -36,6 +34,7 @@ public class UserVo { ...@@ -36,6 +34,7 @@ public class UserVo {
private Integer weight; //体重 private Integer weight; //体重
private String remark; //备注 private String remark; //备注
private String origin; //用户来源 小程序1 后台新增2 导入3
private String contactsName1; private String contactsName1;
private String contactsQQ1; private String contactsQQ1;
...@@ -55,6 +54,8 @@ public class UserVo { ...@@ -55,6 +54,8 @@ public class UserVo {
private String role; //角色 1.管理员 2.志愿者 private String role; //角色 1.管理员 2.志愿者
private String status; //状态 0.未采血 1.已采血 private String status; //状态 0.未采血 1.已采血
private String marrowCode; //骨髓编号
private String oldpwd; //原密码 private String oldpwd; //原密码
private Boolean changePassword; private Boolean changePassword;
private String searchStr; private String searchStr;
...@@ -62,6 +63,12 @@ public class UserVo { ...@@ -62,6 +63,12 @@ public class UserVo {
private String sort; private String sort;
private String avatarImage; //头像 private String avatarImage; //头像
private String start;
private String end;
private String bloodId;
private String startbloodId;
private String endbloodId;
public String getId() { public String getId() {
return id; return id;
} }
...@@ -367,4 +374,48 @@ public class UserVo { ...@@ -367,4 +374,48 @@ public class UserVo {
public void setAvatarImage(String avatarImage) { public void setAvatarImage(String avatarImage) {
this.avatarImage = avatarImage; this.avatarImage = avatarImage;
} }
public String getMarrowCode() {
return marrowCode;
}
public void setMarrowCode(String marrowCode) {
this.marrowCode = marrowCode;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
public String getStart() {
return start;
}
public void setStart(String start) {
this.start = start;
}
public String getEnd() {
return end;
}
public void setEnd(String end) {
this.end = end;
}
public String getBloodId() {
return bloodId;
}
public void setBloodId(String bloodId) {
this.bloodId = bloodId;
}
public String getStartbloodId() {
return startbloodId;
}
public void setStartbloodId(String startbloodId) {
this.startbloodId = startbloodId;
}
public String getEndbloodId() {
return endbloodId;
}
public void setEndbloodId(String endbloodId) {
this.endbloodId = endbloodId;
}
} }
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="webpath" uri="/WEB-INF/tlds/path.tld"%>
<%@ taglib prefix="webpage" uri="/WEB-INF/tlds/pageview.tld"%>
<head>
</head>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="#">首页</a>
</li>
<li class="active">用户管理</li>
<li class="active">导出</li>
</ul><!-- .breadcrumb -->
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<form action="#" id="userImport" name="userImport" method="post" onsubmit="return false" class="form-horizontal dropzone" role="form">
<div class="row">
<div class="col-xs-12">
<h3 class="header smaller lighter blue">导出数据</h3></div>
</div>
<div class="row">
<div class="col-xs-4">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 姓名 </label>
<div class="col-sm-9">
<input type="text" id="name" name="name" value="" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 证件号 </label>
<div class="col-sm-9">
<input type="text" id="paperId" name="paperId" value="" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 采样日期</label>
<div class="col-sm-9">
<input type="text" id="day" name="day" value="" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<div class="col-sm-3" style="padding-right:0">
<select class="col-xs-12 col-sm-12 pull-right" id="bloodIdselect" name="bloodIdselect">
<option value="0">采样编号</option>
<option value="1">采样编号范围</option>
</select>
</div>
<div class="col-sm-9" id="bloodIddiv" style="display:none;">
<input type="text" id="bloodId" name="bloodId" value="" class="col-xs-10 col-sm-10" />
</div>
<div class="col-sm-9" id="bloodIddivrange" style="display:none;">
<input type="text" placeholder="开始" id="startbloodId" name="startbloodId" value="" class="col-xs-5 col-sm-5" />
<input type="text" placeholder="结束" id="endbloodId" name="endbloodId" value="" class="col-xs-5 col-sm-5" />
</div>
</div>
</div>
</div>
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-sm btn-success" type="submit" onclick="user.exportExcel()">
<i class="icon-save bigger-110"></i>
确定
</button>
&nbsp; &nbsp; &nbsp;
<a class="btn btn-sm btn-success" href="javascript:history.go(-1)">
<i class="icon-reply bigger-110"></i>
返回
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="<webpath:path/>/resources/js/user/export.js" type="text/javascript"></script>
<script>
</script>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="webpath" uri="/WEB-INF/tlds/path.tld"%>
<%@ taglib prefix="webpage" uri="/WEB-INF/tlds/pageview.tld"%>
<head>
</head>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="#">首页</a>
</li>
<li class="active">用户管理</li>
<li class="active">导入</li>
</ul><!-- .breadcrumb -->
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<form action="#" id="userImport" name="userImport" method="post" onsubmit="return false" class="form-horizontal dropzone" role="form">
<div class="row">
<div class="col-xs-12">
<h3 class="header smaller lighter blue">导入数据</h3></div>
</div>
<div class="row">
<div class="col-xs-4">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 数据类型 </label>
<div class="col-sm-9">
<select class="col-xs-10 col-sm-10" id="type" name="type">
<option value="0" >请选择</option>
<option value="1" >志愿者已入库基本信息表</option>
<option value="2" >志愿者基本信息未审核</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 选择文件 </label>
<div class="col-sm-9">
<input name="input_file" id="input_file" type="file" />
</div>
</div>
</div>
</div>
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-sm btn-success" type="submit" onclick="user.save()">
<i class="icon-save bigger-110"></i>
确定
</button>
&nbsp; &nbsp; &nbsp;
<a class="btn btn-sm btn-success" href="javascript:history.go(-1)">
<i class="icon-reply bigger-110"></i>
返回
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="<webpath:path/>/resources/js/user/import.js" type="text/javascript"></script>
<script>
</script>
...@@ -37,17 +37,19 @@ ...@@ -37,17 +37,19 @@
新增 新增
</button> </button>
<button class="btn btn-sm btn-success"> <button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/user/importpage'">
<i class="icon-star-half-full bigger-110"></i> <i class="icon-star-half-full bigger-110"></i>
导入 导入
</button> </button>
<button class="btn btn-sm btn-danger"> <button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/user/exportpage'">
<i class="icon-trash bigger-110"></i> <i class="icon-star-half-full bigger-110"></i>
删除 导出
</button> </button>
</div> </div>
<div class="pull-right"> <div class="pull-right">
...@@ -79,12 +81,12 @@ ...@@ -79,12 +81,12 @@
<table id="table-data" class="table table-bordered "> <table id="table-data" class="table table-bordered ">
<thead> <thead>
<tr class=""> <tr class="">
<th class="center"> <!-- <th class="center">
<label> <label>
<input type="checkbox" class="ace"> <input type="checkbox" class="ace">
<span class="lbl"></span> <span class="lbl"></span>
</label> </label>
</th> </th> -->
<th>姓名</th> <th>姓名</th>
<th>性别</th> <th>性别</th>
<th>出生年月</th> <th>出生年月</th>
...@@ -107,12 +109,12 @@ ...@@ -107,12 +109,12 @@
<c:forEach var="user" items="${userPage.records}"> <c:forEach var="user" items="${userPage.records}">
<tr class="tr-highlight"> <tr class="tr-highlight">
<td class="center" width=10> <!-- <td class="center" width=10>
<label> <label>
<input type="checkbox" class="ace"> <input type="checkbox" class="ace">
<span class="lbl"></span> <span class="lbl"></span>
</label> </label>
</td> </td> -->
<td title="${user.name}">${user.name} </td> <td title="${user.name}">${user.name} </td>
<td title="${user.gender}">${user.gender}</td> <td title="${user.gender}">${user.gender}</td>
...@@ -158,7 +160,7 @@ ...@@ -158,7 +160,7 @@
</button> </button>
&nbsp; &nbsp;
<button class="btn btn-xs btn-danger"> <button class="btn btn-xs btn-danger" onclick="user.del('${user.id}')">
<i class="icon-trash bigger-120"></i> <i class="icon-trash bigger-120"></i>
</button> </button>
......
var isSubmit = true;
$(document).ready(function(){
laydate.render({
elem: '#day',
range: true,
done: function(value, date, endDate){
console.log(value); //得到日期生成的值,如:2017-08-18
console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。
user.startDay = date.year + "-" + date.month + "-" + date.date + " 00:00:00" ;
user.endDay = endDate.year + "-" + endDate.month + "-" + endDate.date + " 23:59:59" ;
}
});
$("#bloodIdselect").change(function(){
if ($("#bloodIdselect").val() == "0"){
$("#bloodIddiv").css("display","");
$("#bloodIddivrange").css("display","none");
} else {
$("#bloodIddiv").css("display","none");
$("#bloodIddivrange").css("display","");
}
})
$("#day").val("")
$("#bloodIddiv").css("display","");
$("#bloodIdselect").val(0);
})
var user = {
startDay : "",
endDay : "",
exportExcel : function(){
if (isSubmit){
isSubmit = false;
var url = webPath + "/user/export";
var name = $('#name').val();
var paperId = $('#paperId').val();
var start = user.startDay;
var end = user.endDay;
var bloodId = "";
var startbloodId = "";
var endbloodId = "";
if ($("#bloodIdselect").val() == "0"){
bloodId = $('#bloodId').val();
} else {
startbloodId = $('#startbloodId').val();
endbloodId = $('#endbloodId').val();
}
if(name != "" || paperId != "" || start != "" || end != "" || bloodId != "" || startbloodId != "" || endbloodId != ""){
var param = "?"
if (name != ""){
param = param + "name=" + name ;
}
if (paperId != ""){
if (param == "?"){
param = param + "paperId=" + paperId;
} else {
param = param + "&paperId=" + paperId;
}
}
if (start != ""){
if (param == "?"){
param = param + "start=" + start;
} else {
param = param + "&start=" + start;
}
}
if (end != ""){
if (param == "?"){
param = param + "end=" + end;
} else {
param = param + "&end=" + end;
}
}
if (bloodId != ""){
if (param == "?"){
param = param + "bloodId=" + bloodId;
} else {
param = param + "&bloodId=" + bloodId;
}
}
if (startbloodId != ""){
if (param == "?"){
param = param + "startbloodId=" + startbloodId;
} else {
param = param + "&startbloodId=" + startbloodId;
}
}
if (endbloodId != ""){
if (param == "?"){
param = param + "endbloodId=" + endbloodId;
} else {
param = param + "&endbloodId=" + endbloodId;
}
}
url = url + param;
}
window.open(url);
isSubmit = true;
}
}
}
var isSubmit = true;
$(document).ready(function(){
})
var user = {
save : function(){
if (isSubmit){
isSubmit = false;
var formData = new FormData();
formData.append('file', $('#input_file')[0].files[0]);
formData.append('type', $('#type').val());
$.ajax({
url: '/user/import',
type: 'POST',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType:"json",
beforeSend: function(){
},
success: function(data){
var status=data.status;
if(status==1){//注册成功
bootbox.dialog({
message:"导入成功",
buttons:{
"success":{
"label":"继续添加",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/user/list';
}
}
}
});
} else if (status == 0){
isSubmit = true;
bootbox.dialog({
message:"请选择数据类型",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
}
}
}
});
}
}
});
}
}
}
...@@ -164,7 +164,7 @@ $(document).ready(function(){ ...@@ -164,7 +164,7 @@ $(document).ready(function(){
laydate.render({ laydate.render({
elem: '#birthday' elem: '#birthday'
}); });
$('#birthday').datepicker() //$('#birthday').datepicker()
$("#nation").select2({ $("#nation").select2({
placeholder : "请选择", placeholder : "请选择",
...@@ -231,6 +231,7 @@ var user = { ...@@ -231,6 +231,7 @@ var user = {
height:$('#height').val(), height:$('#height').val(),
weight:$('#weight').val(), weight:$('#weight').val(),
remark:$('#remark').val(), remark:$('#remark').val(),
origin:"2",
contactsName1:$('#contactsName1').val(), contactsName1:$('#contactsName1').val(),
contactsQQ1:$('#contactsQQ1').val(), contactsQQ1:$('#contactsQQ1').val(),
contactsRelation1:$('#contactsRelation1').val(), contactsRelation1:$('#contactsRelation1').val(),
...@@ -354,6 +355,37 @@ var user = { ...@@ -354,6 +355,37 @@ var user = {
url = url + param; url = url + param;
} }
window.location.href = url; window.location.href = url;
},
del : function(id) {
bootbox.confirm({
buttons: {
cancel: {
label: '取消',
className: 'btn-default'
},
confirm: {
label: '确认',
className: 'btn-myStyle'
}
},
message: '请确认是否删除?',
callback: function(result) {
if(result) {
$.ajax({
type: 'GET',
url: webPath + '/api/user/del?id='+id,
dataType:'json',
success: function(data){
window.location.reload();
}
})
} else {
}
},
//title: "bootbox confirm也可以添加标题哦",
});
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment