提交 16094efc authored 作者: Mangostiffy's avatar Mangostiffy

新增后台抽奖管理

上级 bb8d7ed0
package com.mall.controller.tongmeng.lottery;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.mall.service.mengbeng.lottery.LotteryManager;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.mall.controller.base.BaseController;
import com.mall.entity.Page;
import com.mall.util.AppUtil;
import com.mall.util.ObjectExcelView;
import com.mall.util.PageData;
import com.mall.util.Jurisdiction;
import com.mall.util.Tools;
/**
* 说明:抽奖
* 创建时间:2019-01-17
*/
@Controller
@RequestMapping(value="/lottery")
public class LotteryController extends BaseController {
String menuUrl = "lottery/list.do"; //菜单地址(权限用)
@Resource(name="lotteryService")
private LotteryManager lotteryService;
/**保存
* @param
* @throws Exception
*/
@RequestMapping(value="/save")
public ModelAndView save() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"新增Lottery");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
lotteryService.save(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**删除
* @param out
* @throws Exception
*/
@RequestMapping(value="/delete")
public void delete(PrintWriter out) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"删除Lottery");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限
PageData pd = new PageData();
pd = this.getPageData();
lotteryService.delete(pd);
out.write("success");
out.close();
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
public ModelAndView edit() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"修改Lottery");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
lotteryService.edit(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
public ModelAndView list(Page page) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"列表Lottery");
//if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
String keywords = pd.getString("keywords"); //关键词检索条件
if(null != keywords && !"".equals(keywords)){
pd.put("keywords", keywords.trim());
}
page.setPd(pd);
List<PageData> varList = lotteryService.list(page); //列出Lottery列表
mv.setViewName("tongmeng/lottery/lottery_list");
mv.addObject("varList", varList);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
return mv;
}
/**去新增页面
* @param
* @throws Exception
*/
@RequestMapping(value="/goAdd")
public ModelAndView goAdd()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
mv.setViewName("tongmeng/lottery/lottery_edit");
mv.addObject("msg", "save");
mv.addObject("pd", pd);
return mv;
}
/**去修改页面
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
public ModelAndView goEdit()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd = lotteryService.findById(pd); //根据ID读取
mv.setViewName("tongmeng/lottery/lottery_edit");
mv.addObject("msg", "edit");
mv.addObject("pd", pd);
return mv;
}
/**批量删除
* @param
* @throws Exception
*/
@RequestMapping(value="/deleteAll")
@ResponseBody
public Object deleteAll() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"批量删除Lottery");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限
PageData pd = new PageData();
Map<String,Object> map = new HashMap<String,Object>();
pd = this.getPageData();
List<PageData> pdList = new ArrayList<PageData>();
String DATA_IDS = pd.getString("DATA_IDS");
if(null != DATA_IDS && !"".equals(DATA_IDS)){
String ArrayDATA_IDS[] = DATA_IDS.split(",");
lotteryService.deleteAll(ArrayDATA_IDS);
pd.put("msg", "ok");
}else{
pd.put("msg", "no");
}
pdList.add(pd);
map.put("list", pdList);
return AppUtil.returnObject(pd, map);
}
/**导出到excel
* @param
* @throws Exception
*/
@RequestMapping(value="/excel")
public ModelAndView exportExcel() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"导出Lottery到excel");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;}
ModelAndView mv = new ModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
Map<String,Object> dataMap = new HashMap<String,Object>();
List<String> titles = new ArrayList<String>();
titles.add("抽奖数字"); //1
titles.add("中奖奖品"); //2
dataMap.put("titles", titles);
List<PageData> varOList = lotteryService.listAll(pd);
List<PageData> varList = new ArrayList<PageData>();
for(int i=0;i<varOList.size();i++){
PageData vpd = new PageData();
vpd.put("var1", varOList.get(i).get("c_lottery_number").toString()); //1
vpd.put("var2", varOList.get(i).get("c_lottery_reward").toString()); //2
varList.add(vpd);
}
dataMap.put("varList", varList);
ObjectExcelView erv = new ObjectExcelView();
mv = new ModelAndView(erv,dataMap);
return mv;
}
@InitBinder
public void initBinder(WebDataBinder binder){
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true));
}
}
package com.mall.service.mengbeng.lottery;
import java.util.List;
import com.mall.entity.Page;
import com.mall.util.PageData;
/**
* 说明: 抽奖接口
* 创建时间:2019-01-17
* @version
*/
public interface LotteryManager{
/**新增
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**删除
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**列表
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**列表(全部)
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**通过id获取数据
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
}
package com.mall.service.mengbeng.lottery.impl;
import java.util.List;
import javax.annotation.Resource;
import com.mall.service.mengbeng.lottery.LotteryManager;
import org.springframework.stereotype.Service;
import com.mall.dao.DaoSupport;
import com.mall.entity.Page;
import com.mall.util.PageData;
/**
* 说明: 抽奖
* 创建时间:2019-01-17
* @version
*/
@Service("lotteryService")
public class LotteryService implements LotteryManager {
@Resource(name = "daoSupport")
private DaoSupport dao;
/**新增
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
dao.save("LotteryMapper.save", pd);
}
/**删除
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
dao.delete("LotteryMapper.delete", pd);
}
/**修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
dao.update("LotteryMapper.edit", pd);
}
/**列表
* @param page
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<PageData> list(Page page)throws Exception{
return (List<PageData>)dao.findForList("LotteryMapper.datalistPage", page);
}
/**列表(全部)
* @param pd
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<PageData> listAll(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("LotteryMapper.listAll", pd);
}
/**通过id获取数据
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return (PageData)dao.findForObject("LotteryMapper.findById", pd);
}
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
dao.delete("LotteryMapper.deleteAll", ArrayDATA_IDS);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="LotteryMapper">
<!--表名 -->
<sql id="tableName">
c_lottery
</sql>
<!-- 字段 -->
<sql id="Field">
c_lottery_number,
c_lottery_reward,
c_lottery_id
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{c_lottery_number},
#{c_lottery_reward},
#{c_lottery_id}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
c_lottery_number,
c_lottery_reward
) values (
#{c_lottery_number},
#{c_lottery_reward}
)
on DUPLICATE key update c_lottery_reward=#{c_lottery_reward}
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
delete from
<include refid="tableName"></include>
where
c_lottery_id = #{c_lottery_id}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
c_lottery_number = #{c_lottery_number},
c_lottery_reward = #{c_lottery_reward},
c_lottery_id = c_lottery_id
where
c_lottery_id = #{c_lottery_id}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
where
c_lottery_id = #{c_lottery_id}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
where 1=1
<if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
delete from
<include refid="tableName"></include>
where
c_lottery_id in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<%@ 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="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 下拉框 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/ace/css/chosen.css" />
<!-- jsp文件头和头部 -->
<%@ include file="../../system/index/top.jsp"%>
<!-- 日期框 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/ace/css/datepicker.css" />
</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
<!-- /section:basics/sidebar -->
<div class="main-content">
<div class="main-content-inner">
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<form action="${pageContext.request.contextPath}/lottery/${msg }.do" name="Form" id="Form" method="post">
<input type="hidden" name="c_lottery_id" id="c_lottery_id" value="${pd.c_lottery_id}"/>
<div id="zhongxin" style="padding-top: 13px;">
<table id="table_report" class="table table-striped table-bordered table-hover">
<tr>
<td style="width:75px;text-align: right;padding-top: 13px;">抽奖数字:</td>
<td><input type="number" name="c_lottery_number" id="c_lottery_number" value="${pd.c_lottery_number}" oninput="if(value.length>2)value=value.slice(0,2)" placeholder="这里输入抽奖数字" title="抽奖数字" style="width:98%;"/></td>
</tr>
<tr>
<td style="width:75px;text-align: right;padding-top: 13px;">中奖奖品:</td>
<td><input type="number" name="c_lottery_reward" id="c_lottery_reward" value="${pd.c_lottery_reward}" oninput="if(value.length>2)value=value.slice(0,2)" placeholder="这里输入中奖奖品" title="中奖奖品" style="width:80%;" min="1"/>个月</td>
</tr>
<tr>
<td style="text-align: center;" colspan="10">
<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
</td>
</tr>
</table>
</div>
<div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>
</form>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.page-content -->
</div>
</div>
<!-- /.main-content -->
</div>
<!-- /.main-container -->
<!-- 页面底部js¨ -->
<%@ include file="../../system/index/foot.jsp"%>
<!-- 下拉框 -->
<script src="${pageContext.request.contextPath}/static/ace/js/chosen.jquery.js"></script>
<!-- 日期框 -->
<script src="${pageContext.request.contextPath}/static/ace/js/date-time/bootstrap-datepicker.js"></script>
<!--提示框-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.tips.js"></script>
<script type="text/javascript">
$(top.hangge());
//保存
function save(){
if($("#c_lottery_number").val()==""){
$("#c_lottery_number").tips({
side:3,
msg:'请输入抽奖数字',
bg:'#AE81FF',
time:2
});
$("#c_lottery_number").focus();
return false;
}
if($("#c_lottery_reward").val()==""){
$("#c_lottery_reward").tips({
side:3,
msg:'请输入中奖奖品',
bg:'#AE81FF',
time:2
});
$("#C_LOTTERY_REWARD").focus();
return false;
}
if($("#c_lottery_reward").val()<=0){
$("#c_lottery_reward").tips({
side:3,
msg:'请输入大于0的数字',
bg:'#AE81FF',
time:2
});
$("#c_lottery_reward").focus();
return false;
}
$("#Form").submit();
$("#zhongxin").hide();
$("#zhongxin2").show();
}
$(function() {
//日期框
$('.date-picker').datepicker({autoclose: true,todayHighlight: true});
});
</script>
</body>
</html>
\ No newline at end of file
<%@ 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"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 下拉框 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/ace/css/chosen.css" />
<!-- jsp文件头和头部 -->
<%@ include file="../../system/index/top.jsp"%>
<!-- 日期框 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/ace/css/datepicker.css" />
</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
<!-- /section:basics/sidebar -->
<div class="main-content">
<div class="main-content-inner">
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<!-- 检索 -->
<form action="${pageContext.request.contextPath}/lottery/list.do" method="post" name="Form" id="Form">
<%--<table style="margin-top:5px;">
<tr>
<td>
<div class="nav-search">
<span class="input-icon">
<input type="text" placeholder="这里输入关键词" class="nav-search-input" id="nav-search-input" autocomplete="off" name="keywords" value="${pd.keywords }" placeholder="这里输入关键词"/>
<i class="ace-icon fa fa-search nav-search-icon"></i>
</span>
</div>
</td>
<td style="padding-left:2px;"><input class="span10 date-picker" name="lastStart" id="lastStart" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="开始日期" title="开始日期"/></td>
<td style="padding-left:2px;"><input class="span10 date-picker" name="lastEnd" name="lastEnd" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="结束日期" title="结束日期"/></td>
<td style="vertical-align:top;padding-left:2px;">
<select class="chosen-select form-control" name="name" id="id" data-placeholder="请选择" style="vertical-align:top;width: 120px;">
<option value=""></option>
<option value="">全部</option>
<option value="">1</option>
<option value="">2</option>
</select>
</td>
<c:if test="${QX.cha == 1 }">
<td style="vertical-align:top;padding-left:2px"><a class="btn btn-light btn-xs" onclick="tosearch();" title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td>
</c:if>
<c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if>
</tr>
</table>--%>
<!-- 检索 -->
<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;">
<thead>
<tr>
<th class="center" style="width:35px;">
<label class="pos-rel"><input type="checkbox" class="ace" id="zcheckbox" /><span class="lbl"></span></label>
</th>
<th class="center" style="width:50px;">序号</th>
<th class="center">抽奖数字</th>
<th class="center">中奖奖品</th>
<th class="center">操作</th>
</tr>
</thead>
<tbody>
<!-- 开始循环 -->
<c:choose>
<c:when test="${not empty varList}">
<c:if test="${QX.cha == 1 }">
<c:forEach items="${varList}" var="var" varStatus="vs">
<tr>
<td class='center'>
<label class="pos-rel"><input type='checkbox' name='ids' value="${var.c_lottery_id}" class="ace" /><span class="lbl"></span></label>
</td>
<td class='center' style="width: 30px;">${vs.index+1}</td>
<td class='center'>${var.c_lottery_number}</td>
<td class='center'>${var.c_lottery_reward}个月</td>
<td class="center">
<c:if test="${QX.edit != 1 && QX.del != 1 }">
<span class="label label-large label-grey arrowed-in-right arrowed-in"><i class="ace-icon fa fa-lock" title="无权限"></i></span>
</c:if>
<div class="hidden-sm hidden-xs btn-group">
<c:if test="${QX.edit == 1 }">
<a class="btn btn-xs btn-success" title="编辑" onclick="edit('${var.c_lottery_id}');">
<i class="ace-icon fa fa-pencil-square-o bigger-120" title="编辑"></i>
</a>
</c:if>
<c:if test="${QX.del == 1 }">
<a class="btn btn-xs btn-danger" onclick="del('${var.c_lottery_id}');">
<i class="ace-icon fa fa-trash-o bigger-120" title="删除"></i>
</a>
</c:if>
</div>
<div class="hidden-md hidden-lg">
<div class="inline pos-rel">
<button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto">
<i class="ace-icon fa fa-cog icon-only bigger-110"></i>
</button>
<ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
<c:if test="${QX.edit == 1 }">
<li>
<a style="cursor:pointer;" onclick="edit('${var.c_lottery_id}');" class="tooltip-success" data-rel="tooltip" title="修改">
<span class="green">
<i class="ace-icon fa fa-pencil-square-o bigger-120"></i>
</span>
</a>
</li>
</c:if>
<c:if test="${QX.del == 1 }">
<li>
<a style="cursor:pointer;" onclick="del('${var.c_lottery_id}');" class="tooltip-error" data-rel="tooltip" title="删除">
<span class="red">
<i class="ace-icon fa fa-trash-o bigger-120"></i>
</span>
</a>
</li>
</c:if>
</ul>
</div>
</div>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${QX.cha == 0 }">
<tr>
<td colspan="100" class="center">您无权查看</td>
</tr>
</c:if>
</c:when>
<c:otherwise>
<tr class="main_info">
<td colspan="100" class="center" >没有相关数据</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
<div class="page-header position-relative">
<table style="width:100%;">
<tr>
<td style="vertical-align:top;">
<c:if test="${QX.add == 1 }">
<a class="btn btn-mini btn-success" onclick="add();">新增</a>
</c:if>
<c:if test="${QX.del == 1 }">
<a class="btn btn-mini btn-danger" onclick="makeAll('确定要删除选中的数据吗?');" title="批量删除" ><i class='ace-icon fa fa-trash-o bigger-120'></i></a>
</c:if>
</td>
<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
</tr>
</table>
</div>
</form>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.page-content -->
</div>
</div>
<!-- /.main-content -->
<!-- 返回顶部 -->
<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>
</div>
<!-- /.main-container -->
<!-- basic scripts -->
<!-- 页面底部js¨ -->
<%@ include file="../../system/index/foot.jsp"%>
<!-- 删除时确认窗口 -->
<script src="${pageContext.request.contextPath}/static/ace/js/bootbox.js"></script>
<!-- ace scripts -->
<script src="${pageContext.request.contextPath}/static/ace/js/ace/ace.js"></script>
<!-- 下拉框 -->
<script src="${pageContext.request.contextPath}/static/ace/js/chosen.jquery.js"></script>
<!-- 日期框 -->
<script src="${pageContext.request.contextPath}/static/ace/js/date-time/bootstrap-datepicker.js"></script>
<!--提示框-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.tips.js"></script>
<script type="text/javascript">
$(top.hangge());//关闭加载状态
//检索
function tosearch(){
top.jzts();
$("#Form").submit();
}
$(function() {
//日期框
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
});
//下拉框
if(!ace.vars['touch']) {
$('.chosen-select').chosen({allow_single_deselect:true});
$(window)
.off('resize.chosen')
.on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({'width': $this.parent().width()});
});
}).trigger('resize.chosen');
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if(event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({'width': $this.parent().width()});
});
});
$('#chosen-multiple-style .btn').on('click', function(e){
var target = $(this).find('input[type=radio]');
var which = parseInt(target.val());
if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
else $('#form-field-select-4').removeClass('tag-input-style');
});
}
//复选框全选控制
var active_class = 'active';
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;//checkbox inside "TH" table header
$(this).closest('table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
});
});
});
//新增
function add(){
top.jzts();
var diag = new top.Dialog();
diag.Drag=true;
diag.Title ="新增";
diag.URL = '${pageContext.request.contextPath}/lottery/goAdd.do';
diag.Width = 450;
diag.Height = 355;
diag.Modal = true; //有无遮罩窗口
diag. ShowMaxButton = true; //最大化按钮
diag.ShowMinButton = true; //最小化按钮
diag.CancelEvent = function(){ //关闭事件
if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
if('${page.currentPage}' == '0'){
tosearch();
}else{
tosearch();
}
}
diag.close();
};
diag.show();
}
//删除
function del(Id){
bootbox.confirm("确定要删除吗?", function(result) {
if(result) {
top.jzts();
var url = "${pageContext.request.contextPath}/lottery/delete.do?c_lottery_id="+Id+"&tm="+new Date().getTime();
$.get(url,function(data){
tosearch();
});
}
});
}
//修改
function edit(Id){
top.jzts();
var diag = new top.Dialog();
diag.Drag=true;
diag.Title ="编辑";
diag.URL = '${pageContext.request.contextPath}/lottery/goEdit.do?c_lottery_id='+Id;
diag.Width = 450;
diag.Height = 355;
diag.Modal = true; //有无遮罩窗口
diag. ShowMaxButton = true; //最大化按钮
diag.ShowMinButton = true; //最小化按钮
diag.CancelEvent = function(){ //关闭事件
if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
tosearch();
}
diag.close();
};
diag.show();
}
//批量操作
function makeAll(msg){
bootbox.confirm(msg, function(result) {
if(result) {
var str = '';
for(var i=0;i < document.getElementsByName('ids').length;i++){
if(document.getElementsByName('ids')[i].checked){
if(str=='') str += document.getElementsByName('ids')[i].value;
else str += ',' + document.getElementsByName('ids')[i].value;
}
}
if(str==''){
bootbox.dialog({
message: "<span class='bigger-110'>您没有选择任何内容!</span>",
buttons:
{ "button":{ "label":"确定", "className":"btn-sm btn-success"}}
});
$("#zcheckbox").tips({
side:1,
msg:'点这里全选',
bg:'#AE81FF',
time:8
});
return;
}else{
if(msg == '确定要删除选中的数据吗?'){
top.jzts();
$.ajax({
type: "POST",
url: '${pageContext.request.contextPath}/lottery/deleteAll.do?tm='+new Date().getTime(),
data: {DATA_IDS:str},
dataType:'json',
//beforeSend: validateData,
cache: false,
success: function(data){
$.each(data.list, function(i, list){
tosearch();
});
}
});
}
}
}
});
};
//导出excel
function toExcel(){
window.location.href='${pageContext.request.contextPath}/lottery/excel.do';
}
</script>
</body>
</html>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论