26b5fe509e18f8a61c93353d8502dc501dc78fc3.svn-base 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <title>日常值班安排表填报</title>
  7. <!--引入QUI框架js -->
  8. <%@include file="need.jsp"%>
  9. <%--
  10. <script type="text/javascript" src="<%=path%>/scripts/qui/libs/js/form/datePicker/WdatePicker.js"></script>--%>
  11. <script type="text/javascript" src="<%=path%>/scripts/setiframeheight.js" ></script>
  12. <script type="text/javascript" src="<%=path%>/scripts/freamwork/com/sinosoft/system/invoking/invoking.js"></script>
  13. <script type="text/javascript" src="<%=path%>/scripts/business/am/org/maintenance/orgSel.js"></script>
  14. <script type="text/javascript" src="/nwyj/scripts/business/am/duty/DutyImport.js"></script>
  15. <style type="">
  16. ._time{
  17. }
  18. </style>
  19. <script>
  20. var fd_id = "<%=request.getParameter("fd_id")%>";
  21. var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  22. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  23. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  24. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  25. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  26. var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  27. var corpName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  28. var flag=false;
  29. var isNew=false; //是否是新增记录
  30. var editingRow; // 双击的当前编辑行
  31. var isValida=true; //是否需要验证
  32. var g;
  33. var dutyData={"list":[{"value":"0","key":"在岗值班"},{"value":"1","key":"电话值班"},{"value":"2","key":"应急指挥中心值班"}]};
  34. var departNode;
  35. var duty_man;
  36. var duty_man1;
  37. var newrowid=200;
  38. //获得值班领导姓名
  39. function getZhiBanMan() {
  40. var urls = $.pathname() + '/ws/bgd_duty/BgdDutyService/getlei_ZhiBan_Man1';
  41. $.ajax({
  42. url : urls,
  43. type : 'post',
  44. timeout : 15000,
  45. async : false,
  46. data : {
  47. deptId : deptId
  48. },
  49. dataType : 'json',
  50. success : function(data) {
  51. duty_man = data;
  52. },error : function(e) {
  53. top.Dialog.alert("获取数据失败!");
  54. }
  55. });
  56. }
  57. function getZhiBanMan1() {
  58. var urls = '/nwyj/ws/bgd_duty/BgdDutyService/getlei_ZhiBan_Man';
  59. $.ajax({
  60. url : urls,
  61. type : 'post',
  62. timeout : 15000,
  63. async : false,
  64. data : {
  65. deptId : deptId
  66. },
  67. dataType : 'json',
  68. success : function(data) {
  69. duty_man1 = data;
  70. },error : function(e) {
  71. top.Dialog.alert("获取数据失败!");
  72. }
  73. });
  74. }
  75. // function initComplete(){
  76. $(function(){
  77. /* getZhiBanMan();
  78. getZhiBanMan1(); */
  79. $('#qujian').initCanstSelect('BM_QUJIAN');
  80. //$("#oper_dept").val(top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames());
  81. $("#oper_name").html(realname);
  82. $("#opernames").val(realname);
  83. $("#dept_names").html(deptName);//显示
  84. $("#deptnames").val(deptId);//保存
  85. $("#oper_dept").val(CorpArea);
  86. $("#oper_dept_show").html(corpName);
  87. $("#INPUT_NAME_ID_235").val(userId);
  88. var myDate = getNowFormatDate;
  89. $("#oper_time").html(myDate);
  90. $("#opertimes").val(myDate);
  91. getZhiBanMan();
  92. getZhiBanMan1();
  93. initGrid();
  94. $("#import_gpsUser").on("click",function(){
  95. submitInfo();
  96. })
  97. $("#back").hover(function(){
  98. $(this).attr("src","/nwyj/images/temp/back_hover.png");
  99. },function(){
  100. $(this).attr("src","/nwyj/images/temp/back.png");
  101. });
  102. $("#downloadUserModel").bind('click',function(){
  103. window.open("/nwyj/excels/onAMDutyDemo.xls");
  104. })
  105. });
  106. // }
  107. function getNowFormatDate() {
  108. var date = allGetServerTime();
  109. var seperator1 = "-";
  110. var seperator2 = ":";
  111. var year = date.getFullYear();
  112. var month = date.getMonth() + 1;
  113. var strDate = date.getDate();
  114. var hour=date.getHours();
  115. var minu=date.getMinutes();
  116. var sec=date.getSeconds();
  117. if (month >= 1 && month <= 9) {
  118. month = "0" + month;
  119. }
  120. if (strDate >= 0 && strDate <= 9) {
  121. strDate = "0" + strDate;
  122. }
  123. if(hour>=0 && hour<=9){
  124. hour="0"+hour;
  125. }
  126. if(minu>=0 && minu<=9){
  127. minu="0"+minu;
  128. }
  129. if(sec>=0 && sec<=9){
  130. sec="0"+sec;
  131. }
  132. var currentdate = year + seperator1 + month + seperator1 + strDate + " " + hour + seperator2 + minu;
  133. return currentdate;
  134. }
  135. function getNoteTime(){
  136. var date = allGetServerTime();
  137. var seperator1 = "-";
  138. var seperator2 = ":";
  139. var hour=date.getHours();
  140. var minu=date.getMinutes();
  141. var sec=date.getSeconds();
  142. if(hour>=0 && hour<=9){
  143. hour="0"+hour;
  144. }
  145. if(minu>=0 && minu<=9){
  146. minu="0"+minu;
  147. }
  148. if(sec>=0 && sec<=9){
  149. sec="0"+sec;
  150. }
  151. var currentdate = hour + seperator2 + minu + seperator2 + sec;
  152. return currentdate;
  153. }
  154. //选择值班领导带出电话
  155. $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(0)").live("change",function(i){//申请单位联系人的绑定事件
  156. var userId = $(this).data("selectedNode").userid;
  157. if(userId!=''){
  158. $.ajax({
  159. url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
  160. type : 'post',
  161. //async : false,
  162. timeout : 15000,
  163. data: {
  164. userId : userId
  165. },
  166. dataType : 'json',
  167. success : function(result){
  168. $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(3)").val(result);
  169. },error : function(e){
  170. top.Dialog.alert("系统错误!");
  171. }
  172. });
  173. };
  174. });
  175. //值班人员带出电话
  176. $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(1)").live("change",function(i){//申请单位联系人的绑定事件
  177. var userId = $(this).data("selectedNode").userid;
  178. if(userId!=''){
  179. $.ajax({
  180. url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
  181. type : 'post',
  182. //async : false,
  183. timeout : 15000,
  184. data: { userId : userId },
  185. dataType : 'json',
  186. success : function(result){
  187. $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(6)").val(result);
  188. },error : function(e){
  189. top.Dialog.alert("系统错误!");
  190. }
  191. });
  192. };
  193. });
  194. $(".l-grid-body2 .l-grid-row").find(".l-grid-row-cell select:eq(2)").live("change",function(i){//申请单位联系人的绑定事件
  195. var userId = $(this).data("selectedNode").userid;
  196. if(userId!=''){
  197. $.ajax({
  198. url : $.pathname() + '/ws/getPhone/BGDPhoneDUtyUser/getPhoneNoByDUtyUserId',
  199. type : 'post',
  200. //async : false,
  201. timeout : 15000,
  202. data: { userId : userId },
  203. dataType : 'json',
  204. success : function(result){
  205. $(".l-grid-body2 .l-grid-row .l-grid-row-cell input:eq(10)").val(result);
  206. },error : function(e){
  207. top.Dialog.alert("系统错误!");
  208. }
  209. });
  210. };
  211. });
  212. function getNowDate(){
  213. var date = allGetServerTime();
  214. var seperator1 = "-";
  215. var seperator2 = ":";
  216. var year = date.getFullYear();
  217. var month = date.getMonth() + 1;
  218. var strDate = date.getDate();
  219. if (month >= 1 && month <= 9) {
  220. month = "0" + month;
  221. }
  222. if (strDate >= 0 && strDate <= 9) {
  223. strDate = "0" + strDate;
  224. }
  225. var currentdate = year + seperator1 + month + seperator1 + strDate;
  226. return currentdate;
  227. }
  228. function initGrid(){
  229. g = $("#maingrid").quiGrid({
  230. columns: [ /*
  231. {name:'fd_objectid',hide:true},
  232. {name:'duty_id',hide:true},
  233. { display: '日期', name: 'duty_date', align: 'center', width: "10%",editor: { type: 'date',dateFmt:'yyyy-MM-dd' }},
  234. */
  235. //{ display: '开始时间', name: 'start_time', align: 'center', width: "9%",editor: { type: 'date',dateFmt:'yyyy-MM-dd HH:mm' }},
  236. { display: '值班时间', name: 'end_time', align: 'center', width: "15%",editor: { type: 'date',dateFmt:'yyyy-MM-dd' }},
  237. { display: '值班领导', name: 'leader', align: 'center', width: "15%",editor: { type : 'select',data : duty_man1,selWidth : 86,openDirection:"bottom"}},
  238. { display: '领导电话', name: 'leader_tel', align: 'center', width: "15%",editor: { type: 'text',inputMode:'numberOnly'}},
  239. { display: '值班成员', name: 'administration_duty',showTitle:true,align: 'center', width: "14%",editor: { type : 'select',data : duty_man1,selWidth : 86,openDirection:"bottom"}},
  240. { display: '成员电话', name: 'administration_duty_tel',showTitle:true,align: 'center', width: "14%",editor: { type: 'text'}},
  241. //{ display: '生产值班', name: 'everyday_duty',showTitle:true,align: 'center', width: "9%",editor: { type : 'select',data : duty_man1,selWidth : 86}},
  242. //{ display: '生产值班电话', name: 'everyday_duty_tel',showTitle:true,align: 'center', width: "10%",editor: { type: 'text'}},
  243. //{ display: '联系电话', name: 'telephone', align: 'center', width: "12%",editor: { type: 'text' ,maxlength:'11',inputMode:'numberOnly',tip:'只能输入数字'}},
  244. { display: '值班方式', name: 'duty_way', showTitle:true, align: 'center', width: "10%",editor: { type: 'select',data:dutyData,selWidth:95 },
  245. render:function (item){
  246. for (var i = 0; i < dutyData["list"].length; i++){
  247. if (dutyData["list"][i]['value'] == item.duty_way){
  248. return dutyData["list"][i]['key']
  249. }
  250. }
  251. return item.duty_way;
  252. }
  253. },
  254. { display: '操作', isSort: false, width: "14%",
  255. render: function (rowdata, rowindex, value){
  256. var h = "";
  257. if (!rowdata._editing){
  258. flag=false;
  259. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  260. }else{
  261. flag=true;
  262. h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>确认</span></a> ";
  263. // h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
  264. h += "<a onclick='quxiaoEdit(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
  265. }
  266. return h;
  267. }
  268. }
  269. ],
  270. url: $.pathname() + '/ws/duty1/DutyRecordsService1/queryDetailByDutyId',
  271. rownumbers:true,
  272. usePager: false,
  273. percentWidthMode : true,
  274. height: '300px',
  275. width:'100%',
  276. enabledEdit: true,
  277. clickToEdit: false,
  278. onDblClickRow:function(rowdata, rowindex){
  279. if(flag){
  280. top.Dialog.alert("请先完成当前记录的编辑!");
  281. return;
  282. }
  283. editingRow=parseInt(rowindex.slice(1))-1001;
  284. g.beginEdit(rowindex);
  285. },
  286. onBeforeEdit: onBeforeEdit,
  287. onBeforeSubmitEdit: onBeforeSubmitEdit,
  288. onAfterSubmitEdit: onAfterSubmitEdit,
  289. onAfterShowData:function(data){
  290. setHight();
  291. },
  292. toolbar:
  293. {
  294. items: [
  295. { text: '新增', click: addUser, iconClass: 'icon_add' },
  296. { line: true }
  297. ]
  298. }
  299. });
  300. }
  301. // 导入方法
  302. function submitInfo() {
  303. var val = $("#import_report").val();
  304. var end = val.substring(val.indexOf(".") + 1);
  305. if (end == "xls" || end == "xlsx") {
  306. addfn();
  307. } else {
  308. top.Dialog.alert("请导入正确的excel文件");
  309. return;
  310. }
  311. };
  312. // 导入excle
  313. function addfn() {
  314. var $form = $("#RespDutyForm");
  315. fileToSave($form);
  316. };
  317. function fileToSave($form) {
  318. // showProgressBar("正在提交中...");
  319. // 表单异步提交处理
  320. $form.ajaxSubmit({
  321. url : $.pathname() + "/ws/import/DutyImport/importdutytask?report_type=3",
  322. type : 'post',
  323. success : function(responseText, statusText, xhr, $form) {
  324. responseText = eval('(' + responseText + ')');
  325. gridData = responseText;
  326. var data = JSON.stringify(gridData);
  327. g.setOptions({
  328. "data" : JSON.parse(decodeURIComponent(data))
  329. });
  330. g.resetHeight();
  331. g.loadData();
  332. $("#onviewtype").hide();
  333. },error : function(e) {
  334. // $.messager.alert('导入值班信息失败!');
  335. top.Dialog.alert("导入值班信息失败!");
  336. }
  337. });
  338. }
  339. //查看
  340. function onView(rowidx){}
  341. //删除
  342. function onDelete(rowidx){
  343. if(rowidx!=editingRow && flag==true){
  344. top.Dialog.alert("请先完成当前记录的编辑!");
  345. return;
  346. }
  347. top.Dialog.confirm("确定要删除该记录吗?",function(){
  348. isValida=false;
  349. flag=false;
  350. endEdit(rowidx);
  351. //删除记录
  352. var row = g.getRow(rowidx)
  353. //删除操作
  354. g.deleteRow(row);
  355. });
  356. }
  357. //编辑
  358. function beginEdit(rowid) {
  359. g.beginEdit(rowid);
  360. }
  361. //取消编辑
  362. function cancelEdit(rowid) {
  363. g.cancelEdit(rowid);
  364. }
  365. //取消----取消修改
  366. function quxiaoEdit(rowidx){
  367. var row = g.getRow(rowidx);
  368. var dutyTime = row.end_time;//值班时间
  369. var dutyLeader = row.leader;//值班领导
  370. var dutyLeaderTel = row.leader_tel;//值班领导电话
  371. var dutyMember = row.administration_duty;//值班成员
  372. var dutyMemberTel = row.administration_duty_tel;//值班成员
  373. var dutyWay = row.duty_way;//值班方式
  374. if((dutyTime == undefined && dutyLeader == undefined && dutyLeaderTel == undefined && dutyMember == undefined && dutyMemberTel == undefined)){//取消新增未确定(保存)的队伍信息(删除本行)
  375. allot=false;
  376. isValida=false;
  377. flag=false;
  378. endEdit(rowidx);
  379. g.deleteRow(row);//删除操作
  380. }else{//取消修改队伍信息(还原初始值)
  381. cancelEdit(rowidx);
  382. }
  383. };
  384. //结束编辑
  385. function endEdit(rowid){
  386. //editingRow='';
  387. g.endEdit(rowid);
  388. }
  389. //新增
  390. function addUser(){
  391. if(flag){
  392. top.Dialog.alert("请先完成当前记录的编辑!");
  393. return;
  394. }
  395. editingRow=0;
  396. isNew=true;
  397. var row = g.getRow(0);
  398. var rowData={
  399. //duty_date:getNowDate() ,
  400. duty_way:0
  401. };
  402. g.addEditRow(rowData, row, true);
  403. //在这里做新增处理
  404. // var $duty_man_input = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr").children("td").eq(4);
  405. // $duty_man_input.on("click",openaddwindow)
  406. }
  407. function openaddwindow(){
  408. var iithis = $(this);
  409. var trid = iithis.parent().attr("id");
  410. trid = trid.substring(trid.lastIndexOf("r")+2);
  411. trid = parseInt(trid)-1;
  412. editingRow=trid;
  413. g.beginEdit(trid);
  414. var dutymanname = iithis.find("input").val()
  415. var diag = new top.Dialog();
  416. diag.Title = "添加值班人员";
  417. diag.URL = "/nwyj/page/business/em/alert/duty/resp_duty_addman1.jsp?dutymanname="+encodeURI(encodeURI(dutymanname));
  418. diag.OKEvent = function(){
  419. $("#ZBRY").val(dutymanname.ZBRY);
  420. var $dutydiag = $(diag.innerFrame.contentWindow.document.body);
  421. var $form = $dutydiag.find("form");
  422. //var valid = $form.validationEngine({returnIsValid: true});
  423. //if(!(valid&&isTelephoneOrMobile(diag))){
  424. // top.Dialog.alert("请输入正确的人员名称和电话号码!");
  425. // return;
  426. //}
  427. /* if(!valid){
  428. top.Dialog.alert("人员名称必须使用中文!");
  429. return;
  430. } */
  431. if(!isTelephoneOrMobile(diag)){
  432. return;
  433. }
  434. var $dutydiag = $(diag.innerFrame.contentWindow.document.body);
  435. var _tr = $dutydiag.find("tbody").find("tr");
  436. var duty_msg = "";
  437. var a=diag.innerFrame.contentWindow.$("#a").text();
  438. var b=diag.innerFrame.contentWindow.$("#ZBRY").val();
  439. var c=diag.innerFrame.contentWindow.$("#TEL").val();
  440. var e=diag.innerFrame.contentWindow.$("#b").text();
  441. var f=diag.innerFrame.contentWindow.$("#ZBRY1").val();
  442. var g=diag.innerFrame.contentWindow.$("#TEL1").val();
  443. duty_msg=a+":"+b+","+c+";"+e+":"+f+","+g+";";
  444. /* for(var i=0;i<_tr.length;i++){
  445. var _td = _tr.eq(i).find("td");
  446. duty_msg += _td.eq(0).text() + ":" + _td.eq(1).find("select").val() + ","+ _td.eq(2).find("input").val() + ";";
  447. } */
  448. iithis.find("input").eq(0).val(duty_msg);
  449. diag.close();
  450. };
  451. diag.show();
  452. }
  453. //验证电话输入是否正确
  454. function isTelephoneOrMobile(diag){
  455. var tel1 = $(diag.innerFrame.contentWindow.document.body).find("#TEL").val();
  456. var tel2 = $(diag.innerFrame.contentWindow.document.body).find("#TEL1").val();
  457. if(tel1==""||tel2==""){
  458. top.Dialog.alert("电话号码不能为空!");
  459. return false;
  460. }
  461. //正则表达式验证输入是手机号或者固定电话
  462. var r=/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
  463. if(r.test(tel1)&&r.test(tel2)){
  464. return true;
  465. }else{
  466. top.Dialog.alert("电话号码输入不正确!");
  467. return false;
  468. }
  469. }
  470. //将row JSON对象转化为bo对象
  471. function rowToBO(row) {
  472. 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;
  473. return params;
  474. }
  475. //删除后的提示
  476. function handleResult(result){
  477. if(result == 1){
  478. top.Dialog.alert("删除成功!",null,null,null,1);
  479. g.loadData();
  480. }else{
  481. top.Dialog.alert("删除失败!");
  482. }
  483. }
  484. //全部确认修改
  485. function endAllEdit(){
  486. g.endEdit();
  487. }
  488. //全部取消修改
  489. function cancelAllEdit(){
  490. g.cancelEdit();
  491. }
  492. //编辑前事件
  493. function onBeforeEdit(e){}
  494. //编辑提交前事件
  495. function onBeforeSubmitEdit(e){
  496. if(isValida){
  497. if(e.newdata.duty_date==""){
  498. top.Dialog.alert("日期列有输入值为空!");
  499. return false;
  500. }
  501. if(e.newdata.start_time==""){
  502. top.Dialog.alert("开始时间列有输入值为空!");
  503. return false;
  504. }
  505. if(e.newdata.end_time==""){
  506. top.Dialog.alert("结束时间列有输入值为空!");
  507. return false;
  508. }
  509. if(e.newdata.start_time>e.newdata.end_time){
  510. top.Dialog.alert("开始时间晚于结束时间!");
  511. return false;
  512. }
  513. if(e.newdata.leader=="" || validateInput(e.newdata.leader, "^[\" \"]+$")){
  514. top.Dialog.alert("值班领导列有输入值为空或全是空格!");
  515. return false;
  516. }
  517. // var ischinese = validateInput(e.newdata.leader,"^[\u4e00-\u9fa5]{0,}$");//验证值班领导列只能输入汉字(是汉子为true否则为false)
  518. // if(e.newdata.leader_tel==""){
  519. // top.Dialog.alert("领导电话列有输入值为空!");
  520. // return false;
  521. // }
  522. if(e.newdata.name=="" || validateInput(e.newdata.name, "^[\" \"]+$")){
  523. top.Dialog.alert("值班成员列有输入值为空或全是空格!");
  524. return false;
  525. }
  526. if(e.newdata.duty_way==""){
  527. top.Dialog.alert("值班方式列有输入值为空!");
  528. return false;
  529. }
  530. var r=/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
  531. if(r.test(e.newdata.leader_tel)){
  532. return true;
  533. }else{
  534. top.Dialog.alert("电话号码输入不正确!");
  535. return false;
  536. }
  537. }
  538. }
  539. isValida=true;
  540. //编辑后事件
  541. function onAfterSubmitEdit(e){
  542. isNew=false;
  543. }
  544. var token = 0;
  545. function saveDuty(validaFormId,isPublish ){
  546. var datas = g.getData();//lj 判断表格里的数据是否为空
  547. var str = "";
  548. for(var i=0;i<g.options.columns.length;i++){
  549. var json = g.options.columns[i];
  550. str += json["display"]+",";
  551. }
  552. var names = str.split(",");//获取表头的名字集合
  553. for(var i=0;i<datas.length;i++){
  554. if(datas[i].end_time==""){
  555. top.Dialog.alert("第"+(i+1)+"行的"+names[0]+"不能为空!");
  556. return;
  557. }
  558. if(datas[i].leader==""){
  559. top.Dialog.alert("第"+(i+1)+"行的"+names[1]+"不能为空!");
  560. return;
  561. }
  562. if(datas[i].leader_tel==""){
  563. top.Dialog.alert("第"+(i+1)+"行的"+names[2]+"不能为空!");
  564. return;
  565. }
  566. if(datas[i].administration_duty==""){
  567. top.Dialog.alert("第"+(i+1)+"行的"+names[3]+"不能为空!");
  568. return;
  569. }
  570. if(datas[i].administration_duty_tel==""){
  571. top.Dialog.alert("第"+(i+1)+"行的"+names[4]+"不能为空!");
  572. return;
  573. }
  574. if(datas[i].duty_way==""){
  575. top.Dialog.alert("第"+(i+1)+"行的"+names[5]+"不能为空!");
  576. return;
  577. }
  578. }
  579. var dutyMsgNum = $("#maingrid").quiGrid().rows.length;//值班信息记录的条数
  580. if(dutyMsgNum == 0){
  581. top.Dialog.alert("值班信息不能为空!");
  582. return;
  583. }
  584. if(flag){
  585. top.Dialog.alert("请先完成当前记录的编辑!");
  586. return;
  587. }
  588. var valid=$(validaFormId).validationEngine({returnIsValid: true});
  589. // CHECKREDBOX='请检查标红输入框!';
  590. if(!valid){
  591. top.Dialog.alert(CHECKREDBOX);
  592. }
  593. if(valid){
  594. if(token>0){
  595. top.Dialog.alert("已经保存过!");
  596. return;
  597. }
  598. if(g.getRow(0) == undefined){
  599. top.Dialog.alert("请安排值班人员!");
  600. return;
  601. }
  602. token++;
  603. var rows = g.getData();
  604. var rowsjson=JSON.stringify(rows);
  605. //保存并发布
  606. if(isPublish){
  607. $("#release").val("1");
  608. }
  609. var forms = $('#RespDutyForm').serialize();
  610. forms =forms +"#;#"+encodeURI(encodeURI(rowsjson));
  611. if(isPublish){
  612. top.Dialog.confirm("确定要发布吗?|发布", function() {
  613. $.ajax({
  614. url : $.pathname() + '/ws/duty1/DutyRecordsService1/saveDuty',
  615. type : 'post',
  616. timeout : 15000,
  617. data : forms,
  618. dataType : 'json',
  619. success : function(result){
  620. // result = eval('('+result+')');
  621. if (result.Msg.sucsess == true) {
  622. top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {
  623. getNameTel(result.Msg.objectID);
  624. },function(){
  625. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/duty/duty.jsp");
  626. });
  627. } else {
  628. top.Dialog.alert("保存失败!");
  629. }
  630. },
  631. error : function(e){
  632. top.Dialog.alert("保存失败");
  633. }
  634. });
  635. })
  636. }else{
  637. $.ajax({
  638. url : $.pathname() + '/ws/duty1/DutyRecordsService1/saveDuty',
  639. type : 'post',
  640. timeout : 15000,
  641. data : forms,
  642. dataType : 'json',
  643. success : function(result){
  644. if (result.Msg.sucsess == true) {
  645. top.Dialog.alert("保存成功!");
  646. } else {
  647. top.Dialog.alert("保存失败!");
  648. }
  649. history.go(-1);
  650. },error : function(e){
  651. top.Dialog.alert("保存失败");
  652. }
  653. });
  654. }
  655. }
  656. }
  657. function getNameTel(data){
  658. $.ajax({
  659. url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getNameTel1/',
  660. type : 'post',
  661. data : data,
  662. async:false,
  663. dataType : 'json',
  664. success : function(data){
  665. var receiver = ""//接收人员 + 领导
  666. var telephine = "";
  667. var arr = data.rows;
  668. var names = "";
  669. var tels = "";
  670. for(var i=0;i<arr.length;i++){
  671. //值班成员
  672. var name1 = arr[i].LEADER_NAME;
  673. var tel1 = arr[i].LEADER_TEL;
  674. var name2 = arr[i].ADMINISTRATION_DUTY;
  675. var tel2 = arr[i].ADMINISTRATION_DUTY_TEL;
  676. var name3 = arr[i].EVERYDAY_DUTY;
  677. var tel3 = arr[i].EVERYDAY_DUTY_TEL;
  678. if(telephine.indexOf(tel1, "0")==-1){
  679. telephine +=tel1+";";
  680. receiver+=name1+";";
  681. }
  682. if(telephine.indexOf(tel2, "0")==-1){
  683. telephine +=tel2+";";
  684. receiver+=name2+";";
  685. }
  686. /* names = name1+","+name2+","+name3;
  687. tels = tel1+","+tel2+","+tel3; */
  688. //receiver+=names+";";
  689. //tels = arr[i].NAME.split(":")[1].split(",")[1].split(";")[0];
  690. //telephine +=tels+";";
  691. //值班领导
  692. // receiver+=arr[i].LEADER_NAME;
  693. //领导电话
  694. // telephine+=arr[i].LEADER_TEL+";";
  695. };
  696. var table_name = $("#name").val();
  697. addMsg(receiver,telephine,"日常值班“"+table_name+"”中有您的值班信息,请及时查看,并按时值班!","1");
  698. },error : function(e){
  699. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  700. }
  701. });
  702. }
  703. function resetDuty(){
  704. window.location.href="DutyAdd.jsp";
  705. }
  706. </script>
  707. <style type="text/css">
  708. .title_font{
  709. font-weight: bold;
  710. font-size: 24px;
  711. line-height: 45px;
  712. color:#3e62a0;
  713. }
  714. .back{
  715. margin:10px 0px 10px 15px;
  716. }
  717. .title{
  718. height: 50px;
  719. /* background: #F8F8F8; */
  720. border-style:solid;
  721. border-width:1px;
  722. border-right:1px;
  723. border-left:1px;
  724. border-top:1px;
  725. border-color:#cdcaca;
  726. }
  727. .legend{
  728. font-family:宋体;
  729. font-weight: bold;
  730. font-size:14px;
  731. color:#3e62a0;
  732. }
  733. </style>
  734. </head>
  735. <body style="width: 1000px; margin:0 auto; margin-top:15px" align="center" >
  736. <div class="box1" id="formContent" style="border: 1px solid #E4E4E4;background: #F8F8F8;">
  737. <div class="title" align="center">
  738. <a href="javascript:;"> <img id="back" class="back" align="left" title="返回" alt="返回"
  739. src="/nwyj/images/temp/back.png"
  740. onclick="javascript:window.location.href='duty.jsp';" />
  741. </a> <font class="title_font">日常值班安排表填报</font>
  742. </div>
  743. <form id="RespDutyForm" method="post">
  744. <input type="hidden" name="classid" value="234" required="true" />
  745. <input id="INPUT_NAME_ID_235" name="INPUT_NAME_ID_235" type="hidden"/>
  746. <input name="release" id="release" type="hidden" value="0" >
  747. <input name="dept_names" id="deptnames" type="hidden"/>
  748. <input name="oper_name" id="opernames" type="hidden"/>
  749. <input name="oper_time" id="opertimes" type="hidden"/>
  750. <input name="duty_type" id="duty_type" type="hidden" value="1">
  751. <br/>
  752. <div style="float:right">
  753. <input type="button" onclick="javascript:saveDuty('#RespDutyForm',true)" value="保存并发布"/>
  754. <input type="button" onclick="javascript:saveDuty('#RespDutyForm');" value="保存" />
  755. <input type="button" onclick="javascript:resetDuty();" value="重置" /></td>
  756. </div>
  757. <br/>
  758. <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" >
  759. <legend class="legend">基本信息:</legend>
  760. <table class="tableStyle" align="center">
  761. <tr>
  762. <td width="10%" align="right"><span class="star">*</span>名称:</td>
  763. <td width="20%"><input style="width:290px;" id="name" name="name" type="text" maxlength="15" class="validate[required,length[0,50],custom[illegalLetter]]"></td>
  764. <td width="10%" align="right"><span class="star">*</span>单位:</td>
  765. <td width="20%">
  766. <input id="oper_dept" name="oper_dept" type="hidden"/>
  767. <div id="oper_dept_show"></div>
  768. </td>
  769. </tr>
  770. <tr>
  771. <!-- <td align="right">值班时间区间:</td> -->
  772. <!-- <td><select type="text" selWidth="298" prompt="请选择" id="qujian" name="qujian"></select> -->
  773. <td align="right">填报人员:</td>
  774. <td><div id="oper_name"></div></td>
  775. <td align="right">填报部门:</td>
  776. <td><div id="dept_names"></div></td>
  777. </tr>
  778. <tr>
  779. <td align="right">填报时间:</td>
  780. <td><div id="oper_time"></div></td>
  781. <td></td>
  782. <td></td>
  783. </tr>
  784. </table>
  785. </fieldset>
  786. <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" >
  787. <legend width="960px" class="legend">值班信息:</legend>
  788. <table>
  789. <tr>
  790. <td align="right" width="30%">选择导入文件:</td>
  791. <td width="25%"><input name="import_report" fileWidth="300" id="import_report" type="file" contenteditable="false" /></td>
  792. <td width="10%"><div><a href="javascript:;" ><input type="button" value="导入日常值班信息" id="import_gpsUser"/></a></div></td>
  793. <td><div><input type="button" value="下载日常值班模版" id="downloadUserModel"/></div></td>
  794. </tr>
  795. </table>
  796. <div>
  797. <div class="padding_right5">
  798. <div id="maingrid"></div>
  799. </div>
  800. </div>
  801. </fieldset>
  802. </form>
  803. </div>
  804. </body>
  805. </html>