easy ui form 结合 ajax参数
敖子安
2023-12-01
<cui:form id="eventStatics" name="eventStatics" >
<table id="event" >
<tr>
<td style="width: 100px;padding-top: 10px;" align="right">
<label>告警类型:</label>
</td>
<td>
<cui:combobox id="eventType" name="type" width="160" emptyText="全部" method="get" url="${ctx}/tbalarm!querySafeAlarmType.json"></cui:combobox>
</td>
<td style="width: 100px;padding-top: 10px;" align="right">
<label>告警状态:</label>
</td>
<td>
<cui:combobox id="eventStatus" name="eventStatus" width="160" emptyText="全部" method="get" url="${ctx}/statics!querySafeAlarmStatus.json"></cui:combobox>
</td>
<td style="vertical-align: middle;padding-left: 30px;" rowspan="2">
<cui:button id="eventSearchBtn" label="统 计" onClick="eventStatics" ></cui:button>
<cui:button id="eventResetBtn" label="重 置" onClick="reset" ></cui:button>
</td>
</tr>
<tr>
<td style="width: 100px;padding-top: 10px;" align="right">
<label>时 间:</label>
</td>
<td >
<cui:datepicker id="eventStartDate" name="eventStartDate" dateFormat="yyyy-MM-dd" showOn="button" width="160"/>
</td>
<td style="width: 100px;padding-top: 10px;" align="center">
<label>至:</label>
</td>
<td>
<cui:datepicker id="eventEndDate" name="eventEndDate" dateFormat="yyyy-MM-dd" showOn="button" width="160"/>
</td>
</tr>
</table>
</cui:form>
//ajax部分提交的data参数也等同于form的表单的参数提交,后天的action,model也照样能接收到
//最长处理时长Top10--事件工单
function eventTypeStatics(eventBeginDate,eventEndDate,eventType,eventStatus){
require(['echarts','echarts/chart/bar'],type);
var typeChart;
var re;
function type(ec) {
typeChart = ec.init(document.getElementById('eventArea'));
typeChart.showLoading({
text : '努力加载数据中...',
textStyle : {
fontSize : 20
},
effect : 'ring'
});
var sourceData = new Array();
var countData = new Array();
$.ajax({
url:'${ctx}/statics!queryNetAlarmTopStatics.json',
type:'POST',
data:{'beginTime':eventBeginDate,'endTime':eventEndDate,'typeMessage':eventType,'toolMessage':eventStatus},
async:false,
success:function(result){
re = result.data;
for(var i =0 ;i<re.length;i++){
var datas = re[i];
sourceData = datas.sourceData;
var counts = datas.countData;
for(var j =0;j<sourceData.length;j++){
countData.push({'value':counts[j],'name':sourceData[j]});
}
}
}
});
}