123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- /**定义变量**/
- var _this = this;
- /**私有方法**/
- /***新增信息***/
- _this.save = function(){
- var message='';
- var equipmentval;
- var equipmenttext;
- var safeyval;
- var safetext;
- var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- }else if(pattern.test($("#MISSION_NAME_703").val())){
- top.Dialog.alert("填报要求名称不能包含特殊字符");
- return;
- }
- $('#editForm input[name="classid"]').val('703');
- //获得填报地区名
- var write_area=$("#WRITE_AREA_ID_703_show").val();
- $("#WRITE_AREA_703").val(write_area);
- //获取表名及部门名称
- if($("#EQUIPMENT_DEPT").attr("relText")!="请选择" && $("#EQUIPMENT_DEPT").attr("relText")!=undefined){
- var tb1='';
- equipmentval = splits($("#EQUIPMENT_DEPT").attr("relValue"));
- equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
- var nodes = $("#EQUIPMENT_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- if(i==nodes.length-1){
- tb1=tb1+nodes[i].report_type+"||";
- }else{
- tb1=tb1+nodes[i].report_type+",";
- }
- }
- message += "生产设备部:"+equipmenttext+";"+equipmentval.split(";")[0]+":"+tb1;
- }
- if($("#SAFEY_DEPT").attr("relText")!="请选择" && $("#SAFEY_DEPT").attr("relText")!=undefined){
- var tb2='';
- safeyval = splits($("#SAFEY_DEPT").attr("relValue"));
- safetext = $("#SAFEY_DEPT").attr("relText");
- var nodes = $("#SAFEY_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- if(i==nodes.length-1){
- tb2+=nodes[i].report_type;
- }else{
- tb2+=nodes[i].report_type+",";
- }
- }
- message += "安全监察部:"+safetext+";"+safeyval.split(";")[0]+":"+tb2;
- }
- //将报表及部门录入
- $("#REPORT_DEPT_703").val(message);
- if(message==""){
- top.Dialog.alert("请选择至少一张表!");
- return;
- }
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- return;
- }
- if(valid){
- showProgressBar("正在提交中...");
- var formValue = $form.serialize();
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
- url = $.pathname() +"/ws/crud/CRUDService/update/";
- }
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- $('#frmright', window.parent.document).attr('src','/nwyj/page/business/em/report/SpecialReport.jsp');
-
- });
- }
-
- };
-
-
- _this.saveAndRelease = function(){
- var message='';
- var equipmentval;
- var equipmenttext;
- var safeyval;
- var safetext;
- var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- }else if(pattern.test($("#MISSION_NAME_703").val())){
- top.Dialog.alert("填报要求名称不能包含特殊字符");
- return;
- }
- $('#editForm input[name="classid"]').val('703');
- //获得填报地区名
- var write_area=$("#WRITE_AREA_ID_703_show").val();
- $("#WRITE_AREA_703").val(write_area);
- //获取表名及部门名称
- if($("#EQUIPMENT_DEPT").attr("relText")!="请选择" && $("#EQUIPMENT_DEPT").attr("relText")!=undefined){
- var tb1='';
- equipmentval = splits($("#EQUIPMENT_DEPT").attr("relValue"));
- equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
- var nodes = $("#EQUIPMENT_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- if(i==nodes.length-1){
- tb1=tb1+nodes[i].report_type+"||";
- }else{
- tb1=tb1+nodes[i].report_type+",";
- }
- }
- message += "生产设备部:"+equipmenttext+";"+equipmentval.split(";")[0]+":"+tb1;
- }
- if($("#SAFEY_DEPT").attr("relText")!="请选择" && $("#SAFEY_DEPT").attr("relText")!=undefined){
- var tb2='';
- safeyval = splits($("#SAFEY_DEPT").attr("relValue"));
- safetext = $("#SAFEY_DEPT").attr("relText");
- var nodes = $("#SAFEY_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- if(i==nodes.length-1){
- tb2+=nodes[i].report_type;
- }else{
- tb2+=nodes[i].report_type+",";
- }
- }
- message += "安全监察部:"+safetext+";"+safeyval.split(";")[0]+":"+tb2;
- }
- //将报表及部门录入
- $("#REPORT_DEPT_703").val(message);
- if(message==""){
- top.Dialog.alert("请选择至少一张表!");
- return;
- }
-
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- return;
- }
- if(valid){
- showProgressBar("正在提交中...");
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
- url = $.pathname() +"/ws/crud/CRUDService/update/";
- }
- var start_time_check = $("#START_TIME_703").val();
- var affair_type = $("#EARLY_WARNING_NAME_703").val();
- $
- .ajax({
- url : $.pathname()
- + '/ws/xianlutingyun/XianlutingyunService/checkSpecialReport/',
- type : 'post',
- data : {
- start_time : start_time_check,
- affair_type : affair_type
- },
- async : false,
- dataType : 'text',
- success : function(data) {
- if (data != "") {
- top.Dialog
- .confirm(
- "当日已经有已发布的同类型的特殊报表任务,是否确认发布?",
- function() {
- //根据id结束已发布的特殊报表任务
- var params = {
- classid : "703",
- FD_OBJECTID703 : data,
- IS_RELEASE_703 : "2"
- };
- $
- .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);
- //发布时才获取发布时间
- $("#SEND_TIME_703").val(getDateTime());
- //确定发布时才改变发布状态
- $("#IS_RELEASE_703").val("1");
- var formValue = $form.serialize();
- $
- .ajax({
- url : url,
- type : 'post',
- data : formValue,
- async : false,
- dataType : 'json',
- success : function(
- data) {
- top.Dialog
- .alert("新任务发布成功!");
- //获取iframe中的元素值
- var iframe = parent.document
- .getElementsByName("frmright")[0];
- iframe.src = "/nwyj/page/business/em/report/SpecialReport.jsp";
- },
- error : function(
- e) {
- $.messager
- .alert(
- '系统提示信息',
- '访问服务失败!',
- 'error');
- }
- });
- },
- error : function(e) {
- $.messager
- .alert(
- '系统提示信息',
- '访问服务失败!',
- 'error');
- }
- });
- }, function() {
- //点击取消取消发布
-
- return;
- });
- } else {
- top.Dialog.confirm("是否确认发布?",function(){
- //发布时才获取发布时间
- $("#SEND_TIME_703").val(getDateTime());
- //确定发布时才改变发布状态
- $("#IS_RELEASE_703").val("1");
- var formValue = $form.serialize();
- $.ajax({
- url :url,
- type : 'post',
- data : formValue,
- async : false,
- dataType : 'json',
- success : function(data) {
- top.Dialog.alert("发布成功!");
- //获取iframe中的元素值
- var iframe = parent.document
- .getElementsByName("frmright")[0];
- iframe.src = "/nwyj/page/business/em/report/SpecialReport.jsp";
- },
- error : function(e) {
- $.messager.alert('系统提示信息',
- '访问服务失败!', 'error');
- }
- });
- },function(){
- return;
- });
-
- }
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
-
- }
-
- };
-
-
- function formReset(){
- top.Dialog.confirm("确定要重置?将会清空填写的数据,请慎重选择|重置",
- function(){$('#frmright', window.parent.document).attr('src',$.pathname()+ '/scripts/business/em/response/report/addSpecialReportMission.jsp?fd_id='+fd_id);},
- function(){return;});
-
-
- };
-
-
- //初始化绑定按钮的点击事件
- function init() {
- $('#save').bind('click',function(){
- _this.save();
- });
- $("#saveAndRelease").bind("click",function(){
- _this.saveAndRelease();
- });
- $('#goback').bind('click',function(){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/report/SpecialReport.jsp');
- });
- }
-
- //初始化页面
- $(function() {
- //加载按钮的点击事件
- init();
- //加载报表选择的下拉框
- initTypeSel();
- //获得reportid并赋值(见鬼了不知道为啥写jsp页面里没反应,只能写这里了)
- role_id = getReportRole();
- $("#ROLE_ID_703").val(role_id);
- });
- /**
- * 报表类型加载
- */
- function initTypeSel(){
- var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getRequireTypeSel";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 15000,
- async : false,
- data : {
- xg:"xg",
- "comp_id" : deptId
-
- },
- dataType : 'json',
- success : function(data) {
- for(var i=0;i<data.length;i++){
- var data1 = data[i].value;
- data1 = eval('('+data1+')');
- if(data[i].key=='R002105430211'){
- var special = {treeNodes:[]};
- for(var j = 0;j<data1.treeNodes.length;j++){
- if(data1.treeNodes[j].report_type=="114"||data1.treeNodes[j].report_type=="113"||data1.treeNodes[j].report_type=="115"||data1.treeNodes[j].report_type==""){
- special.treeNodes.push(data1.treeNodes[j]);
- }
- }
- debugger;
- $("#EQUIPMENT_DEPT").data("data",special);
- $("#EQUIPMENT_DEPT").render();
- }
- if(data[i].key=='R002105430213'){
- var special = {treeNodes:[]};
- for(var j = 0;j<data1.treeNodes.length;j++){
- if(data1.treeNodes[j].report_type=="110"||data1.treeNodes[j].report_type=="111"||data1.treeNodes[j].report_type=="108"||data1.treeNodes[j].report_type==""){
- special.treeNodes.push(data1.treeNodes[j]);
- }
- }
- $("#SAFEY_DEPT").data("data",special);
- $("#SAFEY_DEPT").render();
- }
-
- }
- },
- error : function(e) {
- $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
- }
- });
- }
- //将角色Id劈开
- function splits(val){
- relval = val.split(",")[0];
- return relval;
- }
|