| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- var index;
- var startTime;
- var endTime;
- $(function(){
- })
- function queryList(){
- var diffWeek = $('#diffWeek').val();
- var watchType = $('#watchType').val();
- var urgent = $('#urgent').val();
- var importance = $('#importance').val();
- var executionStatus = $('#executionStatus').val();
- location='weeklyMeetingController.do?goAdd&diffWeek='+diffWeek+"&watchType="+watchType+"&urgent="+urgent+"&importance="+importance+"&executionStatus="+executionStatus;
- }
- function removeRow(){
- $("#add_table").find("input:checked").parent().parent().each(function(){
- var id = $(this).attr("id");
- var tr = $(this);
- if(!id) {
- tr.remove();
- resetTrNum('add_table');
- }else {
- $.post('weeklyMeetingController.do?deleteRecord', {"id" : id}, function (d) {
- if(d.code == 200){
- tr.remove();
- resetTrNum('add_table');
- }
- }, "json");
- }
- })
- }
- function addRow(){
- var tr = $("#add_template tr").clone();
- if($('#add_table tr').length != 0){
- $(tr).find('td:eq(2)').find('input:eq(1)').val($('#meetingTime0').val());
- }
- var tableBody = $("#add_table");
- tableBody.append(tr);
- resetTrNum('add_table');
- }
- //初始化下标
- function resetTrNum(tableId) {
- $tbody = $("#"+tableId+"");
- $tbody.find('>tr').each(function(i){
- $(':input, select,button,a', this).each(function(){
- var $this = $(this), name = $this.attr('name'),id=$this.attr('id'),onclick_str=$this.attr('onclick'), val = $this.val();
- if(name!=null){
- if (name.indexOf("#index#") >= 0){
- $this.attr("name",name.replace('#index#',i));
- }else{
- var s = name.indexOf("[");
- var e = name.indexOf("]");
- var new_name = name.substring(s+1,e);
- $this.attr("name",name.replace(new_name,i));
- }
- }
- if(id!=null){
- if (id.indexOf("#index#") >= 0){
- $this.attr("id",id.replace('#index#',i));
- }else{
- var s = id.indexOf("[");
- var e = id.indexOf("]");
- if(s>0&&e>0) {
- var new_id = id.substring(s + 1, e);
- $this.attr("id", id.replace(new_id, i));
- }else{
- var new_id = id.substring(id.length - 1);
- $this.attr("id", id.replace(new_id, i));
- }
- }
- }
- if(onclick_str!=null){
- if (onclick_str.indexOf("#index#") >= 0){
- $this.attr("onclick",onclick_str.replace(/#index#/g,i));
- }else{
- }
- }
- });
- $(this).find('div[name=\'xh\']').html(i+1);
- });
- }
- function btn_ok(){
- $("#btnsub").click();
- }
- function btn_issue(){
- var msg ='请确定是否要下发';
- layer.open({
- title:'确认信息',
- content:msg,
- icon:7,
- yes:function(index){
- var url ='weeklyMeetingController.do?issueTask';
- var weekNum = $('#weekNum').val();
- var data = {};
- data.weekNum = weekNum;
- $.post(url,data,function(){
- tip('下发成功');
- layer.close(index);
- location.reload();
- },'json');
- },
- btn:['确定','取消'],
- btn2:function(index){
- layer.close(index);
- }
- });
- }
- function openAllSelect(parameter1, parameter2) {
- if(parameter1 == 'propose'){
- index = parameter2.substring("proposeName".length);
- selectAllUser('选择提出人', proposeCallback);
- }else{
- index = parameter2.substring("implementationName".length);
- selectAllUser('选择落实人', implementationCallback, true);
- }
- }
- function proposeCallback(selectedRows){
- for(var i = 0; i < selectedRows.length; i++){
- $('#proposeId' + index).val(selectedRows[i].id);
- $('#proposeName' + index).val(selectedRows[i].realName);
- }
- }
- function implementationCallback(selectedRows){
- for(var i = 0; i < selectedRows.length; i++){
- if(i == 0){
- $('#implementationId' + index).val(selectedRows[i].id);
- $('#implementationName' + index).val(selectedRows[i].realName);
- }else{
- addRow();
- $('#meetingTime' + (parseInt(index) + i)).val($('#meetingTime' + index).val());
- $('#meetingContent' + (parseInt(index) + i)).val($('#meetingContent' + index).val());
- $('#urgent' + (parseInt(index) + i)).val($('#urgent' + index).val());
- $('#importance' + (parseInt(index) + i)).val($('#importance' + index).val());
- $('#proposeId' + (parseInt(index) + i)).val($('#proposeId' + index).val());
- $('#proposeName' + (parseInt(index) + i)).val($('#proposeName' + index).val());
- $('#implementationId' + (parseInt(index) + i)).val(selectedRows[i].id);
- $('#implementationName' + (parseInt(index) + i)).val(selectedRows[i].realName);
- $('#expectedCompletion' + (parseInt(index) + i)).val($('#expectedCompletion' + index).val());
- }
- }
- }
- function getNowTime() {
- var curr = new Date;
- var first = curr.getDate() - curr.getDay() + 1;
- var firstday = new Date(curr.setDate(first));
- startTime = xx(firstday);
- endTime = AddDays(firstday,6);
- $('#startTime').text(startTime);
- $('#endTime').text(endTime);
- }
- function goBefore(){
- $('#watchType').val('before');
- queryList();
- }
- function goNext(){
- $('#watchType').val('next');
- queryList();
- }
- function xx(rq) {
- return rq.getFullYear() + "-" + ((rq.getMonth() + 1) < 10 ? "0" : "") + (rq.getMonth() + 1) + "-" + (rq.getDate() < 10 ? "0" : "") + rq.getDate() ;
- }
- function AddDays(date,days){
- var nd = new Date(date);
- nd = nd.valueOf();
- nd = nd + days * 24 * 60 * 60 * 1000;
- nd = new Date(nd);
- var y = nd.getFullYear();
- var m = nd.getMonth()+1;
- var d = nd.getDate();
- if(m <= 9) m = "0"+m;
- if(d <= 9) d = "0"+d;
- var cdate = y+"-"+m+"-"+d;
- return cdate;
- }
- function stringTodate(str){
- return new Date(Date.parse(str.replace(/-/g, "/")));
- }
|