f63f4dbfdcc84ced2fcef9c0259bf1165230a96e.svn-base 30 KB

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