Commit afa4a49a authored by liuchao's avatar liuchao

no message

parent 318617fb
...@@ -57,6 +57,74 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -57,6 +57,74 @@ public class RainbowPlanWebController extends BaseController<Object>{
@Autowired @Autowired
private ActivityService activityService; private ActivityService activityService;
@RequestMapping("/rainbow/user/view")
public ModelAndView useradd(String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
RainbowPlanUser user = new RainbowPlanUser();
if(StringUtils.isNotBlank(id)) {
user = userDao.find(id);
}
view.getModelMap().addAttribute("user", user);
view.setViewName("rainbow/saveuser");
return view;
}
@RequestMapping(value = "/rainbow/user/save",method = RequestMethod.POST)
public ModelAndView saveUser(@RequestParam(value = "file", required = false) MultipartFile file, RainbowPlanUserVo vo, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
String uploadImagePath = File.separator + "rainbowplan" + File.separator + "uploadAvatar";
ResourceBundle rb = ResourceBundle.getBundle("system");
RainbowPlanUser user = new RainbowPlanUser();
if (StringUtils.isBlank(vo.getId())) {
if (file == null) {
view.getModelMap().addAttribute("message", "nopic");
return view;
}
view.getModelMap().addAttribute("status", 1);
} else {
user = userDao.find(vo.getId());
view.getModelMap().addAttribute("status", 2);
}
if (file != null) {
String fileFullName = file.getOriginalFilename();
String[] originalFileName = fileFullName.split("\\.");
String fileName = vo.getId() + "." + originalFileName[originalFileName.length-1];
String rootPath = rb.getString("file_path");
if (StringUtils.isNotBlank(user.getAvatar())) {
File oldFile = new File(rootPath + user.getAvatar());
if (oldFile.isFile())
FileUtils.forceDelete(oldFile);
}
File destFile = new File(rootPath + uploadImagePath,fileName);
FileUtils.writeByteArrayToFile(destFile,file.getBytes());
user.setAvatar(uploadImagePath + File.separator + fileName);
}
user.setBedNum(vo.getBedNum());
user.setBirthday(vo.getBirthday());
user.setConnectTel(vo.getConnectTel());
user.setDisease(vo.getDisease());
user.setGender(vo.getGender());
user.setName(vo.getName());
user.setNickName(vo.getNickName());
user.setPhone(vo.getPhone());
user.setReceiveAddress(vo.getReceiveAddress());
user.setReceiveName(vo.getReceiveName());
user.setStatus(vo.getStatus());
userDao.save(user);
return view;
}
@RequestMapping("/rainbow/user/list") @RequestMapping("/rainbow/user/list")
public ModelAndView userlist(RainbowPlanUserVo userVo,HttpServletResponse response, HttpServletRequest request) throws Exception { public ModelAndView userlist(RainbowPlanUserVo userVo,HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView(); ModelAndView view = new ModelAndView();
...@@ -81,7 +149,7 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -81,7 +149,7 @@ public class RainbowPlanWebController extends BaseController<Object>{
List<Activity> activitylist = activityService.findByAavailableAndType(null, "3"); List<Activity> activitylist = activityService.findByAavailableAndType(null, "3");
IPageList<Wish> wishPage = wishDao.findPages(wishVo.getSearchStr(), wishVo.getActivityId(), wishVo.getStatus(), IPageList<Wish> wishPage = wishDao.findPages(wishVo.getSearchStr(), wishVo.getActivityId(), wishVo.getStatus(), wishVo.getType(),
wishVo.getOrder(), wishVo.getSort(), new Hints(getStartRow(request), getPageCount(request))); wishVo.getOrder(), wishVo.getSort(), new Hints(getStartRow(request), getPageCount(request)));
view.getModelMap().addAttribute("activitylist", activitylist); view.getModelMap().addAttribute("activitylist", activitylist);
...@@ -217,7 +285,7 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -217,7 +285,7 @@ public class RainbowPlanWebController extends BaseController<Object>{
XSSFSheet sheet = wb.createSheet("心愿"); XSSFSheet sheet = wb.createSheet("心愿");
sheet.setMargin(HSSFSheet.TopMargin,( double ) 0.5 ); // 上边距 sheet.setMargin(HSSFSheet.TopMargin,( double ) 0.5 ); // 上边距
sheet.setMargin(HSSFSheet.BottomMargin,( double ) 0.5 ); // 下边距 sheet.setMargin(HSSFSheet.BottomMargin,( double ) 0.5 ); // 下边距
sheet.setMargin(HSSFSheet.LeftMargin,( double ) 0.4 ); // 左边距 sheet.setMargin(HSSFSheet.LeftMargin,( double ) 0.3 ); // 左边距
sheet.setMargin(HSSFSheet.RightMargin,( double ) 0.2 ); // 右边距 sheet.setMargin(HSSFSheet.RightMargin,( double ) 0.2 ); // 右边距
...@@ -230,9 +298,9 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -230,9 +298,9 @@ public class RainbowPlanWebController extends BaseController<Object>{
sheet.setColumnWidth(1,2500); sheet.setColumnWidth(1,2500);
sheet.setColumnWidth(2,3500); sheet.setColumnWidth(2,3500);
sheet.setColumnWidth(3,1500); sheet.setColumnWidth(3,1500);
sheet.setColumnWidth(4,4000); sheet.setColumnWidth(4,3000);
sheet.setColumnWidth(5,4000); sheet.setColumnWidth(5,4000);
sheet.setColumnWidth(6,6000); sheet.setColumnWidth(6,8000);
sheet.setColumnWidth(7,3000); sheet.setColumnWidth(7,3000);
sheet.setColumnWidth(8,3000); sheet.setColumnWidth(8,3000);
sheet.setColumnWidth(9,6000); sheet.setColumnWidth(9,6000);
...@@ -273,7 +341,7 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -273,7 +341,7 @@ public class RainbowPlanWebController extends BaseController<Object>{
cell.setCellStyle(cellTopStyle); cell.setCellStyle(cellTopStyle);
cell = row.createCell(4); cell = row.createCell(4);
cell.setCellValue("年龄"); cell.setCellValue("出生年月");
cell.setCellStyle(cellTopStyle); cell.setCellStyle(cellTopStyle);
cell = row.createCell(5); cell = row.createCell(5);
...@@ -308,7 +376,7 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -308,7 +376,7 @@ public class RainbowPlanWebController extends BaseController<Object>{
cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
IPageList<Wish> wishPage = wishDao.findPages(wishVo.getSearchStr(), wishVo.getActivityId(), wishVo.getStatus(), IPageList<Wish> wishPage = wishDao.findPages(wishVo.getSearchStr(), wishVo.getActivityId(), wishVo.getStatus(), wishVo.getType(),
wishVo.getOrder(), wishVo.getSort(), new Hints(getStartRow(request), getPageCount(request))); wishVo.getOrder(), wishVo.getSort(), new Hints(getStartRow(request), getPageCount(request)));
List<Wish> wish = wishPage.getRecords(); List<Wish> wish = wishPage.getRecords();
...@@ -317,6 +385,7 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -317,6 +385,7 @@ public class RainbowPlanWebController extends BaseController<Object>{
for (int i = 0; i < wish.size(); i++) { for (int i = 0; i < wish.size(); i++) {
// 第三步:在这个sheet页里创建一行 // 第三步:在这个sheet页里创建一行
rows = sheet.createRow(i+1); rows = sheet.createRow(i+1);
rows.setHeightInPoints(60);
// 第四步:在该行创建一个单元格 // 第四步:在该行创建一个单元格
Wish data = wish.get(i); Wish data = wish.get(i);
......
...@@ -17,7 +17,7 @@ public interface WishDao extends IDao<Wish,String> { ...@@ -17,7 +17,7 @@ public interface WishDao extends IDao<Wish,String> {
IPageList<Wish> findByVolunteeId(String id, Hints hints); IPageList<Wish> findByVolunteeId(String id, Hints hints);
IPageList<Wish> findPages(String searchStr, String activityId, Integer status, String order, String sort, Hints hints); IPageList<Wish> findPages(String searchStr, String activityId, Integer status, Integer type, String order, String sort, Hints hints);
void batchUpdateStatus(String[] id, String status); void batchUpdateStatus(String[] id, String status);
......
...@@ -37,7 +37,7 @@ public class WishDaoImpl extends AbsDao<Wish,String> implements WishDao { ...@@ -37,7 +37,7 @@ public class WishDaoImpl extends AbsDao<Wish,String> implements WishDao {
@Override @Override
public IPageList<Wish> findPages(String searchStr, String activityId, Integer status, String order, String sort, Hints hints) { public IPageList<Wish> findPages(String searchStr, String activityId, Integer status, Integer type, String order, String sort, Hints hints) {
if (order == null){ if (order == null){
order = " createTime "; order = " createTime ";
} }
...@@ -46,13 +46,20 @@ public class WishDaoImpl extends AbsDao<Wish,String> implements WishDao { ...@@ -46,13 +46,20 @@ public class WishDaoImpl extends AbsDao<Wish,String> implements WishDao {
} }
String hql = ""; String hql = "";
if (StringUtils.isNotBlank(searchStr)) { if (StringUtils.isNotBlank(searchStr)) {
if (type != null) {
if (StringUtils.isBlank(hql)) { if (StringUtils.isBlank(hql)) {
hql += " where "; hql += " where ";
} else { } else {
hql += " and "; hql += " and ";
} }
String param = "%" + searchStr + "%"; if (type == 0) {
hql += " children.phone like '"+param+"' or volunteer.phone like '"+param+"' or children.name like '"+param+"' or volunteer.name like '"+param+"' "; hql += " children.phone like '%"+searchStr+"%' or children.name like '%"+searchStr+"%' or children.bedNum like '%"+searchStr+"%' or children.receiveName like '%"+searchStr+"%'";
hql += " or content like '%"+searchStr+"%' or code = '" + searchStr + "' ";
} else {
hql += " volunteer.phone like '%"+searchStr+"%' or volunteer.name like '%"+searchStr+"%' ";
}
}
} }
if (StringUtils.isNotBlank(activityId)) { if (StringUtils.isNotBlank(activityId)) {
......
...@@ -35,6 +35,8 @@ public class RainbowPlanUser { ...@@ -35,6 +35,8 @@ public class RainbowPlanUser {
private String inviterId;//邀请者ID private String inviterId;//邀请者ID
private int type;//0:小朋友;1:爱心人士 private int type;//0:小朋友;1:爱心人士
private Boolean remove;
public String getInviterId() { public String getInviterId() {
return inviterId; return inviterId;
} }
...@@ -178,4 +180,17 @@ public class RainbowPlanUser { ...@@ -178,4 +180,17 @@ public class RainbowPlanUser {
public void setDisease(String disease) { public void setDisease(String disease) {
this.disease = disease; this.disease = disease;
} }
public Boolean getRemove() {
return remove;
}
public void setRemove(Boolean remove) {
this.remove = remove;
}
} }
...@@ -30,6 +30,7 @@ public class WishVo { ...@@ -30,6 +30,7 @@ public class WishVo {
private String sort; private String sort;
private Boolean reset = false; private Boolean reset = false;
private Integer type;
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
...@@ -183,6 +184,14 @@ public class WishVo { ...@@ -183,6 +184,14 @@ public class WishVo {
this.code = code; this.code = code;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
......
<%@ 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="userForm" name="userForm" method="post" onsubmit="return false" class="form-horizontal" role="form">
<input type="hidden" id="id" name="id" value="${user.id}"/>
<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=phone name="phone" value="${user.phone}" 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="name" name="name" value="${user.name}" 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"> <!--font color="red">*</font--> 昵称 </label>
<div class="col-sm-9">
<input type="text" id="nickName" name="nickName" value="${user.nickName}" 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-2"> 性别 </label>
<div class="col-sm-9">
<label>
<input name="gender" type="radio" class="ace" value="1" <c:if test="${user.gender=='1'}">checked</c:if>>
<span class="lbl"> 男</span>
</label>
<label>
<input name="gender" type="radio" class="ace" value="2" <c:if test="${user.gender=='2'}">checked</c:if>>
<span class="lbl"> 女</span>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> <!--font color="red">*</font--> 出生日期 </label>
<div class="col-sm-9">
<input class="col-xs-10 col-sm-10" id="birthday" name="birthday" type="text" autocomplete="off" data-date-format="yyyy/MM/dd" value="${user.birthday}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> <!--font color="red">*</font--> 楼层床号 </label>
<div class="col-sm-9">
<input type="text" id="bedNum" name="bedNum" value="${user.bedNum}" 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-input-readonly"> 疾病 </label>
<div class="col-sm-9">
<input type="text" id="disease" name="disease" value="${user.disease}" 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"> <!--font color="red">*</font--> 收件人姓名</label>
<div class="col-sm-9">
<input type="text" id="receiveName" name="receiveName" value="${user.receiveName}" 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-input-readonly"> 联系方式</label>
<div class="col-sm-9">
<input type="text" id="connectTel" name="connectTel" value="${user.connectTel}" 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="receiveAddress" name="receiveAddress" value="${user.receiveAddress}" 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">
<select class="col-xs-10 col-sm-10" id="status" name="status">
<option value="0" <c:if test="${user.status==0}">selected</c:if>>未审核</option>
<option value="1" <c:if test="${user.status==1}">selected</c:if>>已审核</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">
<c:if test="${user.avatar!=null}">
<img src="<webpath:path/>/wx/rainbowplan/loadResource?imageName=${user.avatar}" /></c:if>
<input type="file" id="input_file" name="file" >
</div>
</div>
</div>
</div>
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-sm btn-success" type="submit">
<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/rainbow/rainbowuser.js" type="text/javascript"></script>
\ No newline at end of file
...@@ -84,10 +84,10 @@ ...@@ -84,10 +84,10 @@
<td> <td>
<div class="visible-md visible-lg hidden-sm hidden-xs btn-group"> <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
<%-- <button class="btn btn-xs btn-info" onclick="window.location.href='<webpath:path/>/rainbow/user/add?id=${user.id}'"> <button class="btn btn-xs btn-info" title="修改" onclick="window.location.href='<webpath:path/>/rainbow/user/view?id=${user.id}'">
<i class="icon-credit-card bigger-120"></i> <i class="icon-edit bigger-120"></i>
</button> </button>
&nbsp; --%> &nbsp;
<button class="btn btn-xs btn-success" title="添加愿望" onclick="user.openlayer('${user.id}','${user.name}')"> <button class="btn btn-xs btn-success" title="添加愿望" onclick="user.openlayer('${user.id}','${user.name}')">
<i class="icon-lightbulb bigger-120"></i> <i class="icon-lightbulb bigger-120"></i>
......
...@@ -66,7 +66,15 @@ ...@@ -66,7 +66,15 @@
<option value="3" <c:if test="${wishVo.status==3}">selected</c:if>>红会代收</option> <option value="3" <c:if test="${wishVo.status==3}">selected</c:if>>红会代收</option>
<option value="4" <c:if test="${wishVo.status==4}">selected</c:if>>完成</option> <option value="4" <c:if test="${wishVo.status==4}">selected</c:if>>完成</option>
</select> </select>
<input type="text" placeholder="查询" class="nav-search-input" id="searchStr" value="${wishVo.searchStr}" autocomplete="off">
<select class="" id="type" name="type">
<option value="">用户类型</option>
<option value="0" <c:if test="${wishVo.type==0}">selected</c:if>>小朋友</option>
<option value="1" <c:if test="${wishVo.type==1}">selected</c:if>>爱心人士</option>
</select>
<input type="text" placeholder="关键字" class="nav-search-input" id="searchStr" value="${wishVo.searchStr}" autocomplete="off">
<a href="javascript:void(0);" onclick="wish.search();"><i class="icon-search nav-search-icon"></i></a> <a href="javascript:void(0);" onclick="wish.search();"><i class="icon-search nav-search-icon"></i></a>
</div> </div>
</div> </div>
...@@ -83,7 +91,7 @@ ...@@ -83,7 +91,7 @@
</th> </th>
<th width="70">图片</th> <th width="70">图片</th>
<th width="">小朋友</th> <th width="">小朋友</th>
<th width="10%">愿望编号</th> <th width="10%" onclick="wish.sort('code');" style="cursor:pointer">愿望编号 <span id="codeAsc" style="display:<c:if test="${wishVo.sort=='asc'}">none</c:if>;">↑</span><span id="codeDesc" style="display:<c:if test="${wishVo.sort=='desc'}">none</c:if>;">↓</span></th>
<th width="20%">内容</th> <th width="20%">内容</th>
<th width="">爱心人士</th> <th width="">爱心人士</th>
<th width="">寄送方式</th> <th width="">寄送方式</th>
...@@ -173,3 +181,5 @@ ...@@ -173,3 +181,5 @@
<script src="<webpath:path/>/resources/js/rainbow/wish.js?v=window.number" type="text/javascript"></script> <script src="<webpath:path/>/resources/js/rainbow/wish.js?v=window.number" type="text/javascript"></script>
var isSubmit = true;
$(document).ready(function(){ $(document).ready(function(){
if ($('#userForm').length>0){
$('#userForm').validate({
rules : {
"name" : {
required : true
},
"phone" : {
required : true
}
},
messages:{
"name" : {
required : "不能为空"
},
"phone" : {
required : "不能为空"
}
},
submitHandler: function(form){
user.save();
}
});
laydate.render({
elem: '#birthday',
format: 'yyyy/MM/dd'
});
}
}) })
...@@ -65,6 +104,95 @@ var user = { ...@@ -65,6 +104,95 @@ var user = {
} }
}) })
},
save : function(form){
if (isSubmit){
isSubmit = false;
var formData = new FormData();
formData.append('file', $('#input_file')[0].files[0]);
formData.append('id', $('#id').val());
formData.append('phone', $('#phone').val());
formData.append('name', $('#name').val());
formData.append('nickName', $('#nickName').val());
formData.append('gender', $('input:radio[name="gender"]:checked').val());
formData.append('birthday', $('#birthday').val());
formData.append('bedNum', $('#bedNum').val());
formData.append('disease', $('#disease').val());
formData.append('receiveName', $('#receiveName').val());
formData.append('connectTel', $('#connectTel').val());
formData.append('receiveAddress', $('#receiveAddress').val());
formData.append('status', $('#status').val());
$.ajax({
url: webPath + "/rainbow/user/save",
type: 'POST',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType:"json",
beforeSend: function(){
},
success : function(data) {
isSubmit = true;
var status = data.status;
var message = data.message;
if (message == "nopic"){
bootbox.dialog({
message:"请上传图片",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
}
}
}
});
}
if (status == 1){
bootbox.dialog({
message:"保存成功",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
history.go(-1);
}
}
}
});
}
if (status == 2){
bootbox.dialog({
message:"修改成功",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.reload();
}
}
}
});
}
}
})
}
} }
......
...@@ -51,11 +51,31 @@ $(document).ready(function(){ ...@@ -51,11 +51,31 @@ $(document).ready(function(){
var wish = { var wish = {
exportExcel : function(){ exportExcel : function(){
var activityId = $("#activity").val(); var activityId = $("#activity").val();
var searchStr = $("#searchStr").val(); var searchStr = $("#searchStr").val();
var status = $("#status").val(); var status = $("#status").val();
var type = $("#type").val();
var url = webPath + "/rainbow/wish/export"; var url = webPath + "/rainbow/wish/export";
if (searchStr != ""){
if (type == ""){
bootbox.dialog({
message:"请选择要查询的用户类型!",
buttons:{
"success":{
"label":"OK",
"className":"btn-sm btn-primary"
}
}
});
return;
}
}
if(activityId != "" || searchStr != "" || status != ""){ if(activityId != "" || searchStr != "" || status != ""){
var param = "?" var param = "?"
if (activityId != ""){ if (activityId != ""){
...@@ -70,6 +90,14 @@ var wish = { ...@@ -70,6 +90,14 @@ var wish = {
} }
} }
if (type != ""){
if (param == "?"){
param = param + "type=" + type;
} else {
param = param + "&type=" + type;
}
}
if (searchStr != ""){ if (searchStr != ""){
if (param == "?"){ if (param == "?"){
param = param + "searchStr=" + searchStr; param = param + "searchStr=" + searchStr;
...@@ -82,13 +110,63 @@ var wish = { ...@@ -82,13 +110,63 @@ var wish = {
} }
window.open(url); window.open(url);
}, },
sort : function(order){
wish.orderValue = order;
var codeAsc = $("#codeAsc");
var codeDesc = $("#codeDesc");
if (codeAsc.css("display") != "none" && codeDesc.css("display") != "none"){
codeAsc.css("display","") ;
wish.sortValue = "asc" ;
wish.search();
return;
}else if (codeAsc.css("display") != "none" && codeDesc.css("display") == "none"){
codeDesc.css("display","") ;
codeAsc.css("display","none") ;
wish.sortValue = "asc" ;
wish.search();
return;
}else if (codeAsc.css("display") == "none" && codeDesc.css("display") != "none"){
codeAsc.css("display","") ;
codeDesc.css("display","none") ;
wish.sortValue = "desc" ;
wish.search();
return;
}
},
sortValue : "",
orderValue : "",
isSearch:false,
search : function(){ search : function(){
if (wish.isSearch){
return;
}
wish.isSearch = true;
var activityId = $("#activity").val(); var activityId = $("#activity").val();
var searchStr = $("#searchStr").val(); var searchStr = $("#searchStr").val();
var status = $("#status").val(); var status = $("#status").val();
var type = $("#type").val();
var url = webPath + "/rainbow/wish/list"; var url = webPath + "/rainbow/wish/list";
if(activityId != "" || searchStr != "" || status != ""){ if (searchStr != ""){
if (type == ""){
bootbox.dialog({
message:"请选择要查询的用户类型!",
buttons:{
"success":{
"label":"OK",
"className":"btn-sm btn-primary"
}
}
});
return;
}
}
if(activityId != "" || searchStr != "" || status != "" || wish.sortValue != "" || wish.orderValue != ""){
var param = "?" var param = "?"
if (activityId != ""){ if (activityId != ""){
param = param + "activityId=" + activityId ; param = param + "activityId=" + activityId ;
...@@ -102,6 +180,30 @@ var wish = { ...@@ -102,6 +180,30 @@ var wish = {
} }
} }
if (type != ""){
if (param == "?"){
param = param + "type=" + type;
} else {
param = param + "&type=" + type;
}
}
if (wish.sortValue != ""){
if (param == "?"){
param = param + "sort=" + wish.sortValue;
} else {
param = param + "&sort=" + wish.sortValue;
}
}
if (wish.orderValue != ""){
if (param == "?"){
param = param + "order=" + wish.orderValue;
} else {
param = param + "&order=" + wish.orderValue;
}
}
if (searchStr != ""){ if (searchStr != ""){
if (param == "?"){ if (param == "?"){
param = param + "searchStr=" + searchStr; param = param + "searchStr=" + searchStr;
...@@ -215,6 +317,7 @@ var wish = { ...@@ -215,6 +317,7 @@ var wish = {
formData.append('rainbowPlanUserId', $('#rainbowPlanUserId').val()); formData.append('rainbowPlanUserId', $('#rainbowPlanUserId').val());
formData.append('content', $('#content').val()); formData.append('content', $('#content').val());
formData.append('status', $('#status').val()); formData.append('status', $('#status').val());
//console.info($('#reset')); //console.info($('#reset'));
//alert(typeof($('#reset').val()) != "undefined"); //alert(typeof($('#reset').val()) != "undefined");
if (typeof($('#reset').val()) != "undefined" ){ if (typeof($('#reset').val()) != "undefined" ){
......
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