123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- /**
- * 功能:
- *
- *
- * @author
- * @date 2015/09/14
- */
- TranferManager = function() {
- /**定义变量**/
- var _this = this;
- _this.listGrid = null;//数据列表
- $queryForm = null;//查询区域表单
- $searchButt = null;//查询按钮
- $more = null; //更多
- _this.loadParams = null;//列表加载参数
- _this.exportParams = null;//导出EXCEL参数
- /**私有方法**/
- /***新增信息***/
- _this.addForm = function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/tranfer/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 fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID361;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/tranfer/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_OBJECTID361 + ",";
- //判断选中的记录是否已经发布过
- if(rows[i].DAILY_STATE_361=="2"){
- if(rowsLength==1){
- top.Dialog.alert("选中的记录已经发布");
- }else{
- top.Dialog.alert("选中的记录有已经发布过的,请确认!");
- }
- return;
- }
- }
- //发布方法的路径
- var url = $.pathname() +"/ws/transfer/TransferService/release/";
- //需要传递的参数
- var params = {
- objectIDs : ids
- };
- top.Dialog.confirm("确定要发布吗?|发布", function() {
- $.request.del(url,params,function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("发布成功!");
- // 刷新表格数据
- _this.listGrid.loadData();
- } 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++) {
- ids += rows[i].FD_OBJECTID361 + ",";
- }
- var url = $.pathname() +"/ws/crud/CRUDService/delete/";
- var params = {
- objectIDs : ids,
- classid : 361
- };
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- $.request.del(url,params,function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功!");
- // 刷新表格数据
- _this.listGrid.loadData();
- } else {
- top.Dialog.alert("删除失败!");
- }
- });
- });
- };
- /****查看详细信息****/
- _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_OBJECTID361;
-
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/tranfer/TransferInfo.jsp?fd_id="+fd_id);
- }
- };
- //导出excel
- _this.exportData = function(){
- excelExport(361,_this.exportParams,"交接班管理",['IS_DEL']);
- };
- //查询
- function search(obj){
- var queryFormValue = $queryForm.serialize();
- //将查询区域的表单转成json格式
- var queryParams = getQueryFormParams($queryForm);
- //去掉水印
- if(queryParams.RELIEVED_MAN_361=="交班人"){
- queryParams.RELIEVED_MAN_361="";
- }
- //两个json合并方法
- var params = concatJson({}, [_this.loadParams,queryParams]);
- _this.exportParams = params;
- _this.listGrid.setOptions( {
- params : params
- });
- //页号重置为1
- _this.listGrid.setNewPage(1);
- _this.listGrid.loadData();//加载数据
- }
- //更多
- function more(){
- $('#moreTable').toggle();
- }
- return {
- init : function() {
- $queryForm = $("#queryForm");
- /**绑定查询面板的按钮点击事件**/
- $searchButt = $("#searchButt");//查询按钮
- $searchButt.bind('click',function(){
- search();
- });
- /**绑定更多的按钮点击事件*/
- $more = $("#more"); //更多按钮
- $more.bind('click',function(){
- more();
- });
- //列表加载参数
- _this.loadParams = {
- listId : '361',
- condition : 'is_del=0'
- };
-
- _this.exportParams = _this.loadParams;
- /**grid载入数据**/
- _this.listGrid = $("#dataGrid").quiGrid({
- //title : "交接班管理数据列表",
- columns : [
- {
- name : 'FD_OBJECTID361',
- display : '主键',
- align : 'center',
- hide : true
- },
- {
- name : 'RELIEVED_MAN_361',
- display : '交班人',
- align : 'center',
- width: "10%"
- },
- {
- name : 'SUCCEED_MAN_361',
- display : '接班人',
- align : 'center',
- width: "10%"
- },
- {
- name : 'DEPT_361_SHOW',
- display : '部门',
- align : 'center',
- width: "20%"
- },
- {
- name : 'RELIEVED_TIME_361',
- display : '交接班时间',
- align : 'center',
- width: "20%"
- },
- {
- name : 'EW_ACTION_SITUATION_361',
- display : '预警行动情况',
- align : 'center',
- width: "28%"
- },
- {
- name : 'DAILY_STATE_361_SHOW',
- display : '状态',
- align : 'center',
- width: "10%"
- }],
- url : $.pathname() + '/ws/crud/CRUDService/queryQui',
- params : _this.loadParams,
- //排序字段
- sortName:'UPDATEDATE',
- sortOrder:"DESC",
- rownumbers : true,
- checkbox : true,
- height : "100%",
- width : "100%",
- pageSize : 10,
- percentWidthMode : true,
- toolbar : {
- items : [ {
- text : '新增',
- click : _this.addForm,
- iconClass : 'icon_add',
- id:"10000"
- }, {
- line : true
- }, {
- text : '删除',
- click : _this.del,
- iconClass : 'icon_delete',
- id:"10002"
- }, {
- line : true
- }, {
- text : '修改',
- click : _this.editForm,
- iconClass : 'icon_edit',
- id:"10001"
- }, {
- line : true
- }, {
- text : '查看',
- click : _this.showInfo,
- iconClass : 'icon_view',
- id:"10003"
- }, {
- line : true
- }, {
- text : '导出',
- click : _this.exportData,
- iconClass : 'icon_export',
- id:"10006"
- }, {
- line : true
- }, {
- text : '发布',
- click : _this.release,
- iconClass : 'icon_release',
- id:"10102"
- } ]
- }
- });
- showButtns1(_this.listGrid);
- }
- };
- }();
- $(function() {
- TranferManager.init();
- });
|