1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873 |
- var DialogObject = {
- HintWinHander: null,
- MoveState: 0, //移动状态。0 停止移动 1 开始移动 2 移动中
- //消息提示窗口。该类型窗口在未关闭时,多次调用时会复用原窗口
- OpenHint: function(container, opt) {
- if (this.HintWinHander == null) this.HintWinHander = this.Open(container, opt);
- return this.HintWinHander;
- },
- Open: function(container, opt) {
- var newcontainer = container.clone();
- $("body").append(newcontainer);
- newcontainer.attr("id", "dig_" + new Date().getTime());
- newcontainer.find(".fa-times,.dlg_close").off("click").on("click", function() {
- var container = $(this).parents(".site_device_list");
- if (container.css("z-index") == 10000)
- $(".clearn").hide();
- container.remove();
- });
- newcontainer.on("click", ".layui-tools button", function() {
- if ($(this).hasClass("cancel")) $(this).parents(".site_device_list").find(".fa-times").trigger('click');
- else if ($(this).hasClass("confirm")) {
- if (opt != null && opt.onSave != null) {
- opt.onSave(newcontainer, opt.para, this);
- }
- }
- });
- if (opt != null && opt.size != null) {
- newcontainer.css({
- width: opt.size[0],
- height: opt.size[1],
- });
- }
- var total_height = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
- $(".clearn").show().css("height", total_height + "px");
- newcontainer.show();
- var left = parseInt(newcontainer.width() / 2);
- left = -left;
- var top = parseInt(newcontainer.height() / 2);
- top = -top;
- newcontainer.css({
- "margin-left": left + "px",
- "margin-top": top + "px"
- });
- newcontainer.find(".caption").width(newcontainer.width() - 8).on("mousedown", function(e) {
- newcontainer.attr("MoveState", 1);
- var oldpageX = e.pageX;
- var oldpageY = e.pageY;
- var oldLeft = parseInt(newcontainer.css("left"));
- var oldTop = parseInt(newcontainer.css("top"));
- newcontainer.on("mousemove", function(ev) {
- // console.log(e)
- if (newcontainer.attr("MoveState") == "1") {
- newcontainer.css({
- "left": ev.pageX - oldpageX + oldLeft + "px",
- "top": ev.pageY - oldpageY + oldTop + "px"
- })
- }
- })
- }).on("mouseup", function() {
- newcontainer.attr("MoveState", 0);
- newcontainer.off("mousemove");
- });
- if (opt != null && opt.callback != null) {
- opt.callback(newcontainer, opt.para);
- }
- return newcontainer;
- },
- Close: function($ele) {
- if ($ele != null) {
- $(".clearn").hide();
- $ele.hide();
- } else {
- $(".layout_dialog,.clearn").hide();
- }
- },
- Msg: function(msg, opt) {
- var ind = layer.msg(msg, opt);
- $("#layui-layer" + ind).css("z-index", Global.GetSeqNext());
- }
- }
- var hRate = 1;
- var wRate = 1;
- var PoliceObject = {
- IntervalTime: 1000 * 60 * 5, //每5分钟刷新一次页面
- LoddingText: "<i class='layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop' style='margin-right:10px;'></i><span style='color:#ffffff;'>数据加载中...</span>",
- MessageObject: null,
- AreaID: 0, //当前站/区域ID
- ScdID: 0, //当前SCDID
- CurentMark: "",
- AreaInfo: {},
- MainHeight: 0, //页页内容区高度
- Tips: {
- tips: [3, "#f47920"],
- area: ['400', "auto"]
- },
- CurentCompCheckID: "", //当前用户正在一致性校验的记录ID
- CurentParseScdName: "", //当前用户正在解析的SCD名称
- TempScdID: "", //临时查看的scdID
- ScdList: [], //scd列表
- VoltageLevel: [], //电压等级
- AreaList: [], //间隔列表
- DeviceType: [], //装置类型列表
- IedList: [], //IED装置列表
- IedTypeMap: {},
- OnInited: null, //初始化完成事件
- NetWork_ApNodes: null,
- init: function() {
- //显示用户账号
- var userInfo = localStorage.getItem("userinfo");
- userInfo = JSON.parse(userInfo);
- $("#login_user_name").html(userInfo["name"]);
- $("#login_user_role").html("[" + userInfo["rolename"] + "]");
- var main_width = $(".monitor_center").width();
- var screen_width = document.documentElement.clientWidth;
- wRate = (screen_width / 1920).toFixed(2);
- var screen_height = document.documentElement.clientHeight;
- hRate = (screen_height / 1080).toFixed(2);
- $("#left_area_item").prevAll().css("margin-bottom", 20 * hRate + "px");
- PoliceObject.MainHeight = Math.ceil(screen_height - 65 * hRate);
- $(".body_content,#right_area,#container_map").height(PoliceObject.MainHeight);
- //<!--创建变电站列表-->
- $("body").append('<div class="station_list hidden" id="station_list"></div>');
- //scd树初始化
- $("#scd_tree_list").css({
- "height": PoliceObject.MainHeight - (70 * hRate) + "px"
- });
- $("#scd_tree_list>.title:first").css({
- "height": 4 + "rem",
- "line-height": 4 + "rem"
- });
- $("#scd_tree_list>.list:first").css({
- "height": 66 + "rem"
- }).slimScroll({
- height: 62 + "rem",
- width: "98%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- $("body").on('click', function() {
- if ($(this).attr("id") != "scd_info" && $(this).parent().attr("id") != "scd_info") {
- $("#scd_list").addClass("hidden");
- $("#scd_info").find("i").attr("class", "fa fa-caret-up");
- }
- if ($(this).attr("id") != "stationname" && $(this).parent().attr("id") != "stationname") {
- $("#station_list").addClass("hidden");
- $("#stationname").find("i").attr("class", "fa fa-caret-up");
- }
- if ($(this).attr("id") != "voltage_level_select" && $(this).parent().attr("id") != "voltage_level_select") {
- $("#voltage_level_list").addClass("hidden");
- $("#voltage_level_select").find("i").attr("class", "fa fa-caret-up");
- }
- if ($(this).attr("id") != "area_select" && $(this).parent().attr("id") != "area_select") {
- $("#area_list").addClass("hidden");
- $("#area_select").find("i").attr("class", "fa fa-caret-up");
- }
- if ($(this).attr("id") != "device_type_select" && $(this).parent().attr("id") != "device_type_select") {
- $("#device_type_list").addClass("hidden");
- $("#device_type_select").find("i").attr("class", "fa fa-caret-up");
- }
- });
- //初始化搜索事件
- $(document).on("click", function() {
- $("#search_result").html("").addClass("hidden");
- $("#fulltext_search_condition .datelist").addClass("hidden");
- });
- //全局关闭窗口事件
- $(".layout_close").off("click").on("click", function() {
- var container = $(this).parents(".layout_dialog");
- container.hide();
- if (container.css("z-index") == 10000)
- $(".clearn").hide();
- });
- $("#area_list>div:eq(0)").slimScroll({
- height: (300 * hRate) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- $("#site_device_list").css({
- "bottom": 30 * hRate + "px",
- "left": 480 * wRate + "px",
- "height": 400 * hRate + "px",
- "width": 360 * wRate + "px"
- }).children(".dataitemlist").slimScroll({
- height: (360 * hRate) + "px",
- width: 340 * wRate + "px",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- //点击顶端菜单
- $(".main_bar>div").off("click").on("click", function() {
- var mark = $(this).attr("mark");
- if (mark == null || mark == "") return;
- PoliceObject.CurentMark = mark;
- var oldActiveEle = $("#main_bar .app_active").removeClass("app_active").addClass("app_default");
- $(this).addClass("app_active");
- if (mark == "elevator") { //智感梯间
- if ($("#container_fulltext_search").is(":visible"))
- $("#container_fulltext_search").addClass("hidden");
- PoliceObject.GoFloor(0, "");
- } else if (mark == "search") {
- $("body").css("background-color", "#EEF3FF");
- PoliceObject.GoSearch();
- }
- });
- $("#search_panel").show();
- this.LoadOrgConfig();
- this.LoadNoreadNoitce();
- //初始化MQTT
- //初始订阅全局人脸搜索结果主题
- var face_mqtt = new MqttClient(null, null, ["/jujutong/scd/#"], function() {
- console.log("=====订阅成功===");
- });
- //定义接收消息处理过程
- face_mqtt.AddReceivedMqttMessage("/jujutong/scd/", function(topic, message) {
- console.log(topic + ":" + message)
- //scd文件解析通知
- ///jujutong/scd/parse/30000012:{"msg":"","name":"750kVQXB.scd","node":"load-file","rootid":"30000012","state":"0"}
- ///jujutong/scd/parse/30000012:{"msg":"","name":"750kVQXB.scd","node":"load-file","rootid":"30000012","state":"1"}
- ///jujutong/scd/parse/30000012:{"load":"0","msg":"","name":"750kVQXB.scd","node":"write-db","rootid":"30000012","state":"0","total":"925515"}
- ///jujutong/scd/ruleparse/30000012:节点LN属性prefix值最大长度不能超过6,当前属性值[QGD2ILB]长度无效!
- ///jujutong/scd/parse/30000012:{"load":"5000","msg":"","name":"750kVQXB.scd","node":"write-db","rootid":"30000012","state":"2","total":"925515"}
- ///jujutong/scd/parse/30000012:{"load":"925515","msg":"","name":"750kVQXB.scd","node":"write-db","rootid":"30000012","state":"1","total":"925515"}
- ///jujutong/scd/comp/3:{"state":0}
- ///jujutong/scd/notice/17:{"Id":0,"StationId":827,"Caption":"有新的SCD文件任务【SCD签入】需要您发布。","NoticeType":100,"SenderName":"李领","SenderTime":"2022-10-30 20:36:26","Content":"","RevId":17,"ReadFlag":0,"ReadTime":"","Cr":"","Ct":""}
- ///jujutong/scd/iedblockrelations/30000012/CB7522:{"code":1}
- ///jujutong/scd/iedblockinputs/30000012/CB7522/IB7522A:{"code":1}
- if (topic.indexOf("/jujutong/scd/notice") > -1) {
- PoliceObject.LoadNoreadNoitce();
- return;
- }
- if (topic.indexOf("/jujutong/scd/parse") > -1) {
- if (topic.indexOf("error") > 0) {
- layer.msg(message, {
- icon: Global.ICON_ERROR
- })
- return;
- }
- var jsonobj = JSON.parse(message);
- //PoliceObject.CurentParseScdName:当前需要解析有SCD名称
- //如果是签入操作,该变量值由FlowObject对的签入第一步骤提交时设置
- if (PoliceObject.CurentParseScdName != jsonobj.name && PoliceObject.AreaID != jsonobj.stationid) {
- return;
- }
- if (DialogObject.HintWinHander == null) {
- DialogObject.OpenHint($("#dialog_public"), {
- size: ["40rem", "20rem"],
- para: {
- "scdname": jsonobj.name
- },
- callback: function(win, para) {
- win.find(".node_area").remove();
- win.find(".caption>b").html("SCD解析");
- var $dataitemlist = win.find(".dataitemlist").html("<div class='process_msg_hint'></div>");
- var showH = $dataitemlist.height() - 25;
- $dataitemlist.slimScroll({
- height: showH + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- $dataitemlist.height(showH - 30);
- }
- });
- }
- var msgHintEle = DialogObject.HintWinHander.find(".process_msg_hint");
- if (jsonobj.state == "1") {
- var message = "";
- if (jsonobj.node == "load-file") message = Tools.OkIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "加载完成!";
- else if (jsonobj.node == "write-db") message = Tools.OkIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "结构解析入库完成!";
- else if (jsonobj.node == "check-file") message = Tools.OkIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "语法校验完成!";
- else if (jsonobj.node == "crc-file") message = Tools.OkIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "CRC校验完成!";
- Tools.Loading2Ok(msgHintEle);
- msgHintEle.append("<div>" + message + "</div>");
- if (typeof(FlowObject) == "object") {
- //当前处于签出签入界面时,自动刷新数据列表
- FlowObject.GetScdInoutRecord(1, 10, MakeScdInoutRecord);
- return;
- }
- if (typeof(LoadStationFiles) == "function") {
- //当前处于配置文件界面时,自动刷新数据列表
- //需要延迟一点点时间执行,否则获取的数据状态可能不对
- setTimeout(function() {
- LoadStationFiles(1, 20);
- }, 1000);
- return;
- }
- } else if (jsonobj.state == "0") {
- var message = "";
- if (jsonobj.node == "load-file") message = Tools.LoadingIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "开始加载...";
- else if (jsonobj.node == "write-db") message = Tools.LoadingIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "正在结构解析中,时间可能会稍长,请耐心等待完成... [总节点数:" + jsonobj.total + " 已解析:<span id='write-db-parse-count'><b>-</b></span>]";
- else if (jsonobj.node == "check-file") message = Tools.LoadingIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "正在进行语法校验,请耐心等待完成...]";
- else if (jsonobj.node == "crc-file") message = Tools.LoadingIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "正在进行CRC校验,请耐心等待完成...]";
- msgHintEle.append("<div>" + message + "</div>");
- } else if (jsonobj.state == "2") {
- msgHintEle.find("#write-db-parse-count").html(jsonobj.load);
- }
- return;
- }
- if (topic.indexOf("/jujutong/scd/ruleparse") > -1) {
- var jsonobj = JSON.parse(message);
- //PoliceObject.CurentParseScdName:当前需要解析有SCD名称
- //如果是签入操作,该变量值由FlowObject对的签入第一步骤提交时设置
- if (jsonobj.scdid == null || PoliceObject.ScdID != jsonobj.scdid) {
- return;
- }
- if (jsonobj.code == 0) {
- layer.msg(jsonobj.msg, {
- icon: Global.ICON_ERROR
- });
- return;
- }
- if (DialogObject.HintWinHander == null) {
- DialogObject.OpenHint($("#dialog_public"), {
- size: ["40rem", "20rem"],
- para: {
- "scdname": jsonobj.name
- },
- callback: function(win, para) {
- win.find(".caption>b").html("SCD校验");
- var $dataitemlist = win.find(".dataitemlist").html("<div class='process_msg_hint'>" + message + "</div>");
- $dataitemlist.slimScroll({
- height: ($dataitemlist.height() - 5) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- }
- });
- }
- var msgHintEle = DialogObject.HintWinHander.find(".process_msg_hint");
- if (jsonobj.state == "1") {
- var message = Tools.OkIcon() + new Date().Format("hh:mm:ss") + "===SCD文件校验完成!";
- Tools.Loading2Ok(msgHintEle);
- msgHintEle.append("<div>" + message + "</div>");
- } else if (jsonobj.state == "0") {
- var message = Tools.LoadingIcon() + new Date().Format("hh:mm:ss") + "===SCD文件开始进行校验...";
- msgHintEle.append("<div>" + message + "</div>");
- }
- return;
- }
- if (topic.indexOf("/jujutong/scd/comp") > -1) {
- var jsonobj = JSON.parse(message);
- if (PoliceObject.CurentCompCheckID != jsonobj.id) {
- return;
- }
- var msgHintEle = DialogObject.HintWinHander == null ? null : DialogObject.HintWinHander.find(".process_msg_hint");
- //SCD文件一致性对比完成
- var state = jsonobj.state;
- if (state == "1") {
- var btn_scdcomp_start = $(".dialog_public .func_scdcomp_start");
- if (btn_scdcomp_start.length > 0) {
- if ("1" == $.trim(btn_scdcomp_start.attr("comping"))) {
- layer.closeAll();
- layer.msg("SCD一致性校验完成", {
- icon: 1
- });
- btn_scdcomp_start.attr("comping", "0");
- PoliceObject.LoadScdCompList();
- return;
- }
- }
- Tools.Loading2Ok(msgHintEle);
- var message = Tools.OkIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "一致性校验完成!";
- if (msgHintEle != null) msgHintEle.append("<div>" + message + "</div>");
- } else {
- var message = Tools.LoadingIcon() + new Date().Format("hh:mm:ss") + "===SCD文件" + jsonobj.name + "开始进行一致性校验...";
- if (msgHintEle != null) msgHintEle.append("<div>" + message + "</div>");
- }
- }
- if (topic.indexOf("/jujutong/scd/delete") > -1) {
- //清除SCD文件操作
- var jsonobj = JSON.parse(message);
- layer.closeAll();
- if (jsonobj.state == 0)
- layer.msg("SCD文件[" + jsonobj.scd_name + "]及相关数据正在被<b>" + jsonobj.user + "</b>删除中...", {
- icon: Global.ICON_LOADING,
- time: 0
- })
- else {
- layer.msg("SCD文件[" + jsonobj.scd_name + "]及相关数据已被<b>" + jsonobj.user + "</b>完全删除!", {
- icon: Global.ICON_OK
- });
- if (typeof(LoadStationFiles) == "function") {
- //当前处于配置文件界面时,自动刷新数据列表
- //需要延迟一点点时间执行,否则获取的数据状态可能不对
- setTimeout(function() {
- LoadStationFiles(1, 20);
- }, 1000);
- return;
- }
- }
- return;
- }
- if (topic.indexOf("/jujutong/scd/iedblockrelations") > -1) {
- var jsonobj = JSON.parse(message);
- var iedname = jsonobj["ied_name"];
- //数据块关系解析完成消息
- var v_win = $(".dialog_public[ied_name='" + iedname + "']");
- if (v_win.length == 0) return;
- var curBtn = v_win.find("#ied_list_tools .layui-this");
- if (curBtn.attr("ind") == "2") {
- //当前正在查看输入输出控制块信息
- console.log("重新加载" + iedname + "输入输出控制块信息");
- //PoliceObject.LoadIedCtrlRelation(PoliceObject.IedList[iedname]);
- setTimeout(function() {
- curBtn.trigger("click");
- }, 500);
- }
- return;
- }
- if (topic.indexOf("/jujutong/scd/iedblockinputs") > -1) {
- //虚端子关系解析完成消息
- return;
- }
- if (message != "" && message.substring(0, 1) == "{") {
- var jsonobj = JSON.parse(message);
- }
- });
- if (PoliceObject.OnInited != null) PoliceObject.OnInited(); //初始化完成事件
- },
- OpenToXml: function(scdid, lineno, desc) {
- //查看指定行数的scd源xml文件
- if (typeof lineXmlDig != "undefined") DialogObject.Close(lineXmlDig);
- lineXmlDig = DialogObject.Open($("#dialog_public"), {
- size: ["70rem", "65rem"],
- para: {
- "title": "SCD源XML查看",
- "scdid": scdid,
- "lineno": lineno,
- "desc": desc
- },
- callback: function(win, para) {
- if (typeof lineXmlDig != "undefined") win.css("margin-left", "0px");
- win.find(".caption>b").html(para.title);
- var winContent = win.find(".dataitemlist").css("cssText", "padding-top: 0rem !important;").html('<div style="color:red;border-bottom: 1px solid #e1e1e1;">' + para.desc + '</div><div style="overflow:auto;text-align: left;line-height: 2rem;">正在加载数据中</div>').height(win.height() - win.find(".caption").height() - win.find(".footer").height());
- $.getJSON(Global.AccessUrl + "/api/screen/scd/line/sourcexml", {
- "scd_id": para.scdid,
- "lineno": para.lineno
- }, function(data) {
- if (data.code != 0) {
- win.find(".dataitemlist>div:last").html(data.msg);
- return
- }
- var linestr = [];
- var topLine = 0;
- for (var i = 0; i < data.data.length; i++) {
- var linechars = data.data[i].indexOf(" ")
- var lno = data.data[i].substring(0, linechars)
- if (para.lineno == lno) {
- topLine = i + 1
- if (topLine > 25) topLine = topLine - 15;
- }
- linestr.push('<div line=' + lno + ' style="' + (para.lineno == lno ? 'background: #4d4d86;color: #fff;' : '') + '"><span>' + lno + ' </span><span>' + data.data[i].substring(linechars).replace(/</g, '<').replace(/>/g, '>') + '</span></div>');
- }
- win.find(".dataitemlist>div:last").height(winContent.height() - win.find(".dataitemlist>div:first").height()).html(linestr.join('')).scrollTop(topLine * win.find(".dataitemlist>div:last>div:eq(0)").height())
- })
- }
- });
- },
- toScd: function(stationid, scddid, scdname, scdpath) {
- //查看指定scd文件
- window.localStorage.setItem("PoliceObject.TempScdID", scddid);
- window.localStorage.setItem("PoliceObject.TempAreaID", stationid);
- window.localStorage.setItem("PoliceObject.TempScdName", scdname);
- window.localStorage.setItem("PoliceObject.AreaID", stationid);
- window.location.href = 'scd_o.html';
- },
- //加载配置的单位名称
- LoadOrgConfig: function() {
- //获取配置的单位名称
- $.getJSON(Global.AccessUrl + "/api/getSysParamList", {
- "param_name": "orgname"
- }, function(r) {
- if (r.code != 0 || r.data == null) return;
- $("#orgname").html(r.data[0].param_value);
- });
- },
- //加载未读通知提醒
- LoadNoreadNoitce: function() {
- $.getJSON(Global.AccessUrl + "/api/notice/list", {
- "isread": 0
- }, function(r) {
- if (r.code != 0 || r.data == null) return;
- changeBell(r.data.length);
- });
- var openNoticeWin = function() {
- $.getJSON(Global.AccessUrl + "/api/notice/list", {
- "isread": 0
- }, function(r) {
- if (r.code != 0 || r.data == null) return;
- changeBell(r.data.length);
- if (r.data.length == 0) {
- return;
- }
- DialogObject.Open($("#dialog_public"), {
- size: ["81rem", "40rem"],
- para: {
- "title": "",
- "list": r.data
- },
- callback: function(win, para) {
- win.find(".caption>b").html("最新提醒");
- win.find(".node_area").remove();
- var h = (win.height() - win.find(".caption").height() - win.find(".footer").height());
- var dataitemlist = win.find(".dataitemlist").height(h + "px").html("<div class='notice_header f_l' style='border-bottom: 1px solid #334077;font-weight: bold;width: 100%;'></div><div class='notice_list f_l'></div>");
- dataitemlist.children(".notice_header").html('<span class="f_l text_overflow" style="width:15rem">时间</span><span class="f_l text_overflow" style="width:15rem">变电站</span><span class="f_l text_overflow" style="width:30rem">提醒内容</span><span class="f_l text_overflow" style="width:10rem">发布者</span><span class="f_l text_overflow" style="width:10rem">操作</span>');
- var noticeLst = [];
- for (var i = 0; i < para.list.length; i++) {
- noticeLst.push("<div class='notice_item f_l' noticeid='" + para.list[i].id + "'><span class='f_l text_overflow' style='width:15rem'>" + para.list[i].sender_time + "</span><span class='f_l text_overflow' style='width:15rem'>" + para.list[i].station_name + "</span><span class='f_l text_overflow' style='width:30rem'>" + para.list[i].caption + "</span><span class='f_l text_overflow' style='width:10rem'>" + para.list[i].sender_name + "</span><span class='f_l text_overflow' style='width:10rem'><span class='btn' style='padding: 0.5rem 1rem;' noticeid='" + para.list[i].id + "'>已读</span></span></div>");
- }
- var notice_list = dataitemlist.children(".notice_list").html(noticeLst.join(""));
- notice_list.slimScroll({
- height: (h - dataitemlist.children(".notice_header").height() - 5) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- notice_list.find(".btn").off().on('click', function() {
- var row = $(this),
- noticeid = row.attr("noticeid");
- $.post(Global.AccessUrl + "/api/notice/read", {
- "id": noticeid
- }, function(r) {
- layer.msg("操作成功!");
- row.parent().parent().remove();
- if (notice_list.find(".notice_item").length == 0) {
- win.remove();
- changeBell(0);
- } else {
- changeBell(-1);
- }
- });
- });
- }
- });
- });
- }
- var changeBell = function(numer) {
- var menu = $(".monitor_center .header .header_background>div:first");
- var noitcemenu = menu.find(".app_default.notice");
- if (numer == null || numer == 0) {
- noitcemenu.prev().remove();
- noitcemenu.remove();
- return;
- }
- //fa-bell
- if (noitcemenu.length == 0) {
- $('<div class="app_default" style="color: #7A13E1;">|</div><div class="app_default notice" style="border-bottom: 2px solid #7A13E1;height: 93%;position: relative;">' +
- '<i class="fa fa-bell" style="color: #00CEFB;font-size: 1.8rem;margin-right: 0.5rem;border: 0;"></i><span class="abs notice_number" style="height: 2rem;width: 2rem;border-radius: 2rem;border: 2px solid #fff;line-height: 2rem;font-size: 1.2rem;text-align: center;background: red;right: -1.5rem;top: 0;color:#fff;">' + numer + '</span>' +
- '</div>').insertBefore(menu.children(".app_default:eq(2)"));
- noitcemenu = menu.find(".app_default.notice");
- noitcemenu.off().on('click', function() {
- openNoticeWin();
- });
- } else {
- if (numer == -1) {
- //当前值减1
- numer = noitcemenu.find(".notice_number").text() * 1 - 1;
- }
- //最多显示99的数量
- noitcemenu.find(".notice_number").html(numer > 99 ? 99 : numer);
- }
- }
- //openNoticeWin();
- },
- //加载装置类型
- LoadDeviceType: function(clickcallback) {
- $.getJSON(Global.AccessUrl + "/api/scd/ied/typelist", {
- "scd_id": PoliceObject.ScdID
- }, function(r) {
- if (r.code != 0 || r.returncode == 500 || r.data == null) return;
- PoliceObject.DeviceType = r.data;
- var container_map_ied = $("#container_map_ied");
- var tarEle = container_map_ied.find("#device_type_select").off().on('click', function(e) {
- e.stopPropagation();
- var t = $(this),
- t1 = $("#device_type_list");
- t1.removeClass("hidden").css({
- top: t.offset().top + t.height() + 10,
- left: t.offset().left + t.width() - t1.width()
- });
- $(this).find("i").attr("class", "fa fa-caret-down");
- });
- //设备类型采用code,需要把id删除去除
- for (var i = 0; i < r.data.length; i++) {
- delete(r.data[i]["id"]);
- }
- $("#device_type_list").html(template('select_item_tpl', {
- data: [{
- "id": "",
- "name": "全部"
- }].concat(r.data)
- })).find(".station_list_item").off().on('click', function() {
- var v = $(this).attr("value");
- tarEle.attr("vid", v).children(".filter_text").html("装置类型:" + $(this).text());
- tarEle.find("i").attr("class", "fa fa-caret-up");
- if (clickcallback != null) clickcallback(v, $(this).text());
- });
- });
- },
- //加载变电站列表
- LoadStationList: function(loadcallback, clickcallback) {
- //获取变电站列表。后台已经根据当前登录人员做了权限过滤
- $.getJSON(Global.AccessUrl + "/api/basic_area/list", {
- "pid": "0"
- }, function(r) {
- if (r.code != 0 || r.data == null) return;
- var stationname = $("#stationname").html(r.data[0].area_name);
- if (loadcallback != null) loadcallback(r);
- if (r.data.length > 0) {
- PoliceObject.AreaID = r.data[0].id;
- //当前人员有权限的站超过1个时,才显示选择列表
- /*
- stationname.append('<i class="fa fa-caret-up"></i>');
- stationname.off().on('click', function(e) {
- //点击站名时,显示变电站下拉列表
- e.stopPropagation();
- $("#station_list").removeClass("hidden");
- $(this).find("i").attr("class", "fa fa-caret-down");
- });*/
- //生成站列表元素
- var station_list = $("#scd_tree_list .list").html(template("station_list_item_tpl", r));
- /*station_list.css({
- top: stationname.offset().top + stationname.height() + 10,
- left: stationname.offset().left + stationname.width() - station_list.width()
- });*/
- station_list.find(".station_list_item").off().on('click', function() {
- $("#scd_tree_list .list .active").removeClass("active");
- $(this).addClass("active");
- //选择某个站时,加载该站的scd信息
- var stationid = $(this).attr("stationid");
- PoliceObject.AreaID = stationid;
- window.localStorage.setItem("PoliceObject.AreaID", stationid);
- //stationname.html($(this).text() + '<i class="fa fa-caret-up"></i>');
- if (clickcallback != null) clickcallback(stationid);
- });
- var cur_station_id = $.trim(window.localStorage.getItem("PoliceObject.AreaID"));
- if (cur_station_id != "") {
- station_list.find(".station_list_item[stationid='" + cur_station_id + "']").trigger('click');
- } else {
- //默认选择第一个
- station_list.find(".station_list_item:first").addClass("active").trigger('click');
- }
- }
- });
- },
- //加载电压等级列表
- LoadVoltageLevelSelect: function(stationid, clickcallback) {
- var tmp_load = function(r) {
- //绑定电压等级选择事件
- var container_map_ied = $("#container_map_ied");
- var tarEle = container_map_ied.find("#voltage_level_select").off().on('click', function(e) {
- e.stopPropagation();
- var t = $(this),
- t1 = $("#voltage_level_list");
- t1.removeClass("hidden").css({
- top: t.offset().top + t.height() + 10,
- left: t.offset().left + t.width() - t1.width()
- });
- $(this).find("i").attr("class", "fa fa-caret-down");
- });
- $("#voltage_level_list").html(template('select_item_tpl', {
- data: [{
- "id": "",
- "name": "全部"
- }].concat(r)
- })).find(".station_list_item").off().on('click', function() {
- var tarEle = $("#voltage_level_select");
- var v = $(this).attr("value");
- tarEle.attr("vid", v).children(".filter_text").html("电压等级:" + $(this).text());
- tarEle.find("i").attr("class", "fa fa-caret-up");
- $("#area_select").attr("vid", "").children(".filter_text").html("间隔");
- $("#device_type_select").attr("vid", "").children(".filter_text").html("装置类型");
- //过虑所选择的电压等级的间隔
- var area_select = $("#area_list");
- if (v == "") area_select.find(".station_list_item").removeClass("hidden");
- else {
- for (var i = 0; i < PoliceObject.AreaList.length; i++) {
- var tarItemEle = area_select.find(".station_list_item[value='" + PoliceObject.AreaList[i].id + "']");
- if (PoliceObject.AreaList[i].voltage_level == v) {
- tarItemEle.removeClass("hidden");
- } else {
- tarItemEle.addClass("hidden");
- }
- }
- }
- if (clickcallback != null) clickcallback(v, $(this).text());
- });
- if (container_map_ied.find(".scd_area").length > 0) {
- //填充电压等级-间隔列表
- var scdArea = container_map_ied.find(".scd_area").html(template('voltage_level_item_tpl', {
- data: PoliceObject.VoltageLevel
- }));
- scdArea.slimScroll({
- height: $("#container_map .scd_main").height() - $("#container_map .scd_main .scd_filter").height() - $("#container_map .scd_main .scd_filter").css("margin-top").replace("px", "") * 1,
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- //填充间隔列表
- PoliceObject.LoadAreaSelect(PoliceObject.ScdID, function(v, text) {
- PoliceObject.OpenShowIedList(text, {
- "area_id": v,
- "voltage_level_id": "",
- "device_type_id": ""
- });
- });
- }
- if (container_map_ied.find("#network").length > 0) {
- //console.log("================PoliceObject.GetSubNetwork")
- //填充网络结构
- //PoliceObject.GetSubNetwork();
- }
- }
- if (PoliceObject.VoltageLevel == null || PoliceObject.VoltageLevel.length == 0) {
- //加载电压等级
- $.getJSON(Global.AccessUrl + "/api/getGlobalCode", {
- "pcode": "voltage_level"
- }, function(r) {
- if (r.code != 0 || r.returncode == 500 || r.data == null) return;
- PoliceObject.VoltageLevel = r.data;
- tmp_load(PoliceObject.VoltageLevel);
- });
- } else {
- tmp_load(PoliceObject.VoltageLevel);
- }
- },
- //加载间隔列表
- LoadAreaSelect: function(scdid, clickcallback) {
- if (PoliceObject.ScdID == 0) return;
- var tmp_load = function(r) {
- var container_map_ied = $("#container_map_ied");
- var tarEle = container_map_ied.find("#area_select").off().on('click', function(e) {
- e.stopPropagation();
- var t = $(this),
- t1 = $("#area_list");
- t1.removeClass("hidden").css({
- top: t.offset().top + t.height() + 10,
- left: t.offset().left + t.width() - t1.width()
- });
- });
- $("#area_list>div>div:eq(0)").html(template('select_item_tpl', {
- data: [{
- "id": "",
- "name": "全部"
- }].concat(PoliceObject.AreaList)
- })).find(".station_list_item").off().on('click', function() {
- var v = $(this).attr("value");
- tarEle.attr("vid", v).children(".filter_text").html("间隔:" + $(this).text());
- tarEle.find("i").attr("class", "fa fa-caret-up");
- $("#device_type_select").attr("vid", "").children(".filter_text").html("装置类型");
- if (clickcallback != null) clickcallback(v, $(this).text());
- });
- container_map_ied.find(".scd_area .voltage_level_item").each(function() {
- if (PoliceObject.AreaList == null) return;
- //显示每个电压等级下属的间隔
- var $t = $(this),
- volid = $t.attr("itemid");
- var showDiv = $t.find(".voltage_level_area").html("");
- for (var i = 0; i < PoliceObject.AreaList.length; i++) {
- var item = PoliceObject.AreaList[i];
- if (volid == item.voltage_level) {
- showDiv.append('<span class="voltage_level_area_item text_overflow" area_id="' + item.id + '" title="' + item.name + '"><span>' + item.name + '</span></span>')
- }
- }
- var areaLen = showDiv.find(".voltage_level_area_item").length;
- if (areaLen == 0) {
- //移除没有ied的间隔电压等级
- $t.remove();
- //移除电压等级列表项
- $("#voltage_level_list .station_list_item[value=" + volid + "]").remove();
- return
- }
- if (areaLen > 7) {
- //如果间隔超过2排时,需要动态增加区域高度.显示区域默认高度只能显示2排
- var trowH = Math.ceil(areaLen / 7) * 12 * hRate;
- showDiv.css("height", trowH + "rem");
- showDiv.prev().css({
- "height": trowH + "rem",
- "line-height": (trowH + 1) + "rem"
- });
- showDiv.parent().css("height", trowH + "rem");
- }
- /*
- showDiv.slimScroll({
- height: (14 * hRate) + "rem",
- width: "88%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });*/
- });
- container_map_ied.find(".scd_area .voltage_level_area_item").off().on("click", function() {
- //点击间隔,查看该间隔下的IED
- var $t = $(this);
- var tit = $t.parent().prev().text() + "—" + $t.text();
- PoliceObject.OpenShowIedList(tit, {
- "area_id": $t.attr("area_id")
- });
- });
- }
- if (this.AreaList == null || this.AreaList.length == 0) {
- //获取当前变电站的间隔列表
- $.getJSON(Global.AccessUrl + "/api/scd/area/list", {
- "scd_id": scdid
- }, function(r) {
- if (r.code != 0) {
- layer.msg("间隔信息获取失败:" + r.msg);
- return;
- }
- PoliceObject.AreaList = r.data;
- tmp_load(r.data);
- })
- } else {
- tmp_load(this.AreaList);
- }
- },
- CheckScdID: "",
- CheckScdTaretID: "",
- CheckTools: function(type, title, scdid, scdpath, scdname) {
- if (scdid == "0") {
- layer.msg("该SCD文件还未解析!", {
- icon: Global.ICON_ERROR
- });
- return;
- }
- var winSize = ["150rem", "65rem"];
- if (type == "scd") {
- //scd一致性比较
- DialogObject.Open($("#dialog_public"), {
- size: ["130rem", "65rem"],
- para: {
- "title": title,
- "type": type,
- "scdpath": scdpath,
- "scdname": scdname
- },
- callback: function(win, para) {
- win.find(".caption>b").html(para.title);
- win.find(".dataitemlist").css("cssText", "padding-top: 1rem !important;").html(template('checktools_' + para.type + '_tpl', {})).height(win.height() - win.find(".caption").height() - win.find(".footer").height());
- eval("PoliceObject.checktools_" + para.type + "(win)");
- }
- });
- return;
- }
- if (type == "cid" || type == "cid_scd" || type == "ccd" || type == "ccd_scd") {
- //非scd一致性比较
- //开始CID校验
- $.post(Global.AccessUrl + "/api/scd/comp/start", {
- station_id: PoliceObject.AreaID,
- source_scd_id: scdid,
- ids: scdpath,
- type: type
- }, function(r) {
- layer.closeAll();
- if (r.code != 0) {
- layer.msg("操作失败:" + r.msg, {
- icon: Global.ICON_ERROR
- });
- return;
- }
- //$("#comp_ied_list .ied_data_list").html(r.data.info.iedname + "<br>" + (r.data.info.ieddesc || ""));
- //$("#comp_ied_result_show #node_tree>div:first>b").html(r.data.info.f1.filename + "(" + r.data.info.f1.ct + ")");
- //$("#comp_ied_result_show #node_tree>div:last>b").html(r.data.info.f2.filename + "(" + r.data.info.f2.ct + ")");
- if (r.data.list == null || r.data.list.length == 0) {
- layer.msg("当前2个对比文件无差异", {
- "icon": Global.ICON_HINT
- })
- return;
- }
- r.data["file_type"] = type;
- PoliceObject.CheckTools_Scd_Comp_ied_Detail(0, scdid, "", "", 'u', r.data);
- });
- return;
- }
- if ($.trim(scdid) == "" && $.trim(scdpath) != "" && $.trim(scdname) != "") {
- $.getJSON(Global.AccessUrl + "/api/screen/scd/info", {
- 'scdpath': scdpath,
- 'scdname': scdname
- }, function(r) {
- if (r.code != 0) {
- layer.msg(r.msg);
- return;
- }
- if (r.data == null) {
- layer.msg("无效的SCD名称和路径");
- return;
- }
- PoliceObject.CheckScdID = r.data.id;
- DialogObject.Open($("#dialog_public"), {
- size: ["150rem", "65rem"],
- para: {
- "title": r.data.station_name + "—" + r.data.scd_name + "—" + title,
- "type": type,
- "scdpath": scdpath,
- "scdname": scdname,
- "info": r.data
- },
- callback: function(win, para) {
- win.find(".caption>b").html(para.title);
- if (para.info.is_parse == 1) {
- win.find(".dataitemlist").html(template('checktools_' + para.type + '_tpl', {})).height(win.height() - win.find(".caption").height() - win.find(".footer").height());
- eval("PoliceObject.checktools_" + para.type + "(win)");
- } else {
- win.find(".dataitemlist").html(Tools.HintText("文件" + para.scdname + "正在解析中...,稍候重试"));
- }
- }
- });
- });
- } else if (scdid != null && scdid != "") {
- this.CheckScdID = scdid;
- PoliceObject.ScdID = scdid;
- } else {
- this.CheckScdID = PoliceObject.ScdID;
- }
- if (type != "scd" && (this.CheckScdID == null || this.CheckScdID == "")) {
- layer.msg("请选择一个SCD文件", {
- "icon": Global.ICON_ERROR
- })
- return;
- }
- if (type == "crc") {
- winSize = ["100rem", "60rem"];
- }
- $.getJSON(Global.AccessUrl + "/api/screen/scd/info", {
- "scd_id": this.CheckScdID
- }, function(jsondata) {
- if (jsondata.code != 0) {
- layer.msg(jsondata.msg);
- return;
- }
- DialogObject.Open($("#dialog_public"), {
- size: winSize,
- para: {
- "title": jsondata.data.station_name + "—" + jsondata.data.scd_name + "—" + title,
- "type": type,
- "scdpath": jsondata.data.path,
- "scdname": jsondata.data.scd_name
- },
- callback: function(win, para) {
- win.find(".caption>b").html(para.title);
- win.find(".dataitemlist").html(template('checktools_' + para.type + '_tpl', {})).height(win.height() - win.find(".caption").height() - win.find(".footer").height());
- eval("PoliceObject.checktools_" + para.type + "(win)");
- }
- });
- })
- },
- checktools_scl: function(win) {
- var tree = win.find("#node_tree .ztree");
- var dataitemlistH = win.find(".dataitemlist").height() - win.find(".dataitemlist").css("padding-top").replace("px", "") * 1;
- tree.slimscroll({
- height: (dataitemlistH - 10) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- var selectedIedName = "";
- var selectedNodeName = "";
- var selectedNodeId = "";
- var stat = win.find("#content_div .stat");
- var pagebar = win.find("#content_div .pagebar");
- var datalist = win.find("#content_div .datalist");
- datalist.slimscroll({
- height: (dataitemlistH - stat.height() - pagebar.height() - win.find(".datalist_header").height() - 10) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- win.find(".func_scdcomp_exportexcel").off().on('click', function() {
- var isall = $(this).attr("isall");
- if (isall == "1") {
- //导出所有结果
- Tools.ExpExcel({
- "code": "scl-check-result",
- "caption": "SCL校验结果",
- "expcols": "line_no,CREATED_TIME,attr_name,attr_desc,alert_level,parse_result,apply_standard,apply_standard_no",
- "expcolnames": "行号,日期,装置名称,装置描述,等级,校验结果内容,应用标准,标准条款",
- "scd_id": PoliceObject.CheckScdID,
- });
- return
- }
- //导出当前节点结果
- Tools.ExpExcel({
- "code": "scl-check-result",
- "caption": "SCL校验结果",
- "expcols": "line_no,CREATED_TIME,attr_name,attr_desc,alert_level,parse_result,apply_standard,apply_standard_no",
- "expcolnames": "行号,日期,装置名称,装置描述,等级,校验结果内容,应用标准,标准条款",
- "scd_id": PoliceObject.CheckScdID,
- "level": stat.find("span[alert_level].alert_level_active").attr("alert_level"),
- "ied_name": selectedIedName,
- "node_name": selectedNodeName,
- "node_id": selectedNodeId
- });
- });
- var iedHint = false;
- var sumresult = {};
- var arearesult = {};
- var vlresult = {}; //电压等级提示
- var topIedHintType = ""; //最高级的校验结果类型,默认为hint
- var topSCLHintType = "";
- $.getJSON(Global.AccessUrl + "/api/scd/check/sum/result", {
- scd_id: PoliceObject.CheckScdID
- }, function(r) {
- if (r.code != 0) {
- layer.msg("汇总校验结果错误:" + r.msg);
- return;
- }
- if (r.data == null) {
- r.data = [];
- }
- Global.Ztree.Init(tree, {
- url: Global.AccessUrl + "/api/screen/scd/checktools/tree?scd_id=" + PoliceObject.CheckScdID,
- idKey: "id",
- pidKey: "pid",
- nameKey: "title",
- AjaxParam: ["datatype"],
- childrenNodeIcon: 'fa-file-code-o',
- callback: {
- onClick: function(event, treeId, treeNode) {
- //console.log(treeNode)
- paginationLoaded = false;
- selectedIedName = treeNode.attr_name;
- selectedNodeName = treeNode.datatype;
- selectedNodeId = treeNode.attr_name || treeNode.id;
- stat.find("span[alert_level].alert_level_active").removeClass("alert_level_active");
- loadSclCheckResult(1, 20);
- },
- onAsyncSuccess: function(event, treeId, treeNode, msg) {
- }
- },
- DiyDom: function(treeId, treeNode) {
- var aObj = $("#" + treeNode.tId + "_a");
- //console.log(treeNode)
- //aObj.append("<span class='checktools_scl_numberhint alert_level_erro' >5</span>");
- var curNodeId = treeNode.id;
- aObj.append("<span class='checktools_scl_numberhint alert_level_" + treeNode.alert_level + "' ><i class='fa fa-exclamation-circle'></i></span>");
- }
- });
- });
- //获取当前scd所有的结果
- var paginationLoaded = false;
- var loadSclCheckResult = function(pageno, pagesize) {
- $.getJSON(Global.AccessUrl + "/api/scd/check/stat/level", {
- "scd_id": PoliceObject.CheckScdID,
- "ied_name": selectedIedName,
- "node_name": selectedNodeName,
- "node_id": selectedNodeId
- }, function(r1) {
- $("#content_div .stat>span>span[alert_level] b").html("0");
- if (r1.code != 0) {
- layer.msg("分类统计校验信息错误:" + r1.msg);
- return;
- }
- var all = 0;
- if (r1.data == null) {
- layer.msg("校验结果正在统计中,请稍候重试!");
- return;
- }
- for (var i = 0; i < r1.data.length; i++) {
- var item = r1.data[i];
- all += item.cnt * 1;
- var alertlevel = item["alert_level"];
- stat.find("span[alert_level='" + alertlevel + "']>b").html(item.cnt);
- }
- stat.find("span[alert_level='']>b").html(all);
- stat.find("span[alert_level]").off().on("click", function() {
- var t = $(this);
- t.parent().find(".alert_level_active").removeClass("alert_level_active");
- t.addClass("alert_level_active");
- paginationLoaded = false;
- loadSclCheckResult(1, 20, $(this).attr("alert_level"));
- });
- });
- layer.msg("正在查询校验信息中...", {
- time: 30000
- });
- $.getJSON(Global.AccessUrl + "/api/scd/check/resultlist", {
- "scd_id": PoliceObject.CheckScdID,
- "pageno": pageno,
- "pagesize": pagesize,
- "level": stat.find("span[alert_level].alert_level_active").attr("alert_level"),
- "ied_name": selectedIedName,
- "node_name": selectedNodeName,
- "node_id": selectedNodeId
- }, function(r) {
- if (r.code != 0) {
- layer.msg("查询校验信息错误:" + r.msg);
- return;
- }
- layer.closeAll();
- var dl = template('checktools_scl_datalist_tpl', r);
- datalist.html(dl);
- if (r.data == null) {
- r.count = 0;
- pagebar.addClass("hidden");
- datalist.html(Tools.HintText("该节点校验无误!"));
- }
- pagebar.removeClass("hidden");
- if (!paginationLoaded) {
- //生成分页
- pagebar.pagination(r.count, {
- num_edge_entries: 2,
- num_display_entries: 6,
- prev_show_always: false,
- next_show_always: false,
- prev_text: "<",
- next_text: ">",
- callback: function(page_index, jq) {
- //console.log("page_index:" + page_index)
- if (paginationLoaded) loadSclCheckResult(page_index + 1, 20);
- },
- items_per_page: 20
- });
- paginationLoaded = true;
- }
- })
- }
- loadSclCheckResult(1, 20);
- },
- checktools_scd: function(win) {
- if (PoliceObject.CurentCompCheckID != "") {
- layer.msg("正在进行SCD的一致性比对,请稍候...", {
- time: -1,
- icon: Global.ICON_LOADING
- })
- //有scd正在对比中
- win.find(".func_scdcomp_new,.func_scdcomp_start").attr("comping", "1").addClass("btn_disabled");
- }
- var source_scd_id = "";
- var target_scd_id = "";
- win.find(".func_scdcomp_exportexcel").off().on('click', function() {
- var compid = 0;
- var selectComp = win.find("#scd_comp_list .datalist input[name='comp_selected']:checked");
- if (selectComp.length > 0) {
- compid = selectComp.val();
- }
- if (compid == 0) {
- layer.msg("请选择一条历史对比记录或创建新的一致性对比!");
- return;
- }
- Tools.ExpExcel({
- "code": "scd-comp-result",
- "caption": "SCD一致性比对结果",
- "expcols": "source_scd_name,target_scd_name,ied_name,ied_desc,opt,diff_object_type,diff_object_name,desc",
- "expcolnames": "基准SCD,目标比对SCD,装置名称,装置描述,操作,比对内容类型,差异项,差异内容",
- "comp_id": compid
- });
- });
- win.find(".func_scdcomp_new").off().on('click', function() {
- if ($.trim($(this).attr("comping")) == "1") {
- return;
- }
- DialogObject.Open($("#dialog_public"), {
- size: ["80rem", "45rem"],
- para: {
- "title": "新的SCD一致性对比校验"
- },
- callback: function(childwin, para) {
- childwin.find(".caption>b").html(para.title);
- var body = childwin.find("#ln_strcut_detail");
- body.html("<div class='f_l' style='width:100%;line-height: 2rem;'>请同时选择2个scd文件进行对比!</div><div class='left f_l' style='width:99%;height:82%;padding: 1%;background-color: #f7f5f5;border-radius: 3px;border: 1px dotted #ccc;'><div></div></div><div class='layui-tools f_l' style='width: 99%;'><button type='button' class='layui-btn cancel'>关闭</button><button type='button' class='layui-btn layui-btn-normal confirm'>立即比对</button></div>");
- var scddiv = body.find("div.left");
- body.find(".layui-tools .cancel").off().on("click", function() {
- childwin.find(".dlg_close").trigger('click');
- });
- body.find(".layui-tools .confirm").off().on("click", function() {
- //确定按钮
- var scdlist = [];
- scddiv.find("input[type='checkbox']:checked").each(function() {
- var v_scdid = $(this).parent().attr("scdid")
- scdlist.push(v_scdid)
- if (v_scdid != source_scd_id) target_scd_id = v_scdid;
- });
- if (scdlist.length != 2) {
- layer.msg("请同时选择2个scd文件进行对比", {
- icon: Global.ICON_HINT
- })
- return;
- }
- win.find(".func_scdcomp_start").trigger('click');
- childwin.find(".dlg_close").trigger('click');
- });
- body.find(".left>div").slimscroll({
- "height": scddiv.height() + "px",
- "width": "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- })
- scddiv = scddiv.children("div:first").children("div:first");
- var showScdMap = {};
- if (PoliceObject.ScdList != null) {
- for (var i = 0; i < PoliceObject.ScdList.length; i++) {
- showScdMap[PoliceObject.ScdList[i].id] = 1;
- scddiv.append('<div scdid="' + PoliceObject.ScdList[i].id + '" class="f_l" style="width:99%;border-bottom: 1px solid #e8e7e7;"><input class="f_l" type="checkbox" name="scd_selected" style="margin: 1.4rem;"><span class="f_l" style="margin-right: 1.4rem;width: 4rem;height: 1px;">' + PoliceObject.ScdList[i].version + '</span><span class="f_l">' + PoliceObject.ScdList[i].scd_name + '</span><span class="f_r hidden"><input class="f_l" type="radio" name="base_scd_radio" style="margin: 1.4rem;" scdid="' + PoliceObject.ScdList[i].id + '">基准文件</span></div>');
- }
- }
- //获取非管控SCD列表
- $.getJSON(Global.AccessUrl + "/api/screen/scd/list", {
- "stationid": PoliceObject.AreaID,
- "ischeckinscd": ""
- }, function(jsondata) {
- if (jsondata.code != 0) {
- layer.msg("获取非管控SCD列表出错误:" + jsondata.msg, {
- icon: Global.ICON_ERROR
- })
- return;
- }
- if (jsondata.data == null) return;
- for (var i = 0; i < jsondata.data.length; i++) {
- if (showScdMap[jsondata.data[i].id] != null) continue;
- scddiv.append('<div scdid="' + jsondata.data[i].id + '" class="f_l" style="width:99%;border-bottom: 1px solid #e8e7e7;"><input class="f_l" type="checkbox" name="scd_selected" style="margin: 1.4rem;"><span class="f_l" style="margin-right: 1.4rem;width: 4rem;height: 1px;">' + jsondata.data[i].version + '</span><span class="f_l">' + jsondata.data[i].scd_name + '</span><span class="f_r hidden"><input class="f_l" type="radio" name="base_scd_radio" style="margin: 1.4rem;" scdid="' + jsondata.data[i].id + '">基准文件</span></div>');
- }
- scddiv.find("input[type='radio']").off().on('click', function() {
- var t = $(this);
- source_scd_id = t.attr("scdid");
- });
- scddiv.find("input[type='checkbox']").off().on('click', function() {
- var t = $(this);
- if (scddiv.find("input[type='checkbox']:checked").length == 3) {
- t.prop("checked", false);
- layer.msg("最多可选择2个文件进行比对校验!", {
- icon: Global.ICON_HINT
- })
- return
- }
- if (t[0].checked) t.parent().find("input[name='base_scd_radio']").parent().removeClass("hidden");
- else t.parent().find("input[name='base_scd_radio']").parent().addClass("hidden");
- var basescd = $(scddiv.find("input[type='checkbox']:checked")[0]).parent().find("input[name='base_scd_radio']").prop("checked", true)
- source_scd_id = basescd.attr("scdid");
- });
- })
- }
- });
- });
- win.find(".func_scdcomp_start").off().on('click', function() {
- if ($.trim($(this).attr("comping")) == "1") {
- return;
- }
- layer.msg("正在进行SCD的一致性比对,请稍候...", {
- time: -1,
- icon: Global.ICON_LOADING
- })
- var compid = 0;
- var selectComp = win.find("#scd_comp_list .datalist input[name='comp_selected']:checked");
- if (selectComp.length > 0) {
- compid = selectComp.val();
- }
- if (compid == 0 && source_scd_id == "") {
- layer.msg("请选择一条历史校验记录或创建新一致性校验!", {
- icon: 3
- });
- return;
- }
- var optbtn = $(this);
- layer.confirm('该操作耗时较长,校验开始后将清除原有校验结果且无法中止,确定开始吗?', {
- icon: Global.ICON_ASK,
- btn: ['确定', '取消'] //按钮
- }, function(index) {
- layer.close(index);
- optbtn.attr("comping", "1").addClass("btn_disabled");
- win.find(".func_scdcomp_new").attr("comping", "1").addClass("btn_disabled");
- layer.msg("正在进行SCD的一致性比对...请稍候", {
- icon: 16,
- time: -1
- });
- PoliceObject.CurentCompCheckID = compid + source_scd_id;
- $.post(Global.AccessUrl + "/api/scd/comp/start", {
- station_id: PoliceObject.AreaID,
- source_scd_id: source_scd_id,
- target_scd_id: target_scd_id,
- type: "SCD",
- comp_id: compid
- }, function(r) {
- win.find(".func_scdcomp_new,.func_scdcomp_start").attr("comping", "0").removeClass("btn_disabled");
- PoliceObject.CurentCompCheckID = "";
- layer.closeAll();
- if (r.code != 0) {
- layer.msg("操作失败:" + r.msg, {
- icon: Global.ICON_ERROR
- });
- return;
- }
- PoliceObject.LoadScdCompList();
- //等校验完成后,mqtt推送状态信息并更新界面
- });
- });
- });
- var scd_comp_list = win.find("#scd_comp_list");
- var dataitemlistH = win.find(".dataitemlist").height() - win.find(".dataitemlist").css("padding-top").replace("px", "") * 1;
- scd_comp_list.find(".datalist").slimscroll({
- height: (dataitemlistH - win.find(".datalist_header").height() - win.find("#scd_comp_tools").height() - 5) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- this.LoadScdCompList();
- },
- checktools_crc: function(win) {
- var iedcrclist = win.find("#iedcrclist");
- iedcrclist.slimScroll({
- height: iedcrclist.height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- iedcrclist.html(Tools.HintText("正在加载数据中"));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/crc", {
- "scd_id": PoliceObject.ScdID
- }, function(jsondata) {
- if (jsondata.code != 0) {
- iedcrclist.html(Tools.HintText(jsondata.msg));
- return
- }
- win.find("#scdcrc").html(jsondata.data["scdcrc"]["scdcrc"] || '无');
- win.find("#scdcrc2").html(jsondata.data["scdcrc"]["checkcrc"]);
- win.find("#scdcrcresult").html(jsondata.data["scdcrc"]["checkcrc"] == jsondata.data["scdcrc"]["scdcrc"] ? "校验通过" : "<b style='color:red'>不一致</b><select class='fa-search' style='margin-left: 1rem;'><option>全部</option><option>不一致</option><option>一致</option></select>").find(".fa-search").off().on('change', function() {
- var selecttext = $(this).val();
- iedcrclist.find("tr").each(function() {
- var tr = $(this);
- if (selecttext != "全部" && tr.find("td:last").text().indexOf(selecttext) != 0) {
- tr.addClass("hidden")
- } else {
- tr.removeClass("hidden")
- }
- })
- });
- var h = template('checktools_crc_list_tpl', {
- "data": jsondata.data.list.sort(Tools.SortBy("iedname", true))
- });
- iedcrclist.css("height", "96%").html(h);
- });
- },
- LoadScdCompList: function() {
- $("#scd_comp_list .datalist").html(Tools.HintText("正在加载数据中..."));
- $.getJSON(Global.AccessUrl + "/api/scd/comp/list", {
- "station_id": PoliceObject.AreaID
- }, function(r) {
- if (r.code != 0) {
- layer.msg(r.msg, {
- icon: Global.ICON_ERROR
- });
- return
- }
- if (r.data == null || r.data.length == 0) {
- $("#scd_comp_list .datalist").html(Tools.HintText("还没有SCD一致性校验比对记录!"));
- return;
- }
- var h = template('checktools_scd_datalist_tpl', r);
- $("#scd_comp_list .datalist").html(h);
- })
- },
- CurrentCompResult: null, //当前查看的SCD比对结果
- CheckTools_Scd_Comp_Detail: function(e, compId, sourcescdname, targetscdname, sourcescdid, targetscdid) {
- var queryScdId = "";
- var selectedNodeID = "";
- var selectedNodeType = "";
- var paginationLoaded = false;
- var queryDir = "source"; //查询的是比对的源数据还是目标数据。默认为源数据
- var win = $(e).parents(".site_device_list");
- var scdinfos = win.find("#node_tree>div");
- $(scdinfos[0]).children("b").html(sourcescdname);
- $(scdinfos[2]).children("b").html(targetscdname);
- layer.msg("正在加载数据中")
- $.getJSON(Global.AccessUrl + "/api/scd/comp/stat/result", {
- comp_id: compId
- }, function(r) {
- if (r.data != null && r.data.length > 0) {
- layer.closeAll();
- var data = {
- "crc": {},
- "version": {},
- "ied": {
- "addnum": 0,
- "editnum": 0,
- "delnum": 0
- }
- };
- PoliceObject.CurrentCompResult = r.data;
- for (var i = 0; i < r.data.length; i++) {
- if (r.data[i]["diff_object_type"] == "scd.crc") {
- var v = JSON.parse(r.data[i]["diff_desc"]);
- if (v != null) {
- data["crc"]["source"] = v[0];
- data["crc"]["target"] = v[1];
- }
- } else if (r.data[i]["diff_object_type"] == "scd.version") {
- var v = JSON.parse(r.data[i]["diff_desc"]);
- if (v != null) {
- data["version"]["source"] = v[0];
- data["version"]["target"] = v[1];
- }
- } else if (r.data[i]["diff_object_type"] == "scd.ied") {
- if (r.data[i]["diff_opt"] == "i") data.ied.addnum++;
- if (r.data[i]["diff_opt"] == "u") data.ied.editnum++;
- if (r.data[i]["diff_opt"] == "d") data.ied.delnum++;
- }
- }
- var html = template('comp_scd_tpl', data);
- var comp_show_area = win.find("#comp_show_area").html(html);
- var iedDiv = comp_show_area.find(".comp_scd:last");
- var ied_change_stat = win.find("#ied_change_stat");
- ied_change_stat.css({
- "top": iedDiv.position().top + iedDiv.height() + 250,
- "left": iedDiv.position().left + iedDiv.width() / 2 - ied_change_stat.width() / 2,
- });
- ied_change_stat.find(".change_btn").off().on('click', function() {
- if ($(this).attr('change_num') == "0") {
- return
- }
- var change_type = $(this).attr("change_type");
- if (change_type == 'u') PoliceObject.CheckTools_Scd_Comp_ied_Detail(compId, sourcescdid, sourcescdname, targetscdname, $(this).attr('change_type'));
- else {
- var iedlist = [];
- for (var i = 0; i < PoliceObject.CurrentCompResult.length; i++) {
- var item = PoliceObject.CurrentCompResult[i];
- if (item.diff_opt == change_type && item.diff_object_type == 'scd.ied') {
- iedlist.push({
- "ied_name": item.ied_name,
- "ied_desc": item.ied_desc,
- "scd_id": change_type == "d" ? targetscdid : sourcescdid,
- });
- }
- }
- //查看新增或删除的IED信息
- DialogObject.Open($("#dialog_public"), {
- size: ["150rem", "72rem"],
- para: {
- "title": iedlist[0].ied_desc + "(" + iedlist[0].ied_name + ")—详细信息",
- "scd_id": change_type == "d" ? targetscdid : sourcescdid,
- "ied_name": iedlist[0].ied_name,
- },
- callback: function(win, p1) {
- win.attr({
- "ied_name": p1.ied_name,
- "scd_id": p1.scd_id
- });
- win.find(".caption>b").html(p1.title);
- var h = (win.height() - win.find(".caption").height() - win.find(".footer").height());
- win.find(".dataitemlist").height(h + "px").html(template('ied_detail_tpl', {}));
- win.find(".content").height(h - win.find(".tools").height() + "px");
- win.find("#ied_list_tree").height(h - 20 * hRate);
- //绑定快速查找
- win.find("#ied_list_tree .fast_find_list").off().on("input propertychange", function() {
- var v = ($(this).val()).toLocaleLowerCase();
- var tarEle = win.find("#ied_list_tree .station_list_item");
- if (v == "") tarEle.removeClass("hidden");
- else {
- tarEle.each(function() {
- var $this = $(this);
- if ($this.text().toLocaleLowerCase().indexOf(v) > -1) $this.removeClass("hidden");
- else $this.addClass("hidden");
- })
- }
- });
- PoliceObject.LoadIedTreeList2(null, iedlist, null);
- PoliceObject.LoadIedGraph(null, PoliceObject.GetIedData(p1.ied_name, p1.scd_id));
- }
- });
- }
- });
- setTimeout(function() {
- var x = iedDiv.position().left + iedDiv.width() / 2;
- var y = iedDiv.position().top + iedDiv.height()
- var h = ied_change_stat.position().top - y;
- comp_show_area.append('<div class="pointer_line" style="left:' + x + 'px;top:' + y + 'px;height:' + h + 'px"></div>')
- iedDiv = ied_change_stat.find(".change_btn:first");
- x = ied_change_stat.position().left + (iedDiv.css("margin-left").replace("px", "") * 2 + 4 + iedDiv.width()) / 2;
- h = 40;
- y = ied_change_stat.position().top - h;
- comp_show_area.append('<div class="pointer_line" style="left:' + x + 'px;top:' + y + 'px;height:' + h + 'px"></div>')
- iedDiv = ied_change_stat.find(".change_btn:last");
- var x3 = ied_change_stat.position().left + (iedDiv.css("margin-left").replace("px", "") * 2 + iedDiv.width() + 4) * 2.5;
- h = 40;
- var y3 = ied_change_stat.position().top - h;
- comp_show_area.append('<div class="pointer_line" style="left:' + x3 + 'px;top:' + y3 + 'px;height:' + h + 'px"></div>')
- comp_show_area.append('<div class="pointer_line" style="left:' + x + 'px;top:' + y + 'px;width:' + (x3 - x) + 'px"></div>')
- }, 100)
- } else if (r.code != 0) {
- layer.msg("加载失败:" + r.msg + ",建议进行重新比对!", {
- icon: Global.ICON_ERROR
- })
- } else {
- layer.msg("当前2个SCD文件没有差异!", {
- icon: Global.ICON_HINT
- });
- win.find("#comp_show_area").html("当前2个SCD文件没有差异!");
- }
- });
- },
- CheckTools_Scd_Comp_ied_Detail: function(compId, sourcescdid, sourcescdname, targetscdname, ctype, ccd_cid_info) {
- DialogObject.Open($("#dialog_public"), {
- size: ["130rem", "65rem"],
- para: {
- "title": "一致性比对结果",
- "type": ctype,
- "compId": compId,
- "sourcescdid": sourcescdid,
- "sourcescdname": ccd_cid_info != null ? ccd_cid_info.info.f1.filename + "—" + ccd_cid_info.info.f1.ct : sourcescdname,
- "targetscdname": ccd_cid_info != null ? ccd_cid_info.info.f2.filename + "—" + ccd_cid_info.info.f2.ct : targetscdname,
- "ccd_cid_info": ccd_cid_info
- },
- callback: function(win, para) {
- win.find(".caption>b").html(para.title);
- var opt = para.type == "i" ? "新增" : (para.type == "u" ? "更改" : "删除");
- var iedlist = [];
- if (para.ccd_cid_info != null) {
- iedlist.push({
- "ied_name": para.ccd_cid_info.info.iedname,
- "ied_desc": para.ccd_cid_info.info.ieddesc
- });
- //根据变更、新增、删除类型排序
- var tmpList = [];
- for (var i = 0; i < para.ccd_cid_info.list.length; i++) {
- if (para.ccd_cid_info.list[i].diff_opt == 'u') {
- tmpList.unshift(para.ccd_cid_info.list[i]);
- } else {
- tmpList.push(para.ccd_cid_info.list[i])
- }
- }
- para.ccd_cid_info.list = tmpList;
- } else {
- for (var i = 0; i < PoliceObject.CurrentCompResult.length; i++) {
- var item = PoliceObject.CurrentCompResult[i];
- if (item.diff_opt == para.type && item.diff_object_type == 'scd.ied') {
- iedlist.push({
- "ied_name": item.ied_name,
- "ied_desc": item.ied_desc
- });
- }
- }
- }
- var compTplName = "comp_scd_ied_tpl"; //对比结果加载模板名称
- if (para.ccd_cid_info != null && (para.ccd_cid_info.file_type == "ccd" || para.ccd_cid_info.file_type == "ccd_scd")) compTplName = "comp_ccd_ied_tpl";
- win.find(".dataitemlist").css("cssText", "padding-top: 1rem !important;").html(template(compTplName, {
- 'opt': opt,
- "list": iedlist,
- "num": iedlist.length
- })).height(win.height() - win.find(".caption").height() - win.find(".footer").height());
- var comp_show_area = $("#comp_ied_result_show");
- var scdinfos = comp_show_area.find("#node_tree>div");
- $(scdinfos[0]).children("b").html(para.sourcescdname);
- $(scdinfos[2]).children("b").html(para.targetscdname);
- var ieddatalist = win.find("#comp_ied_list .ied_data_list");
- ieddatalist.slimScroll({
- height: ieddatalist.height() + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- win.find("#comp_ied_list .ied_comp_items .node").off().on("click", function() {
- var t = $(this);
- if (t.attr("num") == '0') return;
- var t1 = t.parent().find(".node.active").removeClass("active");
- t1.find(".fa").remove();
- t1.prepend('<i class="f_l fa fa-caret-right" />'); //fa存在伪元素,removeclass后有残留,只能用此方法
- t.addClass("active")
- t.parent().find(".children[p_type='" + t1.attr("type") + "']").addClass("hidden");
- t.find(".fa").remove();
- t.prepend('<i class="f_l fa fa-caret-down" />'); //fa存在伪元素,removeclass后有残留,只能用此方法
- t.parent().find(".children[p_type='" + t.attr("type") + "']").removeClass("hidden");
- t.parent().find(".children[p_type='" + t.attr("type") + "'][num!='0']:first").trigger('click');
- });
- win.find("#comp_ied_list .ied_comp_items .node[num!='0']:first").trigger('click');
- win.find("#comp_ied_list .ied_comp_items .children").off().on("click", function() {
- var t = $(this);
- if (t.attr("num") == '0') return;
- t.parent().find(".children.active").removeClass("active");
- t.addClass("active")
- PoliceObject.GetCompItemDetail(win, para.compId, ieddatalist.find(".ied_item.active").attr("ied_name"), para.type, t.attr("type"), sourcescdid)
- });
- var loadIedCompStat = function(data) {
- var ptypeNums = {};
- var scdiedRelationNum = 0; //回路数量
- var eles = win.find("#comp_ied_list .ied_comp_items");
- for (var k in data) {
- var num = data[k] * 1;
- var ele = eles.find(".children[type='" + k + "']").attr("num", num);
- ele.children(".num").html(num);
- var ptypeNum = ptypeNums[ele.attr("p_type")];
- if (ptypeNum == null) ptypeNums[ele.attr("p_type")] = num;
- else ptypeNums[ele.attr("p_type")] = ptypeNum * 1 + num;
- if (k == "scd.ied.ExtRef") scdiedRelationNum = scdiedRelationNum + num;
- }
- for (var k in ptypeNums) {
- var ele = eles.find(".node[type='" + k + "']").attr("num", ptypeNums[k]);
- ele.children(".num").html(ptypeNums[k]);
- }
- if (scdiedRelationNum > 0) {
- var ele = eles.find(".children[type='scd.ied.Relation']").attr("num", scdiedRelationNum);
- ele.children(".num").html(scdiedRelationNum);
- }
- //触发第一个有变化的节点
- win.find("#comp_ied_list .ied_comp_items .node[num!='0']:first").trigger('click');
- }
- if (ccd_cid_info != null) {
- win.ccd_cid_info = ccd_cid_info;
- var numstatdata = {};
- //统计差异类型数量
- for (var i = 0; i < ccd_cid_info.list.length; i++) {
- var diff_object_type = ccd_cid_info.list[i].diff_object_type;
- if (numstatdata[diff_object_type] == null) numstatdata[diff_object_type] = 1;
- else numstatdata[diff_object_type] = numstatdata[diff_object_type] + 1;
- }
- loadIedCompStat(numstatdata);
- ieddatalist.find(".ied_item:first").addClass("active");
- } else {
- ieddatalist.find(".ied_item").off().on("click", function() {
- ieddatalist.find(".ied_item.active").removeClass("active");
- $(this).addClass("active");
- //获取装备差异分类统计
- var eles = win.find("#comp_ied_list .ied_comp_items");
- eles.children("div").each(function() {
- $(this).attr("num", "0").find(".num").html("0")
- });
- $("#comp_ied_result_show .comp_show_area").html('<div>正在加载数据中</div>')
- layer.msg("正在加载数据中", {
- icon: Global.ICON_HINT
- });
- var clickIedName = $(this).attr("ied_name");
- $.getJSON(Global.AccessUrl + "/api/scd/comp/iedstat/type", {
- 'comp_id': para.compId,
- 'ied_name': clickIedName,
- 'comptype': para.type
- }, function(jsondata) {
- layer.closeAll();
- if (jsondata.code != 0) {
- layer.msg(jsondata.msg, {
- icon: Global.ICON_ERROR
- })
- return
- }
- loadIedCompStat(jsondata.data);
- })
- }).eq(0).trigger('click');
- }
- }
- });
- },
- currentCompItem: null, //当前展示差异数据的对象
- GetCompItemDetail: function(win, compid, iedname, ctype, itemcode, sourcescdid) {
- var itemcode_icon = {
- "scd.ied": "icon_baseinfo.png",
- "scd.ied.YC": "icon_yc.png",
- "scd.ied.YX": "icon_yx.png",
- "scd.ied.YK": "icon_yk.png",
- "scd.ied.YM": "icon_ym.png",
- "scd.ied.DZ": "icon_dz.png",
- "scd.ied.FCDA": "icon_publish.png",
- "scd.ied.ExtRef": "icon_sub.png",
- "scd.ied.Relation": "icon_relation.png",
- "scd.ied.ReportControl": "icon_report_block.png",
- "scd.ied.LogControl": "icon_log_block.png",
- "scd.ied.GSEControl": "icon_goose_block.png",
- "scd.ied.goosepub": "icon_goose_block.png",
- "scd.ied.goosesub": "icon_goose_block.png",
- "scd.ied.SampledValueControl": "icon_sv_block.png",
- "scd.ied.svpub": "icon_sv_block.png",
- "scd.ied.svsub": "icon_sv_block.png",
- "scd.ied.Communication": "icon_ap.png",
- "scd.ied.goosepub.Communication": "icon_ap.png",
- "scd.ied.goosesub.Communication": "icon_ap.png",
- "scd.ied.smvpub.Communication": "icon_ap.png",
- "scd.ied.smvsub.Communication": "icon_ap.png",
- "scd.ied.Communication.GSE": "icon_goose.png",
- "scd.ied.goosepub.Communication.GSE": "icon_goose.png",
- "scd.ied.goosesub.Communication.GSE": "icon_goose.png",
- "scd.ied.Communication.SMV": "icon_sv.png",
- "scd.ied.smvpub.Communication.GSE": "icon_sv.png",
- "scd.ied.smvsub.Communication.GSE": "icon_sv.png",
- "scd.ied.Communication.S1": "icon_mms.png",
- "scd.ied.DatSet": "icon_dataset.png",
- "scd.ied.DatSetMeber": "icon_fcda.png",
- "scd.ied.goosepub.FCDA": "icon_fcda.png",
- "scd.ied.goosesub.FCDA": "icon_fcda.png",
- "scd.ied.smvpub.FCDA": "icon_fcda.png",
- "scd.ied.smvsub.FCDA": "icon_fcda.png",
- }
- var extCompAttrName = {
- "DAI": 1,
- "Address": 1,
- "MaxTime": 1,
- "MinTime": 1,
- "lineno": 1,
- "node_id": 1,
- "SDI": 1,
- "TrgOps": 1,
- "OptFields": 1,
- "RptEnabled": 1,
- "Private": 1,
- "GSE": 1,
- "SMV": 1,
- "PhysConn": 1,
- "SmvOpts": 1,
- }
- var tempCacheData = {};
- //绘制指定差异属性的数据图
- var drawDiffMap = function(ele, iedname) {
- var drawFlagId = ele.attr("idno");
- var itemcode = ele.attr("itemcode");
- var item = tempCacheData[itemcode + "_" + drawFlagId]
- if (item == null) return;
- var diff_desc = JSON.parse(item.diff_desc.replace(/\'| /gi, "").replace(/\r|\n|\t/gi, ""));
- if (diff_desc == null) return;
- var itemname = item.diff_object_name;
- var itemchangetype = item.diff_opt;
- if (item.diff_opt == 'u') {
- //ied变化类型
- //比较差异项
- var s1 = (diff_desc[0])
- var t1 = (diff_desc[1])
- s1DaiMap = {};
- t1DaiMap = {};
- var daiList = diff_desc[0]["DAI"];
- if (daiList != null) {
- for (var p = 0; p < daiList.length; p++) {
- s1DaiMap[daiList[p]["Name"]] = $.trim(daiList[p]["Val"].InnerText);
- }
- }
- daiList = diff_desc[1]["DAI"];
- if (daiList != null) {
- for (var p = 0; p < daiList.length; p++) {
- t1DaiMap[daiList[p]["Name"]] = $.trim(daiList[p]["Val"].InnerText)
- }
- }
- if (diff_desc[0]["P"] != null) {
- for (var p = 0; p < diff_desc[0]["P"].length; p++) {
- var vitem = diff_desc[0]["P"][p];
- s1DaiMap[vitem.Type] = $.trim(vitem.InnerText);
- s1[vitem.Type] = s1DaiMap[vitem.Type]
- }
- delete(s1["P"]);
- }
- if (diff_desc[0]["Address"] != null && diff_desc[0]["Address"]["P"] != null) {
- for (var p = 0; p < diff_desc[0]["Address"]["P"].length; p++) {
- var vitem = diff_desc[0]["Address"]["P"][p];
- s1DaiMap[vitem.Type] = $.trim(vitem.InnerText);
- s1[vitem.Type] = s1DaiMap[vitem.Type]
- }
- delete(s1["Address"]);
- }
- if (diff_desc[0]["MaxTime"] != null) {
- s1DaiMap["MaxTime"] = $.trim(diff_desc[0]["MaxTime"].InnerText);
- s1DaiMap["MinTime"] = $.trim(diff_desc[0]["MinTime"].InnerText);
- }
- if (diff_desc[1]["P"] != null) {
- for (var p = 0; p < diff_desc[1]["P"].length; p++) {
- var vitem = diff_desc[1]["P"][p];
- t1DaiMap[vitem.Type] = $.trim(vitem.InnerText);
- t1[vitem.Type] = t1DaiMap[vitem.Type]
- }
- delete(t1["P"]);
- }
- if (diff_desc[1]["Address"] != null && diff_desc[1]["Address"]["P"] != null) {
- for (var p = 0; p < diff_desc[1]["Address"]["P"].length; p++) {
- var vitem = diff_desc[1]["Address"]["P"][p];
- t1DaiMap[vitem.Type] = $.trim(vitem.InnerText);
- t1[vitem.Type] = t1DaiMap[vitem.Type]
- }
- delete(t1["Address"]);
- }
- if (diff_desc[1]["MaxTime"] != null) {
- t1DaiMap["MaxTime"] = $.trim(diff_desc[1]["MaxTime"].InnerText);
- t1DaiMap["MinTime"] = $.trim(diff_desc[1]["MinTime"].InnerText);
- }
- var diffresult = Tools.GetMapDiffItems(s1DaiMap, t1DaiMap)
- for (var k in s1) {
- if (extCompAttrName[k] != null) {
- for (var c1 in s1[k]) {
- if (JSON.stringify(s1[k][c1]) != JSON.stringify(t1[k][c1])) {
- diffresult.edit[k + "." + c1] = [s1[k][c1] || '[空]', t1[k][c1] || '[空]'];
- diffresult._edit_cnt++;
- }
- }
- continue
- }
- if (s1[k] != t1[k]) {
- diffresult.edit[k] = [s1[k] || '[空]', t1[k] || '[空]'];
- diffresult._edit_cnt++;
- }
- }
- //绘制修改的项
- if (diffresult._edit_cnt > 0) PoliceObject.MakeComp(iedname, itemcode, drawFlagId, itemname, item.diff_opt, 'u', diffresult.edit);
- //绘制新增的项
- if (diffresult._add_cnt > 0) PoliceObject.MakeComp(iedname, itemcode, drawFlagId, itemname, item.diff_opt, 'i', diffresult.add);
- //绘制删除的项
- if (diffresult._del_cnt > 0) PoliceObject.MakeComp(iedname, itemcode, drawFlagId, itemname, item.diff_opt, 'd', diffresult.del);
- } else if (item.diff_opt == 'i') {
- if (diff_desc["RptEnabled"] != null) diff_desc["RptEnabled.Max"] = diff_desc["RptEnabled"]["Max"]
- var obj = {}
- if (diff_desc["P"] != null) {
- for (var p = 0; p < diff_desc["P"].length; p++) {
- var vitem = diff_desc["P"][p];
- diff_desc[vitem.Type] = $.trim(vitem.InnerText);
- }
- delete(diff_desc["P"]);
- }
- if (diff_desc["Address"] != null && diff_desc["Address"]["P"] != null) {
- for (var p = 0; p < diff_desc["Address"]["P"].length; p++) {
- var vitem = diff_desc["Address"]["P"][p];
- diff_desc[vitem.Type] = $.trim(vitem.InnerText);
- }
- delete(diff_desc["Address"]);
- }
- for (var k in diff_desc) {
- if (extCompAttrName[k] == null) obj[k] = diff_desc[k];
- }
- diffresult = {
- "add": obj
- }
- //绘制数据变化图
- PoliceObject.MakeComp(iedname, itemcode, drawFlagId, itemname, item.diff_opt, 'i', diffresult.add);
- } else if (item.diff_opt == 'd') {
- var obj = {}
- if (diff_desc["P"] != null) {
- for (var p = 0; p < diff_desc["P"].length; p++) {
- var vitem = diff_desc["P"][p];
- diff_desc[vitem.Type] = $.trim(vitem.InnerText);
- }
- delete(diff_desc["P"]);
- }
- if (diff_desc["Address"] != null && diff_desc["Address"]["P"] != null) {
- for (var p = 0; p < diff_desc["Address"]["P"].length; p++) {
- var vitem = diff_desc["Address"]["P"][p];
- diff_desc[vitem.Type] = $.trim(vitem.InnerText);
- }
- delete(diff_desc["Address"]);
- }
- for (var k in diff_desc) {
- if (extCompAttrName[k] == null) obj[k] = diff_desc[k];
- }
- diffresult = {
- "del": obj
- }
- //绘制数据变化图
- PoliceObject.MakeComp(iedname, itemcode, drawFlagId, itemname, item.diff_opt, 'd', diffresult.del);
- }
- }
- var loadCompResult = function(iedname, itemcode, resultData) {
- var comp_show_area = $("#comp_ied_result_show .comp_show_area");
- comp_show_area.attr("itemcode", itemcode).html(template('comp_ied_result_show_tpl', {}));
- var vh = comp_show_area.height();
- comp_show_area.slimScroll({
- height: (vh * 0.99) + "px",
- width: "98%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- comp_show_area.css("width", "100%").find(".comp_ied_result_split_line");
- if (itemcode == "scd.ied.Relation") {
- //虚回路
- resultData.sort(Tools.SortBy("no", true));
- PoliceObject.drawIedInputsRelation(sourcescdid, PoliceObject.GetIedData(iedname, sourcescdid), comp_show_area, resultData);
- return
- }
- var source_ied = comp_show_area.find(".source_ied .ied_name").html(iedname).parent();
- var target_ied = comp_show_area.find(".target_ied .ied_name").html(iedname).parent();
- var drawFlagId = {};
- var nosameitem = {};
- //基础信息显示
- if (itemcode == "scd.ied") {
- if (ctype == 'u') {
- //比较差异项
- for (var k in resultData[0]) {
- if (k == "lineno" || k == "node_id") continue;
- if (resultData[0][k] != resultData[1][k]) {
- nosameitem[k] = [resultData[0][k] || '[空]', resultData[1][k] || '[空]'];
- }
- }
- } else {
- for (var k in resultData[0]) {
- if (k == "lineno" || k == "node_id") continue;
- nosameitem[k] = resultData[0][k] || '[空]';
- }
- }
- tempCacheData[itemcode + "_9999"] = item;
- var itemname = "基本信息";
- var itemchangetype = 'u'
- comp_show_area.append('<div itemopt="u" itemcode="' + itemcode + '" idno=9999 class="typeele" dir="source"><img class="type_icon" src="/static/images/comp_scd/' + itemcode_icon[itemcode] + '"><div class="type_name color_' + itemchangetype + '">' + itemname + '</div><span class="state_icon state_icon_' + itemchangetype + '"></span></div>')
- comp_show_area.append('<div itemopt="u" itemcode="' + itemcode + '" idno=9999 class="typeele" dir="target"><img class="type_icon" src="/static/images/comp_scd/' + itemcode_icon[itemcode] + '"><div class="type_name color_' + itemchangetype + '">' + itemname + '</div><span class="state_icon state_icon_' + itemchangetype + '"></span></div>')
- setTimeout(function() {
- comp_show_area.find(".typeele[dir='source']:first").trigger('click');
- PoliceObject.MakeComp(iedname, itemcode, 9999, itemname, 'u', ctype, nosameitem);
- }, 300)
- } else {
- for (var i = 0; i < resultData.length; i++) {
- var item = resultData[i];
- //console.log(item.diff_desc.replace(/\'| /gi, "").replace(/\r|\n|\t/gi, "a"))
- var diff_desc = JSON.parse(item.diff_desc.replace(/\'| /gi, "").replace(/\r|\n|\t/gi, ""));
- if (diff_desc == null) continue;
- var itemname = item.diff_object_name;
- var itemchangetype = item.diff_opt;
- drawFlagId[itemcode + i] = 1001 + (i * 100000) //当前类型将绘制元素的起始id号及差异项代码
- tempCacheData[itemcode + "_" + drawFlagId[itemcode + i]] = item;
- if (item.diff_opt == 'u') {
- comp_show_area.append('<div itemopt="u" itemcode="' + itemcode + '" idno=' + drawFlagId[itemcode + i] + ' title="' + itemname + '" class="typeele" dir="source"><img class="type_icon" src="/static/images/comp_scd/' + itemcode_icon[itemcode] + '"><div class="type_name color_' + itemchangetype + '">' + itemname + '</div><span class="state_icon state_icon_' + itemchangetype + '"></span></div>')
- comp_show_area.append('<div itemopt="u" itemcode="' + itemcode + '" idno=' + drawFlagId[itemcode + i] + ' title="' + itemname + '" class="typeele" dir="target"><img class="type_icon" src="/static/images/comp_scd/' + itemcode_icon[itemcode] + '"><div class="type_name color_' + itemchangetype + '">' + itemname + '</div><span class="state_icon state_icon_' + itemchangetype + '"></span></div>')
- } else if (item.diff_opt == 'i') {
- comp_show_area.append('<div itemopt="i" itemcode="' + itemcode + '" idno=' + drawFlagId[itemcode + i] + ' title="' + itemname + '" class="typeele" dir="source"><img class="type_icon" src="/static/images/comp_scd/' + itemcode_icon[itemcode] + '"><div class="type_name color_' + itemchangetype + '">' + itemname + '</div><span class="state_icon state_icon_' + itemchangetype + '"></span></div>')
- } else if (item.diff_opt == 'd') {
- comp_show_area.append('<div itemopt="d" itemcode="' + itemcode + '" idno=' + drawFlagId[itemcode + i] + ' title="' + itemname + '" class="typeele" dir="target"><img class="type_icon" src="/static/images/comp_scd/' + itemcode_icon[itemcode] + '"><div class="type_name color_' + itemchangetype + '">' + itemname + '</div><span class="state_icon state_icon_' + itemchangetype + '"></span></div>')
- }
- }
- //drawDiffMap(comp_show_area.find(".typeele:first"), iedname);
- }
- var iedFirstLineWidth = 40;
- var iedItemLineWidth = 20;
- //重新排列基准SCD中的typeele
- var totlcnt = comp_show_area.find(".typeele[dir='source']").length;
- if (totlcnt >= 1) {
- //绘制IED与差异之前的连线
- var sourceIedLine = PoliceObject.drawDivLine(comp_show_area, [source_ied.position().left + source_ied.width(), source_ied.position().top + source_ied.css("margin-top").replace("px", "") * 1 + source_ied.height() / 2], [iedFirstLineWidth, null],
- "source_ied_first_line",
- "bgcolor_0"
- );
- var sourceIedLineXY = sourceIedLine.position();
- var one = comp_show_area.find(".typeele[dir='source']:first");
- var left = sourceIedLineXY.left + iedFirstLineWidth + iedItemLineWidth;
- var sigleH = one.height() + one.css("margin-top").replace("px", "") * 1;
- var totalH = totlcnt * sigleH;
- var inith = 0; //初始化top
- if (totalH >= vh) {
- inith = 60;
- comp_show_area.find(".comp_ied_result_split_line").height(inith + 30 + sigleH * totlcnt);
- } else {
- if (totlcnt > 1) inith = (vh - totalH) / 2;
- else inith = sourceIedLineXY.top - sigleH / 2;
- }
- var preEle = null;
- var firstEle = null;
- comp_show_area.find(".typeele[dir='source']").each(function(index) {
- var t = $(this);
- t.on('click', function() {
- var t = $(this);
- if (PoliceObject.currentCompItem != null) {
- var oldIDNo = PoliceObject.currentCompItem.attr("idno");
- comp_show_area.find(".typeele.active").removeClass("active");
- comp_show_area.find(".typeele[dir='target'][idno='" + oldIDNo + "']").removeClass("active");
- //清除之前绘制的元素
- comp_show_area.children("div[flagid='" + oldIDNo + "']").remove();
- }
- PoliceObject.currentCompItem = t.addClass("active");
- comp_show_area.find(".typeele[dir='target'][idno='" + t.attr("idno") + "']").addClass("active");
- //点击差异属性,切换展示数据数据图
- //绘制点击元素的数据图
- var currentCompItemXY = PoliceObject.currentCompItem.position();
- //如果当前元素top为负时,需要自动将画布向上滚动一定距离,至少保证top为不负数
- if (currentCompItemXY.top < 60) {
- var scrollHeight = PoliceObject.currentCompItem.attr("oldtop") * 1 - currentCompItemXY.top;
- comp_show_area.slimScroll({
- scrollTo: scrollHeight - 100
- });
- setTimeout(function() {
- //当点击元素处于非完全可见时(即top为负时),需要延时绘图,等滚动条自动滚动完成,否则获取到的位置不正确
- drawDiffMap(t, iedname);
- }, 300)
- return;
- }
- drawDiffMap(t, iedname);
- });
- var newtop = inith;
- if (preEle == null)
- t.css({
- "top": inith,
- "left": left
- });
- else {
- newtop = preEle.position().top + (preEle.height() + preEle.css("margin-top").replace("px", "") * 1);
- t.css({
- "top": newtop,
- "left": left
- });
- }
- if (firstEle == null) firstEle = t;
- preEle = t.attr("oldtop", newtop);
- PoliceObject.drawDivLine(comp_show_area, [sourceIedLineXY.left + sourceIedLine.width(), newtop + (t.height() + t.css("margin-top").replace("px", "") * 1) / 2], [iedItemLineWidth, null],
- "source_ied_item_line_" + index,
- "bgcolor_0"
- );
- })
- var lineH = preEle.position().top - firstEle.position().top;
- PoliceObject.drawDivLine(comp_show_area, [sourceIedLineXY.left + sourceIedLine.width(), firstEle.position().top + (firstEle.css("margin-top").replace("px", "") * 1 + firstEle.height()) / 2], [null, lineH],
- "source_ied_item_line",
- "bgcolor_0"
- );
- }
- //重新排列比对SCD中的typeele
- var targettotlcnt = comp_show_area.find(".typeele[dir='target']").length;
- if (targettotlcnt >= 1) {
- //绘制IED与差异之前的连线
- var targetIedLine = PoliceObject.drawDivLine(comp_show_area, [target_ied.position().left - iedFirstLineWidth, target_ied.position().top + target_ied.css("margin-top").replace("px", "") * 1 + target_ied.height() / 2], [iedFirstLineWidth, null],
- "target_ied_first_line",
- "bgcolor_0"
- );
- var targetIedLineXY = targetIedLine.position();
- var one = comp_show_area.find(".typeele[dir='target']:first");
- var left = targetIedLineXY.left - iedItemLineWidth;
- var sigleH = one.height() + one.css("margin-top").replace("px", "") * 1;
- var totalH = targettotlcnt * sigleH;
- var inith = 0; //初始化top
- if (totalH >= vh) {
- inith = 60;
- if (comp_show_area.find(".comp_ied_result_split_line").height() < totalH) {
- comp_show_area.find(".comp_ied_result_split_line").height(inith + 30 + sigleH * totlcnt);
- }
- } else {
- if (targettotlcnt > 1) inith = (vh - totalH) / 2;
- else inith = targetIedLineXY.top - sigleH / 2;
- }
- var preEle = null;
- var firstEle = null;
- comp_show_area.find(".typeele[dir='target']").each(function(index) {
- var t = $(this);
- if (t.attr("itemopt") == "d") {
- t.on('click', function() {
- var t = $(this);
- if (PoliceObject.currentCompItem != null) {
- var oldIDNo = PoliceObject.currentCompItem.attr("idno");
- comp_show_area.find(".typeele.active").removeClass("active");
- comp_show_area.find(".typeele[dir='source'][idno='" + oldIDNo + "']").removeClass("active");
- //清除之前绘制的元素
- comp_show_area.children("div[flagid='" + oldIDNo + "']").remove();
- }
- PoliceObject.currentCompItem = t.addClass("active");
- comp_show_area.find(".typeele[dir='source'][idno='" + t.attr("idno") + "']").addClass("active");
- //点击差异属性,切换展示数据数据图
- //绘制点击元素的数据图
- var currentCompItemXY = PoliceObject.currentCompItem.position();
- //如果当前元素top为负时,需要自动将画布向上滚动一定距离,至少保证top为不负数
- if (currentCompItemXY.top < 60) {
- var scrollHeight = PoliceObject.currentCompItem.attr("oldtop") * 1 - currentCompItemXY.top;
- comp_show_area.slimScroll({
- scrollTo: scrollHeight - 100
- });
- setTimeout(function() {
- //当点击元素处于非完全可见时(即top为负时),需要延时绘图,等滚动条自动滚动完成,否则获取到的位置不正确
- drawDiffMap(t, iedname);
- //调整当前查看的差异属性连线位置
- var scrollHeight = PoliceObject.currentCompItem.attr("oldtop") * 1 - PoliceObject.currentCompItem.position().top;
- var itemAttrsSourcelineEle = comp_show_area.find("#" + t.attr("idno") + "_item_attrs_target").css("top", scrollHeight + t.position().top + t.height() / 2);
- var itemAttrsSourceAlllineEle = comp_show_area.find("#" + t.attr("idno") + "_item_attrs_target_all");
- if (itemAttrsSourceAlllineEle.position().top > itemAttrsSourcelineEle.position().top) {
- itemAttrsSourceAlllineEle.css({
- "top": itemAttrsSourcelineEle.position().top,
- "height": itemAttrsSourceAlllineEle.position().top - itemAttrsSourcelineEle.position().top
- })
- }
- }, 300)
- return;
- }
- drawDiffMap(t, iedname);
- var deallist = ["target"];
- for (var di = 0; di < deallist.length; di++) {
- //调整当前查看的差异属性连线位置
- var scrollHeight = PoliceObject.currentCompItem.attr("oldtop") * 1 - PoliceObject.currentCompItem.position().top;
- var itemAttrsSourcelineEle = comp_show_area.find("#" + t.attr("idno") + "_item_attrs_" + deallist[di]).css("top", scrollHeight + t.position().top + t.height() / 2);
- var itemAttrsSourceAlllineEle = comp_show_area.find("#" + t.attr("idno") + "_item_attrs_" + deallist[di] + "_all");
- if (itemAttrsSourceAlllineEle.position().top > itemAttrsSourcelineEle.position().top) {
- itemAttrsSourceAlllineEle.css({
- "top": itemAttrsSourcelineEle.position().top,
- "height": itemAttrsSourceAlllineEle.position().top - itemAttrsSourcelineEle.position().top
- })
- }
- }
- });
- }
- var newtop = inith;
- if (preEle == null)
- t.css({
- "top": inith,
- "left": left - t.width()
- });
- else {
- newtop = preEle.position().top + (preEle.height() + preEle.css("margin-top").replace("px", "") * 1);
- t.css({
- "top": newtop,
- "left": left - t.width()
- });
- }
- if (firstEle == null) firstEle = t;
- preEle = t.attr("oldtop", newtop);
- PoliceObject.drawDivLine(comp_show_area, [targetIedLineXY.left - iedItemLineWidth, newtop + (t.height() + t.css("margin-top").replace("px", "") * 1) / 2], [iedItemLineWidth, null],
- "target_ied_item_line_" + index,
- "bgcolor_0"
- );
- })
- var lineH = preEle.position().top - firstEle.position().top;
- PoliceObject.drawDivLine(comp_show_area, [targetIedLineXY.left, firstEle.position().top + (firstEle.css("margin-top").replace("px", "") * 1 + firstEle.height()) / 2], [null, lineH],
- "target_ied_item_line",
- "bgcolor_0"
- );
- }
- if (totlcnt > 0) {
- comp_show_area.find(".typeele[dir='source']:first").trigger('click');
- } else {
- //如果基准scd侧没有变化的元素,则默认自动点击对比侧第一个元素
- comp_show_area.find(".typeele[dir='target']:first").trigger('click');
- }
- layer.closeAll();
- }
- this.currentCompItem = null;
- layer.msg("正在加载数据中");
- if (win.ccd_cid_info != null) {
- var datalist = [];
- for (var i = 0; i < win.ccd_cid_info.list.length; i++) {
- if (win.ccd_cid_info.list[i].diff_object_type == itemcode) {
- if (itemcode == "scd.ied") {
- //转换ied基本差异信息
- var diff_desc = JSON.parse(win.ccd_cid_info.list[i].diff_desc.replace(/\'| /gi, "").replace(/\r|\n|\t/gi, ""));
- if (diff_desc == null) continue;
- datalist = diff_desc;
- } else {
- datalist.push(win.ccd_cid_info.list[i]);
- }
- }
- }
- loadCompResult(iedname, itemcode, datalist);
- } else {
- $.getJSON(Global.AccessUrl + "/api/scd/comp/result", {
- comp_id: compid,
- ied_name: iedname,
- comptype: ctype,
- itemcode: itemcode
- }, function(jsondata) {
- if (jsondata.code != 0) {
- layer.msg(jsondata.msg, {
- icon: Global.ICON_ERROR
- })
- return
- }
- loadCompResult(iedname, itemcode, jsondata.data);
- });
- }
- },
- MakeComp: function(iedname, itemcode, flagId, itemname, itemchangetype, ctype, nosameitem) {
- var comp_show_area = $("#comp_ied_result_show .comp_show_area");
- var sourceied = comp_show_area.find(".source_ied .ied_name").parent();
- var targetied = comp_show_area.find(".target_ied .ied_name").parent();
- //生成详细项.先确定细项位置
- var v_top = 60; //初始位置
- var scrollHeight = 0; //滚动条滚动距离
- if (PoliceObject.currentCompItem != null) {
- var currentCompItemXY = PoliceObject.currentCompItem.position(); //当前元素的当前位置。当滚动了画布时,以当前为置为准
- v_top = PoliceObject.currentCompItem.attr("oldtop") * 1;
- scrollHeight = v_top - currentCompItemXY.top;
- }
- var detailItemtotalH = 0;
- var detailItems = null;
- var firstDetailItem = null;
- var detailItemsCount = 0;
- for (var k in nosameitem) {
- var attrDesc = Global.SCD_COMP_ATTR_CONST["ied." + k]
- if (attrDesc == null) attrDesc = k;
- if (ctype == 'u') {
- //属性修改
- detailItems = $('<div flagId="' + flagId + '" attr_name="' + attrDesc + '" style="left:50%;margin-left:-13rem;top:' + (v_top) + 'px;color:#09162C;font-weight:bold;" class="comp_scd_detail_item bordercolor_' + ctype + '"><div style="width:40%">' + (nosameitem[k][0] == "" ? "[空]" : nosameitem[k][0]) + '</div><div style="width:17%"><img class="allow_img" src="/static/images/comp_scd/allow_edit.png"></div><div style="width:40%">' + (nosameitem[k][1] == "" ? "[空]" : nosameitem[k][1]) + '</div></div>');
- } else if (ctype == 'i') {
- //属性新增
- detailItems = $('<div flagId="' + flagId + '" attr_name="' + attrDesc + '" style="left:37%;margin-left:0;width:10rem;top:' + (v_top) + 'px;color:#09162C;font-weight:bold;" class="comp_scd_detail_item bordercolor_' + ctype + '"><div style="width:100%">' + (nosameitem[k] == "" ? "[空]" : nosameitem[k]) + '</div></div>');
- } else {
- //属性删除
- detailItems = $('<div flagId="' + flagId + '" attr_name="' + attrDesc + '" style="left:52%;margin-left:0;width:10rem;top:' + (v_top) + 'px;color:#09162C;font-weight:bold;" class="comp_scd_detail_item bordercolor_' + ctype + '"><div style="width:100%">' + (nosameitem[k] == "" ? "[空]" : nosameitem[k]) + '</div></div>');
- }
- comp_show_area.append(detailItems)
- if (firstDetailItem == null) firstDetailItem = detailItems;
- v_top = detailItems.position().top + detailItems.height() + 50 + scrollHeight;
- detailItemsCount++;
- }
- if (detailItems == null) return;
- detailItemtotalH = detailItems.position().top + detailItems.height() - firstDetailItem.position().top;
- //重新计算初始位置 ,使其显示的中间
- var vh = comp_show_area.height();
- //根据当前点击的变化属性元素,计算出需要上下移动的距离
- var v_top_new = 60;
- if (vh >= detailItemtotalH) {
- v_top_new = (vh - detailItemtotalH) / 2;
- }
- var lineFirstXY = null; //基准侧第一个属性元素框
- var lineEndXY = null; //基准侧最后一属性元素框
- var lineFirstXY_right = null; //比对侧第一个属性元素框
- var lineEndXY_right = null; //比对侧最后一属性元素框
- var currentCompItemXY = PoliceObject.currentCompItem.position();
- var one = comp_show_area.find(".comp_scd_detail_item:first");
- one.css("top", scrollHeight + currentCompItemXY.top - 100);
- var lastEle = one;
- var oneXY = one.position();
- var topSub = v_top_new - oneXY.top;
- comp_show_area.find(".comp_scd_detail_item").each(function() {
- var t = $(this);
- if (detailItemsCount > 1) {
- //微调差异内容框top位置
- if (lastEle == null) {
- var tmpTop = t.css("top").replace("px", "") * 1 + (topSub);
- if (t.next().length == 0 && tmpTop > currentCompItemXY.top) {
- tmpTop = tmpTop - topSub; //还原top
- }
- } else {
- tmpTop = scrollHeight + lastEle.position().top + lastEle.height() + 40;
- }
- } else {
- var tmpTop = scrollHeight + currentCompItemXY.top + (PoliceObject.currentCompItem.height() / 2) + 1 - (t.height() + 4) / 2;
- }
- t.css("top", tmpTop);
- lastEle = t;
- var txy = t.position();
- var newTop = scrollHeight + txy.top + t.css("padding-top").replace("px", "") * 1 + t.height() / 2;
- //绘制差异内容框与元素之间的连接线
- if (ctype == 'u' || ctype == 'i') {
- //基准SCD
- var tMarginleft = txy.left + t.css("margin-left").replace("px", "") * 1
- var line = PoliceObject.drawDivLine(comp_show_area, [tMarginleft - 100, newTop], [100, null], null, "bgcolor_" + ctype);
- line.attr({
- "flagId": flagId
- })
- }
- if (ctype == 'u' || ctype == 'd') {
- var tMarginleft = txy.left + t.css("margin-left").replace("px", "") * 1
- //比对SCD,其中4为左右边框总宽度
- var right_left = tMarginleft + t.width() + t.css("padding-right").replace("px", "") * 2 + 4;
- var line = PoliceObject.drawDivLine(comp_show_area, [right_left, newTop], [100, null], null, "bgcolor_" + ctype);
- line.attr({
- "flagId": flagId
- })
- }
- //绘制差异项名称
- if (ctype == 'u' || ctype == 'i') {
- //基准SCD
- comp_show_area.append('<div flagId="' + flagId + '" class="abs comp_scd_detail_item_attrtag bordercolor_' + ctype + ' color_' + ctype + '" style="left:' + (tMarginleft - 100 + 20) + 'px;top:' + (newTop - 13) + 'px;">' + t.attr('attr_name') + '</div>');
- }
- if (ctype == 'u' || ctype == 'd') {
- //比对SCD
- comp_show_area.append('<div flagId="' + flagId + '" class="abs comp_scd_detail_item_attrtag bordercolor_' + ctype + ' color_' + ctype + '" style="left:' + (line.position().left + 20) + 'px;top:' + (newTop - 13) + 'px;">' + t.attr('attr_name') + '</div>');
- }
- if (ctype == 'u' || ctype == 'i') {
- if (lineFirstXY == null) lineFirstXY = [tMarginleft - 100, newTop];
- lineEndXY = [tMarginleft - 100, newTop];
- }
- if (ctype == 'u' || ctype == 'd') {
- if (lineFirstXY_right == null) lineFirstXY_right = [right_left + line.width(), newTop];
- lineEndXY_right = [right_left + line.width(), newTop];
- }
- });
- //绘制当前点击差异属性元素与内容项之间的连接线
- if (ctype == 'u' || ctype == 'i') {
- var lineEle2 = PoliceObject.drawDivLine(comp_show_area, lineFirstXY, [null, lineEndXY[1] - lineFirstXY[1]], flagId + "_item_attrs_source_all", "bgcolor_" + ctype);
- lineEle2.attr({
- "flagId": flagId
- })
- var currEleXY = PoliceObject.currentCompItem.position();
- var v_x = currEleXY.left + PoliceObject.currentCompItem.width() + PoliceObject.currentCompItem.css("border-width").replace("px", "") * 2;
- var lineEle = PoliceObject.drawDivLine(comp_show_area, [v_x, scrollHeight + currEleXY.top - 1 + PoliceObject.currentCompItem.css("margin-top").replace("px", "") * 1 + PoliceObject.currentCompItem.height() / 2], [lineFirstXY[0] - v_x, null], flagId + "_item_attrs_source", "bgcolor_" + ctype);
- lineEle.attr({
- "flagId": flagId
- })
- if (lineEle2.height() == 0) {
- if (lineFirstXY[1] > scrollHeight + lineEle.position().top) lineFirstXY[1] = lineEle.position().top
- lineEle2.css({
- "top": lineFirstXY[1],
- "height": lineEndXY[1] - lineFirstXY[1]
- });
- }
- }
- if (ctype == 'u' || ctype == 'd') {
- var currEle = comp_show_area.find(".typeele[dir='target'][idno='" + PoliceObject.currentCompItem.attr("idno") + "']");
- if (currEle.length > 0) {
- //绘制与比对ied差异项元素之间的连接线
- var lineEle2 = PoliceObject.drawDivLine(comp_show_area, lineFirstXY_right, [null, lineEndXY_right[1] - lineFirstXY_right[1]], flagId + "_item_attrs_target_all", "bgcolor_" + ctype);
- lineEle2.attr({
- "flagId": flagId
- })
- var li1 = $("#" + PoliceObject.currentCompItem.attr("idno") + "_item_attrs_target_all")
- var v_x = li1.position().left
- var lineEle = PoliceObject.drawDivLine(comp_show_area, [v_x, scrollHeight + currEle.position().top - 1 + currEle.css("margin-top").replace("px", "") * 1 + currEle.height() / 2], [currEle.position().left - v_x, null], flagId + "_item_attrs_target", "bgcolor_" + ctype);
- lineEle.attr({
- "flagId": flagId
- })
- if (lineEle2.height() == 0) {
- if (lineFirstXY_right[1] > scrollHeight + lineEle.position().top) lineFirstXY_right[1] = lineEle.position().top
- lineEle2.css({
- "top": lineFirstXY_right[1],
- "height": lineEndXY_right[1] - lineFirstXY_right[1]
- });
- }
- }
- }
- var maxH = 0;
- if (lineEndXY != null) {
- var typeeleLast = comp_show_area.find(".typeele[dir='source']:last");
- var typeeleLastY = typeeleLast.position().top + typeeleLast.height();
- maxH = lineEndXY[1];
- if (maxH < typeeleLastY) maxH = typeeleLastY;
- }
- if (lineEndXY_right != null) {
- var tmpH = lineEndXY_right[1];
- var typeeleLast = comp_show_area.find(".typeele[dir='target']:last");
- var typeeleLastY = typeeleLast.position().top + typeeleLast.height();
- if (maxH < tmpH) maxH = tmpH;
- if (maxH < typeeleLastY) maxH = typeeleLastY;
- }
- maxH = maxH + 74;
- var splitLine = comp_show_area.find(".comp_ied_result_split_line");
- if (maxH > splitLine.height()) splitLine.height(maxH);
- },
- drawDivLine: function(parentele, fromXY, toWH, lineid, color) {
- var id = (lineid == null ? ("L" + (parseInt(fromXY[0]) + "_" + parseInt(fromXY[1]))) : lineid);
- while (parentele.find("#" + id).length > 0) {
- id = id + (parentele.find("#" + id).length + 1)
- }
- parentele.append('<div class="pointer_line" id="' + id + '"></div>')
- var line = parentele.find("#" + id);
- if (color != null) line.addClass(color);
- line.css({
- left: fromXY[0],
- top: fromXY[1],
- width: toWH[0] == null ? 1 : toWH[0],
- height: toWH[1] == null ? 1 : toWH[1],
- });
- return line;
- },
- subNetworkIsLoading: false,
- GetSubNetwork: function() {
- if (this.subNetworkIsLoading) {
- return;
- }
- this.subNetworkIsLoading = true;
- var network = $("#container_map_ied #network").html("");
- network.css("top", 20 * hRate);
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": PoliceObject.ScdID,
- "pagesize": 10000,
- "name": "SubNetwork"
- }, function(r) {
- PoliceObject.subNetworkIsLoading = false;
- if (r.data == null) return;
- var avgWidth = 100 / r.data.length;
- for (var i = 0; i < r.data.length; i++) {
- network.append('<div class="network_item" style="width:' + avgWidth + '%" network_id="' + r.data[i].node_id + '"><img style="width: 10rem;" src="/static/images/network_hub.png"><div class="network_desc">' + r.data[i].attr_desc + '</div><div class="network_name">' + r.data[i].attr_name + '</div></div>');
- }
- network.find(".network_item").off().on("click", function() {
- network.find(".active").removeClass("active");
- loadNetworkAPInfo($(this).attr('network_id'));
- });
- network.append('<div class="network_ap aplist">正在加载数据中</div>');
- network.append('<div class="network-iedlist"></div>');
- var loadNetworkAPInfo = function(networkid) {
- var loadApInfo = [];
- var $aplistEle = $("#network .network_ap").attr("networkid", networkid).html("");
- var ledlist = $("#network .network-iedlist").html("<div class='f_l' style='margin-left:6%'></div>");
- $("#network .network-line").remove();
- $("#network .network-ied-line").remove();
- $("#network .network-ied-line2").remove();
- for (var key in PoliceObject.NetWork_ApNodes) {
- if (networkid == null || key.indexOf(networkid) > -1) {
- networkid = key.split(".")[0];
- loadApInfo.push(PoliceObject.NetWork_ApNodes[key]);
- }
- }
- var sourceNetworkEle = network.find(".network_item[network_id='" + networkid + "']").addClass("active");
- if (loadApInfo.length == 0) {
- return;
- }
- for (var i = 0; i < loadApInfo.length; i++) {
- var apname = loadApInfo[i].attr_ap_name;
- $aplistEle.append('<div class="sub_line ' + apname + '" apname="' + apname + '" style="top:' + ((i + 1) * 2) + 'rem"><span class="line-apname ' + apname + '">' + apname + '</span></div>')
- }
- $aplistEle.css("height", loadApInfo.length * 22 + "px").find(".sub_line").off().on('click', function() {
- //单击总线,只显示该总线的设备
- if ($aplistEle.find(".sub_line").length < 2) return;
- var tmp1 = $(this);
- tmp1.parent().find(".sub_line").css("opacity", 0.3);
- tmp1.css("opacity", 1);
- var ishow = $.trim(tmp1.attr("ishow"));
- var v_apname = tmp1.attr("apname");
- ishow = ishow == "" || ishow == "1" ? "0" : "1";
- tmp1.attr("ishow", ishow);
- $("#network .network-line").each(function() {
- var t = $(this);
- t.css("opacity", t.attr("apname") == v_apname ? 1 : 0.3);
- /*if (t.attr("apname") == v_apname) {
- if (ishow == "0") t.addClass("hidden");
- else t.removeClass("hidden");
- t.css("opacity", 1);
- }*/
- });
- $("#network .network-ied-line").each(function() {
- var t = $(this);
- if (t.attr("apname") == v_apname) t.removeClass("hidden");
- else t.addClass("hidden");
- //t.css("opacity", t.attr("apname") == v_apname ? 1 : 0.2);
- /*if (t.attr("apname") == v_apname) {
- if (ishow == "0") t.addClass("hidden");
- else t.removeClass("hidden");
- t.css("opacity", 1);
- }*/
- });
- var rel_ied_list = [];
- $("#network .network-ied-line2").each(function() {
- var t = $(this);
- if (t.attr("apname") == v_apname) t.removeClass("hidden");
- else t.addClass("hidden");
- //t.css("opacity", t.attr("apname") == v_apname ? 1 : 0.2);
- if (t.attr("apname") == v_apname) {
- rel_ied_list.push(t.attr("foried"));
- }
- /*
- if (t.attr("apname") == v_apname) {
- if (ishow == "0") t.addClass("hidden");
- else t.removeClass("hidden");
- }*/
- });
- $("#network .network-iedlist .ied_item").css("opacity", 0.3);
- for (var i = 0; i < rel_ied_list.length; i++) {
- $("#network .network-iedlist .ied_item[ied_name='" + rel_ied_list[i] + "']").css("opacity", 1);
- }
- });
- //绘制ap与总线的连接线
- //初始连接线位置
- var w = 10 * wRate; //固定间隔距离
- if (sourceNetworkEle.length == 0) {
- return;
- }
- var linkLeft = sourceNetworkEle.position().left + (sourceNetworkEle.width() - ((loadApInfo.length - 1) * w)) / 2;
- var startTop = sourceNetworkEle.position().top + sourceNetworkEle.height() + sourceNetworkEle.css("margin-top").replace("px", "") * 1;
- $aplistEle.find(".sub_line").each(function(ind) {
- var tmp0 = $(this);
- var h = tmp0.position().top + tmp0.parent().position().top - startTop;
- network.append('<div class="network-line ' + tmp0.attr("apname") + '" apname=' + tmp0.attr("apname") + ' style="top:' + startTop + 'px;left:' + (linkLeft + 10 * wRate * ind) + 'px;height:' + h + 'px"></div>');
- });
- var iedListTop = $("#network .sub_line:last").position().top + $("#network .sub_line:last").parent().position().top + 60 * hRate;
- var iedListH = $("#container_map_ied .network").height() - iedListTop;
- ledlist.css({
- "top": iedListTop,
- //"height": iedListH + "px"
- });
- //加载IED
- var iedListDiv = $("#network .network-iedlist>div:first");
- $aplistEle.find(".sub_line").each(function() {
- var apname = $(this).attr("apname");
- //ap对应的总线
- var totalLine = network.find(".sub_line[apname='" + apname + "']");
- var vTop = totalLine.position().top + totalLine.parent().position().top + totalLine.height();
- var viedList = PoliceObject.NetWork_ApNodes[networkid + "." + apname];
- if (viedList.list == null) return;
- for (var i = 0; i < viedList.list.length; i++) {
- var ieddata = viedList.list[i].ied_name;
- var curIed = network.find(".network-iedlist .ied_item[ied_name='" + ieddata.attr_ied_name + "']");
- if (curIed.length == 0) {
- var iplist = [];
- var ip = PoliceObject.IedNetaddrList[ieddata.attr_ied_name + "ip"];
- if (ip != null) {
- for (var ipi = 0; ipi < ip.length; ipi++) {
- iplist.push('<div class="ip">' + ip[ipi].node_value + '</div>');
- }
- }
- iedListDiv.append('<div ied_name="' + ieddata.attr_ied_name + '" title="' + ieddata.attr_desc + '" class="ied_item"><img src="/static/images/default_ied.png"><div>' + ieddata.attr_desc + '</div><div>' + ieddata.attr_ied_name + '</div>' + iplist.join("") + '</div>');
- curIed = network.find(".network-iedlist .ied_item[ied_name='" + ieddata.attr_ied_name + "']");
- }
- //绘制总线与IED连接线
- var left = curIed.position().left.toFixed(1);
- var h = curIed.position().top - vTop + ledlist.position().top + 40 * hRate;
- var lineCss = "left:" + left + "px;top:" + vTop + "px;height:" + h + "px";
- network.append('<div apname="' + apname + '" foried="' + ieddata.attr_ied_name + '" class="network-ied-line ' + apname + '" style="' + lineCss + '"></div>');
- var w = 45 * wRate;
- var lineCss2 = "left:" + left + "px;top:" + (vTop + h) + "px;width:" + w + "px";
- network.append('<div apname="' + apname + '" foried="' + ieddata.attr_ied_name + '" class="network-ied-line2 ' + apname + '" style="' + lineCss2 + '"></div>');
- }
- });
- iedListDiv.find(".ied_item").off().on('click', function() {
- //点击装置时查看装备信息
- var t = $(this);
- //查看IED信息
- DialogObject.Open($("#dialog_public"), {
- size: ["150rem", "72rem"],
- para: {
- "title": t.attr("title") + "(" + t.attr("ied_name") + ")—详细信息",
- "ied_id": t.attr("id"),
- "ied_name": t.attr("ied_name"),
- },
- callback: function(win, p1) {
- win.attr("ied_name", p1.ied_name);
- win.find(".caption>b").html(p1.title);
- var h = (win.height() - win.find(".caption").height() - win.find(".footer").height() - 20 * hRate); //20为paddingTop
- win.find(".dataitemlist").height(h + "px").html(template('ied_detail_tpl', {}));
- win.find(".content").height(h - win.find(".tools").height() + "px");
- win.find("#ied_list_tree").height(h - 20 * hRate); //20为底边留空
- //绑定快速查找
- win.find("#ied_list_tree .fast_find_list").off().on("input propertychange", function() {
- var v = ($(this).val()).toLocaleLowerCase();
- var tarEle = win.find("#ied_list_tree .station_list_item");
- if (v == "") tarEle.removeClass("hidden");
- else {
- tarEle.each(function() {
- var $this = $(this);
- if ($this.text().toLocaleLowerCase().indexOf(v) > -1) $this.removeClass("hidden");
- else $this.addClass("hidden");
- })
- }
- });
- PoliceObject.LoadIedGraph(null, PoliceObject.IedList[p1.ied_name]);
- }
- });
- });
- //如果有2条及以上总线时,需要判断同一设备是否接入多条总线,是则需要微调连接位置 ,使其不重合
- if ($aplistEle.find(".sub_line").length > 0) {
- var leftSameLine = {};
- network.find(".network-ied-line").each(function() {
- var t = $(this);
- var v_apname = t.attr("apname");
- var v_left = t.css("left");
- if (leftSameLine[v_left] == null) leftSameLine[v_left] = [{
- "apname": v_apname,
- "ele": t
- }];
- else {
- var has = 0;
- for (var i = 0; i < leftSameLine[v_left].length; i++) {
- if (leftSameLine[v_left][i].apname == v_apname) {
- has = 1;
- break;
- }
- }
- if (has == 0) leftSameLine[v_left].push({
- "apname": v_apname,
- "ele": t
- });
- }
- })
- //遍历查找同一ap同一left相同连线数量大于2条的
- //console.log(leftSameLine)
- for (var left in leftSameLine) {
- if (leftSameLine[left].length < 2) continue;
- for (var i = 1; i < leftSameLine[left].length; i++) {
- //从第二条开始微调left
- var v_ele = leftSameLine[left][i].ele;
- var oldLeft = v_ele.css("left");
- var v_apname = leftSameLine[left][i].apname;
- network.find(".network-ied-line[apname='" + v_apname + "']").each(function() {
- var t1 = $(this);
- var t1Left = t1.css("left");
- if (oldLeft == t1Left) {
- t1.css({
- "left": oldLeft.replace("px", "") * 1 - (i * 5 * wRate) + "px",
- "height": t1.height() + (i * 5) + "px"
- });
- }
- });
- //调整当前总线-连接线上的装置连接线
- network.find(".network-ied-line2[apname='" + v_apname + "']").each(function() {
- var t1 = $(this);
- var t1Left = t1.css("left");
- var t1OldTop = t1.css("top");
- if (oldLeft == t1Left) {
- var newTop = t1OldTop.replace("px", "") * 1 + (i * 5 * hRate);
- t1.css({
- "top": newTop + "px",
- "width": t1.width() + (i * 5 * wRate) + "px",
- "left": oldLeft.replace("px", "") * 1 - (i * 5 * wRate) + "px"
- });
- }
- });
- }
- }
- }
- var divH = $("#container_map_ied").height() - $("#container_map_ied .scd_tools").height() - (70 * hRate);
- network.slimScroll({
- height: divH + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- })
- network.height(divH);
- layer.closeAll();
- }
- if (PoliceObject.NetWork_ApNodes == null) {
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": PoliceObject.ScdID,
- "pagesize": 10000,
- "name": "ConnectedAP"
- }, function(list) {
- PoliceObject.NetWork_ApNodes = {};
- for (var i = 0; i < list.data.length; i++) {
- var pid = list.data[i].parent_node_id;
- var apname = list.data[i]["attr_ap_name"];
- var key = pid + "." + apname;
- if (PoliceObject.NetWork_ApNodes[key] == null) {
- PoliceObject.NetWork_ApNodes[key] = ($.extend({
- "node_type": "ap",
- "name": key,
- list: [{
- "ied_name": list.data[i]
- }]
- }, list.data[i]));
- } else {
- PoliceObject.NetWork_ApNodes[key].list.push({
- "ied_name": list.data[i]
- });
- }
- }
- network.find(".apname").off().on('click', function() {
- var $t = $(this);
- LoadIedGraph(null, $t.parent().parent().find(".network_name").text() + "—" + $t.attr("apname"), "ap");
- });
- //PoliceObject.NetWork_ApNodes.sort(Tools.SortBy("name", true))
- loadNetworkAPInfo();
- });
- } else {
- loadNetworkAPInfo();
- }
- })
- },
- LoadIedList: function() {
- //layer.msg("努力加载文件数据中...")
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/relation", {
- "scd_id": PoliceObject.ScdID
- }, function(r) {
- PoliceObject.IedList = r.data;
- var container_map_ied = $("#container_map_ied");
- container_map_ied.find(".scd_filter .iedNumber>b").html(r.count);
- var firstShowIed = "",
- refCount = 0;
- for (var iedname in r.data) {
- if (refCount < r.data[iedname].list.length) {
- firstShowIed = iedname;
- refCount = r.data[iedname].list.length;
- }
- }
- iedLoadState = 1;
- PoliceObject.LoadIedNetAddr();
- });
- },
- LoadIedNetAddr: function() {
- PoliceObject.IedNetaddrList = {};
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/netaddr", {
- "scd_id": PoliceObject.ScdID
- }, function(r) {
- if (r.code != 0) {
- $("#network").html(Tools.HintText(r.msg + "\n该SCD可能已被清理,需要重新分析!"));
- return;
- }
- if (r.data == null) {
- $("#network").html(Tools.HintText("未发现网络配置信息,或者该SCD可能已被清理,需要重新分析!"));
- return;
- }
- for (var i = 0; i < r.data.length; i++) {
- var k = r.data[i].attr_ied_name + r.data[i].addrtype;
- var lst = PoliceObject.IedNetaddrList[k];
- if (lst == null) PoliceObject.IedNetaddrList[k] = [r.data[i]];
- else PoliceObject.IedNetaddrList[k].push(r.data[i]);
- }
- netaddrLoadState = 1;
- if ($("#network .network-iedlist .ied_item").length == 0) {
- //尝试再加载一次网络结构
- PoliceObject.GetSubNetwork();
- }
- });
- },
- OpenShowIedList: function(title, filter_cond) {
- var tmp_load = function(title, data) {
- DialogObject.Open($("#dialog_public"), {
- size: ["122rem", "70rem"],
- para: {
- "title": title,
- "list": data
- },
- callback: function(win, para) {
- win.find(".caption>b").html(para.title);
- var h = template("ied_list_tpl", {
- data: para.list
- });
- win.find(".dataitemlist").css("margin-top", "-2rem").html(h).slimScroll({
- height: (win.height() - win.find(".caption").height() - win.find(".footer").height()) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- win.find(".ied_list_item").off().on('click', function() {
- var t = $(this);
- //查看IED信息
- DialogObject.Open($("#dialog_public"), {
- size: ["150rem", "72rem"],
- para: {
- "title": t.find("span:last").text() + "(" + t.find("span:first").text() + ")—详细信息",
- "ied_id": t.attr("id"),
- "ied_name": t.attr("name"),
- },
- callback: function(win, p1) {
- win.attr("ied_name", p1.ied_name);
- win.find(".caption>b").html(p1.title);
- var h = (win.height() - win.find(".caption").height() - win.find(".footer").height());
- win.find(".dataitemlist").height(h + "px").html(template('ied_detail_tpl', {}));
- win.find(".content").height(h - win.find(".tools").height() + "px");
- win.find("#ied_list_tree").height(h - 20 * hRate);
- //绑定快速查找
- win.find("#ied_list_tree .fast_find_list").off().on("input propertychange", function() {
- var v = ($(this).val()).toLocaleLowerCase();
- var tarEle = win.find("#ied_list_tree .station_list_item");
- if (v == "") tarEle.removeClass("hidden");
- else {
- tarEle.each(function() {
- var $this = $(this);
- if ($this.text().toLocaleLowerCase().indexOf(v) > -1) $this.removeClass("hidden");
- else $this.addClass("hidden");
- })
- }
- });
- PoliceObject.LoadIedGraph(null, PoliceObject.IedList[p1.ied_name]);
- }
- });
- });
- }
- });
- }
- var lst = [];
- //判断是否是根据间隔ID来查看
- $.getJSON(Global.AccessUrl + "/api/scd/area/ied/list", {
- scd_id: PoliceObject.ScdID,
- area_id: filter_cond.area_id,
- voltage_level_id: filter_cond.voltage_level_id,
- device_type_id: filter_cond.device_type_id
- }, function(r) {
- if (r.code != 0) {
- layer.msg(r.msg, {
- icon: Global.ICON_ERROR
- });
- return;
- }
- if (r.data == null) {
- layer.msg("该类型下无装置!", {
- icon: Global.ICON_ERROR
- })
- return
- }
- tmp_load(title, r.data.sort(Tools.SortBy("attr_name", true)));
- })
- },
- LoadIedNetWorkInfo: function(ied_name, scdid, callback) {
- if (scdid == null) scdid = "";
- var lst = PoliceObject.GetIedData(ied_name, scdid).network;
- if (lst != null) {
- if (callback != null) callback(lst);
- return;
- }
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/network/info", {
- "scd_id": scdid == null || scdid == "" ? PoliceObject.ScdID : scdid,
- "ied_name": ied_name
- }, function(r) {
- if (r.code != 0) {
- return;
- }
- var ieddata = PoliceObject.OtherIedList[scdid + ied_name];
- if (ieddata != null) ieddata["network"] = r.data;
- else PoliceObject.IedList[ied_name]["network"] = r.data;
- if (callback != null) callback(r.data);
- })
- },
- LoadIedTreeList: function(iedListTree, isrefesh) {
- this.LoadIedTreeList2(iedListTree, null, isrefesh);
- },
- LoadIedTreeList2: function(iedListTree, iedlist, isrefesh) {
- iedListTree = iedListTree == null ? $("#ied_list_tree") : iedListTree;
- if (isrefesh == null && iedListTree.attr("isloaded") == "1") return;
- if (iedListTree.find(".station_list_item").length == 0) {
- var iedListTreeDiv = iedListTree.children("div:last").html('').slimscroll({
- height: (iedListTree.height() - iedListTree.children("div:first").height()) + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- var lstItems = [];
- var isOtherScdid = "";
- if (iedlist != null) {
- for (var i = 0; i < iedlist.length; i++) {
- isOtherScdid = iedlist[i].scd_id;
- lstItems.push({
- "scd_id": iedlist[i].scd_id,
- "code": iedlist[i].ied_name,
- "name": "<span style='width: 9rem;display: inline-block;'>" + iedlist[i].ied_name + "</span><span style='color:#516380;margin-left:0.5rem;'>" + iedlist[i].ied_desc + "</span>"
- });
- }
- } else {
- for (var ied_name in PoliceObject.IedList) {
- lstItems.push({
- "code": ied_name,
- "name": "<span style='width: 9rem;display: inline-block;'>" + ied_name + "</span><span style='color:#516380;margin-left:0.5rem;'>" + PoliceObject.IedList[ied_name].desc + "</span>"
- });
- }
- }
- iedListTreeDiv.html(template('select_item_tpl', {
- data: lstItems.sort(Tools.SortBy("code", true))
- })).find(".station_list_item").attr("scd_id", isOtherScdid).off().on('click', function() {
- iedListTreeDiv.find(".active").removeClass("active");
- var $t = $(this),
- v = $t.attr("value");
- $t.addClass("active");
- var scdid = $.trim($t.attr("scd_id"));
- $t.parents(".site_device_list").attr("scd_id", scdid == "" ? PoliceObject.ScdID : scdid).attr("ied_name", v).find(".caption>b").html($t.children("span:last").text() + "(" + $t.children("span:first").text() + ")" + "—详细信息");
- var tools = iedListTree.next();
- //tools.find("li").removeClass("layui-this");
- //tools.find("li:first").addClass("layui-this");
- tools.find("li.layui-this").trigger('click');
- //PoliceObject.LoadIedGraph(PoliceObject.IedList[v]);
- });
- }
- var tools = iedListTree.next();
- tools.find("li").removeClass("layui-this");
- tools.find("li:first").addClass("layui-this");
- iedListTree.attr("isloaded", "1");
- },
- LoadIedCtrlRelation: function(evt, ieddata) {
- //加载IED列表树
- this.LoadIedTreeList($("#ied_list_tree"));
- var tmp_load = function(data) {
- ied_strcut_detail.html('').slimscroll({
- height: ied_strcut_detail.height() + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- ied_strcut_detail.append('<span class="f_l ied_show_block self_ied" style="font-size: 1.4rem;"></span>');
- var selfIed = ied_strcut_detail.children(".ied_show_block.self_ied").html(ieddata.ied_name + "<br>" + ieddata.desc).attr("ied_name", ieddata.ied_name);
- var iddXY = ied_strcut_detail.position();
- for (var i = 0; i < ieddata.list.length; i++) {
- var itme = ieddata.list[i];
- if (itme.ref_ied_name == null || itme.ref_ied_name == "" || ied_strcut_detail.find("span[ied_name='" + itme.ref_ied_name + "']").length > 0) continue;
- if (itme.ref_type == "1") {
- //输入关系
- ied_strcut_detail.append('<span class="ied_show_block salve_ied" ied_name="' + itme.ref_ied_name + '">' + itme.ref_ied_name + '<br>' + itme.ref_ied_desc + '</span>');
- } else {
- //输出关系
- ied_strcut_detail.append('<span class="ied_show_block salve_ied" ied_name="' + itme.ref_ied_name + '" style="color:#51637F">' + itme.ref_ied_name + '<br>' + itme.ref_ied_desc + '</span>');
- }
- }
- ied_strcut_detail.find(".salve_ied").off().on('click', function() {
- //点击装置进行切换
- PoliceObject.LoadIedCtrlRelation(null, PoliceObject.GetIedData($(this).attr("ied_name")));
- });
- if (data.ControlBlock == null) return;
- //生成其他IED控制块
- for (var i = 0; i < data.ControlBlock.length; i++) {
- var item = data.ControlBlock[i];
- if (item.ref_type == 0) {
- //主IED输出到其他IED
- //var sourceCtrlID=item.ctrl_id;
- //目标IED
- //var toIedName=item.source_ied_name;
- continue;
- }
- if (item.ld_id == "") {
- console.log(item)
- continue;
- }
- var tarEle = ied_strcut_detail.find(".ied_show_block[ied_name='" + item.target_ied_name + "']");
- var ldEle = tarEle.children(".ld[ld_id=" + item.ld_id + "]");
- if (ldEle.length == 0) {
- tarEle.append('<span class="ld f_l" ld_id=' + item.ld_id + '><span class=f_l style="padding: 0.5rem;padding: 0.5rem;width: 100%;text-align: left;">' + item.ld_inst + ' ' + item.ld_desc + '</span></span>');
- ldEle = tarEle.children(".ld[ld_id=" + item.ld_id + "]");
- }
- ldEle.append('<span class="block" attr_type="' + item.ctrl_type + '" ctrl_id="' + item.ctrl_id + '" inputs_cnt=' + item.inputs_cnt + '><div>' + item.ctrl_name + '</div><div>' + item.datset_desc + '<div></span>');
- }
- var iedList = ied_strcut_detail.children("span.salve_ied");
- for (var i = 0; i < iedList.length; i++) {
- if (i % 2 == 0) iedList.eq(i).addClass("left");
- else iedList.eq(i).addClass("right");
- }
- ied_strcut_detail.children("span.ied_show_block.left").each(function(ind) {
- var t = 150;
- if (ind > 0) {
- var $tmp = ied_strcut_detail.children("span.ied_show_block.left:eq(" + (ind - 1) + ")");
- t = $tmp.position().top + $tmp.height() + 30;
- }
- $(this).css({
- left: "5rem",
- top: t + "px"
- });
- });
- ied_strcut_detail.children("span.ied_show_block.right").each(function(ind) {
- var t = 150;
- if (ind > 0) {
- var $tmp = ied_strcut_detail.children("span.ied_show_block.right:eq(" + (ind - 1) + ")");
- t = $tmp.position().top + $tmp.height() + 30;
- }
- $(this).css({
- left: "90rem",
- top: t + "px"
- });
- });
- //计算主IED的高度
- var lastLeftEle = ied_strcut_detail.children("span.ied_show_block.left:last");
- var lastRigthEle = ied_strcut_detail.children("span.ied_show_block.right:last");
- if (lastLeftEle.length > 0 && lastRigthEle.length > 0)
- selfIed.css("height", Math.max(lastLeftEle.position().top + lastLeftEle.height(), lastRigthEle.position().top + lastRigthEle.height()) + 50 + "px");
- else if (lastLeftEle.length > 0)
- selfIed.css("height", Math.max(lastLeftEle.position().top + lastLeftEle.height(), 0) + 50 + "px");
- else if (lastRigthEle.length > 0)
- selfIed.css("height", Math.max(0, lastRigthEle.position().top + lastRigthEle.height()) + 50 + "px");
- else return;
- //生成主IED的控制块
- makeSlefIedBlock(selfIed, data, drawRelationLine);
- }
- var drawRelationLine = function(data) {
- var selfIed = ied_strcut_detail.children(".ied_show_block.self_ied");
- ied_strcut_detail.append("<canvas id='canvas' class='abs canvas' style='width:100%;height:" + selfIed.height() + "px;z-index:1;pointer-events: none;'></canvas>");
- var canvas = PoliceObject.p_createCanvas(ied_strcut_detail.find("canvas"));
- //---------------------------
- //绘制连接线
- var selfIedXY = selfIed.position();
- ied_strcut_detail.find(".ied_show_block.left .block").each(function() {
- //左侧ied输入到主IED的连接线
- var t = $(this),
- xy = t.position();
- var leftSelf = selfIedXY.left + selfIed.css("margin-left").replace("px", "") * 1;
- var left = xy.left + t.width() + t.parent().parent().position().left + (t.css("margin-left").replace("px", "") * 1) + 2;
- var top = xy.top + (t.height() / 2) + t.parent().parent().position().top + (t.css("margin-top").replace("px", "") * 1) + 1;
- var lineColor = "#134BEA";
- var attrtype = $.trim(t.attr('attr_type')).toLocaleLowerCase();
- if (attrtype != "" && "smv,sv".indexOf(attrtype) > -1) {
- lineColor = "red";
- t.css({
- "color": lineColor,
- "border-color": lineColor
- });
- }
- PoliceObject.p_drawLine(canvas, [left, top], [leftSelf, top], lineColor);
- var n1 = PoliceObject.p_drawNumber(ied_strcut_detail, [leftSelf, top], [left, top], t.attr('inputs_cnt'), "left");
- n1.attr({
- "m_iedname": selfIed.attr("ied_name"),
- "s_iedname": t.parents(".salve_ied").attr("ied_name"),
- "s_ctrlid": t.attr('ctrl_id')
- });
- });
- ied_strcut_detail.find(".ied_show_block.right .block").each(function() {
- //右侧ied输入到主IED的连接线
- var t = $(this),
- xy = t.position();
- var left1 = selfIedXY.left + selfIed.width() + selfIed.css("margin-left").replace("px", "") * 1 + 5;
- var left2 = xy.left + t.parent().parent().position().left + (t.css("margin-left").replace("px", "") * 1) + 2;
- var top = xy.top + (t.height() / 2) + t.parent().parent().position().top + (t.css("margin-top").replace("px", "") * 1) + 1;
- var lineColor = "#134BEA";
- var attrtype = $.trim(t.attr('attr_type')).toLocaleLowerCase();
- if (attrtype != "" && "smv,sv".indexOf(attrtype) > -1) {
- lineColor = "red";
- t.css({
- "color": lineColor,
- "border-color": lineColor
- });
- }
- PoliceObject.p_drawLine(canvas, [left2, top], [left1, top], lineColor);
- var n1 = PoliceObject.p_drawNumber(ied_strcut_detail, [left1, top], [left2, top], t.attr('inputs_cnt'), "right");
- n1.attr({
- "m_iedname": selfIed.attr("ied_name"),
- "s_iedname": t.parents(".salve_ied").attr("ied_name"),
- "s_ctrlid": t.attr('ctrl_id')
- });
- });
- //绘制输出连接线
- var outR_cnt = 0;
- var outL_cnt = 0;
- for (var i = 0; i < data.ControlBlock.length; i++) {
- var item = data.ControlBlock[i];
- //主IED输出到其他IED
- var sourceCtrl = selfIed.find(".block[node_id='" + item.ctrl_id + "']");
- //目标IED
- var toIed = ied_strcut_detail.find(".ied_show_block[ied_name='" + item.source_ied_name + "']");
- var x1, y1, x2, y2 = 0;
- var w, h, l, t = 0;
- var lineColor = "#516380";
- var attrtype = $.trim(sourceCtrl.attr('attr_type')).toLocaleLowerCase();
- if (attrtype != "" && "smv,sv".indexOf(attrtype) > -1) {
- lineColor = "red";
- sourceCtrl.css({
- "color": lineColor,
- "border-color": lineColor
- });
- }
- if (item.ref_type == 0) {
- var direction = "";
- if (toIed.hasClass("left")) {
- direction = "left";
- //在左边
- x1 = selfIedXY.left + sourceCtrl.position().left + sourceCtrl.css("margin-left").replace("px", "") * 1 + selfIed.css("margin-left").replace("px", "") * 1;
- y1 = selfIedXY.top + sourceCtrl.position().top + sourceCtrl.css("margin-top").replace("px", "") * 1 + selfIed.css("margin-top").replace("px", "") * 1 + sourceCtrl.height() / 2;
- x2 = toIed.position().left + toIed.width();
- y2 = toIed.position().top + (toIed.height() / 2);
- PoliceObject.p_drawLine(canvas, [x1, y1], [x2, y2 + outL_cnt * 8], lineColor);
- outL_cnt++;
- } else {
- direction = "right";
- //在右边
- x1 = selfIedXY.left + sourceCtrl.position().left + sourceCtrl.width() + sourceCtrl.css("margin-left").replace("px", "") * 1 + selfIed.css("margin-left").replace("px", "") * 1 + 5;
- y1 = selfIedXY.top + sourceCtrl.position().top + sourceCtrl.css("margin-top").replace("px", "") * 1 + (sourceCtrl.height() / 2);
- x2 = toIed.position().left;
- y2 = toIed.position().top + (toIed.height() / 2);
- PoliceObject.p_drawLine(canvas, [x1, y1], [x2, y2 + outR_cnt * 8], lineColor);
- outR_cnt++;
- }
- var n1 = PoliceObject.p_drawNumber(ied_strcut_detail, [x1, y1], [x2, y2], item.inputs_cnt, direction);
- n1.attr({
- "m_iedname": selfIed.attr("ied_name"),
- "s_iedname": item.source_ied_name,
- "m_ctrlid": item.ctrl_id,
- "s_ctrlid": ""
- });
- }
- }
- //绑定控制块关系数量,点击数量打开许端子详细关系窗口
- ied_strcut_detail.find(".inputs_num").off().on('click', function() {
- var tmpEle = $(this);
- DialogObject.Open($("#dialog_public"), {
- size: ["100rem", "55rem"],
- para: {
- "title": "虚端子—详细信息",
- "s_ied_name": $.trim(tmpEle.attr("s_iedname")),
- "m_ied_name": $.trim(tmpEle.attr("m_iedname")),
- "m_ctrlid": $.trim(tmpEle.attr("m_ctrlid")),
- "s_ctrlid": $.trim(tmpEle.attr("s_ctrlid")),
- "scd_id": ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID
- },
- callback: function(win, p1) {
- win.find(".caption>b").html(p1.title);
- var h = (win.height() - win.find(".caption").height() - win.find(".footer").height() - win.find(".dataitemlist").css("padding-top").replace("px", "") * 1);
- var dataContent = win.find(".dataitemlist").height(h + "px").html(Tools.LoadingText("正在加载数据中...")).slimscroll({
- height: h + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/inputs", p1, function(r) {
- dataContent.html("<div id='m_ied' class='abs inputs_ied_box' style='left:10%;'></div><div id='s_ied' class='abs inputs_ied_box' style='right:10%;'></div>");
- if (r.code != 0) {
- layer.msg(r.msg);
- return;
- }
- var mIedEle = dataContent.find("#m_ied");
- var sIedEle = dataContent.find("#s_ied");
- mIedData = PoliceObject.GetIedData(p1.m_ied_name, p1.scd_id)
- sIedData = PoliceObject.GetIedData(p1.s_ied_name, p1.scd_id)
- mIedEle.append('<div class="f_l" style="width: 100%;line-height: 2rem;border-bottom: 1px solid #C8D4E2;"><span class="f_l" style="width:100%">' + p1.m_ied_name + '</span><span style="color: #134BEA;">' + mIedData.desc + '</span></div>');
- sIedEle.append('<div class="f_l" style="width: 100%;line-height: 2rem;border-bottom: 1px solid #C8D4E2;"><span class="f_l" style="width:100%">' + p1.s_ied_name + '</span><span style="color: #134BEA;">' + sIedData.desc + '</span></div>');
- //获取控制块信息
- var inout_type = ""; //相对于主IED的输入输出关系
- for (var i = 0; i < mIedData.ControlBlock.length; i++) {
- var ctrlInfo = mIedData.ControlBlock[i];
- if (ctrlInfo.ctrl_id == p1.m_ctrlid || ctrlInfo.ctrl_id == p1.s_ctrlid) {
- inout_type = ctrlInfo.ref_type;
- //console.log(ctrlInfo)
- if (ctrlInfo.ref_type == 1) {
- //输入控制块
- mIedEle.append('<div class="abs" style="width:90%;left:5%;top:7rem;min-height:33rem;border: 1px solid #C8D4E2;border-radius: 3px;"><div style="text-align: left;margin-top: -2.3rem;float: left;line-height: 2rem;padding: 0 5px;"><b>' + (r.data[0].to_ld_inst || '') + "</b> " + (r.data[0].to_ld_desc || '') + '</div><div class="f_l output_ctrl" style="width:100%;color: #43526B;background: #fff;margin-bottom: 1rem;"> </div></div>');
- //输出控制块
- sIedEle.append('<div class="abs" style="width:90%;left:5%;top:7rem;min-height:33rem;border: 1px solid #C8D4E2;border-radius: 3px;"><div style="text-align: left;margin-top: -2.3rem;float: left;line-height: 2rem;padding: 0 5px;"><b>' + ctrlInfo.ld_inst + "</b> " + ctrlInfo.ld_desc + '</div><div class="f_l output_ctrl" style="width: 100%;color: #43526B;background: #fff;margin-bottom: 1rem;"><span style="margin-right:1rem">' + ctrlInfo.ctrl_name + '</span><span>' + ctrlInfo.datset_desc + '</span></div></div>');
- } else {
- sIedEle.append('<div class="abs" style="width:90%;left:5%;top:7rem;min-height:33rem;border: 1px solid #C8D4E2;border-radius: 3px;"><div style="text-align: left;margin-top: -2.3rem;float: left;line-height: 2rem;padding: 0 5px;"><b>' + (r.data[0].to_ld_inst || '') + "</b> " + (r.data[0].to_ld_desc || '') + '</div><div class="f_l output_ctrl" style="width:100%;color: #43526B;background: #fff;margin-bottom: 1rem;"> </div></div>');
- //输出控制块
- mIedEle.append('<div class="abs" style="width:90%;left:5%;top:7rem;min-height:33rem;border: 1px solid #C8D4E2;border-radius: 3px;"><div style="text-align: left;margin-top: -2.3rem;float: left;line-height: 2rem;padding: 0 5px;"><b>' + ctrlInfo.ld_inst + "</b> " + ctrlInfo.ld_desc + '</div><div class="f_l output_ctrl" style="width: 100%;color: #43526B;background: #fff;margin-bottom: 1rem;"><span style="margin-right:1rem">' + ctrlInfo.ctrl_name + '</span><span>' + ctrlInfo.datset_desc + '</span></div></div>');
- }
- break;
- }
- }
- var mIedEleCtl = mIedEle.children("div:last");
- var sIedEleCtl = sIedEle.children("div:last");
- //生成许端子元素
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- var fIntAddr = item.attr_ld_inst + "/" + (item.attr_prefix || '') + item.attr_ln_class + item.attr_ln_inst + "." + item.attr_do_name + "." + item.attr_da_name;
- if (inout_type == 1) {
- mIedEleCtl.append('<div class="f_l output_ctrl inputs_extref" style="width: 80%;color: #09162C;border: 1px solid #516380;background: #F6FAFF;line-height: 2rem;margin-left:10%;margin-bottom: 1rem;text-align: center;"><span>' + item.to_doi_desc + '</span><span class="f_l" style="width:100%">' + item.attr_int_addr + '</span></div>');
- sIedEleCtl.append('<div class="f_l output_ctrl inputs_extref" style="width: 80%;color: #09162C;border: 1px solid #516380;background: #F6FAFF;line-height: 2rem;margin-left:10%;margin-bottom: 1rem;text-align: center;"><span>' + item.from_doi_desc + '</span><span class="f_l" style="width:100%">' + fIntAddr + '</span></div>');
- } else {
- mIedEleCtl.append('<div class="f_l output_ctrl inputs_extref" style="width: 80%;color: #09162C;border: 1px solid #516380;background: #F6FAFF;line-height: 2rem;margin-left:10%;margin-bottom: 1rem;text-align: center;"><span>' + item.from_doi_desc + '</span><span class="f_l" style="width:100%">' + fIntAddr + '</span></div>');
- sIedEleCtl.append('<div class="f_l output_ctrl inputs_extref" style="width: 80%;color: #09162C;border: 1px solid #516380;background: #F6FAFF;line-height: 2rem;margin-left:10%;margin-bottom: 1rem;text-align: center;"><span>' + item.to_doi_desc + '</span><span class="f_l" style="width:100%">' + item.attr_int_addr + '</span></div>');
- }
- }
- //重新计算 区域高度
- mIedEle.height(mIedEleCtl.height() + 120 * hRate);
- sIedEle.height(sIedEleCtl.height() + 120 * hRate);
- var maxH = Math.max(mIedEle.height(), sIedEle.height()) + 100 * hRate;
- //dataContent.height(maxH);
- //绘制连接
- dataContent.append("<canvas id='canvas' class='abs canvas' style='width:100%;height:" + maxH + "px;z-index:0;pointer-events: none;'></canvas>");
- var canvas = PoliceObject.p_createCanvas(win.find("#canvas"));
- var m_ied_position = $("#m_ied").position();
- var s_ied_position = win.find("#s_ied").position();
- mIedEle.find(".inputs_extref").each(function(ind) {
- var ele = $(this),
- eleXY = ele.position();
- var y = m_ied_position.top + eleXY.top + ele.parent().position().top + ele.height() / 2 - dataContent.css("padding-top").replace("px", "") * 1;
- var x = ele.offset().left - ele.css("margin-left").replace("px", "") * 1 - ele.parent().position().left - win.css("padding-left").replace("px", "") * 1;
- var masterIedJoinPoint = [x, y];
- var s_ied_extref = win.find("#s_ied .inputs_extref:eq(" + ind + ")");
- var sy = s_ied_position.top + s_ied_extref.position().top + s_ied_extref.parent().position().top + s_ied_extref.height() / 2 - dataContent.css("padding-top").replace("px", "") * 1;
- var sx = s_ied_extref.offset().left - s_ied_extref.css("margin-left").replace("px", "") * 1 - s_ied_extref.parent().position().left - s_ied_extref.width() - win.css("padding-left").replace("px", "") * 1;
- var salveJoinPoint = [sx, sy];
- if (p1.m_ctrlid != "") {
- //m_Ied->s_Ied:连线从左到右,箭头在右
- PoliceObject.p_drawLine(canvas, masterIedJoinPoint, salveJoinPoint, "#134BEA");
- } else {
- //m_Ied<-s_Ied:连线从右到左,箭头在左
- PoliceObject.p_drawLine(canvas, salveJoinPoint, masterIedJoinPoint, "#134BEA")
- }
- })
- });
- }
- });
- });
- }
- var makeSlefIedBlock = function(iedEle, data, callback) {
- var count = 0;
- if (data.SampledValueControl != null && data.SampledValueControl.length > 0) {
- for (var i = 0; i < data.SampledValueControl.length; i++) {
- var item = data.SampledValueControl[i];
- iedEle.append('<span class="block" attr_type="SV" cb_name="' + item.ldinst + "/" + item.attr_name + '" node_id="' + item.node_id + '"><div>' + item.ldinst + '/' + item.attr_name + '</div><div>' + item.datset_desc + '</div><div style="font-size: 1.2rem;color: #516380;"></div></span>');
- count++;
- }
- }
- if (data.GSEControl != null && data.GSEControl.length > 0) {
- for (var i = 0; i < data.GSEControl.length; i++) {
- var item = data.GSEControl[i];
- //if(item.attr_type!="GOOSE") continue;
- iedEle.append('<span class="block" attr_type="GOOSE" cb_name="' + item.ldinst + "/" + item.attr_name + '" node_id="' + item.node_id + '"><div>' + item.ldinst + '/' + item.attr_name + '</div><div>' + item.datset_desc + '</div><div style="font-size: 1.2rem;color: #516380;"></div></span>');
- count++;
- }
- }
- PoliceObject.LoadIedNetWorkInfo(data.ied_name, ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID, function(r) {
- for (var i = 0; i < r.length; i++) {
- var tmpEle = iedEle.children(".block[cb_name='" + r[i].ld_inst + "/" + r[i].cb_name + "']");
- if (tmpEle.length == 0 || r[i].address_json == "") continue;
- var addressJson = JSON.parse(r[i].address_json);
- tmpEle.children("div:eq(2)").html("APPID:" + (addressJson["APPID"] || ""));
- }
- var lastBlock = iedEle.find(".block:last");
- var totalH = lastBlock.position().top + lastBlock.height() + 60 + lastBlock.css("margin-top").replace("px", "") * 1;
- var iedEleH = iedEle.height();
- var marginTop = 0;
- if (iedEleH < totalH) {
- iedEle.height(totalH + "px");
- } else {
- marginTop = (iedEleH - totalH) / 2;
- iedEle.find(".block:first").css("margin-top", marginTop + "px");
- }
- if (callback != null) callback(data);
- });
- }
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_relation").removeClass("hidden");
- ele.parents(".site_device_list").attr("ied_name", ieddata.ied_name).find("b").html(ieddata.desc + "(" + ieddata.ied_name + ")—详细信息");
- ele.children("div.tools").children("li").off().on("click", function() {
- var liclass = $.trim($(this).attr("class").replace("layui-this", ""));
- switch (liclass) {
- case "ref_map":
- //块关联图
- PoliceObject.LoadIedCtrlRelation(null, ieddata);
- break;
- case "sv_send":
- //sv发送
- PoliceObject.LoadIedSVSendBlockTable(null, ieddata);
- break;
- case "sv_revice":
- //sv接收
- PoliceObject.LoadIedSVReviceBlockTable(null, ieddata);
- break;
- case "goose_send":
- //goose接收
- PoliceObject.LoadIedGooseSendBlockTable(null, ieddata);
- break;
- case "goose_revice":
- //goose接收
- PoliceObject.LoadIedGooseReviceBlockTable(null, ieddata);
- break;
- default:
- break;
- }
- });
- if (!ele.children("div.tools").find(".ref_map").hasClass("layui-this")) {
- //如果当前不是块关联图,自动切换过去
- ele.children("div.tools").find(".ref_map").addClass("layui-this").trigger('click');
- return;
- }
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html("");
- ied_strcut_detail.html(Tools.LoadingText("正在加载装置(" + ieddata.ied_name + ")数据中..."));
- if (ieddata["GSEControl"] != null || ieddata["SampledValueControl"] != null) {
- //判断装置关联关系是否已分析.未分析时重新分析
- if ($.trim(ieddata["isreset"]) != "1" && (ieddata.list == null || ieddata.list.length <= 1)) {
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/relation", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name,
- "reset": "1"
- }, function(r) {
- if (r.code != 0) {
- layer.msg("获取装置信息失败:" + r.msg)
- return;
- }
- layer.closeAll();
- if (r.data == null) {
- return
- }
- ieddata = r.data[ieddata.ied_name];
- ieddata["isreset"] = "1";
- PoliceObject.IedList[ieddata.ied_name] = ieddata;
- PoliceObject.LoadIedCtrlRelation(null, ieddata, "1");
- });
- return;
- } else {
- tmp_load(ieddata);
- }
- } else {
- var scdid = $.trim(ied_strcut_detail.parents(".site_device_list").attr("scd_id"));
- scdid = scdid == "" ? PoliceObject.ScdID : scdid
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/ctrlblock", {
- "scd_id": scdid,
- "ied_name": ieddata.ied_name
- }, function(r) {
- if (r.code != 0) {
- layer.msg(r.msg);
- return;
- }
- ieddata["GSEControl"] = r.data.GSEControl;
- ieddata["SampledValueControl"] = r.data.SampledValueControl;
- PoliceObject.IedList[ieddata.ied_name] = ieddata;
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/ref/ctrlblock", {
- "scd_id": scdid,
- "ied_name": ieddata.ied_name,
- "forcerefresh": ieddata["isforcerefresh"] == null ? "0" : ieddata["isforcerefresh"]
- }, function(r1) {
- if (r1.code != 0) {
- layer.msg(r1.msg);
- return;
- }
- if ($.trim(ieddata["isforcerefresh"]) != "1") {
- //判断返回的块关系数是否与装置关系数相同,如果不同重新生成一次
- if (r1.data != null && r1.data.length < ieddata.list.length) {
- ieddata["GSEControl"] = null;
- ieddata["SampledValueControl"] = null;
- ieddata["isforcerefresh"] = "1";
- PoliceObject.LoadIedCtrlRelation(null, ieddata);
- return;
- }
- }
- ieddata["isforcerefresh"] = "0";
- ieddata["ControlBlock"] = r1.data;
- PoliceObject.IedList[ieddata.ied_name] = ieddata;
- tmp_load(ieddata);
- });
- });
- }
- },
- //装置关联关系
- LoadIedGraph: function(evt, ieddata, node_type, isreset) {
- if (ieddata == null) return;
- //加载IED列表树
- this.LoadIedTreeList($("#ied_list_tree"));
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_info").removeClass("hidden");
- ele.parents(".site_device_list").attr("ied_name", ieddata.ied_name).find("b").html(ieddata.desc + "(" + ieddata.ied_name + ")—详细信息");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html("");
- var iedRefList = ieddata.list;
- if (iedRefList == null || iedRefList.length == 0) {
- return;
- }
- if (iedRefList.length == 1 && isreset == null) {
- //尝试重新分析该装置关系
- this.GetIedData(ieddata.ied_name);
- PoliceObject.LoadIedGraph(null, PoliceObject.IedList[ieddata.ied_name], node_type, 1);
- return
- }
- ied_strcut_detail.slimscroll({
- height: ied_strcut_detail.height() + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- ied_strcut_detail.append('<span class="f_l ied_show_block self_ied ied_show_item" style="color:#134BEA;height:34rem;border:0px;"></span>');
- var selfIed = ied_strcut_detail.children(".ied_show_block.self_ied").html("<div class='abs' style='top: 68%;width:100%;font-weight:bold;font-size:1.5rem;'>" + ieddata.ied_name + "<br>" + ieddata.desc + "</div>").attr("ied_name", ieddata.ied_name);
- var iddXY = ied_strcut_detail.position();
- for (var i = 0; i < ieddata.list.length; i++) {
- var itme = ieddata.list[i];
- var existRefIed = ied_strcut_detail.find("span[ied_name='" + itme.ref_ied_name + "']");
- if (itme.ref_ied_name == null || itme.ref_ied_name == "" || existRefIed.length > 0) {
- if (existRefIed.attr("ref_type") != itme.ref_type) {
- //双向输入输出关系
- existRefIed.attr("ref_type", '2');
- }
- continue;
- }
- if (itme.ref_type == "1") {
- //输入关系
- ied_strcut_detail.append('<span ref_type=' + itme.ref_type + ' class="ied_show_block salve_ied ied_show_item" ied_name="' + itme.ref_ied_name + '" style="border:0px;"><div class="abs" style="width: 100%;line-height: 1.6rem;">' + itme.ref_ied_name + '<br>' + itme.ref_ied_desc + '</div></span>');
- } else {
- //输出关系
- ied_strcut_detail.append('<span ref_type=' + itme.ref_type + ' class="ied_show_block salve_ied ied_show_item" ied_name="' + itme.ref_ied_name + '" style="border:0px;"><div class="abs" style="width: 100%;line-height: 1.6rem;color:#51637F">' + itme.ref_ied_name + '<br>' + itme.ref_ied_desc + '</div></span>');
- }
- }
- ied_strcut_detail.find(".ied_show_item").off().on('click', function() {
- //点击装置进行切换
- PoliceObject.LoadIedGraph(null, PoliceObject.IedList[$(this).attr("ied_name")]);
- });
- var iedList = ied_strcut_detail.children("span.salve_ied");
- for (var i = 0; i < iedList.length; i++) {
- if (i % 2 == 0) iedList.eq(i).addClass("left");
- else iedList.eq(i).addClass("right");
- }
- var leftIedCount = 0;
- ied_strcut_detail.children("span.ied_show_block.left").each(function(ind) {
- var t = 0;
- if (ind > 0) {
- var $tmp = ied_strcut_detail.children("span.ied_show_block.left:eq(" + (ind - 1) + ")");
- t = $tmp.position().top + $tmp.height() + 50;
- }
- $(this).css({
- left: "5rem",
- top: t + "px"
- });
- leftIedCount++;
- });
- var rightIedCount = 0; //右边IED显示的装置总数
- ied_strcut_detail.children("span.ied_show_block.right").each(function(ind) {
- var t = 0;
- if (ind > 0) {
- var $tmp = ied_strcut_detail.children("span.ied_show_block.right:eq(" + (ind - 1) + ")");
- t = $tmp.position().top + $tmp.height() + 50;
- }
- $(this).css({
- left: "90rem",
- top: t + "px"
- });
- rightIedCount++;
- });
- //计算主IED的高度
- var lastLeftEle = ied_strcut_detail.children("span.ied_show_block.left:last");
- var lastRigthEle = ied_strcut_detail.children("span.ied_show_block.right:last");
- if (lastLeftEle.length > 0 && lastRigthEle.length > 0) {
- selfIed.css("height", Math.max(lastLeftEle.position().top + lastLeftEle.height(), lastRigthEle.position().top + lastRigthEle.height()) + 50 + "px");
- } else if (lastLeftEle.length > 0)
- selfIed.css("height", Math.max(lastLeftEle.position().top + lastLeftEle.height(), 500) + 50 + "px");
- else if (lastRigthEle.length > 0)
- selfIed.css("height", Math.max(500, lastRigthEle.position().top + lastRigthEle.height()) + 50 + "px");
- if (selfIed.height() < 500) selfIed.height(500); //中间的主IED最小高度
- //当右边装置数量不是偶数时,需要重新排列右边装置的位置,主要是top位置
- //if (rightIedCount % 2 != 0) {
- var rightIedFirst = ied_strcut_detail.children("span.ied_show_block.right:first");
- if (rightIedFirst.length > 0) {
- var newRightFirstIedTop = (selfIed.height() - rightIedCount * (rightIedFirst.height() + (rightIedCount == 1 ? 0 : 50))) / 2;
- var topSubValue = newRightFirstIedTop - rightIedFirst.css("top").replace("px", "") * 1;
- //微调每一个右侧IED的top
- ied_strcut_detail.children("span.ied_show_block.right").each(function() {
- var v_ied_oldtop = $(this).css("top").replace("px", "") * 1;
- var t = v_ied_oldtop + topSubValue + selfIed.css("top").replace("px", "") * 1;
- if (t < 0) t = 0;
- $(this).css("top", t + "px");
- });
- }
- var leftIedFirst = ied_strcut_detail.children("span.ied_show_block.left:first");
- if (leftIedFirst.length > 0) {
- var newLeftFirstIedTop = (selfIed.height() - leftIedCount * (leftIedFirst.height() + (leftIedCount == 1 ? 0 : 50))) / 2;
- var topSubValue = newLeftFirstIedTop - leftIedFirst.css("top").replace("px", "") * 1;
- //微调每一个左侧IED的top
- ied_strcut_detail.children("span.ied_show_block.left").each(function() {
- var v_ied_oldtop = $(this).css("top").replace("px", "") * 1;
- var t = v_ied_oldtop + topSubValue + selfIed.css("top").replace("px", "") * 1;
- if (t < 0) t = 10;
- $(this).css("top", t + "px");
- });
- }
- ied_strcut_detail.append("<canvas id='canvas' class='abs canvas' style='width:100%;height:" + selfIed.height() + "px;z-index:0;pointer-events: none;'></canvas>");
- var canvas = this.p_createCanvas(ied_strcut_detail.find("canvas"));
- //绘制连接线
- //主设备的左右边连接点[x,y]
- var masterIedLeftJoinPoint = [selfIed.position().left + selfIed.css("margin-left").replace("px", "") * 1, selfIed.position().top + selfIed.height() / 2];
- var masterIedRightJoinPoint = [selfIed.position().left + selfIed.width() + selfIed.css("margin-left").replace("px", "") * 1, selfIed.position().top + selfIed.height() / 2];
- //绘制左边连接
- var inIedCnt = 0;
- ied_strcut_detail.children("span.ied_show_block.left").each(function(ind) {
- var t = $(this);
- var salveRightJoinPoint = [t.position().left + t.width() + 5 - (t.width() * 0.2), t.position().top + t.height() / 2];
- if (t.attr("ref_type") == "0") //输出到其他IED
- PoliceObject.p_drawLine(canvas, masterIedLeftJoinPoint, salveRightJoinPoint, "#134BEA");
- else if (t.attr("ref_type") == "1") {
- PoliceObject.p_drawLine(canvas, salveRightJoinPoint, [masterIedLeftJoinPoint[0], masterIedLeftJoinPoint[1] + inIedCnt * 5], "#516380");
- inIedCnt++;
- } else {
- PoliceObject.p_drawLine(canvas, [masterIedLeftJoinPoint[0], masterIedLeftJoinPoint[1] + inIedCnt * 5], salveRightJoinPoint, "#516380");
- PoliceObject.p_drawLine(canvas, salveRightJoinPoint, [masterIedLeftJoinPoint[0], masterIedLeftJoinPoint[1] + inIedCnt * 5], "#134BEA");
- inIedCnt++;
- }
- //var n1 = PoliceObject.p_drawNumber(ied_strcut_detail, masterIedLeftJoinPoint, salveRightJoinPoint, 12, "left");
- //n1.attr("ied_name", t.attr("ied_name"));
- });
- //绘制右边连接
- var outIedCnt = 0;
- ied_strcut_detail.children("span.ied_show_block.right").each(function(ind) {
- var t = $(this);
- var salveLeftJoinPoint = [t.position().left + (t.width() * 0.2) - 5, t.position().top + t.height() / 2];
- if (t.attr("ref_type") == "0") //输出到其他IED
- {
- PoliceObject.p_drawLine(canvas, masterIedRightJoinPoint, salveLeftJoinPoint, "#134BEA");
- } else if (t.attr("ref_type") == "1") {
- PoliceObject.p_drawLine(canvas, salveLeftJoinPoint, [masterIedRightJoinPoint[0], masterIedRightJoinPoint[1] + outIedCnt * 5], "#516380");
- outIedCnt++;
- } else {
- PoliceObject.p_drawLine(canvas, [masterIedRightJoinPoint[0], masterIedRightJoinPoint[1] + outIedCnt * 5], salveLeftJoinPoint, "#516380");
- PoliceObject.p_drawLine(canvas, salveLeftJoinPoint, [masterIedRightJoinPoint[0], masterIedRightJoinPoint[1] + outIedCnt * 5], "#134BEA");
- outIedCnt++;
- }
- //var n1 = PoliceObject.p_drawNumber(ied_strcut_detail, masterIedRightJoinPoint, salveLeftJoinPoint, 12, "right");
- //n1.attr("ied_name", t.attr("ied_name"));
- });
- },
- //指定指定SCD下的ied信息
- OtherIedList: {},
- GetIedData: function(ied_name, scdid) {
- if (scdid == null || scdid == PoliceObject.ScdID) scdid = "";
- var ieddata = scdid != PoliceObject.ScdID ? PoliceObject.OtherIedList[scdid + ied_name] : PoliceObject.IedList[ied_name];
- if (ieddata == null) {
- layer.msg("正在获取装置信息...", {
- time: 0
- });
- $.ajaxSettings.async = false;
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/relation", {
- "scd_id": (scdid == null || scdid == "") ? PoliceObject.ScdID : scdid,
- "ied_name": ied_name,
- "reset": "1"
- }, function(r) {
- $.ajaxSettings.async = true;
- if (r.code != 0) {
- layer.msg("获取装置信息失败:" + r.msg)
- return null;
- }
- layer.closeAll();
- if (r.data == null) {
- return null;
- }
- ieddata = r.data[ied_name];
- if (scdid != null && scdid != "" && scdid == PoliceObject.ScdID) PoliceObject.IedList[ied_name] = ieddata;
- else PoliceObject.OtherIedList[scdid + ied_name] = ieddata
- return ieddata;
- });
- $.ajaxSettings.async = true;
- }
- layer.closeAll();
- return ieddata;
- },
- LoadIedAllPointRelation: function(evt, refdata) {
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_allpoint_info").removeClass("hidden");
- ele.parents(".site_device_list").attr("ied_name", refdata.ied_name).find("b").html(refdata.desc + "(" + refdata.ied_name + ")—详细信息");
- var dataitemlist = ele.find("#ied_strcut_detail").html(PoliceObject.LoddingText);
- var curIedName = refdata.ied_name;
- /*
- for (var iedname in PoliceObject.IedList) {
- //输出关系
- if (curIedName == iedname) {
- for (var i = 0; i < PoliceObject.IedList[iedname].list.length; i++) {
- var itme = PoliceObject.IedList[iedname].list[i];
- if (itme.ref_type == "1") {
- //输入关系
- ref_ied_list.append('<span style="float:left;padding:1rem;margin:1rem;color:yellow">' + itme.ref_ied_desc + '</span>');
- } else {
- //输出关系
- ref_ied_list.append('<span style="float:left;padding:1rem;margin:1rem;">' + itme.ref_ied_desc + '</span>');
- }
- }
- }
- }*/
- var v_scdid = ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID;
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/inputs", {
- "scd_id": v_scdid,
- "ied_name": curIedName
- }, function(r) {
- PoliceObject.drawIedInputsRelation(v_scdid, refdata, dataitemlist, r.data);
- })
- },
- //绘制装置的输入输出关系图
- drawIedInputsRelation: function(v_scdid, refdata, dataitemlist, data) {
- var w = dataitemlist.width(),
- h = dataitemlist.height();
- var curIedName = refdata.ied_name
- //定义IED名称图形,该图形固定显示在中间,并且不显示连接点
- dataitemlist.html("<div ied_name='" + curIedName + "' class='ied'><span style='height: 9rem;background-color: #a9bdee;border-radius: 1rem 1rem 0 0;'><img src='/static/images/ied.png'><span class='ied_header_desc'>" + refdata.desc + "</span><span class='ied_header_name'>" + curIedName + "</span></span><span class='master_ied'></span></div>");
- var links = [];
- var tmp = {};
- var masterIed = dataitemlist.find(".master_ied");
- var preExtrefEle_no = 0;
- for (var i = 0; i < data.length; i++) {
- var item = data[i];
- if (item.no != null) {
- if (preExtrefEle_no > 0 && (preExtrefEle_no + 1) != (item.no * 1)) {
- //判断no是否是连续的,不连续时使用一个...代表中间有间隔
- masterIed.append("<div class='extref' style='font-size: 1.5rem;font-weight: bold;letter-spacing: 0.5rem;'><span>...</span></div>");
- }
- preExtrefEle_no = item.no * 1;
- }
- var daname = $.trim(item["attr_da_name"]) == "" ? "" : "." + item["attr_da_name"];
- var targetName = item["attr_ld_inst"] + "/" + item["attr_prefix"] + item["attr_ln_class"] + item["attr_ln_inst"] + "." + item["attr_do_name"] + daname;
- if (item.inout_type == "out") {
- masterIed.append("<div intAddr='" + targetName + "' to_ied_name='" + item.ied_name + "' to_addr='" + item["attr_int_addr"] + "' class='extref extref_opt_" + (item.opt || '') + "'><span class='extref_no'>" + (item["no"] || '') + "</span><span>" + targetName + "<br>" + item["do_source_desc"] + "</span><span class='linkpoint_right'></span><span class='extref_icon_opt_" + (item.opt || '') + "'></span></div>");
- } else {
- masterIed.append("<div intAddr='" + item["attr_int_addr"] + "' in_ied_name='" + item.ied_name + "' class='extref extref_opt_" + (item.opt || '') + "'><span class='linkpoint_left'></span><span class='extref_no'>" + (item["no"] || '') + "</span><span>" + item["attr_int_addr"] + "<br>" + item["do_target_desc"] + "</span><span class='extref_icon_opt_" + (item.opt || '') + "'></span></div>");
- }
- var ied_slave = dataitemlist.find(".ied." + item.inout_type + "[ied_name='" + item.ied_name + "']");
- if (ied_slave.length == 0) {
- var iedObj = PoliceObject.GetIedData(item.ied_name, item.scd_id || v_scdid)
- if (item.inout_type == "in") {
- var inIedCnt = dataitemlist.find(".ied.in:last");
- var top = inIedCnt.length == 0 ? 10 : inIedCnt.height() + inIedCnt.position().top + 10;
- if (iedObj == null) {
- console.log(item)
- continue;
- }
- dataitemlist.append("<div ied_name='" + item.ied_name + "' class='ied in' style='right:auto;left:25%;top:" + top + "px;width:20rem;'><span class='ied_header'><img src='/static/images/ied.png' style='height:4rem;width:5rem'><span class='ied_header_desc'>" + iedObj.desc + "</span><span class='ied_header_name'>" + item.ied_name + "</span></span><span class='master_ied'></span></div>");
- } else {
- var inIedCnt = dataitemlist.find(".ied.out:last");
- var top = inIedCnt.length == 0 ? 10 : inIedCnt.height() + inIedCnt.position().top + 10;
- if (iedObj == null) {
- console.log(item)
- continue;
- }
- dataitemlist.append("<div ied_name='" + item.ied_name + "' class='ied out' style='left:auto;right:10%;top:" + top + "px;width:20rem;'><span class='ied_header'><img src='/static/images/ied.png' style='height:4rem;width:5rem'><span class='ied_header_desc'>" + iedObj.desc + "</span><span class='ied_header_name'>" + item.ied_name + "</span></span><span class='master_ied'></span></div>");
- }
- ied_slave = dataitemlist.find(".ied." + item.inout_type + "[ied_name='" + item.ied_name + "']");
- }
- if (item.inout_type == "out") {
- ied_slave.attr("class", "ied out");
- //显示在主设备右边
- ied_slave.find(".master_ied").append("<div intAddr='" + item["attr_int_addr"] + "' in_ied_name='" + curIedName + "' class='extref'><span class='linkpoint_left '></span><span>" + item["attr_int_addr"] + "<br>" + item["do_target_desc"] + "</span></div>");
- } else {
- ied_slave.attr("class", "ied in");
- //显示在主设备左边
- ied_slave.find(".master_ied").append("<div intAddr='" + targetName + "' to_ied_name='" + curIedName + "' to_addr='" + item["attr_int_addr"] + "' class='extref'><span>" + targetName + "<br>" + item["do_source_desc"] + "</span><span class='linkpoint_right'></span></div>");
- }
- }
- if (item.opt == null) {
- dataitemlist.find(".ied").off().on('click', function() {
- //切换装置
- PoliceObject.LoadIedAllPointRelation(null, PoliceObject.GetIedData($(this).attr("ied_name"), v_scdid));
- });
- }
- var maxTopHei = 0;
- dataitemlist.find(".ied.out").each(function(ind) {
- var $t = $(this);
- var thisIedName = $t.attr("ied_name");
- var master_ied_first_extref = masterIed.children(".extref[to_ied_name='" + thisIedName + "']:first");
- if (ind == 0) {
- $t.css({
- "left": "auto",
- "right": "10%",
- "top": master_ied_first_extref.position().top + "px"
- });
- } else {
- var prev = dataitemlist.find(".ied.out:eq(" + (ind - 1) + ")");
- $t.css({
- "left": "auto",
- "right": "10%",
- "top": (prev.position().top * 1 + prev.height() + 30) + "px"
- });
- }
- var tmpH = $t.position().top * 1 + $t.height();
- if (maxTopHei < tmpH) maxTopHei = tmpH;
- });
- dataitemlist.find(".ied.in").each(function(ind) {
- var $t = $(this);
- if (ind == 0) {
- $t.css({
- "left": "20%",
- "right": "auto",
- "top": "1rem"
- });
- } else {
- var prev = dataitemlist.find(".ied.in:eq(" + (ind - 1) + ")");
- $t.css({
- "left": "20%",
- "right": "auto",
- "top": (prev.position().top * 1 + prev.height() + 30) + "px"
- });
- }
- var tmpH = $t.position().top * 1 + $t.height();
- if (maxTopHei < tmpH) maxTopHei = tmpH;
- });
- var masterParentIed = masterIed.parent();
- var master_ied_H = masterParentIed.position().top * 1 + masterParentIed.height();
- if (maxTopHei < master_ied_H) maxTopHei = master_ied_H;
- dataitemlist.append("<div class='ied blank' style='top:" + maxTopHei + "px;height:3rem;background: transparent;border: 0;'></div>");
- dataitemlist.slimscroll({
- height: dataitemlist.height() + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- dataitemlist.append("<canvas class='abs canvas' style='width:100%;height:" + maxTopHei + "px;z-index:1;pointer-events: none;'></canvas>");
- var canvas = PoliceObject.p_createCanvas(dataitemlist.find("canvas"));
- var lastIed = dataitemlist.find(".ied.blank");
- var topP = dataitemlist.offset();
- dataitemlist.find(".extref").each(function() {
- var $t = $(this),
- toiedname = $.trim($t.attr("to_ied_name")),
- toextref = $t.attr("to_addr");
- var currIedname = $t.parent().parent().attr("ied_name");
- if (toiedname == "") {
- return;
- }
- var point = $t.find(".linkpoint_right,.linkpoint_left");
- try {
- if (point.length > 0) {
- var toEle = dataitemlist.find(".ied[ied_name='" + toiedname + "'] .extref[intaddr='" + toextref + "'][in_ied_name='" + currIedname + "']").find(".linkpoint_right,.linkpoint_left");
- var p = point.position(),
- p1 = point.parents(".ied");
- var t = toEle.position(),
- t1 = toEle.parents(".ied");
- var sourceLeft = p1.position().left * 1;
- if (point.hasClass("linkpoint_right")) sourceLeft = sourceLeft + p1.width() + 5 - (p1.css("margin-left").replace("px", "") * -1);
- else sourceLeft = p1.left - (p1.css("margin-left").replace("px", "") * -1);
- var targetLeft = t1.position().left * 1;
- if (toEle.hasClass("linkpoint_right")) targetLeft = targetLeft + t1.width() + 5 - (t1.css("margin-left").replace("px", "") * -1);
- else targetLeft = targetLeft - (t1.css("margin-left").replace("px", "") * -1);
- //p_drawPoly(canvascontext, [sourceLeft, p.top * 1 - topP.top + 5], [targetLeft, t.top * 1 - topP.top + 5]);
- PoliceObject.p_drawLine(canvas, [sourceLeft, p1.position().top * 1 + 5 + point.parent().position().top + point.position().top], [targetLeft, t1.position().top + toEle.parent().position().top + toEle.position().top + 5], "#A6B1BF");
- }
- } catch (e) {
- console.log(e)
- }
- })
- },
- //加载装置基本信息
- LoadIedStrcut: function(evt, ieddata) {
- //console.log(ieddata)
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_basicinfo").removeClass("hidden");
- if (ele.parent().hasClass("slimScrollDiv")) {
- ele.parent().removeClass("hidden");
- }
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(PoliceObject.LoddingText);
- ele.slimscroll({
- height: ele.height() + "px",
- width: "100%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- var iddXY = ied_strcut_detail.position();
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/attrs", {
- "scd_id": ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "node_id": ieddata.node_id,
- "ied_name": ieddata.ied_name,
- }, function(list) {
- var thisIedName = list.data.name;
- var wh = 200 * wRate;
- var l = (ele.width() - wh) / 2;
- ied_strcut_detail.html('<div class="ied_strcut" style="position:absolute;background-size:contain;background-repeat: no-repeat;background-image:url(/static/images/default_ied.png);width:' + wh + 'px;height:' + wh + 'px;left:' + l + 'px;top:30%;"><div class="ied_strcut_desc text_overflow" title="' + list.data.desc + '">' + list.data.desc + '</div><div class="ied_strcut_manufacturer text_overflow" style="top:50%;left:63%;" title="' + list.data.name + '">' + list.data.name + '</div><div class="ied_strcut_manufacturer text_overflow" title="' + list.data.manufacturer + '">' + list.data.manufacturer + '</div><div class="ied_strcut_type text_overflow" title="' + list.data.type + '">' + list.data.type + '</div></div>');
- //生成IED装备固上定位置的连接点(上下左右)
- var tmpIed = ied_strcut_detail.find(".ied_strcut");
- var tmpIedOffset = tmpIed.position();
- //主设备上的4连接点坐标
- var iedTopPointXY = [tmpIedOffset.left + tmpIed.width() / 2, tmpIedOffset.top - iddXY.top];
- var iedBottompointXY = [tmpIedOffset.left + tmpIed.width() / 2, tmpIedOffset.top - iddXY.top + tmpIed.height()];
- var iedLeftPointXY = [tmpIedOffset.left, tmpIedOffset.top - iddXY.top + tmpIed.height() / 2];
- var iedRightPointXY = [tmpIedOffset.left + tmpIed.width(), tmpIedOffset.top - iddXY.top + tmpIed.height() / 2];
- //在界面上创建主IED在连接点
- ied_strcut_detail.append('<span accessPoint="ied" class="ied_linkpoint left hidden" ind=2 style="top: ' + iedLeftPointXY[1] + 'px;left: ' + iedLeftPointXY[0] + 'px;"></span><span accessPoint="ied" ind=1 class="ied_linkpoint middle hidden" style="left: ' + iedBottompointXY[0] + 'px;top: ' + iedBottompointXY[1] + 'px;"></span><span accessPoint="ied" ind=3 class="ied_linkpoint right hidden" style="left: ' + iedRightPointXY[0] + 'px;top: ' + iedRightPointXY[1] + 'px;"></span><span accessPoint="ied" ind="" class="ied_linkpoint top" style="left: ' + iedTopPointXY[0] + 'px;top: ' + iedTopPointXY[1] + 'px;"></span>');
- //固定的dataset关系
- ied_strcut_detail.append('<div class="accessPoint" accessPoint="DataSet" style="position:absolute;top:1rem;left:48.2%;width: 6rem;background: transparent;color: aqua;"></div><span class="ied_linkpoint" accessPoint="DataSet" style="top: 6rem;left: 2.22rem;"></span>');
- var accesspointEle = ied_strcut_detail.find(".accessPoint[accessPoint='DataSet']").css("left", function() {
- return iedTopPointXY[0] - $(this).width() / 2;
- });
- var datasetPointStart = ied_strcut_detail.find(".ied_linkpoint[accessPoint='DataSet']").css({
- "left": iedTopPointXY[0],
- "top": accesspointEle.position().top + accesspointEle.height() - iddXY.top - 10
- });
- //生成固定的dataset连接线
- var datasetlineheight = (iddXY.top + iedTopPointXY[1] - datasetPointStart.position().top);
- ied_strcut_detail.append('<div class="line" style="position:absolute;top:' + (datasetPointStart.position().top - iddXY.top + datasetPointStart.height()) + 'px;left:' + (iedTopPointXY[0] + 2.5) + 'px;width: 1px;background: #134BEA;color: #516380;font-size: 1rem;height: ' + datasetlineheight + 'px;line-height:' + datasetlineheight + 'px;">DataSet</div>');
- //加载DataSet列表
- PoliceObject.LoadDataSet(thisIedName);
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "pagesize": 10000,
- "ied_name": thisIedName,
- "name": "AccessPoint"
- }, function(result) {
- //生成访问点并进行布局。现固定支持最多3个accesspoint
- for (var i = 0; i < result.data.length; i++) {
- var master_link_point = ied_strcut_detail.find(".ied_linkpoint[ind=" + (i + 1) + "]").removeClass("hidden");
- if (master_link_point.length == 0) continue;
- var item = result.data[i];
- var css = "";
- var linkpoint_css = "";
- var top = master_link_point.position().top - iddXY.top;
- var linpoint_left = 0;
- if (i == 0) {
- //底边区域:第一个访问点生成及位置
- var top1 = top + 120;
- var left = master_link_point.position().left - ied_strcut_detail.width() / 2;
- //left=master_link_point.offset().left-left;
- css = 'width:39rem;height:auto;left:50%;top:' + top1 + 'px;margin-left: -20rem;min-height: 5rem;';
- linpoint_left = iedBottompointXY[0];
- linkpoint_css = 'top: ' + (top1 - 5) + 'px;';
- } else if (i == 1) {
- //右边区域:第2个访问点生成及位置
- var top1 = top - 20;
- css = 'width:39rem;height:auto;left:17%;top:' + top1 + 'px;margin-left: -20rem;min-height: 5rem;';
- linkpoint_css = 'top: ' + iedLeftPointXY[1] + 'px;';
- } else if (i == 2) {
- //右边区域:第3个访问点生成及位置
- var top1 = top - 20;
- //var left=master_link_point.offset().left-ied_strcut_detail.width()*0.75;
- css = 'width:39rem;height:auto;left:80%;top:' + top1 + 'px;margin-left: -20rem;min-height: 5rem;';
- linkpoint_css = 'top: ' + iedRightPointXY[1] + 'px;';
- }
- //生成AccessPoint区域
- ied_strcut_detail.append('<div class="accessPoint" accessPoint="' + item.attr_name + '" style="' + css + '"><div class="accessPoint_name">' + item.attr_name + ' (' + (item.attr_desc || '—') + ')</div><div class="networkinfo">正在加载网络信息...</div><div class="networkinfo_nmuber hidden"></div><div class="ldevice_list"><span style="position: absolute;top: -1rem;left: 1rem;background: #516380;line-height: 2rem;padding: 0 1rem;border-radius: 1rem;font-size: 1.4rem;color:#fff">LDevice</span></div></div>');
- if (i > 0) {
- //计算左右2侧accesspoint上的连接点left位置
- accesspointEle = ied_strcut_detail.find(".accessPoint[accessPoint='" + item.attr_name + "']");
- linpoint_left = accesspointEle.position().left + accesspointEle.css("margin-left").replace("px", "") * 1;
- if (i == 1) linpoint_left = linpoint_left + accesspointEle.width();
- }
- //生成目标连接点
- ied_strcut_detail.append('<span class="ied_linkpoint" accessPoint="' + item.attr_name + '" ind=' + (i + 1) + ' style="left:' + linpoint_left + 'px;' + linkpoint_css + '"></span>');
- }
- //生成连线
- ied_strcut_detail.find(".ied_linkpoint[accessPoint='ied']").each(function() {
- var $t = $(this),
- start = $t.position();
- if (!$t.hasClass("hidden")) {
- var ind = $t.attr("ind");
- if (ind == "") return; //dataset的连接点不具备ind属性
- //需要连接的目标AccessPoint
- var toEle = ied_strcut_detail.find(".ied_linkpoint[ind=" + ind + "][accessPoint!='ied']"),
- to = toEle.position();
- //计算连线长度
- var line_width = Math.abs(start.left - to.left);
- if (ind == 1) {
- //连线高度
- line_width = Math.abs(start.top - to.top);
- ied_strcut_detail.append('<div class="line" style="position:absolute;height:' + line_width + 'px;width:1px;background-color:#134BEA;left:' + (start.left + $t.width() / 2) + 'px;top:' + (start.top - iddXY.top + $t.height() / 2) + 'px;color: #516380;font-size: 1rem;line-height: ' + line_width + 'px;">AccessPoint</div>');
- } else {
- //判断目标AccessPoint在主IED在左边还是右边
- if (start.left < to.left)
- ied_strcut_detail.append('<div class="line" style="position:absolute;height:1px;width:' + line_width + 'px;background-color:#134BEA;left:' + (start.left + $t.width()) + 'px;top:' + (start.top - iddXY.top + $t.height() / 2) + 'px;color: #516380;font-size: 1rem;line-height: 0rem;">AccessPoint</div>');
- else {
- ied_strcut_detail.append('<div class="line" style="position:absolute;height:1px;width:' + line_width + 'px;background-color:#134BEA;left:' + (to.left + toEle.width()) + 'px;top:' + (to.top - iddXY.top + toEle.height() / 2) + 'px;color: #516380;font-size: 1rem;line-height: 0rem;">AccessPoint</div>');
- }
- }
- }
- });
- //获取每个访问点下的Ldevice列表
- for (var i = 0; i < result.data.length; i++) {
- PoliceObject.LoadLdeviceList(result.data[i].node_id, result.data[i].attr_name);
- }
- //获取设备的网络信息
- PoliceObject.LoadIedNetWorkInfo(ieddata.ied_name, ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID, function(r) {
- var tmpEle = ied_strcut_detail.find(".accessPoint .networkinfo").html("");
- for (var i = 0; i < r.length; i++) {
- var apName = r[i].ap_name;
- var accesspointEle = ied_strcut_detail.find(".accessPoint[accessPoint='" + apName + "']");
- if (accesspointEle.length == 0) continue;
- var address_json = $.trim(r[i].address_json);
- if (address_json == "") continue;
- address_json = JSON.parse(address_json);
- var accesspointNetEle = accesspointEle.children(".networkinfo");
- var netHtml = [];
- netHtml.push('<div cbname="' + r[i].cb_name + '">');
- netHtml.push('<div><span class="f_l v_label">MAC-Address:</span><span class="f_l v_value">' + (address_json['MAC-Address'] || "无") + '</span></div>');
- netHtml.push('<div><span class="f_l v_label">VLAN-PRIORITY:</span><span class="f_l v_value">' + (address_json['VLAN-PRIORITY'] || "无") + '</span></div>');
- netHtml.push('<div><span class="f_l v_label">APPID:</span><span class="f_l v_value">' + (address_json['APPID'] || "无") + '</span></div>');
- netHtml.push('<div><span class="f_l v_label">VLAN-ID:</span><span class="f_l v_value">' + (address_json['VLAN-ID'] || "无") + '</span></div>');
- netHtml.push('</div>');
- accesspointNetEle.append(netHtml.join(""));
- var accesspointNumnerEle = accesspointEle.children(".networkinfo_nmuber");
- accesspointNumnerEle.append('<span title="' + r[i].cb_name + '">' + (accesspointNumnerEle.children("span").length + 1) + '</span>');
- }
- ied_strcut_detail.find(".accessPoint[accessPoint]").each(function() {
- var t123 = $(this).find(".networkinfo");
- if (t123.children("div").length == 0) {
- t123.addClass("hidden")
- }
- });
- ied_strcut_detail.find(".networkinfo_nmuber").each(function() {
- var me = $(this);
- var mespan = me.children('span');
- if (mespan.length > 1) me.removeClass("hidden");
- else return;
- mespan.off().on('click', function() {
- var t = $(this);
- var tp = t.parent().prev();
- t.parent().children(".active").removeClass("active");
- tp.children("div").addClass("hidden");
- tp.children("div[cbname='" + t.attr("title") + "']").removeClass("hidden");
- t.addClass("active");
- }).eq(0).trigger('click');
- });
- });
- });
- });
- },
- //加载装置定值条目
- LoadIedDingzhiTable: function(evt, ieddata) {
- ///api/screen/scd/dingzhi/list?scd_id=4000002&pagesize=10000&ied_name=AE1101&name=DataSet
- var $t = null;
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_dingzhiinfo").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(PoliceObject.LoddingText);
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/dingzhi", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- layer.msg(jsondata.msg)
- return;
- }
- if (jsondata.data.length == 0) {
- ied_strcut_detail.html(Tools.HintText("没有定值信息"));
- return;
- }
- ied_strcut_detail.html('<div class="datasetlist" style="width:100%;height:32%;margin: 1rem;border: 1px solid #ededed;"></div><div style="width:100%;height:2rem;text-align: left;line-height: 2rem;"><span style="margin: 0 2rem;font-weight: bold;">定值条目列表详情(共 <b id="dataset_fcda_total"></b> 条)</span></div><div class="fcdalist" style="width:100%;height:64%;margin: 1rem;"></div>');
- var tmpDsList = ied_strcut_detail.find(".datasetlist");
- for (var i = 0; i < jsondata.data.length; i++) {
- jsondata.data[i]["fcdalist"] = JSON.stringify(jsondata.data[i]["list"]);
- }
- tmpDsList.html(template("dingzhi_datasetlist_tpl", jsondata)).find("tbody>tr").off('click').on('click', function() {
- tmpDsList.find("tr.active").removeClass("active");
- var fcdalist = $.trim($(this).addClass("active").attr("fcdalist"));
- var targetdiv = ied_strcut_detail.find(".fcdalist");
- $("#dataset_fcda_total").html("-");
- if (fcdalist == "") {
- targetdiv.html(Tools.HintText("没有条目信息"));
- return;
- }
- fcdalist = JSON.parse(fcdalist);
- ied_strcut_detail.find("#dataset_fcda_total").html(fcdalist.length);
- targetdiv.html(template("dingzhi_fcdalist_tpl", {
- "data": fcdalist
- })).find("tbody>tr").off('click').on('click', function() {
- targetdiv.find("tr.active").removeClass("active");
- $(this).addClass("active");
- });
- targetdiv.children(".detailtable").slimscroll({
- height: targetdiv.height() - targetdiv.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- });
- tmpDsList.children(".detailtable").slimscroll({
- height: tmpDsList.height() - (tmpDsList.css("margin").replace("px", "") * 2) - tmpDsList.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- tmpDsList.height(tmpDsList.height() - 24).find("tbody>tr:first").trigger('click');
- });
- },
- //加载信息点表
- LoadIedPointTable: function(evt, ieddata) {
- ///api/screen/scd/dingzhi/list?scd_id=4000002&pagesize=10000&ied_name=AE1101&name=DataSet
- var $t = null;
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_pointtableinfo").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(PoliceObject.LoddingText);
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/pointtable", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- layer.msg(jsondata.msg)
- return;
- }
- if (jsondata.data.length == 0) {
- ied_strcut_detail.html(Tools.HintText("没有信息点表"));
- return;
- }
- ied_strcut_detail.html('<div class="datasetlist" style="width:100%;height:42%;margin: 1rem;border: 1px solid #ededed;"></div><div style="width:100%;height:2rem;text-align: left;line-height: 2rem;"><span style="margin: 0 2rem;font-weight: bold;">点表条目列表详情(共 <b id="dataset_fcda_total"></b> 条)</span></div><div class="fcdalist" style="width:100%;height:54%;margin: 1rem;"></div>');
- var tmpDsList = ied_strcut_detail.find(".datasetlist");
- for (var i = 0; i < jsondata.data.length; i++) {
- jsondata.data[i]["fcdalist"] = JSON.stringify(jsondata.data[i]["list"]);
- jsondata.data[i]["point_cnt"] = jsondata.data[i]["list"].length;
- }
- tmpDsList.html(template("pointtable_datasetlist_tpl", jsondata)).find("tbody>tr").off('click').on('click', function() {
- tmpDsList.find("tr.active").removeClass("active");
- var fcdalist = $.trim($(this).addClass("active").attr("fcdalist"));
- var targetdiv = ied_strcut_detail.find(".fcdalist");
- $("#dataset_fcda_total").html("-");
- if (fcdalist == "") {
- targetdiv.html(Tools.HintText("没有条目信息"));
- return;
- }
- fcdalist = JSON.parse(fcdalist);
- ied_strcut_detail.find("#dataset_fcda_total").html(fcdalist.length);
- targetdiv.html(template("pointtable_fcdalist_tpl", {
- "data": fcdalist
- })).find("tbody>tr").off('click').on('click', function() {
- targetdiv.find("tr.active").removeClass("active");
- $(this).addClass("active");
- });
- targetdiv.children(".detailtable").slimscroll({
- height: targetdiv.height() - targetdiv.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- });
- tmpDsList.children(".detailtable").slimscroll({
- height: tmpDsList.height() - (tmpDsList.css("margin").replace("px", "") * 2) - tmpDsList.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- tmpDsList.height(tmpDsList.height() - 24).find("tbody>tr:first").trigger('click');
- });
- },
- //加载信息点表
- LoadIedSourceXML: function(evt, ieddata) {
- var $t = null;
- if (evt != null) {
- var $t = $(evt);
- //切换显示div
- var chs = $t.parents(".dataitemlist").children(".content");
- chs.children("div:eq(" + $t.index() + ")").removeClass("hidden");
- chs.children("div:not(" + $t.index() + ")").addClass("hidden");
- }
- var ele = $("#ied_sourcexmlinfo").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(PoliceObject.LoddingText);
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/sourcexml", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- layer.msg(jsondata.msg)
- return;
- }
- ied_strcut_detail.html("<textarea style='width:100%;height:98%;border: 1px solid #d3d1d1;color: #666;font-family: initial;padding-left: 1rem;'>" + formateXml(jsondata.data) + "</textarea>");
- });
- },
- //加载SV发送列表
- LoadIedSVSendBlockTable: function(evt, ieddata) {
- var ele = $("#ied_relation").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(Tools.LoadingText("正在加载装置(" + ieddata.ied_name + ")数据中..."));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/ctrlblock", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- ied_strcut_detail.html(jsondata.msg);
- return;
- }
- if (jsondata.data.SampledValueControl == null || jsondata.data.SampledValueControl.length == 0) {
- ied_strcut_detail.html(Tools.HintText("该装置无SV发送"))
- return;
- }
- var h = template('svsend_datasetlist_tpl', {
- "data": jsondata.data.SampledValueControl
- });
- ied_strcut_detail.html('<div class="datasetlist" style="width:100%;height:42%;margin: 1rem;border: 1px solid #ededed;"></div><div style="width:100%;height:2rem;text-align: left;line-height: 2rem;"><span style="margin: 0 2rem;font-weight: bold;">SMV端子列表详情(共 <b id="dataset_fcda_total"></b> 条)</span></div><div class="fcdalist" style="width:100%;height:50%;margin: 1rem;"></div>');
- var tmpDsList = ied_strcut_detail.find(".datasetlist");
- tmpDsList.html(h).find("tbody>tr").off('click').on('click', function() {
- tmpDsList.find("tr.active").removeClass("active");
- var fcdalist = $.trim($(this).addClass("active").attr("fcdalist"));
- var ctrlId = $(this).attr("ctrl_id")
- var targetdiv = ied_strcut_detail.find(".fcdalist");
- $("#dataset_fcda_total").html("-");
- targetdiv.html(Tools.HintText("正在加载端子列表数据..."));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/smv_ctrlblock/sendfcdalist", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name,
- "ctrlid": ctrlId
- }, function(jsondata) {
- if (jsondata.code != 0) {
- targetdiv.html(Tools.HintText(jsondata.msg));
- return;
- }
- if (jsondata.data == null || jsondata.data.length == 0) {
- $("#dataset_fcda_total").html("0");
- targetdiv.html(Tools.HintText("未查找到端子列表"));
- return;
- }
- $("#dataset_fcda_total").html(jsondata.data.length);
- targetdiv.html(template('svsend_fcdalist_tpl', jsondata));
- targetdiv.children(".detailtable").slimscroll({
- height: targetdiv.height() - targetdiv.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- })
- });
- tmpDsList.children(".detailtable").slimscroll({
- height: tmpDsList.height() - (tmpDsList.css("margin").replace("px", "") * 2) - tmpDsList.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- tmpDsList.height(tmpDsList.height() - 24).find("tbody>tr:first").trigger('click');
- });
- },
- //加载SV接收列表
- LoadIedSVReviceBlockTable: function(evt, ieddata) {
- var ele = $("#ied_relation").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(Tools.LoadingText("正在加载装置(" + ieddata.ied_name + ")数据中..."));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/smv_ctrlblock/receive", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- ied_strcut_detail.html(jsondata.msg);
- return;
- }
- if (jsondata.data == null || jsondata.data.length == 0) {
- ied_strcut_detail.html(Tools.HintText("该装置无SV接收"))
- return;
- }
- //拆分为主从结构
- var masterdatalist = [],
- tmplist = {};
- for (var i = 0; i < jsondata.data.length; i++) {
- var item = jsondata.data[i];
- var key = item.out_ied_name + item.out_smv_ctrl_name + item.out_dataset_name;
- if (tmplist[key] == null) {
- tmplist[key] = {
- "info": item,
- "list": [item]
- };
- } else {
- tmplist[key]["list"].push(item);
- }
- }
- for (var k in tmplist) {
- tmplist[k]["info"]["list"] = JSON.stringify(tmplist[k]["list"]);
- masterdatalist.push(tmplist[k]);
- }
- var h = template('svrev_datasetlist_tpl', {
- "data": masterdatalist
- });
- tmplist = null;
- masterdatalist = null;
- ied_strcut_detail.html('<div class="datasetlist" style="width:99%;height:42%;margin: 1rem;border: 1px solid #ededed;"></div><div style="width:99%;height:2rem;text-align: left;line-height: 2rem;"><span style="margin: 0 2rem;font-weight: bold;">SMV端子列表详情(共 <b id="dataset_fcda_total"></b> 条)</span></div><div class="fcdalist" style="width:100%;height:50%;margin: 1rem;"></div>');
- var tmpDsList = ied_strcut_detail.find(".datasetlist");
- tmpDsList.html(h).find("tbody>tr").off('click').on('click', function() {
- tmpDsList.find("tr.active").removeClass("active");
- var fcdalist = $.trim($(this).addClass("active").attr("fcdalist"));
- var ctrlId = $(this).attr("ctrl_id")
- var targetdiv = ied_strcut_detail.find(".fcdalist");
- ied_strcut_detail.find("#dataset_fcda_total").html("-");
- if (fcdalist == "") {
- ied_strcut_detail.find("#dataset_fcda_total").html("0");
- targetdiv.html(Tools.HintText("未查找到端子列表"));
- return;
- }
- fcdalist = JSON.parse(fcdalist);
- ied_strcut_detail.find("#dataset_fcda_total").html(fcdalist.length);
- targetdiv.html(template('svrev_fcdalist_tpl', {
- "data": fcdalist
- }));
- targetdiv.children(".detailtable").slimscroll({
- height: targetdiv.height() - targetdiv.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- });
- tmpDsList.children(".detailtable").slimscroll({
- height: tmpDsList.height() - (tmpDsList.css("margin").replace("px", "") * 2) - tmpDsList.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- tmpDsList.height(tmpDsList.height() - 24).find("tbody>tr:first").trigger('click');
- });
- },
- //加载goose发送列表
- LoadIedGooseSendBlockTable: function(evt, ieddata) {
- var ele = $("#ied_relation").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(Tools.LoadingText("正在加载装置(" + ieddata.ied_name + ")数据中..."));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/ctrlblock", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- ied_strcut_detail.html(jsondata.msg);
- return;
- }
- if (jsondata.data.GSEControl == null || jsondata.data.GSEControl.length == 0) {
- ied_strcut_detail.html(Tools.HintText("该装置无GOOSE发送"))
- return;
- }
- var h = template('goosesend_datasetlist_tpl', {
- "data": jsondata.data.GSEControl
- });
- ied_strcut_detail.html('<div class="datasetlist" style="width:100%;height:42%;margin: 1rem;border: 1px solid #ededed;"></div><div style="width:100%;height:2rem;text-align: left;line-height: 2rem;"><span style="margin: 0 2rem;font-weight: bold;">GOOSE端子列表详情(共 <b id="dataset_fcda_total"></b> 条)</span></div><div class="fcdalist" style="width:100%;height:50%;margin: 1rem;"></div>');
- var tmpDsList = ied_strcut_detail.find(".datasetlist");
- tmpDsList.html(h).find("tbody>tr").off('click').on('click', function() {
- tmpDsList.find("tr.active").removeClass("active");
- var fcdalist = $.trim($(this).addClass("active").attr("fcdalist"));
- var ctrlId = $(this).attr("ctrl_id")
- var targetdiv = ied_strcut_detail.find(".fcdalist");
- $("#dataset_fcda_total").html("-");
- targetdiv.html(Tools.HintText("正在加载端子列表数据..."));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/goose_ctrlblock/sendfcdalist", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name,
- "ctrlid": ctrlId
- }, function(jsondata) {
- if (jsondata.code != 0) {
- targetdiv.html(Tools.HintText(jsondata.msg));
- return;
- }
- if (jsondata.data == null || jsondata.data.length == 0) {
- $("#dataset_fcda_total").html("0");
- targetdiv.html(Tools.HintText("未查找到端子列表"));
- return;
- }
- $("#dataset_fcda_total").html(jsondata.data.length);
- targetdiv.html(template('goosesend_fcdalist_tpl', jsondata));
- targetdiv.children(".detailtable").slimscroll({
- height: targetdiv.height() - targetdiv.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- })
- });
- tmpDsList.children(".detailtable").slimscroll({
- height: tmpDsList.height() - (tmpDsList.css("margin").replace("px", "") * 2) - tmpDsList.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- tmpDsList.height(tmpDsList.height() - 24).find("tbody>tr:first").trigger('click');
- });
- },
- //加载GOOSE接收列表
- LoadIedGooseReviceBlockTable: function(evt, ieddata) {
- var ele = $("#ied_relation").removeClass("hidden");
- var ied_strcut_detail = ele.find("#ied_strcut_detail").html(Tools.LoadingText("正在加载装置(" + ieddata.ied_name + ")数据中..."));
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ied/goose_ctrlblock/receive", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "ied_name": ieddata.ied_name
- }, function(jsondata) {
- if (jsondata.code != 0) {
- ied_strcut_detail.html(jsondata.msg);
- return;
- }
- if (jsondata.data == null || jsondata.data.length == 0) {
- ied_strcut_detail.html(Tools.HintText("该装置无GOOSE接收"))
- return;
- }
- //拆分为主从结构
- var masterdatalist = [],
- tmplist = {};
- for (var i = 0; i < jsondata.data.length; i++) {
- var item = jsondata.data[i];
- var key = item.out_ied_name + item.out_smv_ctrl_name + item.out_dataset_name;
- if (tmplist[key] == null) {
- tmplist[key] = {
- "info": item,
- "list": [item]
- };
- } else {
- tmplist[key]["list"].push(item);
- }
- }
- for (var k in tmplist) {
- tmplist[k]["info"]["list"] = JSON.stringify(tmplist[k]["list"]);
- masterdatalist.push(tmplist[k]);
- }
- var h = template('gooserev_datasetlist_tpl', {
- "data": masterdatalist
- });
- tmplist = null;
- masterdatalist = null;
- ied_strcut_detail.html('<div class="datasetlist" style="width:100%;height:42%;margin: 1rem;border: 1px solid #ededed;"></div><div style="width:100%;height:2rem;text-align: left;line-height: 2rem;"><span style="margin: 0 2rem;font-weight: bold;">GOOSE端子列表详情(共 <b id="dataset_fcda_total"></b> 条)</span></div><div class="fcdalist" style="width:100%;height:50%;margin: 1rem;"></div>');
- var tmpDsList = ied_strcut_detail.find(".datasetlist");
- tmpDsList.html(h).find("tbody>tr").off('click').on('click', function() {
- tmpDsList.find("tr.active").removeClass("active");
- var fcdalist = $.trim($(this).addClass("active").attr("fcdalist"));
- var ctrlId = $(this).attr("ctrl_id")
- var targetdiv = ied_strcut_detail.find(".fcdalist");
- ied_strcut_detail.find("#dataset_fcda_total").html("-");
- if (fcdalist == "") {
- ied_strcut_detail.find("#dataset_fcda_total").html("0");
- targetdiv.html(Tools.HintText("未查找到端子列表"));
- return;
- }
- fcdalist = JSON.parse(fcdalist);
- ied_strcut_detail.find("#dataset_fcda_total").html(fcdalist.length);
- targetdiv.html(template('gooserev_fcdalist_tpl', {
- "data": fcdalist
- }));
- targetdiv.children(".detailtable").slimscroll({
- height: targetdiv.height() - targetdiv.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- });
- tmpDsList.children(".detailtable").slimscroll({
- height: tmpDsList.height() - (tmpDsList.css("margin").replace("px", "") * 2) - tmpDsList.find(".headertable").height() + "px",
- width: "99%",
- alwaysVisible: false,
- wheelStep: 10,
- size: "6px",
- color: "#03aee7"
- });
- tmpDsList.height(tmpDsList.height() - 24).find("tbody>tr:first").trigger('click');
- });
- },
- //加载DataSet列表
- LoadDataSet: function(thisIedName) {
- var $ied_strcut = $("#ied_basicinfo");
- var $datasetList = $("#ied_basicinfo #dataset_list");
- if ($datasetList.length == 0) {
- $ied_strcut.append('<div id="dataset_list"></div>');
- $datasetList = $("#ied_basicinfo #dataset_list");
- } else {
- $datasetList.removeClass("hidden").html("");
- }
- var datasetEle = $ied_strcut.find(".accessPoint[accessPoint='DataSet']");
- $datasetList.css({
- "left": "1rem",
- "top": datasetEle.position().top
- });
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": $ied_strcut.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "pagesize": 10000,
- "ied_name": thisIedName,
- "name": "DataSet"
- }, function(result) {
- var eles = [];
- for (var i = 0; i < result.data.length; i++) {
- eles.push('<span dataset_id="' + result.data[i].node_id + '"><i class="fa fa-database"></i><span class="f_l" style="width:100%;font-weight: 400;font-size:1.4rem;">' + result.data[i].attr_name + '</span><span class="f_l" style="width:100%;color:#A38BF3;font-weight: 800;font-size:1.2rem;">(' + result.data[i].attr_desc + ')</span></span>');
- }
- $datasetList.html(eles.join("")).children("span").off().on('click', function() {
- var t = $(this);
- PoliceObject.LoadFCDAList(this, t.attr("dataset_id"), t.find("span:last").text());
- });
- var datasetPoint = $(".ied_linkpoint[accesspoint='DataSet']").css({
- "top": $datasetList.position().top + $datasetList.height() + (15 * hRate) + "px"
- })
- var h1 = $(".ied_linkpoint.top").position().top - datasetPoint.position().top;
- datasetPoint.next().css({
- "top": datasetPoint.position().top + 5 + "px",
- "height": h1 + "px",
- "line-height": h1 + "px"
- });
- });
- },
- //加载AccessPoint下的LDevice列表
- LoadLdeviceList: function(accessPointId, accessPointName) {
- var ele = $("#ied_basicinfo .accessPoint[accesspoint='" + accessPointName + "']");
- if (ele.length == 0) return;
- $.getJSON(Global.AccessUrl + "/api/screen/scd/ldevice/list", {
- "scd_id": ele.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "accessPointId": accessPointId
- }, function(r) {
- if (r.data == null) {
- return;
- }
- var $ldeviceList = ele.find(".ldevice_list");
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- var txt = item.attr_inst;
- if (item.attr_desc != "") txt += "<br><font style='font-size:1rem;color: #94A3B8;'>" + item.attr_desc + "</font>";
- $ldeviceList.append('<span title="点击查看LN" onclick="PoliceObject.LoadLnList(this,\'' + item.node_id + '\')" class="ldevice_item" ldevice_id="' + item.node_id + '"><img src="/static/images/ldevice.png"><div>' + txt + '</div></span>');
- }
- });
- },
- //加载LDevice下的LN列表
- LoadLnList: function(ele, ldeviceId) {
- var $ied_strcut = $("#ied_basicinfo");
- var ied_strcut_detail = $("#ied_basicinfo #ied_strcut_detail");
- layer.msg("正在加载LN列表...", {
- time: 0
- });
- var showLnList = $ied_strcut.find("#showLnList");
- if (showLnList.length == 0) {
- $ied_strcut.append("<div id='showLnList'><span style='cursor:pointer;position:absolute;top:7px;right:7px;color:#299BFF;font-size:1.5rem;z-index:100' class='fa fa-times' onclick='$(\"#showLnList\").remove();'></span><span class='caption'></span><span class='ln_list_title'><table style='width:100%;text-align: center;font-size: 1rem;'><thead><tr><td style='width:7%'>序号</td><td style='width:8%'>inst</td><td style='width:10%'>lnClass</td><td style='width:40%'>lnType</td><td style='width:35%'>desc</td></tr></thead></table></span><span class='ln_list'><table style='width:100%;text-align: center;color: #ccc;font-size: 1rem;color:#09162C'></table></span></div>");
- showLnList = $ied_strcut.find("#showLnList");
- } else {
- showLnList.removeClass("hidden").find(".ln_list table").html("");
- }
- var toEle = $(ele),
- toXY = toEle.position();
- showLnList.find(".caption").html(toEle.text() + "—LN/LN0节点列表");
- showLnList.css({
- top: $ied_strcut.height() * 0.25,
- left: ($ied_strcut.width() - showLnList.width()) / 2
- });
- var lndatalistEle = showLnList.find(".ln_list table");
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "parent_node_id": ldeviceId,
- "pagesize": 1000,
- "name": "LN0"
- }, function(r) {
- var trs = [];
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- trs.push("<tr json='" + JSON.stringify(item) + "' node_id=" + item.node_id + "><td style='width:7%'>1</td><td class='text_overflow' style='width:8%'>" + (item.attr_inst || " ") + "</td><td class='text_overflow' style='width:10%'>" + item.attr_ln_class + "</td><td class='text_overflow' style='width:40%'>" + item.attr_ln_type + "</td><td class='text_overflow' style='width:35%'>" + item.attr_desc + "</td></tr>");
- }
- lndatalistEle.prepend(trs.join(""));
- lndatalistEle.find("tr").each(function(ind, ele) {
- $(ele).children("td:first").html(ind + 1);
- });
- });
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "parent_node_id": ldeviceId,
- "pagesize": 1000,
- "name": "LN"
- }, function(r) {
- var trs = [];
- layer.closeAll();
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- trs.push("<tr json='" + JSON.stringify(item) + "' node_id=" + item.node_id + "><td style='width:7%'>序号</td><td class='text_overflow' style='width:8%'>" + (item.attr_inst || " ") + "</td><td class='text_overflow' style='width:10%'>" + item.attr_ln_class + "</td><td class='text_overflow' style='width:40%'>" + item.attr_ln_type + "</td><td class='text_overflow' style='width:35%'>" + item.attr_desc + "</td></tr>");
- }
- lndatalistEle.append(trs.join(""));
- lndatalistEle.find("tr").each(function(ind, ele) {
- $(ele).children("td:first").html(ind + 1);
- });
- });
- lndatalistEle.off().on("click", "tr", function() {
- var jsondata = JSON.parse($(this).attr("json"));
- //暂时屏蔽该逻辑
- /*
- DialogObject.Open($("#dialog_public"), {
- callback: PoliceObject.LoadLnStrcut,
- para: jsondata,
- size: ["100rem", "70rem"]
- });
- */
- });
- },
- LoadLnStrcut: function(win, para) {
- win.find(".caption>b").html((para.attr_ln_class == "LLN0" ? "LLN0" : "LN") + "结构详情—" + para.attr_desc);
- var h = (win.height() - win.find(".caption").height() - win.find(".footer").height());
- win.find(".dataitemlist").height(h + "px");
- var ln_strcut_detail = win.find("#ln_strcut_detail");
- layer.msg("正在加载DOI数据...", {
- time: 0
- });
- //生成根节点
- var trs = [{
- "id": para.node_id,
- "isroot": true,
- "topic": para.attr_desc || para.attr_ln_class
- }];
- kmsjsmap.inited = kmsjsmap.isInit = false; //重置初始化状态为未初始化
- var jsmind = kmsjsmap.init({
- container: ln_strcut_detail[0],
- data: trs,
- editable: false,
- onRelation: function(item) {
- if (item.children.length == 0 && item.data.badge != "" && !item.data.isloaded) {
- //加载该节点下的子节点
- var node = jsmind.get_node(item.id);
- //console.log('当前选择中的是', node)
- PoliceObject.AppendMindNodes(para.scdid, jsmind, node, item.id, item.topic);
- }
- }
- });
- //移除组件自带的放大缩小插件
- win.find(".lui-jsmind-innerToolBar").remove();
- PoliceObject.AppendMindNodeType(para.scdid, jsmind, jsmind.get_node(para.node_id), para.node_id);
- },
- AppendMindNodeType: function(scdid, jsmind, parentItem, pid, callback) {
- layer.closeAll();
- //获取下级节点及数量
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/children/stat", {
- "scd_id": scdid,
- "node_id": pid
- }, function(r) {
- parentItem.data.isloaded = true;
- if (r.data == null || r.data.length == 0) {
- if (callback != null) callback();
- return;
- }
- jsmind.options.editable = true;
- for (var i = 0; i < r.data.length; i++) {
- var cItem = r.data[i];
- var nid = pid + "_" + cItem.node_name;
- jsmind.data.jm.add_node(parentItem, nid, cItem.node_name, {
- "badge": cItem.cnt,
- "isloaded": false
- });
- }
- jsmind.options.editable = false;
- if (callback != null) callback();
- });
- },
- //加载指定节点的子节点到导图中
- AppendMindNodes: function(scdid, jsmind, parentItem, pid, nodeName, callback) {
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": scdid,
- "parent_node_id": pid,
- "name": nodeName,
- "pagesize": 10000
- }, function(r) {
- parentItem.data.isloaded = true;
- if (r.data == null || r.data.length == 0) {
- if (callback != null) callback();
- return;
- }
- jsmind.options.editable = true;
- for (var i = 0; i < r.data.length; i++) {
- var daiItem = r.data[i];
- var sddr = daiItem.attr_saddr;
- var txt = daiItem.attr_name;
- if (daiItem.node_name == "SDI") {
- if ($.trim(daiItem.attr_desc) != "") txt = txt + "(" + daiItem.attr_desc + ")";
- }
- if (daiItem.node_name == "DAI") {
- if ($.trim(daiItem.attr_saddr) != "") txt = txt + "(sAddr:" + daiItem.attr_saddr + ")";
- }
- if (daiItem.node_name == "Val") {
- txt = daiItem.node_value;
- }
- if (daiItem.node_name == "FCDA") {
- txt = daiItem.attr_ln_class + "_" + daiItem.attr_ln_inst;
- }
- if (daiItem.node_name == "ExtRef") {
- txt = daiItem.attr_ln_class + "_" + daiItem.attr_ln_inst + "(intAddr:" + daiItem.attr_int_addr + ")";
- }
- var nid = daiItem.node_id || daiItem.nodeid;
- var newNode = jsmind.data.jm.add_node(parentItem, nid, txt, {
- "badge": "",
- "isloaded": false
- });
- PoliceObject.AppendMindNodeType(jsmind, newNode, nid);
- }
- jsmind.options.editable = false;
- if (callback != null) callback();
- });
- },
- //加载DataSet下的FCDA列表
- LoadFCDAList: function(ele, dataset_id, dataset_name) {
- var $ied_strcut = $("#ied_basicinfo");
- var ied_strcut_detail = $ied_strcut.find("#ied_strcut_detail");
- layer.msg("正在加载FCDA列表...", {
- time: 0
- });
- var showLnList = $ied_strcut.find("#showLnList");
- if (showLnList.length == 0) {
- $ied_strcut.append("<div id='showLnList'><span style='cursor:pointer;position:absolute;top:7px;right:7px;color:#299BFF;font-size:1.5rem;z-index:100' class='fa fa-times' onclick='$(\"#showLnList\").remove();'></span><span class='caption'></span><span class='ln_list_title'><table style='width:100%;text-align: center;font-size: 1rem;'><thead><tr><td style='width:10%' class='text_overflow'>ldInst</td><td style='width:15%' class='text_overflow'>prefix</td><td style='width:15%' class='text_overflow'>lnClass</td><td style='width:10%' class='text_overflow'>lnInst</td><td style='width:30%' class='text_overflow'>doName</td><td style='width:10%' class='text_overflow'>daName</td><td style='width:10%' class='text_overflow'>fc</td></tr></thead></table></span><span class='ln_list'><table style='width:100%;text-align: center;font-size: 1rem;color:#09162C;'></table></span></div>");
- showLnList = $ied_strcut.find("#showLnList");
- } else {
- showLnList.removeClass("hidden").find(".ln_list table").html("");
- }
- var toEle = $(ele),
- toXY = toEle.position();
- showLnList.find(".caption").html(dataset_name + "—FCDA列表");
- showLnList.css({
- top: $ied_strcut.height() * 0.25,
- left: ($ied_strcut.width() - showLnList.width()) / 2
- });
- var lndatalistEle = showLnList.find(".ln_list table");
- $.getJSON(Global.AccessUrl + "/api/screen/scd/node/list", {
- "scd_id": ied_strcut_detail.parents(".site_device_list").attr("scd_id") || PoliceObject.ScdID,
- "parent_node_id": dataset_id,
- "pagesize": 1000,
- "name": "FCDA"
- }, function(r) {
- var trs = [];
- layer.closeAll();
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- trs.push("<tr node_id=" + item.node_id + "><td class='text_overflow' style='width:10%'>" + (item.attr_ld_inst || " ") + "</td><td style='width:15%' class='text_overflow'>" + (item.attr_prefix || " ") + "</td><td class='text_overflow' style='width:15%'>" + (item.attr_ln_class || " ") + "</td><td class='text_overflow' style='width:10%'>" + (item.attr_ln_inst || " ") + "</td><td class='text_overflow' style='width:30%'>" + (item.attr_do_name || " ") + "</td><td class='text_overflow' style='width:10%'>" + (item.attr_da_name || " ") + "</td><td class='text_overflow' style='width:10%'>" + (item.attr_fc || " ") + "</td></tr>");
- }
- lndatalistEle.prepend(trs.join(""));
- });
- },
- p_createCanvas: function(canvasconEle) {
- var canvas = canvasconEle[0];
- canvas.width = canvasconEle.width();
- canvas.height = canvasconEle.height();
- var canvascontext = canvas.getContext('2d');
- return canvascontext
- },
- p_drawPoly(canvascontext, point1, point2) {
- //canvascontext.setLineDash([]);
- canvascontext.strokeStyle = "#08b008";
- canvascontext.lineWidth = 1;
- canvascontext.lineJoin = 'round';
- canvascontext.lineCap = 'round';
- canvascontext.beginPath();
- canvascontext.moveTo(point1[0], point1[1]);
- canvascontext.lineTo(point1[0] + 10, point1[1]);
- canvascontext.stroke();
- canvascontext.closePath();
- canvascontext.beginPath();
- canvascontext.moveTo(point1[0] + 9, point1[1]);
- if (point2[1] < point1[1]) canvascontext.quadraticCurveTo(point1[0] + 50, point1[1] - 20, point2[0], point2[1]);
- else canvascontext.quadraticCurveTo(point1[0] + 50, point1[1] + 20, point2[0], point2[1]);
- canvascontext.stroke();
- },
- p_drawNumber: function(ele, masterIedJoinPoint, salveJoinPoint, num, direction) {
- //额外加减的11px为数字高宽的一半
- if (direction == "left") {
- var numberLeft = masterIedJoinPoint[0] - (masterIedJoinPoint[0] - salveJoinPoint[0]) / 2 - 11;
- var numberTop = masterIedJoinPoint[1] - (masterIedJoinPoint[1] - salveJoinPoint[1]) / 2 - 11;
- return ele.append('<span class="abs inputs_num" style="left:' + numberLeft + 'px;top:' + numberTop + 'px">' + num + '</span>').find(".inputs_num:last");
- } else {
- //右边的
- var numberLeft = masterIedJoinPoint[0] + (salveJoinPoint[0] - masterIedJoinPoint[0]) / 2 - 11;
- var numberTop = masterIedJoinPoint[1] - (masterIedJoinPoint[1] - salveJoinPoint[1]) / 2 - 11;
- return ele.append('<span class="abs inputs_num" style="left:' + numberLeft + 'px;top:' + numberTop + 'px">' + num + '</span>').find(".inputs_num:last");
- }
- },
- p_drawLine: function(cxt, point1, point2, color) {
- /*cxt.strokeStyle = "#fff";
- cxt.lineWidth = 1;
- cxt.lineJoin = 'round';
- cxt.lineCap = 'round';
- //cxt.fillStyle = paintConfig.fillStyle;
- cxt.beginPath();
- cxt.moveTo(point1[0], point1[1]);
- cxt.lineTo(point2[0], point2[1]);
- cxt.stroke();*/
- //this.p_drawArrow(cxt, point1[0], point1[1], point2[0], point2[1], 30, 10, 1, color);
- this.p_drawArrow2(cxt, point1[0], point1[1], point2[0], point2[1], 1, 1, 18, 5, color, 1.5)
- },
- //
- //ctx:Canvas绘图环境
- //fromX, fromY:起点坐标(也可以换成p1,只不过它是一个数组)
- //toX, toY:终点坐标 (也可以换成p2,只不过它是一个数组)
- //theta:三角斜边一直线夹角
- //headlen:三角斜边长度
- //width:箭头线宽度
- //color:箭头颜色
- p_drawArrow: function(ctx, fromX, fromY, toX, toY, theta, headlen, width, color) {
- theta = typeof(theta) != 'undefined' ? theta : 30;
- headlen = typeof(theta) != 'undefined' ? headlen : 10;
- width = typeof(width) != 'undefined' ? width : 1;
- color = typeof(color) != 'undefined' ? color : '#fff';
- // 计算各角度和对应的P2,P3坐标
- var angle = Math.atan2(fromY - toY, fromX - toX) * 180 / Math.PI,
- angle1 = (angle + theta) * Math.PI / 180,
- angle2 = (angle - theta) * Math.PI / 180,
- topX = headlen * Math.cos(angle1),
- topY = headlen * Math.sin(angle1),
- botX = headlen * Math.cos(angle2),
- botY = headlen * Math.sin(angle2);
- ctx.save();
- ctx.beginPath();
- var arrowX = fromX - topX,
- arrowY = fromY - topY;
- ctx.moveTo(arrowX, arrowY);
- ctx.moveTo(fromX, fromY);
- ctx.lineTo(toX, toY);
- arrowX = toX + topX;
- arrowY = toY + topY;
- ctx.moveTo(arrowX, arrowY);
- ctx.lineTo(toX, toY);
- arrowX = toX + botX;
- arrowY = toY + botY;
- ctx.lineTo(arrowX, arrowY);
- ctx.strokeStyle = color;
- ctx.lineWidth = width;
- ctx.stroke();
- ctx.restore();
- },
- // Draw arrow head
- drawHead: function(ctx, x0, y0, x1, y1, x2, y2, style, color, width) {
- if (typeof(x0) == 'string') {
- x0 = parseInt(x0);
- }
- if (typeof(y0) == 'string') {
- y0 = parseInt(y0);
- }
- if (typeof(x1) == 'string') {
- x1 = parseInt(x1);
- }
- if (typeof(y1) == 'string') {
- y1 = parseInt(y1);
- }
- if (typeof(x2) == 'string') {
- x2 = parseInt(x2);
- }
- if (typeof(y2) == 'string') {
- y2 = parseInt(y2);
- }
- var radius = 3,
- twoPI = 2 * Math.PI;
- ctx.save();
- ctx.beginPath();
- ctx.strokeStyle = color;
- ctx.fillStyle = color;
- ctx.lineWidth = width;
- ctx.moveTo(x0, y0);
- ctx.lineTo(x1, y1);
- ctx.lineTo(x2, y2);
- switch (style) {
- case 0:
- var backdist = Math.sqrt(((x2 - x0) * (x2 - x0)) + ((y2 - y0) * (y2 - y0)));
- ctx.arcTo(x1, y1, x0, y0, .55 * backdist);
- ctx.fill();
- break;
- case 1:
- ctx.beginPath();
- ctx.moveTo(x0, y0);
- ctx.lineTo(x1, y1);
- ctx.lineTo(x2, y2);
- ctx.lineTo(x0, y0);
- ctx.fill();
- break;
- case 2:
- ctx.stroke();
- break;
- case 3:
- var cpx = (x0 + x1 + x2) / 3;
- var cpy = (y0 + y1 + y2) / 3;
- ctx.quadraticCurveTo(cpx, cpy, x0, y0);
- ctx.fill();
- break;
- case 4:
- var cp1x, cp1y, cp2x, cp2y, backdist;
- var shiftamt = 5;
- if (x2 == x0) {
- backdist = y2 - y0;
- cp1x = (x1 + x0) / 2;
- cp2x = (x1 + x0) / 2;
- cp1y = y1 + backdist / shiftamt;
- cp2y = y1 - backdist / shiftamt;
- } else {
- backdist = Math.sqrt(((x2 - x0) * (x2 - x0)) + ((y2 - y0) * (y2 - y0)));
- var xback = (x0 + x2) / 2;
- var yback = (y0 + y2) / 2;
- var xmid = (xback + x1) / 2;
- var ymid = (yback + y1) / 2;
- var m = (y2 - y0) / (x2 - x0);
- var dx = (backdist / (2 * Math.sqrt(m * m + 1))) / shiftamt;
- var dy = m * dx;
- cp1x = xmid - dx;
- cp1y = ymid - dy;
- cp2x = xmid + dx;
- cp2y = ymid + dy;
- }
- ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x0, y0);
- ctx.fill();
- break;
- }
- ctx.restore();
- },
- // draw arrow
- //p_drawArrow2(ctx, 100, 50, 200, 50, 1, 1, 18, 5, '#f36', 1);
- //p_drawArrow2(ctx, 300, 50, 450, 50, 2, 1, 18, 4, 'blue', 0.5);
- p_drawArrow2: function(ctx, x1, y1, x2, y2, style, which, angle, d, color, width) {
- if (typeof(x1) == 'string') {
- x1 = parseInt(x1);
- }
- if (typeof(y1) == 'string') {
- y1 = parseInt(y1);
- }
- if (typeof(x2) == 'string') {
- x2 = parseInt(x2);
- }
- if (typeof(y2) == 'string') {
- y2 = parseInt(y2);
- }
- style = typeof(style) != 'undefined' ? style : 3;
- which = typeof(which) != 'undefined' ? which : 1;
- angle = typeof(angle) != 'undefined' ? angle : Math.PI / 9;
- d = typeof(d) != 'undefined' ? d : 10;
- color = typeof(color) != 'undefined' ? color : '#fff';
- width = typeof(width) != 'undefined' ? width : 1;
- var toDrawHead = typeof(style) != 'function' ? this.drawHead : style;
- var dist = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
- var ratio = (dist - d / 3) / dist;
- var tox, toy, fromx, fromy;
- if (which & 1) {
- tox = Math.round(x1 + (x2 - x1) * ratio);
- toy = Math.round(y1 + (y2 - y1) * ratio);
- } else {
- tox = x2;
- toy = y2;
- }
- if (which & 2) {
- fromx = x1 + (x2 - x1) * (1 - ratio);
- fromy = y1 + (y2 - y1) * (1 - ratio);
- } else {
- fromx = x1;
- fromy = y1;
- }
- ctx.beginPath();
- ctx.strokeStyle = color;
- ctx.lineWidth = width;
- ctx.moveTo(fromx, fromy);
- ctx.lineTo(tox, toy);
- ctx.stroke();
- var lineangle = Math.atan2(y2 - y1, x2 - x1);
- var h = Math.abs(d / Math.cos(angle));
- if (which & 1) {
- var angle1 = lineangle + Math.PI + angle;
- var topx = x2 + Math.cos(angle1) * h;
- var topy = y2 + Math.sin(angle1) * h;
- var angle2 = lineangle + Math.PI - angle;
- var botx = x2 + Math.cos(angle2) * h;
- var boty = y2 + Math.sin(angle2) * h;
- toDrawHead(ctx, topx, topy, x2, y2, botx, boty, style, color, width);
- }
- if (which & 2) {
- var angle1 = lineangle + angle;
- var topx = x1 + Math.cos(angle1) * h;
- var topy = y1 + Math.sin(angle1) * h;
- var angle2 = lineangle - angle;
- var botx = x1 + Math.cos(angle2) * h;
- var boty = y1 + Math.sin(angle2) * h;
- toDrawHead(ctx, topx, topy, x1, y1, botx, boty, style, color, width);
- }
- },
- AlwaysTimer: function() {
- var time = new Date();
- var year = time.getFullYear();
- var month = time.getMonth() + 1;
- var date = time.getDate();
- var hour = time.getHours();
- var minutes = time.getMinutes();
- var seconds = time.getSeconds();
- month = month < 10 ? "0" + month : month;
- date = date < 10 ? "0" + date : date;
- if (hour < 10) {
- hour = "0" + hour;
- }
- if (minutes < 10) {
- minutes = "0" + minutes;
- }
- if (seconds < 10) {
- seconds = "0" + seconds;
- }
- $(".yyyymmdd").html(year + "-" + month + "-" + date);
- $(".week").html(PoliceObject.GetWeek());
- $(".hour_minute").html(hour + ":" + minutes + ":" + seconds);
- setTimeout('PoliceObject.AlwaysTimer()', 1000);
- },
- GetWeek: function() {
- var time = new Date();
- var day = time.getDay();
- var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
- return weeks[day];
- }
- }
|