9c152834e20efa6ab6c7e33652dfb803e31797f7.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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>
  11. var flag = false;
  12. var isNew = false; //是否是新增记录
  13. var editingRow; // 双击的当前编辑行
  14. var isValida = true; //是否需要验证
  15. var task_id;
  16. var g;
  17. var dutyData = {"list" : [ {"value" : "0","key" : "在岗值班"},
  18. {"value" : "1","key" : "电话值班"},
  19. {"value" : "2","key" : "应急指挥中心值班"}]};
  20. function initComplete() {
  21. // 部门id
  22. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  23. //取得用户真实姓名
  24. var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  25. //部门名称
  26. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  27. //父部门id
  28. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  29. //初始化页面
  30. task_id = "<%=request.getParameter("task_id")%>";
  31. if((window.location.href).indexOf('?')>-1 ){//修改表单
  32. $("#biaoti").text("保供电值班安排表");
  33. //加载任务id
  34. $("#TASK_ID_632").initYewuSelect("610", "FD_OBJECTID", "PROGRAM_NAME","FD_OBJECTID = '"+task_id+"'");
  35. initGrid();
  36. }
  37. }
  38. //获取系统时间
  39. function getNowDate() {
  40. var s = "";
  41. var d = allGetServerTime();
  42. var vYear = d.getFullYear();
  43. var vMon = d.getMonth() + 1;
  44. var vDay = d.getDate();
  45. var h = d.getHours();
  46. var m = d.getMinutes();
  47. var se = d.getSeconds();
  48. s = vYear + "-" + (vMon < 10 ? "0" + vMon : vMon) + "-" + (vDay < 10 ? "0" + vDay : vDay) + " " + (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + "00";
  49. return s;
  50. }
  51. function initGrid() {
  52. var hurl;
  53. var loadParms;
  54. hurl= $.pathname() + '/ws/bgd_duty/BgdDutyService/getDutyByTaskId';
  55. loadParms={taskid:task_id};
  56. g = $("#maingrid").quiGrid({
  57. columns : [
  58. /* {name:'fd_objectid',hide:true},
  59. {name:'duty_id',hide:true},
  60. { display: '日期', name: 'duty_date', align: 'center', width: "10%",editor: { type: 'date',dateFmt:'yyyy-MM-dd' }},
  61. */
  62. {name:'FD_OBJECTID',hide:true},
  63. {display : '任务名称', name : 'TASK_ID', hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
  64. {display : '更新时间', name : 'UPDATEDATE', hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
  65. {display : '填报时间', name : 'TIANBAO_TIME',hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
  66. {display : '部门', name : 'DEPT', hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
  67. {display : '填报人', name : 'TIANBAO_PERSON',hide : true,align : 'center',width : "10%", editor : {type : 'text',maxlength : '15'}},
  68. {display : '开始时间', name : 'START_TIME', align : 'center',width : "15%"/* , editor : {type : 'date',dateFmt: 'yyyy-MM-dd HH:mm:00'} */},
  69. {display : '结束时间', name : 'END_TIME', align : 'center',width : "15%"/* , editor : {type : 'date',dateFmt : 'yyyy-MM-dd HH:mm:00'} */},
  70. {display : '值班领导', name : 'LEADER', align : 'center',width : "10%"/* , editor : {type : 'text',maxlength : '15'} */},
  71. {display : '领导电话', name : 'LEADER_TEL', align : 'center',width : "12%"/* , editor : {type : 'text',maxlength : '11',inputMode : 'numberOnly',tip : '只能输入数字'} */},
  72. {display : '值班成员', name : 'WATCH_MAN',/* showTitle:true, */align : 'center',width : "10%"/* ,editor : {type : 'text'} */},
  73. {display : '联系电话', name : 'WATCH_TEL', align : 'center',width : "12%"/* ,editor : {type : 'text',maxlength : '11',inputMode : 'numberOnly',tip : '只能输入数字'} */},
  74. {display : '值班方式', name : 'DUTY_MODE', align : 'center',width : "13%"/* ,editor : {type : 'select',data : dutyData,selWidth : 155} */,render : function(item) {
  75. for (var i = 0; i < dutyData["list"].length; i++) {
  76. if (dutyData["list"][i]['value'] == item.DUTY_MODE)
  77. return dutyData["list"][i]['key']
  78. }
  79. return item.DUTY_MODE;
  80. }
  81. }
  82. /* {display : '操作',isSort : false,width : "12%", render : function(rowdata, rowindex, value) {
  83. var h = "";
  84. if (!rowdata._editing) {
  85. flag = false;
  86. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  87. } else {
  88. flag = true;
  89. h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>确认</span></a> ";
  90. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
  91. }
  92. return h;
  93. }
  94. } */ ],
  95. // url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getDutyByTaskId',
  96. url:hurl,
  97. rownumbers : true,
  98. params:loadParms,
  99. usePager : false,
  100. percentWidthMode : true,
  101. height : '600',
  102. width : '100%',
  103. enabledEdit : true,
  104. clickToEdit : false,
  105. onDblClickRow : function(rowdata, rowindex) {
  106. if (flag) {
  107. top.Dialog.alert("请先完成当前记录的编辑!");
  108. return;
  109. }
  110. editingRow = parseInt(rowindex.slice(1)) - 1001;
  111. g.beginEdit(rowindex);
  112. },
  113. onBeforeEdit : onBeforeEdit,
  114. onBeforeSubmitEdit : onBeforeSubmitEdit,
  115. onAfterSubmitEdit : onAfterSubmitEdit
  116. /* toolbar : {
  117. items : [ { text : '新增',click : addUser,iconClass : 'icon_add'},
  118. { line : true }]
  119. } */
  120. });
  121. }
  122. //查看
  123. function onView(rowidx) {
  124. }
  125. //删除
  126. function onDelete(rowidx) {
  127. if (rowidx != editingRow && flag == true) {
  128. top.Dialog.alert("请先完成当前记录的编辑!");
  129. return;
  130. }
  131. top.Dialog.confirm("确定要删除该记录吗?", function() {
  132. isValida = false;
  133. flag = false;
  134. endEdit(rowidx);
  135. //删除记录
  136. var row = g.getRow(rowidx)
  137. // alert(row.fd_objectid)
  138. //删除操作
  139. g.deleteRow(row);
  140. });
  141. }
  142. //编辑
  143. function beginEdit(rowid) {
  144. g.beginEdit(rowid);
  145. }
  146. //取消编辑
  147. function cancelEdit(rowid) {
  148. g.cancelEdit(rowid);
  149. }
  150. //结束编辑
  151. function endEdit(rowid) {
  152. editingRow = '';
  153. g.endEdit(rowid);
  154. }
  155. //新增
  156. /* function addUser() {
  157. alert("iuuiu");
  158. if (flag) {
  159. top.Dialog.alert("请先完成当前记录的编辑!");
  160. return;
  161. }
  162. editingRow = 0;
  163. isNew = true;
  164. var row = g.getRow(0);
  165. var rowData = {
  166. duty_way : 0
  167. };
  168. g.addEditRow(rowData, row, true);
  169. //在这里做新增处理
  170. var $duty_man_input = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr").children("td").eq(4);
  171. } */
  172. function addUser(){
  173. alert("iiiiii")
  174. if(flag){
  175. top.Dialog.alert("请先完成当前记录的编辑!");
  176. return;
  177. }
  178. editingRow=0;
  179. isNew=true;
  180. var row = g.getRow(0);
  181. //var row = "11";
  182. alert(row+"--------row");
  183. var rowData={
  184. //duty_date:getNowDate() ,
  185. DUTY_MODE:0
  186. };
  187. alert(1111);
  188. g.addEditRow(rowData, row, true);
  189. alert(1111);
  190. //在这里做新增处理
  191. var $duty_man_input = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr").children("td").eq(4);
  192. $duty_man_input.on("click",openaddwindow)
  193. }
  194. //将row JSON对象转化为bo对象
  195. function rowToBO(row) {
  196. // 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;
  197. 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;
  198. return params;
  199. }
  200. //删除后的提示
  201. function handleResult(result) {
  202. if (result == 1) {
  203. top.Dialog.alert("删除成功!", null, null, null, 1);
  204. g.loadData();
  205. } else {
  206. top.Dialog.alert("删除失败!");
  207. }
  208. }
  209. //全部确认修改
  210. function endAllEdit() {
  211. g.endEdit();
  212. }
  213. //全部取消修改
  214. function cancelAllEdit() {
  215. g.cancelEdit();
  216. }
  217. //编辑前事件
  218. function onBeforeEdit(e) {
  219. }
  220. //编辑提交前事件
  221. function onBeforeSubmitEdit(e) {
  222. if (isValida) {
  223. if (e.newdata.duty_date == "") {
  224. top.Dialog.alert("日期列有输入值为空!");
  225. return false;
  226. }
  227. if (e.newdata.start_time == "") {
  228. top.Dialog.alert("开始时间列有输入值为空!");
  229. return false;
  230. }
  231. if (e.newdata.end_time == "") {
  232. top.Dialog.alert("结束时间列有输入值为空!");
  233. return false;
  234. }
  235. if (e.newdata.start_time > e.newdata.end_time) {
  236. top.Dialog.alert("开始时间晚于结束时间!");
  237. return false;
  238. }
  239. if (e.newdata.leader == "" || validateInput(e.newdata.leader, "^[\" \"]+$")) {
  240. top.Dialog.alert("值班领导列有输入值为空或全是空格!");
  241. return false;
  242. }
  243. if (e.newdata.leader_tel == "") {
  244. top.Dialog.alert("领导电话列有输入值为空!");
  245. return false;
  246. }
  247. if (e.newdata.name == "" || validateInput(e.newdata.name, "^[\" \"]+$")) {
  248. top.Dialog.alert("值班成员列有输入值为空或全是空格!");
  249. return false;
  250. }
  251. if (e.newdata.telephone == "") {
  252. top.Dialog.alert("联系电话列有输入值为空!");
  253. return false;
  254. }
  255. if (e.newdata.duty_way == "") {
  256. top.Dialog.alert("值班方式列有输入值为空!");
  257. return false;
  258. }
  259. }
  260. isValida = true;
  261. }
  262. //编辑后事件
  263. function onAfterSubmitEdit(e) {
  264. isNew = false;
  265. }
  266. //保存方法bg
  267. var token = 0;
  268. function saveDuty(validaFormId) {
  269. var valid = $(validaFormId).validationEngine({
  270. returnIsValid : true
  271. });
  272. if (valid) {
  273. if (token > 0) {
  274. top.Dialog.alert("已经保存过!");
  275. return;
  276. }
  277. token++;
  278. var rows = g.getData();
  279. //保存数据时为隐藏域的东西赋值
  280. for (var i = 0; i < rows.length; i++) {
  281. //填报人
  282. rows[i].TIANBAO_PERSON = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  283. //填报部门
  284. rows[i].DEPT = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  285. //填报时间
  286. rows[i].TIANBAO_TIME = getNowDate();
  287. rows[i].UPDATEDATE = getNowDate();
  288. //加载任务名称数据
  289. rows[i].TASK_ID = $("#TASK_ID_632").val();
  290. }
  291. var rowsjson = JSON.stringify(rows);
  292. var forms = $('#RespDutyForm').serialize();
  293. // forms =forms +"#;#"+rowsjson;
  294. var gurl ;
  295. if(task_id == ""){
  296. gurl = $.pathname() + '/ws/bgd_duty/BgdDutyService/saveDuty';
  297. }else{
  298. gurl = $.pathname() + '/ws/bgd_duty/BgdDutyService/updateBgdDuty';
  299. }
  300. alert(gurl);
  301. $.ajax({
  302. url : gurl,
  303. type : 'post',
  304. timeout : 15000,
  305. data : encodeURI(rowsjson, "UTF-8"),
  306. dataType : 'text',
  307. success : function(result) {
  308. alert(result.sucsess);
  309. if (result.sucsess) {
  310. top.Dialog.alert("保存成功!");
  311. history.go(-1);
  312. } else {
  313. top.Dialog.alert("保存失败!");
  314. }
  315. },
  316. error : function(e) {
  317. alert(JSON.stringify(e));
  318. top.Dialog.alert("保存失败");
  319. }
  320. });
  321. }
  322. }
  323. function resetDuty() {
  324. window.location.href = "duty_edit.jsp";
  325. }
  326. function alter_reset(){
  327. alert("修改重置");
  328. $("#biaoti").text("保供电值班安排表填报修改1");
  329. //加载修改的页面方法
  330. initGrid();
  331. }
  332. </script>
  333. </head>
  334. <body style="height: 650px;overflow:auto; overflow-x:hidden;background-color:white">
  335. <div style="height: 50px;background: #F8F8F8;" align="center">
  336. <a href="javascript:;"> <img id="back" align="left" alt="返回" src="/nwyj/images/temp/back.png" onclick="javascript:window.location.href='bgd_duty_list.jsp';" />
  337. </a> <font id="biaoti" style="font-weight: bold;font-size: 20px;line-height: 45px;">保供电值班安排表填报</font>
  338. </div>
  339. <form id="RespDutyForm" method="post">
  340. <table width="100%" border='0'>
  341. <!-- <tr>
  342. <td colspan="6" align="right">
  343. <input type="button" onclick="javascript:saveDuty('#RespDutyForm');" value="保存" />
  344. <input id="add_reset" type="button" onclick="javascript:resetDuty();" value="重置" />
  345. <input id="alter_reset" type="button" onclick="javascript:alter_reset();" value="重置" />
  346. </td>
  347. </tr> -->
  348. <tr>
  349. <!-- <td width="10%" align="right"><span class="star">*</span>名称:</td><td width="20%"><input id="name" maxlength="15" name="name" type="text" class="validate[required,length[0,50],custom[illegalLetter]]"></td> -->
  350. <td width="10%" align="right"><span class="star">*</span>名称:</td>
  351. <td width="20%"><select editable=false name="TASK_ID_632" class="validate[required]" id="TASK_ID_632" selAlign="" selWidth="200"></select> <!-- <div class="selectTree validate[required]" id="TASK_ID_632" name="TASK_ID_632" selWidth="200" boxHeight="260"></div> --></td>
  352. <!-- <td width="10%" align="right"><span class="star">*</span>部门:</td>
  353. <td width="20%"><div class="selectTree validate[required]" id="dept_names" name="dept_names" selWidth="200" boxHeight="260"></div></td>
  354. -->
  355. <td width="10%"></td>
  356. <td width="20%"></td>
  357. </tr>
  358. <!-- <tr>
  359. <td align="right"><span class="star">*</span>填报人员:</td>
  360. <td><input name="oper_name" id="oper_name" maxlength="15" type="text" class="validate[required,length[0,20],custom[illegalLetter]]"></td>
  361. <td align="right"><span class="star">*</span>填报部门:</td>
  362. <td>
  363. <input name="oper_dept" id="oper_dept" type="text" />
  364. <div class="selectTree validate[required]" id="oper_dept" name="oper_dept" selWidth="200" boxHeight="260"></div> <input name="duty_type" id="duty_type" type="hidden" value="3">
  365. </td>
  366. <td align="right"><span class="star">*</span>填报时间:</td>
  367. <td><input name="oper_time" id="oper_time" type="text" class="date validate[required]" dateFmt="yyyy-MM-dd HH:mm"></td>
  368. </tr> -->
  369. </table>
  370. </form>
  371. <div>
  372. <div class="padding_right5">
  373. <div id="maingrid"></div>
  374. </div>
  375. </div>
  376. </div>
  377. </body>
  378. </html>