4f9c795fc33536e462b9a88848bbbc518b28dc51.svn-base 72 KB

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