123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661 |
- /**
- * 功能:
- *
- *
- * @author HXB
- * @date 2015/09/18
- */
- ReportInput = function() {
- /** 定义变量* */
- var _this = this;
- _this.listGrid = null;// 数据列表
- _this.searchPanel = null; // 查询面板
- $queryForm = null;// 查询区域表单
- $searchButt = null;// 查询按钮
- $more = null; // 更多
- _this.loadParams = null;// 列表加载参数
- var currDate = getNowFormatDate();
- // 部门id
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- //登陆用户的单位名称
- var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- /** 私有方法* */
- /** *修改信息** */
- _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.TASK_STATE_610 == 1) {
- top.Dialog.alert("选中的记录已经发布过,不能再修改!");
- return;
- }
- var fd_id = row.FD_OBJECTID610;
- $('#frmright', window.parent.document).attr('src', $.pathname() + '/page/business/gps/taskManagement/taskManagementUpdate.jsp?fd_id=' + fd_id);
- }
- };
-
- /** *导入** */
- _this.import_task = function() {
- var diag = new top.Dialog();
- diag.Title = "导入保供电任务";
- diag.Width=700;
- diag.Height=300;
- diag.URL = "/nwyj/page/business/gps/taskManagement/bgd_task_import.jsp";
- diag.show();
-
- };
-
- /** *发布** */
- _this.release = function() {
- // 取得选中的Grid行
- 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.TASK_STATE_610 == 1) {
- top.Dialog.alert("选中的记录已经发布过的,请重新选择!");
- return;
- }
- var fd_id = row.FD_OBJECTID610; //
-
- var areas = row.GPS_AREA_ID_610;
- var bgdname=row.PROGRAM_NAME_610;
-
- /*alert(areas);
- return;*/
- var corp_ids = row.GPS_AREA_ID_610;
- var params = {
- classid : "610",
- FD_OBJECTID610 : fd_id,
- TASK_STATE_610 : "1",
- ISSUE_TIME_610:currDate,
- ISSUE_DEPT_610:deptId,
- //taskPublish:true
- };
- var receiver = '';//短信功能的“接收人”
- var telephine= '';//短信功能的“电话”
- var alertmsg = "确定要发布吗?|发布";
- top.Dialog.confirm(alertmsg, function() {
- var flag = 1;
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data) {
- //top.Dialog.alert('发布成功!', null, null, null, -1);
- _this.listGrid.rend();
- $.post($.pathname() + "/ws/sendmenu/SendMsgService/dwrMsg",{method:"sendMessage",msg:"最新发布保供电任务:"+bgdname,url:"'http://localhost:8080/nwyj/page/frameWork.html'"},function(){},"json");
- top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {//参考保供电值班安排表发布后的短信
- //短信
- $.ajax({
- url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getTaskInfos/',
- type : 'post',
- data : areas,//要传的参数---------------------------------------------------保供电范围
- async:false,
- dataType : 'json',
- success : function(data){
- for(var i=0;i<data.length;i++){
- //alert(data[i].USER_ID+" data[i].MOBILE="+data[i].MOBILE);
- if(data[i] != null && data[i].USER_ID!='' && data[i].USER_ID!=null && data[i].MOBILE!='' && data[i].MOBILE!=null){
- receiver+=data[i].USER_ID+";";
- telephine+=data[i].MOBILE+";";
- }
-
- };
- //alert(receiver+"telephine="+telephine);
- addMsg(
- receiver,//data.list.split("|")[0],//要发送的人
- telephine,//data.list.split("|")[1],//要发送的手机号
- "新发布了一个保供电任务,请及时查看!"//要发送的信息内容
- );
- /*
- var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgForMuchDwr/';
- var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/gps/taskManagement/detailTaskManagement.jsp?fd_id="+fd_id+"')\">"+corp_name+"发布的保供电任务</a>";
- var params = {
- parentDeptName:corp_ids,
- msg:msg
- };
-
- $.ajax({
- url : url,
- type : 'post',
- data : params,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- },
- error : function(){
- $.messager.alert('操作失败');
- }
-
- });*/
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- /*$.ajax({
- url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg',
- type : 'post',
- data : {
- 'fd_id' : ids,
- 'userId':userId,
- 'comp_id':comp_id
- },
- async:false,
- dataType : 'json',
- success : function(data) {
- // addMsg('','',"新发布了一个保供电值班安排表,请及时填报!");
- addMsg(
- data.list.split("|")[0],//要发送的人
- data.list.split("|")[1],//要发送的手机号
- "新发布了一个保供电值班安排表,请及时填报!"//要发送的信息内容
- );
- },
- error : function(e) {
- $.messager.alert('访问服务失败!', 'error');
- }
- });*/
- });
-
- if(flag==1){//接口
- $.ajax({
- url : $.pathname() + '/ws/alertToImpl/AlertToImplService/taskReleaseSupply/',
- type : 'post',
- timeout : 15000,
- data : {
- fd_objectid : fd_id
- },
- dataType : 'json',
- success : function(result) {
-
- },error : function(e) {
- /*$.messager.alert('发布接口失败!');*/
- }
- });
- }
-
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- });
- }
- };
- /** *删除信息** */
- _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_OBJECTID610 + ",";
- var row = rows[i];
- if (row.TASK_STATE_610 == 1) {
- top.Dialog.alert("选中的记录有已发布,请重新选择!");
- return;
- }
- }
- var url = $.pathname() + "/ws/bgd_duty/BgdDutyService/deleteTask/";
- var params = {
- objectIDs : ids,
- classid : 610
- };
- /*top.Dialog.confirm("确定要删除吗?|删除", function() {
- $.request.del(url, params, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功!");
- // 刷新表格数据
- _this.listGrid.rend();
- } else {
- top.Dialog.alert("删除失败!");
- }
- });
- });*/
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- $.ajax({
- url : url,
- type : 'post',
- data : params,
- dataType : 'json',
- success : function(data) {
- top.Dialog.alert("删除成功!");
- // 刷新表格数据
- _this.listGrid.rend();
- },
- error : function(e){
- $.messager.alert('删除失败', '访问服务失败!', 'error');
- }
- });
- });
- };
-
- _this.rollback = function(){
- // 取得选中的Grid行
- 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.TASK_STATE_610 != 1) {
- top.Dialog.alert("选中的记录未发布,不需要撤销,请重新选择!");
- return;
- }
- if(row.INPUT_NAME_ID_610!=userId){
- top.Dialog.alert("只有填写人本人才能执行撤销操作!");
- return;
- }
- var fd_id = row.FD_OBJECTID610; //
- var params = {
- classid : "610",
- FD_OBJECTID610 : fd_id,
- TASK_STATE_610 : "0",
- ISSUE_TIME_610:""
- };
-
- var alertmsg = "确定要撤销吗?";
- top.Dialog.confirm(alertmsg, function() {
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data) {
- //top.Dialog.alert('发布成功!', null, null, null, -1);
- _this.listGrid.rend();
-
-
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- });
- }
-
-
- }
-
- // 打开保供电任务信息页面
- _this.openDetail = function(rowindex) {
- var row = _this.listGrid.getRow(rowindex);
- var fd_id = row.FD_OBJECTID610;
- $('#frmright', window.parent.document).attr('src',$.pathname()+
- '/page/business/gps/taskManagement/taskAllmsg.jsp?fd_id='+fd_id);
- // window.open($.pathname() + '/page/business/gps/taskManagement/taskAllmsg.jsp?fd_id=' + fd_id, "保供电任务信息")
- };
- /** **查看详细信息*** */
- _this.show = 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_OBJECTID610;
- $('#frmright', window.parent.document).attr('src', $.pathname() + '/page/business/gps/taskManagement/detailTaskManagement.jsp?fd_id=' + fd_id);
- }
- };
- // 查询
- function search(obj) {
- if($("#PROGRAM_NAME_610").val() == "任务名称") {
- $("#PROGRAM_NAME_610").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() {
- $('#moreDiv').toggle();
- document.getElementById("queryForm").reset(); // 重置一下表单
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- }
- /*// 更多
- function more() {
- $('#moreDiv').toggle(200,function(){
- $("#emptyCondition").click();
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- });
- }*/
-
- return {
-
- init : function() {
-
- /*$("#PROGRAM_NAME_610").keydown(function(event){
- if(event.keyCode == 13){
- search();
- }
- });*/
- getCompName();//查询里面的单位
-
- $queryForm = $("#queryForm");
- /** 绑定查询面板的按钮点击事件* */
- $searchButt = $("#searchButt");// 查询按钮
-
- $searchButt.live({
- click: function() {
- // do something on click
- search();
- }
- });
-
- /*$("#PROGRAM_NAME_610").bind('keydown', function() {
- if(event.keyCode==13){search();};
- });*/
-
- /*$searchButt.bind('click', function() {
- search();
- });*/
- $("#PROGRAM_NAME_610").bind('enter', function() {
- search();
- });
- /** 绑定更多的按钮点击事件 */
- $more = $("#more"); // 更多按钮
- $more.bind('click', function() {
- more();
- });
- // 获得面板对象
- _this.searchPanel = $("#searchPanel");
- // 列表加载参数
-
- _this.loadParams = {
- listId : '610',
- condition : " (((INPUT_UNIT_ID='"+deptId+"' or GPS_AREA_ID like '%"+deptId+"%') AND TASK_STATE=1) OR (INPUT_NAME_ID='"+userId+"')) and IS_DEL=0 and PROGRAM_STATE = '1' ", //and TASK_STATE!='null'
- direction : 'desc', // 排序方式
- sort : 'UPDATEDATE'
- };
- /** grid载入数据* */
- /* _this.listGrid = $("#dataGrid").quiGrid({ */
- var grid_option={
- columns : [ {
- display : '任务名称',
- name : 'PROGRAM_NAME_610',
- showTitle:true,
- width : "8%",
- 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>";
- }
- },{
- display : '任务编号',
- name : 'GPS_TASK_NUMBER_610',
- showTitle:true,
- width : "3%"
- }/*,{
- display : '填报单位',
- name : 'INPUT_UNIT_NAME_610',
- showTitle:true,
- width : "8%"
- }*/,{
- /*display : '任务属性',
- columns :[{*/
- display : '任务性质',
- name : 'GPS_TASK_PROPERTY_610_SHOW',
- showTitle:true,
- width : "8%"
- },{
- display : '任务级别',
- name : 'GPS_LEVEL_610_SHOW',
- showTitle:true,
- width : "5%"
- },{
- display : '任务类别',
- name : 'GPS_TASK_TYPE_610_SHOW',
- showTitle:true,
- width : "8%"
- },{
- display : '任务来源',
- name : 'GPS_SIREL_610_SHOW',
- showTitle:true,
- width : "10%"
- },{
- display : '计划性',
- name : 'GPS_TASK_PLAN_TYPE_610_SHOW',
- showTitle:true,
- width : "8%"
- /*}]*/
- },{/*
- display : '保供电任务时间',
- columns :[{*/
- display : '开始日期',
- name : 'START_TIME_610',
- showTitle : true,
- width : "5%"
- }, {
- display : '结束日期',
- name : 'END_TIME_610',
- showTitle : true,
- width : "5%"
- /*}, {
- display : '持续时间',
- name : 'GPS_CONTINATION_TIME_610',
- showTitle : true,
- width : "8%"
- }]*/
- }, /*{
- display : '保供电资源投入',
- columns :[{
- display : '应急发电车(UPS电源)',
- columns :[{
- display : '单日最大用量/台',
- name : 'GPS_TASK_FDC_DAY_610',
- showTitle : true,
- width : "8%"
- }, {
- display : '投入总量/台次',
- name : 'GPS_TASK__FDC_TOTAL_610',
- showTitle : true,
- width : "8%"
- }]
- }, {
- display : '应急发电机(UPS电源)',
- columns :[{
- display : '单日最大用量/台',
- name : 'GPS_TASK_FDJ_DAY_610',
- showTitle : true,
- width : "8%"
- }, {
- display : '投入总量/台次',
- name : 'GPS_TASK_FDJ_TOTAL_610',
- showTitle : true,
- width : "8%"
- }]
- }, {
- display : '车辆/辆次',
- name : 'GPS_TASK_CAR_610',
- showTitle : true,
- width : "8%"
- }]
- }, {
- display : '保供电人员投入',
- columns :[{
- display : '值班指挥管理人员/人日',
- name : 'GPS_TASK_ZBZHGLRY_610',
- showTitle : true,
- width : "8%"
- }, {
- display : '本单位班组人员/人日',
- name : 'GPS_TASK_BDWBZRY_610',
- showTitle : true,
- width : "8%"
- }, {
- display : '安保人员/人日',
- name : 'GPS_TASK_ABRY_610',
- showTitle : true,
- width : "8%"
- }, {
- display : '外委生产人员/人日',
- name : 'GPS_TASK_WWSCRY_610',
- showTitle : true,
- width : "8%"
- }]
- },*/{
- display : '保供电区域',
- name : 'GPS_AREA_CITY_610',
- showTitle:true,
- width : "5%"
- }, {
- display : '保供电实施单位',
- name : 'GPS_AREA_NAME_610',
- showTitle:true,
- width : "12%"
- }, {
- display : '下达状态',
- name : 'TASK_STATE_610_SHOW',
- width : "3%"
- }, {
- display : '执行状态',
- name : 'GPS_ZX_STATE_610',
- width : "3%",
- render : function(rowdata, rowindex, value, column) {
- var value = "";
- if(rowdata.TASK_STATE_610=='0'){
- value = "未执行";
- }else{
- if(getDateTime()>rowdata.END_TIME_610){
- value = "已结束";
- }else {
- value = "执行中";
- }
- }
- return value;
- }
- } ],
- rownumbers : true,
- checkbox : true,
- pageSize : 10,
- percentWidthMode : true
- };
- var roleCons = roleButtonArr();
- var toolBarOpt = {
- items : [ {
- text : '删除',
- click : 'del',
- iconClass : 'delete_tem',
- disabled: false,
- id:"bgdsc"
- }, {
- text : '修改',
- click : 'editForm',
- iconClass : 'update_tem',
- disabled: false,
- id:"bgdxg"
- }, {
- text : '查看',
- click : 'show',
- iconClass : 'view_tem',
- id:'bgdck'
- }, {
- text : '发布',
- click : 'release',
- iconClass : 'release_tem',
- disabled: false,
- id:'bgdfb'
-
- }, {
- text : '撤销',
- click : 'rollback',
- iconClass : 'retract_tem',
- disabled: false,
- id:'bgdfb'
-
- } , {
- text : '导入',
- click : 'import_task',
- iconClass : 'import_tem',
- disabled: false,
- id:'bgdfb'
-
- }],
- roleCons : roleCons
- };
- var options = {
- url : '/nwyj/ws/crud/CRUDService/queryQui',
- params : _this.loadParams,
- width : 960,
- gridOptions : grid_option,
- paperOpration : {
- showInput : "true"
- },
- toolBarOptions : toolBarOpt
- };
- /** grid载入数据(定义数据列表)* */
- _this.listGrid = gridAndSingleRecode = $("#dataGrid").quickgridAndSingleRecode(options);
- /* }); */
- }
- };
- }();
- $(function() {
- ReportInput.init();
- });
- function showPrimaryKey(obj,index){
- var fd_id = obj.FD_OBJECTID610;
- $('#frmright', window.parent.document).attr('src',$.pathname()+
- '/page/business/gps/taskManagement/taskAllmsg.jsp?fd_id='+fd_id);
- }
- //获得当前系统时间:年月日时分
- function getDateTime(){
- var s="";
- var d = allGetServerTime();
- var vYear = d.getFullYear();
- var vMon = d.getMonth() + 1;
- var vDay = d.getDate();
- var h = d.getHours();
- var m = d.getMinutes();
- var se = d.getSeconds();
- s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)+"-"+(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h)+":"+(m<10 ? "0" + m : m)+":"+(se<10 ? "0" +se : se);
- return s;
- }
|