5e19c9d2a37fa35a5d639a65648a1304873f7341.svn-base 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author
  6. * @date 2015/10/26
  7. */
  8. TranferManager = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. _this.listGrid = null;//数据列表
  12. $queryForm = null;//查询区域表单
  13. $searchButt = null;//查询按钮
  14. $more = null; //更多
  15. _this.loadParams = null;//列表加载参数
  16. /**私有方法**/
  17. /***新增信息***/
  18. _this.addForm = function(){
  19. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/gps/duty/transfer/TransferAddEdit.jsp?fd_id=");
  20. };
  21. /***修改信息***/
  22. _this.editForm = function(){
  23. var rows = _this.listGrid.getSelectedRows();
  24. var rowsLength = rows.length;
  25. if (rowsLength == 0) {
  26. top.Dialog.alert("请选中要修改的记录!");
  27. return;
  28. } else if (rowsLength > 1) {
  29. top.Dialog.alert("请选中一条要修改的记录!");
  30. return;
  31. } else {
  32. var row = _this.listGrid.getSelectedRow();
  33. if (row.DAILY_STATE_611 == 2) {
  34. top.Dialog.alert("选中记录已经发布,不能进行修改操作!");
  35. return;
  36. }
  37. var fd_id = row.FD_OBJECTID611;
  38. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/gps/duty/transfer/TransferAddEdit.jsp?fd_id="+fd_id);
  39. }
  40. };
  41. /***发布***/
  42. _this.release = function(){
  43. //取得选中的Grid行
  44. var rows = _this.listGrid.getSelectedRows();
  45. //选中的行数
  46. var rowsLength = rows.length;
  47. if (rowsLength == 0) {
  48. top.Dialog.alert("请选中要发布的记录!");
  49. return;
  50. }
  51. var ids = "";
  52. for ( var i = 0; i < rowsLength; i++) {
  53. //将选中记录的id拼到一起
  54. ids += rows[i].FD_OBJECTID611 + ",";
  55. //判断选中的记录是否已经发布过
  56. if(rows[i].DAILY_STATE_611 == 2){
  57. if(rowsLength==1){
  58. top.Dialog.alert("选中的记录已经发布");
  59. }else{
  60. top.Dialog.alert("选中的记录有已经发布过的,请确认!");
  61. }
  62. return;
  63. }
  64. }
  65. //发布方法的路径
  66. var url = $.pathname() +"/ws/transfer/TransferService/releasel/";
  67. //需要传递的参数
  68. var params = {
  69. objectIDs : ids
  70. };
  71. top.Dialog.confirm("确定要发布吗?|发布", function() {
  72. $.request.add(url,params,function(result){
  73. if (result.Msg.sucsess == true) {
  74. top.Dialog.alert("发布成功!");
  75. // 刷新表格数据
  76. _this.listGrid.rend();
  77. } else {
  78. top.Dialog.alert("发布失败!");
  79. }
  80. });
  81. });
  82. };
  83. /***删除信息***/
  84. _this.del = function(){
  85. var rows = _this.listGrid.getSelectedRows();
  86. var rowsLength = rows.length;
  87. if (rowsLength == 0) {
  88. top.Dialog.alert("请选中要删除的记录!");
  89. return;
  90. }
  91. var ids = "";
  92. for ( var i = 0; i < rowsLength; i++) {
  93. if(rows[i].DAILY_STATE_611 == 2){
  94. if(rowsLength==1){
  95. top.Dialog.alert("选中的记录已经发布,不能进行删除操作!");
  96. }else{
  97. top.Dialog.alert("选中的记录有已经发布过的,不能进行删除操作!");
  98. }
  99. return;
  100. }
  101. ids += rows[i].FD_OBJECTID611 + ",";
  102. }
  103. var url = $.pathname() +"/ws/crud/CRUDService/delete/";
  104. var params = {
  105. objectIDs : ids,
  106. classid : 611
  107. };
  108. top.Dialog.confirm("确定要删除吗?|删除", function() {
  109. $.request.del(url,params,function(result){
  110. if (result.Msg.sucsess == true) {
  111. top.Dialog.alert("删除成功!");
  112. // 刷新表格数据
  113. _this.listGrid.setOptions({data:result});
  114. _this.listGrid.rend();
  115. } else {
  116. top.Dialog.alert("删除失败!");
  117. }
  118. });
  119. });
  120. };
  121. _this.openDetail = function(rowindex){
  122. var row = _this.listGrid.getRow(rowindex);
  123. var fd_id = row.FD_OBJECTID611;
  124. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/gps/duty/transfer/TransferInfo.jsp?fd_id='+fd_id);
  125. };
  126. /****查看详细信息****/
  127. _this.showInfo = function(){
  128. var rows = _this.listGrid.getSelectedRows();
  129. var rowsLength = rows.length;
  130. if (rowsLength == 0) {
  131. top.Dialog.alert("请选中要查看的记录!");
  132. return;
  133. } else if (rowsLength > 1) {
  134. top.Dialog.alert("请选中一条要查看的记录!");
  135. return;
  136. } else {
  137. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID611;
  138. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/gps/duty/transfer/TransferInfo.jsp?fd_id="+fd_id);
  139. }
  140. };
  141. //查询
  142. function search(obj){
  143. if($("#TASK_ID_NAME_611").val()=="请输入任务名称"){
  144. $("#TASK_ID_NAME_611").val("");
  145. }
  146. $("#queryForm").serialize();
  147. //获取选中的值
  148. var searchCondition = getSelectCon(conditionData);
  149. var queryParams = getQueryFormParams($("#queryForm"));
  150. var params=$.extend({},_this.loadParams,queryParams);
  151. //与之前参数条件拼接
  152. params.condition = searchCondition.condition + params.condition;
  153. _this.listGrid.setOptions({"params":params});
  154. //加载数据
  155. // _this.listGrid.setNewPage(1);
  156. _this.listGrid.rend();
  157. }
  158. //更多
  159. function more(){
  160. $('#moreTable').toggle();
  161. document.getElementById("queryForm").reset(); //重置一下表单
  162. $(parent.document.body).find("#frmright").height($(window.document.body).height());
  163. }
  164. return {
  165. init : function() {
  166. $queryForm = $("#queryForm");
  167. /**绑定查询面板的按钮点击事件**/
  168. $searchButt = $("#searchButt");//查询按钮
  169. $searchButt.bind('click',function(){
  170. search();
  171. });
  172. $searchButt.live('click',function(){
  173. search();
  174. });
  175. $("#TASK_ID_NAME_611").keydown(function(e){
  176. if(e.keyCode==13){
  177. search();
  178. }
  179. });
  180. /**绑定更多的按钮点击事件*/
  181. $more = $("#more"); //更多按钮
  182. $more.bind('click',function(){
  183. more();
  184. });
  185. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  186. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  187. $("#RELIEVED_MAN_611").keydown(function(event){
  188. if(event.keyCode == 13){
  189. search();
  190. }
  191. });
  192. //alert(subCompanyIds)
  193. //列表加载参数
  194. _this.loadParams = {
  195. listId : '611',
  196. // condition : "is_del=0 and DEPARTMENT in("+subCompanyIds+")",
  197. condition : "is_del=0 and ((DAILY_STATE=1 and RELIEVED_MAN = '"+realName+"' ) or (DAILY_STATE=2 and DEPARTMENT ='"+deptId+"'))",
  198. direction:'DESC',
  199. sort: 'UPDATEDATE'
  200. };
  201. var grid_option={
  202. //title : "保供电交接班日志数据列表",
  203. columns : [
  204. {name : 'FD_OBJECTID611',display : '主键',align : 'center',hide : true},
  205. {name : 'TASK_NAME_611_SHOW',display : '任务名称',align : 'center', width: "15%",
  206. isSort : false,
  207. isPrimaryKey:true,
  208. render : function(rowdata, rowindex, value, column) {
  209. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  210. }
  211. },
  212. {name : 'DEPARTMENT_611_SHOW',display : '部门',align : 'center', width: "13%"},
  213. {name : 'RELIEVED_MAN_611',display : '交班人',align : 'center', width: "10%"},
  214. {name : 'SUCCEED_MAN_611',display : '接班人',align : 'center', width: "10%"},
  215. {name : 'RELIEVED_TIME_611',display : '交接班时间',align : 'center', width: "12%"},
  216. {name : 'SECURITY_SUPPLY_PROGRESS_611',display : '保供电进展情况',align : 'center', width: "28%"},
  217. {name : 'DAILY_STATE_611_SHOW',display : '状态',align : 'center', width: "10%"}],
  218. usePager:true,
  219. checkbox : true,
  220. pageSize : 10,
  221. percentWidthMode : true,
  222. rownumbers:true
  223. };
  224. //查询出该角色权限下的所有按钮ID roleButtonArr()方法需引入/nwyj/scripts/freamwork/com/sinosoft/common/common.js
  225. var roleCons = roleButtonArr();
  226. var toolBarOpt={
  227. items: [{text : '添加',click :'addForm',iconClass : 'add1_tem',id:"bgdxz"},
  228. {text : '删除',click : 'del',iconClass : 'delete_tem',id:"bgdsc"},
  229. {text : '修改',click : 'editForm',iconClass : 'update_tem',id:"bgdxg"},
  230. {text : '查看',click : 'showInfo',iconClass : 'view_tem',id:"bgdck"},
  231. {text : '发布',click : 'release',iconClass : 'release_tem',id:"bgdfb"}],
  232. roleCons:roleCons};//将角色id传参到gridroleCons:roleCons
  233. var options={
  234. url :'/nwyj/ws/crud/CRUDService/queryQui',
  235. params:_this.loadParams,
  236. width:960,
  237. gridOptions:grid_option,
  238. singleRecodeOptions:{a:"aa"},
  239. paperOpration:{showInput:"true"},
  240. toolBarOptions:toolBarOpt
  241. };
  242. /**grid载入数据**/
  243. /*_this.listGrid = $("#dataGrid").quiGrid(gridOptions);*/
  244. gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options);
  245. }
  246. };
  247. }();
  248. $(function() {
  249. TranferManager.init();
  250. });
  251. function showPrimaryKey(obj,index){
  252. var fd_id = obj.FD_OBJECTID611;
  253. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/gps/duty/transfer/TransferInfo.jsp?fd_id='+fd_id);
  254. }