123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863 |
- <%@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/qui/libs/js/form/datePicker/WdatePicker.js"></script>--%>
- <script type="text/javascript" src="<%=path%>/scripts/setiframeheight.js" ></script>
- <script type="text/javascript" src="<%=path%>/scripts/freamwork/com/sinosoft/system/invoking/invoking.js"></script>
- <script type="text/javascript" src="<%=path%>/scripts/business/am/org/maintenance/orgSel.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/business/am/duty/DutyImport.js"></script>
- <style type="">
- ._time{
-
- }
- </style>
- <script>
- var fd_id = "<%=request.getParameter("fd_id")%>";
-
- var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- 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 g;
- var dutyData={"list":[{"value":"0","key":"在岗值班"},{"value":"1","key":"电话值班"},{"value":"2","key":"应急指挥中心值班"}]};
- var departNode;
- var duty_man;
- var duty_man1;
- 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_man = data;
- },error : function(e) {
- top.Dialog.alert("获取数据失败!");
- }
- });
- }
-
- function getZhiBanMan1() {
- var urls = '/nwyj/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_man1 = data;
- },error : function(e) {
- top.Dialog.alert("获取数据失败!");
- }
- });
- }
-
- // function initComplete(){
- $(function(){
- /* getZhiBanMan();
- getZhiBanMan1(); */
- $('#qujian').initCanstSelect('BM_QUJIAN');
- //$("#oper_dept").val(top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames());
- $("#oper_name").html(realname);
- $("#opernames").val(realname);
- $("#dept_names").html(deptName);//显示
- $("#deptnames").val(deptId);//保存
-
- $("#oper_dept").val(CorpArea);
- $("#oper_dept_show").html(corpName);
-
- $("#INPUT_NAME_ID_235").val(userId);
-
- var myDate = getNowFormatDate;
- $("#oper_time").html(myDate);
- $("#opertimes").val(myDate);
-
-
- getZhiBanMan();
- getZhiBanMan1();
- initGrid();
-
- $("#import_gpsUser").on("click",function(){
- submitInfo();
- })
-
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
-
- $("#downloadUserModel").bind('click',function(){
- window.open("/nwyj/excels/onAMDutyDemo.xls");
- })
-
- });
- // }
-
- 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;
- }
- //选择值班领导带出电话
- $(".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(3)").val(result);
- },error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
- };
- });
- //值班人员带出电话
- $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(1)").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(6)").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(10)").val(result);
- },error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
- };
- });
- 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: "9%",editor: { type: 'date',dateFmt:'yyyy-MM-dd HH:mm' }},
- { display: '值班时间', name: 'end_time', align: 'center', width: "15%",editor: { type: 'date',dateFmt:'yyyy-MM-dd' }},
- { display: '值班领导', name: 'leader', align: 'center', width: "15%",editor: { type : 'select',data : duty_man1,selWidth : 86,openDirection:"bottom"}},
- { display: '领导电话', name: 'leader_tel', align: 'center', width: "15%",editor: { type: 'text',inputMode:'numberOnly'}},
- { display: '值班成员', name: 'administration_duty',showTitle:true,align: 'center', width: "14%",editor: { type : 'select',data : duty_man1,selWidth : 86,openDirection:"bottom"}},
- { display: '成员电话', name: 'administration_duty_tel',showTitle:true,align: 'center', width: "14%",editor: { type: 'text'}},
- //{ display: '生产值班', name: 'everyday_duty',showTitle:true,align: 'center', width: "9%",editor: { type : 'select',data : duty_man1,selWidth : 86}},
- //{ display: '生产值班电话', name: 'everyday_duty_tel',showTitle:true,align: 'center', width: "10%",editor: { type: 'text'}},
- //{ display: '联系电话', name: 'telephone', align: 'center', width: "12%",editor: { type: 'text' ,maxlength:'11',inputMode:'numberOnly',tip:'只能输入数字'}},
- { display: '值班方式', name: 'duty_way', showTitle:true, align: 'center', width: "10%",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: '操作', 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/duty1/DutyRecordsService1/queryDetailByDutyId',
- rownumbers:true,
- usePager: false,
- percentWidthMode : true,
- height: '300px',
- 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:function(data){
- setHight();
- },
- toolbar:
- {
- items: [
- { text: '新增', click: addUser, iconClass: 'icon_add' },
- { line: true }
- ]
- }
- });
- }
-
- // 导入方法
- function submitInfo() {
- var val = $("#import_report").val();
- var end = val.substring(val.indexOf(".") + 1);
- if (end == "xls" || end == "xlsx") {
- addfn();
- } else {
- top.Dialog.alert("请导入正确的excel文件");
- return;
- }
- };
-
- // 导入excle
- function addfn() {
- var $form = $("#RespDutyForm");
- fileToSave($form);
-
- };
-
- function fileToSave($form) {
- // showProgressBar("正在提交中...");
- // 表单异步提交处理
- $form.ajaxSubmit({
- url : $.pathname() + "/ws/import/DutyImport/importdutytask?report_type=3",
- type : 'post',
- success : function(responseText, statusText, xhr, $form) {
- responseText = eval('(' + responseText + ')');
- gridData = responseText;
- var data = JSON.stringify(gridData);
- g.setOptions({
- "data" : JSON.parse(decodeURIComponent(data))
- });
- g.resetHeight();
- g.loadData();
- $("#onviewtype").hide();
- },error : function(e) {
- // $.messager.alert('导入值班信息失败!');
- top.Dialog.alert("导入值班信息失败!");
- }
- });
- }
-
- //查看
- function onView(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 quxiaoEdit(rowidx){
- var row = g.getRow(rowidx);
-
- var dutyTime = row.end_time;//值班时间
- var dutyLeader = row.leader;//值班领导
- var dutyLeaderTel = row.leader_tel;//值班领导电话
- var dutyMember = row.administration_duty;//值班成员
- var dutyMemberTel = row.administration_duty_tel;//值班成员
- var dutyWay = row.duty_way;//值班方式
-
- if((dutyTime == undefined && dutyLeader == undefined && dutyLeaderTel == undefined && dutyMember == undefined && dutyMemberTel == undefined)){//取消新增未确定(保存)的队伍信息(删除本行)
- allot=false;
- isValida=false;
- flag=false;
- endEdit(rowidx);
- g.deleteRow(row);//删除操作
- }else{//取消修改队伍信息(还原初始值)
- cancelEdit(rowidx);
- }
- };
-
- //结束编辑
- 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;
- editingRow=trid;
- 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_addman1.jsp?dutymanname="+encodeURI(encodeURI(dutymanname));
- diag.OKEvent = function(){
- $("#ZBRY").val(dutymanname.ZBRY);
- var $dutydiag = $(diag.innerFrame.contentWindow.document.body);
- var $form = $dutydiag.find("form");
- //var valid = $form.validationEngine({returnIsValid: true});
- //if(!(valid&&isTelephoneOrMobile(diag))){
- // top.Dialog.alert("请输入正确的人员名称和电话号码!");
- // return;
- //}
- /* if(!valid){
- top.Dialog.alert("人员名称必须使用中文!");
- return;
- } */
- 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("select").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();
- 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 = '&EcmDutyDetail1.fd_objectid='+row.fd_objectid+'&EcmDutyDetail1.duty_id='+dutyid+'&EcmDutyDetail1.duty_date='+row.duty_date+'&EcmDutyDetail1.start_time='+row.start_time+'&EcmDutyDetail1.end_time='+row.end_time+'&EcmDutyDetail1.leader='+row.leader+'&EcmDutyDetail1.leader_tel='+row.leader_tel+'&EcmDutyDetail1.name='+row.name+'&EcmDutyDetail1.telephone='+row.telephone+'&EcmDutyDetail1.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(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;
- }
- var r=/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
- if(r.test(e.newdata.leader_tel)){
- return true;
- }else{
- top.Dialog.alert("电话号码输入不正确!");
- return false;
- }
- }
- }
- isValida=true;
-
- //编辑后事件
- function onAfterSubmitEdit(e){
- isNew=false;
- }
-
- var token = 0;
- function saveDuty(validaFormId,isPublish ){
- var datas = g.getData();//lj 判断表格里的数据是否为空
-
- var str = "";
- for(var i=0;i<g.options.columns.length;i++){
- var json = g.options.columns[i];
- str += json["display"]+",";
- }
- var names = str.split(",");//获取表头的名字集合
-
- for(var i=0;i<datas.length;i++){
-
- if(datas[i].end_time==""){
- top.Dialog.alert("第"+(i+1)+"行的"+names[0]+"不能为空!");
- return;
- }
- if(datas[i].leader==""){
- top.Dialog.alert("第"+(i+1)+"行的"+names[1]+"不能为空!");
- return;
- }
- if(datas[i].leader_tel==""){
- top.Dialog.alert("第"+(i+1)+"行的"+names[2]+"不能为空!");
- return;
- }
- if(datas[i].administration_duty==""){
- top.Dialog.alert("第"+(i+1)+"行的"+names[3]+"不能为空!");
- return;
- }
- if(datas[i].administration_duty_tel==""){
- top.Dialog.alert("第"+(i+1)+"行的"+names[4]+"不能为空!");
- return;
- }
- if(datas[i].duty_way==""){
- top.Dialog.alert("第"+(i+1)+"行的"+names[5]+"不能为空!");
- return;
- }
-
- }
-
- var dutyMsgNum = $("#maingrid").quiGrid().rows.length;//值班信息记录的条数
- if(dutyMsgNum == 0){
- top.Dialog.alert("值班信息不能为空!");
- return;
- }
-
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- var valid=$(validaFormId).validationEngine({returnIsValid: true});
-
- // CHECKREDBOX='请检查标红输入框!';
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- }
-
- 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/duty1/DutyRecordsService1/saveDuty',
- type : 'post',
- timeout : 15000,
- data : forms,
- dataType : 'json',
- success : function(result){
- // result = eval('('+result+')');
- if (result.Msg.sucsess == true) {
- top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {
- getNameTel(result.Msg.objectID);
- },function(){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/duty/duty.jsp");
- });
- } else {
- top.Dialog.alert("保存失败!");
- }
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
- })
- }else{
- $.ajax({
- url : $.pathname() + '/ws/duty1/DutyRecordsService1/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/getNameTel1/',
- 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;
- if(telephine.indexOf(tel1, "0")==-1){
- telephine +=tel1+";";
- receiver+=name1+";";
- }
- if(telephine.indexOf(tel2, "0")==-1){
- telephine +=tel2+";";
- receiver+=name2+";";
- }
- /* names = name1+","+name2+","+name3;
- tels = tel1+","+tel2+","+tel3; */
- //receiver+=names+";";
- //tels = arr[i].NAME.split(":")[1].split(",")[1].split(";")[0];
- //telephine +=tels+";";
- //值班领导
- // receiver+=arr[i].LEADER_NAME;
- //领导电话
- // telephine+=arr[i].LEADER_TEL+";";
- };
- var table_name = $("#name").val();
- addMsg(receiver,telephine,"日常值班“"+table_name+"”中有您的值班信息,请及时查看,并按时值班!","1");
- },error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- function resetDuty(){
- window.location.href="DutyAdd.jsp";
- }
- </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" title="返回" alt="返回"
- src="/nwyj/images/temp/back.png"
- onclick="javascript:window.location.href='duty.jsp';" />
- </a> <font class="title_font">日常值班安排表填报</font>
- </div>
- <form id="RespDutyForm" method="post">
- <input type="hidden" name="classid" value="234" required="true" />
- <input id="INPUT_NAME_ID_235" name="INPUT_NAME_ID_235" 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="1">
- <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="重置" /></td>
- </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 class="legend">基本信息:</legend>
- <table class="tableStyle" align="center">
- <tr>
- <td width="10%" align="right"><span class="star">*</span>名称:</td>
- <td width="20%"><input style="width:290px;" id="name" name="name" type="text" maxlength="15" class="validate[required,length[0,50],custom[illegalLetter]]"></td>
- <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>
- </tr>
- <tr>
- <!-- <td align="right">值班时间区间:</td> -->
- <!-- <td><select type="text" selWidth="298" prompt="请选择" id="qujian" name="qujian"></select> -->
- <td align="right">填报人员:</td>
- <td><div id="oper_name"></div></td>
- <td align="right">填报部门:</td>
- <td><div id="dept_names"></div></td>
- </tr>
- <tr>
- <td align="right">填报时间:</td>
- <td><div id="oper_time"></div></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>
- <table>
- <tr>
- <td align="right" width="30%">选择导入文件:</td>
- <td width="25%"><input name="import_report" fileWidth="300" id="import_report" type="file" contenteditable="false" /></td>
- <td width="10%"><div><a href="javascript:;" ><input type="button" value="导入日常值班信息" id="import_gpsUser"/></a></div></td>
- <td><div><input type="button" value="下载日常值班模版" id="downloadUserModel"/></div></td>
- </tr>
- </table>
- <div>
- <div class="padding_right5">
- <div id="maingrid"></div>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
- </body>
- </html>
|