d48c6d148779afa9cbe785dd5eb48e43f867c4d2.svn-base 28 KB

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