ccba4059a53a8b7961b63ad7bf0aadc9cdbabdf1.svn-base 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029
  1. laws = function() {
  2. /** 定义变量* */
  3. var _this = this;
  4. _this.listGrid = null;// 数据列表
  5. //_this.searchPanel = null; // 查询面板
  6. $queryForm = null;// 查询区域表单
  7. $searchButt = null;// 查询按钮
  8. $more = null; // 更多
  9. _this.loadParams = null;// 列表加载参数
  10. //取登录人应急角色
  11. var Roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids() + ",";
  12. var roleidTemp =Roleid.split(",");
  13. var flag="0";
  14. /** *新增信息** */
  15. _this.addForm = function() {
  16. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_add.jsp");
  17. };
  18. /** *修改、删除信息 各级单位的超级管理员可以修改表单信息。湛江局许永山提的建议 2016-05-31** */
  19. _this.editForm = function() {
  20. var rows = _this.listGrid.getSelectedRows();
  21. var rowsLength = rows.length;
  22. if (rowsLength == 0) {
  23. top.Dialog.alert("请选中要修改的记录!");
  24. return;
  25. } else if (rowsLength > 1) {
  26. top.Dialog.alert("请选中一条要修改的记录!");
  27. return;
  28. } else {
  29. for(var i=0; i< roleidTemp.length; i++){
  30. if(roleidTemp[i]=="R002105430200"){
  31. flag="1";
  32. }
  33. }
  34. if(rows[0].COLUMN_3_243=="1"&&flag=="0"){
  35. top.Dialog.alert("发布后的记录不能够修改!");
  36. return;
  37. }
  38. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  39. if(getUser_id!=rows[0].TYPEIN_PEOPLE_243&&flag=="0"){
  40. top.Dialog.alert("只能修改自己上传的文件!");
  41. return;
  42. }
  43. var fd_id = rows[0].FD_OBJECTID243;
  44. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_edit.jsp?"+fd_id);
  45. }
  46. };
  47. /** *删除信息** */
  48. _this.del = function(){
  49. var rows = _this.listGrid.getSelectedRows();
  50. var rowsLength = rows.length;
  51. if (rowsLength == 0) {
  52. top.Dialog.alert("请选中要删除的记录!");
  53. return;
  54. }
  55. for(var i=0; i< roleidTemp.length; i++){
  56. if(roleidTemp[i]=="R002105430200"){
  57. flag="1";
  58. }
  59. }
  60. var ids = "";
  61. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  62. var flag1 = false;
  63. for ( var i = 0; i < rowsLength; i++) {
  64. ids += rows[i].FD_OBJECTID243 + ",";
  65. if(rows[i].COLUMN_3_243=="1"&&flag=="0"){
  66. if(rowsLength==1){
  67. top.Dialog.alert("您选中的记录已发布,不能删除!");
  68. }else{
  69. top.Dialog.alert("您选中的记录中有已发布的,不能删除!");
  70. }
  71. return;
  72. }
  73. if(getUser_id!=rows[i].TYPEIN_PEOPLE_243&&flag=="0"){
  74. if(rowsLength==1){
  75. top.Dialog.alert("您只能删除您自己上传的文件记录!");
  76. }else{
  77. top.Dialog.alert("您只能删除您自己上传的文件记录!");
  78. }
  79. return;
  80. }
  81. $.ajax({
  82. url : $.pathname() + '/ws/crud/CRUDService/getDataById/',
  83. type : 'post',
  84. timeout : 60000,
  85. data : { classid : '800', objectID : rows[i].UNITE_243 },
  86. async:false, //异步
  87. dataType : 'json',
  88. success : function(data){
  89. if(data.DEPT_LEVEL_800<dept_level){
  90. flag1 = true;
  91. }
  92. },
  93. error : function(e){
  94. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  95. }
  96. });
  97. }
  98. if(flag1){
  99. top.Dialog.alert("不能删除上级的记录!");
  100. return;
  101. }else{
  102. top.Dialog.confirm("确定要删除吗?|删除", function() {
  103. // 删除记录
  104. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  105. "objectIDs" : ids,
  106. classid : 243
  107. }, function(result) {
  108. if (result.Msg.sucsess == true) {
  109. $.messager.alert("删除成功",null,null,null,1);
  110. // 刷新表格数据
  111. _this.listGrid.rend();
  112. } else {
  113. top.Dialog.alert("删除失败!");
  114. }
  115. }, "json");
  116. });
  117. }
  118. };
  119. /** **查看详细信息*** */
  120. _this.show = function() {
  121. var rows = _this.listGrid.getSelectedRows();
  122. var rowsLength = rows.length;
  123. if (rowsLength == 0) {
  124. top.Dialog.alert("请选中要查看的记录!");
  125. return;
  126. } else if (rowsLength > 1) {
  127. top.Dialog.alert("请选中一条要查看的记录!");
  128. return;
  129. } else {
  130. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID243;
  131. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id);
  132. }
  133. };
  134. //点击主键跳转详细信息页面
  135. _this.openDetail = function(rowindex) {
  136. var row = _this.listGrid.getRow(rowindex);
  137. var fd_id = row.FD_OBJECTID243;
  138. // $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id);
  139. $.indexOpenNextWindow("/nwyj/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id);
  140. };
  141. /** **历史版本*** */
  142. _this.onhistory = function() {
  143. var rows = _this.listGrid.getSelectedRows();
  144. if(rows.length==0){
  145. top.Dialog.alert("请选择一条记录");
  146. return;
  147. }
  148. if(rows.length>1){
  149. top.Dialog.alert("只能选择一条记录");
  150. return;
  151. }
  152. //上一个版本的预案ID
  153. // var fd_id = rows[0].OBJ_FIRST_243;
  154. var fd_id = rows[0].FD_OBJECTID243;
  155. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_version.jsp?"+fd_id);
  156. };
  157. /** **导出*** */
  158. _this.exportTotalData = function() {
  159. var rows = _this.listGrid.getSelectedRows();
  160. var rowsLength = rows.length;
  161. if (rowsLength == 0) {
  162. top.Dialog.confirm("是否导出所有的文件信息?|是", function() {
  163. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  164. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  165. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  166. var loadParams ={
  167. "listId" :'243' ,
  168. // "condition" : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id) ",
  169. "condition" : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE ='"+dpids+"' ",
  170. direction:'DESC',
  171. sort: 'UPDATEDATE'
  172. };
  173. excelExport(243,loadParams,"应急制度文件信息","IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_2,COLUMN_3,COLUMN_4,OBJ_FIRST,VERSION,TYPEIN_PEOPLE_PHONE_NUM");
  174. });
  175. return;
  176. }
  177. var ids = "";
  178. for ( var i = 0; i < rowsLength; i++) {
  179. ids += "'"+rows[i].FD_OBJECTID243+"'" + ",";
  180. }
  181. var temp = ids.substring(0,ids.length-1);
  182. var condition = " IS_DEL='0' ";
  183. condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%';
  184. var sql = {
  185. "listId" :'243' ,
  186. "condition" : condition,
  187. direction:'DESC',
  188. sort: 'UPDATEDATE'
  189. };
  190. excelExport(243,sql,"应急制度文件","IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_2,COLUMN_3,COLUMN_4,OBJ_FIRST,VERSION,TYPEIN_PEOPLE_PHONE_NUM");
  191. };
  192. /** 导入 */
  193. _this.showImportDialog = function() {
  194. window.location.href="laws-import.jsp";
  195. };
  196. /************************************** **下载*** *************************************************/
  197. _this.onDownLoad = function() {
  198. //批量打包下载
  199. var FD_OBJECTID = "";
  200. var rows = _this.listGrid.getSelectedRows();
  201. if(rows.length==0){
  202. top.Dialog.alert("请选择一条记录");
  203. return;
  204. }
  205. for (var i = 0; i < rows.length; i++) {
  206. var FD_OBJECTID1= rows[i].FD_OBJECTID243;//预案的主键
  207. FD_OBJECTID += "'"+FD_OBJECTID1+"'" + ",";//预案的主键(复数)
  208. }
  209. var temp = FD_OBJECTID.substring(0,FD_OBJECTID.length-1);
  210. //发送请求,获取文件名的集合。
  211. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanFile/';
  212. var params = {
  213. fileId : temp
  214. };
  215. var SAVENAME1="";
  216. var NAME1 = "";
  217. var FILEEXT1="";
  218. $.ajax({
  219. url : url,
  220. type : 'post',
  221. timeout : 60000,
  222. data : params,
  223. dataType : 'json',
  224. success : function(data){
  225. var dataLenth = data.rows.length;
  226. var filenames="";
  227. var downfilename = "";
  228. for (var i = 0; i < dataLenth; i++) {
  229. SAVENAME1= data.rows[i].SAVENAME;
  230. NAME1= data.rows[i].NAME;
  231. FILEEXT1= data.rows[i].FILEEXT;
  232. filenames +=SAVENAME1 + "." + FILEEXT1 + ";";
  233. downfilename+=NAME1 + "." + FILEEXT1 + ";";
  234. }
  235. var filenames1 = filenames.substring(0,filenames.length-1);
  236. filenames = decodeURI(filenames1);
  237. var downfilename1 = downfilename.substring(0,downfilename.length-1);
  238. downfilename = decodeURI(downfilename1);
  239. showFile(filenames1,downfilename1);
  240. //alert(downfilename1+"============"+filenames1);
  241. //返回回调打包下载的函数,拼传给回调函数的filenames,downfilename
  242. },
  243. error : function(e){
  244. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  245. }
  246. });
  247. };
  248. function showFile(downfilename,filenames){
  249. var url = "/nwyj/page/business/am/org/query/getZipFile.jsp?downfilename="+downfilename+"&filenames="+filenames;
  250. window.open(url);
  251. }
  252. /****************************************************end******************************************************/
  253. /** **统计*** */
  254. _this.sum = function() {
  255. window.location.href="laws_poll.jsp";
  256. };
  257. // 查询
  258. // function search() {
  259. //
  260. // if($("#LAWS_REGULATIONS_NAME_243").val()=="法律法规"){
  261. // $("#LAWS_REGULATIONS_NAME_243").val("");
  262. // }
  263. // $queryForm.serialize();
  264. // var $comp_id = $("#selectConditions").find(".UNITE");
  265. // var loadParams11;
  266. // //判断是否有用单位做查询条件
  267. // if(!!$comp_id.prop("outerHTML")){
  268. //
  269. // loadParams11 = {
  270. // "listId" : '243',
  271. // "condition" : " IS_DEL='0' AND COLUMN_3='1' ",
  272. // direction:'DESC',
  273. // sort: 'UPDATEDATE'
  274. // };
  275. // }else{
  276. //
  277. // loadParams11 = $.extend({},_this.loadParams,loadParams);
  278. // }
  279. // var searchCondition = getSelectCon(conditionData);
  280. // var queryParams = getQueryFormParams($queryForm);
  281. // var params=$.extend({},loadParams11,queryParams);// 默认
  282. // params.condition = searchCondition.condition + params.condition;
  283. // _this.exportParams = params;
  284. // _this.listGrid.setOptions( {
  285. // params : params
  286. // });
  287. // _this.listGrid.rend();//加载数据
  288. // }
  289. function search(){
  290. if($("#LAWS_REGULATIONS_NAME").val()=="法律法规"){
  291. $("#LAWS_REGULATIONS_NAME").val("");
  292. }
  293. var name = $("#LAWS_REGULATIONS_NAME").val();
  294. //部门id
  295. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  296. //登录人ID
  297. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  298. //父部门id
  299. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  300. $queryForm.serialize();
  301. var $comp_id = $("#selectConditions").find(".UNITE");
  302. var loadParams11;
  303. //判断是否有用单位做查询条件
  304. if(!!$comp_id.prop("outerHTML")){
  305. if(name!=""){
  306. loadParams11 = {
  307. "listId" : '243',
  308. "condition" : " IS_DEL='0' AND (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')",
  309. direction:'DESC',
  310. sort: 'UPDATEDATE'
  311. };
  312. }else{
  313. loadParams11 = {
  314. "listId" : '243',
  315. "condition" : " IS_DEL='0' AND (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) ",
  316. direction:'DESC',
  317. sort: 'UPDATEDATE'
  318. };
  319. }
  320. }else{
  321. if(name==""){
  322. loadParams11 = $.extend({},_this.loadParams,loadParams);
  323. }else{
  324. loadParams11 = {
  325. "listId" : '243',
  326. "condition" : " is_del='0' and (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id) and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')",
  327. direction:'DESC',
  328. sort: 'UPDATEDATE'
  329. };
  330. }
  331. }
  332. var searchCondition = getSelectCon(conditionData);
  333. var ff = searchCondition.condition.split("and");
  334. var queryParams = getQueryFormParams($queryForm);
  335. var params=$.extend({},loadParams11,queryParams);// 默认
  336. params.condition = searchCondition.condition + params.condition;
  337. _this.exportParams = params;
  338. _this.listGrid.setOptions( {
  339. params : params
  340. });
  341. _this.listGrid.rend();//加载数据
  342. };
  343. _this.searchHandler2 = function(){
  344. if($("#LAWS_REGULATIONS_NAME").val()=="请输入法律法规名称"){
  345. $("#LAWS_REGULATIONS_NAME").val("");
  346. }
  347. //部门id
  348. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  349. //登录人ID
  350. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  351. //父部门id
  352. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  353. var name = $("#LAWS_REGULATIONS_NAME").val();
  354. var TAKE_DATE1 = $('#TAKE_DATE1').val();
  355. var TAKE_DATE2 = $('#TAKE_DATE2').val();
  356. var ISSUE_DATE1 = $('#ISSUE_DATE1').val();
  357. var ISSUE_DATE2 = $('#ISSUE_DATE2').val();
  358. var ISSUE_ORGANIZATION = $("#ISSUE_ORGANIZATION").val();
  359. var condition = "";
  360. if(zTreeCompId=="" || zTreeCompId==dpids){
  361. // condition = "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id)";
  362. condition = "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE ='"+dpids+"' ";
  363. }else{
  364. condition = "is_del='0' and COLUMN_3='1' and UNITE='"+zTreeCompId+"' ";
  365. }
  366. if(name!=""){
  367. condition += " AND LAWS_REGULATIONS_NAME LIKE '%" +name+"%'";
  368. }
  369. if(ISSUE_ORGANIZATION!=""){
  370. condition += " AND ISSUE_ORGANIZATION LIKE '%" +ISSUE_ORGANIZATION+"%'";
  371. }
  372. /***************时间*******************/
  373. if((TAKE_DATE1!=""&&TAKE_DATE2=="")||(TAKE_DATE1==""&&TAKE_DATE2!="")){
  374. top.Dialog.alert("发布日期的开始日期或结束日期不能为空");
  375. return;
  376. }else if(TAKE_DATE1>TAKE_DATE2){
  377. top.Dialog.alert("发布日期的开始日期不能晚于结束日期");
  378. return;
  379. }else if(TAKE_DATE1!=""&&TAKE_DATE2!=""){
  380. condition += " AND ISSUE_DATE BETWEEN '"+TAKE_DATE1+"' AND '"+TAKE_DATE2+"' ";
  381. }
  382. if((ISSUE_DATE1!=""&&ISSUE_DATE2=="")||(ISSUE_DATE1==""&&ISSUE_DATE2!="")){
  383. top.Dialog.alert("实施日期的开始日期或结束日期不能为空");
  384. return;
  385. }else if(ISSUE_DATE1>ISSUE_DATE2){
  386. top.Dialog.alert("实施日期的开始日期不能晚于结束日期");
  387. return;
  388. }else if(ISSUE_DATE1!=""&&ISSUE_DATE2!=""){
  389. condition += " AND IMPLEMENT_DATE BETWEEN '"+ISSUE_DATE1+"' AND '"+ISSUE_DATE2+"' ";
  390. }
  391. /****************复选框查询******************/
  392. //分类
  393. var CLASSES = "";
  394. $("input:checkbox[name=CLASSES]").each(function(){
  395. if($(this).attr("checked")){
  396. if($(this).val()=="0000"){
  397. CLASSES += " CLASSES = '1' or CLASSES = '2' or CLASSES = '3' or CLASSES = '4' or CLASSES = '5' or ";
  398. }else{
  399. CLASSES += "CLASSES = '" + $(this).val() +"' or ";
  400. }
  401. }
  402. });
  403. if(CLASSES!=""){
  404. CLASSES = CLASSES.substring(0,CLASSES.lastIndexOf("or"));
  405. condition += " and ("+CLASSES+") ";
  406. }
  407. //状态
  408. var STATE = "";
  409. $("input:checkbox[name=STATE]").each(function(){
  410. if($(this).attr("checked")){
  411. if($(this).val()=="0000"){
  412. STATE += " STATE = '1' or STATE = '2' or STATE = '3' or STATE = '4' or STATE = '5' or ";
  413. }else{
  414. STATE += "STATE = '" + $(this).val() +"' or ";
  415. }
  416. }
  417. });
  418. if(STATE!=""){
  419. STATE = STATE.substring(0,STATE.lastIndexOf("or"));
  420. condition += " and ("+STATE+") ";
  421. }
  422. //发布情况
  423. var COLUMN_3 = "";
  424. $("input:checkbox[name=COLUMN_3]").each(function(){
  425. if($(this).attr("checked")){
  426. if($(this).val()=="0000"){
  427. COLUMN_3 += " COLUMN_3 = '1' or COLUMN_3 = '0' or ";
  428. }else{
  429. COLUMN_3 += "COLUMN_3 = '" + $(this).val() +"' or ";
  430. }
  431. }
  432. });
  433. if(COLUMN_3!=""){
  434. COLUMN_3 = COLUMN_3.substring(0,COLUMN_3.lastIndexOf("or"));
  435. condition += " and ("+COLUMN_3+") ";
  436. }
  437. // $queryForm.serialize();
  438. // var $comp_id = $("#selectConditions").find(".UNITE");
  439. // var loadParams11;
  440. // //判断是否有用单位做查询条件
  441. // if(!!$comp_id.prop("outerHTML")){
  442. // if(name!=""){
  443. // loadParams11 = {
  444. // "listId" : '243',
  445. // "condition" : " IS_DEL='0' AND COLUMN_3='1' and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')",
  446. // direction:'DESC',
  447. // sort: 'UPDATEDATE'
  448. // };
  449. // }else{
  450. // loadParams11 = {
  451. // "listId" : '243',
  452. // "condition" : " IS_DEL='0' AND COLUMN_3='1' ",
  453. // direction:'DESC',
  454. // sort: 'UPDATEDATE'
  455. // };
  456. // }
  457. // }else{
  458. // if(name==""){
  459. // loadParams11 = $.extend({},_this.loadParams,loadParams);
  460. // }else{
  461. // loadParams11 = {
  462. // "listId" : '243',
  463. // "condition" : " is_del='0' and (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id) and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')",
  464. // direction:'DESC',
  465. // sort: 'UPDATEDATE'
  466. // };
  467. // }
  468. //
  469. // }
  470. // var searchCondition = getSelectCon(conditionData);
  471. // var queryParams = getQueryFormParams($queryForm);
  472. // var params=$.extend({},loadParams11,queryParams);// 默认
  473. // params.condition = searchCondition.condition + params.condition;
  474. // _this.exportParams = params;
  475. // _this.listGrid.setOptions( {
  476. // params : params
  477. // });
  478. _this.listGrid.setOptions({//重置加载列表的参数
  479. params : {
  480. "listId" :'243' ,
  481. "condition" : condition,
  482. direction:'DESC',
  483. sort: 'UPDATEDATE'
  484. }
  485. });
  486. _this.listGrid.rend();//加载数据
  487. };
  488. function more() {
  489. $('#moreDiv').toggle(400,function(){
  490. // $("#emptyCondition").click();
  491. // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  492. // setHt();
  493. checkAndSetHeight();//changeFormat.js
  494. });
  495. }
  496. function setHt(){
  497. /* alert($("#layout1 .padding_right5").height())
  498. alert($("#layout1 .selDiv").height());
  499. alert($(".l-layout-left").height()); */
  500. var leftHeight = $(".layout_content").height()+70;
  501. var rightHeight = $("#layout1 .padding_right5").height()+$("#layout1 #moreDiv").height()+70;
  502. var height = leftHeight>rightHeight?leftHeight:rightHeight;
  503. $(top.document.body).find("#frmright").height($(window.document.body).height(height)+30);
  504. }
  505. /*// 更多
  506. function more() {
  507. $('#moreDiv').toggle();
  508. $(parent.document.body).find("#frmright").height($(window.document.body).height());
  509. }*/
  510. /*************************************************************************************************/
  511. //发布 单一
  512. _this.fabu = function(data) {
  513. var row = _this.listGrid.getRow(data);
  514. var fd_id = row.FD_OBJECTID243+",";
  515. //只能发布自己上传的文件
  516. var userId = row.TYPEIN_PEOPLE_243;
  517. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  518. if(getUser_id!=userId){
  519. top.Dialog.alert("只能发布自己上传的文件!");
  520. return;
  521. }
  522. top.Dialog.confirm("确定要发布吗?|发布", function() {
  523. // 发布规范文件
  524. $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsFabu/", {
  525. fd_id : fd_id,
  526. }, function(result) {
  527. if (result.Msg.sucsess == true) {
  528. top.Dialog.alert("发布成功",null,null,null,1);
  529. // 刷新表格数据
  530. _this.listGrid.rend();
  531. } else {
  532. top.Dialog.alert("发布失败!");
  533. }
  534. }, "json");
  535. });
  536. };
  537. //发布 批量
  538. _this.onPublish = function() {
  539. var rows = _this.listGrid.getSelectedRows();
  540. var rowsLength = rows.length;
  541. if (rowsLength == 0) {
  542. top.Dialog.alert("请选中要发布的记录!");
  543. return;
  544. }
  545. var ids = "";
  546. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  547. for ( var i = 0; i < rowsLength; i++) {
  548. ids += rows[i].FD_OBJECTID243 + ",";
  549. if(rows[i].COLUMN_3_243=="1"){
  550. if(rowsLength==1){
  551. top.Dialog.alert("您选中的记录已经发布!");
  552. }else{
  553. top.Dialog.alert("您选中的记录有已经发布的!");
  554. }
  555. return;
  556. }
  557. if(getUser_id!=rows[i].TYPEIN_PEOPLE_243){
  558. if(rowsLength==1){
  559. top.Dialog.alert("您选中的记录不是您自己上传的文件记录,请选择您自己上传的文件记录!");
  560. }else{
  561. top.Dialog.alert("您选中的记录有不是您自己上传的文件记录,请选择您自己上传的文件记录!");
  562. }
  563. return;
  564. }
  565. }
  566. top.Dialog.confirm("确定要发布吗?|发布", function() {
  567. $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsFabu/", {
  568. fd_id : ids,
  569. }, function(result) {
  570. if (result.Msg.sucsess == true) {
  571. $.messager.alert("发布成功",null,null,null,-1);
  572. // 刷新表格数据
  573. _this.listGrid.rend();
  574. } else {
  575. top.Dialog.alert("发布失败!");
  576. }
  577. }, "json");
  578. });
  579. };
  580. //共享 单一
  581. _this.gongxiang = function(data) {
  582. var row = _this.listGrid.getRow(data);
  583. var fd_id = row.FD_OBJECTID243+",";
  584. //只能共享以及发布的文件
  585. if(row.COLUMN_3_243!="1"){
  586. top.Dialog.alert("只能共享已经发布的文件!");
  587. return;
  588. }
  589. //只能共享自己上传的文件
  590. // var userId = row.TYPEIN_PEOPLE_243;
  591. // var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  592. // if(getUser_id!=userId){
  593. // top.Dialog.alert("只能共享自己上传的文件!");
  594. // return;
  595. // }
  596. if(dept_level!="1"){
  597. if(dept_level!="2"){
  598. top.Dialog.alert("只有省级用户才能共享!");
  599. return;
  600. }else{
  601. var userDept_id = row.UNITE_243;
  602. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  603. if(userDept_id==dpids){
  604. top.Dialog.alert("省公司的文件只有网公司有权决定是否共享!");
  605. return;
  606. }
  607. }
  608. }
  609. top.Dialog.confirm("确定要共享吗?|共享", function() {
  610. // 发布规范文件
  611. $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsShare/", {
  612. fd_id : fd_id,
  613. }, function(result) {
  614. if (result.Msg.sucsess == true) {
  615. top.Dialog.alert("共享成功",null,null,null,1);
  616. // 刷新表格数据
  617. _this.listGrid.rend();
  618. } else {
  619. top.Dialog.alert("共享失败!");
  620. }
  621. }, "json");
  622. });
  623. };
  624. //共享 批量
  625. _this.publicShare = function() {
  626. var rows = _this.listGrid.getSelectedRows();
  627. var rowsLength = rows.length;
  628. if (rowsLength == 0) {
  629. top.Dialog.alert("请选中要共享的记录!");
  630. return;
  631. }
  632. var ids = "";
  633. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  634. for ( var i = 0; i < rowsLength; i++) {
  635. ids += rows[i].FD_OBJECTID243 + ",";
  636. if(rows[i].COLUMN_4_243=="1"){
  637. if(rowsLength==1){
  638. top.Dialog.alert("您选中的记录已经共享!");
  639. }else{
  640. top.Dialog.alert("您选中的记录有已经共享的!");
  641. }
  642. return;
  643. }
  644. if(rows[i].COLUMN_3_243!="1"){
  645. if(rowsLength==1){
  646. top.Dialog.alert("您选中的记录还没有发布!");
  647. }else{
  648. top.Dialog.alert("您选中的记录中有还没有发布的!");
  649. }
  650. return;
  651. }
  652. if(getUser_id!=rows[i].TYPEIN_PEOPLE_243){
  653. if(rowsLength==1){
  654. top.Dialog.alert("您选中的记录不是您自己上传的文件记录,请选择您自己上传的文件记录!");
  655. }else{
  656. top.Dialog.alert("您选中的记录有不是您自己上传的文件记录,请选择您自己上传的文件记录!");
  657. }
  658. return;
  659. }
  660. }
  661. top.Dialog.confirm("确定要共享吗?|共享", function() {
  662. $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsShare/", {
  663. fd_id : ids,
  664. }, function(result) {
  665. if (result.Msg.sucsess == true) {
  666. $.messager.alert("共享成功",null,null,null,-1);
  667. // 刷新表格数据
  668. _this.listGrid.rend();
  669. } else {
  670. top.Dialog.alert("共享失败!");
  671. }
  672. }, "json");
  673. });
  674. };
  675. //撤销共享
  676. _this.gongxiang1 = function(data){
  677. var row = _this.listGrid.getRow(data);
  678. var fd_id = row.FD_OBJECTID243+",";
  679. //只能撤销自己上传的文件
  680. var userId = row.TYPEIN_PEOPLE_243;
  681. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  682. if(getUser_id!=userId){
  683. top.Dialog.alert("只能撤销自己上传的文件!");
  684. return;
  685. }
  686. top.Dialog.confirm("确定要撤销共享吗?|撤销", function() {
  687. // 发布规范文件
  688. $.post($.pathname() +"/ws/LAWSPOLL/LawsService/noLawsShare/", {
  689. fd_id : fd_id,
  690. }, function(result) {
  691. if (result.Msg.sucsess == true) {
  692. top.Dialog.alert("撤销成功",null,null,null,1);
  693. // 刷新表格数据
  694. _this.listGrid.rend();
  695. } else {
  696. top.Dialog.alert("撤销失败!");
  697. }
  698. }, "json");
  699. });
  700. };
  701. //撤销发布
  702. _this.noPublish = function() {
  703. var rows = _this.listGrid.getSelectedRows();
  704. var rowsLength = rows.length;
  705. if (rowsLength == 0) {
  706. top.Dialog.alert("请选中要撤销的记录!");
  707. return;
  708. } else if (rowsLength > 1) {
  709. top.Dialog.alert("请选中一条要撤销的记录!");
  710. return;
  711. }
  712. var ids = "";
  713. for ( var i = 0; i < rowsLength; i++) {
  714. ids += rows[i].FD_OBJECTID243 + ",";
  715. if(rows[i].COLUMN_3_243!="1"){
  716. top.Dialog.alert("您选中的记录还没有发布!");
  717. return;
  718. }
  719. }
  720. top.Dialog.confirm("确定要撤销发布吗?|撤销", function() {
  721. $.post($.pathname() +"/ws/LAWSPOLL/LawsService/noLawsFabu/", {
  722. fd_id : ids,
  723. }, function(result) {
  724. if (result.Msg.sucsess == true) {
  725. $.messager.alert("撤销成功",null,null,null,-1);
  726. // 刷新表格数据
  727. _this.listGrid.rend();
  728. } else {
  729. top.Dialog.alert("撤销失败!");
  730. }
  731. }, "json");
  732. });
  733. };
  734. /*************************************************************************************************/
  735. return {
  736. init : function() {
  737. $queryForm = $("#queryForm");
  738. /** 绑定查询面板的按钮点击事件* */
  739. // $searchButt = $("#searchButt");// 查询按钮
  740. // $searchButt.bind('click', function() {
  741. // search();
  742. // });
  743. // $searchButt = $("#searchButt");// 更多查询按钮
  744. // $searchButt.live('click', function() {
  745. // search();
  746. // });
  747. $searchOne = $("#searchOne");//查询图标绑定查询事件
  748. $searchOne.bind('click', function() {
  749. searchHandler2();
  750. });
  751. /** 绑定更多的按钮点击事件 */
  752. $more = $("#more"); // 更多按钮
  753. $more.bind('click', function() {
  754. more();
  755. });
  756. //部门id
  757. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  758. //取得用户真实姓名
  759. var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  760. //登录人ID
  761. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  762. //登陆用户的单位名称
  763. var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  764. //父部门id
  765. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  766. $("body").eq(0).showLoading();
  767. // 列表加载参数
  768. _this.loadParams = {
  769. listId : '243',
  770. direction:'DESC',
  771. sort: 'EMC_AM_LAWS_REGULATIONS.UPDATEDATE',
  772. //sublist:' left join ECM_EM_TREATED_HUMAN',
  773. //subCondition:' on ECM_EM_PUBLISH_ALERT_NOTICE.FD_OBJECTID=ECM_EM_TREATED_HUMAN.BUSINESS_ID ',
  774. //condition : " EMC_AM_LAWS_REGULATIONS.is_del='0' "
  775. // condition : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id)"
  776. condition : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE ='"+dpids+"' "
  777. };
  778. var roleCons = roleButtonArr();
  779. /** grid载入数据* */
  780. var toolBarOpt1 = {
  781. items : [ {text : '新增',click : 'addForm',iconClass : 'add1_tem',id : 'wjxz'},
  782. {text : '删除',click : 'del',iconClass : 'delete_tem',id : 'wjsc'},
  783. {text : '修改',click : 'editForm',iconClass : 'update_tem',id : 'wjxg'},
  784. // {text : '查看',click : 'show',iconClass : 'view_tem',id : '10003'},
  785. // {text : '历史版本',click:"onhistory",iconClass: 'history_tem',id:"10201" },
  786. {text : '导入', click: "showImportDialog", iconClass: 'import_tem' ,id:"wjdr"},
  787. {text : '导出',click:"exportTotalData",iconClass: 'export_tem',id:"10006"},
  788. // {text : '下载',click:"onDownLoad",iconClass: 'download_tem',id:"10007" },
  789. {text : '汇总',click: "sum", iconClass: 'poll_tem' ,id:"10200"},
  790. // {text : '发布',click: "onPublish", iconClass: 'release_tem' ,id:"wjfb"},
  791. //{text : '共享',click: "publicShare", iconClass: 'share_tem' ,id:"10200"},
  792. {text : '撤销',click: "noPublish", iconClass: 'retract_tem' ,id:"10215"}
  793. ],
  794. roleCons:roleCons
  795. };
  796. var grid_option1={
  797. columns : [
  798. {display : '名称', name : 'LAWS_REGULATIONS_NAME_243', align : 'left',width : "15%",isPrimaryKey:true,
  799. // render : function(rowdata, value) {
  800. // return '<a href="javascript:void(0)" '
  801. // + 'onclick=jumpPage("'
  802. // + rowdata.FD_OBJECTID243
  803. // +'")>'+ rowdata.LAWS_REGULATIONS_NAME_243 +'</a>';
  804. // }
  805. render : function(rowdata, rowindex, value, column) {
  806. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  807. }
  808. },
  809. {display : '颁布机构', name : 'ISSUE_ORGANIZATION_243', align : 'center',width : "15%",showTitle:true},
  810. {display : '颁布文号', name : 'ISSUE_ARTICLE_NUM_243', align : 'center',width : "10%",showTitle:true},
  811. {display : '发布日期', name : 'ISSUE_DATE_243', align : 'center',width : "10%",showTitle:true},
  812. {display : '填写人员', name : 'TYPEIN_PEOPLE_243_SHOW', align : 'center',width : "10%",showTitle:true},
  813. // {display : '录入人联系方式', name : 'TYPEIN_PEOPLE_PHONE_NUM_243',align : 'center',width : "10%",showTitle:true},
  814. {display : '实施日期', name : 'IMPLEMENT_DATE_243', align : 'center',width : "10%",showTitle:true} ,
  815. {display : '单位', name : 'UNITE_243_SHOW', align : 'center',width : "10%",showTitle:true} ,
  816. // {display : '部门', name : 'DEPT_243_SHOW', align : 'center',width : "10%",showTitle:true} ,
  817. {display : '状态', name : 'STATE_243_SHOW', align : 'center',width : "10%",showTitle:true},
  818. {display : '操作', isAllowHide: false, align : 'center', width:'10%',
  819. render: function (rowdata, rowindex, value, column){
  820. //判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0”
  821. var fabu='';//fabu
  822. if(rowdata.COLUMN_3_243=="1"){
  823. fabu = '<span class="fashang_07 hand" title="发布" onclick="fabu1()"></span>';
  824. }else{
  825. fabu = '<span class="fashang_06 hand" title="发布" onclick="fabu(' + rowindex + ')"></span>';
  826. }
  827. //判断是否已经共享。取共享的状态,如果已经共享为“1”;未共享为“0”
  828. var gongxiang='';
  829. if(rowdata.COLUMN_4_243=="1"){
  830. gongxiang = '<span class="share_07 hand" title="撤销共享" onclick="gongxiang1(' + rowindex + ')"></span>';
  831. }else{
  832. gongxiang = '<span class="share_03 hand" title="共享" onclick="gongxiang(' + rowindex + ')"></span>';
  833. }
  834. return fabu + gongxiang;
  835. }
  836. }],
  837. /* detail: {
  838. //onShowDetail: showFlow,
  839. height: 'auto'
  840. },*/
  841. pageSize : 10,
  842. rownumbers : true,
  843. checkbox : true,
  844. percentWidthMode : true,
  845. onAfterShowData:function(data){
  846. setHt();
  847. }
  848. };
  849. var options1={
  850. url :'/nwyj/ws/crud/CRUDService/queryQui',
  851. params: _this.loadParams,
  852. height: '100%',
  853. width:"100%",
  854. gridOptions:grid_option1,
  855. singleRecodeOptions:{a:"aa"},
  856. paperOpration:{showInput:"true"},
  857. toolBarOptions:toolBarOpt1
  858. };
  859. _this.listGrid=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
  860. $("body").eq(0).hideLoading();
  861. }
  862. };
  863. }();
  864. $(function() {
  865. laws.init();
  866. // getCompName();
  867. /*$("#UNITE").OrgSel({selectedMulti : true,loadCorp:"loadCorp",setMulti : {
  868. "Y" : "s",
  869. "N" : ""
  870. }});*/
  871. getDeptLevel();
  872. });
  873. /**************2016-09-10 唐群胜 获取登陆人的级别*****************/
  874. var dept_level="";
  875. function getDeptLevel(){
  876. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  877. $.ajax({
  878. url : $.pathname()+ "/ws/planService/PlanService/getDeptLevel",
  879. type : 'post',
  880. timeout : 60000,
  881. data : {id:dpids},
  882. dataType : 'text',
  883. success : function(data){
  884. dept_level=data;
  885. }
  886. });
  887. }
  888. //单击跳转
  889. function jumpPage(fd_id){
  890. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id);
  891. }
  892. function showPrimaryKey(obj,index){
  893. var fd_id = obj.FD_OBJECTID243;
  894. // $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id);
  895. $.indexOpenNextWindow("/nwyj/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id);
  896. }
  897. function getCompName(){
  898. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  899. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getresourXj/';
  900. var params = {
  901. id : deptId,
  902. value:"UNITE",
  903. flag:"1"
  904. };
  905. $.ajax({
  906. url : url,
  907. type : 'post',
  908. timeout : 60000,
  909. data : params,
  910. dataType : 'json',
  911. success : function(data){
  912. var conditionData3 = JSON.stringify(data);
  913. var test = eval("("+conditionData3+")");
  914. if(conditionData3!='{"list":[{"name":"查询单位","className":"UNITE","equalType":"equal","list":[]}]}'){
  915. conditionData.list.push(test.list[0]);
  916. }
  917. createConditionsDom(conditionData);
  918. $(".item").unbind("click").bind("click",bindSelectOne);
  919. },
  920. error : function(e){
  921. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  922. }
  923. });
  924. }
  925. function fabu1(){
  926. top.Dialog.alert("该文件已经发布!");
  927. }
  928. //清空
  929. function resetSearch(){
  930. $('#LAWS_REGULATIONS_NAME').val("");
  931. $('#ISSUE_ORGANIZATION').val("");
  932. $('#TAKE_DATE1').val("");
  933. $('#TAKE_DATE2').val("");
  934. $('#ISSUE_DATE1').val("");
  935. $('#ISSUE_DATE2').val("");
  936. $("input:checkbox[name=CLASSES]").attr("checked",false);
  937. $("input:checkbox[name=STATE]").attr("checked",false);
  938. $("input:checkbox[name=COLUMN_3]").attr("checked",false);
  939. }
  940. $.messager=top.Dialog;