var netCarDriverId = $('#netCarDriverId').val(); var array = []; var language =$("#language").val() $(function () { laydate.render({ elem: '#punishTime', //指定元素 format: 'yyyy-MM-dd',//日期格式 value: '',//默认值 zIndex: 99999999//层叠顺序 ,lang:"en", trigger: 'click', done: function(value, date, endDate){ console.log(value); //得到日期生成的值,如:2017-08-18 } }); if('' != netCarDriverId){ getData(); } }); var Training = { id: "OpenCity", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1, }; /** * 关闭此对话框 */ Training.close = function () { parent.layer.close(window.parent.YesDriver.layerIndex); }; /** * 保存数据 */ function save() { if(array.length == 0){ Feng.error("请先添加处罚记录"); return; } $.ajax({ url: Feng.ctxPath + "/tDriver/savePunish", type: 'POST', data: { punish: array.toString(), driverId: netCarDriverId }, success: function (res) { if(res.status == 200){ Feng.success("添加成功"); Training.close(); window.parent.YesDriver.table.refresh();//刷新表格数据 }else{ Feng.error(res.msg) } } }); } function add() { var id = $('#id').val(); var punishTime = $('#punishTime').val().trim(); var punishReason = $('#punishReason').val().trim(); var punishReault = $('#punishReault').val().trim(); if('' == punishTime){ Feng.error("处罚时间不能为空"); return; } if('' == punishReason){ Feng.error("处罚原因不能为空"); return; } if('' == punishReault){ Feng.error("处罚结果不能为空"); return; } var str = id + '_' + punishTime + '_' + punishReason + '_' + punishReault; if($.inArray(str, array) < 0){ array.push(str); $('#id').val(''); $('#punishTime').val(''); $('#punishReason').val(''); $('#punishReault').val(''); } analysis(); } function analysis() { var str = ''; for(var i in array){ var a = array[i].split('_'); str += '