123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900 |
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>应急响应值班安排表填报</title>
- <!--引入QUI框架js -->
- <%@include file="need.jsp" %>
- <script type="text/javascript" src="<%=path%>/scripts/setiframeheight.js" ></script>
- <script type="text/javascript" src="<%=path%>/scripts/business/am/org/maintenance/orgSel.js"></script>
- <script type="text/javascript" src="<%=path%>/scripts/freamwork/com/sinosoft/system/invoking/invoking.js"></script>
- <script>
- // 部门id
- var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //取得用户真实姓名
- var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //部门名称
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- //父部门id
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var corpName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
-
- var flag=false;
- var isNew=false; //是否是新增记录
- var editingRow; // 双击的当前编辑行
- var isValida=true; //是否需要验证
-
- var duty;
- var g;
- var dutyData={"list":[{"value":"0","key":"在岗值班"},{"value":"1","key":"电话值班"},{"value":"2","key":"应急指挥中心值班"}]};
- var departNode;
- var duty_man1;
- var duty_man;
- var newrowid=200;
-
- //获得值班人员姓名
- function getZhiBanMan() {
- var urls = $.pathname() + '/ws/bgd_duty/BgdDutyService/getlei_ZhiBan_Man1';
-
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 15000,
- async : false,
- data : {
- deptId : deptId
- },
- dataType : 'json',
- success : function(data) {
- duty_man1 = data;
- },
- error : function(e) {
- alert("获取数据失败!!!!");
- }
- });
-
- }
- function getZhiBanMan1() {
- var urls = $.pathname() + '/ws/bgd_duty/BgdDutyService/getlei_ZhiBan_Man';
-
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 15000,
- async : false,
- data : {
- deptId : deptId
- },
- dataType : 'json',
- success : function(data) {
- duty_man = data;
- },
- error : function(e) {
- alert("获取数据失败!!!!");
- }
- });
-
- }
-
- function initComplete(){
- getZhiBanMan1();
- getZhiBanMan();
- // $("#name_id").initYewuSelect("365","FD_OBJECTID","EARLY_WARNING_ID","IS_DEL ='0' AND IS_ALERT='1' and IS_SEND='5' and EARLY_WARNING_PROPERTY != '51' and WRITE_DEPT ='"+deptId+"'"); //需求名称
- var AUrl = $.pathname() + "/ws/crud/CRUDService/queryQui/";
- var Aparams = {
- listId : "365",
- condition : " IS_DEL ='0' AND IS_ALERT='1' and IS_SEND='5' and EARLY_WARNING_PROPERTY != '51' and WRITE_DEPT ='"+CorpArea+"'"
- };
- var Alist = [];
- $.post(AUrl, Aparams, function(result) {
- for (var i = 0; i < result.rows.length; i++) {
-
- var Akey = result.rows[i].EARLY_WARNING_ID_365;
- var val = result.rows[i].FD_OBJECTID365
- Alist.push({
- "value" : val,
- "key" : Akey
- })
-
- }
- var selData = {
- "list" : Alist
- };
- // 赋给data
- $("#name_id").data("data", selData);
- $("#name_id").render();
- }, "json");
-
- $("#name_id").bind("change",function(){
- var tm = $(this).attr("relText");
- if(tm == "请选择"){
- return;
- }
- var taskName = tm+"_"+corpName+"_"+getNowFormatDate1();
- $("#name").val(taskName);
- });
- $("#oper_name").html(realname);
- $("#opernames").val(realname);
- $("#dept_names").html(deptName);//显示
- $("#deptnames").val(deptId);//保存
-
- $("#oper_dept").val(CorpArea);
- $("#oper_dept_show").html(corpName);
- // $("#oper_dept").OrgSel({selectedMulti : true,loadId_in:CorpArea,loadCorp:"loadCorp"});
- // $("#oper_dept").val(top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames());
- // var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
- // $.post(deptUrl,{id:parentId,name:''},function(data){
- // $("#oper_dept").data("data",data);
- // $("#oper_dept").render();
- // }, "json");
- //默认选中登录人所属部门
- //$('#dept_names').attr('selectedValue',dpids);
- //$('#oper_dept').attr('selectedValue',dpids);
- var url = $.pathname() + "/ws/sys/constantService/getQuiConstantByName/";
- var obj = this;
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- async:false,
- data: {
- "name" : 'BM_DUTYTIME'
- },
- dataType : 'json',
- success : function(data){
-
- $('#duty_time').data("data",data);
- $('#duty_time').render();
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- })
- $("#INPUT_NAME_ID_335").val(userId);
- var myDate = getNowFormatDate();
- $("#oper_time").html(myDate);
- $("#opertimes").val(myDate);
- var uls=$.pathname() + '/ws/duty/DutyRecordsService/getDutyZHIBAN';
- var num = $('#duty_time').attr("relvalue");
- $.ajax({
- url : uls,
- type : 'post',
- timeout : 15000,
- data: {
- num : num
- },
- dataType : 'json',
- success : function(data){
- duty=data;
- initGrid();
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- })
-
- $("#duty_time").bind("change",function(){
- var num = $(this).attr("relvalue");
- var uls=$.pathname() + '/ws/duty/DutyRecordsService/getDutyZHIBAN';
- $.ajax({
- url : uls,
- type : 'post',
- timeout : 15000,
- data: {
- num : num
- },
- dataType : 'json',
- success : function(data){
- duty=data;
- initGrid();
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- })
- })
- getZhiBanMan();
- }
- //选择值班领导带出电话
- $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(0)").live("change",function(i){//申请单位联系人的绑定事件
- var userId = $(this).data("selectedNode").userid;
- if(userId!=''){
- $.ajax({
- url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
- type : 'post',
- //async : false,
- timeout : 15000,
- data: {
- userId : userId
- },
- dataType : 'json',
- success : function(result){
- $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(4)").val(result);
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
- };
- });
- //值班人员带出电话
- $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(2)").live("change",function(i){//申请单位联系人的绑定事件
- var userId = $(this).data("selectedNode").userid;
- if(userId!=''){
- $.ajax({
- url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
- type : 'post',
- //async : false,
- timeout : 15000,
- data: {
- userId : userId
- },
- dataType : 'json',
- success : function(result){
- $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(9)").val(result);
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
- };
- });
- $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(3)").live("change",function(i){//申请单位联系人的绑定事件
- var userId = $(this).data("selectedNode").userid;
- if(userId!=''){
- $.ajax({
- url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
- type : 'post',
- //async : false,
- timeout : 15000,
- data: {
- userId : userId
- },
- dataType : 'json',
- success : function(result){
- $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(12)").val(result);
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
- };
- });
- $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(4)").live("change",function(i){//申请单位联系人的绑定事件
- var userId = $(this).data("selectedNode").userid;
- if(userId!=''){
- $.ajax({
- url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
- type : 'post',
- //async : false,
- timeout : 15000,
- data: {
- userId : userId
- },
- dataType : 'json',
- success : function(result){
- $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(15)").val(result);
- },
- error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
- };
- });
- //获得当前系统时间(年月日)
- function getNowFormatDate1(){
- var s="";
- var d = allGetServerTime();
- var vYear = d.getFullYear();
- var vMon = d.getMonth() + 1;
- var vDay = d.getDate();
- // var h = d.getHours();
- // var m = d.getMinutes();
- s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)+"-"+(vDay<10 ? "0"+ vDay : vDay);
- return s;
- }
- function getNowFormatDate() {
-
- var date = allGetServerTime();
- var seperator1 = "-";
- var seperator2 = ":";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
-
-
- var hour=date.getHours();
- var minu=date.getMinutes();
- var sec=date.getSeconds();
-
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- if(hour>=0 && hour<=9){
- hour="0"+hour;
- }
-
- if(minu>=0 && minu<=9){
- minu="0"+minu;
- }
- if(sec>=0 && sec<=9){
- sec="0"+sec;
- }
-
- var currentdate = year + seperator1 + month + seperator1 + strDate
- + " " + hour + seperator2 + minu;
- return currentdate;
- }
- function getNoteTime(){
- var date = allGetServerTime();
- var seperator1 = "-";
- var seperator2 = ":";
-
- var hour=date.getHours();
- var minu=date.getMinutes();
- var sec=date.getSeconds();
-
- if(hour>=0 && hour<=9){
- hour="0"+hour;
- }
-
- if(minu>=0 && minu<=9){
- minu="0"+minu;
- }
- if(sec>=0 && sec<=9){
- sec="0"+sec;
- }
-
- var currentdate = hour + seperator2 + minu
- + seperator2 + sec;
- return currentdate;
-
- }
- function getNowDate(){
- var date = allGetServerTime();
- var seperator1 = "-";
- var seperator2 = ":";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate;
- return currentdate;
-
- }
-
- function initGrid(){
- g = $("#maingrid").quiGrid({
- columns: [
- /* {name:'fd_objectid',hide:true},
- {name:'duty_id',hide:true},
- { display: '日期', name: 'duty_date', align: 'center', width: "10%",editor: { type: 'date',dateFmt:'yyyy-MM-dd' }},
- */{ display: '开始时间', name: 'start_time', align: 'center', width: 110,editor: { type: 'date',dateFmt:'yyyy-MM-dd HH:mm' }},
- { display: '结束时间', name: 'end_time', align: 'center', width: 110,editor: { type: 'date',dateFmt:'yyyy-MM-dd HH:mm' }},
- { display: '值班领导', name: 'leader', align: 'center', width: 110,editor: { type : 'select',data : duty_man1,selWidth : 110}},
- { display: '领导电话', name: 'leader_tel', align: 'center', width: 110,editor: { type: 'text' ,inputMode:'numberOnly'}},
- // { display: '值班成员,联系电话', name: 'name',showTitle:true, align: 'center', width: "33%",editor: { type: 'text'}},
- // { display: '联系电话', name: 'telephone', align: 'center', width: "12%",editor: { type: 'text' ,maxlength:'11',inputMode:'numberOnly',tip:'只能输入数字'}},
- { display: '值班方式', name: 'duty_way', align: 'center', width: 95,editor: { type: 'select',data:dutyData,selWidth:110 },render:function (item){
- for (var i = 0; i < dutyData["list"].length; i++)
- {
- if (dutyData["list"][i]['value'] == item.duty_way)
- return dutyData["list"][i]['key']
- }
- return item.duty_way;
- }},
- { display: '行政值班', name: 'administration_duty', align: 'center', width: 110,editor: { type : 'select',data : duty_man,selWidth : 110}},
- { display: '行政值班电话', name: 'administration_duty_tel', align: 'center', width: 110,editor: { type: 'text',inputMode:'numberOnly'}},
- { display: '生产值班', name: 'everyday_duty', align: 'center', width: 110,editor: { type : 'select',data : duty_man,selWidth : 110}},
- { display: '生产值班电话', name: 'everyday_duty_tel', align: 'center', width: 110,editor: { type: 'text',inputMode:'numberOnly'}},
- { display: '现场值班', name: 'spot_duty', align: 'center', width: 110,editor: { type : 'select',data : duty_man,selWidth : 110}},
- { display: '现场值班电话', name: 'spot_duty_tel', align: 'center', width: 110,editor: { type: 'text',inputMode:'numberOnly'}},
- { display: '现场值班地点', name: 'spot_duty_address', align: 'center', width: 110,editor: { type : 'text'}},
- { display: '现场值班车辆', name: 'spot_duty_car', align: 'center', width: 110,editor: { type: 'text'}},
- { display: '操作', isSort: false, width: "14%", render: function (rowdata, rowindex, value)
- {
- var h = "";
- if (!rowdata._editing)
- {
- flag=false;
- h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
- }
- else
- {
- flag=true;
- h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>确认</span></a> ";
- // h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
- h += "<a onclick='quxiaoEdit(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
- }
- return h;
- }
- }
- ],
- // url: $.pathname() + '/ws/duty/DutyRecordsService/getDutyZHIBAN',
- data:duty,
- rownumbers:true,
- height: '500px',
- enabledEdit: true,clickToEdit: false,
- onDblClickRow:function(rowdata, rowindex){
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow=parseInt(rowindex.slice(1))-1001;
- $(g.getRowObj(rowindex)).children("td").eq(4).unbind("click").bind("click",openaddwindow);
- g.beginEdit(rowindex);
- },
- onBeforeEdit: onBeforeEdit,
- onBeforeSubmitEdit: onBeforeSubmitEdit,
- onAfterSubmitEdit: onAfterSubmitEdit,
- onAfterShowData:function(){setHight();},
- toolbar:
- {
- items: [
- { text: '新增', click: addUser, iconClass: 'icon_add' },
- { line: true }
-
- ]
- }
- });
- }
-
- //查看
- function onView(rowidx){
-
- }
- //取消
- function quxiaoEdit(rowidx){
- var row = g.getRow(rowidx);
- var startTime = row.start_time;
- if(startTime == undefined){//未保存的取消(删除)
- isValida=false;
- flag=false;
- endEdit(rowidx);
- g.deleteRow(row);//删除操作
- }else{//取消编辑(还原编辑之前的数据)
- cancelEdit(rowidx)
- }
- }
- //删除
- function onDelete(rowidx){
- if(rowidx!=editingRow && flag==true){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
-
- top.Dialog.confirm("确定要删除该记录吗?",function(){
- isValida=false;
- flag=false;
- endEdit(rowidx);
- //删除记录
- var row = g.getRow(rowidx)
- //删除操作
- g.deleteRow(row);
- });
- }
-
- //编辑
- function beginEdit(rowid) {
- g.beginEdit(rowid);
- }
-
- //取消编辑
- function cancelEdit(rowid) {
- g.cancelEdit(rowid);
- }
-
- //结束编辑
- function endEdit(rowid){
- editingRow='';
- g.endEdit(rowid);
- }
-
- //新增
- function addUser(){
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow=0;
- isNew=true;
- var row = g.getRow(0);
- var rowData={
- //duty_date:getNowDate() ,
- duty_way:0
- };
- g.addEditRow(rowData, row, true);
- //在这里做新增处理
- // var $duty_man_input = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr").children("td").eq(4);
- // $duty_man_input.on("click",openaddwindow)
-
- }
- function openaddwindow(){
- var iithis = $(this);
- var trid = iithis.parent().attr("id");
- trid = trid.substring(trid.lastIndexOf("r")+2);
- trid = parseInt(trid)-1;
- g.beginEdit(trid);
- var dutymanname = iithis.find("input").val()
- var diag = new top.Dialog();
- diag.Title = "添加值班人员";
- diag.URL = "/nwyj/page/business/em/alert/duty/resp_duty_addman.jsp?dutymanname="+encodeURI(encodeURI(dutymanname));
- diag.OKEvent = function(){
- var $dutydiag = $(diag.innerFrame.contentWindow.document.body);
- var $form = $dutydiag.find("form");
- var valid = $form.validationEngine({returnIsValid: true});
- if(!isTelephoneOrMobile(diag)){
- return;
- }
- var $dutydiag = $(diag.innerFrame.contentWindow.document.body);
- var _tr = $dutydiag.find("tbody").find("tr");
- var duty_msg = "";
- var a=diag.innerFrame.contentWindow.$("#a").text();
- var b=diag.innerFrame.contentWindow.$("#ZBRY").val();
- var c=diag.innerFrame.contentWindow.$("#TEL").val();
- var e=diag.innerFrame.contentWindow.$("#b").text();
- var f=diag.innerFrame.contentWindow.$("#ZBRY1").val();
- var g=diag.innerFrame.contentWindow.$("#TEL1").val();
- duty_msg=a+":"+b+","+c+";"+e+":"+f+","+g+";";
- /* for(var i=0;i<_tr.length;i++){
- var _td = _tr.eq(i).find("td");
- duty_msg += _td.eq(0).text() + ":" + _td.eq(1).find("input").val() + ","+ _td.eq(2).find("input").val() + ";";
- } */
- iithis.find("input").eq(0).val(duty_msg);
- diag.close();
- };
- diag.show();
- }
- //验证电话输入是否正确
- function isTelephoneOrMobile(diag){
- var tel1 = $(diag.innerFrame.contentWindow.document.body).find("#TEL").val();
- var tel2 = $(diag.innerFrame.contentWindow.document.body).find("#TEL1").val();
- var zbry1 =$(diag.innerFrame.contentWindow.document.body).find("#ZBRY").val();
- var zbry2 =$(diag.innerFrame.contentWindow.document.body).find("#ZBRY1").val();
- if(zbry1==""||zbry2==""){
- top.Dialog.alert("值班成员不能为空!");
- return false;
- }
- if(tel1==""||tel2==""){
- top.Dialog.alert("电话号码不能为空!");
- return false;
- }
- //正则表达式验证输入是手机号或者固定电话
- var r=/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
- if(r.test(tel1)&&r.test(tel2)){
- return true;
- }else{
- top.Dialog.alert("电话号码输入不正确!");
- return false;
- }
- }
- //将row JSON对象转化为bo对象
- function rowToBO(row) {
- // var params = '&userinfor.userId='+row.userId+'&userinfor.userName='+row.userName+'&userinfor.userSex='+row.userSex+'&userinfor.userAge='+Math.ceil(row.userAge)+'&userinfor.userDepartment='+row.userDepartment+'&userinfor.userEmployTime='+row.userEmployTime+'&userinfor.userPassword='+row.userPassword+'&userinfor.userEducation='+row.userEducation+'&userinfor.userLoginName='+row.userLoginName;
- var params = '&EcmDutyDetail.fd_objectid='+row.fd_objectid+'&EcmDutyDetail.duty_id='+dutyid+'&EcmDutyDetail.duty_date='+row.duty_date+'&EcmDutyDetail.start_time='+row.start_time+'&EcmDutyDetail.end_time='+row.end_time+'&EcmDutyDetail.leader='+row.leader+'&EcmDutyDetail.leader_tel='+row.leader_tel+'&EcmDutyDetail.name='+row.name+'&EcmDutyDetail.telephone='+row.telephone+'&EcmDutyDetail.duty_way='+row.duty_way;
- return params;
- }
-
- //删除后的提示
- function handleResult(result){
- if(result == 1){
- top.Dialog.alert("删除成功!",null,null,null,1);
- g.loadData();
- }else{
- top.Dialog.alert("删除失败!");
- }
- }
-
- //全部确认修改
- function endAllEdit(){
- g.endEdit();
- }
-
- //全部取消修改
- function cancelAllEdit(){
- g.cancelEdit();
- }
- //编辑前事件
- function onBeforeEdit(e){ }
-
- //编辑提交前事件
- function onBeforeSubmitEdit(e){
- if(isValida){
- if(e.newdata.duty_date==""){
- top.Dialog.alert("日期列有输入值为空!");
- return false;
- }
- if(e.newdata.start_time==""){
- top.Dialog.alert("开始时间列有输入值为空!");
- return false;
- }
- if(e.newdata.end_time==""){
- top.Dialog.alert("结束时间列有输入值为空!");
- return false;
- }
-
- if(e.newdata.start_time>e.newdata.end_time){
- top.Dialog.alert("开始时间晚于结束时间!");
- return false;
- }
-
- if(e.newdata.leader=="" || validateInput(e.newdata.leader, "^[\" \"]+$")){
- top.Dialog.alert("值班领导列有输入值为空或全是空格!");
- return false;
- }
- var ischinese = validateInput(e.newdata.leader,"^[\u4e00-\u9fa5]{0,}$");//验证值班领导列只能输入汉字(是汉子为true否则为false)
- if(!ischinese){
- top.Dialog.alert("值班领导列只能输入汉字!");
- return false;
- }
-
- if(e.newdata.leader_tel==""){
- top.Dialog.alert("领导电话列有输入值为空!");
- return false;
- }
- if(e.newdata.name=="" || validateInput(e.newdata.name, "^[\" \"]+$")){
- top.Dialog.alert("值班成员列有输入值为空或全是空格!");
- return false;
- }
- if(e.newdata.duty_way==""){
- top.Dialog.alert("值班方式列有输入值为空!");
- return false;
- }
- }
- isValida=true;
- }
-
- //编辑后事件
- function onAfterSubmitEdit(e)
- {
- isNew=false;
- }
- var token = 0;
- function saveDuty(validaFormId,isPublish){
- $("#release").val("0");
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- var valid=$(validaFormId).validationEngine({returnIsValid: true});
- if(valid){
- // if(token>0){
- // top.Dialog.alert("已经保存过!");
- // return;
- // }
- if(g.getRow(0) == undefined){
- top.Dialog.alert("请安排值班人员!");
- return;
- }
- token++;
- var rows = g.getData();
- var rowsjson=JSON.stringify(rows);
- //保存并发布
- if(isPublish){
- $("#release").val("1");
- }
- var forms = $('#RespDutyForm').serialize();
- forms =forms +"#;#"+encodeURI(encodeURI(rowsjson));
- if(isPublish){
- top.Dialog.confirm("确定保存并发布吗?|发布", function() {
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/saveDuty',
- type : 'post',
- timeout : 15000,
- data : forms,
- dataType : 'json',
- success : function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {
- getNameTel(result.Msg.objectID);
- } ,function(){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/duty/resp_duty_list.jsp");
- });
- } else {
- window.location.href="resp_duty_list.jsp";
- top.Dialog.alert("保存失败!");
- }
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
- }/* ,function(){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/duty/resp_duty_list.jsp");
- } */)
- }else{
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/saveDuty',
- type : 'post',
- timeout : 15000,
- data : forms,
- dataType : 'json',
- success : function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("保存成功!");
- } else {
- top.Dialog.alert("保存失败!");
- }
- history.go(-1);
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
- }
- }
- }
- function getNameTel(data){
- $.ajax({
- url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getNameTel/',
- type : 'post',
- data : data,
- async:false,
- dataType : 'json',
- success : function(data){
- var receiver = ""//接收人员 + 领导
- var telephine = "";
- var arr = data.rows;
- var names = "";
- var tels = "";
- for(var i=0;i<arr.length;i++){
- //值班成员
- var name1 = arr[i].LEADER_NAME;
- var tel1 = arr[i].LEADER_TEL;
- var name2 = arr[i].ADMINISTRATION_DUTY;
- var tel2 = arr[i].ADMINISTRATION_DUTY_TEL;
- var name3 = arr[i].EVERYDAY_DUTY;
- var tel3 = arr[i].EVERYDAY_DUTY_TEL;
- var name4 = arr[i].SPOT_DUTY;
- var tel4 = arr[i].SPOT_DUTY_TEL;
- names = name1+","+name2+","+name3+","+name4;
- tels = tel1+","+tel2+","+tel3+","+tel4;
- receiver+=names+";";
- //tels = arr[i].NAME.split(":")[1].split(",")[1].split(";")[0];
- telephine +=tels+";";
- //值班领导
- receiver+=arr[i].LEADER_NAME;
- //领导电话
- telephine+=arr[i].LEADER_TEL+";";
- };
- addMsg(receiver,telephine,"新发布了一个响应值班安排表,请及时查看!","1");
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- function resetDuty(){
- window.location.href="resp_duty_edit.jsp";
- }
- $(function(){
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
-
- var bodyheight = $(window.document.body).height();
- $(parent.document.body).find("#frmright").height(bodyheight);
- })
- </script>
- <style type="text/css">
- .title_font{
- font-weight: bold;
- font-size: 24px;
- line-height: 45px;
- color:#3e62a0;
- }
- .back{
- margin:10px 0px 10px 15px;
- }
- .title{
- height: 50px;
- /* background: #F8F8F8; */
- border-style:solid;
- border-width:1px;
- border-right:1px;
- border-left:1px;
- border-top:1px;
- border-color:#cdcaca;
- }
- .legend{
- font-family:宋体;
- font-weight: bold;
- font-size:14px;
- color:#3e62a0;
- }
- </style>
- </head>
- <body style="width: 1000px; margin:0 auto; margin-top:15px" align="center" >
- <div class="box1" id="formContent" style="border: 1px solid #E4E4E4;background: #F8F8F8;">
- <div class="title" align="center">
- <a href="javascript:;">
- <img id="back" class="back" align="left" alt="返回" src="/nwyj/images/temp/back.png" title="返回" onclick="javascript:window.location.href='resp_duty_list.jsp';" />
- </a>
- <font class="title_font">应急响应值班安排表填报</font>
- </div>
-
- <form id="RespDutyForm" method="post" >
- <input id="INPUT_NAME_ID_335" name="INPUT_NAME_ID_335" type="hidden"/>
- <input name="release" id="release" type="hidden" value="0" >
- <input name="dept_names" id="deptnames" type="hidden"/>
- <input name="oper_name" id="opernames" type="hidden"/>
- <input name="oper_time" id="opertimes" type="hidden"/>
- <input name="duty_type" id="duty_type" type="hidden" value="2">
- <br/>
- <div style="float:right">
- <input type="button" onclick="javascript:saveDuty('#RespDutyForm',true);" value="保存并发布" />
- <input type="button" onclick="javascript:saveDuty('#RespDutyForm');" value="保存" />
- <input type="button" onclick="javascript:resetDuty();" value="重置" />
- </div>
- <br/>
- <fieldset style=" border-color:#999999; border-top-color: rgb(200,200,200); border-right-color: rgb(200,200,200); border-bottom-color: rgb(200,200,200); border-left-color: rgb(200,200,200); width: 960px " align="center" >
- <legend width="960px" class="legend">基本信息:</legend>
- <table width="960px" class="tableStyle" align="center">
- <tr>
- <td align="right">响应编号:</td>
- <td><select editable=false name="name_id" class="validate[required] selectWidth" id="name_id" selAlign="" prompt="请选择" swidth="94%"></select></td>
- <td width="10%" align="right"><span class="star">*</span>名称:</td>
- <td width="20%"><input id="name" style="width:98%;" name="name" type="text" class="validate[required]" readonly="readonly"></td>
- </tr>
- <tr>
- <td width="10%" align="right"><span class="star">*</span>单位:</td>
- <td width="20%">
- <input id="oper_dept" name="oper_dept" type="hidden"/>
- <div id="oper_dept_show"></div>
- </td>
- <td width="10%" align="right">填报人员:</td>
- <td width="20%"><div id="oper_name"></div></td>
- </tr>
- <tr>
- <td width="10%" align="right">填报部门:</td>
- <td width="20%"><div id="dept_names"></div></td>
- <td width="10%" align="right">填报时间:</td>
- <td width="20%"><div id="oper_time"></div></td>
- </tr>
- <tr>
- <td align="right">值班持续时间:</td>
- <td><select id="duty_time" name="duty_time"></select></td>
- <td></td>
- <td></td>
- </tr>
- </table>
- </fieldset>
- <fieldset style=" border-color:#999999; border-top-color: rgb(200,200,200); border-right-color: rgb(200,200,200); border-bottom-color: rgb(200,200,200); border-left-color: rgb(200,200,200); width: 960px " align="center" >
- <legend width="960px" class="legend">值班信息:</legend>
- <div>
- <div class="padding_right5">
- <div id="maingrid"></div>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
-
- </body>
- </html>
|