bc409ca076f968d7b03e5751f3de651dc28b37f8.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/10/27
  7. */
  8. TargetManage = function() {
  9. /** 定义变量* */
  10. var _this = this;
  11. _this.listGrid = null;// 数据列表
  12. _this.searchPanel = null; // 查询面板
  13. $queryForm = null;// 查询区域表单
  14. $searchButt = null;// 查询按钮
  15. $more = null; // 更多
  16. _this.loadParams = null;// 列表加载参数
  17. //部门id
  18. //var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  19. /** 私有方法* */
  20. /** *新增信息** */
  21. _this.addForm = function() {
  22. $('#frmright', window.parent.document).attr('src',$.pathname()+"/page/business/em/evaluate/targetManage/TargetManageAddEdit.jsp?fd_id=");
  23. };
  24. /** *修改信息** */
  25. _this.editForm = function() {
  26. var rows = _this.listGrid.getSelectedRows();
  27. var rowsLength = rows.length;
  28. if (rowsLength == 0) {
  29. top.Dialog.alert("请选中要修改的记录!");
  30. return;
  31. } else if (rowsLength > 1) {
  32. top.Dialog.alert("请选中一条要修改的记录!");
  33. return;
  34. } else{
  35. if(_this.listGrid.getSelectedRow().__level==1){
  36. top.Dialog.alert("评估指标不可修改,请选择子项修改!");
  37. return;
  38. }else{
  39. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID374;
  40. $('#frmright', window.parent.document).attr('src',$.pathname()+"/page/business/em/evaluate/targetManage/TargetManageAddEdit.jsp?fd_id="+fd_id);
  41. }
  42. }
  43. };
  44. /** *删除信息** */
  45. _this.del = function() {
  46. var rows = _this.listGrid.getSelectedRows();
  47. var rowsLength = rows.length;
  48. if (rowsLength == 0) {
  49. top.Dialog.alert("请选中要删除的记录!");
  50. return;
  51. }
  52. var ids = "";
  53. for ( var i = 0; i < rowsLength; i++) {
  54. ids += rows[i].FD_OBJECTID374 + ",";
  55. }
  56. var url = $.pathname() +"/ws/crud/CRUDService/delete/";
  57. var params = {
  58. objectIDs : ids,
  59. classid : 374
  60. };
  61. top.Dialog.confirm("确定要删除吗?|删除", function() {
  62. $.request.del(url,params,function(result){
  63. if (result.Msg.sucsess == true) {
  64. top.Dialog.alert("删除成功!");
  65. // 刷新表格数据
  66. _this.listGrid.loadData();
  67. //_this.listGrid.rend();
  68. } else {
  69. top.Dialog.alert("删除失败!");
  70. }
  71. });
  72. });
  73. };
  74. /** **评价内容*** */
  75. _this.show = function() {
  76. var rows = _this.listGrid.getSelectedRows();
  77. var rowsLength = rows.length;
  78. if (rowsLength == 0) {
  79. top.Dialog.alert("请选中要查看的记录!");
  80. return;
  81. } else if (rowsLength > 1) {
  82. top.Dialog.alert("请选中一条要查看的记录!");
  83. return;
  84. } else {
  85. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID374;
  86. $('#frmright', window.parent.document).attr('src',$.pathname()+"/page/business/em/evaluate/targetManage/TargetManageDetails.jsp?fd_id="+fd_id);
  87. }
  88. };
  89. // 查询
  90. function search(obj) {
  91. $queryForm.serialize();
  92. var queryParams = getQueryFormParams($queryForm);
  93. //去掉水印
  94. if(queryParams.NAME_374=="体系/评价项目名"){
  95. queryParams.NAME_374="";
  96. }
  97. var params=$.extend({},_this.loadParams,queryParams);
  98. var searchCondition = getSelectCon(conditionData);
  99. params.condition = searchCondition.condition + params.condition;
  100. //alert(params.condition);
  101. _this.exportParams = params;
  102. _this.listGrid.setOptions({"params":params});
  103. //加载数据
  104. _this.listGrid.rend();
  105. }
  106. // 更多
  107. function more() {
  108. $('#moreDiv').toggle();
  109. document.getElementById("queryForm").reset(); //重置一下表单
  110. $(parent.document.body).find("#frmright").height($(window.document.body).height());
  111. }
  112. return {
  113. init : function() {
  114. $queryForm = $("#queryForm");
  115. /** 绑定查询面板的按钮点击事件* */
  116. $searchButt = $("#searchButt");// 查询按钮
  117. $searchButt.bind('click', function(){
  118. search();
  119. });
  120. /** 绑定更多的按钮点击事件 */
  121. $more = $("#more"); // 更多按钮
  122. $more.bind('click', function() {
  123. more();
  124. });
  125. // 获得面板对象
  126. _this.searchPanel = $("#searchPanel");
  127. // 列表加载参数
  128. _this.loadParams = {
  129. listId : '374',
  130. //condition : "is_del=0 and WRITE_DEPT='"+deptId+"'",
  131. condition : "is_del=0",
  132. direction : 'desc', // 排序方式
  133. sort : 'UPDATEDATE'
  134. };
  135. // var datadata = {"rows":[{"open":false,"WRITE_TIME_374":"2015-10-31 15:08:51.000000","NAME_374":"南网应急管理评估指标体系","isParent":true,"FD_OBJECTID374":"372144592870071100000035100000"},{"open":false,"WRITE_TIME_374":"2015-10-30 15:08:40.000000","NAME_374":"应急准备评估指标","isParent":true,"FD_OBJECTID374":"372144592872886000000036100000"},{"open":false,"WRITE_TIME_374":"2015-10-14 15:08:06.000000","NAME_374":"基础准备评估指标","isParent":true,"FD_OBJECTID374":"372144592882177900000037100000"}]};
  136. /** grid载入数据* */
  137. var toolBarOpt1 = {
  138. items : [ {text : '新增',click : _this.addForm,iconClass : 'add1_tem'},
  139. {text : '删除',click : _this.del,iconClass : 'delete_tem'},
  140. {text : '修改',click : _this.editForm,iconClass : 'update_tem'},
  141. {text : '评价内容',click : _this.show,iconClass : 'view_tem'}
  142. ]
  143. };
  144. _this.listGrid = $("#dataGrid").quiGrid({
  145. columns: [
  146. {
  147. display : '体系/评价项目名',
  148. name : 'NAME_374',
  149. width : "35%",
  150. align:'left',
  151. id:'FD_OBJECTID374'
  152. },{
  153. display : '项目级别',
  154. name : 'LEVEL_374_SHOW',
  155. showTitle:true,
  156. width : "20%"
  157. }, {
  158. display : '权重',
  159. name : 'WEIGHT_VALUE_374',
  160. showTitle:true,
  161. width : "20%"
  162. }, {
  163. display : '创建日期',
  164. name : 'WRITE_TIME_374',
  165. showTitle:true,
  166. width : "25%",
  167. render:function (rowdata, rowindex, value){
  168. return value.split(' ')[0];
  169. }
  170. }
  171. ],
  172. height: '460px',
  173. width:"100%",
  174. checkbox:true,
  175. type:'post',
  176. usePager: true,
  177. rownumbers:true,
  178. url :$.pathname() + '/ws/targetManage/TargetManageService/getTrunkTree',
  179. params: {},
  180. toolbar:toolBarOpt1,
  181. percentWidthMode:true,
  182. autoCheckChildren:true,
  183. tree: { columnId: 'FD_OBJECTID374' },
  184. treeAjax:true,
  185. treeChildDataPath:$.pathname() + '/ws/targetManage/TargetManageService/getTargetTreeList?params=',
  186. treeAutoParam:"params"
  187. });
  188. }
  189. };
  190. }();
  191. $(function() {
  192. TargetManage.init();
  193. });