123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- /**
- * 功能:
- *
- *
- * @author
- * @date 2015/10/26
- */
- TranferManager = function() {
- /**定义变量**/
- var _this = this;
- _this.listGrid = null;//数据列表
- $queryForm = null;//查询区域表单
- $searchButt = null;//查询按钮
- $more = null; //更多
- _this.loadParams = null;//列表加载参数
- /**私有方法**/
- /***新增信息***/
- _this.addForm = function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/gps/duty/transfer/TransferAddEdit.jsp?fd_id=");
- };
-
- /***修改信息***/
- _this.editForm = function(){
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要修改的记录!");
- return;
- } else if (rowsLength > 1) {
- top.Dialog.alert("请选中一条要修改的记录!");
- return;
- } else {
- var row = _this.listGrid.getSelectedRow();
- if (row.DAILY_STATE_611 == 2) {
- top.Dialog.alert("选中记录已经发布,不能进行修改操作!");
- return;
- }
- var fd_id = row.FD_OBJECTID611;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/gps/duty/transfer/TransferAddEdit.jsp?fd_id="+fd_id);
- }
- };
-
-
- /***发布***/
- _this.release = function(){
- //取得选中的Grid行
- var rows = _this.listGrid.getSelectedRows();
- //选中的行数
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要发布的记录!");
- return;
- }
- var ids = "";
- for ( var i = 0; i < rowsLength; i++) {
- //将选中记录的id拼到一起
- ids += rows[i].FD_OBJECTID611 + ",";
- //判断选中的记录是否已经发布过
- if(rows[i].DAILY_STATE_611 == 2){
- if(rowsLength==1){
- top.Dialog.alert("选中的记录已经发布");
- }else{
- top.Dialog.alert("选中的记录有已经发布过的,请确认!");
- }
- return;
- }
- }
- //发布方法的路径
- var url = $.pathname() +"/ws/transfer/TransferService/releasel/";
- //需要传递的参数
- var params = {
- objectIDs : ids
- };
- top.Dialog.confirm("确定要发布吗?|发布", function() {
- $.request.add(url,params,function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("发布成功!");
- // 刷新表格数据
- _this.listGrid.rend();
- } else {
- top.Dialog.alert("发布失败!");
- }
- });
- });
- };
- /***删除信息***/
- _this.del = function(){
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要删除的记录!");
- return;
- }
- var ids = "";
- for ( var i = 0; i < rowsLength; i++) {
- if(rows[i].DAILY_STATE_611 == 2){
- if(rowsLength==1){
- top.Dialog.alert("选中的记录已经发布,不能进行删除操作!");
- }else{
- top.Dialog.alert("选中的记录有已经发布过的,不能进行删除操作!");
- }
- return;
- }
- ids += rows[i].FD_OBJECTID611 + ",";
- }
- var url = $.pathname() +"/ws/crud/CRUDService/delete/";
- var params = {
- objectIDs : ids,
- classid : 611
- };
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- $.request.del(url,params,function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功!");
- // 刷新表格数据
- _this.listGrid.setOptions({data:result});
- _this.listGrid.rend();
- } else {
- top.Dialog.alert("删除失败!");
- }
- });
- });
- };
- _this.openDetail = function(rowindex){
- var row = _this.listGrid.getRow(rowindex);
- var fd_id = row.FD_OBJECTID611;
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/gps/duty/transfer/TransferInfo.jsp?fd_id='+fd_id);
- };
- /****查看详细信息****/
- _this.showInfo = function(){
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要查看的记录!");
- return;
- } else if (rowsLength > 1) {
- top.Dialog.alert("请选中一条要查看的记录!");
- return;
- } else {
- var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID611;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/gps/duty/transfer/TransferInfo.jsp?fd_id="+fd_id);
- }
- };
- //查询
- function search(obj){
- if($("#TASK_ID_NAME_611").val()=="请输入任务名称"){
- $("#TASK_ID_NAME_611").val("");
- }
- $("#queryForm").serialize();
- //获取选中的值
- var searchCondition = getSelectCon(conditionData);
- var queryParams = getQueryFormParams($("#queryForm"));
- var params=$.extend({},_this.loadParams,queryParams);
- //与之前参数条件拼接
- params.condition = searchCondition.condition + params.condition;
- _this.listGrid.setOptions({"params":params});
- //加载数据
- // _this.listGrid.setNewPage(1);
- _this.listGrid.rend();
- }
-
-
- //更多
- function more(){
- $('#moreTable').toggle();
- document.getElementById("queryForm").reset(); //重置一下表单
- $(parent.document.body).find("#frmright").height($(window.document.body).height());
- }
- return {
- init : function() {
- $queryForm = $("#queryForm");
- /**绑定查询面板的按钮点击事件**/
- $searchButt = $("#searchButt");//查询按钮
- $searchButt.bind('click',function(){
- search();
- });
- $searchButt.live('click',function(){
- search();
- });
- $("#TASK_ID_NAME_611").keydown(function(e){
- if(e.keyCode==13){
- search();
- }
- });
- /**绑定更多的按钮点击事件*/
- $more = $("#more"); //更多按钮
- $more.bind('click',function(){
- more();
- });
-
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- $("#RELIEVED_MAN_611").keydown(function(event){
- if(event.keyCode == 13){
- search();
- }
- });
- //alert(subCompanyIds)
- //列表加载参数
- _this.loadParams = {
- listId : '611',
- // condition : "is_del=0 and DEPARTMENT in("+subCompanyIds+")",
- condition : "is_del=0 and ((DAILY_STATE=1 and RELIEVED_MAN = '"+realName+"' ) or (DAILY_STATE=2 and DEPARTMENT ='"+deptId+"'))",
- direction:'DESC',
- sort: 'UPDATEDATE'
- };
-
- var grid_option={
- //title : "保供电交接班日志数据列表",
- columns : [
- {name : 'FD_OBJECTID611',display : '主键',align : 'center',hide : true},
- {name : 'TASK_NAME_611_SHOW',display : '任务名称',align : 'center', width: "15%",
- isSort : false,
- isPrimaryKey:true,
- render : function(rowdata, rowindex, value, column) {
- return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
- }
- },
- {name : 'DEPARTMENT_611_SHOW',display : '部门',align : 'center', width: "13%"},
- {name : 'RELIEVED_MAN_611',display : '交班人',align : 'center', width: "10%"},
- {name : 'SUCCEED_MAN_611',display : '接班人',align : 'center', width: "10%"},
- {name : 'RELIEVED_TIME_611',display : '交接班时间',align : 'center', width: "12%"},
- {name : 'SECURITY_SUPPLY_PROGRESS_611',display : '保供电进展情况',align : 'center', width: "28%"},
- {name : 'DAILY_STATE_611_SHOW',display : '状态',align : 'center', width: "10%"}],
- usePager:true,
- checkbox : true,
- pageSize : 10,
- percentWidthMode : true,
- rownumbers:true
- };
- //查询出该角色权限下的所有按钮ID roleButtonArr()方法需引入/nwyj/scripts/freamwork/com/sinosoft/common/common.js
- var roleCons = roleButtonArr();
- var toolBarOpt={
- items: [{text : '添加',click :'addForm',iconClass : 'add1_tem',id:"bgdxz"},
- {text : '删除',click : 'del',iconClass : 'delete_tem',id:"bgdsc"},
- {text : '修改',click : 'editForm',iconClass : 'update_tem',id:"bgdxg"},
- {text : '查看',click : 'showInfo',iconClass : 'view_tem',id:"bgdck"},
- {text : '发布',click : 'release',iconClass : 'release_tem',id:"bgdfb"}],
- roleCons:roleCons};//将角色id传参到gridroleCons:roleCons
- var options={
- url :'/nwyj/ws/crud/CRUDService/queryQui',
- params:_this.loadParams,
- width:960,
- gridOptions:grid_option,
- singleRecodeOptions:{a:"aa"},
- paperOpration:{showInput:"true"},
- toolBarOptions:toolBarOpt
- };
- /**grid载入数据**/
- /*_this.listGrid = $("#dataGrid").quiGrid(gridOptions);*/
- gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options);
-
- }
- };
- }();
- $(function() {
- TranferManager.init();
- });
- function showPrimaryKey(obj,index){
- var fd_id = obj.FD_OBJECTID611;
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/gps/duty/transfer/TransferInfo.jsp?fd_id='+fd_id);
- }
|