d26d5a8c38efdf53f1776faa67cd0366b43ba951.svn-base 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var clickNum = 0;
  3. //登陆用户的单位名称
  4. var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  5. var parent_ids = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  6. /*******************************修改、删除信息 各级单位的超级管理员可以修改表单信息。湛江局许永山提的建议 2016-05-31** */
  7. //登陆人角色
  8. var Roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids() + ",";
  9. var roleidTemp =Roleid.split(",");
  10. var flag="0";
  11. $(function(){
  12. // getCompName();
  13. /** 下拉框加载 */
  14. /** 绑定更多的按钮点击事件 */
  15. $more = $("#more"); // 更多按钮
  16. $more.bind('click', function() {
  17. more();
  18. });
  19. // $searchButt = $("#searchButt");// 更多查询按钮
  20. // $searchButt.live('click', function() {
  21. // searchHandler();
  22. // });
  23. $searchOne = $("#searchOne");//查询图标绑定查询事件
  24. $searchOne.bind('click', function() {
  25. searchHandler2();
  26. });
  27. });
  28. //查询单位条件加载
  29. function getCompName(){
  30. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  31. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getresourXj/';
  32. var params = {
  33. id : deptId,
  34. value:"UNITS"
  35. };
  36. $.ajax({
  37. url : url,
  38. type : 'post',
  39. timeout : 60000,
  40. data : params,
  41. dataType : 'json',
  42. success : function(data){
  43. var conditionData3 = JSON.stringify(data);
  44. var test = eval("("+conditionData3+")");
  45. if(conditionData3!='{"list":[{"name":"查询单位","className":"UNITS","equalType":"equal","list":[]}]}'){
  46. conditionData.list.push(test.list[0]);
  47. }
  48. createConditionsDom(conditionData);
  49. $(".item").unbind("click").bind("click",bindSelectOne);
  50. },
  51. error : function(e){
  52. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  53. }
  54. });
  55. }
  56. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
  57. var g;
  58. //
  59. //condition = "IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.PARENT_ID='"+deptName+"' OR A.DEPT_ID='"+deptName+"')))" ;
  60. condition = "IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.DEPT_ID='"+deptName+"')))" ;
  61. //列表加载参数
  62. var loadParams = {
  63. "listId" : '299',
  64. "condition" : condition,
  65. direction:'DESC',
  66. sort: 'UPDATEDATE'
  67. };
  68. function initComplete(){
  69. /**
  70. * 工具条
  71. */
  72. var roleCons = roleButtonArr();
  73. var toolBarOpt1 = {
  74. items:[
  75. {text: '新增', click: "addUnit", iconClass: 'add1_tem',id:"rcxz"},
  76. {text: '删除', click: "deleteUnit", iconClass: 'delete_tem',id:"rcsc"},
  77. {text: '修改', click: "updateUnit", iconClass: 'update_tem',id:"rcxg"},
  78. // {text: '查看', click: "onView", iconClass: 'view_tem',id:"10003"},
  79. {text: '统计', click: "sumUnit", iconClass: 'poll_tem',id:"10200"},
  80. {text: '导入', click: "showImportDialog", iconClass: 'import_tem',id:"rcdr"},
  81. {text: '导出', click: "exportTotalData", iconClass: 'export_tem',id:"10006"},
  82. { text: '撤销', click: "noPublish", iconClass: 'retract_tem' ,id:"10215"},
  83. { text: '查看本级单位演练', click: "showSameLevel", iconClass: 'poll_tem' ,id:"10007"}
  84. ],
  85. roleCons:roleCons
  86. };
  87. /**
  88. * 树形列
  89. */
  90. var grid_option1 = {
  91. columns: [
  92. { display: '演练名称', name: 'DRILL_NAME_299', align: 'left', width: "15%",isPrimaryKey:true,
  93. render : function(rowdata, rowindex, value, column) {
  94. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  95. }
  96. },
  97. { display: '填报单位', name: 'UNITS_299_SHOW', align: 'center', width: "10%",showTitle:true},
  98. { display: '主办单位', name: 'SPONSOR_COMP_299_SHOW', align: 'center', width: "10%",showTitle:true},
  99. { display: '演练类别', name: 'DRILL_TYPE_299_SHOW', align: 'center' , width: "10%",showTitle:true},
  100. { display: '演练形式', name: 'DRILL_FORM_299_SHOW', align: 'center', width: "10%",showTitle:true},
  101. { display: '是否计划', name: 'IS_PLAN_299_SHOW', align: 'center', width: "5%",showTitle:true},
  102. { display: '计划时间', name: 'PLAN_TIME_299', align: 'center' , width: "10%",showTitle:true},
  103. { display: '是否完成', name: 'IMPLEMENT_STAT_299_SHOW', align: 'center' , width: "5%",showTitle:true},
  104. { display: '计划填报人', name: 'PLAN_MAKER_299_SHOW', align: 'center', width: "10%" ,showTitle:true},
  105. { display: '附件', isAllowHide: false, align: 'center', width:"5%",
  106. render: function (rowdata, rowindex, value, column){
  107. //判断是否有上传附件
  108. var fujian = '';
  109. if(ontest(rowdata.FD_OBJECTID_299)){
  110. fujian = '<span class="sendup_leaf hand" title="有附件" onclick="showFile(' + rowindex + ')"></span>';
  111. }else{
  112. fujian = '<span title="没附件" style="color: red">没有附件</span>';
  113. }
  114. return fujian;
  115. }
  116. },
  117. { display: '操作', isAllowHide: false, align: 'center', width:"5%",
  118. render: function (rowdata, rowindex, value, column){
  119. //判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09fashang_plan
  120. var shangbao='';
  121. //判断是否有上传附件
  122. // var fujian = '';
  123. // if(ontest(rowdata.FD_OBJECTID_299)){
  124. // fujian = '<span class="sendup_templan hand" title="有附件" onclick="showFile(' + rowindex + ')"></span>';
  125. // }else{
  126. // fujian = '<span title="没附件" >没有附件</span>';
  127. // }
  128. if(rowdata.IS_SHANGBAO_299=="1"){
  129. shangbao = '<span class="fashang_07 hand" title="发布" onclick="shangbao(' + rowindex + ')"></span>';
  130. }else{
  131. shangbao = '<span class="fashang_06 hand" title="发布" onclick="shangbao(' + rowindex + ')"></span>';
  132. }
  133. return shangbao/* + fujian*/;
  134. }
  135. }
  136. ],
  137. rownumbers : true,
  138. checkbox : true,
  139. sortName : 'UPDATEDATE_299',
  140. pageSize : 10,
  141. percentWidthMode : true,
  142. onAfterShowData:function(data){
  143. setHt();
  144. }
  145. };
  146. var options1={
  147. url :'/nwyj/ws/crud/CRUDService/queryQui',
  148. params:loadParams,
  149. gridOptions:grid_option1,
  150. singleRecodeOptions:{a:"aa"},
  151. paperOpration:{showInput:"true"},
  152. toolBarOptions:toolBarOpt1
  153. };
  154. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
  155. }
  156. //判断是否有附件
  157. function ontest(id){
  158. var bean = false;
  159. $.ajax({
  160. url : $.pathname() +"/ws/DrillCount/DrillCountService/getIsNoFile/",
  161. type : 'post',
  162. timeout : 60000,
  163. data : { fd_id : id },
  164. dataType : 'json',
  165. async:false,//返回值时注意同步异步问题,此时是同步状态
  166. success : function(result){
  167. if (result.Msg.sucsess == true) {
  168. bean = true;
  169. }
  170. },
  171. error : function(e){
  172. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  173. }
  174. });
  175. return bean;
  176. }
  177. // function onDownload(){
  178. // var rows = g.getSelectedRows();
  179. // if (rows.length == 0) {
  180. // top.Dialog.alert("请选择一条记录");
  181. // return;
  182. // }
  183. // if (rows.length > 1) {
  184. // top.Dialog.alert("只能选择一条记录");
  185. // return;
  186. // }
  187. // var fd_id = rows[0].FD_OBJECTID299;
  188. // showFile(fd_id);
  189. //
  190. // }
  191. function showFile(data){
  192. var row = g.getRow(data);
  193. var fd_id = row.FD_OBJECTID299;
  194. var diag = new top.Dialog();// 定义一个窗口对象
  195. diag.Title = "附件信息";// 窗口标题
  196. diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
  197. diag.Height = 400;
  198. diag.Width = 1000;
  199. diag.ShowOkButton=false;// 不显示确认按钮
  200. diag.ShowCancelButton=false;// 不显示取消按钮
  201. diag.ButtonAlign="center";// 按钮居中
  202. diag.show();// 显示窗口
  203. }
  204. function searchHandler(){
  205. $queryForm = $("#queryForm");
  206. if($("#DRILL_NAME_299").val()=="请输入演练的名称"){
  207. $("#DRILL_NAME_299").val("");
  208. }
  209. $queryForm.serialize();
  210. var $comp_id = $("#selectConditions").find(".UNITS");
  211. var loadParams11;
  212. //判断是否有用单位做查询条件
  213. if(!!$comp_id.prop("outerHTML")){
  214. loadParams11 = {
  215. "listId" : '299',
  216. "condition" : " IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or IS_SHANGBAO='1')",
  217. direction:'DESC',
  218. sort: 'UPDATEDATE'
  219. };
  220. }else{
  221. loadParams11 = $.extend({},loadParams,loadParams);
  222. }
  223. //获取选中的值
  224. var searchCondition = getSelectCon(conditionData);
  225. var queryParams = getQueryFormParams($queryForm);
  226. var params=$.extend({},loadParams11,queryParams);
  227. //与之前参数条件拼接
  228. params.condition = searchCondition.condition + params.condition;
  229. g.setOptions({"params":params});
  230. //加载数据
  231. g.rend();
  232. }
  233. function searchHandler2(){
  234. $queryForm = $("#queryForm");
  235. if($("#DRILL_NAME_299").val()=="请输入演练的名称"){
  236. $("#DRILL_NAME_299").val("");
  237. }
  238. var DRILL_NAME_299 = $("#DRILL_NAME_299").val();
  239. var TAKE_DATE1 = $('#TAKE_DATE1').val();
  240. var TAKE_DATE2 = $('#TAKE_DATE2').val();
  241. var ISSUE_DATE1 = $('#ISSUE_DATE1').val();
  242. var ISSUE_DATE2 = $('#ISSUE_DATE2').val();
  243. var DRILL_LINKMAN = $('#DRILL_LINKMAN').val();
  244. var LINKMENCALL = $('#LINKMENCALL').val();
  245. var condition = "";
  246. if(zTreeCompId=="" ||zTreeCompId==deptName){
  247. if(clickNum % 2 !=0){
  248. condition = "IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.DEPT_ID='"+deptName+"')))" ;
  249. }else{
  250. condition=" IS_DEL = '0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+deptName+"%' and dept_type='1'))) ";
  251. }
  252. }else{
  253. if(clickNum % 2 !=0){
  254. condition = "IS_DEL='0' AND (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.DEPT_ID='"+zTreeCompId+"'))" ;
  255. }else{
  256. condition =" IS_DEL='0' AND (IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+zTreeCompId+"%' and dept_type='1')) ";
  257. }
  258. }
  259. if(DRILL_NAME_299!=""){
  260. condition += " AND DRILL_NAME LIKE '%" +DRILL_NAME_299+"%'";
  261. }
  262. /***************************************时间****************************************/
  263. if((TAKE_DATE1!=""&&TAKE_DATE2=="")||(TAKE_DATE1==""&&TAKE_DATE2!="")){
  264. top.Dialog.alert("填报时间的开始日期或结束日期不能为空");
  265. return;
  266. }else if(TAKE_DATE1>TAKE_DATE2){
  267. top.Dialog.alert("填报时间的开始日期不能晚于结束日期");
  268. return;
  269. }else if(TAKE_DATE1!=""&&TAKE_DATE2!=""){
  270. condition += " AND REPORT_DATE BETWEEN '"+TAKE_DATE1+"' AND '"+TAKE_DATE2+"' ";
  271. }
  272. if((ISSUE_DATE1!=""&&ISSUE_DATE2=="")||(ISSUE_DATE1==""&&ISSUE_DATE2!="")){
  273. top.Dialog.alert("计划时间的开始日期或结束日期不能为空");
  274. return;
  275. }else if(ISSUE_DATE1>ISSUE_DATE2){
  276. top.Dialog.alert("计划时间的开始日期不能晚于结束日期");
  277. return;
  278. }else if(ISSUE_DATE1!=""&&ISSUE_DATE2!=""){
  279. condition += " AND PLAN_TIME BETWEEN '"+ISSUE_DATE1+"' AND '"+ISSUE_DATE2+"' ";
  280. }
  281. /************************************************************************/
  282. if(DRILL_LINKMAN!=""){
  283. condition += " AND DRILL_LINKMAN LIKE '%" +DRILL_LINKMAN+"%'";
  284. }
  285. if(LINKMENCALL!=""){
  286. condition += " AND LINKMENCALL LIKE '%" +LINKMENCALL+"%'";
  287. }
  288. /****************************************复选框查询******************************************/
  289. //实施状态
  290. var IMPLEMENT_STAT = "";
  291. $("input:checkbox[name=IMPLEMENT_STAT]").each(function(){
  292. if($(this).attr("checked")){
  293. if($(this).val()=="0000"){
  294. IMPLEMENT_STAT += " IMPLEMENT_STAT = '1' or IMPLEMENT_STAT = '0' or ";
  295. }else{
  296. IMPLEMENT_STAT += "IMPLEMENT_STAT = '" + $(this).val() +"' or ";
  297. }
  298. }
  299. });
  300. if(IMPLEMENT_STAT!=""){
  301. IMPLEMENT_STAT = IMPLEMENT_STAT.substring(0,IMPLEMENT_STAT.lastIndexOf("or"));
  302. condition += " and ("+IMPLEMENT_STAT+") ";
  303. }
  304. //上报状态
  305. var IS_SHANGBAO = "";
  306. $("input:checkbox[name=IS_SHANGBAO]").each(function(){
  307. if($(this).attr("checked")){
  308. if($(this).val()=="0000"){
  309. IS_SHANGBAO += " IS_SHANGBAO = '1' or IS_SHANGBAO = '0' or ";
  310. }else{
  311. IS_SHANGBAO += "IS_SHANGBAO = '" + $(this).val() +"' or ";
  312. }
  313. }
  314. });
  315. if(IS_SHANGBAO!=""){
  316. IS_SHANGBAO = IS_SHANGBAO.substring(0,IS_SHANGBAO.lastIndexOf("or"));
  317. condition += " and ("+IS_SHANGBAO+") ";
  318. }
  319. //演练类别
  320. var DRILL_TYPE = "";
  321. $("input:checkbox[name=DRILL_TYPE]").each(function(){
  322. if($(this).attr("checked")){
  323. if($(this).val()=="0000"){
  324. DRILL_TYPE += " DRILL_TYPE = '10' or DRILL_TYPE = '11' or ";
  325. }else{
  326. DRILL_TYPE += "DRILL_TYPE = '" + $(this).val() +"' or ";
  327. }
  328. }
  329. });
  330. if(DRILL_TYPE!=""){
  331. DRILL_TYPE = DRILL_TYPE.substring(0,DRILL_TYPE.lastIndexOf("or"));
  332. condition += " and ("+DRILL_TYPE+") ";
  333. }
  334. //细化类别
  335. var DRILL_REFINE_CATEGORY = "";
  336. $("input:checkbox[name=DRILL_REFINE_CATEGORY]").each(function(){
  337. if($(this).attr("checked")){
  338. if($(this).val()=="0000"){
  339. DRILL_REFINE_CATEGORY += " DRILL_REFINE_CATEGORY = '10' or DRILL_REFINE_CATEGORY = '11' or DRILL_REFINE_CATEGORY = '12' or DRILL_REFINE_CATEGORY = '13' or" +
  340. " DRILL_REFINE_CATEGORY = '14' or DRILL_REFINE_CATEGORY = '15' or DRILL_REFINE_CATEGORY = '16' or DRILL_REFINE_CATEGORY = '17' or" +
  341. " DRILL_REFINE_CATEGORY = '18' or DRILL_REFINE_CATEGORY = '19' or DRILL_REFINE_CATEGORY = '20' or DRILL_REFINE_CATEGORY = '21' or" +
  342. " DRILL_REFINE_CATEGORY = '22' or DRILL_REFINE_CATEGORY = '23' or DRILL_REFINE_CATEGORY = '24' or DRILL_REFINE_CATEGORY = '25' or" +
  343. " DRILL_REFINE_CATEGORY = '26' or DRILL_REFINE_CATEGORY = '27' or ";
  344. }else{
  345. DRILL_REFINE_CATEGORY += "DRILL_REFINE_CATEGORY = '" + $(this).val() +"' or ";
  346. }
  347. }
  348. });
  349. if(DRILL_REFINE_CATEGORY!=""){
  350. DRILL_REFINE_CATEGORY = DRILL_REFINE_CATEGORY.substring(0,DRILL_REFINE_CATEGORY.lastIndexOf("or"));
  351. condition += " and ("+DRILL_REFINE_CATEGORY+") ";
  352. }
  353. //演练形式
  354. var DRILL_FORM = "";
  355. $("input:checkbox[name=DRILL_FORM]").each(function(){
  356. if($(this).attr("checked")){
  357. if($(this).val()=="0000"){
  358. DRILL_FORM += " DRILL_FORM = '10' or DRILL_FORM = '11' or DRILL_FORM = '12' or DRILL_FORM = '13' or ";
  359. }else{
  360. DRILL_FORM += "DRILL_FORM = '" + $(this).val() +"' or ";
  361. }
  362. }
  363. });
  364. if(DRILL_FORM!=""){
  365. DRILL_FORM = DRILL_FORM.substring(0,DRILL_FORM.lastIndexOf("or"));
  366. condition += " and ("+DRILL_FORM+") ";
  367. }
  368. //是否计划
  369. var IS_PLAN = "";
  370. $("input:checkbox[name=IS_PLAN]").each(function(){
  371. if($(this).attr("checked")){
  372. if($(this).val()=="0000"){
  373. IS_PLAN += " IS_PLAN = '0' or IS_PLAN = '1' or ";
  374. }else{
  375. IS_PLAN += "IS_PLAN = '" + $(this).val() +"' or ";
  376. }
  377. }
  378. });
  379. if(IS_PLAN!=""){
  380. IS_PLAN = IS_PLAN.substring(0,IS_PLAN.lastIndexOf("or"));
  381. condition += " and ("+IS_PLAN+") ";
  382. }
  383. // $queryForm.serialize();
  384. // var $comp_id = $("#selectConditions").find(".UNITS");
  385. // var loadParams11;
  386. // //判断是否有用单位做查询条件
  387. // if(!!$comp_id.prop("outerHTML")){
  388. //
  389. // loadParams11 = {
  390. // "listId" : '299',
  391. // "condition" : " IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or IS_SHANGBAO='1')",
  392. // direction:'DESC',
  393. // sort: 'UPDATEDATE'
  394. // };
  395. // }else{
  396. //
  397. // loadParams11 = $.extend({},loadParams,loadParams);
  398. // }
  399. // //获取选中的值
  400. // var searchCondition = getSelectCon(conditionData);
  401. // var queryParams = getQueryFormParams($queryForm);
  402. // var params=$.extend({},loadParams11,queryParams);
  403. // //与之前参数条件拼接
  404. // params.condition = searchCondition.condition + params.condition;
  405. // g.setOptions({"params":params});
  406. g.setOptions({//重置加载列表的参数
  407. params : {
  408. "listId" :'299' ,
  409. "condition" : condition,
  410. direction:'DESC',
  411. sort: 'UPDATEDATE'
  412. }
  413. });
  414. //加载数据
  415. g.rend();
  416. }
  417. function resetSearch(){
  418. $('#DRILL_NAME_299').val("");
  419. $('#TAKE_DATE1').val("");
  420. $('#TAKE_DATE2').val("");
  421. $('#ISSUE_DATE1').val("");
  422. $('#ISSUE_DATE2').val("");
  423. $('#DRILL_LINKMAN').val("");
  424. $('#LINKMENCALL').val("");
  425. $("input:checkbox[name=IMPLEMENT_STAT]").attr("checked",false);
  426. $("input:checkbox[name=IS_SHANGBAO]").attr("checked",false);
  427. $("input:checkbox[name=DRILL_TYPE]").attr("checked",false);
  428. $("input:checkbox[name=DRILL_REFINE_CATEGORY]").attr("checked",false);
  429. $("input:checkbox[name=DRILL_FORM]").attr("checked",false);
  430. $("input:checkbox[name=IS_PLAN]").attr("checked",false);
  431. }
  432. //新增
  433. function addUnit(){
  434. window.location.href="emc-drill-add.jsp";
  435. //测试演练逾期window.location.href="emc-drillYuqi.jsp";
  436. }
  437. //修改
  438. function updateUnit(rowid){
  439. var rows = g.getSelectedRows();
  440. if(rows.length==0){
  441. top.Dialog.alert("请选择一条记录");
  442. return;
  443. }
  444. if(rows.length>1){
  445. top.Dialog.alert("只能选择一条记录");
  446. return;
  447. }
  448. for(var i=0; i< roleidTemp.length; i++){
  449. if(roleidTemp[i]=="R002105430200"){
  450. flag="1";
  451. }
  452. }
  453. var PLAN_MAKER_299 = rows[0].PLAN_MAKER_299;;
  454. var tianbaorenID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  455. if(PLAN_MAKER_299!=tianbaorenID&&flag=="0"){
  456. top.Dialog.alert("不能修改别人上传的演练计划!");
  457. return;
  458. }
  459. var fd_id= rows[0].FD_OBJECTID299;
  460. window.location.href="emc-drill-update.jsp?"+fd_id;
  461. }
  462. //删除
  463. function deleteUnit(){
  464. var rows = g.getSelectedRows();
  465. var rowsLength = rows.length;
  466. if (rowsLength == 0) {
  467. top.Dialog.alert("请选中要删除的记录!");
  468. return;
  469. }
  470. for(var i=0; i< roleidTemp.length; i++){
  471. if(roleidTemp[i]=="R002105430200"){
  472. flag="1";
  473. }
  474. }
  475. var ids = "";
  476. var fd_sb ="";
  477. var PLAN_MAKER_299;
  478. var tianbaorenID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  479. for ( var i = 0; i < rowsLength; i++) {
  480. ids += rows[i].FD_OBJECTID299 + ",";
  481. fd_sb = rows[i].IS_SHANGBAO_299;
  482. PLAN_MAKER_299 = rows[i].PLAN_MAKER_299;
  483. if(fd_sb=="1"&&flag=="0"){
  484. top.Dialog.alert("发布的应急演练不能删除!");
  485. return;
  486. }
  487. if(PLAN_MAKER_299!=tianbaorenID&&flag=="0"){
  488. top.Dialog.alert("不能删除别人上传的演练计划!");
  489. return;
  490. }
  491. }
  492. top.Dialog.confirm("确定要删除吗?|删除", function() {
  493. // 删除记录
  494. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  495. "objectIDs" : ids,
  496. classid : 299
  497. }, function(result) {
  498. if (result.Msg.sucsess == true) {
  499. $.messager.alert("删除成功",null,null,null,1);
  500. // 刷新表格数据
  501. g.rend();
  502. } else {
  503. top.Dialog.alert("删除失败!");
  504. }
  505. }, "json");
  506. });
  507. }
  508. //单个删除
  509. function onDelete(rowid){
  510. var row = g.getRow(rowid);
  511. var fd_shangbao = row.IS_SHANGBAO_299;
  512. if(fd_shangbao=="1"){
  513. top.Dialog.alert("发布的应急演练不能删除!");
  514. return;
  515. }
  516. var fd_id= row.FD_OBJECTID299;
  517. top.Dialog.confirm("确定要删除该记录吗?",function(){
  518. //删除记录
  519. $.post($.pathname() +"/ws/crud/CRUDService/delete/",{
  520. "objectIDs" : fd_id,
  521. classid : 299
  522. },function(result){
  523. if(result.Msg.sucsess == true){
  524. top.Dialog.alert("删除成功!",null,null,null,1);
  525. }else{
  526. top.Dialog.alert("删除失败!");
  527. }
  528. //刷新表格
  529. g.loadData();
  530. },"json");
  531. });
  532. }
  533. //导入
  534. function showImportDialog(){
  535. window.location.href="emc-drill-import.jsp";
  536. }
  537. //导出
  538. function exportTotalData(){
  539. var rows = g.getSelectedRows();
  540. var rowsLength = rows.length;
  541. if (rowsLength == 0) {
  542. top.Dialog.confirm("是否导出所有的应急演练计划?|确定", function() {
  543. excelExport(299,loadParams,"应急演练计划","IS_DEL,UPDATEDATE,FD_OBJECTID,IS_SHANGBAO,DRILL_VIEW_CONTENT,DRILL_SCHEME,APPEAR_COMP,FINAL_REPORT,NOTICE_TIME,PLAN_MAKER,PLAN_STAT");});
  544. return;
  545. }
  546. var ids = "";
  547. for ( var i = 0; i < rowsLength; i++) {
  548. ids += "'"+rows[i].FD_OBJECTID299+"'" + ",";
  549. }
  550. var temp = ids.substring(0,ids.length-1);
  551. var condition = " IS_DEL='0' ";
  552. condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%';
  553. var sql = {
  554. "listId" :'299' ,
  555. "condition" : condition,
  556. direction:'DESC',
  557. sort: 'UPDATEDATE'
  558. };
  559. excelExport(299,sql,"应急演练计划","IS_DEL,UPDATEDATE,FD_OBJECTID,IS_SHANGBAO,DRILL_VIEW_CONTENT,DRILL_SCHEME,APPEAR_COMP,FINAL_REPORT,NOTICE_TIME,PLAN_MAKER,PLAN_STAT");
  560. }
  561. //点击查看
  562. function jumpPage(id){
  563. window.location.href="emc-drill-info.jsp?"+id;
  564. }
  565. //点击主键跳转详细信息页面
  566. this.openDetail = function(rowindex) {
  567. var row = g.getRow(rowindex);
  568. var fd_id = row.FD_OBJECTID299;
  569. //window.location.href="emc-drill-info.jsp?"+fd_id;
  570. $.indexOpenNextWindow("/nwyj/page/business/am/drill/emc-drill-info.jsp?"+fd_id);
  571. };
  572. function showPrimaryKey(obj,index){
  573. var fd_id = obj.FD_OBJECTID299;
  574. // window.location.href="emc-drill-info.jsp?"+fd_id;
  575. $.indexOpenNextWindow("/nwyj/page/business/am/drill/emc-drill-info.jsp?"+fd_id);
  576. }
  577. //详情
  578. function onView(rowid){
  579. var rows = g.getSelectedRows();
  580. if(rows.length==0){
  581. top.Dialog.alert("请选择一条记录");
  582. return;
  583. }
  584. if(rows.length>1){
  585. top.Dialog.alert("只能选择一条记录");
  586. return;
  587. }
  588. // var row = g.getRow(rowid);
  589. // var fd_id= row.FD_OBJECTID299;
  590. var fd_id= rows[0].FD_OBJECTID299;
  591. window.location.href="emc-drill-info.jsp?"+fd_id;
  592. }
  593. //上报(修改预案的状态)
  594. function shangbao(data){
  595. var row = g.getRow(data);
  596. var fd_id = row.FD_OBJECTID299;
  597. var shangbao = row.IS_SHANGBAO_299;
  598. if(shangbao=="1"){
  599. top.Dialog.alert("该演练计划已经发布!");
  600. return;
  601. }
  602. top.Dialog.confirm("确定要发布吗?|发布", function() {
  603. // 上报
  604. $.post($.pathname() +"/ws/DrillCount/DrillCountService/appear/", {
  605. //当前单位id
  606. comp_id : 299,
  607. fd_id : fd_id,
  608. }, function(result) {
  609. if (result.Msg.sucsess == true) {
  610. $.messager.alert("发布成功",null,null,null,-1);
  611. //推送
  612. fillShangbao(data);
  613. // 刷新表格数据 上报成功后不能刷新表格
  614. g.rend();
  615. } else {
  616. top.Dialog.alert("发布失败!");
  617. }
  618. }, "json");
  619. });
  620. }
  621. function showSameLevel(){
  622. if(zTreeCompId == ""){
  623. top.Dialog.alert("请在左侧菜单选择单位再查看演练信息!");
  624. return;
  625. }
  626. var condition = "";
  627. clickNum++;
  628. if(zTreeCompId==deptName){//点击本单位时
  629. if(clickNum % 2 !=0){
  630. $("#10007").addClass("blue");
  631. $("#10007 span").text("查看本级单位演练(含下级)");
  632. condition = "IS_DEL='0' AND (PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN('"+zTreeCompId+"')))" ;
  633. }else{
  634. $("#10007").removeClass("blue");
  635. $("#10007 span").text("查看本级单位演练");
  636. condition = "IS_DEL='0' AND (PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+zTreeCompId+"%' and dept_type='1')))" ;
  637. }
  638. }else{
  639. if(clickNum % 2 !=0){
  640. $("#10007").addClass("blue");
  641. $("#10007 span").text("查看本级单位演练(含下级)");
  642. condition = "IS_DEL='0' and IS_SHANGBAO='1' and UNITS IN('"+zTreeCompId+"') ";
  643. }else{
  644. $("#10007").removeClass("blue");
  645. $("#10007 span").text("查看本级单位演练");
  646. condition = "IS_DEL='0' and IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+zTreeCompId+"%' and dept_type='1') ";
  647. }
  648. }
  649. g.setOptions({//重置加载列表的参数
  650. params : {
  651. "listId" :'299' ,
  652. "condition" : condition,
  653. direction:'DESC',
  654. sort: 'UPDATEDATE'
  655. }
  656. });
  657. g.rend();
  658. }
  659. //上报前先给上级单位公共消息库里插入一条记录
  660. /**
  661. * 1、取本级单位ID
  662. * 2、上报人ID
  663. * 3、上报消息主键
  664. * 4、服务名称(URL)
  665. **/
  666. function fillShangbao(data){
  667. var row = g.getRow(data);
  668. var fd_id = row.FD_OBJECTID299;
  669. //向后台发送请求调用dwr
  670. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgDwr/';
  671. var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/public/emc-drill-info.jsp?"+fd_id+"')\">"+corp_name+"的应急演练</a>";
  672. //var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/contingencyPlan/PlanAdd.jsp')\">应急预案</a>";
  673. var params = {
  674. parentDeptName:parent_ids,
  675. msg:msg
  676. };
  677. $.ajax({
  678. url : url,
  679. type : 'post',
  680. data : params,
  681. dataType : 'text',
  682. timeout : 60000,
  683. success : function(data){
  684. },
  685. error : function(){
  686. // $.messager.alert('操作失败');
  687. }
  688. });
  689. }
  690. function onReport(id){
  691. top.Dialog.alert("发布");
  692. }
  693. //统计
  694. function sumUnit(){
  695. window.location.href="emc-drill-poll.jsp";
  696. }
  697. //短信
  698. function sendMsg(){
  699. window.location.href="NoticeTime.jsp";
  700. }
  701. function more() {
  702. $('#moreDiv').toggle(400,function(){
  703. // $("#emptyCondition").click();
  704. // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  705. //setHt();
  706. checkAndSetHeight();//changeFormat.js
  707. });
  708. }
  709. function setHt(){
  710. /* alert($("#layout1 .padding_right5").height())
  711. alert($("#layout1 .selDiv").height());
  712. alert($(".l-layout-left").height()); */
  713. var leftHeight = $(".layout_content").height()+70;
  714. var rightHeight = $("#layout1 .padding_right5").height()+$("#layout1 #moreDiv").height()+70;
  715. var height = leftHeight>rightHeight?leftHeight:rightHeight;
  716. $(top.document.body).find("#frmright").height($(window.document.body).height(height)+30);
  717. }
  718. //撤销
  719. function noPublish(){
  720. var rows = g.getSelectedRows();
  721. var rowsLength = rows.length;
  722. if (rowsLength == 0) {
  723. top.Dialog.alert("请选中要撤销的记录!");
  724. return;
  725. } else if (rowsLength > 1) {
  726. top.Dialog.alert("请选中一条要撤销的记录!");
  727. return;
  728. }
  729. var ids = "";
  730. for ( var i = 0; i < rowsLength; i++) {
  731. ids += rows[i].FD_OBJECTID299 + ",";
  732. //判断是否包含已经上报的记录
  733. if(rows[i].IS_SHANGBAO_299=="0"){
  734. top.Dialog.alert("您选中的记录还未发布!");
  735. return;
  736. }
  737. }
  738. top.Dialog.confirm("确定要撤销发布吗?|撤销", function() {
  739. $.post($.pathname() +"/ws/DrillCount/DrillCountService/noAppear/", {
  740. fd_id : ids,
  741. }, function(result) {
  742. if (result.Msg.sucsess == true) {
  743. $.messager.alert("撤销成功",null,null,null,-1);
  744. g.rend();// 刷新表格数据
  745. } else {
  746. top.Dialog.alert("撤销失败!");
  747. }
  748. }, "json");
  749. });
  750. }
  751. $.messager=top.Dialog;