loading js备份
loadingManageEdit.jsp
$(function(){
//组织
var lodingDeparts =[<c:forEach items="${lodingDeparts}" var="dept"> {
deptId:"${dept.deptId}",
deptName:"${dept.deptName}"},</c:forEach>];
var applist=new Array();//应用集合
var ruleTotalId = "";
var ruleTotalContent = "";
$.each(lodingDeparts,function(i,item){
if (i == 0){
ruleTotalContent ="<span style='word-break:hyphenate;' id='"+item.deptId+"' >" +item.deptName+" <a href='javascript:;' onclick='removeData(\""+item.deptId+"\")'>删除</a> </span>";
//动态添加到下边显示
$("#dept").find('td').eq(1).append(ruleTotalContent);
}else{
ruleTotalId = item.deptId;
ruleTotalContent = "<span style='word-break:hyphenate;' id='"+item.deptId+"' >"+","+item.deptName+" <a href='javascript:;' onclick='removeData(\""+item.deptId+"\")'>删除</a>";
$("#dept").find('td').eq(1).append(" "+ruleTotalContent+"</span>");
}
//将id和name组合加入集合
applist.push(item.deptId);
});
//将已选择的数组缓存在页面中
$("#alertSelectNode").val(applist.join());
//岗位
var lodingPosts = [<c:forEach items="${lodingPosts}" var="post"> {
postId:"${post.postId}",
postName:"${post.postName}"},</c:forEach>];
var postList=new Array();//应用集合
var postTotalId = "";
var postTotalContent = "";
$.each(lodingPosts,function(i,item){
if (i == 0){
ruleTotalContent ="<span style='word-break:hyphenate;' id='"+item.postId+"' >" +item.postName+" <a href='javascript:;' onclick='removePost(\""+item.postId+"\")'>删除</a> </span>";
//动态添加到下边显示
$("#post").find('td').eq(1).append(ruleTotalContent);
}else{
postTotalId = item.postId;
postTotalContent = "<span style='word-break:hyphenate;' id='"+item.postId+"' >"+","+item.postName+" <a href='javascript:;' onclick='removePost(\""+item.postId+"\")'>删除</a>";
$("#post").find('td').eq(1).append(" "+postTotalContent+"</span>");
}
//将id和name组合加入集合
postList.push(item.postId);
});
//将已选择的数组缓存在页面中
$("#alertSelectPost").val(postList.join());
//图片
var LoadingAttachs = [<c:forEach items="${LoadingAttachs}" var="attach"> {
attachId:"${attach.attachId}",
picPath:"${attach.picPath}",
picSeq:"${attach.picSeq}"},
</c:forEach>];
$.each(LoadingAttachs,function(i,item){
if (i == 0){
$("#loadingAttachmentId").val(item.attachId);
}else{
var attachmentIds = $("#loadingAttachmentId").val();
$("#loadingAttachmentId").val(attachmentIds+","+item.attachId);
}
//动态添加一行表格
$('#picTable tbody').append();
});
})
function removeData(id){
var ids = $("#alertSelectNode").val().split(",");
for(var j = 0,len = ids.length; j < len; j++){
if(ids[j]==id){
ids.splice(j,1)
}
}
$("#alertSelectNode").val(ids.join());
calcuUserCount();
$("#"+id).remove();
}
function removePost(id){
var ids = $("#alertSelectPost").val().split(",");
for(var j = 0,len = ids.length; j < len; j++){
if(ids[j]==id){
ids.splice(j,1);
}
}
$("#alertSelectPost").val(ids.join());
calcuUserCount();
$("#"+id).remove();
}
function removePic(id){
var ids = $("#loadingAttachmentId").val().split(",");
var idValue=null;
for(var j = 0,len = ids.length; j < len; j++){
if(ids[j]==id){
idValue= $('input[name='+id+']').val();
ids.splice(j,1);
}
}
$("#loadingAttachmentId").val(ids.join());
$("#"+id).remove();
//调整排序
for(var j = 0,len = ids.length; j < len; j++){
var idValues= $('input[name='+ids[j]+']').val();
if(idValues>idValue){
$('input[name='+ids[j]+']').val(idValues-1);
}
}
if(ids==null || ids==""){//将表格头隐藏
$('#picTable').attr("style","display:none;");
}
}
function calcuUserCount(){
var obj = window.top.document.getElementById("win_right");
//得到当前所选择的所有组织
var allDept = obj.contentWindow.$("#alertSelectNode").val();
//得到当前所选择的所有岗位
var allPost = obj.contentWindow.$("#alertSelectPost").val();
//请求数据
var url =ctx + "/loadingManageAction.do?method=calcuUserCount";
$.ajax({
type:'post',//请求方法的类型为post
url:ctx + "/loadingManageAction.do?method=calcuUserCount",//请求地址
async:false,
data : {
allDept : allDept,
allPost : allPost
}, // 参数值
success:function(data){//成功时触发方法
if (data != null){
obj.contentWindow.$("#count").html(data);
}
}
});
}
loadingManageEdit.js
function doSubmitHandle(){
//判断名称不能为空
var name = $("#name").val().trim();
if(name.length==0){
jboxAlert("名称不能为空");
return false;
}
var regName = new RegExp("^[0-9]*$");//从头到尾都是数字
if(regName.test(name)){
jboxAlert("请输入非数字字符串");
return false;
}
//判断权重不能为空
var weight = $("#weight").val().trim();
if(weight.length==0){
jboxAlert("权重不能为空");
return false;
}
var regPos = /^(([^0][0-9]+|0)\.([0-9]{1,2}))$/; //非负浮点数
if(!regName.test(weight)||weight>999||weight<=0||regPos.test(weight)){
jboxAlert("请输入1-999的整数");
return false;
}
//判断附件上传不能为空
var fileName = $("#loadingAttachmentId").val().trim();
if(fileName == "" ||fileName==null){
jboxAlert("请选择上传图片");
return false;
}
//判断广告关闭方式
var weight = $("#weight").val().trim();
var chkRadio = $('input:radio[name="isCompel"]:checked').val();
if(chkRadio==null){
jboxAlert("请选择广告关闭方式");
return false;
}
//判断播放时长
var showTime = $('input[name="showTime"]:checked').val();
if(showTime==null){
jboxAlert("请选择播放时长");
return false;
}
// 判断时间不能为空,并且开始时间要小于结束时间
if(($("#beginTime").val() == null || $("#beginTime").val() == "")
&& ($("#endTime").val() == null || $("#endTime").val() == "")){
jboxAlert("请选择起始日期和结束日期");
return false;
}
if(($("#beginTime").val() == null || $("#beginTime").val() == "")
&& !($("#endTime").val() == null || $("#endTime").val() == "")){
jboxAlert("请选择起始日期");
return false;
}
if(!($("#beginTime").val() == null || $("#beginTime").val() == "")
&& ($("#endTime").val() == null || $("#endTime").val() == "")){
jboxAlert("请选择结束日期");
return false;
}
//显示规则
var weight = $("#showRule").val().trim();
var chkRadio = $('input:radio[name="showRule"]:checked').val();
if(chkRadio==null){
jboxAlert("请选择显示规则");
return false;
}
//显示范围
var alertSelectNode = $("#alertSelectNode").val().trim();
if(alertSelectNode==null ||alertSelectNode==""){
jboxAlert("请选择显示范围");
return false;
}
//将排序方式从页面获取并放置到页面
var picSeqs=new Array();//应用集合
var seqs = $("#loadingAttachmentId").val().split(",");
var picSeq = "";
for(i=0 ;i < seqs.length ; i++){
item = seqs[i]
picSeq = $('input[name='+item+']').val();
if(picSeq==null ||picSeq==""){
jboxAlert("图片排序不能为空");
return false;
}
picSeqs.push(picSeq);
}
// 判断集合排序元素是否重复
for (var i = 0; i < picSeqs.length; i++) {
if (parseInt(picSeqs[i],10) == parseInt(picSeqs[i + 1],10)) {
jboxAlert("图片排序不能重复");
return false;
}
}
$("#picSeqs").val(picSeqs.join());
var count = $("#count").html();
$("#countUv").val(count);
$("#loadingManageForm").submit();
}
// 文件上传成功,给item添加成功class, 用样式标记上传成功。
uploader.on( 'uploadSuccess', function( file ,data) {
if(data.success=="true"){
var attachmentIds = $("#loadingAttachmentId").val();
if(attachmentIds==null || attachmentIds==""){//之前没有上传图片
//如果是第一个添加进来的图片需要先将table显示出来
$('#picTable').attr("style","display:block;");
$("#loadingAttachmentId").val(data.file.id);
}else{
var attachmentIds = $("#loadingAttachmentId").val();
$("#loadingAttachmentId").val(attachmentIds+","+data.file.id);
}
var size = $("#loadingAttachmentId").val().split(",");
//动态添加一行表格
$('#picTable tbody').append("<tr id="+data.file.id+">"+
"<td><img style='width:60px;height:60px;margin-left: 50px;margin-top: 20px;'src="+data.file.uploadFilePath+">"+"</image></td>" +
"<td><input type='text' value='"+size.length+"' name="+data.file.id+" style='text-align:center;width:45px;border-style:ridge;' onkeyup="+"this.value=this.value.replace(/[^0-9]/g,'') /></td>"+
"<td><a href='javascript:;' onclick='removePic(\""+data.file.id+"\")'>删除</a></td>"+"</tr>");
}else{
jboxAlert(data.message);
}
});
loading js备份的更多相关文章
- Atitit. Toast alert loading js控件 atiToast v2新特性
Atitit. Toast alert loading js控件 atiToast v2新特性 1. 连续多个txt追加的原理 var txt = document.createElement(& ...
- 自己寫的 Loading JS插件
本文為原創文章,轉載請注明出處,謝謝./** * @author samkin.yang * @version 1.0 */var $_yxj = new SamkinLoading(); (func ...
- gulpfile.js备份
var gulp = require('gulp'); var uglify = require('gulp-uglify'); // var rename = require('gulp-renam ...
- [js开源组件开发]loading加载效果
loading加载效果 由于程序和网络的原因,常常我们需要在交互的时候,给用户一个正在加载中的动画,于是,loading组件横空出世.不需要复杂的代码,也能完成大多数业务,这就是我做组件的原则. 效果 ...
- ReactJS实践(一)—— FrozenUI React化之Loading组件
在前面我们通过四篇文章入门了React的大部分主要API,现在则开始进入实践环节. 实践系列的开篇打算拿我司的FrozenUI来试验,将其部分UI组件进行React化,作为第一篇实践文章,将以较简单的 ...
- JS -- 异步加载进度条
今天在博客园问答里面看到博友问道怎么实现Ajax异步加载产生进度条. 很好奇就自己写了一个. 展现效果: 1) 当点击Load的时候,模拟执行异步加载. 浏览器被遮挡. 进度条出现. 实现思路: 1. ...
- gulp 压缩js,css
最近做的前端项目中发现引用的js包太多,导致页面加载时反应很慢,所以首先想到的是将js和css压缩,提高加载速度. 我们先来看看抓到的当前页面响应时间: 页面异步加载,需要响应时间 7.41秒,这也太 ...
- loading插件(原创)
前言:服务器这几天都连不上,所以迟迟未更新,今天连上后才把插件文件和文档上传了.良心之作啊,难度虽不高,但命名多文件多啊.我得马上写篇博客絮叨一下,直接上地址. 文档及下载地址:www.chenggu ...
- loading
<!doctype html> <html> <head> <title>实惠福利</title> <meta charset=&qu ...
随机推荐
- bean属性复制到另外一个bean
import org.springframework.beans.BeanUtils; BeanUtils.copyProperties(maker.getBaseInfo(), newBasInfo ...
- 「雅礼集训 2017 Day5」珠宝
题目描述 Miranda 准备去市里最有名的珠宝展览会,展览会有可以购买珠宝,但可惜的是只能现金支付,Miranda 十分纠结究竟要带多少的现金,假如现金带多了,就会比较危险,假如带少了,看到想买的右 ...
- atomic详解
http://www.360doc.com/content/14/1120/21/203028_426770242.shtml
- django-crontab实现定时任务
django-crontab实现服务端的定时任务 安装 pip install django-crontab 在Django项目中使用 settings.py INSTALLED_APPS = ( ' ...
- 把xml数据直接插入到sqlserver数据库
存储过程: ALTER proc [ali].[ins_冻结金额表] @xmldoc varchar(max), ) as declare @idoc int exec sp_xml_prepared ...
- EasyUI + ajax + treegrid/datagrid 接收 json 数据,显示树状/网状表结构
最后一更了,时间间隔有点久了~~ EasyUI作为一个成熟的前端框架,封装了ajax,对于数据的处理配合datagrid组件的使用,使其非常适合后台管理界面的开发(目前来说界面有点过时了). 通过aj ...
- STM32的内存管理
ref:https://www.cnblogs.com/leo0621/p/9977932.html 这里针对STM32F407芯片+1M外部内存的内存管理!(全篇是个人愚见,如果错误,请不吝指出!) ...
- python之路(7)装饰器
前言 装饰器:为函数添加附属功能,本质为函数 原则:不修改被修饰函数的源代码 不修改被修饰函数的调用方式 装饰器=高阶函数+函数嵌套+闭包 使用场景演示 定义下面函数 def cal(l): res ...
- Dynamic Clock in Terminal.
#!/bin/bash tput civis while [ 1 ] do tput clear # tput cup 10 20 info=$(date "+%Y-%m-%d %H:%M: ...
- Emit 自动生成IL代码,注入代码
Spring 框架中的注入代码,以及自动生成对接口的实现,则根据il代码注入 Emit学习(1)-Emit概览 一.Emit概述 Emit,可以称为发出或者产生.在Framework中,与Emit相关 ...