计算灾害次数
var warningType=[];
<c:forEach items="${page.list}" var="tourismWarning">
warningType.push( '${tourismWarning.warningType}');
</c:forEach>
function sum4(warningType) {
var s = 0;
for (var i=warningType.length-1; i>=0; i--) {
if(warningType[i]=='景区周边道路预警'){
s++;
}
}
return s;
}
function sum1(warningType) {
var s = 0;
for (var i=warningType.length-1; i>=0; i--) {
if(warningType[i]=='地址灾害气象预警'){
s++;
}
}
return s;
}
function sum2(warningType) {
var s = 0;
for (var i=warningType.length-1; i>=0; i--) {
if(warningType[i]=='突发事件'){
s++;
}
}
return s;
}
function sum3(warningType) {
var s = 0;
for (var i=warningType.length-1; i>=0; i--) {
if(warningType[i]=='景区容量预警'){
s++;
}
}
return s;
}
var main_chart_41=document.getElementById('main_chart_41').innerHTML=sum4(warningType);
var main_chart_31=document.getElementById('main_chart_31').innerHTML=sum3(warningType);
var main_chart_21=document.getElementById('main_chart_21').innerHTML=sum2(warningType);
var main_chart_11=document.getElementById('main_chart_11').innerHTML=sum1(warningType);
============================================
数值三位加分隔符
<c:choose>
<c:when test="${fn:length(tourismGustflowMonitor.todayIncome)>3}">
${fn:substring(tourismGustflowMonitor.todayIncome,0,3)},${fn:substringAfter(tourismGustflowMonitor.todayIncome,fn:substring(tourismGustflowMonitor.todayIncome,0,3))}
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${(tourismGustflowMonitor.todayIncome==0)}">
<p class="font-red" style="font-size: 30px"> ${tourismGustflowMonitor.todayIncome}</p>
</c:when>
<c:otherwise>
${tourismGustflowMonitor.todayIncome}
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
</p>
<p>
<c:choose>
<%--<c:when test="${tourismGustflowMonitor.id==fn:length(tourismGustflowMonitor.id)}">--%><%--第一位为红色--%>
<c:when test="${tourismGustflowMonitor.incomeType=='本周旅游收入总数'}">
(万元)
</c:when>
<c:when test="${tourismGustflowMonitor.incomeType=='今日旅游收入总数'}">
(万元)
</c:when>
<c:when test="${tourismGustflowMonitor.incomeType=='本周客容量报警数'}">
(条)
</c:when>
<c:otherwise>
(人次)
</c:otherwise>
</c:choose>
加注解
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
遍历每个数据
var currentTime=[];
var tourstAmount = [];
var increaseRate=[];
<c:forEach items="${page4.list}" var="tourisimCurrentInformation">
currentTime.push( '${tourisimCurrentInformation.currentTime}');
tourstAmount.push( ${tourisimCurrentInformation.tourstAmount});
increaseRate.push( ${tourisimCurrentInformation.increaseRate});
</c:forEach>
计算人数和票数
function sum(ticketNum) {
var s = 0;
for (var i=ticketNum.length-1; i>=0; i--) {
s += ticketNum[i];
}
return s;
}
var main_chart_4_1 = document.getElementById('main_chart_4_1').innerHTML="今日销售门票:<span class=\"text-blue\">"+sum(ticketNum)+"</span>张";
function sum1(tourismNum) {
var s = 0;
for (var i=ticketNum.length-1; i>=0; i--) {
s += ticketNum[i];
}
return s;
}
var main_chart_4_2 = document.getElementById('main_chart_4_2').innerHTML="实时客流量:<span class=\"text-blue\">"+sum1(tourismNum)+"</span>人";
值为”正”个数
function sum1(twoSide) {
var s = 0;
for (var i=twoSide.length-1; i>=0; i--) {
if (twoSide[i]=="正"){
s++;
}
}
return s;
}
下拉选框
<form:select path="weekDate" class="input-xlarge required" maxlength="25" cssStyle="width: 122px;" >
<form:option value="周一" label="周一" onkeydown="true"/>
<form:option value="周二" label="周二"/>
<form:option value="周三" label="周三"/>
<form:option value="周四" label="周四"/>
<form:option value="周五" label="周五"/>
<form:option value="周六" label="周六"/>
<form:option value="周日" label="周日"/>
</form:select>
==============================================
<label class="control-label">日期:</label>
<div class="controls">
<%-- <form:input path="times" htmlEscape="false" maxlength="25" class="input-xlarge required" readonly="true"/>--%>
<form:input path="times" htmlEscape="false" class="input-xlarge required"
onclick="WdatePicker({dateFmt:'MM.dd'})" />
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
=====================================================
<div class="control-group">
<label class="control-label">节日类型:</label>
<div class="controls">
<%--<form:input path="festivalType" htmlEscape="false" maxlength="25" class="input-xlarge required" readonly="true"/>--%>
<form:select path="festivalType" class="input-mini" cssStyle="width: 122px;">
<form:option value="春节" label="春节" onkeydown="true"/>
<form:option value="清明节" label="清明节"/>
<form:option value="劳动节" label="劳动节"/>
<form:option value="端午节" label="端午节"/>
<form:option value="中秋节" label="中秋节"/>
<form:option value="国庆节" label="国庆节"/>
</form:select>
<form:select path="monthId" class="input-mini" cssStyle="width: 122px;">
<form:option value="1" label="一月" onkeydown="true"/>
<form:option value="2" label="二月"/>
<form:option value="3" label="三月"/>
<form:option value="4" label="四月"/>
<form:option value="5" label="五月"/>
<form:option value="6" label="六月"/>
<form:option value="7" label="七月"/>
<form:option value="8" label="八月"/>
<form:option value="9" label="九月"/>
<form:option value="10" label="十月"/>
<form:option value="11" label="十一月"/>
<form:option value="12" label="十二月"/>
</form:select>
====================
判断数据库中的值是否为空
<c:choose>
<c:when test="${tourismWeMediaAttention.fansVolumLastweek==null}">
${tourismWeMediaAttention.fansVolumLastweek}
</c:when>
<c:otherwise>
${tourismWeMediaAttention.fansVolumLastweek}(万人)
</c:otherwise>
</c:choose>
=====================
<form:select path="scienceAir" htmlEscape="false" maxlength="25" >
<form:option value="晴" label="晴" onkeydown="true"/>
<form:option value="多云" label="多云"/>
<form:option value="雨" label="雨"/>
</form:select>
需要提前在后台字典里定义好’incomeItems’
<form:select path="incomeItems" class="input-xlarge required">
<form:option value="" label=""/>
<form:options items="${fns:getDictList('incomeItems')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
============================================
提示
<span class="help-inline">轻微区3.5~5、较轻区2.5~3.5、重点区1.5~2.5、强烈区0~1.5 </span>
输入限制
只能输入数字
onkeyup="value=value.replace(/[^\d]/g,'')"
onkeyup="this.value=this.value.replace(/\D/g,'')"
onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\@\.]/g,'')"
<span class="help-inline"><font color="red">*</font> 只能输入中文、英文、数字、@符号和.符号</span>
onkeyup="value=value.replace(/[^\d\.\-]/g,'')"
οnblur=“if(this.value.replace(/^ +| +$/g,’’)==’’)alert(‘不能为空!’)”
排序
ORDER BY roadValue DESC 降序
ORDER BY roadValue ASC升序
==============
只读
readonly="true"
日期格式
<fmt:formatDate value="${tourismWarning.warningTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
必须输入8位数
<td>
<fmt:formatNumber type="number"
pattern="00000000" value="${tourismIndexNum.todayNum}" />
<%--${tourismIndexNum.todayNum}--%>
</td>
行号
<c:forEach varStatus="status" items="${page1.list}" var="tourismWarningContact">
${status.index}从0开始
${status.count}从1开始
</c:forEach>
================
默认到小数点后两位
placeholder="默认到小数点后两位" onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
=======================
年份
<div class="control-group">
<label class="control-label">年份:</label>
<div class="controls">
<form:input path="nyear" htmlEscape="false" class="input-xlarge number required" onclick="WdatePicker({dateFmt:'yyyy',minDate:'1900',maxDate:'2099'})" />
</div>
</div>
清空月份选择
onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"
=======================
选择单位
<div class="control-group">
<label class="control-label">已完成投资:</label>
<div class="controls">
<form:input path="cutOff" id="cutOff" htmlEscape="false" class="input-xlarge number required" placeholder="默认到小数点后两位" onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')" onblur="validateCutOff()"/><span class="help-inline"><font color="red">*<span class="tip" id="tip"></span></font></span>
<label>单位:</label>
<form:select path="unit" id="unit" class="input-mini" cssStyle="width: 122px;">
<form:option value="万元" label="万元"/>
<form:option value="元" label="元"/>
<%--<form:option value="%" label="%"/>--%>
</form:select>
</div>
</div>
==================================
举例 placeholder="如:陕西**公司物流配送建设工程"
图片上传
=========================
宽度设置cssStyle="width: 60%"