7353223494ce1ca67821bc47e9ebc238f2417bce.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  3. var deptNames = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  4. $(function(){
  5. // getChildInfo();
  6. createConditionsDom(conditionData);
  7. $(".item").unbind("click").bind("click",bindSelectOne);
  8. /******************************绑定事件**************************************/
  9. $more = $("#more"); // 更多按钮
  10. $more.bind('click', function() {
  11. more();
  12. });
  13. $searchButt = $("#searchButt");// 更多查询按钮
  14. $searchButt.live('click', function() {
  15. searchHandler();
  16. });
  17. $searchOne = $("#searchOne");//查询图标绑定查询事件
  18. $searchOne.bind('click', function() {
  19. searchHandler();
  20. });
  21. });
  22. function getChildInfo(){
  23. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getresourXj/';
  24. var params = {
  25. id : deptId,
  26. value:"BELONGING_DEPARMENT"
  27. };
  28. $.ajax({
  29. url : url,
  30. type : 'post',
  31. timeout : 60000,
  32. data : params,
  33. dataType : 'json',
  34. success : function(data){
  35. var conditionData3 = JSON.stringify(data);
  36. var test = eval("("+conditionData3+")");
  37. if(conditionData3!='{"list":[{"name":"查询单位","className":"BELONGING_DEPARMENT","equalType":"equal","list":[]}]}'){
  38. conditionData.list.push(test.list[0]);
  39. }
  40. createConditionsDom(conditionData);
  41. $(".item").unbind("click").bind("click",bindSelectOne);
  42. },
  43. error : function(e){
  44. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  45. }
  46. });
  47. }
  48. var g;
  49. /**定义变量**/
  50. //列表加载参数
  51. //var condition="IS_DEL='0' AND WAREHOUSE_BELONGING IN('"+ deptId +"') or WAREHOUSE_BELONGING IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.PARENT_ID='"+deptId+"')";
  52. var condition="IS_DEL='0' and BELONGING_DEPARMENT ='"+deptId+"'";
  53. var loadParams = {
  54. "listId" : '284',
  55. // "condition" : condition,
  56. "deptName":deptNames,
  57. direction:'DESC',
  58. sort: 'UPDATEDATE'
  59. };
  60. function initComplete(){
  61. /**
  62. * 工具条
  63. */
  64. var roleCons = roleButtonArr();
  65. var toolBarOpt1 = {
  66. items:[
  67. {text: '查看', click: "onView", iconClass: 'view_tem',id:"10003"}
  68. ,
  69. {text: '导出', click: "daochu", iconClass: 'export_tem',id:"10006"}
  70. // ,
  71. // {text: '统计', click: "sumUnit", iconClass: 'poll_tem',id:"10200"}
  72. // {text: '横向查看', click: "tempValue", iconClass: 'history_tem',id:"10206"}
  73. ],
  74. roleCons:roleCons
  75. };
  76. /**
  77. * 树形列
  78. */
  79. var grid_option1 = {
  80. columns: [
  81. { display: '仓库名称', name: 'WAREHOUSE_NAME', align: 'left', width: "15%",isPrimaryKey:true,
  82. // render : function(rowdata, value) {
  83. // return '<a href="javascript:void(0)" '
  84. // + 'onclick=jumpPage("'
  85. // + rowdata.FD_OBJECTID284
  86. // +'")>'+ rowdata.WAREHOUSE_NAME_284 +'</a>';
  87. // }
  88. render : function(rowdata, rowindex, value, column) {
  89. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  90. }
  91. },
  92. { display: '仓库归属', name: 'WAREHOUSE_BELONGING', align: 'center', width: "10%",showTitle:true},
  93. { display: '所属单位', name: 'BELONGING_DEPARTMENT', align: 'center', width: "15%",showTitle:true},
  94. { display: '仓库类别', name: 'WAREHOUSE_TYPE', align: 'center', width: "10%",showTitle:true},
  95. { display: '仓库级别', name: 'WAREHOUSE_LEVEL', align: 'center' , width: "10%",showTitle:true},
  96. { display: '详细地址', name: 'DETAILED_ADDRESS', align: 'center', width: "15%",showTitle:true},
  97. { display: '存储物资类别', name: 'STORAGE_MATERIAL_TYPE', align: 'center' , width: "15%",showTitle:true},
  98. { display: '仓库负责人', name: 'WAREHOUSE_PRINCIPAL', align: 'center', width: "10%" ,showTitle:true}
  99. ],
  100. rownumbers : true,
  101. checkbox : true,
  102. pageSize : 10,
  103. percentWidthMode : true
  104. };
  105. var options1={
  106. url :'/nwyj/ws/WareHouseService/WareHouseService/getWarehouseInfo',
  107. params:loadParams,
  108. width:960,
  109. gridOptions:grid_option1,
  110. singleRecodeOptions:{a:"aa"},
  111. paperOpration:{showInput:"true"},
  112. toolBarOptions:toolBarOpt1
  113. };
  114. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
  115. }
  116. //导出
  117. function daochu(){
  118. var rows = g.getSelectedRows();
  119. var rowsLength = rows.length;
  120. // if (rowsLength == 0) {
  121. top.Dialog.confirm("是否导出所有的物资仓库信息?|确定", function() {
  122. var sql = {
  123. "report_type" : "rcwhxx"
  124. // ,
  125. // "json" : JSON.stringify(g.getData())
  126. };
  127. excelExport(undefined,sql,"物资仓库信息","IS_DEL,UPDATEDATE,FD_OBJECTID,SUPERIORWAREHOUSE,WAREHOUSSYSCODE","物资仓库信息",'rcdaochu');
  128. });
  129. return;
  130. // }
  131. //
  132. // var ids = "";
  133. // for ( var i = 0; i < rowsLength; i++) {
  134. // ids += "'"+rows[i].FD_OBJECTID284+"'" + ",";
  135. // }
  136. // var temp = ids.substring(0,ids.length-1);
  137. //
  138. // var condition = " IS_DEL='0' ";
  139. // condition += " AND FD_OBJECTID IN (" + temp + ") " ;
  140. //
  141. // var sql = {
  142. // "listId" :'284' ,
  143. // "condition" : condition,
  144. // direction:'DESC',
  145. // sort: 'UPDATEDATE'
  146. // };
  147. //
  148. // excelExport(284,sql,"FD_OBJECTID,IS_DEL");
  149. }
  150. function searchHandler(){
  151. $queryForm = $("#queryForm");
  152. if($("#WAREHOUSE_NAME_284").val()=="请输入仓库名称"){
  153. $("#WAREHOUSE_NAME_284").val("");
  154. }
  155. $queryForm.serialize();
  156. var $comp_id = $("#selectConditions").find(".WAREHOUSE_BELONGING");
  157. var loadParams11;
  158. //判断是否有用单位做查询条件
  159. if(!!$comp_id.prop("outerHTML")){
  160. loadParams11 = {
  161. // "listId" : '284',
  162. "condition" : " ",
  163. // direction:'DESC',
  164. // sort: 'UPDATEDATE'
  165. };
  166. }else{
  167. loadParams11 = $.extend({},loadParams,loadParams);
  168. }
  169. //获取选中的值
  170. var searchCondition = getSelectCon(conditionData);
  171. var queryParams = getQueryFormParams($queryForm);//拼接出来的条件
  172. var params=$.extend({},loadParams11,queryParams);// 默认
  173. //与之前参数条件拼接
  174. params.condition = searchCondition.condition + params.condition;
  175. g.setOptions({"params":params});
  176. //加载数据
  177. g.rend();
  178. }
  179. //点击查看
  180. //function jumpPage(id){
  181. // window.location.href="inventory.jsp?"+id;
  182. //}
  183. //点击主键跳转详细信息页面
  184. this.openDetail = function(rowindex) {
  185. var row = g.getRow(rowindex);
  186. var fd_id = row.WAREHOUSE_SYS_CODE;
  187. var fd_id1 = row.OBJECT_ID;
  188. window.location.href="inventory.jsp?"+fd_id+"?"+fd_id1;
  189. };
  190. function showPrimaryKey(obj,index){
  191. var fd_id = obj.WAREHOUSE_SYS_CODE;
  192. var fd_id1 = row.OBJECT_ID;
  193. window.location.href="inventory.jsp?"+fd_id+"?"+fd_id1;
  194. }
  195. //导出
  196. function exportTotalData(){
  197. var rows = g.getSelectedRows();
  198. var rowsLength = rows.length;
  199. if (rowsLength == 0) {
  200. top.Dialog.confirm("是否导出所有的物资仓库信息?|确定", function() {
  201. excelExport(284,loadParams,"物资仓库信息","IS_DEL,UPDATEDATE,FD_OBJECTID,SUPERIORWAREHOUSE,WAREHOUSSYSCODE");});
  202. return;
  203. }
  204. var ids = "";
  205. for ( var i = 0; i < rowsLength; i++) {
  206. ids += "'"+rows[i].FD_OBJECTID284+"'" + ",";
  207. }
  208. var temp = ids.substring(0,ids.length-1);
  209. var condition = " IS_DEL='0' ";
  210. condition += " AND FD_OBJECTID IN (" + temp + ") " ;
  211. var sql = {
  212. "listId" :'284' ,
  213. "condition" : condition,
  214. direction:'DESC',
  215. sort: 'UPDATEDATE'
  216. };
  217. excelExport(284,sql,"物资仓库信息","IS_DEL,UPDATEDATE,FD_OBJECTID,SUPERIORWAREHOUSE,WAREHOUSSYSCODE");
  218. }
  219. //详情
  220. function onView(){
  221. var rows = g.getSelectedRows();
  222. if(rows.length==0){
  223. top.Dialog.alert("请选择一条记录");
  224. return;
  225. }
  226. if(rows.length>1){
  227. top.Dialog.alert("只能选择一条记录");
  228. return;
  229. }
  230. var fd_id = rows[0].OBJECT_ID;
  231. // window.location.href="warehouse_view.jsp?"+fd_id;
  232. $.indexOpenNextWindow("/nwyj/page/business/am/resource/warehouse/warehouse_view.jsp?"+fd_id);
  233. }
  234. //统计
  235. function sumUnit(){
  236. //top.Dialog.alert("无数据信息");
  237. window.location.href="warehouse_poll.jsp";
  238. }
  239. function more() {
  240. $('#moreDiv').toggle(400,function(){
  241. $("#emptyCondition").click();
  242. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  243. });
  244. }
  245. /*// 更多
  246. function more() {
  247. $('#moreDiv').toggle();
  248. // $("#WAREHOUSE_NAME_284").val("");
  249. $(parent.document.body).find("#frmright").height($(window.document.body).height());//重新设置高度
  250. }*/
  251. $.messager=top.Dialog;
  252. //横向查看功能
  253. function tempValue(){
  254. var diag = new top.Dialog();
  255. diag.Title = "应急组织";
  256. diag.URL = $.pathname() + '/page/business/am/resource/ledger/readDept.jsp';
  257. diag.Width = 700;
  258. diag.Height = 500;
  259. diag.Top = "80%";
  260. diag.Left = "50%";
  261. diag.ShowButtonRow=true;
  262. diag.ButtonAlign = 'center';
  263. diag.OkButtonText="确 定";
  264. diag.OKEvent = function(){
  265. Validate(diag);
  266. };
  267. diag.show();
  268. }
  269. function Validate(diag){
  270. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
  271. var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames(); //申请单位的名称
  272. var time1=diag.innerFrame.contentWindow.$("#time1").val();
  273. var time2=diag.innerFrame.contentWindow.$("#time2").val();
  274. var yuanyin=diag.innerFrame.contentWindow.$("#yuanyin").val();
  275. //获取zTree对象
  276. var zTree = diag.innerFrame.contentWindow.$.fn.zTree.getZTreeObj("tree-1");
  277. //得到选中的数据集
  278. var checkedNodes = zTree.getCheckedNodes(true);
  279. if(time1==""||time2==""){
  280. $.messager.alert('请选择申请查看权限的时间!');
  281. return;
  282. }
  283. if(time1>time2){
  284. $.messager.alert('请选择正确的申请查看权限的时间!');
  285. return;
  286. }
  287. if(yuanyin==""){
  288. $.messager.alert('请输入申请查看权限的原因!');
  289. return;
  290. }
  291. if(checkedNodes==""){
  292. $.messager.alert('请选择要申请查看的单位!');
  293. return;
  294. }
  295. var compValue="";
  296. var compValue2="";
  297. for(var i = 0; i < checkedNodes.length; i++){
  298. //机构名称
  299. compValue += checkedNodes[i].id + ",";
  300. compValue2 += checkedNodes[i].name+",";
  301. }
  302. var compid = compValue.substring(0,compValue.length-1);
  303. var compname = compValue2.substring(0,compValue2.length-1);
  304. //给第二个form的字段设置值
  305. $("#APPLY_PERSION_216").val(getUser_id);
  306. $("#COMPNAME_216").val(dept_name);
  307. $("#APPROVE_PERSION_216").val("暂时数据");
  308. $("#START_TIME_216").val(time1);
  309. $("#END_TIME_216").val(time2);
  310. $("#APPLY_CAUSE_216").val(yuanyin);
  311. $("#APPLY_COMPID_216").val(compid);//查看单位的ID
  312. $("#APPLY_COMPNAME_216").val(compname); //查看单位的名称
  313. var $form = $('#fillForm1');
  314. var url = $.pathname() + '/ws/crud/CRUDService/create';
  315. $.ajax({
  316. url : url,
  317. type : 'post',
  318. data : $form.serialize(),
  319. dataType : 'text',
  320. timeout : 60000,
  321. success : function(data){
  322. $.messager.alert("申请提交成功",null,null,null,-1);
  323. },
  324. error : function(){
  325. $.messager.alert('操作失败');
  326. }
  327. });
  328. top.Dialog.close();//关闭新增窗口
  329. }