310300d3b04a2ac4f517748ed6381d529fb80896.svn-base 30 KB

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