123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869 |
- <%@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>
- var flag=false;
- var isNew=false; //是否是新增记录
- var isNewSave=true; //新增记录是否保存
- var editingRow; // 双击的当前编辑行
- var isValida=true; //是否需要验证
-
- //取得用户真实名字
- var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //部门
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- //父部门id
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var corpName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- var g;
- var dutyid;
- var dutyData={"list":[{"value":"0","key":"在岗值班"},{"value":"1","key":"电话值班"},{"value":"2","key":"应急指挥中心值班"}]};
-
- var departNode;
- var duty_man1;
- var newrowid=200;
- var duty_man;
-
- //获得值班人员姓名
- 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;
- initGrid(dutyid);
- },
- 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;
- initGrid(dutyid);
- },
- error : function(e) {
- alert("获取数据失败!!!!");
- }
- });
-
- }
- function initComplete(){
- // var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
- // $.post(deptUrl,{id:parentId,name:''},function(data){
- // $("#oper_dept").data("data",data);
- // $("#oper_dept").render();
- // }, "json");
- $("#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 release_unit ='"+CorpArea+"'"); //需求名称
- $("#name_id").bind("change",function(){
- var tm = $(this).attr("relText");
- if(tm == "请选择"){
- return;
- }
- var taskName = tm+"_"+corpName+"_"+getNowFormatDate1();
- $("#name").val(taskName);
- });
- if((window.location.href).indexOf('?')>-1){
- dutyid = (window.location.href).split('?')[1];//获取记录id
- var url = $.pathname() + "/ws/duty/DutyRecordsService/getDutyById/";
- var params = {
- dutyid : dutyid
- };
-
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data){
- $("#name_id").setValue(data.name_id);
- $("#oper_name").html(data.oper_name);
- $("#oper_time").html(data.oper_time);
- $('#RespDutyForm').ajaxWrite({data:data});
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/getunitname',
- data : {dept_id:data.dept_names},
- type : 'post',
- dataType : 'text',
- success : function(data){
- $("#dept_names").html(data);
- },error : function(e){
- top.Dialog.alert("访问服务器失败!")
- }
- })
- $.ajax({
- url : $.pathname() + '/ws/duty1/DutyRecordsService1/getunitname',
- data : {dept_id:data.oper_dept},
- type : 'post',
- dataType : 'text',
- success : function(data){
- $("#oper_dept").html(data);
- },error : function(e){
- top.Dialog.alert("error");
- }
- })
- },
- error : function(e){
- top.Dialog.alert("访问服务失败!");
- }
- });
-
- }
-
- if(typeof dutyid === 'undefined' || dutyid === null){ //预存值班表 主键, 如果不存在,生成主键, 值班表、值班明细表新增时使用
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/queryPid',
- type : 'post',
- timeout : 15000,
- data : {'classid':335},
- dataType : 'json',
- success : function(data){
- dutyid = data.pid;
- initGrid(dutyid);
- },
- error : function(e){
- top.Dialog.alert("访问服务失败!");
- }
- });
- }
- getZhiBanMan(dutyid);
- getZhiBanMan1(dutyid);
- }
- //选择值班领导带出电话
- $(".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 initGrid(dutyid){
- 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:ss' }},
- { 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: 110,editor: { type: 'select',data:dutyData,selWidth:95 },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: 110, 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;
- }
- }
- ],
- // $.pathname() + '/ws/duty/DutyRecordsService/delDetailByID',
- url: $.pathname() + '/ws/duty/DutyRecordsService/queryDetailByDutyId',
- params :{"dutyid":dutyid,"is_del":0},
- sortName: 'duty_date',
- rownumbers:true,
- pageSize:10,
- dataAction:"server",
- usePager: false,
- percentWidthMode : true,
- onAfterShowData:function(){setHeight();},
- height: "500px", width:"100%",enabledEdit: true,clickToEdit: false,onDblClickRow:function(rowdata, rowindex){
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow=parseInt(rowindex.slice(1))-1001;
- g.beginEdit(rowindex);
- },onBeforeEdit: onBeforeEdit, onBeforeSubmitEdit: onBeforeSubmitEdit,onAfterSubmitEdit: onAfterSubmitEdit,onAfterShowData:binddiag,
- toolbar:
- {
- items: [
- { text: '新增', click: addUser, iconClass: 'icon_add' },
- { line: true }/*,
- { text: '全部确认修改', click: endAllEdit, iconClass: 'icon_ok' },
- { line: true },
- { text: '全部取消修改', click: cancelAllEdit, iconClass: 'icon_no' } */
-
- ]
- }
- });
- }
-
- //查看
- function onView(rowidx){
-
- }
- function binddiag(){
- var $_tr = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr");
- for(var i=0;i<$_tr.length;i++){
- var $_td = $_tr.eq(i).children("td").eq(4);
- $_td.on("click",openaddwindow);
- }
- }
- //取消
- function quxiaoEdit(rowidx){
- alert(456)
- var rowMsg = g.getRow(rowidx);
- }
- //删除
- function onDelete(rowidx){
- if(rowidx!=editingRow && flag==true){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- if(rowidx != editingRow){
- top.Dialog.confirm("此删除操作将无法撤回,是否继续?",function(){
- //删除记录
- var row = g.getRow(rowidx)
- //删除操作
- $.post($.pathname() + '/ws/duty/DutyRecordsService/delDetailByID',
- {"fd_objectid":row.fd_objectid},
- function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功!");
- g.loadData();
- } else {
- top.Dialog.alert("删除失败!");
- }
- },"json");
-
-
- });
- }
-
- else if(isNew){
- top.Dialog.confirm("确定要删除该记录吗?",function(){
-
- isNewSave=false;
- isValida=false;
- endEdit(rowidx);
- //删除记录
- var row = g.getRow(rowidx)
- //删除操作
- g.deleteRow(row);
-
-
- });
-
- }else{
- isNewSave=false;
- isValida=false;
- endEdit(rowidx);
- g.loadData();
-
-
- }
-
-
- }
-
- //编辑
- function beginEdit(rowid) {
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- g.beginEdit(rowid);
- }
-
- //取消编辑
- function cancelEdit(rowid) {
- g.cancelEdit(rowid);
- }
-
- //结束编辑
- function endEdit(rowid)
- {
- // editingRow=undefined;
- isNew=false;
- g.endEdit(rowid);
- }
-
- //新增
- function addUser(){
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- isNew=true;
- editingRow=0;
- var row = g.getRow(0);
- var rowData={
- duty_date:getNowDate(),
- duty_way:0
-
- };
-
- g.addEditRow(rowData, row, true);
- //在这里做新增处理
- var $_tr = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr");
- for(var i=0;i<$_tr.length;i++){
- var $_td = $_tr.eq(i).children("td").eq(4);
- $_tdf.on("click",openaddwindow);
- }
- /* $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;
- editingRow=trid;
- g.beginEdit(trid);
- var dutymanname = iithis.find("input").val()==undefined?iithis.text():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 _tr = $dutydiag.find("tbody").find("tr");
- var duty_msg = "";
- if(!isTelephoneOrMobile(diag)){
- return;
- }
- /* 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() + ";";
- } */
- 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+";";
- 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;
- }
- }
- 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 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;
-
- }
-
- //将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)
- {
- var str="编辑前事件,可阻止某些行或列进行编辑。列名:"+e.column.name+";行号:"+e.rowindex+";编辑前的值:"+e.value+"\n";
- //if(e.record.id=="121"){
- //top.Dialog.alert("此行不可编辑",null,null,null,2);
- // return false;
- //}
- }
-
-
- //编辑提交前事件
- 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;
- }
-
- 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.telephone==""){
- top.Dialog.alert("联系电话列有输入值为空!");
- return false;
- }
- if(e.newdata.duty_way==""){
- top.Dialog.alert("值班方式列有输入值为空!");
- return false;
- }
- }
- isValida=true;
- }
-
- //编辑后事件
- function onAfterSubmitEdit(e){
- if(isNewSave){
- var fd_objectid = e.record.fd_objectid;
- var rowData = e.newdata;
- var row = JSON.stringify(rowData);
- row += "#"+dutyid+"#"+fd_objectid;
- //ajax方式提交数据到数据库
- // $.post($.pathname() + '/ws/duty/DutyRecordsService/saveDetail',row,function(data){
- // g.loadData();
- // },"json");
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/saveDetail',
- type : 'post',
- timeout : 15000,
- data : row,
- dataType : 'text',
- success : function(result){
- top.Dialog.alert("保存成功!");
- isNew=false;
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
-
- }
- isNewSave=true;
- //var row =certInfoGrid.getRow(e.rowindex);
- //$.post("/material/certInfo/saveCertInfo.do?",rowToBO(row),function(){},"json");
- }
- 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++;
- //保存并发布
- if(isPublish){
- $("#release").val("1");
- }
- var forms = $('#RespDutyForm').serialize();
- forms =forms+"&"+"fd_objectid="+dutyid;
- if(isPublish){
- top.Dialog.confirm("确定保存并发布吗?|发布", function() {
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/updateDuty',
- type : 'post',
- timeout : 15000,
- data : forms,
- dataType : 'json',
- success : function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {
- getNameTel(dutyid);
- },function(){
- window.location.href="/nwyj/page/business/em/response/duty/resp_duty_list.jsp";
- });
- } else {
- top.Dialog.alert("保存失败!");
- }
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
- })
- }else{
- $.ajax({
- url : $.pathname() + '/ws/duty/DutyRecordsService/updateDuty',
- 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_editor.jsp?"+dutyid;
- }
- $(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 style="font-weight: bold;font-size: 20px;line-height: 45px;" >应急响应值班安排表修改</font>
- </div>
- <form id="RespDutyForm" method="post" >
- <br/>
- <div align="center"><font style="font-weight: bold;font-size: 30px;line-height: 45px;" id="" ></font></div>
- <br />
- <tr>
- <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="重置" />
- <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="oper_dept" id="operdept" type="hidden"/>
- </div>
- </tr>
- <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" class="class_color"><span class="star" >*</span>名称:</td>
- <td width="20%"><input id="name" name="name" style="width:300px;" type="text" class=" validate[required] selectWidth"></td>
- </tr>
- <tr>
- <td width="10%" align="right" class="class_color">单位:</td>
- <td><div id="oper_dept"></div></td>
- <td width="10%" align="right" class="class_color">填报人员:</td>
- <td width="20%"><div id="oper_name"></div></td>
-
- </tr>
- <tr>
- <td width="10%" align="right" class="class_color">填报部门:</td>
- <td width="20%"><div id="dept_names"></div></td>
- <td width="10%" align="right" class="class_color">填报时间:</td>
- <td><div id="oper_time"></div></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 class="padding_right5">
- <div id="maingrid"></div>
- </div>
- </fieldset>
- </form>
- </div>
-
- </body>
- </html>
|