1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172 |
- var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- // 保存公司Id变量
- var compId = corpId;
- var corpName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var mobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
- var loginName = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
- //获取用户Id
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- //单位名称简称
- var corpShortName = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/getShortCompName", {
- "comp_id" : compId,"comp_name":corpName
- }, "text");
- var g;
- var mycol;
- var mycol1;
- var testData;
- var checkWrite = false;
- // 统计表和明细表
- var maintableType = "";
- // 保存报表类型,用于切换报表类型失败时重新赋值
- var excType = "";
- //获取用户角色id
- var role_ids = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- //专业管理部门角色
- var zyRoleArr = getZyRole(role_ids);
- var zyRole = zyRoleArr.join(",");
- //返回用户专业管理部门角色的字符串----格式:'role_id','role_id'
- var zyRoleId = getUserZyRole(zyRoleArr);
- var _thisUrl = decodeURI(window.location.href);
- var backUrl = "/nwyj/page/business/em/report/Report_main.jsp";
- //保存报表类型
- var report_type = "";
- //保存角色id
- var role_id = "";
- //任务id
- var fdIds = "";
- //任务名称
- var plan_name = "";
- //事件类型名称
- var affairType = "";
- //事件类型id
- var affair = "";
- //草稿填报还是正常时间点填报
- var draftWrite = "";
- //填报时间点
- var report_time = "";
- //该变量用于保存可编辑的行号
- var rowNumArr = [];
- var isValida = true; // 是否需要验证
- var require = "";
- var flag = false;
- var flag1 = false;
- var selecta = "";
- var editingRow = "";
- //判断是否是班组 默认为单位
- var deptFlag = "false";
- //单位级别,根据deptFlag判断
- var deptLevel = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/getDeptLevel", {
- "comp_id" : compId
- }, "text");
- var level = deptLevel;
- //应急资源表的跨区域选择
- var areaData = "";
- var yjzyGrid = "";
- //判断是否有操作列
- var rollbackFlag = false;
- //用于判断本单位是否有下级填报单位,有下级填报单位时为true 班组部门没有下级填报单位
- var hasSubUnit = "";
- var clickFlag = false;
- var lockFlag = false;
- var taskFlag;//判断是否给下级单位下发了任务
- //预警发布及响应启动情况表
- var urls1 = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getAlertMsg";
- var warn_url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getNeedWritePro";
- var data11 = {
- "list" : [ {
- "value" : "红色预警",
- "key" : "红色预警"
- }, {
- "value" : "橙色预警",
- "key" : "橙色预警"
- }, {
- "value" : "黄色预警",
- "key" : "黄色预警"
- }, {
- "value" : "蓝色预警",
- "key" : "蓝色预警"
- }, {
- "value" : "一级响应",
- "key" : "一级响应"
- }, {
- "value" : "二级响应",
- "key" : "二级响应"
- }, {
- "value" : "三级响应",
- "key" : "三级响应"
- }, {
- "value" : "四级响应",
- "key" : "四级响应"
- } ]
- };
- var data22 = {
- "list" : [ {
- "value" : "一级响应",
- "key" : "一级响应"
- }, {
- "value" : "二级响应",
- "key" : "二级响应"
- }, {
- "value" : "三级响应",
- "key" : "三级响应"
- }, {
- "value" : "四级响应",
- "key" : "四级响应"
- } ]
- };
- var huifu = {
- "list" : [ {
- "value" : "是",
- "key" : "是"
- }, {
- "value" : "否",
- "key" : "否"
- } ]
- };
- var shqk = {
- "list" : [ {
- "value" : "轻伤",
- "key" : "轻伤"
- }, {
- "value" : "重伤",
- "key" : "重伤"
- }, {
- "value" : "死亡",
- "key" : "死亡"
- }, {
- "value" : "受困",
- "key" : "受困"
- }, {
- "value" : "失踪",
- "key" : "失踪"
- }, {
- "value" : "其它",
- "key" : "其它"
- } ]
- };
- var xb = {
- "list" : [ {
- "value" : "男",
- "key" : "男"
- }, {
- "value" : "女",
- "key" : "女"
- }
- ]
- };
- var dbtype = {
- "list" : [ {
- "value" : "变电站",
- "key" : "变电站"
- }, {
- "value" : "发电厂",
- "key" : "发电厂"
- }, {
- "value" : "换流站",
- "key" : "换流站"
- }, {
- "value" : "用户站",
- "key" : "用户站"
- }
- ]
- };
- var dydj = {
- "list" : [
- {
- "value" : "500kV",
- "key" : "500kV"
- }, {
- "value" : "220kV",
- "key" : "220kV"
- }, {
- "value" : "110kV",
- "key" : "110kV"
- }, {
- "value" : "35kV",
- "key" : "35kV"
- } ]
- };
- var wh = "";
- //明细表的数据
- var xqData;
- function initComplete() {
- $(".mainCon").live("click", function() {
- if (maintableType != "1") {
- g.endEdit();
- }
- });
- $(".l-grid-hd-cell-text").css("color", "white");
- // 自动补齐数据
- $("#lock").live("click", function() {
- if (!lockFlag) {
- lockFlag = true;
- $("#lock").parent().addClass("backcolor");
- $("#lock").attr("title", "单元格获取上次数据开启");
- } else {
- lockFlag = false;
- $("#lock").parent().removeClass("backcolor");
- $("#lock").attr("title", "单元格获取上次数据关闭");
- }
- });
-
- //只有是单位才会有下级填报单位
- $(".company a").live("click",function(){
- var type = $("#sel").val();//报表类型
- var rowdata = g.getSelectedRow();
- console.log(JSON.stringify(rowdata));
- var comp = rowdata.COMP_ID;
- var comp_name = rowdata.COMP_NAME;
- var alert_id = rowdata.REPORT_ID;//记录id,没有上报数据为""
- var diag = new top.Dialog();
- diag.Title = "修改报表";
- diag.URL = encodeURI("/nwyj/page/business/em/report/Alert_Data.html");
- diag.Height = 560; diag.Width= 1200;
- diag.showOkButton = false;
- diag.showCancelButton = false;
- diag.ShowMaxButton = true;
- diag.show();
- diag.OnLoad = function(){
- diag.innerFrame.contentWindow.showData(type,comp,comp_name,role_id,affair,affairType,alert_id);
- };
- });
-
- //初始化报表责任部门数据
- getDeptRole();
-
- console.log(_thisUrl);
- var reportData = _thisUrl.split("?");
- if (reportData.length == 9) {// 从代办进入填报页面
- // 报表类型
- report_type = reportData[1];
- // 任务id
- fdIds = reportData[2];
- // 角色id
- role_id = reportData[3];
- // 事件类型名称
- affairType = reportData[4];
- // 事件类型id
- affair = reportData[5];
- //任务名称
- plan_name = reportData[6];
- // 当前填报时间的填报(false),不是当前填报时间节点的填报--作为草稿填报(true)
- draftWrite = reportData[7];
- //填报时间点
- report_time = reportData[8];
- console.log("待办任务id:"+fdIds+";待办任务名称:"+plan_name+";draftWrite:"+draftWrite+";填报时间:"+report_time);
-
- $("#sel").setValue(report_type);
- $("#sel").attr("disabled", true);
- $("#sel").render();
- $("#roleSel").setValue(role_id);
- $("#roleSel").attr("disabled", true);
- $("#roleSel").render();
- //根据事件类型和报表类型判断是否为班组
- deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
- "corpId" : compId,
- "deptId" : deptId,
- "affair" : affair,//事件类型id
- "report_type" : report_type
- }, "text");
-
- if("true"==deptFlag){//班组部门
- deptLevel = level - 1;
- corpId = deptId;
- }else{
- deptLevel = level;
- corpId = compId;
- }
-
- excType = report_type;
- var tableType = getThing($.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/getCheckType", {
- report_type : report_type
- }, 'text');
- maintableType = tableType;
- //初始化报表模版
- getRole(role_id, report_type);
- //加载填写说明
- getRequire(role_id);
-
- //班组部门没有下级填报单位
- if("0"==maintableType && "false"==deptFlag){
- //用于判断本单位是否有下级填报单位,有下级填报单位时为true
- hasSubUnit = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/checkSubUnit", {
- "comp_id" : compId,
- "role_id" : role_id,
- "affair" : affair,
- "report_type" : report_type
- }, "text");
- if(hasSubUnit == "true"){
- rollbackFlag = true;//该单位(非班组)有下级填报单位 可作为判断是否需要汇总和显示操作列
- }
- //若没有给下级单位下发任务,那么整个表格可以编辑。不需要汇总下级单位数据及操作列
- taskFlag = getThing($.pathname() + "/ws/baoBiao/BaoBiaoService/getReportTaskComp",{
- "comp_id" : compId,
- "role_id" : role_id,
- "affair" : affair,
- "report_type" : deptLevel=="2" && report_type=="101"?"2":report_type
- },"text");
- if(taskFlag===""){//没有有任务
- rollbackFlag = false;
- }
- }
-
- //贵州版本任务只下发到县区,下级的供电所作为县区的部门。县区那层级不需要代填
- if(parseInt(deptLevel)>3){
- rollbackFlag = false;
- }
-
- //统计表工具栏菜单
- var item = getItem(report_type);
- //表头
- getColumns(report_type,affair);
-
- $("#add").text("新增" + corpName + mycol1);
- $("#affair").text(affairType);
- //报表计划信息展示
- getReportPlanInfo();
-
- //填写说明
- changeRequireByVal(report_type);
-
- if (tableType == "1") {// 明细表
- if (report_type == "7") {
- $("#maingrids").show();
- initGrid(urls1, report_type);
- } else {
- $("#maingrid2").show();
- var item1 = getXqItem(report_type);
- //明细表汇总下级单位数据
- // checkXqHuiZong(rollbackFlag);
- getXqtotal();
- initGrid1(xqData, item1, report_type);
- }
- } else {// 统计表
- //应急资源表的跨区域显示
- getAreaData(deptLevel);
- $("#maingrid").show();
- //初始化获取单位数据
- getRows(report_type,affair);
- //加载表格数据
- init(testData, item, report_type);
- //汇总下级单位数据
- checkHuiZong(rollbackFlag);
- }
- } else {
- affairType = reportData[1].split("=")[1];
- affair = reportData[2].split("=")[1];
- role_id = $("#roleSel").val();
- //报表类型
- report_type = getType(role_id);
- //根据事件类型和报表类型判断是否为班组
- deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
- "corpId" : compId,
- "deptId" : deptId,
- "affair" : affair,
- "report_type" : report_type
- }, "text");
-
- if("true"==deptFlag){
- deptLevel = level - 1;
- corpId = deptId;
- }else{
- deptLevel = level;
- corpId = compId;
- }
-
- var miantableType = getThing($.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/getCheckType", {
- report_type : report_type
- }, 'text');
- maintableType = miantableType;
-
- //班组部门没有下级填报单位
- if("0"==miantableType && "false"==deptFlag){
- //用于判断本单位是否有下级填报单位,有下级填报单位时为true
- hasSubUnit = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/checkSubUnit", {
- "comp_id" : compId,
- "role_id" : role_id,
- "report_type" : report_type,
- "affair" : affair
- }, "text");
- if(hasSubUnit == "true"){
- rollbackFlag = true;
- }
- //若没有给下级单位下发任务,那么整个表格可以编辑。不需要汇总下级单位数据及操作列
- taskFlag = getThing($.pathname() + "/ws/baoBiao/BaoBiaoService/getReportTaskComp",{
- "comp_id" : compId,
- "role_id" : role_id,
- "affair" : affair,
- "report_type" : report_type
- },"text");
- if(taskFlag===""){//没有有任务
- rollbackFlag = false;
- }
-
-
- }
-
- //贵州版本任务只下发到县区,下级的供电所作为县区的部门。县区那层级不需要代填
- if(parseInt(deptLevel)>3){
- rollbackFlag = false;
- }
- //报表模版初始化
- getRole(role_id);
- //加载填写说明
- getRequire(role_id);
-
- // 报表填报点击新增时新增
- getColumns(getType(role_id),affair);
- if (report_type == "100") {
- $("#requires").hide();
- }
- excType = report_type;
- //根据报表类型显示填写说明
- changeRequireByVal(report_type);
- var inititem = getItem(report_type);
-
- //根据事件类型和报表类型查询报表计划
- getReportPlan();
- $("#affair").text(affairType);
- $("#add").text("新增" + corpName + mycol1);
- //报表计划信息展示
- getReportPlanInfo();
-
-
- if (miantableType == "1") {
- if (report_type == "7") {
- $("#maingrids").show();
- initGrid(urls1);
- } else {
- $("#maingrid2").show();
- var item2 = getXqItem(report_type);
- //明细表汇总下级数据
- // checkXqHuiZong(rollbackFlag);
- getXqtotal();
- initGrid1(xqData, item2);
- }
- } else {
- //应急资源表的跨区域显示
- getAreaData(deptLevel);
-
- $("#maingrid").show();
- getRows(report_type,affair);
- init(testData, inititem, report_type);
- //汇总下级数据
- checkHuiZong(rollbackFlag);
- }
- }
- $("#back").hover(function() {
- $(this).attr("src", "/nwyj/images/temp/back_hover.png");
- }, function() {
- $(this).attr("src", "/nwyj/images/temp/back.png");
- });
- }
- $(function() {
- $("#lock").attr("title", "单元格获取上次数据关闭");
- $("#handlerinfo").parent().attr("title", "开启填报报表明细填写情况");
- $("#drscsj").parent().attr("title", "点击导入上次填报的数据");
- $("#hzxjsj").parent().attr("title", "点击自动汇总导入下级上报的数据");
- $(".l-grid-hd-cell-text").css("color", "white");
- $more = $("#more"); // 更多按钮
- $more.bind('click', function() {
- more();
- });
- });
- /**
- * 根据事件类型查询报表计划
- */
- function getReportPlan(){
- var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportPlan";
- var params = {"report_type":report_type,"affair":affair,"comp_id":compId,"dept_id":deptId,"role_id":role_id,"deptFlag":deptFlag};
- $.ajax({
- url : url,
- type : "post",
- data : params,
- dataType : "json",
- async : false,
- success : function(result){
- fdIds = "";
- plan_name = "";
- if(result.length>0){
- var data = result[0];
- fdIds = data.key;
- plan_name = data.value;
- draftWrite = data.stat;
- report_time = data.time;
- console.log("fd_id:"+fdIds+";plan_name:"+plan_name+";draftWrite:"+draftWrite+";report_time:"+report_time);
- }
- },
- error : function(){
- $.messager.alert('查询报表计划失败!', '访问服务失败!', 'error');
- }
- });
- }
- function getReportPlanInfo(){
- if(""==fdIds){
- $("#showRequire").hide();
- $("#showplan").hide();
- }else{
- $("#showRequire").show();
- $("#plan").text("");
- $("#start_time").text("");
- $("#end_time").text("");
- $("#report_times").text("");
- $("#report_time").text("");
- var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportPlanInfo";
- $.ajax({
- url : url,
- type : "post",
- data : {fd_id:fdIds,stat:"add"},
- dataType : "json",
- async : false,
- success : function(result){
- $("#plan").text(plan_name);
- $("#start_time").text(result[0]["start_time"]);
- $("#end_time").text(result[0]["end_time"]);
- $("#report_times").text(result[0]["report_times"]);
- $("#report_time").text(report_time);
- },
- error : function(){
- $.messager.alert('查询报表计划信息失败!', '访问服务失败!', 'error');
- }
- });
- }
- }
- function getAreaData(level){
- $(".areaSel").hide();
- if (report_type=="8") {
- if(level=='3'){
- areaData = {"list" : [ {"value" : "0","key" : "不跨省调拨"}, {"value" : "1","key" : "跨省调拨"}]};
- $(".areaSel").show();
- $("#areaSel").data("data", areaData);
- $("#areaSel").render();
- }else if(level=='4'){
- areaData = {"list" : [ {"value" : "0","key" : "不跨市调拨"}, {"value" : "1","key" : "跨市调拨"}]};
- $(".areaSel").show();
- $("#areaSel").data("data", areaData);
- $("#areaSel").render();
- }
- }
- }
- /**
- * 加载统计表表格数据
- * @param data
- * @param item 工具栏菜单
- * @param type 报表类型
- */
- function init(data, item, type) {
- g = null;
- var gridObj = "";
- if (type != "8") {
- gridObj = $("#maingrid");
- $("#yjzy").hide();
- $("#maingrid").show();
- } else {
- gridObj = $("#yjzy");
- $("#yjzy").show();
- $("#maingrid").hide();
- if(deptLevel==3 || deptLevel==4){
- $(".areaSel").show();
- }else{
- $(".areaSel").hide();
- }
- }
- g = gridObj.quiGrid({
- columns : mycol,
- data : data,
- usePager : false,
- sortName : 'id',
- headerRowHeight : 50,
- rownumbers : true,
- enabledEdit : true, // 编辑用
- width : "100%",
- /* height:"80%", */
- multihead : true,
- enabledSort : false,
- excelMode : true,
- alternatingRow : false,
- rowAttrRender : function(rowdata, rowid) {
- //OVERSTAT为0表示2小时之前的数据
- return "0" == rowdata.OVERSTAT ? "style=\"background-color:yellow;\""
- : '';
- },
- toolbar : {
- items : item
- },
- onAfterEdit : onAfterEdit,
- onBeforeEdit : onBeforeEdit,
- onAfterShowData : function() {
- setTjContentHeight(type);
- $("body").eq(0).hideLoading();
- }
- });
- // console.log(g.options.toolbar);
- if(rollbackFlag){
- $("#hzxjsj").parent().siblings().removeClass("backcolor");
- $("#hzxjsj").parent().addClass("backcolor");
- }
- }
- var oldVal;
- function onBeforeEdit(e) {
- var position = mousePosition(this);
- if(position.x>1100){
- g.setScroller(null,position.x,false);
- }
- //非班组且有下级填报单位,首行非中调或局本部的及不可编辑
- if(rollbackFlag && e.record.COMP_ID!=corpId && $.inArray(e.rowindex,rowNumArr)==-1){
- return false;
- }
- var len = g.getData().length;
- if (e.rowindex == len - 1) {
- top.Dialog.alert("此行不能编辑", null, null, null, -1);
- return false;
- }
- if (e.column.name == 'BZYDW_ID' && e.rowindex == len - 1) {
- top.Dialog.alert("此单元格不能编辑", null, null, null, -1);
- return false;
- }
- if (e.column["columnname"] == "SWRYMXB_TJ" && report_type == "10") {
- top.Dialog.alert("此列不能编辑", null, null, null, -1);
- return false;
- }
- if (e.value != null && e.value != "") {
- oldVal = e.value;
- } else {
- oldVal = 0;
- }
- }
- var num1 = 0;
- function onAfterEdit(e) {
- if (maintableType != "1" && num2 == 0) {
- if (e.column.isCount != 0) {
- return false;
- }
- if (isNaN(e.value)) {
- e.value = 0;
- }
- var size = g.getData().length;
- if (e.value == null || e.value == "") {
- e.value = "0";
- checkWrite = true;
- }
- if (e.value != null && e.value != "" && e.value != "0") {
- // 判断该单元格是否有值
- checkWrite = true;
- var Dataparams = {
- "value" : e.value,
- "column" : e.column.name,
- "comp_id" : corpId,
- "corp_id" : e.record.COMP_ID,
- "report_type" : $("#sel").val()
- };
- if (report_type == '1'
- && e.column.name.indexOf("TRIP_OUT_TOTAL_") > -1
- && !isNaN(e.value)) {
- $.ajax({
- url : $.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/CheckCellValue",
- type : "post",
- data : Dataparams,
- dataType : "text",
- success : function(data) {
- // alert(data);
- if (data == "false") {
- top.Dialog.alert("当前输入的数据小于最新记录数据");
- }
- },
- error : function() {
- $.messager.alert('查询失败!', '访问服务失败!', 'error');
- }
- });
- }
- }
- if (report_type == "10") {
- var RowObj = (g.getRow(e["record"]["__id"]));
- var count = RowObj["SWRYMXB_TJ"] == ""
- || RowObj["SWRYMXB_TJ"] == undefined
- || RowObj["SWRYMXB_TJ"] == "undefined" ? "0"
- : RowObj["SWRYMXB_TJ"];
- var oldCount = count;
- count = parseInt(count, 10) + parseInt(e.value, 10)
- - parseInt(oldVal, 10);
- g.updateCell("SWRYMXB_TJ", count, RowObj);
- var lastTj = g.getRow(size - 1)["SWRYMXB_TJ"] == "" ? "0" : g
- .getRow(size - 1)["SWRYMXB_TJ"];
- g.getRow(size - 1)["SWRYMXB_TJ"] = parseInt(lastTj, 10)
- + parseInt(count, 10) - oldCount;
- }
- var updatecolumn = e.column.name;
- num1 = g.getRow(size - 1)[updatecolumn] == ""
- || g.getRow(size - 1)[updatecolumn] == undefined ? "0" : g
- .getRow(size - 1)[updatecolumn];
- num1 = getZjResult(num1, e.value, oldVal);// Math.round((parseFloat(num1)+parseFloat(e.value)-oldVal)*100)/100;
- var row = g.getRow(size - 1);
- row[updatecolumn] = num1;
- var row1 = g.getRow(e.rowindex);
- row1[updatecolumn] = parseFloat(e.value);
- g.updateRow(e.rowindex, row1);
- g.updateRow(size - 1, row);
-
- if (flag && num % 2 != 0 && checkWrite) {
- // alert(JSON.stringify(e.record));
- var fd_id = e.record.FD_OBJECTID;
- var name = e.column.name;
- var comp = e.record.COMP_NAME;
- var id = e.record.COMP_ID;
- var report_id = e.record.REPORT_ID;
- var display = e.column.display;
- var writeVal = $("#sel").val();
- if (writeVal == "8") {
- if (display.indexOf("人") == -1) {
- return;
- }
- }
- var totalCount = e.value;
- var wrong = $("#wrongNum").val();
- var write_url = "/nwyj/page/business/em/report/writeData/writeData1.jsp";
- var diag = new top.Dialog();// 定义一个窗口对象
- diag.Title = "明细填写";// 窗口标题
- diag.URL = encodeURI(write_url);// 窗口对应的页面
- diag.Height = 560;
- diag.Width = 1200;
- diag.showOkButton = false;
- diag.showCancelButton = false;
- diag.ShowMaxButton = true;
- diag.show();// 显示窗口
- diag.OnLoad = function() {
- diag.innerFrame.contentWindow.showDetail(fd_id, name, comp,
- writeVal, display, totalCount, e.column["__id"],
- e["record"]["__id"], wrong, checkInterface, id,
- report_id);
- };
- var bodyheight = $(window.document.body).height();
- $(window.document.body).find("#frmright").height(bodyheight);
- }
- }
- // 取消事件冒泡
- return false;
- }
- function getZjResult(arg1, arg2, arg3) {
- var r1, r2, r3, m, n;
- try {
- r1 = arg1.toString().split(".")[1].length;
- } catch (e) {
- r1 = 0;
- }
- try {
- r2 = arg2.toString().split(".")[1].length;
- } catch (e) {
- r2 = 0;
- }
- try {
- r3 = arg3.toString().split(".")[1].length;
- } catch (e) {
- r3 = 0;
- }
- m = Math.pow(10, Math.max(r1, r2, r3));
- // 动态控制精度长度
- n = Math.max(r1, r2, r3);
- return ((arg1 * m + arg2 * m - arg3 * m) / m).toFixed(n);
- }
- // 返回主页面
- function goback() {
- flag = false;
- var iframe = parent.document.getElementsByName("frmright")[0];
- if (_thisUrl.indexOf("affair=") == -1) {
- iframe.src = "/nwyj/page/business/em/waitdo/waitDo.html";
- }else{
- iframe.src = "/nwyj/page/business/em/report/Report_main.jsp";
- }
- }
- /**
- * 获取表字段
- * @param type 报表类型
- * @param affair 事件类型
- */
- function getColumns(type,affair) {
- if (type == '100') {
- mycol1 = "抢修工作进度情况表";
- mycol = [ {
- hide : "true",
- name : "FD_OBJECTID"
- }, {
- display : "支援单位",
- name : "COMP_NAME",
- id : "COMP_ID",
- frozen: true,
- width : '80'
- },
- // {display:"支援单位",name:"COMP_NAME",id:"COMP_ID",minWidth:'100'/*,editor:{type:"text",inputMode:"positiveDecimal",maxlength:"20"}*/},
- {
- display : "被支援单位",
- name : "BZYDW_ID",
- editor : {
- type : "text",
- inputMode : "text",
- maxlength : "15"
- },
- width : '11%'
- }, {
- display : "500kV线路",
- columns : [ {
- display : "累计完成",
- columns : [ {
- display : "组塔(基)",
- name : "LJWCZT_500",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "LJWCJX_500",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- } ]
- }, {
- display : "220kV线路",
- columns : [ {
- display : "累计完成",
- columns : [ {
- display : "组塔(基)",
- name : "LJWCZT_220",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "LJWCJX_220",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- } ]
- }, {
- display : "110kV线路",
- columns : [ {
- display : "累计完成",
- columns : [ {
- display : "组塔(基)",
- name : "LJWCZT_110",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "立杆(根)",
- name : "LJWCLG_110",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "LJWCJX_110",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- } ]
- },
- {
- display : "10kV线路",
- columns : [ {
- display : "今日完成",
- columns : [ {
- display : "组塔(基)",
- name : "JRWCZT_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "扶杆(根)",
- name : "JRWCFG_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "立杆(根)",
- name : "JRWCLG_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "JRWCJX_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- }, {
- display : "累计完成",
- columns : [ {
- display : "组塔(基)",
- name : "LJWCZT_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "扶杆(根)",
- name : "LJWCFG_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "立杆(根)",
- name : "LJWCLG_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "LJWCJX_10",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- } ]
- },
- {
- display : "低压线路",
- columns : [ {
- display : "今日完成",
- columns : [ {
- display : "扶杆(根)",
- name : "JRWCFG_DY",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "立杆(根)",
- name : "JRWCLG_DY",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "JRWCJX_DY",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- }, {
- display : "累计完成",
- columns : [ {
- display : "扶杆(根)",
- name : "LJWCFG_DY",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "立杆(根)",
- name : "LJWCLG_DY",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- }, {
- display : "架线(km)",
- name : "LJWCJX_DY",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- } ]
- }, {
- display : "配变",
- columns : [ {
- display : "今日完成",
- columns : [ {
- display : "修复(台)",
- name : "JRWCXF_PB",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- }, {
- display : "累计完成",
- columns : [ {
- display : "修复(台)",
- name : "LJWCXF_PB",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- isCount : "0",
- width : '5%'
- } ]
- } ]
- }, {
- display : "累计完成比例",
- name : "LJWCBL",
- editor : {
- type : "text",
- inputMode : "positiveDecimal",
- maxlength : "9"
- },
- width : '5%'
- }, {
- display : "今日完成其他工作",
- name : "WCQTGZ",
- editor : {
- type : "text",
- inputMode : "text",
- maxlength : "500"
- },
- width : '5%'
- }, {
- display : "遗留问题",
- name : "YLWT",
- editor : {
- type : "text",
- inputMode : "text",
- maxlength : "500"
- },
- width : '5%'
- }
- ];
- } else {
- var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getEditColumns";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 300000,
- async : false,
- data : {
- "report_type" : type,
- "affair" : affair,
- "comp_id" : corpId,
- "rollbackFlag" : rollbackFlag
- },
- dataType : 'text',
- success : function(data) {
- mycol = eval('(' + data + ')');
- mycol1 = eval('(' + data + ')')[0].display;
- },
- error : function(e) {
- $.messager.alert('查询表头失败!', '访问服务失败!', 'error');
- }
- });
- }
- }
- // 获取行
- function getRows(type,affair) {
- // var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getRowName";
- var urls = $.pathname() + "/ws/baoBiao/BaoBiaoService/getRowName";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 300000,
- async : false,
- data : {
- comp_id : corpId,
- report_type : type,
- roleId : role_id,
- flag : deptFlag,
- affair : affair
- },
- dataType : 'json',
- success : function(data) {
- testData = data;
- // alert(JSON.stringify(testData));
- },
- error : function(e) {
- $.messager.alert('查询行失败!', '访问服务失败!', 'error');
- }
- });
- }
- /**
- * 明细表操作列
- * @param rowdata
- * @param rowindex
- * @param value
- * @returns
- */
- function operation(rowdata, rowindex, value) {
- var h = "";
- if (!rowdata._editing) {
- flag1 = false;
- h += "<a onclick='beginEdit(" + rowindex
- + ")'><span class='icon_edit'>修改</span></a>";
- h += "<a onclick='onDelete(" + rowindex
- + ")'><span class='icon_delete'>删除</span></a> ";
- } else {
- flag1 = true;
- h += "<a onclick='endEdits(" + rowindex
- + ")'><span class='icon_ok'>确认</span></a> ";
- h += "<a onclick='cancelEdit(" + rowindex
- + ")'><span class='icon_delete'>取消</span></a> ";
- }
- return h;
- }
- /**
- * 统计表操作列
- * @param rowdata
- * @param rowindex
- * @param value
- * @returns
- */
- function backspace(rowdata, rowindex, value) {
- var h = "";
- if(rowdata.COMP_NAME != "总计"){
- if(rowdata.appearStat=="true"){
- h += "<a onclick='rollback(" + rowindex+")'><span class='retract_tem'>回退</span></a>";
- }else if(rowdata.appearStat=="false"){
- if (!rowdata._editing) {
- h += "<a onclick='proxyWrite(" + rowindex + ")'><span class='icon_edit'>代填</span></a>";
- h += "<a onclick='urgeReport(" + rowindex + ")'><span class='sendmsg_tem'>催报</span></a> ";
- }else{
- h += "<a onclick='saveRowData(" + rowindex + ")'><span class='icon_ok'>保存</span></a> ";
- h += "<a onclick='cancelRow(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
- }
- }
- }
- return h;
- }
- // 退回
- function rollback(rowindex) {
- var row = g.getRow(rowindex);
- var fdId = row.REPORT_ID;//记录id
- var writeName = row.REAL_NAME;
- var writeMobile = row.MOBILE;
- var stat = row.appearStat;
- if (stat=="true") {
- rollbackInfo(fdId,writeName,writeMobile);
- } else {
- top.Dialog.alert("该记录无法回退!");
- return;
- }
- }
- // 代填
- function proxyWrite(rowindex){
- var rowdata = g.getRow(rowindex);
- //判断当前时间点是否有填报任务
- var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportWriteTask";
- var params = {
- "report_type" : report_type,
- "affair" : affair,
- "comp_id" : compId,
- "role_id" : role_id,
- "data" : JSON.stringify(rowdata)
- };
- $.ajax({
- url : url,
- type : "post",
- data : params,
- dataType : "json",
- async : false,
- success : function(result){
- console.log("代填任务:"+JSON.stringify(result));
- if(result.length>0){
- var task_id = "";
- var task_name = "";
- var task_time = "";
- for(var i in result){
- var data = result[i];
- task_id += data.key+",";
- task_name += data.value+",";
- task_time += data.time+",";
- }
- task_id = task_id.substring(0, task_name.lastIndexOf(","));
- task_name = task_name.substring(0, task_name.lastIndexOf(","));
- task_time = task_time.substring(0, task_time.lastIndexOf(","));
- console.log("代填任务id:"+task_id+";任务名称:"+task_name+";任务时间:"+task_time);
- rowNumArr.push(rowindex);
- rowdata.TASK_ID = task_id;// 任务id
- rowdata.TASK_NAME = task_name;// 任务名称
- rowdata.TASK_TIME = task_time;
- rowdata._editing = true;// 设置为可编辑状态
- g.reRender({ rowdata: rowdata });
- }else{
- top.Dialog.alert("该单位/部门当前时间没有填报任务|代填提示");
- }
- },
- error : function(){
- $.messager.alert('查询报表任务失败!', '访问服务失败!', 'error');
- }
- });
- }
- // 催报
- function urgeReport(rowindex){
- var rowdata = g.getRow(rowindex);
- var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/urgeReport";
- var params = {
- "comp_id" : compId,
- "role_id" : role_id,
- "report_type" : report_type,
- "affair" : affair,
- "data" : JSON.stringify(rowdata)
- };
- $.ajax({
- url : url,
- type : "post",
- data : params,
- dataType : "json",
- success : function(data){
- console.log("催报:"+JSON.stringify(data));
- if(data.Msg.sucsess==true){
- if(data.Msg.data==null){
- top.Dialog.alert(data.Msg.info);//没有催报人员
- }else{
- var name = data.Msg.data.split("&")[0];
- var phone = data.Msg.data.split("&")[1];
- var nameText = data.Msg.data.split("&")[2];//计划
- var wtTime = data.Msg.data.split("&")[3];//填报时间
- addMsg(name,phone,'您好,'+nameText+'计划中的'+mycol1+'在'+wtTime+"填报时间段还没有上报,请您尽快登陆系统进行填写上报");
- }
- }else{
- top.Dialog.alert(data.Msg.info);//当前没有任务
- }
- },
- error : function(){
- $.messager.alert('报表催报失败!', '访问服务失败!', 'error');
- }
- });
- }
- //保存填写的数据
- function saveRowData(rowindex){
- rowNumArr.pop(rowindex);
- var rowdata = g.getRow(rowindex);
- rowdata.USER_ID = user_id;// 用户id
- rowdata.REAL_NAME = real_name;// 用户名
- rowdata.MOBILE = mobile;// 电话
-
- //保存数据
- var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/saveRowData";
- var params = {
- "data" : JSON.stringify(rowdata),
- "report_type" : report_type,
- "affair" : affair,
- "comp_id" : corpId,
- "role_id" : role_id,
- "report_comp" : corpName + deptName
- };
- $.ajax({
- url : url,
- type : "post",
- data : params,
- dataType : "json",
- async : false,
- success : function(data){
- if(data.Msg.sucsess==true){
- rowdata.REPORT_ID = data.Msg.objectID;//记录id
- rowdata.appearStat = "true";// 将下级上报状态改成已上报
- delete rowdata['_editing'];//设置为不可编辑状态
- }else{
- rowdata.appearStat = "false";// 将下级上报状态改成未上报
- delete rowdata["USER_ID"];// 用户id
- delete rowdata["REAL_NAME"];// 用户名
- delete rowdata["MOBILE"];// 电话
- }
- top.Dialog.alert(data.Msg.info);
- },
- error : function(){
- $.messager.alert('保存代填数据失败!', '访问服务失败!', 'error');
- }
- });
- g.reRender({ rowdata: rowdata });
- }
- //取消填写的数据
- function cancelRow(rowindex){
- rowNumArr.pop(rowindex);
- g.endEdit();
- var size = g.getData().length;
- var rowdata = g.getRow(rowindex);
- var zjRowdata = g.getRow(size-1);//总计行
- var columns = g.columns;
- for(var i=0;i<columns.length;i++){
- if(!columns[i].name){continue;}
- if(columns[i].name=="COMP_NAME" || columns[i].name=="FD_OBJECTID"){continue;}
- if(!rowdata[columns[i].name]){continue;}
- if(columns[i].isCount=="0"){//统计列
- var num = getZjResult(zjRowdata[columns[i].name], oldVal, rowdata[columns[i].name]);
- zjRowdata[columns[i].name] = num;
- }
- delete rowdata[columns[i].name];
- }
- delete rowdata["TASK_ID"];
- delete rowdata["TASK_NAME"];
- delete rowdata["TASK_TIME"];
- delete rowdata['_editing'];//设置为不可编辑状态
- g.reRender({ rowdata: rowdata });
- //更新总计行数据
- g.updateRow(size - 1, zjRowdata);
- }
- // 角色选择
- function roleChange(){
- role_id = $("#roleSel").val();
- //根据角色id获取默认的报表类型
- report_type = getType(role_id);
-
- //根据事件类型和报表类型判断是否为班组
- deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
- "corpId" : compId,
- "deptId" : deptId,
- "affair" : affair,
- "report_type" : report_type
- }, "text");
-
- if("true"==deptFlag){
- deptLevel = level - 1;
- corpId = deptId;
- }else{
- deptLevel = level;
- corpId = compId;
- }
-
- getRole(role_id);
- if (checkRowObj) {
- checkRowObj = false;
- }
- g.endEdit();
- $("body").eq(0).showLoading();
- changeTable(report_type);
- }
- // 根据下拉框的选择,动态获取表头
- function change() {
- var typeVal = $("#sel").val();
-
- //根据事件类型和报表类型判断是否为班组
- deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
- "corpId" : compId,
- "deptId" : deptId,
- "affair" : affair,
- "report_type" : typeVal
- }, "text");
-
- if("true"==deptFlag){
- deptLevel = level - 1;
- corpId = deptId;
- }else{
- deptLevel = level;
- corpId = compId;
- }
-
- report_type = typeVal;
- if (flag1) {
- top.Dialog.alert("请编辑完再切换");
- $("#sel").setValue(excType);
- return;
- }
- if (checkRowObj) {
- checkRowObj = false;
- }
- g.endEdit();
- $("body").eq(0).showLoading();
- changeTable(typeVal);
- }
- // 新增报表
- function save(type) {
- if (flag1) {
- top.Dialog.alert("请完成编辑再保存");
- return;
- }
-
- if(rowNumArr.length>0){
- top.Dialog.alert("请完成代填 后再保存");
- return;
- }
- if (num % 2 != 0) {
- flag = false;
- $("#handlerinfo").text("开启填写明细");
- $("#handlerinfo").parent().removeClass("backcolor");
- num = 2;
- }
- g.endEdit();
-
- var typeValue = $("#sel").val();
- var row = g.getData();
- var json = JSON.stringify(row);
- if (maintableType == "1") {
- // 新增前判断首行是否为空
- if (typeValue != '7') {
- var textInput = $("#maingrid2").find(".l-grid2").find(".l-grid-body-inner").find("tbody").find("tr");
- if (textInput.eq(0).text().trim() == "修改删除") {
- checkRowObj = true;
- }
- }else{
- var textInput = $("#maingrids").find(".l-grid2").find(".l-grid-body-inner").find("tbody").find("tr");
- if (textInput.eq(0).text().trim() == "修改删除") {
- checkRowObj = true;
- }
- }
-
- if (checkRowObj) {
- top.Dialog.confirm("内容存在空数据,是否继续保存|确定", function() {
- saveTable(type, json);
- });
- } else {
- saveTable(type, json);
- }
- } else {
- saveTable(type, json);
- }
- }
- // 重置表信息
- function clear_msg() {
- if (flag1) {
- top.Dialog.alert("请编辑完再重置");
- return;
- }
- top.Dialog.confirm("确定要重置?填写的信息会全部清除,请慎重选择|重置", function() {
- window.location.href = window.location.href;
- });
- }
- // 监听回车
- function checkKeyCode(event) {
- if (event.keyCode == 13) {
- g.endEdit();
- }
- return false;
- }
- //根据用户角色初始化报表责任部门 20170316 kym
- function getDeptRole(){
- $.ajax({
- url : $.pathname() +"/ws/getUserRole/GetRoleService/getUserRole",
- type : 'post',
- timeout : 15000,
- async : false,
- data : {userId:user_id,roleId:zyRole},
- dataType : 'json',
- success : function(data) {
- $("#roleSel").data("data",data);
- $("#roleSel").render();
- },
- error : function(e) {
- $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
- }
- });
- }
- // 根据用户登录时的不同角色初始化下拉框
- function getRole(roleId, report_type) {
- var urls = "";
- var initParams = "";
- if (report_type != undefined) {// 代办传入报表类型
- urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getDbReport";
- initParams = {
- report_type : report_type,
- deptLevel : deptLevel
- };
- } else {
- // urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getTypeSel";
- urls = $.pathname() + "/ws/baoBiao/BaoBiaoService/getTypeSel";
- initParams = {
- role_id : roleId,
- dept_level : deptLevel,
- affair : affair
- };
- }
- selecta = getThing(urls, initParams);
- $("#sel").data("data", selecta);
- $("#sel").render();
- }
- function getRequire(roleId){
- $("#requires").empty();
- $("#changerequire").empty();
- if (roleId == "R002105430210") {
- $("#requires")
- .append("<span>填写说明:</span><br>"
- + "<span>① 单位:受灾地市局</span>;<br>"
- + "<span>② 跳闸停电(条数):相应电压等级线路跳闸的总条数,不包含重合闸成功的跳闸线路条数,且同一条线路多次跳闸,只统计为一个跳闸条数。</span><br>"
- + "<span>③ 未恢复:填写相应电压等级线路跳闸后,未恢复成热备用状态的线路条数。</span><br>"
- + "<span>④ 累计跳闸(条次):相应电压等级线路跳闸的总条次数,包含重合闸成功的跳闸线路条数,且同一条线路多次跳闸,统计为多个跳闸条次数。</span><br>"
- + "<span>⑤ 备注:填写未恢复线路名称。</span><br>"
- + "<span>⑥ 损失负荷:电网因灾损失的负荷数。电网发生故障后,在线路重合闸及备用电源自投装置动作完成后系统未恢复的负荷,包括电网减供负荷和低压脱扣负荷。</span><br>"
- + "<span>⑦ 损失占比:损失负荷数占同期电网应有负荷的百分比。</span>");
- $("#changerequire")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位:受灾地市局</span><br>"
- + "<span>② 累计停运(座):灾害过程中发生停运变电站的总座数。</span><br>"
- + "<span>③ 未恢复(座):截止当前时间未恢复变电站的总座数。</span><br>"
- + "<span>④ 备注:发生停运事件的变电站名称及目前状态。例如:XX变电站(已恢复/未恢复)</span>");
- }
- if (roleId == "R002105430213") {
- $("#requires")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位名称:公司、受灾地市局。</span><br>"
- + "<span>② 本单位预警或响应级别:防风防汛X色预警,防风防汛X级响应。</span><br>"
- + "<span>③ 同级政府相关部门名称:例如XX省防总等。</span><br>"
- + "<span>④ 同级政府相关部门预警或响应级别:防风防汛X色预警,防风防汛X级响应。</span><br>"
- + "<span>⑤ 开始时间:例如,9月9日9时30分。</span><br>"
- + "<span>⑥ 结束时间:例如,9月9日9时30分。当处于预警发布或响应启动状态时,结束时间可保持为空。</span><br>"
- + "<span>⑦ 备注:台风登陆期间不用填报。</span>");
- $("#changerequire")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位名称:受灾地市局。</span><br>"
- + "<span>② 抢修人员:填写当日投入抢修人数的最大值。</span><br>"
- + "<span>③ 抢修车辆:填写当日投入抢修车辆数的最大值。</span><br>"
- + "<span>④ 应急发电车:填写当日投入应急发电车数量的最大值。</span><br>"
- + "<span>⑤ 应急发电机:填写当日投入应急发电机数量的最大值。</span><br>"
- + "<span>⑥ 备注:台风登陆期间不用填报。</span>");
- }
- if (roleId == "R002105430211") {
- $("#requires")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位:受灾地市局。</span><br>"
- + "<span>② 备注:台风登陆期间不用填报。</span><br>"
- );
- $("#changerequire")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位:受灾地市局</span><br>"
- + "<span>② 线路受损:按单相导路(地线)受损长度统计,统计距离为断线或者整条线路损毁时的档距。</span><br>"
- + "<span>③ 线路未恢复:截至当前仍未修复的受损线路长度。</span><br>"
- + "<span>④ 配变受损:发生损害需要修复或更换的配变台数。</span><br>"
- + "<span>⑤ 配变未恢复:截至当前仍未修复或更换的配变台数。</span><br>"
- + "<span>⑥ 备注:台风登陆期间不用填报。</span>");
- }
- if (roleId == "R002105430212") {
- $("#requires")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位:受灾地市局。</span><br>"
- + "<span>② 台区:一个配变所供负荷区域计作一个台区。</span><br>"
- + "<span>③ 用户数:1)线路重复跳闸时客户停电户数不累加统计,即线路重复跳闸时,停电户数只统计一次。2)线路跳闸重合成功的客户数不统计。</span><br>"
- + "<span>④ 未恢复数:因灾发生停电的用户截至当前还未恢复供电的用户数。</span><br>"
- + "<span>⑤停电占比:停电占比=停电台区(用户)数÷当地台区(用户)总数。</span><br>"
- + "<span>⑥损失电量:灾害期间损失电量的总数。</span>");
- $("#changerequire")
- .append("<span>填写说明:</span><br>"
- +"<span>① 单位:受灾地市局。</span><br>"
- + "<span>② 累计全停:灾害发生以来发生全县(区)、全乡镇、全行政村全停的个数。</span><br>"
- + "<span>③ 当前全停:当前仍存在全县(区)、全乡镇、全行政村全停的个数。</span><br>"
- + "<span>④ 备注:台风登陆期间不用填报。</span>");
- }
- }
- // 根据用户角色登录,返回report_type 的默认值
- function getType(id) {
- if (id == "R002105430210") {
- report_type = "1";
- } else if (id == "R002105430213") {
- report_type = "7";
- } else if (id == "R002105430211") {
- report_type = "3";
- } else if (id == "R002105430212") {
- report_type = "5";
- } else if (id == "R002105430200") {
- report_type = "1";
- } else if (id == "R002105430222") {
- report_type = "100";
- }
- return report_type;
- }
- //通过预警或响应编号来显示报表计划要求
- function getPlan() {
- g.endEdit();
- $("#sysDept").html("");
- $("#equipmentDept").html("");
- $("#markingDept").html("");
- $("#safeyDept").html("");
- $("#showTables").html("");
- $("#deptRole").text("");
- $("#star_time").html("");
- $("#end_time").html("");
- $("#type").html("");
- $("#round").html("");
- $("#temporary").html("");
- var val = $("#warning").val();
- if (val) {
- getPlanContent(val);
- } else {
- $("#showplan").hide();
- $("#showRequire").hide();
- $("#showRequire").find("a").html("隐藏报表填报要求");
- $(parent.document.body).find("#frmright").height(wh);
- }
- }
- function getPlanRequires(value) {
- require = "";
- $.ajax({
- url : $.pathname()
- + '/ws/getPlanRequires/getPlanRequireService/getReportPlanRequire/',
- type : 'post',
- timeout : 300000,
- async : false,
- data : {
- comp : corpId,
- warning_number : value
- },
- dataType : 'json',
- success : function(data) {
- require = data;
- },
- error : function(e) {
- $.messager.alert('查询报表计划失败!', '访问服务失败!', 'error');
- }
- });
- return require;
- }
- function showTable() {
- $("#showplan").toggle();
- var show = $("#showplan").css("display");
- if (show == "none") {
- $("#showRequire").find("a").html("显示报表填报要求");
- } else {
- $("#showRequire").find("a").html("隐藏报表填报要求");
- }
- }
- /**
- * 统计表汇总下级数据----非班组部门且有下级填报单位
- */
- function total() {
- $("#hzxjsj").parent().siblings().removeClass("backcolor");
- $("#hzxjsj").parent().addClass("backcolor");
- checkInterface = false;
- var value = $("#sel").val();//报表类型
-
- if (num % 2 != 0) {
- flag = false;
- $("#handlerinfo").text("开启填写明细");
- num = 2;
- }
-
- g.endEdit();
- var json = JSON.stringify(g.getData());
- $("body").eq(0).showLoading();
- // var urls = $.pathname()+"/ws/xianlutingyun/XianlutingyunService/getChildHzReport";
- var urls = $.pathname()+"/ws/baoBiao/BaoBiaoService/getChildHzReport";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 300000,
- /* async : false, */
- data : {
- comp_id : compId,//非班组且有下级单位
- comp_name : corpName,
- report_type : value,
- roleId : role_id,
- affair : affair,
- flag : deptFlag,
- json : json
- },
- dataType : 'json',
- success : function(data) {
- g.options.data = data;
- g.loadData();
- setHight();
- $("body").eq(0).hideLoading();
- },
- error : function(e) {
- $.messager.alert('汇总下级数据失败!', '访问服务失败!', 'error');
- }
- });
- }
- /**
- * 明细汇总下级数据
- */
- function getXqtotal(){
- $("#hzxjsj_xq").parent().siblings().removeClass("backcolor");
- $("#hzxjsj_xq").parent().addClass("backcolor");
- //报表类型
- var value = $("#sel").val();
- $("body").eq(0).showLoading();
- var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getChildHzXqData";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 300000,
- async : false,
- data : {
- comp_id : compId,
- comp_name : corpName,
- report_type : value,
- roleId : role_id,
- affair : affair
- },
- dataType : 'json',
- success : function(data) {
- xqData = data;
- setHight();
- $("body").eq(0).hideLoading();
- },
- error : function(e) {
- $.messager.alert('导入上次报表失败!', '访问服务失败!', 'error');
- }
- });
- }
- var num = 2;
- /**
- * 填写明细
- */
- function beginWrite() {
- var reportVal = $("#sel").val();
- if (reportVal == "1" || reportVal == "2" || reportVal == "3"
- || reportVal == "5" || reportVal == "8" || reportVal == "4"
- || reportVal == "101") {
- if (num % 2 == 0) {
- $("#handlerinfo").parent().addClass("backcolor");
- $("#handlerinfo").parent().siblings().removeClass("backcolor");
- $("#handlerinfo").text("关闭填写明细");
- $("#handlerinfo").parent().attr("title", "关闭填报报表明细填写情况");
- flag = true;
- } else {
- $("#handlerinfo").parent().removeClass("backcolor");
- $("#handlerinfo").parent().attr("title", "开启填报报表明细填写情况");
- $("#handlerinfo").text("开启填写明细");
- flag = false;
- }
- num++;
- } else {
- top.Dialog.alert("此表没有明细填写");
- flag = false;
- num = 2;
- }
- };
- // 更多 多选查询卡
- function more() {
- $('#moretable').toggle();
- }
- /** 绑定更多的按钮点击事件 */
- $more = $("#more"); // 更多按钮
- $more.bind('click', function() {
- more();
- });
- /**
- * 根据报表类型显示填写说明
- * @param value 报表类型
- */
- function changeRequireByVal(value) {
- if (value == "1") {
- $("#requires").show();
- $("#changerequire").hide();
- } else if (value == "2" || value == "101") {
- $("#requires").hide();
- $("#changerequire").show();
- }
- else if (value == "3") {
- $("#changerequire").hide();
- $("#requires").show();
- } else if (value == "4") {
- $("#requires").hide();
- $("#changerequire").show();
- } else if (value == "5") {
- $("#changerequire").hide();
- $("#requires").show();
- } else if (value == "6") {
- $("#requires").hide();
- $("#changerequire").show();
- } else if (value == "7") {
- $("#changerequire").hide();
- $("#requires").show();
- } else if (value == "8") {
- $("#requires").hide();
- $("#changerequire").show();
- } else {
- $("#requires").hide();
- $("#changerequire").hide();
- }
- }
- /**
- * 加载表格数据
- * @param url
- * @param data
- * @param type 预警发布与响应启动情况表
- */
- function initGrid(url, data, type) {
- g = null;
- g = $("#maingrids").quiGrid({
- url : url,
- params : {
- comp_id : corpId,
- affair : affair
- },
- usePager : false,
- fixedCellHeight : false,
- columns : mycol,
- data : data,
- /* height:"90%", */
- headerRowHeight : 38,
- rowHeight : 38,
- width : '100%',
- rownumbers : true,
- percentWidthMode : true,
- enabledEdit : true,
- clickToEdit : false,
- onAfterSubmitEdit : onAfterSubmitEdit,
- onAfterEdit : onAfterEdit,
- onBeforeSubmitEdit : onBeforeSubmitEdit,
- onAfterShowData : function() {
- setHight();
- $("body").eq(0).hideLoading();
- },
- toolbar : {
- items : [ {
- text : '新增',
- click : addUser,
- iconClass : 'add1_tem'
- }, {
- line : true
- },{
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- ]
- }
- });
- if ($("#maingridsgrid").height() < 500) {
- g.setOptions({
- height : "500px"
- });
- g.resetHeight();
- } else {
- g.setOptions({
- height : "auto"
- });
- g.resetHeight();
- }
- $(".l-grid-hd-cell-text").css("color", "white");
- }
- // 类型为7的检测
- function onBeforeSubmitEdit(e) {
- if (isValida) {
- if (e.newdata.ORG_END_TIME != "") {
- var endTime = e.newdata.ORG_END_TIME.replace(new RegExp("-", "gm"),
- "/");
- var startTime = e.newdata.ORG_START_TIME.replace(new RegExp("-",
- "gm"), "/");
- if (new Date(startTime).getTime() > new Date(endTime).getTime()) {
- top.Dialog.alert("本单位开始时间不能早于本单位的结束时间");
- return false;
- }
- }
- if (e.newdata.GOVE_ORG_END_TIME != "") {
- var endTime = e.newdata.GOVE_ORG_END_TIME.replace(new RegExp("-",
- "gm"), "/");
- var startTime = e.newdata.GOVE_ORG_START_TIME.replace(new RegExp(
- "-", "gm"), "/");
- if (new Date(startTime).getTime() > new Date(endTime).getTime()) {
- top.Dialog.alert("同级政府开始时间不能早于同级政府的结束时间");
- return false;
- }
- }
- }
- isValida = true;
- }
- /**
- * 加载明细表表格数据
- * @param data
- * @param item 明细表工具栏菜单
- * @param type 报表类型
- */
- function initGrid1(data, item, type) {
- g = null;
- g = $("#maingrid2").quiGrid({
- columns : mycol,
- data : data,
- usePager : false,
- fixedCellHeight : false,
- headerRowHeight : 38,
- rowHeight : 38,
- enabledSort : false,
- width : '100%',
- /* height:"90%", */
- rownumbers : true,
- percentWidthMode : true,
- enabledEdit : true,
- clickToEdit : false,
- onAfterSubmitEdit : onAfterSubmitEdit,
- onAfterEdit : onAfterEdit,
- onBeforeSubmitEdit : checkSubmitEdit,
- onAfterShowData : function() {
- // setHight();
- setXqContentHeight();
- $("body").eq(0).hideLoading();
- },
- toolbar : item
- });
-
- if(rollbackFlag){
- $("#hzxjsj_xq").parent().siblings().removeClass("backcolor");
- $("#hzxjsj_xq").parent().addClass("backcolor");
- }
-
- if ($("#maingrid2grid").height() < 400) {
- g.setOptions({
- height : "400px"
- });
- g.resetHeight();
- } else {
- g.setOptions({
- height : "auto"
- });
- g.resetHeight();
- }
- $(".l-grid-hd-cell-text").css("color", "white");
- }
- /**
- * 根据报表类型加载明细表的工具栏菜单
- * @param report_type
- * @returns
- */
- function getXqItem(report_type) {
- var item = "";
- if(rollbackFlag){//有下级填报单位
- item = {
- items : [ {
- text : '新增',
- click : addUser,
- iconClass : 'add1_tem',
- id : "add"
- }, {
- line : true
- }, {
- text : '汇总下级数据',
- click : getXqtotal,
- iconClass : 'add1_tem',
- id : "hzxjsj_xq"
- },{
- line : true
- },{
- text : '获取接口数据',
- click : getInterFaceData,
- iconClass : 'import_tem',
- id : "jksj_xq"
- }, {
- line : true
- }, {
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- }, {
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- /*
- * { text: '全屏', click: fullScreen2, iconClass:
- * 'import_tem',id:"qp2" }, { line: true }
- */
- ]
- };
- } else {
- item = {
- items : [ {
- text : '新增',
- click : addUser,
- iconClass : 'add1_tem',
- id : "add"
- },{
- line : true
- }, {
- text : '获取接口数据',
- click : getInterFaceData,
- iconClass : 'import_tem',
- id : "jksj_xq"
- }, {
- line : true
- }, {
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- },{
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- /*
- * { text: '全屏', click: fullScreen2, iconClass:
- * 'import_tem',id:"qp2" }, { line: true }
- */
- ]
- };
- }
- return item;
- }
- /**
- * 实时编辑表格--删除
- * @param rowidx
- * @returns
- */
- function onDelete(rowidx) {
- if (flag1 == true) {
- top.Dialog.alert("请先完成当前记录的编辑!");
- return false;
- }
- top.Dialog.confirm("确定要删除该记录吗?", function() {
- isValida = false;
- flag1 = false;
- g.endEdit(rowidx);
- // 删除记录
- if (rowidx == 0) {
- checkRowObj = false;
- }
- var row = g.getRow(rowidx);
- g.deleteRow(row);
- });
- }
- /**
- * 实时编辑表格--编辑
- * @param rowid
- */
- function beginEdit(rowid) {
- if (flag1) {
- top.Dialog.alert("请先完成正在编辑的一行!");
- return;
- } else {
- g.beginEdit(rowid);
- }
- }
- /**
- * 实时编辑表格--取消
- * @param rowid
- */
- function cancelEdit(rowid) {
- flag1 = false;
- g.cancelEdit(rowid);
- }
- //判断是否存在空行数据
- var checkRowObj = false;
- /**
- * 实时编辑表格--结束编辑
- * @param rowid
- */
- function endEdits(rowid) {
-
- //正在编辑的行
- var textInput = $(".l-grid-body-table").find("input[type='text']");
- var checkNum = 0;
- var len = textInput.length;
- for (var i = 0; i < len; i++) {
- if (textInput.eq(i).val() == "" || textInput.eq(i).val() == "请选择") {
- checkNum++;
- }
- }
- if (checkNum == len) {
- if (rowid > 0) {
- top.Dialog.confirm("不在首行的数据如果为空将会被删除,是否执行?", function() {
- g.endEdit(rowid);
- var rowObj = g.getRow(rowid);
- g.deleteRow(rowObj);
- });
- }
-
- if (rowid == 0) {
- checkRowObj = true;
- g.endEdit(rowid);
- }
- } else if (len > checkNum) {
- checkRowObj = false;
- g.endEdit(rowid);
- }
- }
- function showOrgSelect(item) {
- for (var i = 0; i < data11["list"].length; i++) {
- if (data11["list"][i]['value'] == item.ORG_GRADE)
- return data11["list"][i]['key'];
- }
- return item.ORG_GRADE;
- }
- function showGovSelect(item) {
- for (var i = 0; i < data11["list"].length; i++) {
- if (data11["list"][i]['value'] == item.GOV_ORG_GRADE)
- return data11["list"][i]['key'];
- }
- return item.GOV_ORG_GRADE;
- }
- var num2 = 0;
- /**
- * 实时编辑表格--新增
- * @returns
- */
- function addUser() {
- if (flag1) {
- top.Dialog.alert("请先完成当前记录的编辑!");
- return false;
- }
- var typeValue = $("#sel").val();
- // 新增前判断首行是否为空
- if (typeValue != '7') {
- var textInput = $("#maingrid2").find(".l-grid2").find(".l-grid-body-inner").find("tbody").find("tr");
- if (textInput.eq(0).text().trim() == "修改删除") {
- checkRowObj = true;
- }
- }
-
- //checkRowObj 判断首行是否有空数据
- if (checkRowObj) {
- top.Dialog.alert("首行数据为空,不能继续添加");
- return false;
- }
-
- editingRow = 0;
- isNew = true;
- var row = g.getRow(0);
- var rowData = {
- duty_way : 0,
- COMP_ID : corpId,
- COMP_NAME : deptFlag=="false"?corpShortName:deptName
- };
- g.addEditRow(rowData, row, true);
- num2++;
- if ($("#maingridsgrid").height() < 400) {
- g.setOptions({
- height : "400px"
- });
- g.resetHeight();
- } else {
- g.setOptions({
- height : "auto"
- });
- g.resetHeight();
- }
- setHight();
- }
- // 编辑后事件
- function onAfterSubmitEdit(e) {
- isNew = false;
- }
- function zhiyin() {
- window.open("/nwyj/page/business/em/report/baobiaozy.html");
- }
- function print() {
- var type = $("#sel").val();
- if (maintableType == "1") {
- if (type == "7") {
- $("#maingrids").jqprint();
- } else {
- $("#maingrid2").jqprint();
- }
- } else {
- $("#maingrid").jqprint();
- }
- }
- function _addStatus(rowdata, rowindex, value, column) {
- if (value == '总计') {
- return "<div style='background-color: #f2f2f2'>" + value + "</div>";
- } else {
- return "<div style='background-color: #dde5f0' class='company' title='"
- + value + "'>" + value + "</div>";
- }/*else{
- return "<div style='background-color: #dde5f0' class='company' title='"
- + value + "'><a href='javascript:void(0)'>" + value + "</a></div>";
- }*/
- }
- // 能获取接口数据的数组
- var typeArr = [ "1", "2", "101", "4", "5", "3" ];
- var checkInterface = false;
- function getInterFaceData() {
- $("#jksj").parent().siblings().removeClass("backcolor");
- $("#jksj").parent().addClass("backcolor");
- $("#jksj_xq").parent().siblings().removeClass("backcolor");
- $("#jksj_xq").parent().addClass("backcolor");
- if (num % 2 != 0) {
- flag = false;
- $("#handlerinfo").html("开启填写明细");
- num = 2;
- }
- if (flag1) {
- top.Dialog.alert("请完成编辑再获取!");
- return false;
- }
- g.endEdit();
- var value = $("#sel").val();
- if ($.inArray(value, typeArr) > -1) {
- /*
- * if(value=="14"){ if(flag1){ top.Dialog.alert("请编辑完再获取"); return
- * false; } }
- */
- $("body").eq(0).showLoading();
- var faceparams = "";
- if (maintableType == "1") {
- faceparams = {
- report_type : value,
- roleId : role_id,
- corpId : compId,
- type : "xq"
- };
- } else {
- faceparams = {
- report_type : value,
- roleId : role_id,
- corpId : compId,
- type : "tj"
- };
- }
- var urls = "";
- if (value == '5') {
- $("#jksj").parent().addClass("backcolor");
- checkInterface = true;
- beginWrite();
- urls = $.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/getInterfaceData";
- }
- // else{
- // urls = $.pathname() +
- // "/ws/xianlutingyun/XianlutingyunService/getNewInterFaceData";
- // }
- if (value == '1') {
- urls = $.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/getNewInterFaceData";
- beginWrite();
- $("#jksj").parent().addClass("backcolor");
- checkInterface = true;
- }
- if (value == '2' || value == "101") {
- faceparams["deptLevel"] = deptLevel;
- urls = $.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/getBDZData";
- beginWrite();
- $("#jksj").parent().addClass("backcolor");
- checkInterface = true;
- }
- if (value == '3' || value == '4') {
- urls = $.pathname()
- + "/ws/xianlutingyun/XianlutingyunService/getInterDG";
- beginWrite();
- $("#jksj").parent().addClass("backcolor");
- checkInterface = true;
- }
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 300000,
- data : faceparams,
- dataType : 'json',
- /* async:false, */
- success : function(data) {
- $("body").eq(0).hideLoading();
- if (data["rows"].length > 0) {
- g.options.data = data;
- g.loadData();
- } else {
- top.Dialog.alert("目前暂无数据");
- }
- setHight();
- },
- error : function(e) {
- $.messager.alert('导入上次报表失败!', '访问服务失败!', 'error');
- }
- });
- } else {
- top.Dialog.alert("该表的接口暂未开通");
- }
- }
- /**
- * 根据报表类型获取统计表工具栏菜单
- * @param type 报表类型
- * @returns
- */
- function getItem(type) {
- var item = "";
- if (rollbackFlag && role_id == "R002105430213") {
- item = [ {
- text : '开启填写明细',
- click : beginWrite,
- iconClass : 'add1_tem',
- id : "handlerinfo"
- }, {
- line : true
- }, /*{
- text : '导入上次数据',
- click : import_report,
- iconClass : 'import_tem',
- id : "drscsj"
- }, {
- line : true
- }, */{
- text : '汇总下级数据',
- click : total,
- iconClass : 'add1_tem',
- id : "hzxjsj"
- }, {
- line : true
- }, {
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- }, /*{
- text : '自动补齐数据',
- title : "单元格获取上次数据关闭",
- iconClass : 'import_tem',
- id : "lock"
- }, {
- line : true
- },*/ {
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- ];
- }
- else if (rollbackFlag && (role_id == "R002105430210" || role_id == "R002105430211")) {
- if (role_id == "R002105430210" && deptLevel == "4") {
- item = [ {
- text : '开启填写明细',
- click : beginWrite,
- iconClass : 'add1_tem',
- id : "handlerinfo"
- }, {
- line : true
- }, /*{
- text : '导入上次数据',
- click : import_report,
- iconClass : 'import_tem',
- id : "drscsj"
- }, {
- line : true
- }, */{
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- }, /*{
- text : '自动补齐数据',
- title : "单元格获取上次数据关闭",
- iconClass : 'import_tem',
- id : "lock"
- }, {
- line : true
- },*/{
- text : '导出',
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- ];
- } else {
- item = [ {
- text : '开启填写明细',
- click : beginWrite,
- iconClass : 'add1_tem',
- id : "handlerinfo"
- }, {
- line : true
- }, /*{
- text : '导入上次数据',
- click : import_report,
- iconClass : 'import_tem',
- id : "drscsj"
- }, {
- line : true
- },*/ {
- text : '汇总下级数据',
- click : total,
- iconClass : 'add1_tem',
- id : "hzxjsj"
- }, {
- line : true
- }, {
- text : '获取接口数据',
- click : getInterFaceData,
- iconClass : 'add1_tem',
- id : "jksj"
- }, {
- line : true
- }, {
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- }, /*{
- text : '自动补齐数据',
- title : "单元格获取上次数据关闭",
- iconClass : 'import_tem',
- id : "lock"
- }, {
- line : true
- },*/ {
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- ];
- }
- } else if (rollbackFlag && role_id == "R002105430212") {
- item = [ {
- text : '开启填写明细',
- click : beginWrite,
- iconClass : 'add1_tem',
- id : "handlerinfo"
- }, {
- line : true
- }, /*{
- text : '导入上次数据',
- click : import_report,
- iconClass : 'import_tem',
- id : "drscsj"
- }, {
- line : true
- },*/ {
- text : '汇总下级数据',
- click : total,
- iconClass : 'add1_tem',
- id : "hzxjsj"
- }, {
- line : true
- }, {
- text : '获取接口数据',
- click : getInterFaceData,
- iconClass : 'add1_tem',
- id : "jksj"
- }, {
- line : true
- }, {
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- }, /*{
- text : '自动补齐数据',
- title : "单元格获取上次数据关闭",
- iconClass : 'import_tem',
- id : "lock"
- }, {
- line : true
- },*/ {
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- ];
- }
- else {
- item = [ {
- text : '开启填写明细',
- click : beginWrite,
- iconClass : 'add1_tem',
- id : "handlerinfo"
- }, {
- line : true
- }, /*{
- text : '导入上次数据',
- click : import_report,
- iconClass : 'import_tem',
- id : "drscsj"
- }, {
- line : true
- },*/ {
- text : '导入',
- click : goImport,
- iconClass : 'import_tem',
- id : "dr"
- }, {
- line : true
- }, /*{
- text : '自动补齐数据',
- title : "单元格获取上次数据关闭",
- iconClass : 'import_tem',
- id : "lock"
- }, {
- line : true
- },*/ {
- text : '导出',
- click : export_report,
- iconClass : 'export_tem',
- id : "export_report"
- }, {
- line : true
- }
- ];
- }
- if (type == "8") {
- var tool1 = {
- text : '查看下级单位数据',
- click : getCompData,
- iconClass : 'view_tem',
- id : "corpData"
- };
- var tool2 = {
- line : true
- };
- item.push(tool1, tool2);
- }
- return item;
- };
- /**
- * 导入按钮
- */
- function goImport() {
- var sel = $("#sel").val();
- if (sel == "100") {
- top.Dialog.alert("此表暂不支持导入功能");
- return;
- }
- flag = false;
- var iframe = parent.document.getElementsByName("frmright")[0];
- iframe.src = "/nwyj/page/business/em/report/Import_Report.html?role_id="
- + role_id + "?report_type=" + $("#sel").val() + "?value="
- + affair+ "?affairType="+affairType;
- }
- /**
- * 导出
- */
- function export_report(){
- if(flag1){
- top.Dialog.alert("请编辑完再操作");
- return;
- }
- var data = g.getData();
- var condition = {
- "report_type":$("#sel").val(),
- "json":JSON.stringify(data),
- "flag":"huizong",
- "id":corpId
- };
- excelExport("",condition,"导出"+corpName+mycol1,filterNoUseColumn(),corpName+mycol1,'report');
- }
- /**
- * 过滤不可用的字段
- */
- function filterNoUseColumn(){
- var noUseColumns = "";
- var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/filterNoUseColumn";
- var params = {
- "affair" : affair,
- "report_type" : report_type,
- "comp_id" : corpId
- };
- $.ajax({
- url : url,
- type : "post",
- data : params,
- dataType : "text",
- async : false,
- success : function(data){
- noUseColumns = data;
- },
- error : function(){
- $.messager.alert('过滤不可用字段失败!', '访问服务失败!', 'error');
- }
- });
- return noUseColumns;
- }
- /**
- * 保存数据
- * @param type
- * @param json 数据源
- */
- function saveTable(type, json) {
- var textMsg = "";
- var times = "";
- var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/create";
- var value = $("#sel").val();
- if (value == "8" && (deptLevel==3 || deptLevel==4)) {
- var areaFlag = $("#areaSel").val();
- if (areaFlag == "") {
- top.Dialog.alert("请选择区域");
- return;
- }
- }
-
- //查询当前时间的报表任务
- var planUrl = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportPlanTask";
- $.ajax({
- url : planUrl,
- type : "post",
- data : {"report_type":report_type,"affair":affair,"comp_id":compId,"dept_id":deptId,"role_id":role_id,"deptFlag":deptFlag},
- dataType : "json",
- async : false,
- success : function(result){
- if(result.length>0){
- fdIds = "";
- plan_name = "";
- times = "";
- draftWrite = "false";
- for(var i in result){
- var data = result[i];
- fdIds = fdIds.indexOf(data.key)==-1 ? fdIds+data.key+"," : fdIds;
- plan_name = plan_name.indexOf(data.value)==-1 ? plan_name+data.value+"," : plan_name;
- times = times.indexOf(data.time)==-1 ? times+data.time+"," : times;
- }
- fdIds = fdIds.substring(0, fdIds.lastIndexOf(","));
- plan_name = plan_name.substring(0, plan_name.lastIndexOf(","));
- times = times.substring(0, times.lastIndexOf(","));
- console.log("新增当前任务id:"+fdIds+";当前任务名称:"+plan_name+";当前填报时间:"+times);
- }else{
- draftWrite = "true";//作为草稿,不能上报
- times = report_time==""?"":getServerTime().split(" ")[0]+" "+report_time;
- }
- },
- error : function(){
- $.messager.alert('查询报表任务失败!', '访问服务失败!', 'error');
- }
- });
-
- var recordParams = "";
- if (value != 8) {
- recordParams = {
- json : json,
- user_id : user_id,
- report_type : value,
- comp_id : corpId,
- name : real_name,
- report_comp : corpName + deptName,
- roleId : role_id,
- affair : affair,
- time : times
- };
- } else {
- recordParams = {
- json : json,
- user_id : user_id,
- report_type : value,
- comp_id : corpId,
- name : real_name,
- report_comp : corpName + deptName,
- roleId : role_id,
- affair : affair,
- time : times,
- flag : $("#areaSel").val()
- };
- }
- if (type == "save") {
- recordParams["operate"] = "新增了";
- recordParams["sendStat"] = "save";
- recordParams["report_id"] = fdIds;
- recordParams["warnText"] = plan_name;
- textMsg = "新增报表";
- } else {
- recordParams["operate"] = "新增并上报了";
- recordParams["sendStat"] = "send";
- textMsg = '新增并上报报表';
- }
- if (type == "save") {
- addRecords(urls, recordParams, textMsg, type, backUrl);
- }
- if (type == "send") {
- if (draftWrite == "true") {
- top.Dialog.alert("现在没有可上报的计划,请先保存");
- return;
- }else {
- recordParams["report_id"] = fdIds;
- recordParams["warnText"] = plan_name;
- }
-
- if (_thisUrl.indexOf("role_Id=") == -1) {// 返回代办页面
- backUrl = "/nwyj/page/business/em/waitdo/waitDo.html";
- addRecords(urls, recordParams, textMsg, type, backUrl);
- } else {
- addRecords(urls, recordParams, textMsg, type, backUrl);
- }
- }
- }
- /**
- * ********************************全屏代码**************************************************
- */
- /*
- * function fullScreen(){
- * if(undefined==$("#qp").attr("fullState")||0==$("#qp").attr("fullState")){
- *
- * $("#qp").attr("fullState","1").text("退出全屏");
- * $(top.document).find("#frmright").attr("width","100%").css({position:
- * "fixed",top: "0px",left: "0px","z-index": 50}); $("#maingrid").css({position:
- * "fixed",top: "0px", "z-index": 750,height:$(top.document).height()+"px",
- * "overflow-y": "auto","overflow-x": "hidden" }); }else{
- *
- * $("#qp").attr("fullState","0").text("全屏");
- * $(top.document).find("#frmright").attr("width","99%").css({position:
- * "initial"}); $("#maingrid").css({position:
- * "initial",height:"100%","overflow-y": "hidden","overflow-x": "hidden"}); } }
- * function fullScreen2(){
- * if(undefined==$("#qp2").attr("fullState")||0==$("#qp2").attr("fullState")){
- * $("#qp2").attr("fullState","1"); $("#qp2").text("退出全屏");
- * $(top.document).find("#frmright").attr("width","100%").css({position:
- * "fixed",top: "0px",left: "0px","z-index": 50});
- * $("#maingrid2").css({position: "fixed",top: "0px", "z-index":
- * 800,height:$(top.document).height()+"px", "overflow-y": "auto","overflow-x":
- * "hidden" }); }else{ $("#qp2").attr("fullState","0"); $("#qp2").text("全屏");
- * $(top.document).find("#frmright").attr("width","99%").css({position:
- * "initial"}); $("#maingrid2").css({position:
- * "initial",height:"100%","overflow-y": "hidden","overflow-x": "hidden"}); } }
- */
- function checkSubmitEdit(e) {
- if (isValida) {
- var reportType = $("#sel").val();
- if (reportType == "101") {
- reportType = "2";
- }
- if (reportType == "2") {
- if (e.newdata.DYDJ == "") {
- top.Dialog.alert("电压等级不能为空");
- return false;
- }
- if (e.newdata.BDZMC == ""
- || validateInput(e.newdata.BDZMC, "^[\" \"]+$")) {
- top.Dialog.alert("变电站名称不能为空");
- return false;
- }
- if (e.newdata.SFYHF == "") {
- top.Dialog.alert("是否已恢复不能为空");
- return false;
- }
- if (e.newdata.SFYHF != "") {
- if (e.newdata.SFYHF == "是") {
- if (e.newdata.HFSJ == ""
- || validateInput(e.newdata.HFSJ, "^[\" \"]+$")) {
- top.Dialog.alert("是否已恢复为是,请输入恢复时间");
- return false;
- }
- }
- }
- if (e.newdata.TYSJ == ""
- || validateInput(e.newdata.TYSJ, "^[\" \"]+$")) {
- top.Dialog.alert("停运时间不能为空");
- return false;
- }
- if (e.newdata.HFSJ != "") {
- var endTime = e.newdata.HFSJ
- .replace(new RegExp("-", "gm"), "/");
- var startTime = e.newdata.TYSJ.replace(new RegExp("-", "gm"),
- "/");
- if (new Date(startTime).getTime() > new Date(endTime).getTime()) {
- top.Dialog.alert("停运时间不能早于恢复时间");
- return false;
- }
- }
- }
- }
- isValida = true;
- }
- /**
- * 表格切换
- * @param typeVal
- */
- function changeTable(typeVal) {
- var tableType = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/getCheckType", {
- report_type : typeVal
- }, 'text');
- maintableType = tableType;
-
- //初始化
- rollbackFlag = false;
-
- //班组部门没有下级填报单位
- if("0"==maintableType && "false"==deptFlag){
- //用于判断本单位是否有下级填报单位,有下级填报单位时为true
- hasSubUnit = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/checkSubUnit", {
- "comp_id" : compId,
- "role_id" : role_id,
- "report_type" : report_type,
- "affair" : affair
- }, "text");
- if(hasSubUnit == "true"){
- rollbackFlag = true;
- }
- }
-
- //贵州版本任务只下发到县区,下级的供电所作为县区的部门。县区那层级不需要代填
- if(parseInt(deptLevel)>3){
- rollbackFlag = false;
- }
-
- //加载填写说明
- getRequire(role_id);
- //填写说明
- changeRequireByVal(typeVal);
-
- getColumns(typeVal);
-
- excType = typeVal;
-
- //根据事件类型和报表类型查询报表计划
- getReportPlan();
- $("#add").text("新增" + corpName + mycol1);
- $("#affair").text(affairType);
- getReportPlanInfo();
-
- if (tableType == "1") {
- $("#maingrid").hide();
- $("#maingrid2").hide();
- $("#maingrids").hide();
- $("#yjzy").hide();
- if (typeVal == "7") {
- $("#maingrids").show();
- initGrid(urls1);
- } else {
- $("#maingrid2").show();
- var item = getXqItem(typeVal);
- //明细表汇总
- // checkXqHuiZong(rollbackFlag);
- getXqtotal();
- initGrid1(xqData, item);
- }
- } else {
- //应急资源表跨区域显示
- getAreaData(deptLevel);
- var item = getItem(typeVal);
- $("#maingrid").show();
- $("#maingrids").hide();
- $("#maingrid2").hide();
- getRows(typeVal,affair);
- init(testData, item, typeVal);
- checkHuiZong(rollbackFlag);
-
- }
- $("body").eq(0).hideLoading();
- num2 = 0;
- if (num % 2 != 0) {
- $("#handlerinfo").text("开启填写明细");
- $("#handlerinfo").parent().removeClass("backcolor");
- num = 2;
- }
- $(".l-grid-body2").css({
- "overflow" : "scroll"
- });
- }
- /**
- * 应急资源表查看下级单位数据按钮
- */
- function getCompData() {
- window.open("/nwyj/page/business/em/report/CompData.html?deptLevel="
- + deptLevel + "&roleId=" + role_id + "&corpId=" + corpId
- + "&compName=" + corpName + "&affair="+affair);
- }
- /**
- * 统计表判断是否要汇总下级数据
- */
- function checkHuiZong(flag) {
- if (flag || report_type=='8') {
- total();
- }
- }
- /**
- * 明细表判断是否要汇总下级数据
- */
- function checkXqHuiZong(flag) {
- if (flag) {
- getXqtotal();
- }else{
- xqData = {"rows" : [{"FD_OBJECTID":"","COMP_ID":corpId,"COMP_NAME":deptFlag=="false"?corpShortName:deptName}]};
- }
- }
- /**
- * 统计表设置高度
- * @param type
- */
- function setTjContentHeight(type){
- if(type != "8"){
- $(window.document.body).height($("#maingrid").height()+$("#tianXie_con").height()+250);
- }else{
- $(window.document.body).height($("#yjzy").height()+$("#tianXie_con").height()+250);
- }
- $(top.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
- }
- /**
- * 明细表设置高度
- * @param type
- */
- function setXqContentHeight(){
- $(window.document.body).height($("#maingrid2").height()+$("#tianXie_con").height()+250);
- $(top.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
- }
- /**
- * 获得鼠标的相对坐标
- * 2017-10-26 djc
- */
- function mousePosition(ev){
- var e = event || window.event;
- var scrollX = document.documentElement.scorllLeft||document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
- var x = e.pageX || e.clientX+scrollX;
- var y = e.pageY || e.clientY+scrollY;
- return {'x':x,'y':y};
- }
|