123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622 |
- /**
- * 功能:
- *
- *
- * @author LJP
- * @date 2015/10/09
- */
- //部门id
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var roleId = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- ReportInput = function() {
- /** 定义变量* */
- var _this = this;
- _this.listGrid = null;// 数据列表
- _this.searchPanel = null; // 查询面板
- $queryForm = null;// 查询区域表单
- $searchButt = null;// 查询按钮
- $more = null; // 更多
- _this.loadParams = null;// 列表加载参数
- /** 私有方法* */
- /** *新增信息** */
- _this.addForm = function() {
- $('#frmright', window.parent.document).attr('src',$.pathname()+"/page/business/em/response/report/reportInput1/ReportInputAddEdit.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.OPR_STATE_321 == 1) {
- top.Dialog.alert("选中的记录已经上报,请重新选择!");
- return;
- }// 判断选中的记录是否已经发布过
- if (row.IS_RELEASE_321 == 1) {
- top.Dialog.alert("选中的记录已经发布,请重新选择!");
- return;
- }
- var row = _this.listGrid.getSelectedRow();
- var fd_id = row.FD_OBJECTID321;
- var input_role = row.INPUT_ROLE_ID_321;
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/response/report/reportInput1/ReportInputAddEdit.jsp?fd_id='+fd_id+"&input_role="+input_role);
- }
- };
- /** *发布** */
- _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.OPR_STATE_321 == 4) {
- top.Dialog.alert("选中的记录已经回退,请重新选择!");
- return;
- }*/
- // 判断选中的记录是否已经发布过
- if (row.IS_RELEASE_321 == 1) {
- top.Dialog.alert("选中的记录已经发布过的,请重新选择!");
- return;
- }
- var fd_id = row.FD_OBJECTID321; //
- var params = {
- classid : "321",
- FD_OBJECTID321 : fd_id,
- IS_RELEASE_321 : "1"
- };
- 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('发布失败');
- }
- });
- },function(){return;}
- );
- }
- };
- /**上报**/
- _this.reported = 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.OPR_STATE_321 == 1) {
- top.Dialog.alert("选中的记录已经上报,请重新选择!");
- return;
- }
- var fd_id = row.FD_OBJECTID321; //
- var params = {
- classid : "321",
- FD_OBJECTID321 : fd_id,
- OPR_STATE_321:"1",
- IS_RELEASE_321 : "1"
- };
- var alertmsg = "确定要上报吗?|上报";
- if(row.IS_RELEASE_321 == 0){//未发布
- alertmsg = "该报告尚未发布,是否发布并上报?|上报";
- }/*else if(row.OPR_STATE_321 != 2 ){//已发布,未报送
- alertmsg = "该报告尚未报送,是否报送并上报?|上报";
- }*/
- if(row.INPUT_NAME_ID_321 != userId){//未发布
- top.Dialog.alert('非本人填报的报告,不能上报!', null, null, null, -1);
- return;
- }
- $.ajax({
- url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadReportInputByDeptAndTaskId',
- type : 'post',
- timeout : 15000,
- data : {
- planId : row.PLAN_ID_321,
- deptId : row.INPUT_UNIT_321,
- roleId : row.INPUT_ROLE_ID_321,
- reportType:"4"
- },
- ansyc:false,
- dataType : 'text',
- success : function(data) {
- if(data=="true"){
- top.Dialog.confirm("同时段,该填报要求工作动态报告已上报过,是否继续上报覆盖之前的报告?", function(){
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- async:false,
- success : function(data) {
- top.Dialog.alert('上报成功!', null, null, null, -1);
- _this.listGrid.rend();
- },
- error : function(e) {
- $.messager.alert('上报失败');
- }
- });
- },
- function(){return;}
- );
- }else{
- top.Dialog.confirm(alertmsg, function(){
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- async:false,
- success : function(data) {
- top.Dialog.alert('上报成功!', null, null, null, -1);
- _this.listGrid.rend();
- },
- error : function(e) {
- $.messager.alert('上报失败');
- }
- });
- },
- function(){return;}
- );
- }
- },
- error : function(e) {
- $.messager.alert('上报失败');
- }
- });
- }
- };
- /**报送**/
- _this.submission = 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.OPR_STATE_321 == 1) {
- top.Dialog.alert("选中的记录已经上报,请重新选择!");
- return;
- }else if(row.OPR_STATE_321 == 2) {
- top.Dialog.alert("选中的记录已经报送,请重新选择!");
- return;
- }
- var fd_id = row.FD_OBJECTID321; //
- var params = {
- classid : "321",
- FD_OBJECTID321 : fd_id,
- OPR_STATE_321:"2",
- IS_RELEASE_321 : "1"
- };
- var alertmsg = "确定要报送吗?|报送";
- if(row.IS_RELEASE_321 == 0){//未发布
- 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('报送失败');
- }
- });
- },function(){return;});
- }
- };
- /**撤回**/
- _this.recall = 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.IS_RELEASE_321 == 0) {
- top.Dialog.alert("选中的记录尚未发布,请重新选择!");
- return;
- }
- if (row.OPR_STATE_321 != 1) {
- top.Dialog.alert("选中的记录未上报,请重新选择!");
- return;
- }
- if (row.OPR_STATE_321 == 4) {
- top.Dialog.alert("选中的记录已经回退,请重新选择!");
- return;
- }
- // 判断选中的记录是否已经发布过
- if (row.OPR_STATE_321 == 3) {
- top.Dialog.alert("选中的记录已经撤回,请重新选择!");
- return;
- }
- if (row.INPUT_NAME_ID_321 != userId) {
- top.Dialog.alert("只能撤回本人上报的工作动态,请重新选择!");
- return;
- }
- var fd_id = row.FD_OBJECTID321; //
- var params = {
- classid : "321",
- FD_OBJECTID321 : fd_id,
- OPR_STATE_321:"3",
- IS_RELEASE_321 : "0"
- };
- top.Dialog.confirm("确定要撤回吗?|撤回", 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('撤回失败');
- }
- });
- });
- }
- };
- /**回退**/
- _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.INPUT_NAME_ID_321 == userId) {
- top.Dialog.alert("不能回退自己填写的报告,请重新选择!");
- return;
- }
- /*if (row.INPUT_UNIT_321 == deptId) {
- top.Dialog.alert("不能回退本单位填写的报告,请重新选择!");
- return;
- }*/
- var fd_id = row.FD_OBJECTID321; //
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/response/report/reportInput1/rollbackReportInput.jsp?fd_id='+fd_id);
- }
- };
- /** *删除信息** */
- _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_OBJECTID321 + ",";
- var row = rows[i];
- if (row.IS_RELEASE_321 == 1) {
- top.Dialog.alert("选中的记录有已发布,请重新选择!");
- return;
- }
- if (row.OPR_STATE_321 == 1) {
- top.Dialog.alert("选中的记录有已上报,请重新选择!");
- return;
- }
- }
- var url = $.pathname() + "/ws/crud/CRUDService/delete/";
- var params = {
- objectIDs : ids,
- classid : 321
- };
- 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("删除失败!");
- }
- });
- });
- };
- /** **查看详细信息*** */
- _this.show = function(fdId) {
- if(fdId){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/response/report/reportInput1/detailReportInput.jsp?fd_id='+fdId);
- }else{
- 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_OBJECTID321;
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/response/report/reportInput1/detailReportInput.jsp?fd_id='+fd_id);
- }
- }
- };
- // 查询
- function search(obj) {
- if($("#REPORT_NAME_321").val().trim()=="报告名称" || $("#REPORT_NAME_321").val().trim()==""){
- $("#REPORT_NAME_321").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(200,function(){
- $("#emptyCondition").click();
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- });
- }
- return {
- init : function() {
- $queryForm = $("#queryForm");
- /** 绑定查询面板的按钮点击事件* */
- $searchButt = $("#searchButt");// 更多查询按钮
- $searchButt.live('click', function() {
- search();
- });
- $searchOne = $("#searchOne");//查询图标绑定查询事件
- $searchOne.bind('click', function() {
- search();
- });
- $("#REPORT_NAME_321").keydown(function(event){
- if(event.which == "13")
- $searchOne.click();
- });
- /** 绑定更多的按钮点击事件 */
- $more = $("#more"); // 更多按钮
- $more.bind('click', function() {
- more();
- });
- $(".l-grid-body-table .isPrimaryKey").live("click",function(){
- var rowdata = $(this).find("a").data("rowdata");
- if(rowdata){
- var fdId = rowdata.FD_OBJECTID321;
- show(fdId);
- }
- });
- // 获得面板对象
- _this.searchPanel = $("#searchPanel");
- roleId = getRoleNameById(roleId);
-
- // 列表加载参数
- _this.loadParams = {
- listId : '321',
- condition : "is_del=0 AND REPORT_TYPE LIKE '%4%' and is_alert=1 AND ((IS_RELEASE=1 AND INPUT_UNIT='"+deptId+"') or INPUT_NAME_ID='"+userId+"' or (OPR_STATE=1 and INPUT_UNIT='"+deptId+"'))",
- direction : 'desc', // 排序方式
- sort : 'UPDATEDATE'
- };
- /** grid载入数据* */
- //_this.listGrid = $("#dataGrid").quiGrid({
- var grid_option={
- columns : [{
- display : '报告名称',
- name : 'REPORT_NAME_321',
- //showTitle:true,
- width : "20%",
- isSort : false,
- isPrimaryKey:true,
- render:function(rowdata, rowindex, value, column){
- value = "<a href='javascript:;' data-rowdata='"+JSON.stringify(rowdata)+"' title='"+value+"'>"+value+"</a>";
- return value;
- }
- },{
- display : '应急响应编号',
- name : 'EARLY_ID_321',
- showTitle:true,
- width : "15%"
- },{
- display : '填报角色',
- name : 'INPUT_ROLE_ID_321_SHOW',
- showTitle:true,
- width : "15%"
- }, {
- display : '填报单位',
- name : 'INPUT_UNIT_321_SHOW',
- showTitle:true,
- width : "8%"
- }, {
- display : '填报人',
- name : 'INPUT_NAME_321',
- showTitle:true,
- width : "5%"
- }, {
- display : '填报时间',
- name : 'INPUT_DATE_321',
- showTitle:true,
- width : "13%"
- }, {
- display : '要求填报时间',
- name : 'PLAN_TIME_321',
- showTitle:true,
- width : "10%"
- }, {
- display : '报送状态',
- name : 'OPR_STATE_321_SHOW',
- width : "5%"
- }, {
- display : '发布状态',
- name : 'IS_RELEASE_321_SHOW',
- width : "5%"
- } ],
- rownumbers : true,
- checkbox : true,
- pageSize : 10,
- percentWidthMode : true};
-
- var roleCons = roleButtonArr();
- var toolBarOpt={
- items : [ {
- text : '新增',
- click : 'addForm',
- iconClass : 'add1_tem',
- id : '25tj'
- },{
- text : '删除',
- click : 'del',
- iconClass : 'delete_tem',
- id : '25sc'
- }, {
- text : '修改',
- click : 'editForm',
- iconClass : 'update_tem',
- id : '25xg'
- }, /*{
- text : '查看',
- click : 'show',
- iconClass : 'view_tem'
- },*/ {
- text : '发布',
- click : 'release',
- iconClass : 'release_tem',
- id : '25fb'
- }/*,{
- text : '报送',
- click : 'submission',
- iconClass : 'sendreport_tem'
- }*/, {
- text : '上报',
- click : 'reported',
- iconClass : 'sendup_tem',
- id : '25sb'
- }, {
- text : '撤回',
- click : 'recall',
- iconClass : 'retract_tem',
- id : '25ch'
- }, {
- text : '回退',
- click : 'rollback',
- iconClass : 'rollback_tem',
- id : '25ht'
- } ],
- 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(row,index){//row为整条数据,index为第几字段,index是从0开始的
- var fdId = row.FD_OBJECTID321;
- show(fdId);
- }
- /**
- 判断包含哪个角色
- **/
- function getRoleNameById(roleid){
- var rol_name = "";
- var role_id;
- $.ajax({
- url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadJBRole',
- type : 'post',
- timeout : 15000,
- dataType : 'json',
- data:{"corpId":deptId},
- async:false,
- success : function(data) {
- for (var i = 0; i < data.length; i++) {
- if(roleid.indexOf(data[i].ROLE_ID) != -1){
- rol_name = data[i].ROLE_NAME;
- role_id = data[i].ROLE_ID;
- break;
- }
- }
- },
- error : function(e) {
- $.messager.alert('报送失败');
- }
- });
- return role_id
- }
|