96d125a5d2f87b8b6264ef161193af59c2080f06.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  2. <!DOCTYPE HTML>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=9" />
  7. <title>应急响应值班安排表填报</title>
  8. <!--引入QUI框架js -->
  9. <%@include file="../../../../include.jsp" %>
  10. <script type="text/javascript" src="<%=path%>/scripts/setiframeheight.js" ></script>
  11. <script>
  12. var flag=false;
  13. var isNew=false; //是否是新增记录
  14. var isNewSave=true; //新增记录是否保存
  15. var editingRow; // 双击的当前编辑行
  16. var isValida=true; //是否需要验证
  17. //取得用户真实名字
  18. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  19. //部门id
  20. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  21. //部门名称
  22. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  23. //父部门id
  24. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  25. var g;
  26. var demandid;
  27. var departNode;
  28. var newrowid=200;
  29. var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
  30. $.post(deptUrl,{id:parentId,name:''},function(data){
  31. $("#RECIPIENT_DEPARTMENT").data("data",data);
  32. $("#RECIPIENT_DEPARTMENT").render();
  33. }, "json");
  34. function initComplete(){
  35. if((window.location.href).indexOf('?')>-1){
  36. demandid = (window.location.href).split('?')[1];//获取记录id
  37. var url = $.pathname() + '/ws/equip/RespEquipmentService/getEquipById/';
  38. var params = {demandid : demandid};
  39. $.ajax({
  40. url : url,
  41. type : 'post',
  42. timeout : 15000,
  43. data : params,
  44. dataType : 'json',
  45. success : function(data){
  46. top.Dialog.alert("访问服务成功!");
  47. $('#editForm').ajaxWrite({data:data});
  48. },
  49. error : function(e){
  50. top.Dialog.alert("访问服务失败!");
  51. }
  52. });
  53. }
  54. initGrid();
  55. }
  56. function initGrid(){
  57. g = $("#maingrid").quiGrid({
  58. columns: [
  59. {name:'fd_objectid',hide:true},
  60. {name:'demand_id',hide:true},
  61. { display: '队伍专业', name: 'team_major', align: 'center', width: 200,editor: { type: 'text' }},
  62. { display: '需求人数', name: 'need_number', align: 'center', width: 200,editor: { type: 'text' }},
  63. { display: '操作', isSort: false, width: 120, render: function (rowdata, rowindex, value)
  64. {
  65. var h = "";
  66. if (!rowdata._editing)
  67. {
  68. flag=false;
  69. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  70. }
  71. else
  72. {
  73. flag=true;
  74. h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>确认</span></a> ";
  75. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
  76. }
  77. return h;
  78. }
  79. }
  80. ],
  81. url: $.pathname() + '/ws/equip/RespEquipmentService/getDetailById/',
  82. params :{"demandid":demandid},
  83. rownumbers:true,
  84. pageSize:10,
  85. dataAction:"server",
  86. usePager: false,
  87. percentWidthMode : true,
  88. height: '100%', width:'100%',enabledEdit: true,clickToEdit: false,onDblClickRow:function(rowdata, rowindex){
  89. if(flag){
  90. top.Dialog.alert("请先完成当前记录的编辑!");
  91. return;
  92. }
  93. editingRow=parseInt(rowindex.slice(1))-1001;
  94. g.beginEdit(rowindex);
  95. },onBeforeEdit: onBeforeEdit, onBeforeSubmitEdit: onBeforeSubmitEdit,onAfterSubmitEdit: onAfterSubmitEdit,
  96. toolbar:
  97. {
  98. items: [
  99. { text: '新增', click: addUser, iconClass: 'icon_add' },
  100. { line: true }
  101. ]
  102. }
  103. });
  104. }
  105. //查看
  106. function onView(rowidx){
  107. }
  108. //删除
  109. function onDelete(rowidx){
  110. alert("rowidx"+rowidx);
  111. alert("editingRow"+editingRow);
  112. alert("flag"+flag);
  113. alert("isNew"+isNew);
  114. if(rowidx!=editingRow && flag==true){
  115. top.Dialog.alert("请先完成当前记录的编辑!");
  116. return;
  117. }
  118. if(rowidx != editingRow){
  119. top.Dialog.confirm("此删除操作将无法撤回,是否继续?",function(){
  120. //删除记录
  121. var row = g.getRow(rowidx)
  122. // alert(row.fd_objectid)
  123. //删除操作
  124. $.post($.pathname() + '/ws/equip/RespEquipmentService/delDetailByID',
  125. {"fd_objectid":row.fd_objectid},
  126. function(result){
  127. if (result.Msg.sucsess == true) {
  128. top.Dialog.alert("删除成功!");
  129. g.loadData();
  130. } else {
  131. top.Dialog.alert("删除失败!");
  132. }
  133. },"json");
  134. });
  135. }
  136. else if(!isNew){
  137. isNewSave=false;
  138. isValida=false;
  139. isNew=false;
  140. g.loadData();
  141. }else{
  142. top.Dialog.confirm("确定要删除该记录吗?",function(){
  143. isNewSave=false;
  144. isValida=false;
  145. endEdit(rowidx);
  146. //删除记录
  147. var row = g.getRow(rowidx)
  148. // alert(row.fd_objectid)
  149. //删除操作
  150. g.deleteRow(row);
  151. });
  152. }
  153. }
  154. //编辑
  155. function beginEdit(rowid) {
  156. g.beginEdit(rowid);
  157. }
  158. //取消编辑
  159. function cancelEdit(rowid) {
  160. g.cancelEdit(rowid);
  161. }
  162. //结束编辑
  163. function endEdit(rowid)
  164. {
  165. // editingRow='';
  166. isNew=false;
  167. g.endEdit(rowid);
  168. }
  169. //新增
  170. function addUser(){
  171. if(flag){
  172. top.Dialog.alert("请先完成当前记录的编辑!");
  173. return;
  174. }
  175. isNew=true;
  176. editingRow=0;
  177. var row = g.getRow(0);
  178. var rowData={
  179. };
  180. g.addEditRow(rowData, row, true);
  181. //在这里做新增处理
  182. }
  183. //将row JSON对象转化为bo对象
  184. function rowToBO(row) {
  185. // 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;
  186. // 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;
  187. var params='&EquipmentDetail.fd_objectid='+row.fd_objectid+'&EquipmentDetail.equipment_name='+row.equipment_name+'&EquipmentDetail.equipment_model='+row.equipment_model+'&EquipmentDetail.equipment_number='+row.equipment_number;
  188. return params;
  189. }
  190. //删除后的提示
  191. function handleResult(result){
  192. if(result == 1){
  193. top.Dialog.alert("删除成功!",null,null,null,1);
  194. g.loadData();
  195. }else{
  196. top.Dialog.alert("删除失败!");
  197. }
  198. }
  199. //全部确认修改
  200. function endAllEdit(){
  201. g.endEdit();
  202. }
  203. //全部取消修改
  204. function cancelAllEdit()
  205. {
  206. g.cancelEdit();
  207. }
  208. //编辑前事件
  209. function onBeforeEdit(e)
  210. {
  211. }
  212. //编辑提交前事件
  213. function onBeforeSubmitEdit(e){
  214. if(isValida){
  215. if(e.newdata.equipment_name==""){
  216. top.Dialog.alert("队伍专业列有输入值为空!");
  217. return false;
  218. }
  219. if(e.newdata.equipment_model==""){
  220. top.Dialog.alert("需求人数列有输入值为空!");
  221. return false;
  222. }
  223. }
  224. isValida=true;
  225. }
  226. //编辑后事件
  227. function onAfterSubmitEdit(e)
  228. {
  229. if(isNewSave){
  230. var fd_objectid = e.record.fd_objectid;
  231. var rowData = e.newdata;
  232. var row = JSON.stringify(rowData);
  233. row += ";"+demandid+";"+fd_objectid;
  234. //ajax方式提交数据到数据库
  235. // $.post($.pathname() + '/ws/duty/DutyRecordsService/saveDetail',row,function(data){
  236. // g.loadData();
  237. // },"json");
  238. $.ajax({
  239. url : $.pathname() + '/ws/equip/RespEquipmentService/saveDetailByID',
  240. type : 'post',
  241. timeout : 15000,
  242. data : row,
  243. dataType : 'text',
  244. success : function(result){
  245. top.Dialog.alert("保存成功!");
  246. isNew=false;
  247. },
  248. error : function(e){
  249. top.Dialog.alert("保存失败!");
  250. }
  251. });
  252. }
  253. isNewSave=true;
  254. }
  255. var token = 0;
  256. function saveDuty(validaFormId){
  257. var valid=$(validaFormId).validationEngine({returnIsValid: true});
  258. if(true){
  259. if(token>0){
  260. top.Dialog.alert("已经保存过!");
  261. return;
  262. }
  263. token++;
  264. var rows = g.getData();
  265. var rowsjson=JSON.stringify(rows);
  266. var forms = $('#editForm').serialize();
  267. forms =forms +"&"+"fd_objectid="+demandid;
  268. alert(forms);
  269. $.ajax({
  270. url : $.pathname() + '/ws/equip/RespEquipmentService/updateDemand',
  271. type : 'post',
  272. timeout : 15000,
  273. data : forms,
  274. dataType : 'json',
  275. success : function(result){
  276. if (result.Msg.sucsess == true) {
  277. top.Dialog.alert("保存成功!");
  278. // history.go(-1);
  279. } else {
  280. top.Dialog.alert("保存失败!");
  281. }
  282. },
  283. error : function(e){
  284. top.Dialog.alert("保存失败");
  285. }
  286. });
  287. }
  288. /* function resetDuty(){
  289. window.location.href="TeamEdit.jsp";
  290. } */
  291. }
  292. </script>
  293. </head>
  294. <body style="height:700px;overflow:auto; overflow-x:hidden;background-color:white">
  295. <div style="height: 50px;background: #F8F8F8;" align="center">
  296. <a href="javascript:;">
  297. <img id="back" align="left" alt="返回" src="/nwyj/images/temp/back.png" title="返回" onclick="javascript:window.location.href='TeamManage.jsp';" />
  298. </a>
  299. <font style="font-weight: bold;font-size: 20px;line-height: 45px;" >修改应急队伍调拨申请</font>
  300. </div>
  301. <form id="editForm">
  302. <input name="REPORTED_STATE" id="REPORTED_STATE" type="hidden" >
  303. <input name="AUDIT_STATE" id="AUDIT_STATE" type="hidden" >
  304. <table style="width:100%" border="0">
  305. <tr>
  306. <td colspan="5" align="right"><input type="button" onclick="javascript:saveDuty('#editForm');" value="保存" />&nbsp;&nbsp;<input type="button" onclick="javascript:resetDuty();" value="重置" />&nbsp;&nbsp;&nbsp;&nbsp;</td>
  307. </tr>
  308. <td width="15%" align="right"><span class="star">*</span>被支援单位:</td>
  309. <td width="35%"><input type="text" maxlength="50" name="BY_BOOST_SECTOR_391" id="BY_BOOST_SECTOR_391" class="validate[required,length[0,50]]"/></td>
  310. <td width="15%" align="right"><span class="star">*</span>到达时间:</td>
  311. <td width="35%"><input type="text" readonly="readonly" maxlength="26" dateFmt="yyyy-MM-dd HH:mm:ss" onfocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',skin:themeColor})" name="ARRIVE_391" id="ARRIVE_391" class="date validate[required,custom[date]]"/></td>
  312. </tr>
  313. <tr>
  314. <td align="right"><span class="star">*</span>受灾情况:</td>
  315. <td colspan="3"><textarea style="height:40px;width:854px" maxlength="450" name="INJURY_CASE_391" id="INJURY_CASE_391" class="validate[length[0,500]]"></textarea></td>
  316. </tr>
  317. <tr>
  318. <td align="right"><span class="star">*</span>抢修任务:</td>
  319. <td colspan="3"><textarea style="height:40px;width:854px" maxlength="450" name="REPAIR_TASK_391" id="REPAIR_TASK_391" class="validate[length[0,500]]"></textarea></td>
  320. </tr>
  321. <tr>
  322. <td align="right"><span class="star">*</span>地质地貌:</td>
  323. <td colspan="3"><textarea style="height:40px;width:854px" maxlength="450" name="GEOLOGY_PHYSIOGNOMY_391" id="GEOLOGY_PHYSIOGNOMY_391" class="validate[length[0,500]]"></textarea></td>
  324. </tr>
  325. <tr>
  326. <td align="right"><span class="star">*</span>气候状况:</td>
  327. <td colspan="3"><textarea style="height:40px;width:854px" maxlength="450" name="WEATHER_CASE_391" id="WEATHER_CASE_391" class="validate[length[0,500]]"></textarea></td>
  328. </tr>
  329. <tr >
  330. <td align="right"><span class="star">*</span>住宿装备:</td>
  331. <td colspan="3"><textarea style="height:40px;width:854px" maxlength="450" name="STAY_GEAR_391" id=""STAY_GEAR_391"" class="validate[length[0,500]]"></textarea></td></td>
  332. </tr>
  333. <tr>
  334. <td align="right"><span class="star">*</span>施工机具:</td>
  335. <td colspan="3"><textarea style="height:40px;width:854px" maxlength="450" name="EXECUTION_IMPLEMENT_391" id="EXECUTION_IMPLEMENT_391" class="validate[length[0,500]]"></textarea></td></td>
  336. </tr>
  337. </table>
  338. </form>
  339. <div class="padding_right5">
  340. <div id="maingrid"></div>
  341. </div>
  342. </div>
  343. </body>
  344. </html>