b0ff32108ab835f0142e4f641183a627415bcb3a.svn-base 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <%@page language="java" 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 xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>应急制度文件管理</title>
  7. <!--框架必需start-->
  8. <%@include file="../../../include.jsp" %>
  9. <!--框架必需end-->
  10. <script type="text/javascript" src="/nwyj/scripts/business/am/org/maintenance/orgSel.js"></script>
  11. <script type="text/javascript">
  12. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  13. var ztData = {"list":[{"key":"单位","value":"1"},{"key":"部门","value":"2"},{"key":"直属中心机构","value":"3"},{"key":"虚拟机构","value":"4"},{"key":"车间","value":"5"},{"key":"班组","value":"6"}]}
  14. $(function(){
  15. $("#UNITS_214").OrgSel();//{orgType:"per"}
  16. });
  17. var g;
  18. //var condition = "IS_DEL='0' AND PARENT_ID ='"+ deptId +"' and (dept_name like '%供电局' or dept_name like '%供电分局' or dept_name like '%供电所' or dept_name like '%电网有限责任公司' or dept_name like '%输电%' or dept_name like '%变电%' or dept_name like '%调度%') order by sort ";
  19. var condition11 ="IS_DEL='0' AND PARENT_ID ='"+deptId +"' order by sort desc";
  20. //列表加载参数
  21. var loadParams = {
  22. "listId" : '800',
  23. "condition" : condition11,
  24. };
  25. function initComplete(){
  26. g = $("#maingrid").quiGrid({
  27. columns: [
  28. // { display: '单位名称', name: 'CORP_NAME_800', align: 'center', width: "25%"},
  29. { display: '单位/部门名称', name: 'DEPT_NAME_800', align: 'center', width: "30%"},
  30. { display: '序号', name: 'SORT_800', align: 'center' , width: "20%" ,editor: { type: 'text'}},
  31. { display: '单位/部门类型', name: 'DEPT_TYPE_800', align: 'center' , width: "20%" ,
  32. editor: { type: 'select', data : ztData},
  33. render : function(rowdata, rowindex, value, column) {
  34. var thisvalue = value;
  35. for (var i = 0; i < ztData["list"].length; i++) {
  36. if (ztData["list"][i]['value'] == value)
  37. thisvalue = ztData["list"][i]['key'];
  38. }
  39. return thisvalue;
  40. }},
  41. { display: '单位名称', name: 'CORP_NAME_800', align: 'center' , width: "35%",editor: { type: 'text'}}
  42. ],
  43. url :'/nwyj/ws/crud/CRUDService/queryQui',
  44. params:loadParams,
  45. sortName : '',
  46. sortOrder : '',
  47. rownumbers:true,
  48. checkbox:true,
  49. usePager:false,
  50. height: '100%',
  51. width:"100%",
  52. enabledEdit: true, //编辑用
  53. onBeforeEdit: onBeforeEdit, onBeforeSubmitEdit: onBeforeSubmitEdit,onAfterEdit: onAfterEdit,
  54. percentWidthMode:true,
  55. //顶部图标按钮栏
  56. toolbar:{
  57. items:[
  58. {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
  59. { line : true }
  60. ]
  61. }
  62. });
  63. }
  64. var bh_code = "";
  65. //编辑前事件
  66. function onBeforeEdit(e){
  67. bh_code = parseInt(e.rowindex)+31;
  68. }
  69. //编辑提交前事件
  70. function onBeforeSubmitEdit(e){
  71. /* if(e.column.columnname=="SORT_800"){
  72. var re = /^[1-9]*[1-9][0-9]*$/;
  73. if(e.record.SORT_800==""){
  74. e.record.SORT_800 = bh_code;
  75. }else if(e.record.SORT_800 != undefined && e.record.SORT_800 != ""){
  76. if (e.record.SORT_800.length!=2 || !re.test(e.record.SORT_800)){
  77. top.Dialog.alert("请输入2位数的正整数!");
  78. // return false;
  79. }
  80. }
  81. }else if(e.column.columnname=="CORP_NAME_800"){
  82. e.record.CORP_ID_800 = $("#editCellId").val();
  83. } */
  84. }
  85. //编辑后事件
  86. function onAfterEdit(e){
  87. var num = e.record.SORT_800;
  88. if(isNaN(num)){
  89. top.Dialog.alert("请输入正整数!");
  90. }
  91. }
  92. function saveAll(){
  93. /* var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;
  94. var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+"); */
  95. var rows=g.getSelectedRows();
  96. var rowsLength = rows.length;
  97. if (rowsLength == 0) {
  98. top.Dialog.alert("请选中要保存的信息!");
  99. return;
  100. }
  101. var json=JSON.stringify(rows);
  102. var myobj=eval(json);
  103. for(var i=0;i<myobj.length;i++){
  104. var SORT_800 = myobj[i].SORT_800;
  105. /* var fff =1;
  106. fff = fff+i; */
  107. if(SORT_800==null||""==SORT_800){
  108. top.Dialog.alert("保存的机构中序号不能为空值,请勾选有序号的或补全序号!");
  109. return;
  110. }
  111. }
  112. var ids = "";
  113. var sort= "";
  114. var type= "";
  115. var corpName= "";
  116. var corpId= "";
  117. for ( var i = 0; i < rowsLength; i++) {
  118. ids += rows[i].FD_OBJECTID800 + ",";
  119. sort += rows[i].SORT_800 + ",";
  120. type += rows[i].DEPT_TYPE_800 +",";
  121. corpName += rows[i].CORP_NAME_800 +",";
  122. corpId += rows[i].CORP_ID_800 +",";
  123. }
  124. var url = $.pathname()
  125. + "/ws/InDepartmentService/InDepartmentService/getDepartmentUilt";
  126. var params = {
  127. id:ids,
  128. sort:sort,
  129. type:type,
  130. corpName:corpName,
  131. corpId:corpId
  132. };
  133. $("body").eq(0).showLoading();
  134. $.ajax({
  135. url : url,
  136. type : 'post',
  137. timeout : 15000,
  138. data : params,
  139. dataType : 'json',
  140. success : function(data) {
  141. $("body").eq(0).hideLoading();
  142. $.messager.alert('保存成功');
  143. window.location.href = "DepartmentUilt.jsp";
  144. },
  145. error : function(e) {
  146. $("body").eq(0).hideLoading();
  147. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  148. }
  149. });
  150. }
  151. function searchHandler(){
  152. //var condition = "IS_DEL='0' and (dept_name like '%供电局' or dept_name like '%供电分局' or dept_name like '%供电所' or dept_name like '%电网有限责任公司' or dept_name like '%输电%' or dept_name like '%变电%' or dept_name like '%调度%') ";
  153. var condition ="IS_DEL='0' ";
  154. var compId = $('#UNITS_214').val();
  155. if(compId!=""){
  156. condition += " and PARENT_ID = '"+compId+"'";
  157. }else{
  158. condition += " and PARENT_ID = '"+deptId+"'";
  159. }
  160. condition += " order by sort ";
  161. g.setOptions({
  162. params : {
  163. "listId" :'800' ,
  164. "condition" : condition
  165. }
  166. });
  167. g.loadData();//加载数据
  168. }
  169. $(function(){
  170. //单位/部门类型 改变事件
  171. $(".l-grid-editor").find("select").live("change",function(){//申请单位联系人的绑定事件
  172. var value = $(this).data("selectedNode").value;
  173. var id = $(".l-grid-row-cell-editing").parent().attr("id");
  174. var rowindex = Number(id.split("r1")[1])-1;
  175. var data = g.getRow(rowindex);
  176. if(value==1){
  177. //alert(JSON.stringify(data));
  178. data.CORP_ID_800 = data.DEPT_ID_800;
  179. data.CORP_NAME_800 = data.DEPT_NAME_800;/*
  180. $(".l-grid-row-cell-editing").next().find(".l-grid-row-cell-inner").text(data.DEPT_ID_800);
  181. $(".l-grid-row-cell-editing").prev().prev().prev().find(".l-grid-row-cell-inner").text(data.DEPT_NAME_800); */
  182. g.updateRow(data,g.getRowObj(rowindex));
  183. }
  184. });
  185. $(".l-grid-editor").find("input").unbind("click").live("click",openone);
  186. })
  187. function openone(){
  188. var id = $(".l-grid-row-cell-editing").attr("id");
  189. id = id.substring(id.length-1);
  190. if(id=="6"){
  191. var $self = $(this);
  192. $(".l-grid-editor").find("input").attr("id","editCellId_show");
  193. var defalutOption = {
  194. loadId_in : loadId_in,
  195. loadId_out : loadId_out,
  196. orgWidth : "91%",
  197. selectedMulti : false,
  198. setMulti : {
  199. "Y" : "",
  200. "N" : ""
  201. },
  202. orgType : "",
  203. manGroup:"no-addManGroup",
  204. loadCorp:"",
  205. divId : "editCellId"
  206. };
  207. openandSelectOrg(defalutOption);
  208. }
  209. }
  210. function openandSelectOrg(params,orgData) {
  211. var iframeHeight = $(window.document.body).height();
  212. var inId = params.loadId_in;
  213. var outId = params.loadId_out;
  214. var divId = params.divId;
  215. var mu = params.selectedMulti;
  216. var diag = new top.Dialog();// 定义一个窗口对象
  217. var chkboxType1 = params.setMulti.Y;
  218. var chkboxType2 = params.setMulti.N;
  219. var orgType = params.orgType;
  220. var manGroup = params.manGroup;
  221. var loadCorp = params.loadCorp;
  222. //alert(orgData);
  223. diag.Title = "选择组织";// 窗口标题/
  224. if(manGroup=="addManGroup"){
  225. diag.URL = "/nwyj/page/business/am/org/maintenance/orgSel.html?" + inId
  226. + "?" + outId + "?" + divId + "?" + mu + "?" + chkboxType1 + "?"
  227. + chkboxType2 + "?" + orgType+"?"+iframeHeight+"?"+loadCorp+"?"+orgData+"?"+manGroup;// 窗口对应的页面
  228. }else{
  229. diag.URL = "/nwyj/page/business/am/org/maintenance/orgSel.html?" + inId
  230. + "?" + outId + "?" + divId + "?" + mu + "?" + chkboxType1 + "?"
  231. + chkboxType2 + "?" + orgType+"?"+iframeHeight+"?"+loadCorp+"?"+orgData;// 窗口对应的页面
  232. }
  233. diag.Height = 500;
  234. diag.Width = 380;
  235. diag.ShowOkButton = false;// 不显示确认按钮
  236. diag.ShowCancelButton = false;// 不显示取消按钮
  237. diag.ButtonAlign = "center";// 按钮居中
  238. //diag.ParamsObj属性 ={"aa":"11","bb":"22"};
  239. diag.show();// 显示窗口
  240. // 添加关闭按钮
  241. };
  242. $.messager = top.Dialog;
  243. </script>
  244. </head>
  245. <body>
  246. <div class="box2" id="searchPanel">
  247. <input type="hidden" id="editCellId" />
  248. <input type="hidden" id="show_editCellId" />
  249. <form id="queryUserForm" method="post">
  250. <table width="100%">
  251. <tr>
  252. <td align="right" width="10%">所属单位:</td>
  253. <td width="60%"><div id="UNITS_214" ></div></td>
  254. <td width="30%"><button type="button" onclick="searchHandler()"><span class="icon_find">查询</span></button></td>
  255. </tr>
  256. </table>
  257. </form>
  258. </div>
  259. <div class="adding_right5">
  260. <div id="maingrid"></div>
  261. </div>
  262. </body>
  263. </html>