f8eb194f0b1063c09c2ce3bda5198d06902357d1.svn-base 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172
  1. var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. // 保存公司Id变量
  3. var compId = corpId;
  4. var corpName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  5. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  6. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  7. var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  8. var mobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
  9. var loginName = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  10. //获取用户Id
  11. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  12. //单位名称简称
  13. var corpShortName = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/getShortCompName", {
  14. "comp_id" : compId,"comp_name":corpName
  15. }, "text");
  16. var g;
  17. var mycol;
  18. var mycol1;
  19. var testData;
  20. var checkWrite = false;
  21. // 统计表和明细表
  22. var maintableType = "";
  23. // 保存报表类型,用于切换报表类型失败时重新赋值
  24. var excType = "";
  25. //获取用户角色id
  26. var role_ids = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  27. //专业管理部门角色
  28. var zyRoleArr = getZyRole(role_ids);
  29. var zyRole = zyRoleArr.join(",");
  30. //返回用户专业管理部门角色的字符串----格式:'role_id','role_id'
  31. var zyRoleId = getUserZyRole(zyRoleArr);
  32. var _thisUrl = decodeURI(window.location.href);
  33. var backUrl = "/nwyj/page/business/em/report/Report_main.jsp";
  34. //保存报表类型
  35. var report_type = "";
  36. //保存角色id
  37. var role_id = "";
  38. //任务id
  39. var fdIds = "";
  40. //任务名称
  41. var plan_name = "";
  42. //事件类型名称
  43. var affairType = "";
  44. //事件类型id
  45. var affair = "";
  46. //草稿填报还是正常时间点填报
  47. var draftWrite = "";
  48. //填报时间点
  49. var report_time = "";
  50. //该变量用于保存可编辑的行号
  51. var rowNumArr = [];
  52. var isValida = true; // 是否需要验证
  53. var require = "";
  54. var flag = false;
  55. var flag1 = false;
  56. var selecta = "";
  57. var editingRow = "";
  58. //判断是否是班组 默认为单位
  59. var deptFlag = "false";
  60. //单位级别,根据deptFlag判断
  61. var deptLevel = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/getDeptLevel", {
  62. "comp_id" : compId
  63. }, "text");
  64. var level = deptLevel;
  65. //应急资源表的跨区域选择
  66. var areaData = "";
  67. var yjzyGrid = "";
  68. //判断是否有操作列
  69. var rollbackFlag = false;
  70. //用于判断本单位是否有下级填报单位,有下级填报单位时为true 班组部门没有下级填报单位
  71. var hasSubUnit = "";
  72. var clickFlag = false;
  73. var lockFlag = false;
  74. var taskFlag;//判断是否给下级单位下发了任务
  75. //预警发布及响应启动情况表
  76. var urls1 = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getAlertMsg";
  77. var warn_url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getNeedWritePro";
  78. var data11 = {
  79. "list" : [ {
  80. "value" : "红色预警",
  81. "key" : "红色预警"
  82. }, {
  83. "value" : "橙色预警",
  84. "key" : "橙色预警"
  85. }, {
  86. "value" : "黄色预警",
  87. "key" : "黄色预警"
  88. }, {
  89. "value" : "蓝色预警",
  90. "key" : "蓝色预警"
  91. }, {
  92. "value" : "一级响应",
  93. "key" : "一级响应"
  94. }, {
  95. "value" : "二级响应",
  96. "key" : "二级响应"
  97. }, {
  98. "value" : "三级响应",
  99. "key" : "三级响应"
  100. }, {
  101. "value" : "四级响应",
  102. "key" : "四级响应"
  103. } ]
  104. };
  105. var data22 = {
  106. "list" : [ {
  107. "value" : "一级响应",
  108. "key" : "一级响应"
  109. }, {
  110. "value" : "二级响应",
  111. "key" : "二级响应"
  112. }, {
  113. "value" : "三级响应",
  114. "key" : "三级响应"
  115. }, {
  116. "value" : "四级响应",
  117. "key" : "四级响应"
  118. } ]
  119. };
  120. var huifu = {
  121. "list" : [ {
  122. "value" : "是",
  123. "key" : "是"
  124. }, {
  125. "value" : "否",
  126. "key" : "否"
  127. } ]
  128. };
  129. var shqk = {
  130. "list" : [ {
  131. "value" : "轻伤",
  132. "key" : "轻伤"
  133. }, {
  134. "value" : "重伤",
  135. "key" : "重伤"
  136. }, {
  137. "value" : "死亡",
  138. "key" : "死亡"
  139. }, {
  140. "value" : "受困",
  141. "key" : "受困"
  142. }, {
  143. "value" : "失踪",
  144. "key" : "失踪"
  145. }, {
  146. "value" : "其它",
  147. "key" : "其它"
  148. } ]
  149. };
  150. var xb = {
  151. "list" : [ {
  152. "value" : "男",
  153. "key" : "男"
  154. }, {
  155. "value" : "女",
  156. "key" : "女"
  157. }
  158. ]
  159. };
  160. var dbtype = {
  161. "list" : [ {
  162. "value" : "变电站",
  163. "key" : "变电站"
  164. }, {
  165. "value" : "发电厂",
  166. "key" : "发电厂"
  167. }, {
  168. "value" : "换流站",
  169. "key" : "换流站"
  170. }, {
  171. "value" : "用户站",
  172. "key" : "用户站"
  173. }
  174. ]
  175. };
  176. var dydj = {
  177. "list" : [
  178. {
  179. "value" : "500kV",
  180. "key" : "500kV"
  181. }, {
  182. "value" : "220kV",
  183. "key" : "220kV"
  184. }, {
  185. "value" : "110kV",
  186. "key" : "110kV"
  187. }, {
  188. "value" : "35kV",
  189. "key" : "35kV"
  190. } ]
  191. };
  192. var wh = "";
  193. //明细表的数据
  194. var xqData;
  195. function initComplete() {
  196. $(".mainCon").live("click", function() {
  197. if (maintableType != "1") {
  198. g.endEdit();
  199. }
  200. });
  201. $(".l-grid-hd-cell-text").css("color", "white");
  202. // 自动补齐数据
  203. $("#lock").live("click", function() {
  204. if (!lockFlag) {
  205. lockFlag = true;
  206. $("#lock").parent().addClass("backcolor");
  207. $("#lock").attr("title", "单元格获取上次数据开启");
  208. } else {
  209. lockFlag = false;
  210. $("#lock").parent().removeClass("backcolor");
  211. $("#lock").attr("title", "单元格获取上次数据关闭");
  212. }
  213. });
  214. //只有是单位才会有下级填报单位
  215. $(".company a").live("click",function(){
  216. var type = $("#sel").val();//报表类型
  217. var rowdata = g.getSelectedRow();
  218. console.log(JSON.stringify(rowdata));
  219. var comp = rowdata.COMP_ID;
  220. var comp_name = rowdata.COMP_NAME;
  221. var alert_id = rowdata.REPORT_ID;//记录id,没有上报数据为""
  222. var diag = new top.Dialog();
  223. diag.Title = "修改报表";
  224. diag.URL = encodeURI("/nwyj/page/business/em/report/Alert_Data.html");
  225. diag.Height = 560; diag.Width= 1200;
  226. diag.showOkButton = false;
  227. diag.showCancelButton = false;
  228. diag.ShowMaxButton = true;
  229. diag.show();
  230. diag.OnLoad = function(){
  231. diag.innerFrame.contentWindow.showData(type,comp,comp_name,role_id,affair,affairType,alert_id);
  232. };
  233. });
  234. //初始化报表责任部门数据
  235. getDeptRole();
  236. console.log(_thisUrl);
  237. var reportData = _thisUrl.split("?");
  238. if (reportData.length == 9) {// 从代办进入填报页面
  239. // 报表类型
  240. report_type = reportData[1];
  241. // 任务id
  242. fdIds = reportData[2];
  243. // 角色id
  244. role_id = reportData[3];
  245. // 事件类型名称
  246. affairType = reportData[4];
  247. // 事件类型id
  248. affair = reportData[5];
  249. //任务名称
  250. plan_name = reportData[6];
  251. // 当前填报时间的填报(false),不是当前填报时间节点的填报--作为草稿填报(true)
  252. draftWrite = reportData[7];
  253. //填报时间点
  254. report_time = reportData[8];
  255. console.log("待办任务id:"+fdIds+";待办任务名称:"+plan_name+";draftWrite:"+draftWrite+";填报时间:"+report_time);
  256. $("#sel").setValue(report_type);
  257. $("#sel").attr("disabled", true);
  258. $("#sel").render();
  259. $("#roleSel").setValue(role_id);
  260. $("#roleSel").attr("disabled", true);
  261. $("#roleSel").render();
  262. //根据事件类型和报表类型判断是否为班组
  263. deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
  264. "corpId" : compId,
  265. "deptId" : deptId,
  266. "affair" : affair,//事件类型id
  267. "report_type" : report_type
  268. }, "text");
  269. if("true"==deptFlag){//班组部门
  270. deptLevel = level - 1;
  271. corpId = deptId;
  272. }else{
  273. deptLevel = level;
  274. corpId = compId;
  275. }
  276. excType = report_type;
  277. var tableType = getThing($.pathname()
  278. + "/ws/xianlutingyun/XianlutingyunService/getCheckType", {
  279. report_type : report_type
  280. }, 'text');
  281. maintableType = tableType;
  282. //初始化报表模版
  283. getRole(role_id, report_type);
  284. //加载填写说明
  285. getRequire(role_id);
  286. //班组部门没有下级填报单位
  287. if("0"==maintableType && "false"==deptFlag){
  288. //用于判断本单位是否有下级填报单位,有下级填报单位时为true
  289. hasSubUnit = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/checkSubUnit", {
  290. "comp_id" : compId,
  291. "role_id" : role_id,
  292. "affair" : affair,
  293. "report_type" : report_type
  294. }, "text");
  295. if(hasSubUnit == "true"){
  296. rollbackFlag = true;//该单位(非班组)有下级填报单位 可作为判断是否需要汇总和显示操作列
  297. }
  298. //若没有给下级单位下发任务,那么整个表格可以编辑。不需要汇总下级单位数据及操作列
  299. taskFlag = getThing($.pathname() + "/ws/baoBiao/BaoBiaoService/getReportTaskComp",{
  300. "comp_id" : compId,
  301. "role_id" : role_id,
  302. "affair" : affair,
  303. "report_type" : deptLevel=="2" && report_type=="101"?"2":report_type
  304. },"text");
  305. if(taskFlag===""){//没有有任务
  306. rollbackFlag = false;
  307. }
  308. }
  309. //贵州版本任务只下发到县区,下级的供电所作为县区的部门。县区那层级不需要代填
  310. if(parseInt(deptLevel)>3){
  311. rollbackFlag = false;
  312. }
  313. //统计表工具栏菜单
  314. var item = getItem(report_type);
  315. //表头
  316. getColumns(report_type,affair);
  317. $("#add").text("新增" + corpName + mycol1);
  318. $("#affair").text(affairType);
  319. //报表计划信息展示
  320. getReportPlanInfo();
  321. //填写说明
  322. changeRequireByVal(report_type);
  323. if (tableType == "1") {// 明细表
  324. if (report_type == "7") {
  325. $("#maingrids").show();
  326. initGrid(urls1, report_type);
  327. } else {
  328. $("#maingrid2").show();
  329. var item1 = getXqItem(report_type);
  330. //明细表汇总下级单位数据
  331. // checkXqHuiZong(rollbackFlag);
  332. getXqtotal();
  333. initGrid1(xqData, item1, report_type);
  334. }
  335. } else {// 统计表
  336. //应急资源表的跨区域显示
  337. getAreaData(deptLevel);
  338. $("#maingrid").show();
  339. //初始化获取单位数据
  340. getRows(report_type,affair);
  341. //加载表格数据
  342. init(testData, item, report_type);
  343. //汇总下级单位数据
  344. checkHuiZong(rollbackFlag);
  345. }
  346. } else {
  347. affairType = reportData[1].split("=")[1];
  348. affair = reportData[2].split("=")[1];
  349. role_id = $("#roleSel").val();
  350. //报表类型
  351. report_type = getType(role_id);
  352. //根据事件类型和报表类型判断是否为班组
  353. deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
  354. "corpId" : compId,
  355. "deptId" : deptId,
  356. "affair" : affair,
  357. "report_type" : report_type
  358. }, "text");
  359. if("true"==deptFlag){
  360. deptLevel = level - 1;
  361. corpId = deptId;
  362. }else{
  363. deptLevel = level;
  364. corpId = compId;
  365. }
  366. var miantableType = getThing($.pathname()
  367. + "/ws/xianlutingyun/XianlutingyunService/getCheckType", {
  368. report_type : report_type
  369. }, 'text');
  370. maintableType = miantableType;
  371. //班组部门没有下级填报单位
  372. if("0"==miantableType && "false"==deptFlag){
  373. //用于判断本单位是否有下级填报单位,有下级填报单位时为true
  374. hasSubUnit = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/checkSubUnit", {
  375. "comp_id" : compId,
  376. "role_id" : role_id,
  377. "report_type" : report_type,
  378. "affair" : affair
  379. }, "text");
  380. if(hasSubUnit == "true"){
  381. rollbackFlag = true;
  382. }
  383. //若没有给下级单位下发任务,那么整个表格可以编辑。不需要汇总下级单位数据及操作列
  384. taskFlag = getThing($.pathname() + "/ws/baoBiao/BaoBiaoService/getReportTaskComp",{
  385. "comp_id" : compId,
  386. "role_id" : role_id,
  387. "affair" : affair,
  388. "report_type" : report_type
  389. },"text");
  390. if(taskFlag===""){//没有有任务
  391. rollbackFlag = false;
  392. }
  393. }
  394. //贵州版本任务只下发到县区,下级的供电所作为县区的部门。县区那层级不需要代填
  395. if(parseInt(deptLevel)>3){
  396. rollbackFlag = false;
  397. }
  398. //报表模版初始化
  399. getRole(role_id);
  400. //加载填写说明
  401. getRequire(role_id);
  402. // 报表填报点击新增时新增
  403. getColumns(getType(role_id),affair);
  404. if (report_type == "100") {
  405. $("#requires").hide();
  406. }
  407. excType = report_type;
  408. //根据报表类型显示填写说明
  409. changeRequireByVal(report_type);
  410. var inititem = getItem(report_type);
  411. //根据事件类型和报表类型查询报表计划
  412. getReportPlan();
  413. $("#affair").text(affairType);
  414. $("#add").text("新增" + corpName + mycol1);
  415. //报表计划信息展示
  416. getReportPlanInfo();
  417. if (miantableType == "1") {
  418. if (report_type == "7") {
  419. $("#maingrids").show();
  420. initGrid(urls1);
  421. } else {
  422. $("#maingrid2").show();
  423. var item2 = getXqItem(report_type);
  424. //明细表汇总下级数据
  425. // checkXqHuiZong(rollbackFlag);
  426. getXqtotal();
  427. initGrid1(xqData, item2);
  428. }
  429. } else {
  430. //应急资源表的跨区域显示
  431. getAreaData(deptLevel);
  432. $("#maingrid").show();
  433. getRows(report_type,affair);
  434. init(testData, inititem, report_type);
  435. //汇总下级数据
  436. checkHuiZong(rollbackFlag);
  437. }
  438. }
  439. $("#back").hover(function() {
  440. $(this).attr("src", "/nwyj/images/temp/back_hover.png");
  441. }, function() {
  442. $(this).attr("src", "/nwyj/images/temp/back.png");
  443. });
  444. }
  445. $(function() {
  446. $("#lock").attr("title", "单元格获取上次数据关闭");
  447. $("#handlerinfo").parent().attr("title", "开启填报报表明细填写情况");
  448. $("#drscsj").parent().attr("title", "点击导入上次填报的数据");
  449. $("#hzxjsj").parent().attr("title", "点击自动汇总导入下级上报的数据");
  450. $(".l-grid-hd-cell-text").css("color", "white");
  451. $more = $("#more"); // 更多按钮
  452. $more.bind('click', function() {
  453. more();
  454. });
  455. });
  456. /**
  457. * 根据事件类型查询报表计划
  458. */
  459. function getReportPlan(){
  460. var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportPlan";
  461. var params = {"report_type":report_type,"affair":affair,"comp_id":compId,"dept_id":deptId,"role_id":role_id,"deptFlag":deptFlag};
  462. $.ajax({
  463. url : url,
  464. type : "post",
  465. data : params,
  466. dataType : "json",
  467. async : false,
  468. success : function(result){
  469. fdIds = "";
  470. plan_name = "";
  471. if(result.length>0){
  472. var data = result[0];
  473. fdIds = data.key;
  474. plan_name = data.value;
  475. draftWrite = data.stat;
  476. report_time = data.time;
  477. console.log("fd_id:"+fdIds+";plan_name:"+plan_name+";draftWrite:"+draftWrite+";report_time:"+report_time);
  478. }
  479. },
  480. error : function(){
  481. $.messager.alert('查询报表计划失败!', '访问服务失败!', 'error');
  482. }
  483. });
  484. }
  485. function getReportPlanInfo(){
  486. if(""==fdIds){
  487. $("#showRequire").hide();
  488. $("#showplan").hide();
  489. }else{
  490. $("#showRequire").show();
  491. $("#plan").text("");
  492. $("#start_time").text("");
  493. $("#end_time").text("");
  494. $("#report_times").text("");
  495. $("#report_time").text("");
  496. var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportPlanInfo";
  497. $.ajax({
  498. url : url,
  499. type : "post",
  500. data : {fd_id:fdIds,stat:"add"},
  501. dataType : "json",
  502. async : false,
  503. success : function(result){
  504. $("#plan").text(plan_name);
  505. $("#start_time").text(result[0]["start_time"]);
  506. $("#end_time").text(result[0]["end_time"]);
  507. $("#report_times").text(result[0]["report_times"]);
  508. $("#report_time").text(report_time);
  509. },
  510. error : function(){
  511. $.messager.alert('查询报表计划信息失败!', '访问服务失败!', 'error');
  512. }
  513. });
  514. }
  515. }
  516. function getAreaData(level){
  517. $(".areaSel").hide();
  518. if (report_type=="8") {
  519. if(level=='3'){
  520. areaData = {"list" : [ {"value" : "0","key" : "不跨省调拨"}, {"value" : "1","key" : "跨省调拨"}]};
  521. $(".areaSel").show();
  522. $("#areaSel").data("data", areaData);
  523. $("#areaSel").render();
  524. }else if(level=='4'){
  525. areaData = {"list" : [ {"value" : "0","key" : "不跨市调拨"}, {"value" : "1","key" : "跨市调拨"}]};
  526. $(".areaSel").show();
  527. $("#areaSel").data("data", areaData);
  528. $("#areaSel").render();
  529. }
  530. }
  531. }
  532. /**
  533. * 加载统计表表格数据
  534. * @param data
  535. * @param item 工具栏菜单
  536. * @param type 报表类型
  537. */
  538. function init(data, item, type) {
  539. g = null;
  540. var gridObj = "";
  541. if (type != "8") {
  542. gridObj = $("#maingrid");
  543. $("#yjzy").hide();
  544. $("#maingrid").show();
  545. } else {
  546. gridObj = $("#yjzy");
  547. $("#yjzy").show();
  548. $("#maingrid").hide();
  549. if(deptLevel==3 || deptLevel==4){
  550. $(".areaSel").show();
  551. }else{
  552. $(".areaSel").hide();
  553. }
  554. }
  555. g = gridObj.quiGrid({
  556. columns : mycol,
  557. data : data,
  558. usePager : false,
  559. sortName : 'id',
  560. headerRowHeight : 50,
  561. rownumbers : true,
  562. enabledEdit : true, // 编辑用
  563. width : "100%",
  564. /* height:"80%", */
  565. multihead : true,
  566. enabledSort : false,
  567. excelMode : true,
  568. alternatingRow : false,
  569. rowAttrRender : function(rowdata, rowid) {
  570. //OVERSTAT为0表示2小时之前的数据
  571. return "0" == rowdata.OVERSTAT ? "style=\"background-color:yellow;\""
  572. : '';
  573. },
  574. toolbar : {
  575. items : item
  576. },
  577. onAfterEdit : onAfterEdit,
  578. onBeforeEdit : onBeforeEdit,
  579. onAfterShowData : function() {
  580. setTjContentHeight(type);
  581. $("body").eq(0).hideLoading();
  582. }
  583. });
  584. // console.log(g.options.toolbar);
  585. if(rollbackFlag){
  586. $("#hzxjsj").parent().siblings().removeClass("backcolor");
  587. $("#hzxjsj").parent().addClass("backcolor");
  588. }
  589. }
  590. var oldVal;
  591. function onBeforeEdit(e) {
  592. var position = mousePosition(this);
  593. if(position.x>1100){
  594. g.setScroller(null,position.x,false);
  595. }
  596. //非班组且有下级填报单位,首行非中调或局本部的及不可编辑
  597. if(rollbackFlag && e.record.COMP_ID!=corpId && $.inArray(e.rowindex,rowNumArr)==-1){
  598. return false;
  599. }
  600. var len = g.getData().length;
  601. if (e.rowindex == len - 1) {
  602. top.Dialog.alert("此行不能编辑", null, null, null, -1);
  603. return false;
  604. }
  605. if (e.column.name == 'BZYDW_ID' && e.rowindex == len - 1) {
  606. top.Dialog.alert("此单元格不能编辑", null, null, null, -1);
  607. return false;
  608. }
  609. if (e.column["columnname"] == "SWRYMXB_TJ" && report_type == "10") {
  610. top.Dialog.alert("此列不能编辑", null, null, null, -1);
  611. return false;
  612. }
  613. if (e.value != null && e.value != "") {
  614. oldVal = e.value;
  615. } else {
  616. oldVal = 0;
  617. }
  618. }
  619. var num1 = 0;
  620. function onAfterEdit(e) {
  621. if (maintableType != "1" && num2 == 0) {
  622. if (e.column.isCount != 0) {
  623. return false;
  624. }
  625. if (isNaN(e.value)) {
  626. e.value = 0;
  627. }
  628. var size = g.getData().length;
  629. if (e.value == null || e.value == "") {
  630. e.value = "0";
  631. checkWrite = true;
  632. }
  633. if (e.value != null && e.value != "" && e.value != "0") {
  634. // 判断该单元格是否有值
  635. checkWrite = true;
  636. var Dataparams = {
  637. "value" : e.value,
  638. "column" : e.column.name,
  639. "comp_id" : corpId,
  640. "corp_id" : e.record.COMP_ID,
  641. "report_type" : $("#sel").val()
  642. };
  643. if (report_type == '1'
  644. && e.column.name.indexOf("TRIP_OUT_TOTAL_") > -1
  645. && !isNaN(e.value)) {
  646. $.ajax({
  647. url : $.pathname()
  648. + "/ws/xianlutingyun/XianlutingyunService/CheckCellValue",
  649. type : "post",
  650. data : Dataparams,
  651. dataType : "text",
  652. success : function(data) {
  653. // alert(data);
  654. if (data == "false") {
  655. top.Dialog.alert("当前输入的数据小于最新记录数据");
  656. }
  657. },
  658. error : function() {
  659. $.messager.alert('查询失败!', '访问服务失败!', 'error');
  660. }
  661. });
  662. }
  663. }
  664. if (report_type == "10") {
  665. var RowObj = (g.getRow(e["record"]["__id"]));
  666. var count = RowObj["SWRYMXB_TJ"] == ""
  667. || RowObj["SWRYMXB_TJ"] == undefined
  668. || RowObj["SWRYMXB_TJ"] == "undefined" ? "0"
  669. : RowObj["SWRYMXB_TJ"];
  670. var oldCount = count;
  671. count = parseInt(count, 10) + parseInt(e.value, 10)
  672. - parseInt(oldVal, 10);
  673. g.updateCell("SWRYMXB_TJ", count, RowObj);
  674. var lastTj = g.getRow(size - 1)["SWRYMXB_TJ"] == "" ? "0" : g
  675. .getRow(size - 1)["SWRYMXB_TJ"];
  676. g.getRow(size - 1)["SWRYMXB_TJ"] = parseInt(lastTj, 10)
  677. + parseInt(count, 10) - oldCount;
  678. }
  679. var updatecolumn = e.column.name;
  680. num1 = g.getRow(size - 1)[updatecolumn] == ""
  681. || g.getRow(size - 1)[updatecolumn] == undefined ? "0" : g
  682. .getRow(size - 1)[updatecolumn];
  683. num1 = getZjResult(num1, e.value, oldVal);// Math.round((parseFloat(num1)+parseFloat(e.value)-oldVal)*100)/100;
  684. var row = g.getRow(size - 1);
  685. row[updatecolumn] = num1;
  686. var row1 = g.getRow(e.rowindex);
  687. row1[updatecolumn] = parseFloat(e.value);
  688. g.updateRow(e.rowindex, row1);
  689. g.updateRow(size - 1, row);
  690. if (flag && num % 2 != 0 && checkWrite) {
  691. // alert(JSON.stringify(e.record));
  692. var fd_id = e.record.FD_OBJECTID;
  693. var name = e.column.name;
  694. var comp = e.record.COMP_NAME;
  695. var id = e.record.COMP_ID;
  696. var report_id = e.record.REPORT_ID;
  697. var display = e.column.display;
  698. var writeVal = $("#sel").val();
  699. if (writeVal == "8") {
  700. if (display.indexOf("人") == -1) {
  701. return;
  702. }
  703. }
  704. var totalCount = e.value;
  705. var wrong = $("#wrongNum").val();
  706. var write_url = "/nwyj/page/business/em/report/writeData/writeData1.jsp";
  707. var diag = new top.Dialog();// 定义一个窗口对象
  708. diag.Title = "明细填写";// 窗口标题
  709. diag.URL = encodeURI(write_url);// 窗口对应的页面
  710. diag.Height = 560;
  711. diag.Width = 1200;
  712. diag.showOkButton = false;
  713. diag.showCancelButton = false;
  714. diag.ShowMaxButton = true;
  715. diag.show();// 显示窗口
  716. diag.OnLoad = function() {
  717. diag.innerFrame.contentWindow.showDetail(fd_id, name, comp,
  718. writeVal, display, totalCount, e.column["__id"],
  719. e["record"]["__id"], wrong, checkInterface, id,
  720. report_id);
  721. };
  722. var bodyheight = $(window.document.body).height();
  723. $(window.document.body).find("#frmright").height(bodyheight);
  724. }
  725. }
  726. // 取消事件冒泡
  727. return false;
  728. }
  729. function getZjResult(arg1, arg2, arg3) {
  730. var r1, r2, r3, m, n;
  731. try {
  732. r1 = arg1.toString().split(".")[1].length;
  733. } catch (e) {
  734. r1 = 0;
  735. }
  736. try {
  737. r2 = arg2.toString().split(".")[1].length;
  738. } catch (e) {
  739. r2 = 0;
  740. }
  741. try {
  742. r3 = arg3.toString().split(".")[1].length;
  743. } catch (e) {
  744. r3 = 0;
  745. }
  746. m = Math.pow(10, Math.max(r1, r2, r3));
  747. // 动态控制精度长度
  748. n = Math.max(r1, r2, r3);
  749. return ((arg1 * m + arg2 * m - arg3 * m) / m).toFixed(n);
  750. }
  751. // 返回主页面
  752. function goback() {
  753. flag = false;
  754. var iframe = parent.document.getElementsByName("frmright")[0];
  755. if (_thisUrl.indexOf("affair=") == -1) {
  756. iframe.src = "/nwyj/page/business/em/waitdo/waitDo.html";
  757. }else{
  758. iframe.src = "/nwyj/page/business/em/report/Report_main.jsp";
  759. }
  760. }
  761. /**
  762. * 获取表字段
  763. * @param type 报表类型
  764. * @param affair 事件类型
  765. */
  766. function getColumns(type,affair) {
  767. if (type == '100') {
  768. mycol1 = "抢修工作进度情况表";
  769. mycol = [ {
  770. hide : "true",
  771. name : "FD_OBJECTID"
  772. }, {
  773. display : "支援单位",
  774. name : "COMP_NAME",
  775. id : "COMP_ID",
  776. frozen: true,
  777. width : '80'
  778. },
  779. // {display:"支援单位",name:"COMP_NAME",id:"COMP_ID",minWidth:'100'/*,editor:{type:"text",inputMode:"positiveDecimal",maxlength:"20"}*/},
  780. {
  781. display : "被支援单位",
  782. name : "BZYDW_ID",
  783. editor : {
  784. type : "text",
  785. inputMode : "text",
  786. maxlength : "15"
  787. },
  788. width : '11%'
  789. }, {
  790. display : "500kV线路",
  791. columns : [ {
  792. display : "累计完成",
  793. columns : [ {
  794. display : "组塔(基)",
  795. name : "LJWCZT_500",
  796. editor : {
  797. type : "text",
  798. inputMode : "positiveDecimal",
  799. maxlength : "9"
  800. },
  801. isCount : "0",
  802. width : '5%'
  803. }, {
  804. display : "架线(km)",
  805. name : "LJWCJX_500",
  806. editor : {
  807. type : "text",
  808. inputMode : "positiveDecimal",
  809. maxlength : "9"
  810. },
  811. isCount : "0",
  812. width : '5%'
  813. } ]
  814. } ]
  815. }, {
  816. display : "220kV线路",
  817. columns : [ {
  818. display : "累计完成",
  819. columns : [ {
  820. display : "组塔(基)",
  821. name : "LJWCZT_220",
  822. editor : {
  823. type : "text",
  824. inputMode : "positiveDecimal",
  825. maxlength : "9"
  826. },
  827. isCount : "0",
  828. width : '5%'
  829. }, {
  830. display : "架线(km)",
  831. name : "LJWCJX_220",
  832. editor : {
  833. type : "text",
  834. inputMode : "positiveDecimal",
  835. maxlength : "9"
  836. },
  837. isCount : "0",
  838. width : '5%'
  839. } ]
  840. } ]
  841. }, {
  842. display : "110kV线路",
  843. columns : [ {
  844. display : "累计完成",
  845. columns : [ {
  846. display : "组塔(基)",
  847. name : "LJWCZT_110",
  848. editor : {
  849. type : "text",
  850. inputMode : "positiveDecimal",
  851. maxlength : "9"
  852. },
  853. isCount : "0",
  854. width : '5%'
  855. }, {
  856. display : "立杆(根)",
  857. name : "LJWCLG_110",
  858. editor : {
  859. type : "text",
  860. inputMode : "positiveDecimal",
  861. maxlength : "9"
  862. },
  863. isCount : "0",
  864. width : '5%'
  865. }, {
  866. display : "架线(km)",
  867. name : "LJWCJX_110",
  868. editor : {
  869. type : "text",
  870. inputMode : "positiveDecimal",
  871. maxlength : "9"
  872. },
  873. isCount : "0",
  874. width : '5%'
  875. } ]
  876. } ]
  877. },
  878. {
  879. display : "10kV线路",
  880. columns : [ {
  881. display : "今日完成",
  882. columns : [ {
  883. display : "组塔(基)",
  884. name : "JRWCZT_10",
  885. editor : {
  886. type : "text",
  887. inputMode : "positiveDecimal",
  888. maxlength : "9"
  889. },
  890. isCount : "0",
  891. width : '5%'
  892. }, {
  893. display : "扶杆(根)",
  894. name : "JRWCFG_10",
  895. editor : {
  896. type : "text",
  897. inputMode : "positiveDecimal",
  898. maxlength : "9"
  899. },
  900. isCount : "0",
  901. width : '5%'
  902. }, {
  903. display : "立杆(根)",
  904. name : "JRWCLG_10",
  905. editor : {
  906. type : "text",
  907. inputMode : "positiveDecimal",
  908. maxlength : "9"
  909. },
  910. isCount : "0",
  911. width : '5%'
  912. }, {
  913. display : "架线(km)",
  914. name : "JRWCJX_10",
  915. editor : {
  916. type : "text",
  917. inputMode : "positiveDecimal",
  918. maxlength : "9"
  919. },
  920. isCount : "0",
  921. width : '5%'
  922. } ]
  923. }, {
  924. display : "累计完成",
  925. columns : [ {
  926. display : "组塔(基)",
  927. name : "LJWCZT_10",
  928. editor : {
  929. type : "text",
  930. inputMode : "positiveDecimal",
  931. maxlength : "9"
  932. },
  933. isCount : "0",
  934. width : '5%'
  935. }, {
  936. display : "扶杆(根)",
  937. name : "LJWCFG_10",
  938. editor : {
  939. type : "text",
  940. inputMode : "positiveDecimal",
  941. maxlength : "9"
  942. },
  943. isCount : "0",
  944. width : '5%'
  945. }, {
  946. display : "立杆(根)",
  947. name : "LJWCLG_10",
  948. editor : {
  949. type : "text",
  950. inputMode : "positiveDecimal",
  951. maxlength : "9"
  952. },
  953. isCount : "0",
  954. width : '5%'
  955. }, {
  956. display : "架线(km)",
  957. name : "LJWCJX_10",
  958. editor : {
  959. type : "text",
  960. inputMode : "positiveDecimal",
  961. maxlength : "9"
  962. },
  963. isCount : "0",
  964. width : '5%'
  965. } ]
  966. } ]
  967. },
  968. {
  969. display : "低压线路",
  970. columns : [ {
  971. display : "今日完成",
  972. columns : [ {
  973. display : "扶杆(根)",
  974. name : "JRWCFG_DY",
  975. editor : {
  976. type : "text",
  977. inputMode : "positiveDecimal",
  978. maxlength : "9"
  979. },
  980. isCount : "0",
  981. width : '5%'
  982. }, {
  983. display : "立杆(根)",
  984. name : "JRWCLG_DY",
  985. editor : {
  986. type : "text",
  987. inputMode : "positiveDecimal",
  988. maxlength : "9"
  989. },
  990. isCount : "0",
  991. width : '5%'
  992. }, {
  993. display : "架线(km)",
  994. name : "JRWCJX_DY",
  995. editor : {
  996. type : "text",
  997. inputMode : "positiveDecimal",
  998. maxlength : "9"
  999. },
  1000. isCount : "0",
  1001. width : '5%'
  1002. } ]
  1003. }, {
  1004. display : "累计完成",
  1005. columns : [ {
  1006. display : "扶杆(根)",
  1007. name : "LJWCFG_DY",
  1008. editor : {
  1009. type : "text",
  1010. inputMode : "positiveDecimal",
  1011. maxlength : "9"
  1012. },
  1013. isCount : "0",
  1014. width : '5%'
  1015. }, {
  1016. display : "立杆(根)",
  1017. name : "LJWCLG_DY",
  1018. editor : {
  1019. type : "text",
  1020. inputMode : "positiveDecimal",
  1021. maxlength : "9"
  1022. },
  1023. isCount : "0",
  1024. width : '5%'
  1025. }, {
  1026. display : "架线(km)",
  1027. name : "LJWCJX_DY",
  1028. editor : {
  1029. type : "text",
  1030. inputMode : "positiveDecimal",
  1031. maxlength : "9"
  1032. },
  1033. isCount : "0",
  1034. width : '5%'
  1035. } ]
  1036. } ]
  1037. }, {
  1038. display : "配变",
  1039. columns : [ {
  1040. display : "今日完成",
  1041. columns : [ {
  1042. display : "修复(台)",
  1043. name : "JRWCXF_PB",
  1044. editor : {
  1045. type : "text",
  1046. inputMode : "positiveDecimal",
  1047. maxlength : "9"
  1048. },
  1049. isCount : "0",
  1050. width : '5%'
  1051. } ]
  1052. }, {
  1053. display : "累计完成",
  1054. columns : [ {
  1055. display : "修复(台)",
  1056. name : "LJWCXF_PB",
  1057. editor : {
  1058. type : "text",
  1059. inputMode : "positiveDecimal",
  1060. maxlength : "9"
  1061. },
  1062. isCount : "0",
  1063. width : '5%'
  1064. } ]
  1065. } ]
  1066. }, {
  1067. display : "累计完成比例",
  1068. name : "LJWCBL",
  1069. editor : {
  1070. type : "text",
  1071. inputMode : "positiveDecimal",
  1072. maxlength : "9"
  1073. },
  1074. width : '5%'
  1075. }, {
  1076. display : "今日完成其他工作",
  1077. name : "WCQTGZ",
  1078. editor : {
  1079. type : "text",
  1080. inputMode : "text",
  1081. maxlength : "500"
  1082. },
  1083. width : '5%'
  1084. }, {
  1085. display : "遗留问题",
  1086. name : "YLWT",
  1087. editor : {
  1088. type : "text",
  1089. inputMode : "text",
  1090. maxlength : "500"
  1091. },
  1092. width : '5%'
  1093. }
  1094. ];
  1095. } else {
  1096. var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getEditColumns";
  1097. $.ajax({
  1098. url : urls,
  1099. type : 'post',
  1100. timeout : 300000,
  1101. async : false,
  1102. data : {
  1103. "report_type" : type,
  1104. "affair" : affair,
  1105. "comp_id" : corpId,
  1106. "rollbackFlag" : rollbackFlag
  1107. },
  1108. dataType : 'text',
  1109. success : function(data) {
  1110. mycol = eval('(' + data + ')');
  1111. mycol1 = eval('(' + data + ')')[0].display;
  1112. },
  1113. error : function(e) {
  1114. $.messager.alert('查询表头失败!', '访问服务失败!', 'error');
  1115. }
  1116. });
  1117. }
  1118. }
  1119. // 获取行
  1120. function getRows(type,affair) {
  1121. // var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getRowName";
  1122. var urls = $.pathname() + "/ws/baoBiao/BaoBiaoService/getRowName";
  1123. $.ajax({
  1124. url : urls,
  1125. type : 'post',
  1126. timeout : 300000,
  1127. async : false,
  1128. data : {
  1129. comp_id : corpId,
  1130. report_type : type,
  1131. roleId : role_id,
  1132. flag : deptFlag,
  1133. affair : affair
  1134. },
  1135. dataType : 'json',
  1136. success : function(data) {
  1137. testData = data;
  1138. // alert(JSON.stringify(testData));
  1139. },
  1140. error : function(e) {
  1141. $.messager.alert('查询行失败!', '访问服务失败!', 'error');
  1142. }
  1143. });
  1144. }
  1145. /**
  1146. * 明细表操作列
  1147. * @param rowdata
  1148. * @param rowindex
  1149. * @param value
  1150. * @returns
  1151. */
  1152. function operation(rowdata, rowindex, value) {
  1153. var h = "";
  1154. if (!rowdata._editing) {
  1155. flag1 = false;
  1156. h += "<a onclick='beginEdit(" + rowindex
  1157. + ")'><span class='icon_edit'>修改</span></a>";
  1158. h += "<a onclick='onDelete(" + rowindex
  1159. + ")'><span class='icon_delete'>删除</span></a> ";
  1160. } else {
  1161. flag1 = true;
  1162. h += "<a onclick='endEdits(" + rowindex
  1163. + ")'><span class='icon_ok'>确认</span></a> ";
  1164. h += "<a onclick='cancelEdit(" + rowindex
  1165. + ")'><span class='icon_delete'>取消</span></a> ";
  1166. }
  1167. return h;
  1168. }
  1169. /**
  1170. * 统计表操作列
  1171. * @param rowdata
  1172. * @param rowindex
  1173. * @param value
  1174. * @returns
  1175. */
  1176. function backspace(rowdata, rowindex, value) {
  1177. var h = "";
  1178. if(rowdata.COMP_NAME != "总计"){
  1179. if(rowdata.appearStat=="true"){
  1180. h += "<a onclick='rollback(" + rowindex+")'><span class='retract_tem'>回退</span></a>";
  1181. }else if(rowdata.appearStat=="false"){
  1182. if (!rowdata._editing) {
  1183. h += "<a onclick='proxyWrite(" + rowindex + ")'><span class='icon_edit'>代填</span></a>";
  1184. h += "<a onclick='urgeReport(" + rowindex + ")'><span class='sendmsg_tem'>催报</span></a> ";
  1185. }else{
  1186. h += "<a onclick='saveRowData(" + rowindex + ")'><span class='icon_ok'>保存</span></a> ";
  1187. h += "<a onclick='cancelRow(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
  1188. }
  1189. }
  1190. }
  1191. return h;
  1192. }
  1193. // 退回
  1194. function rollback(rowindex) {
  1195. var row = g.getRow(rowindex);
  1196. var fdId = row.REPORT_ID;//记录id
  1197. var writeName = row.REAL_NAME;
  1198. var writeMobile = row.MOBILE;
  1199. var stat = row.appearStat;
  1200. if (stat=="true") {
  1201. rollbackInfo(fdId,writeName,writeMobile);
  1202. } else {
  1203. top.Dialog.alert("该记录无法回退!");
  1204. return;
  1205. }
  1206. }
  1207. // 代填
  1208. function proxyWrite(rowindex){
  1209. var rowdata = g.getRow(rowindex);
  1210. //判断当前时间点是否有填报任务
  1211. var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportWriteTask";
  1212. var params = {
  1213. "report_type" : report_type,
  1214. "affair" : affair,
  1215. "comp_id" : compId,
  1216. "role_id" : role_id,
  1217. "data" : JSON.stringify(rowdata)
  1218. };
  1219. $.ajax({
  1220. url : url,
  1221. type : "post",
  1222. data : params,
  1223. dataType : "json",
  1224. async : false,
  1225. success : function(result){
  1226. console.log("代填任务:"+JSON.stringify(result));
  1227. if(result.length>0){
  1228. var task_id = "";
  1229. var task_name = "";
  1230. var task_time = "";
  1231. for(var i in result){
  1232. var data = result[i];
  1233. task_id += data.key+",";
  1234. task_name += data.value+",";
  1235. task_time += data.time+",";
  1236. }
  1237. task_id = task_id.substring(0, task_name.lastIndexOf(","));
  1238. task_name = task_name.substring(0, task_name.lastIndexOf(","));
  1239. task_time = task_time.substring(0, task_time.lastIndexOf(","));
  1240. console.log("代填任务id:"+task_id+";任务名称:"+task_name+";任务时间:"+task_time);
  1241. rowNumArr.push(rowindex);
  1242. rowdata.TASK_ID = task_id;// 任务id
  1243. rowdata.TASK_NAME = task_name;// 任务名称
  1244. rowdata.TASK_TIME = task_time;
  1245. rowdata._editing = true;// 设置为可编辑状态
  1246. g.reRender({ rowdata: rowdata });
  1247. }else{
  1248. top.Dialog.alert("该单位/部门当前时间没有填报任务|代填提示");
  1249. }
  1250. },
  1251. error : function(){
  1252. $.messager.alert('查询报表任务失败!', '访问服务失败!', 'error');
  1253. }
  1254. });
  1255. }
  1256. // 催报
  1257. function urgeReport(rowindex){
  1258. var rowdata = g.getRow(rowindex);
  1259. var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/urgeReport";
  1260. var params = {
  1261. "comp_id" : compId,
  1262. "role_id" : role_id,
  1263. "report_type" : report_type,
  1264. "affair" : affair,
  1265. "data" : JSON.stringify(rowdata)
  1266. };
  1267. $.ajax({
  1268. url : url,
  1269. type : "post",
  1270. data : params,
  1271. dataType : "json",
  1272. success : function(data){
  1273. console.log("催报:"+JSON.stringify(data));
  1274. if(data.Msg.sucsess==true){
  1275. if(data.Msg.data==null){
  1276. top.Dialog.alert(data.Msg.info);//没有催报人员
  1277. }else{
  1278. var name = data.Msg.data.split("&")[0];
  1279. var phone = data.Msg.data.split("&")[1];
  1280. var nameText = data.Msg.data.split("&")[2];//计划
  1281. var wtTime = data.Msg.data.split("&")[3];//填报时间
  1282. addMsg(name,phone,'您好,'+nameText+'计划中的'+mycol1+'在'+wtTime+"填报时间段还没有上报,请您尽快登陆系统进行填写上报");
  1283. }
  1284. }else{
  1285. top.Dialog.alert(data.Msg.info);//当前没有任务
  1286. }
  1287. },
  1288. error : function(){
  1289. $.messager.alert('报表催报失败!', '访问服务失败!', 'error');
  1290. }
  1291. });
  1292. }
  1293. //保存填写的数据
  1294. function saveRowData(rowindex){
  1295. rowNumArr.pop(rowindex);
  1296. var rowdata = g.getRow(rowindex);
  1297. rowdata.USER_ID = user_id;// 用户id
  1298. rowdata.REAL_NAME = real_name;// 用户名
  1299. rowdata.MOBILE = mobile;// 电话
  1300. //保存数据
  1301. var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/saveRowData";
  1302. var params = {
  1303. "data" : JSON.stringify(rowdata),
  1304. "report_type" : report_type,
  1305. "affair" : affair,
  1306. "comp_id" : corpId,
  1307. "role_id" : role_id,
  1308. "report_comp" : corpName + deptName
  1309. };
  1310. $.ajax({
  1311. url : url,
  1312. type : "post",
  1313. data : params,
  1314. dataType : "json",
  1315. async : false,
  1316. success : function(data){
  1317. if(data.Msg.sucsess==true){
  1318. rowdata.REPORT_ID = data.Msg.objectID;//记录id
  1319. rowdata.appearStat = "true";// 将下级上报状态改成已上报
  1320. delete rowdata['_editing'];//设置为不可编辑状态
  1321. }else{
  1322. rowdata.appearStat = "false";// 将下级上报状态改成未上报
  1323. delete rowdata["USER_ID"];// 用户id
  1324. delete rowdata["REAL_NAME"];// 用户名
  1325. delete rowdata["MOBILE"];// 电话
  1326. }
  1327. top.Dialog.alert(data.Msg.info);
  1328. },
  1329. error : function(){
  1330. $.messager.alert('保存代填数据失败!', '访问服务失败!', 'error');
  1331. }
  1332. });
  1333. g.reRender({ rowdata: rowdata });
  1334. }
  1335. //取消填写的数据
  1336. function cancelRow(rowindex){
  1337. rowNumArr.pop(rowindex);
  1338. g.endEdit();
  1339. var size = g.getData().length;
  1340. var rowdata = g.getRow(rowindex);
  1341. var zjRowdata = g.getRow(size-1);//总计行
  1342. var columns = g.columns;
  1343. for(var i=0;i<columns.length;i++){
  1344. if(!columns[i].name){continue;}
  1345. if(columns[i].name=="COMP_NAME" || columns[i].name=="FD_OBJECTID"){continue;}
  1346. if(!rowdata[columns[i].name]){continue;}
  1347. if(columns[i].isCount=="0"){//统计列
  1348. var num = getZjResult(zjRowdata[columns[i].name], oldVal, rowdata[columns[i].name]);
  1349. zjRowdata[columns[i].name] = num;
  1350. }
  1351. delete rowdata[columns[i].name];
  1352. }
  1353. delete rowdata["TASK_ID"];
  1354. delete rowdata["TASK_NAME"];
  1355. delete rowdata["TASK_TIME"];
  1356. delete rowdata['_editing'];//设置为不可编辑状态
  1357. g.reRender({ rowdata: rowdata });
  1358. //更新总计行数据
  1359. g.updateRow(size - 1, zjRowdata);
  1360. }
  1361. // 角色选择
  1362. function roleChange(){
  1363. role_id = $("#roleSel").val();
  1364. //根据角色id获取默认的报表类型
  1365. report_type = getType(role_id);
  1366. //根据事件类型和报表类型判断是否为班组
  1367. deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
  1368. "corpId" : compId,
  1369. "deptId" : deptId,
  1370. "affair" : affair,
  1371. "report_type" : report_type
  1372. }, "text");
  1373. if("true"==deptFlag){
  1374. deptLevel = level - 1;
  1375. corpId = deptId;
  1376. }else{
  1377. deptLevel = level;
  1378. corpId = compId;
  1379. }
  1380. getRole(role_id);
  1381. if (checkRowObj) {
  1382. checkRowObj = false;
  1383. }
  1384. g.endEdit();
  1385. $("body").eq(0).showLoading();
  1386. changeTable(report_type);
  1387. }
  1388. // 根据下拉框的选择,动态获取表头
  1389. function change() {
  1390. var typeVal = $("#sel").val();
  1391. //根据事件类型和报表类型判断是否为班组
  1392. deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
  1393. "corpId" : compId,
  1394. "deptId" : deptId,
  1395. "affair" : affair,
  1396. "report_type" : typeVal
  1397. }, "text");
  1398. if("true"==deptFlag){
  1399. deptLevel = level - 1;
  1400. corpId = deptId;
  1401. }else{
  1402. deptLevel = level;
  1403. corpId = compId;
  1404. }
  1405. report_type = typeVal;
  1406. if (flag1) {
  1407. top.Dialog.alert("请编辑完再切换");
  1408. $("#sel").setValue(excType);
  1409. return;
  1410. }
  1411. if (checkRowObj) {
  1412. checkRowObj = false;
  1413. }
  1414. g.endEdit();
  1415. $("body").eq(0).showLoading();
  1416. changeTable(typeVal);
  1417. }
  1418. // 新增报表
  1419. function save(type) {
  1420. if (flag1) {
  1421. top.Dialog.alert("请完成编辑再保存");
  1422. return;
  1423. }
  1424. if(rowNumArr.length>0){
  1425. top.Dialog.alert("请完成代填 后再保存");
  1426. return;
  1427. }
  1428. if (num % 2 != 0) {
  1429. flag = false;
  1430. $("#handlerinfo").text("开启填写明细");
  1431. $("#handlerinfo").parent().removeClass("backcolor");
  1432. num = 2;
  1433. }
  1434. g.endEdit();
  1435. var typeValue = $("#sel").val();
  1436. var row = g.getData();
  1437. var json = JSON.stringify(row);
  1438. if (maintableType == "1") {
  1439. // 新增前判断首行是否为空
  1440. if (typeValue != '7') {
  1441. var textInput = $("#maingrid2").find(".l-grid2").find(".l-grid-body-inner").find("tbody").find("tr");
  1442. if (textInput.eq(0).text().trim() == "修改删除") {
  1443. checkRowObj = true;
  1444. }
  1445. }else{
  1446. var textInput = $("#maingrids").find(".l-grid2").find(".l-grid-body-inner").find("tbody").find("tr");
  1447. if (textInput.eq(0).text().trim() == "修改删除") {
  1448. checkRowObj = true;
  1449. }
  1450. }
  1451. if (checkRowObj) {
  1452. top.Dialog.confirm("内容存在空数据,是否继续保存|确定", function() {
  1453. saveTable(type, json);
  1454. });
  1455. } else {
  1456. saveTable(type, json);
  1457. }
  1458. } else {
  1459. saveTable(type, json);
  1460. }
  1461. }
  1462. // 重置表信息
  1463. function clear_msg() {
  1464. if (flag1) {
  1465. top.Dialog.alert("请编辑完再重置");
  1466. return;
  1467. }
  1468. top.Dialog.confirm("确定要重置?填写的信息会全部清除,请慎重选择|重置", function() {
  1469. window.location.href = window.location.href;
  1470. });
  1471. }
  1472. // 监听回车
  1473. function checkKeyCode(event) {
  1474. if (event.keyCode == 13) {
  1475. g.endEdit();
  1476. }
  1477. return false;
  1478. }
  1479. //根据用户角色初始化报表责任部门 20170316 kym
  1480. function getDeptRole(){
  1481. $.ajax({
  1482. url : $.pathname() +"/ws/getUserRole/GetRoleService/getUserRole",
  1483. type : 'post',
  1484. timeout : 15000,
  1485. async : false,
  1486. data : {userId:user_id,roleId:zyRole},
  1487. dataType : 'json',
  1488. success : function(data) {
  1489. $("#roleSel").data("data",data);
  1490. $("#roleSel").render();
  1491. },
  1492. error : function(e) {
  1493. $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
  1494. }
  1495. });
  1496. }
  1497. // 根据用户登录时的不同角色初始化下拉框
  1498. function getRole(roleId, report_type) {
  1499. var urls = "";
  1500. var initParams = "";
  1501. if (report_type != undefined) {// 代办传入报表类型
  1502. urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getDbReport";
  1503. initParams = {
  1504. report_type : report_type,
  1505. deptLevel : deptLevel
  1506. };
  1507. } else {
  1508. // urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getTypeSel";
  1509. urls = $.pathname() + "/ws/baoBiao/BaoBiaoService/getTypeSel";
  1510. initParams = {
  1511. role_id : roleId,
  1512. dept_level : deptLevel,
  1513. affair : affair
  1514. };
  1515. }
  1516. selecta = getThing(urls, initParams);
  1517. $("#sel").data("data", selecta);
  1518. $("#sel").render();
  1519. }
  1520. function getRequire(roleId){
  1521. $("#requires").empty();
  1522. $("#changerequire").empty();
  1523. if (roleId == "R002105430210") {
  1524. $("#requires")
  1525. .append("<span>填写说明:</span><br>"
  1526. + "<span>① 单位:受灾地市局</span>;<br>"
  1527. + "<span>② 跳闸停电(条数):相应电压等级线路跳闸的总条数,不包含重合闸成功的跳闸线路条数,且同一条线路多次跳闸,只统计为一个跳闸条数。</span><br>"
  1528. + "<span>③ 未恢复:填写相应电压等级线路跳闸后,未恢复成热备用状态的线路条数。</span><br>"
  1529. + "<span>④ 累计跳闸(条次):相应电压等级线路跳闸的总条次数,包含重合闸成功的跳闸线路条数,且同一条线路多次跳闸,统计为多个跳闸条次数。</span><br>"
  1530. + "<span>⑤ 备注:填写未恢复线路名称。</span><br>"
  1531. + "<span>⑥ 损失负荷:电网因灾损失的负荷数。电网发生故障后,在线路重合闸及备用电源自投装置动作完成后系统未恢复的负荷,包括电网减供负荷和低压脱扣负荷。</span><br>"
  1532. + "<span>⑦ 损失占比:损失负荷数占同期电网应有负荷的百分比。</span>");
  1533. $("#changerequire")
  1534. .append("<span>填写说明:</span><br>"
  1535. +"<span>① 单位:受灾地市局</span><br>"
  1536. + "<span>② 累计停运(座):灾害过程中发生停运变电站的总座数。</span><br>"
  1537. + "<span>③ 未恢复(座):截止当前时间未恢复变电站的总座数。</span><br>"
  1538. + "<span>④ 备注:发生停运事件的变电站名称及目前状态。例如:XX变电站(已恢复/未恢复)</span>");
  1539. }
  1540. if (roleId == "R002105430213") {
  1541. $("#requires")
  1542. .append("<span>填写说明:</span><br>"
  1543. +"<span>① 单位名称:公司、受灾地市局。</span><br>"
  1544. + "<span>② 本单位预警或响应级别:防风防汛X色预警,防风防汛X级响应。</span><br>"
  1545. + "<span>③ 同级政府相关部门名称:例如XX省防总等。</span><br>"
  1546. + "<span>④ 同级政府相关部门预警或响应级别:防风防汛X色预警,防风防汛X级响应。</span><br>"
  1547. + "<span>⑤ 开始时间:例如,9月9日9时30分。</span><br>"
  1548. + "<span>⑥ 结束时间:例如,9月9日9时30分。当处于预警发布或响应启动状态时,结束时间可保持为空。</span><br>"
  1549. + "<span>⑦ 备注:台风登陆期间不用填报。</span>");
  1550. $("#changerequire")
  1551. .append("<span>填写说明:</span><br>"
  1552. +"<span>① 单位名称:受灾地市局。</span><br>"
  1553. + "<span>② 抢修人员:填写当日投入抢修人数的最大值。</span><br>"
  1554. + "<span>③ 抢修车辆:填写当日投入抢修车辆数的最大值。</span><br>"
  1555. + "<span>④ 应急发电车:填写当日投入应急发电车数量的最大值。</span><br>"
  1556. + "<span>⑤ 应急发电机:填写当日投入应急发电机数量的最大值。</span><br>"
  1557. + "<span>⑥ 备注:台风登陆期间不用填报。</span>");
  1558. }
  1559. if (roleId == "R002105430211") {
  1560. $("#requires")
  1561. .append("<span>填写说明:</span><br>"
  1562. +"<span>① 单位:受灾地市局。</span><br>"
  1563. + "<span>② 备注:台风登陆期间不用填报。</span><br>"
  1564. );
  1565. $("#changerequire")
  1566. .append("<span>填写说明:</span><br>"
  1567. +"<span>① 单位:受灾地市局</span><br>"
  1568. + "<span>② 线路受损:按单相导路(地线)受损长度统计,统计距离为断线或者整条线路损毁时的档距。</span><br>"
  1569. + "<span>③ 线路未恢复:截至当前仍未修复的受损线路长度。</span><br>"
  1570. + "<span>④ 配变受损:发生损害需要修复或更换的配变台数。</span><br>"
  1571. + "<span>⑤ 配变未恢复:截至当前仍未修复或更换的配变台数。</span><br>"
  1572. + "<span>⑥ 备注:台风登陆期间不用填报。</span>");
  1573. }
  1574. if (roleId == "R002105430212") {
  1575. $("#requires")
  1576. .append("<span>填写说明:</span><br>"
  1577. +"<span>① 单位:受灾地市局。</span><br>"
  1578. + "<span>② 台区:一个配变所供负荷区域计作一个台区。</span><br>"
  1579. + "<span>③ 用户数:1)线路重复跳闸时客户停电户数不累加统计,即线路重复跳闸时,停电户数只统计一次。2)线路跳闸重合成功的客户数不统计。</span><br>"
  1580. + "<span>④ 未恢复数:因灾发生停电的用户截至当前还未恢复供电的用户数。</span><br>"
  1581. + "<span>⑤停电占比:停电占比=停电台区(用户)数÷当地台区(用户)总数。</span><br>"
  1582. + "<span>⑥损失电量:灾害期间损失电量的总数。</span>");
  1583. $("#changerequire")
  1584. .append("<span>填写说明:</span><br>"
  1585. +"<span>① 单位:受灾地市局。</span><br>"
  1586. + "<span>② 累计全停:灾害发生以来发生全县(区)、全乡镇、全行政村全停的个数。</span><br>"
  1587. + "<span>③ 当前全停:当前仍存在全县(区)、全乡镇、全行政村全停的个数。</span><br>"
  1588. + "<span>④ 备注:台风登陆期间不用填报。</span>");
  1589. }
  1590. }
  1591. // 根据用户角色登录,返回report_type 的默认值
  1592. function getType(id) {
  1593. if (id == "R002105430210") {
  1594. report_type = "1";
  1595. } else if (id == "R002105430213") {
  1596. report_type = "7";
  1597. } else if (id == "R002105430211") {
  1598. report_type = "3";
  1599. } else if (id == "R002105430212") {
  1600. report_type = "5";
  1601. } else if (id == "R002105430200") {
  1602. report_type = "1";
  1603. } else if (id == "R002105430222") {
  1604. report_type = "100";
  1605. }
  1606. return report_type;
  1607. }
  1608. //通过预警或响应编号来显示报表计划要求
  1609. function getPlan() {
  1610. g.endEdit();
  1611. $("#sysDept").html("");
  1612. $("#equipmentDept").html("");
  1613. $("#markingDept").html("");
  1614. $("#safeyDept").html("");
  1615. $("#showTables").html("");
  1616. $("#deptRole").text("");
  1617. $("#star_time").html("");
  1618. $("#end_time").html("");
  1619. $("#type").html("");
  1620. $("#round").html("");
  1621. $("#temporary").html("");
  1622. var val = $("#warning").val();
  1623. if (val) {
  1624. getPlanContent(val);
  1625. } else {
  1626. $("#showplan").hide();
  1627. $("#showRequire").hide();
  1628. $("#showRequire").find("a").html("隐藏报表填报要求");
  1629. $(parent.document.body).find("#frmright").height(wh);
  1630. }
  1631. }
  1632. function getPlanRequires(value) {
  1633. require = "";
  1634. $.ajax({
  1635. url : $.pathname()
  1636. + '/ws/getPlanRequires/getPlanRequireService/getReportPlanRequire/',
  1637. type : 'post',
  1638. timeout : 300000,
  1639. async : false,
  1640. data : {
  1641. comp : corpId,
  1642. warning_number : value
  1643. },
  1644. dataType : 'json',
  1645. success : function(data) {
  1646. require = data;
  1647. },
  1648. error : function(e) {
  1649. $.messager.alert('查询报表计划失败!', '访问服务失败!', 'error');
  1650. }
  1651. });
  1652. return require;
  1653. }
  1654. function showTable() {
  1655. $("#showplan").toggle();
  1656. var show = $("#showplan").css("display");
  1657. if (show == "none") {
  1658. $("#showRequire").find("a").html("显示报表填报要求");
  1659. } else {
  1660. $("#showRequire").find("a").html("隐藏报表填报要求");
  1661. }
  1662. }
  1663. /**
  1664. * 统计表汇总下级数据----非班组部门且有下级填报单位
  1665. */
  1666. function total() {
  1667. $("#hzxjsj").parent().siblings().removeClass("backcolor");
  1668. $("#hzxjsj").parent().addClass("backcolor");
  1669. checkInterface = false;
  1670. var value = $("#sel").val();//报表类型
  1671. if (num % 2 != 0) {
  1672. flag = false;
  1673. $("#handlerinfo").text("开启填写明细");
  1674. num = 2;
  1675. }
  1676. g.endEdit();
  1677. var json = JSON.stringify(g.getData());
  1678. $("body").eq(0).showLoading();
  1679. // var urls = $.pathname()+"/ws/xianlutingyun/XianlutingyunService/getChildHzReport";
  1680. var urls = $.pathname()+"/ws/baoBiao/BaoBiaoService/getChildHzReport";
  1681. $.ajax({
  1682. url : urls,
  1683. type : 'post',
  1684. timeout : 300000,
  1685. /* async : false, */
  1686. data : {
  1687. comp_id : compId,//非班组且有下级单位
  1688. comp_name : corpName,
  1689. report_type : value,
  1690. roleId : role_id,
  1691. affair : affair,
  1692. flag : deptFlag,
  1693. json : json
  1694. },
  1695. dataType : 'json',
  1696. success : function(data) {
  1697. g.options.data = data;
  1698. g.loadData();
  1699. setHight();
  1700. $("body").eq(0).hideLoading();
  1701. },
  1702. error : function(e) {
  1703. $.messager.alert('汇总下级数据失败!', '访问服务失败!', 'error');
  1704. }
  1705. });
  1706. }
  1707. /**
  1708. * 明细汇总下级数据
  1709. */
  1710. function getXqtotal(){
  1711. $("#hzxjsj_xq").parent().siblings().removeClass("backcolor");
  1712. $("#hzxjsj_xq").parent().addClass("backcolor");
  1713. //报表类型
  1714. var value = $("#sel").val();
  1715. $("body").eq(0).showLoading();
  1716. var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getChildHzXqData";
  1717. $.ajax({
  1718. url : urls,
  1719. type : 'post',
  1720. timeout : 300000,
  1721. async : false,
  1722. data : {
  1723. comp_id : compId,
  1724. comp_name : corpName,
  1725. report_type : value,
  1726. roleId : role_id,
  1727. affair : affair
  1728. },
  1729. dataType : 'json',
  1730. success : function(data) {
  1731. xqData = data;
  1732. setHight();
  1733. $("body").eq(0).hideLoading();
  1734. },
  1735. error : function(e) {
  1736. $.messager.alert('导入上次报表失败!', '访问服务失败!', 'error');
  1737. }
  1738. });
  1739. }
  1740. var num = 2;
  1741. /**
  1742. * 填写明细
  1743. */
  1744. function beginWrite() {
  1745. var reportVal = $("#sel").val();
  1746. if (reportVal == "1" || reportVal == "2" || reportVal == "3"
  1747. || reportVal == "5" || reportVal == "8" || reportVal == "4"
  1748. || reportVal == "101") {
  1749. if (num % 2 == 0) {
  1750. $("#handlerinfo").parent().addClass("backcolor");
  1751. $("#handlerinfo").parent().siblings().removeClass("backcolor");
  1752. $("#handlerinfo").text("关闭填写明细");
  1753. $("#handlerinfo").parent().attr("title", "关闭填报报表明细填写情况");
  1754. flag = true;
  1755. } else {
  1756. $("#handlerinfo").parent().removeClass("backcolor");
  1757. $("#handlerinfo").parent().attr("title", "开启填报报表明细填写情况");
  1758. $("#handlerinfo").text("开启填写明细");
  1759. flag = false;
  1760. }
  1761. num++;
  1762. } else {
  1763. top.Dialog.alert("此表没有明细填写");
  1764. flag = false;
  1765. num = 2;
  1766. }
  1767. };
  1768. // 更多 多选查询卡
  1769. function more() {
  1770. $('#moretable').toggle();
  1771. }
  1772. /** 绑定更多的按钮点击事件 */
  1773. $more = $("#more"); // 更多按钮
  1774. $more.bind('click', function() {
  1775. more();
  1776. });
  1777. /**
  1778. * 根据报表类型显示填写说明
  1779. * @param value 报表类型
  1780. */
  1781. function changeRequireByVal(value) {
  1782. if (value == "1") {
  1783. $("#requires").show();
  1784. $("#changerequire").hide();
  1785. } else if (value == "2" || value == "101") {
  1786. $("#requires").hide();
  1787. $("#changerequire").show();
  1788. }
  1789. else if (value == "3") {
  1790. $("#changerequire").hide();
  1791. $("#requires").show();
  1792. } else if (value == "4") {
  1793. $("#requires").hide();
  1794. $("#changerequire").show();
  1795. } else if (value == "5") {
  1796. $("#changerequire").hide();
  1797. $("#requires").show();
  1798. } else if (value == "6") {
  1799. $("#requires").hide();
  1800. $("#changerequire").show();
  1801. } else if (value == "7") {
  1802. $("#changerequire").hide();
  1803. $("#requires").show();
  1804. } else if (value == "8") {
  1805. $("#requires").hide();
  1806. $("#changerequire").show();
  1807. } else {
  1808. $("#requires").hide();
  1809. $("#changerequire").hide();
  1810. }
  1811. }
  1812. /**
  1813. * 加载表格数据
  1814. * @param url
  1815. * @param data
  1816. * @param type 预警发布与响应启动情况表
  1817. */
  1818. function initGrid(url, data, type) {
  1819. g = null;
  1820. g = $("#maingrids").quiGrid({
  1821. url : url,
  1822. params : {
  1823. comp_id : corpId,
  1824. affair : affair
  1825. },
  1826. usePager : false,
  1827. fixedCellHeight : false,
  1828. columns : mycol,
  1829. data : data,
  1830. /* height:"90%", */
  1831. headerRowHeight : 38,
  1832. rowHeight : 38,
  1833. width : '100%',
  1834. rownumbers : true,
  1835. percentWidthMode : true,
  1836. enabledEdit : true,
  1837. clickToEdit : false,
  1838. onAfterSubmitEdit : onAfterSubmitEdit,
  1839. onAfterEdit : onAfterEdit,
  1840. onBeforeSubmitEdit : onBeforeSubmitEdit,
  1841. onAfterShowData : function() {
  1842. setHight();
  1843. $("body").eq(0).hideLoading();
  1844. },
  1845. toolbar : {
  1846. items : [ {
  1847. text : '新增',
  1848. click : addUser,
  1849. iconClass : 'add1_tem'
  1850. }, {
  1851. line : true
  1852. },{
  1853. text : '导出',
  1854. click : export_report,
  1855. iconClass : 'export_tem',
  1856. id : "export_report"
  1857. }, {
  1858. line : true
  1859. }
  1860. ]
  1861. }
  1862. });
  1863. if ($("#maingridsgrid").height() < 500) {
  1864. g.setOptions({
  1865. height : "500px"
  1866. });
  1867. g.resetHeight();
  1868. } else {
  1869. g.setOptions({
  1870. height : "auto"
  1871. });
  1872. g.resetHeight();
  1873. }
  1874. $(".l-grid-hd-cell-text").css("color", "white");
  1875. }
  1876. // 类型为7的检测
  1877. function onBeforeSubmitEdit(e) {
  1878. if (isValida) {
  1879. if (e.newdata.ORG_END_TIME != "") {
  1880. var endTime = e.newdata.ORG_END_TIME.replace(new RegExp("-", "gm"),
  1881. "/");
  1882. var startTime = e.newdata.ORG_START_TIME.replace(new RegExp("-",
  1883. "gm"), "/");
  1884. if (new Date(startTime).getTime() > new Date(endTime).getTime()) {
  1885. top.Dialog.alert("本单位开始时间不能早于本单位的结束时间");
  1886. return false;
  1887. }
  1888. }
  1889. if (e.newdata.GOVE_ORG_END_TIME != "") {
  1890. var endTime = e.newdata.GOVE_ORG_END_TIME.replace(new RegExp("-",
  1891. "gm"), "/");
  1892. var startTime = e.newdata.GOVE_ORG_START_TIME.replace(new RegExp(
  1893. "-", "gm"), "/");
  1894. if (new Date(startTime).getTime() > new Date(endTime).getTime()) {
  1895. top.Dialog.alert("同级政府开始时间不能早于同级政府的结束时间");
  1896. return false;
  1897. }
  1898. }
  1899. }
  1900. isValida = true;
  1901. }
  1902. /**
  1903. * 加载明细表表格数据
  1904. * @param data
  1905. * @param item 明细表工具栏菜单
  1906. * @param type 报表类型
  1907. */
  1908. function initGrid1(data, item, type) {
  1909. g = null;
  1910. g = $("#maingrid2").quiGrid({
  1911. columns : mycol,
  1912. data : data,
  1913. usePager : false,
  1914. fixedCellHeight : false,
  1915. headerRowHeight : 38,
  1916. rowHeight : 38,
  1917. enabledSort : false,
  1918. width : '100%',
  1919. /* height:"90%", */
  1920. rownumbers : true,
  1921. percentWidthMode : true,
  1922. enabledEdit : true,
  1923. clickToEdit : false,
  1924. onAfterSubmitEdit : onAfterSubmitEdit,
  1925. onAfterEdit : onAfterEdit,
  1926. onBeforeSubmitEdit : checkSubmitEdit,
  1927. onAfterShowData : function() {
  1928. // setHight();
  1929. setXqContentHeight();
  1930. $("body").eq(0).hideLoading();
  1931. },
  1932. toolbar : item
  1933. });
  1934. if(rollbackFlag){
  1935. $("#hzxjsj_xq").parent().siblings().removeClass("backcolor");
  1936. $("#hzxjsj_xq").parent().addClass("backcolor");
  1937. }
  1938. if ($("#maingrid2grid").height() < 400) {
  1939. g.setOptions({
  1940. height : "400px"
  1941. });
  1942. g.resetHeight();
  1943. } else {
  1944. g.setOptions({
  1945. height : "auto"
  1946. });
  1947. g.resetHeight();
  1948. }
  1949. $(".l-grid-hd-cell-text").css("color", "white");
  1950. }
  1951. /**
  1952. * 根据报表类型加载明细表的工具栏菜单
  1953. * @param report_type
  1954. * @returns
  1955. */
  1956. function getXqItem(report_type) {
  1957. var item = "";
  1958. if(rollbackFlag){//有下级填报单位
  1959. item = {
  1960. items : [ {
  1961. text : '新增',
  1962. click : addUser,
  1963. iconClass : 'add1_tem',
  1964. id : "add"
  1965. }, {
  1966. line : true
  1967. }, {
  1968. text : '汇总下级数据',
  1969. click : getXqtotal,
  1970. iconClass : 'add1_tem',
  1971. id : "hzxjsj_xq"
  1972. },{
  1973. line : true
  1974. },{
  1975. text : '获取接口数据',
  1976. click : getInterFaceData,
  1977. iconClass : 'import_tem',
  1978. id : "jksj_xq"
  1979. }, {
  1980. line : true
  1981. }, {
  1982. text : '导入',
  1983. click : goImport,
  1984. iconClass : 'import_tem',
  1985. id : "dr"
  1986. }, {
  1987. line : true
  1988. }, {
  1989. text : '导出',
  1990. click : export_report,
  1991. iconClass : 'export_tem',
  1992. id : "export_report"
  1993. }, {
  1994. line : true
  1995. }
  1996. /*
  1997. * { text: '全屏', click: fullScreen2, iconClass:
  1998. * 'import_tem',id:"qp2" }, { line: true }
  1999. */
  2000. ]
  2001. };
  2002. } else {
  2003. item = {
  2004. items : [ {
  2005. text : '新增',
  2006. click : addUser,
  2007. iconClass : 'add1_tem',
  2008. id : "add"
  2009. },{
  2010. line : true
  2011. }, {
  2012. text : '获取接口数据',
  2013. click : getInterFaceData,
  2014. iconClass : 'import_tem',
  2015. id : "jksj_xq"
  2016. }, {
  2017. line : true
  2018. }, {
  2019. text : '导入',
  2020. click : goImport,
  2021. iconClass : 'import_tem',
  2022. id : "dr"
  2023. }, {
  2024. line : true
  2025. },{
  2026. text : '导出',
  2027. click : export_report,
  2028. iconClass : 'export_tem',
  2029. id : "export_report"
  2030. }, {
  2031. line : true
  2032. }
  2033. /*
  2034. * { text: '全屏', click: fullScreen2, iconClass:
  2035. * 'import_tem',id:"qp2" }, { line: true }
  2036. */
  2037. ]
  2038. };
  2039. }
  2040. return item;
  2041. }
  2042. /**
  2043. * 实时编辑表格--删除
  2044. * @param rowidx
  2045. * @returns
  2046. */
  2047. function onDelete(rowidx) {
  2048. if (flag1 == true) {
  2049. top.Dialog.alert("请先完成当前记录的编辑!");
  2050. return false;
  2051. }
  2052. top.Dialog.confirm("确定要删除该记录吗?", function() {
  2053. isValida = false;
  2054. flag1 = false;
  2055. g.endEdit(rowidx);
  2056. // 删除记录
  2057. if (rowidx == 0) {
  2058. checkRowObj = false;
  2059. }
  2060. var row = g.getRow(rowidx);
  2061. g.deleteRow(row);
  2062. });
  2063. }
  2064. /**
  2065. * 实时编辑表格--编辑
  2066. * @param rowid
  2067. */
  2068. function beginEdit(rowid) {
  2069. if (flag1) {
  2070. top.Dialog.alert("请先完成正在编辑的一行!");
  2071. return;
  2072. } else {
  2073. g.beginEdit(rowid);
  2074. }
  2075. }
  2076. /**
  2077. * 实时编辑表格--取消
  2078. * @param rowid
  2079. */
  2080. function cancelEdit(rowid) {
  2081. flag1 = false;
  2082. g.cancelEdit(rowid);
  2083. }
  2084. //判断是否存在空行数据
  2085. var checkRowObj = false;
  2086. /**
  2087. * 实时编辑表格--结束编辑
  2088. * @param rowid
  2089. */
  2090. function endEdits(rowid) {
  2091. //正在编辑的行
  2092. var textInput = $(".l-grid-body-table").find("input[type='text']");
  2093. var checkNum = 0;
  2094. var len = textInput.length;
  2095. for (var i = 0; i < len; i++) {
  2096. if (textInput.eq(i).val() == "" || textInput.eq(i).val() == "请选择") {
  2097. checkNum++;
  2098. }
  2099. }
  2100. if (checkNum == len) {
  2101. if (rowid > 0) {
  2102. top.Dialog.confirm("不在首行的数据如果为空将会被删除,是否执行?", function() {
  2103. g.endEdit(rowid);
  2104. var rowObj = g.getRow(rowid);
  2105. g.deleteRow(rowObj);
  2106. });
  2107. }
  2108. if (rowid == 0) {
  2109. checkRowObj = true;
  2110. g.endEdit(rowid);
  2111. }
  2112. } else if (len > checkNum) {
  2113. checkRowObj = false;
  2114. g.endEdit(rowid);
  2115. }
  2116. }
  2117. function showOrgSelect(item) {
  2118. for (var i = 0; i < data11["list"].length; i++) {
  2119. if (data11["list"][i]['value'] == item.ORG_GRADE)
  2120. return data11["list"][i]['key'];
  2121. }
  2122. return item.ORG_GRADE;
  2123. }
  2124. function showGovSelect(item) {
  2125. for (var i = 0; i < data11["list"].length; i++) {
  2126. if (data11["list"][i]['value'] == item.GOV_ORG_GRADE)
  2127. return data11["list"][i]['key'];
  2128. }
  2129. return item.GOV_ORG_GRADE;
  2130. }
  2131. var num2 = 0;
  2132. /**
  2133. * 实时编辑表格--新增
  2134. * @returns
  2135. */
  2136. function addUser() {
  2137. if (flag1) {
  2138. top.Dialog.alert("请先完成当前记录的编辑!");
  2139. return false;
  2140. }
  2141. var typeValue = $("#sel").val();
  2142. // 新增前判断首行是否为空
  2143. if (typeValue != '7') {
  2144. var textInput = $("#maingrid2").find(".l-grid2").find(".l-grid-body-inner").find("tbody").find("tr");
  2145. if (textInput.eq(0).text().trim() == "修改删除") {
  2146. checkRowObj = true;
  2147. }
  2148. }
  2149. //checkRowObj 判断首行是否有空数据
  2150. if (checkRowObj) {
  2151. top.Dialog.alert("首行数据为空,不能继续添加");
  2152. return false;
  2153. }
  2154. editingRow = 0;
  2155. isNew = true;
  2156. var row = g.getRow(0);
  2157. var rowData = {
  2158. duty_way : 0,
  2159. COMP_ID : corpId,
  2160. COMP_NAME : deptFlag=="false"?corpShortName:deptName
  2161. };
  2162. g.addEditRow(rowData, row, true);
  2163. num2++;
  2164. if ($("#maingridsgrid").height() < 400) {
  2165. g.setOptions({
  2166. height : "400px"
  2167. });
  2168. g.resetHeight();
  2169. } else {
  2170. g.setOptions({
  2171. height : "auto"
  2172. });
  2173. g.resetHeight();
  2174. }
  2175. setHight();
  2176. }
  2177. // 编辑后事件
  2178. function onAfterSubmitEdit(e) {
  2179. isNew = false;
  2180. }
  2181. function zhiyin() {
  2182. window.open("/nwyj/page/business/em/report/baobiaozy.html");
  2183. }
  2184. function print() {
  2185. var type = $("#sel").val();
  2186. if (maintableType == "1") {
  2187. if (type == "7") {
  2188. $("#maingrids").jqprint();
  2189. } else {
  2190. $("#maingrid2").jqprint();
  2191. }
  2192. } else {
  2193. $("#maingrid").jqprint();
  2194. }
  2195. }
  2196. function _addStatus(rowdata, rowindex, value, column) {
  2197. if (value == '总计') {
  2198. return "<div style='background-color: #f2f2f2'>" + value + "</div>";
  2199. } else {
  2200. return "<div style='background-color: #dde5f0' class='company' title='"
  2201. + value + "'>" + value + "</div>";
  2202. }/*else{
  2203. return "<div style='background-color: #dde5f0' class='company' title='"
  2204. + value + "'><a href='javascript:void(0)'>" + value + "</a></div>";
  2205. }*/
  2206. }
  2207. // 能获取接口数据的数组
  2208. var typeArr = [ "1", "2", "101", "4", "5", "3" ];
  2209. var checkInterface = false;
  2210. function getInterFaceData() {
  2211. $("#jksj").parent().siblings().removeClass("backcolor");
  2212. $("#jksj").parent().addClass("backcolor");
  2213. $("#jksj_xq").parent().siblings().removeClass("backcolor");
  2214. $("#jksj_xq").parent().addClass("backcolor");
  2215. if (num % 2 != 0) {
  2216. flag = false;
  2217. $("#handlerinfo").html("开启填写明细");
  2218. num = 2;
  2219. }
  2220. if (flag1) {
  2221. top.Dialog.alert("请完成编辑再获取!");
  2222. return false;
  2223. }
  2224. g.endEdit();
  2225. var value = $("#sel").val();
  2226. if ($.inArray(value, typeArr) > -1) {
  2227. /*
  2228. * if(value=="14"){ if(flag1){ top.Dialog.alert("请编辑完再获取"); return
  2229. * false; } }
  2230. */
  2231. $("body").eq(0).showLoading();
  2232. var faceparams = "";
  2233. if (maintableType == "1") {
  2234. faceparams = {
  2235. report_type : value,
  2236. roleId : role_id,
  2237. corpId : compId,
  2238. type : "xq"
  2239. };
  2240. } else {
  2241. faceparams = {
  2242. report_type : value,
  2243. roleId : role_id,
  2244. corpId : compId,
  2245. type : "tj"
  2246. };
  2247. }
  2248. var urls = "";
  2249. if (value == '5') {
  2250. $("#jksj").parent().addClass("backcolor");
  2251. checkInterface = true;
  2252. beginWrite();
  2253. urls = $.pathname()
  2254. + "/ws/xianlutingyun/XianlutingyunService/getInterfaceData";
  2255. }
  2256. // else{
  2257. // urls = $.pathname() +
  2258. // "/ws/xianlutingyun/XianlutingyunService/getNewInterFaceData";
  2259. // }
  2260. if (value == '1') {
  2261. urls = $.pathname()
  2262. + "/ws/xianlutingyun/XianlutingyunService/getNewInterFaceData";
  2263. beginWrite();
  2264. $("#jksj").parent().addClass("backcolor");
  2265. checkInterface = true;
  2266. }
  2267. if (value == '2' || value == "101") {
  2268. faceparams["deptLevel"] = deptLevel;
  2269. urls = $.pathname()
  2270. + "/ws/xianlutingyun/XianlutingyunService/getBDZData";
  2271. beginWrite();
  2272. $("#jksj").parent().addClass("backcolor");
  2273. checkInterface = true;
  2274. }
  2275. if (value == '3' || value == '4') {
  2276. urls = $.pathname()
  2277. + "/ws/xianlutingyun/XianlutingyunService/getInterDG";
  2278. beginWrite();
  2279. $("#jksj").parent().addClass("backcolor");
  2280. checkInterface = true;
  2281. }
  2282. $.ajax({
  2283. url : urls,
  2284. type : 'post',
  2285. timeout : 300000,
  2286. data : faceparams,
  2287. dataType : 'json',
  2288. /* async:false, */
  2289. success : function(data) {
  2290. $("body").eq(0).hideLoading();
  2291. if (data["rows"].length > 0) {
  2292. g.options.data = data;
  2293. g.loadData();
  2294. } else {
  2295. top.Dialog.alert("目前暂无数据");
  2296. }
  2297. setHight();
  2298. },
  2299. error : function(e) {
  2300. $.messager.alert('导入上次报表失败!', '访问服务失败!', 'error');
  2301. }
  2302. });
  2303. } else {
  2304. top.Dialog.alert("该表的接口暂未开通");
  2305. }
  2306. }
  2307. /**
  2308. * 根据报表类型获取统计表工具栏菜单
  2309. * @param type 报表类型
  2310. * @returns
  2311. */
  2312. function getItem(type) {
  2313. var item = "";
  2314. if (rollbackFlag && role_id == "R002105430213") {
  2315. item = [ {
  2316. text : '开启填写明细',
  2317. click : beginWrite,
  2318. iconClass : 'add1_tem',
  2319. id : "handlerinfo"
  2320. }, {
  2321. line : true
  2322. }, /*{
  2323. text : '导入上次数据',
  2324. click : import_report,
  2325. iconClass : 'import_tem',
  2326. id : "drscsj"
  2327. }, {
  2328. line : true
  2329. }, */{
  2330. text : '汇总下级数据',
  2331. click : total,
  2332. iconClass : 'add1_tem',
  2333. id : "hzxjsj"
  2334. }, {
  2335. line : true
  2336. }, {
  2337. text : '导入',
  2338. click : goImport,
  2339. iconClass : 'import_tem',
  2340. id : "dr"
  2341. }, {
  2342. line : true
  2343. }, /*{
  2344. text : '自动补齐数据',
  2345. title : "单元格获取上次数据关闭",
  2346. iconClass : 'import_tem',
  2347. id : "lock"
  2348. }, {
  2349. line : true
  2350. },*/ {
  2351. text : '导出',
  2352. click : export_report,
  2353. iconClass : 'export_tem',
  2354. id : "export_report"
  2355. }, {
  2356. line : true
  2357. }
  2358. ];
  2359. }
  2360. else if (rollbackFlag && (role_id == "R002105430210" || role_id == "R002105430211")) {
  2361. if (role_id == "R002105430210" && deptLevel == "4") {
  2362. item = [ {
  2363. text : '开启填写明细',
  2364. click : beginWrite,
  2365. iconClass : 'add1_tem',
  2366. id : "handlerinfo"
  2367. }, {
  2368. line : true
  2369. }, /*{
  2370. text : '导入上次数据',
  2371. click : import_report,
  2372. iconClass : 'import_tem',
  2373. id : "drscsj"
  2374. }, {
  2375. line : true
  2376. }, */{
  2377. text : '导入',
  2378. click : goImport,
  2379. iconClass : 'import_tem',
  2380. id : "dr"
  2381. }, {
  2382. line : true
  2383. }, /*{
  2384. text : '自动补齐数据',
  2385. title : "单元格获取上次数据关闭",
  2386. iconClass : 'import_tem',
  2387. id : "lock"
  2388. }, {
  2389. line : true
  2390. },*/{
  2391. text : '导出',
  2392. iconClass : 'export_tem',
  2393. id : "export_report"
  2394. }, {
  2395. line : true
  2396. }
  2397. ];
  2398. } else {
  2399. item = [ {
  2400. text : '开启填写明细',
  2401. click : beginWrite,
  2402. iconClass : 'add1_tem',
  2403. id : "handlerinfo"
  2404. }, {
  2405. line : true
  2406. }, /*{
  2407. text : '导入上次数据',
  2408. click : import_report,
  2409. iconClass : 'import_tem',
  2410. id : "drscsj"
  2411. }, {
  2412. line : true
  2413. },*/ {
  2414. text : '汇总下级数据',
  2415. click : total,
  2416. iconClass : 'add1_tem',
  2417. id : "hzxjsj"
  2418. }, {
  2419. line : true
  2420. }, {
  2421. text : '获取接口数据',
  2422. click : getInterFaceData,
  2423. iconClass : 'add1_tem',
  2424. id : "jksj"
  2425. }, {
  2426. line : true
  2427. }, {
  2428. text : '导入',
  2429. click : goImport,
  2430. iconClass : 'import_tem',
  2431. id : "dr"
  2432. }, {
  2433. line : true
  2434. }, /*{
  2435. text : '自动补齐数据',
  2436. title : "单元格获取上次数据关闭",
  2437. iconClass : 'import_tem',
  2438. id : "lock"
  2439. }, {
  2440. line : true
  2441. },*/ {
  2442. text : '导出',
  2443. click : export_report,
  2444. iconClass : 'export_tem',
  2445. id : "export_report"
  2446. }, {
  2447. line : true
  2448. }
  2449. ];
  2450. }
  2451. } else if (rollbackFlag && role_id == "R002105430212") {
  2452. item = [ {
  2453. text : '开启填写明细',
  2454. click : beginWrite,
  2455. iconClass : 'add1_tem',
  2456. id : "handlerinfo"
  2457. }, {
  2458. line : true
  2459. }, /*{
  2460. text : '导入上次数据',
  2461. click : import_report,
  2462. iconClass : 'import_tem',
  2463. id : "drscsj"
  2464. }, {
  2465. line : true
  2466. },*/ {
  2467. text : '汇总下级数据',
  2468. click : total,
  2469. iconClass : 'add1_tem',
  2470. id : "hzxjsj"
  2471. }, {
  2472. line : true
  2473. }, {
  2474. text : '获取接口数据',
  2475. click : getInterFaceData,
  2476. iconClass : 'add1_tem',
  2477. id : "jksj"
  2478. }, {
  2479. line : true
  2480. }, {
  2481. text : '导入',
  2482. click : goImport,
  2483. iconClass : 'import_tem',
  2484. id : "dr"
  2485. }, {
  2486. line : true
  2487. }, /*{
  2488. text : '自动补齐数据',
  2489. title : "单元格获取上次数据关闭",
  2490. iconClass : 'import_tem',
  2491. id : "lock"
  2492. }, {
  2493. line : true
  2494. },*/ {
  2495. text : '导出',
  2496. click : export_report,
  2497. iconClass : 'export_tem',
  2498. id : "export_report"
  2499. }, {
  2500. line : true
  2501. }
  2502. ];
  2503. }
  2504. else {
  2505. item = [ {
  2506. text : '开启填写明细',
  2507. click : beginWrite,
  2508. iconClass : 'add1_tem',
  2509. id : "handlerinfo"
  2510. }, {
  2511. line : true
  2512. }, /*{
  2513. text : '导入上次数据',
  2514. click : import_report,
  2515. iconClass : 'import_tem',
  2516. id : "drscsj"
  2517. }, {
  2518. line : true
  2519. },*/ {
  2520. text : '导入',
  2521. click : goImport,
  2522. iconClass : 'import_tem',
  2523. id : "dr"
  2524. }, {
  2525. line : true
  2526. }, /*{
  2527. text : '自动补齐数据',
  2528. title : "单元格获取上次数据关闭",
  2529. iconClass : 'import_tem',
  2530. id : "lock"
  2531. }, {
  2532. line : true
  2533. },*/ {
  2534. text : '导出',
  2535. click : export_report,
  2536. iconClass : 'export_tem',
  2537. id : "export_report"
  2538. }, {
  2539. line : true
  2540. }
  2541. ];
  2542. }
  2543. if (type == "8") {
  2544. var tool1 = {
  2545. text : '查看下级单位数据',
  2546. click : getCompData,
  2547. iconClass : 'view_tem',
  2548. id : "corpData"
  2549. };
  2550. var tool2 = {
  2551. line : true
  2552. };
  2553. item.push(tool1, tool2);
  2554. }
  2555. return item;
  2556. };
  2557. /**
  2558. * 导入按钮
  2559. */
  2560. function goImport() {
  2561. var sel = $("#sel").val();
  2562. if (sel == "100") {
  2563. top.Dialog.alert("此表暂不支持导入功能");
  2564. return;
  2565. }
  2566. flag = false;
  2567. var iframe = parent.document.getElementsByName("frmright")[0];
  2568. iframe.src = "/nwyj/page/business/em/report/Import_Report.html?role_id="
  2569. + role_id + "?report_type=" + $("#sel").val() + "?value="
  2570. + affair+ "?affairType="+affairType;
  2571. }
  2572. /**
  2573. * 导出
  2574. */
  2575. function export_report(){
  2576. if(flag1){
  2577. top.Dialog.alert("请编辑完再操作");
  2578. return;
  2579. }
  2580. var data = g.getData();
  2581. var condition = {
  2582. "report_type":$("#sel").val(),
  2583. "json":JSON.stringify(data),
  2584. "flag":"huizong",
  2585. "id":corpId
  2586. };
  2587. excelExport("",condition,"导出"+corpName+mycol1,filterNoUseColumn(),corpName+mycol1,'report');
  2588. }
  2589. /**
  2590. * 过滤不可用的字段
  2591. */
  2592. function filterNoUseColumn(){
  2593. var noUseColumns = "";
  2594. var url = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/filterNoUseColumn";
  2595. var params = {
  2596. "affair" : affair,
  2597. "report_type" : report_type,
  2598. "comp_id" : corpId
  2599. };
  2600. $.ajax({
  2601. url : url,
  2602. type : "post",
  2603. data : params,
  2604. dataType : "text",
  2605. async : false,
  2606. success : function(data){
  2607. noUseColumns = data;
  2608. },
  2609. error : function(){
  2610. $.messager.alert('过滤不可用字段失败!', '访问服务失败!', 'error');
  2611. }
  2612. });
  2613. return noUseColumns;
  2614. }
  2615. /**
  2616. * 保存数据
  2617. * @param type
  2618. * @param json 数据源
  2619. */
  2620. function saveTable(type, json) {
  2621. var textMsg = "";
  2622. var times = "";
  2623. var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/create";
  2624. var value = $("#sel").val();
  2625. if (value == "8" && (deptLevel==3 || deptLevel==4)) {
  2626. var areaFlag = $("#areaSel").val();
  2627. if (areaFlag == "") {
  2628. top.Dialog.alert("请选择区域");
  2629. return;
  2630. }
  2631. }
  2632. //查询当前时间的报表任务
  2633. var planUrl = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getReportPlanTask";
  2634. $.ajax({
  2635. url : planUrl,
  2636. type : "post",
  2637. data : {"report_type":report_type,"affair":affair,"comp_id":compId,"dept_id":deptId,"role_id":role_id,"deptFlag":deptFlag},
  2638. dataType : "json",
  2639. async : false,
  2640. success : function(result){
  2641. if(result.length>0){
  2642. fdIds = "";
  2643. plan_name = "";
  2644. times = "";
  2645. draftWrite = "false";
  2646. for(var i in result){
  2647. var data = result[i];
  2648. fdIds = fdIds.indexOf(data.key)==-1 ? fdIds+data.key+"," : fdIds;
  2649. plan_name = plan_name.indexOf(data.value)==-1 ? plan_name+data.value+"," : plan_name;
  2650. times = times.indexOf(data.time)==-1 ? times+data.time+"," : times;
  2651. }
  2652. fdIds = fdIds.substring(0, fdIds.lastIndexOf(","));
  2653. plan_name = plan_name.substring(0, plan_name.lastIndexOf(","));
  2654. times = times.substring(0, times.lastIndexOf(","));
  2655. console.log("新增当前任务id:"+fdIds+";当前任务名称:"+plan_name+";当前填报时间:"+times);
  2656. }else{
  2657. draftWrite = "true";//作为草稿,不能上报
  2658. times = report_time==""?"":getServerTime().split(" ")[0]+" "+report_time;
  2659. }
  2660. },
  2661. error : function(){
  2662. $.messager.alert('查询报表任务失败!', '访问服务失败!', 'error');
  2663. }
  2664. });
  2665. var recordParams = "";
  2666. if (value != 8) {
  2667. recordParams = {
  2668. json : json,
  2669. user_id : user_id,
  2670. report_type : value,
  2671. comp_id : corpId,
  2672. name : real_name,
  2673. report_comp : corpName + deptName,
  2674. roleId : role_id,
  2675. affair : affair,
  2676. time : times
  2677. };
  2678. } else {
  2679. recordParams = {
  2680. json : json,
  2681. user_id : user_id,
  2682. report_type : value,
  2683. comp_id : corpId,
  2684. name : real_name,
  2685. report_comp : corpName + deptName,
  2686. roleId : role_id,
  2687. affair : affair,
  2688. time : times,
  2689. flag : $("#areaSel").val()
  2690. };
  2691. }
  2692. if (type == "save") {
  2693. recordParams["operate"] = "新增了";
  2694. recordParams["sendStat"] = "save";
  2695. recordParams["report_id"] = fdIds;
  2696. recordParams["warnText"] = plan_name;
  2697. textMsg = "新增报表";
  2698. } else {
  2699. recordParams["operate"] = "新增并上报了";
  2700. recordParams["sendStat"] = "send";
  2701. textMsg = '新增并上报报表';
  2702. }
  2703. if (type == "save") {
  2704. addRecords(urls, recordParams, textMsg, type, backUrl);
  2705. }
  2706. if (type == "send") {
  2707. if (draftWrite == "true") {
  2708. top.Dialog.alert("现在没有可上报的计划,请先保存");
  2709. return;
  2710. }else {
  2711. recordParams["report_id"] = fdIds;
  2712. recordParams["warnText"] = plan_name;
  2713. }
  2714. if (_thisUrl.indexOf("role_Id=") == -1) {// 返回代办页面
  2715. backUrl = "/nwyj/page/business/em/waitdo/waitDo.html";
  2716. addRecords(urls, recordParams, textMsg, type, backUrl);
  2717. } else {
  2718. addRecords(urls, recordParams, textMsg, type, backUrl);
  2719. }
  2720. }
  2721. }
  2722. /**
  2723. * ********************************全屏代码**************************************************
  2724. */
  2725. /*
  2726. * function fullScreen(){
  2727. * if(undefined==$("#qp").attr("fullState")||0==$("#qp").attr("fullState")){
  2728. *
  2729. * $("#qp").attr("fullState","1").text("退出全屏");
  2730. * $(top.document).find("#frmright").attr("width","100%").css({position:
  2731. * "fixed",top: "0px",left: "0px","z-index": 50}); $("#maingrid").css({position:
  2732. * "fixed",top: "0px", "z-index": 750,height:$(top.document).height()+"px",
  2733. * "overflow-y": "auto","overflow-x": "hidden" }); }else{
  2734. *
  2735. * $("#qp").attr("fullState","0").text("全屏");
  2736. * $(top.document).find("#frmright").attr("width","99%").css({position:
  2737. * "initial"}); $("#maingrid").css({position:
  2738. * "initial",height:"100%","overflow-y": "hidden","overflow-x": "hidden"}); } }
  2739. * function fullScreen2(){
  2740. * if(undefined==$("#qp2").attr("fullState")||0==$("#qp2").attr("fullState")){
  2741. * $("#qp2").attr("fullState","1"); $("#qp2").text("退出全屏");
  2742. * $(top.document).find("#frmright").attr("width","100%").css({position:
  2743. * "fixed",top: "0px",left: "0px","z-index": 50});
  2744. * $("#maingrid2").css({position: "fixed",top: "0px", "z-index":
  2745. * 800,height:$(top.document).height()+"px", "overflow-y": "auto","overflow-x":
  2746. * "hidden" }); }else{ $("#qp2").attr("fullState","0"); $("#qp2").text("全屏");
  2747. * $(top.document).find("#frmright").attr("width","99%").css({position:
  2748. * "initial"}); $("#maingrid2").css({position:
  2749. * "initial",height:"100%","overflow-y": "hidden","overflow-x": "hidden"}); } }
  2750. */
  2751. function checkSubmitEdit(e) {
  2752. if (isValida) {
  2753. var reportType = $("#sel").val();
  2754. if (reportType == "101") {
  2755. reportType = "2";
  2756. }
  2757. if (reportType == "2") {
  2758. if (e.newdata.DYDJ == "") {
  2759. top.Dialog.alert("电压等级不能为空");
  2760. return false;
  2761. }
  2762. if (e.newdata.BDZMC == ""
  2763. || validateInput(e.newdata.BDZMC, "^[\" \"]+$")) {
  2764. top.Dialog.alert("变电站名称不能为空");
  2765. return false;
  2766. }
  2767. if (e.newdata.SFYHF == "") {
  2768. top.Dialog.alert("是否已恢复不能为空");
  2769. return false;
  2770. }
  2771. if (e.newdata.SFYHF != "") {
  2772. if (e.newdata.SFYHF == "是") {
  2773. if (e.newdata.HFSJ == ""
  2774. || validateInput(e.newdata.HFSJ, "^[\" \"]+$")) {
  2775. top.Dialog.alert("是否已恢复为是,请输入恢复时间");
  2776. return false;
  2777. }
  2778. }
  2779. }
  2780. if (e.newdata.TYSJ == ""
  2781. || validateInput(e.newdata.TYSJ, "^[\" \"]+$")) {
  2782. top.Dialog.alert("停运时间不能为空");
  2783. return false;
  2784. }
  2785. if (e.newdata.HFSJ != "") {
  2786. var endTime = e.newdata.HFSJ
  2787. .replace(new RegExp("-", "gm"), "/");
  2788. var startTime = e.newdata.TYSJ.replace(new RegExp("-", "gm"),
  2789. "/");
  2790. if (new Date(startTime).getTime() > new Date(endTime).getTime()) {
  2791. top.Dialog.alert("停运时间不能早于恢复时间");
  2792. return false;
  2793. }
  2794. }
  2795. }
  2796. }
  2797. isValida = true;
  2798. }
  2799. /**
  2800. * 表格切换
  2801. * @param typeVal
  2802. */
  2803. function changeTable(typeVal) {
  2804. var tableType = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/getCheckType", {
  2805. report_type : typeVal
  2806. }, 'text');
  2807. maintableType = tableType;
  2808. //初始化
  2809. rollbackFlag = false;
  2810. //班组部门没有下级填报单位
  2811. if("0"==maintableType && "false"==deptFlag){
  2812. //用于判断本单位是否有下级填报单位,有下级填报单位时为true
  2813. hasSubUnit = getThing($.pathname() + "/ws/xianlutingyun/XianlutingyunService/checkSubUnit", {
  2814. "comp_id" : compId,
  2815. "role_id" : role_id,
  2816. "report_type" : report_type,
  2817. "affair" : affair
  2818. }, "text");
  2819. if(hasSubUnit == "true"){
  2820. rollbackFlag = true;
  2821. }
  2822. }
  2823. //贵州版本任务只下发到县区,下级的供电所作为县区的部门。县区那层级不需要代填
  2824. if(parseInt(deptLevel)>3){
  2825. rollbackFlag = false;
  2826. }
  2827. //加载填写说明
  2828. getRequire(role_id);
  2829. //填写说明
  2830. changeRequireByVal(typeVal);
  2831. getColumns(typeVal);
  2832. excType = typeVal;
  2833. //根据事件类型和报表类型查询报表计划
  2834. getReportPlan();
  2835. $("#add").text("新增" + corpName + mycol1);
  2836. $("#affair").text(affairType);
  2837. getReportPlanInfo();
  2838. if (tableType == "1") {
  2839. $("#maingrid").hide();
  2840. $("#maingrid2").hide();
  2841. $("#maingrids").hide();
  2842. $("#yjzy").hide();
  2843. if (typeVal == "7") {
  2844. $("#maingrids").show();
  2845. initGrid(urls1);
  2846. } else {
  2847. $("#maingrid2").show();
  2848. var item = getXqItem(typeVal);
  2849. //明细表汇总
  2850. // checkXqHuiZong(rollbackFlag);
  2851. getXqtotal();
  2852. initGrid1(xqData, item);
  2853. }
  2854. } else {
  2855. //应急资源表跨区域显示
  2856. getAreaData(deptLevel);
  2857. var item = getItem(typeVal);
  2858. $("#maingrid").show();
  2859. $("#maingrids").hide();
  2860. $("#maingrid2").hide();
  2861. getRows(typeVal,affair);
  2862. init(testData, item, typeVal);
  2863. checkHuiZong(rollbackFlag);
  2864. }
  2865. $("body").eq(0).hideLoading();
  2866. num2 = 0;
  2867. if (num % 2 != 0) {
  2868. $("#handlerinfo").text("开启填写明细");
  2869. $("#handlerinfo").parent().removeClass("backcolor");
  2870. num = 2;
  2871. }
  2872. $(".l-grid-body2").css({
  2873. "overflow" : "scroll"
  2874. });
  2875. }
  2876. /**
  2877. * 应急资源表查看下级单位数据按钮
  2878. */
  2879. function getCompData() {
  2880. window.open("/nwyj/page/business/em/report/CompData.html?deptLevel="
  2881. + deptLevel + "&roleId=" + role_id + "&corpId=" + corpId
  2882. + "&compName=" + corpName + "&affair="+affair);
  2883. }
  2884. /**
  2885. * 统计表判断是否要汇总下级数据
  2886. */
  2887. function checkHuiZong(flag) {
  2888. if (flag || report_type=='8') {
  2889. total();
  2890. }
  2891. }
  2892. /**
  2893. * 明细表判断是否要汇总下级数据
  2894. */
  2895. function checkXqHuiZong(flag) {
  2896. if (flag) {
  2897. getXqtotal();
  2898. }else{
  2899. xqData = {"rows" : [{"FD_OBJECTID":"","COMP_ID":corpId,"COMP_NAME":deptFlag=="false"?corpShortName:deptName}]};
  2900. }
  2901. }
  2902. /**
  2903. * 统计表设置高度
  2904. * @param type
  2905. */
  2906. function setTjContentHeight(type){
  2907. if(type != "8"){
  2908. $(window.document.body).height($("#maingrid").height()+$("#tianXie_con").height()+250);
  2909. }else{
  2910. $(window.document.body).height($("#yjzy").height()+$("#tianXie_con").height()+250);
  2911. }
  2912. $(top.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  2913. }
  2914. /**
  2915. * 明细表设置高度
  2916. * @param type
  2917. */
  2918. function setXqContentHeight(){
  2919. $(window.document.body).height($("#maingrid2").height()+$("#tianXie_con").height()+250);
  2920. $(top.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  2921. }
  2922. /**
  2923. * 获得鼠标的相对坐标
  2924. * 2017-10-26 djc
  2925. */
  2926. function mousePosition(ev){
  2927. var e = event || window.event;
  2928. var scrollX = document.documentElement.scorllLeft||document.body.scrollLeft;
  2929. var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  2930. var x = e.pageX || e.clientX+scrollX;
  2931. var y = e.pageY || e.clientY+scrollY;
  2932. return {'x':x,'y':y};
  2933. }