You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

212 lines
5.9 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/wdk/theme/je/module/public/common.jsp"%>
<title>周选择控件</title>
<script type="text/javascript">
<% if(null==su){%>
$.timeout();
//alert("登录超时,请重新登录!");
//$.getRoot().document.location.href = $.base()+"/console.jsp";
<%}%>
var strparam = $.urlparam_decode($.getURLParam('param'));
var jparam = $.str2json(strparam);
var _startdate = jparam.param.startdate;
var _enddate = jparam.param.enddate;
window.onload = function(){
$.wait_open();
var _data = {
startdate:_startdate,
enddate:_enddate
};
$.cuajax({
url: 'wdk?action=wdk.public&method=dateweek_load&ajaxparam='+new Date().getTime(),
method:"post",
timeout:WDK_Timeout,
data:_data,
success:function(result) {
var jres = $.str2json(result);
if("1"==jres.code){
init(jres.jyears);
}else{
alert(jres.desc);
}
$.wait_close();
},
error:function(result){
alert('网络错误!result='+result);
$.wait_close();
}
});
};
function init(jyears){
var yearData = [];
var weekDate = new Object();
var dayDate = new Object();
//1、给年份增加默认空值
var defaultYear = new Object();
defaultYear.id = 'null';
defaultYear.text = '==请选择==';
yearData.push(defaultYear);
for(var i=0;i<jyears.length;i++){
var nYear = jyears[i].year;
var jWeeks = jyears[i].weeks;
var jYear = new Object();
jYear.id = nYear;
jYear.text = nYear;
yearData.push(jYear);
weekDate[nYear] = [];
//给周增加默认空值
var defaultWeek = new Object();
defaultWeek.id = 'null';
defaultWeek.text = '==请选择==';
weekDate[nYear].push(defaultWeek);
for(var j=0;j<jWeeks.length;j++){
var nWeek = jWeeks[j].year_week;
var jWeekdays = jWeeks[j].weekdays;
var jWeek = new Object();
jWeek.id = nWeek;
jWeek.text = '第'+nWeek+'周';
weekDate[nYear].push(jWeek);
dayDate[nYear+"_"+nWeek] = [];
//给日期增加默认空值
var defaultWeekday = new Object();
defaultWeekday.id = 'null';
defaultWeekday.text = '==请选择==';
dayDate[nYear+"_"+nWeek].push(defaultWeekday);
for(var k = 0;k<jWeekdays.length;k++){
var oWeekday = jWeekdays[k];
var jWeekday = new Object();
jWeekday.id = oWeekday.weekday+','+oWeekday.date;
jWeekday.text = oWeekday.weekday+','+oWeekday.date;
dayDate[nYear+"_"+nWeek].push(jWeekday);
}
}
}
var comb_year = $.combobox({
id:'dwb_year',
data:yearData,
editable:false,
idField:'id',
textField:'text',
panelHeight:100
});
var comb_week = $.combobox({
id:'dwb_week',
data:[],
editable:false,
idField:'id',
textField:'text',
panelHeight:100
});
var comb_day = $.combobox({
id:'dwb_day',
data:[],
editable:false,
idField:'id',
textField:'text',
panelHeight:100
});
comb_year.combobox({
onSelect:function(node1){
//刷新数据,重新读取省份下的城市,并清空当前输入的值
if('null'==node1.id){
comb_week.combobox({data:[]}).combobox('clear');
comb_day.combobox({data:[]}).combobox('clear');
}else{
comb_week.combobox({
data:weekDate[node1.id],
onSelect:function(node2){
if('null'==node2.id){
comb_day.combobox({
data:[]
}).combobox('clear');
}else{
comb_day.combobox({
data:dayDate[node1.id+"_"+node2.id]
}).combobox('clear');
}
}
}).combobox('clear');
comb_day.combobox({data:[]}).combobox('clear');
}
}
});
//设置选中
// 2013,14,星期二,2013-04-02
var arr = jparam.value_id.split(",");
if(arr[0]){
comb_year.combobox('select',arr[0]);
if(arr[1]){
comb_week.combobox('select',arr[1]);
if(arr[2]&&arr[3]){
comb_day.combobox('select',arr[2]+','+arr[3]);
}
}
}
}
//点击提交
function inputpop_getValue(){
var yearvalue = $("#dwb_year").combobox('getValue');
var weekvalue = $("#dwb_week").combobox('getValue');
var dayvalue = $("#dwb_day").combobox('getValue');
var showvalue = "";
var hiddenvalue = "";
if(yearvalue){
showvalue += yearvalue+'年 ';
hiddenvalue += yearvalue;
if(weekvalue){
showvalue += '第'+weekvalue+'周 ';
hiddenvalue += ','+weekvalue;
if(dayvalue){
showvalue += dayvalue;
hiddenvalue += ','+dayvalue;
}
}
}
var jres = jparam;
jres.value_id = hiddenvalue;
jres.value_text = showvalue;
return jres;
}
</script>
</head>
<body class="easyui-layout" style="padding:0px;margin:0px;background-color:#FFFFFF;">
<div id="layout_center" data-options="region:'center'" style="padding:0px;overflow:hidden;">
<table class="condi_tb" cellpadding="0" cellspacing="0">
<tr style="height:50px">
<td class="condi_tdlbl" style="height:50px">年份:</td>
<td class="condi_tdipt">
<input type="text" id="dwb_year" name="dwb_year" class="txt" style="width:150px"></input>
</td>
</tr>
<tr style="height:50px">
<td class="condi_tdlbl" style="height:50px">周数:</td>
<td class="condi_tdipt">
<input type="text" id="dwb_week" name="dwb_week" class="txt" style="width:150px"></input>
</td>
</tr>
<tr style="height:50px">
<td class="condi_tdlbl" style="height:50px">日期:</td>
<td class="condi_tdipt">
<input type="text" id="dwb_day" name="dwb_day" class="txt" style="width:150px"></input>
</td>
</tr>
<tr></tr>
</table>
</div>
</body>
</html>