123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777 |
- import BaseWidget = require('core/BaseWidget.class');
- import Functions = require('core/Functions.module');
- import Extent = require('esri/geometry/Extent');
- import SpatialReference = require('esri/SpatialReference');
- import Point = require("esri/geometry/Point");
- import GraphicsLayer = require("esri/layers/GraphicsLayer");
- import Graphic = require("esri/graphic");
- import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol");
- import TextSymbol = require("esri/symbols/TextSymbol");
- import Font = require("esri/symbols/Font");
- import Draw = require('esri/toolbars/draw');
- import SimpleMarkerSymbol = require('esri/symbols/SimpleMarkerSymbol');
- import Color = require("esri/Color");
- import Polygon = require('esri/geometry/Polygon');
- import SimpleLineSymbol = require('esri/symbols/SimpleLineSymbol');
- import SimpleFillSymbol = require('esri/symbols/SimpleFillSymbol');
- import arrayUtils = require('dojo/_base/array');
- import ClassBreaksRenderer = require('esri/renderers/ClassBreaksRenderer');
- import PopupTemplate = require('esri/dijit/PopupTemplate');
- import Geoprocessor = require("esri/tasks/Geoprocessor");
- import Polyline = require('esri/geometry/Polyline');
- import geometryEngine = require("esri/geometry/geometryEngine");
- import graphicsUtils = require("esri/graphicsUtils");
- import AjaxSend = require("common/AjaxSend.class")
- import ArcGISDynamicMapServiceLayer = require('esri/layers/ArcGISDynamicMapServiceLayer');
- enum selectType {
- all, single
- }
- export = MissionSchedule;
- declare var Date;
- class MissionSchedule extends BaseWidget {
- baseClass = "widget-missionschedule";
-
- preLayerId = 'HalfPanel' + this.baseClass;
- map = null;
- toast = null;
- popup = null;
- loadWait = null;
- plan_addpontype_layer: GraphicsLayer;
- plan_addptype_layer: GraphicsLayer;
- missionschedule_plandetail_polylinelayer: GraphicsLayer;
- regionInfoGraphicLayer: GraphicsLayer;
- dynamicMapServer: ArcGISDynamicMapServiceLayer
- ajaxSend = null;
- distanceInfo = 50;
- companyid = "";
- missionschedule_planpoint_clusterLayer = null;
- regionid = "";
- regionname = "";
- realName = "";
-
- copyPopup = null;
- devices_selected = [];
- devices_selected_layers: GraphicsLayer;
- currentRegionPolygon = null;
- drawToolbar = null;
- dataTable_r = null;
- dataTable_User = null;
- dataTable_current = null;
- dataTable_current_list = {};
- objectIdsStr = {};
- gisUrlList = {};
- private deviceTypes = null;
- gp = null;
- analyzeUrl = "";
- datalength = 0;
- mapServerUrl = "";
- objectids = [];
- jobid = "";
- dataTable_all = null
- dataTable_all_searchInfo = {};
- xunjianSelectVal = null;
- addData = {
- companyid: undefined,
- deviceTypeIds: undefined,
- deviceTypeIdsTemp:undefined,
- intervalDays: undefined,
- periodId: undefined,
- planBegindate: undefined,
- planEnddate: undefined,
- planMode: undefined,
- pointInfo: undefined,
- regionId: undefined,
- userId: undefined,
- synergyUserIds: undefined,
- description: undefined,
- planRate: undefined,
- geoType: undefined,
- gisInfo: undefined,
- gisInfoList: [
- ],
- gisUrl: undefined,
- objectIds: undefined,
- plan_tolerance: undefined
- }
-
- startup() {
- this.configure();
- this.initHtml();
- this.getDistanceInfo();
- this.getPlanLayers();
- this.initEvent();
- }
-
- configure() {
- this.toast = this.AppX.runtimeConfig.toast;
- this.popup = this.AppX.runtimeConfig.popup;
- this.map = this.AppX.runtimeConfig.map;
- this.ajaxSend = new AjaxSend();
- this.loadWait = this.AppX.runtimeConfig.loadWait;
- if (this.AppX.appConfig.gisResource.filterMapRQ.config.length > 0) {
- this.analyzeUrl = this.AppX.appConfig.gisResource.filterMapRQ.config[0].url;
- this.mapServerUrl = this.AppX.appConfig.gisResource.filterMapRQ.config[1].url;
- } else {
- this.toast.show("图层过滤服务未配置");
- }
- if (!this.regionInfoGraphicLayer) {
- this.regionInfoGraphicLayer = new GraphicsLayer();
- this.regionInfoGraphicLayer.id = this.preLayerId + "regionInfoGraphicLayer";
- this.map.addLayer(this.regionInfoGraphicLayer);
- }
- if (!this.plan_addpontype_layer) {
- this.plan_addpontype_layer = new GraphicsLayer();
- this.plan_addpontype_layer.id = this.preLayerId + "plan_addpontype_layer";
- this.map.addLayer(this.plan_addpontype_layer);
- }
- if (!this.devices_selected_layers) {
- this.devices_selected_layers = new GraphicsLayer();
- this.devices_selected_layers.id = this.preLayerId + "devices_selected_layers";
- this.map.addLayer(this.devices_selected_layers);
- }
- if (!this.missionschedule_plandetail_polylinelayer) {
- this.missionschedule_plandetail_polylinelayer = new GraphicsLayer();
- this.missionschedule_plandetail_polylinelayer.id = this.preLayerId + "missionschedule_plandetail_polylinelayer";
- this.map.addLayer(this.missionschedule_plandetail_polylinelayer);
- }
- if (!this.plan_addptype_layer) {
- this.plan_addptype_layer = new GraphicsLayer();
- this.plan_addptype_layer.id = this.preLayerId + "plan_addptype_layer";
- this.map.addLayer(this.plan_addptype_layer);
- }
- }
-
- initHtml() {
- var html = _.template(this.template.split('$$')[0] + "</div>")();
- this.setHtml(html);
- this.ready();
- }
-
- initLoginUser() {
- this.configTimes();
- this.domObj.find(".planslist-title").empty().append(this.template.split('$$')[10]);
- this.companyid = this.AppX.appConfig.deptId
- this.getGroup(selectType.all);
- }
- planEnddate = {
- format: 'YYYY-MM-DD',
- isinitVal: false,
- okfun: function (obj) {
- var period_id = this.domObj.find(".periodid option:selected").val();
- var dt = new Date(obj.val.replace(/-/g, "/"));
- if (period_id == "1") {
- this.endDate.minDate = obj.val;
- } else if (period_id == "2") {
-
- this.endDate.minDate = obj.val;
- }
- if (parseInt(this.domObj.find(".plan_enddate").val().replace(/-/g, "")) < parseInt(this.endDate.minDate.replace(/-/g, ""))) {
- this.domObj.find(".plan_enddate").val(this.endDate.minDate);
- }
- }.bind(this)
- }
- planBegindate = {
- format: 'YYYY-MM-DD',
- isinitVal: false,
- okfun: function (obj) {
- var period_id = this.domObj.find(".periodid option:selected").val();
- if (period_id == "3") {
- this.endDate.minDate = obj.val;
- }
- var dt = new Date(obj.val.replace(/-/g, "/"));
- this.planEnddate.minDate = Functions.DateFormat(dt, "yyyy-MM-dd");
- this.domObj.find(".plan_enddate").val(this.planEnddate.minDate);
- }.bind(this)
- }
-
- configTimes() {
- $.jeDate("." + this.baseClass + " .plan_begindate", this.planBegindate);
- $.jeDate("." + this.baseClass + " .plan_enddate", this.planEnddate);
- }
-
- initEvent() {
- this.regionInfoGraphicLayer.clear();
- this.initLoginUser();
- this.getMissionSchedule();
- var that = this;
-
- this.domObj.find('.department').on("change", function () {
- this.getUser(selectType.all, this.domObj.find(".department").val());
- }.bind(this));
-
- this.domObj.find(".btn-search").off("click").on("click", function () {
- this.clearCurrentTr();
- this.getMissionSchedule();
- }.bind(this));
-
- this.domObj.find('.btn_addplans').off("click").on("click", function () {
- this.clearCurrentTr();
- this.domObj.empty().append(this.template.split('$$')[1]);
- this.addDataReset();
- this.initEvent2();
- }.bind(this));
- this.domObj.find('.btn_transplans').off().on('click', e => {
- let data = that.dataTable_all.aExtentData.checkCurrentData;
- if (!data || data.length <= 0) {
- this.toast.Show("请勾选需要转移的计划!");
- return;
- } else {
- for (var i = 0; i < data.length; i++) {
- if (data[i].childPlanState != 1 && data[i].childPlanState! != 2) {
- this.toast.Show("只能转移未开始和正在执行的任务!");
- return;
- }
- }
- this.popup.setSize(500, 330);
- var Obj = this.popup.Show("转移", this.template.split('$$')[11]);
- Obj.submitObj.off("click").on("click", function () {
-
- let dataInfo = that.dataTable_all.aExtentData.checkCurrentData;
- var notes = Obj.conObj.find(".notes");
- if (notes.val().trim() == "") {
- notes.addClass('has-error');
- notes.attr("placeholder", "任务转移说明不能为空!");
- this.toast.show("任务转移说明不能为空!");
- return;
- }
- let ids = _.join(dataInfo.map(item => {
- return item.id
- }), ",")
- let data = {
- "ids": ids,
- "applyNote": notes.val(),
- };
- this.ajaxSend.sendAjax(this, data, this.config.planTransfer, this.ajaxSend.type.post, function (result) {
- this.popup.close();
- if (this.ajaxSend.checkResults(this, result)) {
- this.toast.show('计划转移申请成功!');
- this.getMissionSchedule();
- }
- }.bind(this));
- }.bind(this));
- }
- })
-
- this.domObj.find('.btn_deleteplans').off("click").on("click", function () {
- let data = that.dataTable_all.aExtentData.checkCurrentData;
- if (!data || data.length <= 0) {
- this.toast.Show("请勾选需删除的计划!");
- return;
- } else {
- var ids = [];
- for (var n = 0; n < data.length; n++) {
- var item = data[n];
- ids.push(item.id);
-
-
-
-
- }
- this.popup.setSize(300, 250);
- var Obj = this.popup.ShowMessage("提示", "是否删除选择计划数据?");
- Obj.submitObj.off("click").on("click", function () {
- this.popup.Close();
- this.ajaxSend.sendAjax(this, ids, this.config.deleteMissionSchedule, this.ajaxSend.type.delete, this.deleteMissionScheduleCallback.bind(this));
- }.bind(this));
- }
- }.bind(this));
- }
-
- addDataReset() {
- this.addData = {
- companyid: undefined,
- deviceTypeIds: undefined,
- intervalDays: undefined,
- periodId: undefined,
- planBegindate: undefined,
- planEnddate: undefined,
- planMode: undefined,
- pointInfo: undefined,
- regionId: undefined,
- userId: undefined,
- synergyUserIds: undefined,
- description: undefined,
- planRate: undefined,
- geoType: undefined,
- gisInfo: undefined,
- gisInfoList: [],
- gisUrl: undefined,
- objectIds: undefined,
- plan_tolerance: undefined
- }
- this.dataTable_current_list = {};
- this.objectIdsStr = {};
- this.gisUrlList = {};
- }
-
- initEventVal() {
- this.config.pagenumber = 1;
- this.config.pagesize = 25;
- this.config.pagetotal = 0;
- this.devices_selected = [];
- this.devices_selected_layers.clear();
- this.regionInfoGraphicLayer.clear();
- this.domObj.empty().append(this.template.split('$$')[0] + "</div>");
- this.initEvent();
- }
-
- initEvent2() {
- this.planClear();
- this.domObj.find(".department_btn").show();
- this.getPlanType();
- this.getPeriod();
- this.initTimes();
-
- this.domObj.find('.department').off("change").on("change", function () {
- this.getUser(selectType.single, this.domObj.find(".department").val());
-
-
-
- $('option', $('.subUsers')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- }.bind(this));
- this.domObj.find(".users").off("change").on("change", function () {
-
-
-
-
-
-
- $('option', $('.subUsers')).each(function (element) {
- $(this).prop('selected', false);
- });
- var selectedUserVal = this.domObj.find(".users option:selected").val();
- var subUsersOptions = this.domObj.find(".subUsers option");
- for (var i = 0; i < subUsersOptions.length; i++) {
- if ($(subUsersOptions[i]).val() == selectedUserVal) {
- subUsersOptions[i].disabled = true;
- } else {
- subUsersOptions[i].disabled = false;
- }
- }
- var selectedTypeVal = this.domObj.find(".planpointtype option:selected").val();
- if (selectedTypeVal == "1" || selectedTypeVal == "2") {
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("disable");
- } else {
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- });
- }
-
-
-
-
-
-
- }.bind(this))
- this.domObj.find('.planpointtype').off("change").on("change", function () {
- var pointType = this.domObj.find(".planpointtype option:selected").attr("data-type");
- var pointVal = this.domObj.find(".planpointtype option:selected").val();
- if (pointType == "0" && pointVal != "1" && pointVal != "2") {
-
- $('option', $('.subUsers')).each(function (element) {
- $(this).prop('selected', false);
- });
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("enable");
- this.domObj.find(".xunjianUser").attr("disabled", false)
-
- } else {
-
- $('option', $('.subUsers')).each(function (element) {
- $(this).prop('selected', false);
- });
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("disable");
- this.domObj.find(".xunjianUser").attr("disabled", true)
-
- }
-
-
-
-
- this.domObj.find(".users").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- });
- }.bind(this));
- this.domObj.find('.planlinetype').off("change").on("change", function () {
-
- this.domObj.find(".subUsers").multiselect("disable");
- $('option', $('.users')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
-
-
-
-
-
- }.bind(this));
- this.domObj.find('input[type=radio][name=typeSelect]').off("change").on("change", function () {
- if ($("input:radio[name='typeSelect']:checked").val() == "0") {
-
-
-
-
-
-
-
- $('option', $('.subUsers')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- $('option', $('.planpointtype')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- $('option', $('.planlinetype')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- this.domObj.find(".planpointtype").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("enable");
- this.domObj.find(".planlinetype").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("disable");
- } else if ($("input:radio[name='typeSelect']:checked").val() == "1") {
-
-
-
-
- $('option', $('.planpointtype')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- $('option', $('.planlinetype')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- this.domObj.find(".planlinetype").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("enable");
- this.domObj.find(".planpointtype").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("disable");
- $('option', $('.subUsers')).each(function (element) {
- $(this).removeAttr('selected').prop('selected', false);
- });
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("disable");
-
- }
- }.bind(this))
-
- if (this.addData.planBegindate) {
- this.domObj.find('.plan_begindate').val(this.addData.planBegindate.split(" ")[0]);
- }
- if (this.addData.planEnddate) {
- this.domObj.find('.plan_enddate').val(this.addData.planEnddate.split(" ")[0])
- }
- if (this.addData.planMode) {
- this.domObj.find(".radio[value='" + this.addData.planMode + "']").prop('checked', true);
- }
- if (this.addData.description) {
- this.domObj.find('.plan_name').val(this.addData.description);
- }
- if (this.addData.planRate) {
- this.domObj.find('.plan_rate').val(this.addData.planRate);
- }
-
- this.domObj.find(".periodid").off("change").on("change", function () {
- this.initTimes();
- }.bind(this));
-
- this.domObj.find('.btn_previous_step').off("click").on("click", function () {
- this.initEventVal();
- }.bind(this));
-
- this.domObj.find('.btn_return').off("click").on("click", function () {
- this.initEventVal();
- }.bind(this));
-
- this.domObj.find('.btn_next_step').off("click").on("click", function () {
-
- var pointAndLineId = [];
- this.addData.companyid = this.AppX.appConfig.companyId;
- this.addData.deptId = this.domObj.find(".department option:selected").val();
- debugger
- if ($("input:radio[name='typeSelect']:checked").val() == "0") {
- var brands = $('.planpointtype option:selected');
- $(brands).each(function (index, brand) {
- pointAndLineId.push(Number(($(brand).attr("data-device_type_id"))));
- this.addData.geoType = $(brand).attr("data-type");
- }.bind(this));
- } else if ($("input:radio[name='typeSelect']:checked").val() == "1") {
- var brands = $('.planlinetype option:selected');
- this.addData.geoType = "1";
- $(brands).each(function (index, brand) {
- pointAndLineId.push(Number($(brand).attr("data-device_type_id")));
- }.bind(this));
- }
-
-
-
-
- this.addData.deviceTypeIds = pointAndLineId.join(",");
- this.addData.deviceTypeIdsTemp = pointAndLineId.join(",");
- this.addData.periodId = parseInt(this.domObj.find('.periodid option:selected').val());
- this.addData.intervalDays = this.domObj.find(".periodid option:selected").attr("data-days");
- this.addData.intervalDays = parseInt((this.addData.intervalDays == "null" ? "0" : this.addData.intervalDays));
- this.addData.planBegindate = this.ajaxSend.conductAddTime(this.domObj.find('.plan_begindate').val());
- this.addData.planEnddate = this.ajaxSend.conductAddEndTime(this.domObj.find('.plan_enddate').val());
- this.addData.planMode = this.domObj.find(".radio[name='radio']:checked").val();
- this.addData.plan_tolerance = this.domObj.find(".plan_tolerance").val();
-
- var synergyUserIdsVal = [];
- let checkContent = this.domObj.find(".users option:selected").val();
- let synergyUser = this.domObj.find(".subUsers option:selected");
- $(synergyUser).each(function (index, brand) {
- synergyUserIdsVal.push($(this).val());
- });
-
-
-
-
- this.addData.userId = checkContent
-
- this.addData.synergyUserIds = synergyUserIdsVal.join(",")
-
- this.addData.description = this.domObj.find('.plan_name').val();
- this.addData.planRate = parseFloat(this.domObj.find('.plan_rate').val());
- this.xunjianSelectVal = $("input:radio[name='xunjianSelect']:checked").val();
-
- if (new Date(this.addData.planEnddate).getTime() - new Date(this.addData.planBegindate).getTime() < 0) {
- this.toast.Show("计划结束时间应大于计划开始时间!");
- return;
- }
- if (this.addData.periodId == "") {
- this.toast.Show("请选择巡检类型");
- return;
- }
- if (this.addData.planBegindate == "") {
- this.toast.Show("请选择开始时间");
- return;
- }
- if (this.addData.planEnddate == "") {
- this.toast.Show("请选择结束时间");
- return;
- }
- if (this.addData.userId + "" == "NaN" || this.addData.userId == "") {
- this.toast.Show("请选择巡检人员");
- return;
- }
- if (this.addData.description == "") {
- this.toast.Show("请输入巡检任务名称");
- return;
- }
- if (isNaN(this.addData.planRate)||this.addData.planRate== "") {
- this.toast.Show("请输入本次巡检完成率");
- return;
- } else {
- if (this.addData.planRate > 100 || this.addData.planRate < 0) {
- this.toast.Show("巡检完成率在0~100之间");
- return;
- }
- }
- if (this.addData.deviceTypeIds == 1 || this.addData.deviceTypeIds == 2) {
- this.domObj.empty().append(this.template.split('$$')[4]);
- this.initEvent4();
-
- this.getRegionInfo(this.regionid, this.addData.deviceTypeIds);
- } else {
- if (this.xunjianSelectVal == "巡检区域") {
- this.domObj.empty().append(this.template.split('$$')[2]);
- this.initEvent3();
- } else {
- this.domObj.empty().append(this.template.split('$$')[13]);
- this.initEvent3_1();
- }
- }
- }.bind(this));
- }
-
- getPlanLayers() {
- let data = {
- current: 1,
- size: 1000
- }
- this.ajaxSend.sendAjax(this, data, this.config.getLayerId, this.ajaxSend.type.get, function (results) {
- if (results.code != -1) {
- this.deviceTypes = results.result.records
- }
- }.bind(this));
- }
-
- initEvent3() {
- var that = this;
- this.config.pagenumber = 1;
- this.config.pagesize = 25;
- this.config.pagetotal = 0;
- this.devices_selected = [];
- this.devices_selected_layers.clear();
- this.missionschedule_plandetail_polylinelayer.clear();
- this.regionInfoGraphicLayer.clear();
- if (this.missionschedule_planpoint_clusterLayer != null) {
- this.map.removeLayer(this.missionschedule_planpoint_clusterLayer);
- this.missionschedule_planpoint_clusterLayer = null;
- }
- this.getAllPlanRegion();
-
- this.domObj.find('.btn_search').off("click").on("click", function () {
- this.getAllPlanRegion();
- }.bind(this));
-
- this.domObj.find('.btn_previous_step').off("click").on("click", function () {
- this.domObj.empty().append(this.template.split('$$')[1]);
- this.initEvent2();
- }.bind(this));
-
- this.domObj.find('.btn_return').off("click").on("click", function () {
- this.initEventVal();
- }.bind(this));
- }
-
- initEvent3_1() {
- var that = this;
- this.config.pagenumber = 1;
- this.config.pagesize = 25;
- this.config.pagetotal = 0;
- this.devices_selected = [];
- this.devices_selected_layers.clear();
- this.missionschedule_plandetail_polylinelayer.clear();
- this.regionInfoGraphicLayer.clear();
- if (this.missionschedule_planpoint_clusterLayer != null) {
- this.map.removeLayer(this.missionschedule_planpoint_clusterLayer);
- this.missionschedule_planpoint_clusterLayer = null;
- }
-
-
- this.domObj.find('.btn_search').off("click").on("click", function () {
- this.getAllUserList();
- }.bind(this));
-
- this.domObj.find('.btn_previous_step').off("click").on("click", function () {
- this.domObj.empty().append(this.template.split('$$')[1]);
- this.initEvent2();
- }.bind(this));
-
- this.domObj.find('.btn_return').off("click").on("click", function () {
- this.initEventVal();
- }.bind(this));
- }
-
- initEvent4() {
- if (this.addData.geoType == 1) {
- this.domObj.find('.pipeType').attr('style', '');
- }
- if (this.addData.deviceTypeIds != 1 && this.addData.deviceTypeIds != 2 && this.addData.deviceTypeIds.split(",").length == 1) {
- this.getFieldUniqueValueByAjax()
- }
- var that = this;
- this.domObj.find('.widget-planregion_deviceselect .btn_search').hide();
- if (this.xunjianSelectVal != "巡检区域") {
- this.domObj.find('.btn_removeall').hide();
- this.domObj.find('.btn_select').hide();
- this.domObj.find('.btn_part_removeall').hide();
- }
- this.addData.objectIds = undefined;
- this.addData.gisUrl = undefined;
- this.addData.gisInfo = undefined;
-
- if (this.addData.geoType == '0' && this.addData.deviceTypeIds != '1') {
-
-
- let date = new Date();
- let setTimebegindate = {
- format: 'YYYY-MM-DD',
- isinitVal: false,
- maxDate: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(),
- };
- let setTimeenddate = {
- format: 'YYYY-MM-DD',
- isinitVal: false,
- maxDate: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(),
- okfun: function (obj) {
- var dt = new Date(obj.val.replace(/-/g, "/"));
- let endDate = parseInt(obj.val.replace(/-/g, ""));
- let beginDate = parseInt(this.domObj.find(".setTimebegindate").val().replace(/-/g, ""));
- if (endDate < beginDate) {
- this.domObj.find(".setTimebegindate").val(obj.val);
- }
- setTimebegindate.maxDate = Functions.DateFormat(dt, "yyyy-MM-dd");
- }.bind(this)
- };
- $.jeDate("." + this.baseClass + " .setTimebegindate", setTimebegindate);
- $.jeDate("." + this.baseClass + " .setTimeenddate", setTimeenddate);
- }
- this.objectids = [];
-
- this.domObj.find('.btn_confirm').off("click").on("click", function () {
- if (this.addData.deviceTypeIds.split(",").length > 1) {
- var device_Type_Ids = this.addData.deviceTypeIds.split(",");
- var sendData_ids = [];
- for (let i = 0; i < device_Type_Ids.length; i++) {
- var deviceTypeId = device_Type_Ids[i];
- var cfg = this.getDeviceType(deviceTypeId);
- if (this.objectIdsStr[cfg.cnContactLayerName]) {
- this.addData.gisInfoList.push({
- "gisInfo": [],
- "gisUrl": this.gisUrlList[cfg.cnContactLayerName],
- "objectIds": this.objectIdsStr[cfg.cnContactLayerName],
- "regionId": this.addData.regionId,
- "typeId": Number(deviceTypeId)
- });
- sendData_ids.push(deviceTypeId)
- }
- }
- var sendData = {
- companyId: this.AppX.appConfig.companyId,
- deptId: this.addData.deptId,
- description: this.addData.description,
- deviceTypeIds: sendData_ids.join(","),
- gisInfoList: this.addData.gisInfoList,
- intervalDays: this.addData.intervalDays,
- periodId: this.addData.periodId,
- planBegindate: this.addData.planBegindate,
- planEnddate: this.addData.planEnddate,
- planMode: this.addData.planMode,
- planRate: JSON.stringify(this.addData.planRate),
- synergyUserIds: this.addData.synergyUserIds || "",
- userId: Number(this.addData.userId),
- tolerance: this.addData.plan_tolerance
- }
- this.ajaxSend.sendAjax(this, sendData, this.config.addMissionScheduleInfo, this.ajaxSend.type.post, this.addMissionScheduleInfoCallback.bind(this));
- } else {
- var xjlist = [];
- if (this.devices_selected.length > 0) {
- for (var j = 0; j < this.devices_selected.length; j++) {
- var sobj = this.devices_selected[j];
- var content = (sobj.mapitem == null ? sobj.currentTarget.data("content") : sobj.mapitem.attributes);
- var strContent = "";
- if (typeof (content) != 'string') {
- strContent = JSON.stringify(content);
- }
- if (_.findIndex(xjlist, function (o: any) { return o.sid == sobj.sid }) > -1) continue;
- var itemselect = {
- "sid": parseInt(sobj.sid),
- "geometry": sobj.geometry,
- "name": "",
- "code": content.OBJECTID,
- "device_type_id": (sobj.mapitem == null ? sobj.currentTarget.data("device_type_id") : sobj.mapitem.device_type_id),
- "regionname": (sobj.mapitem == null ? sobj.currentTarget.data("regionname") : sobj.mapitem.regionname),
- "address": "",
- "content": "'" + strContent + "'",
- "pipe_length": content[this.config.lengthfield] == undefined ? 0 : content[this.config.lengthfield].toFixed(2)
- };
- xjlist.push(itemselect);
- }
- }
- if (this.addData.deviceTypeIds == "1" || this.addData.deviceTypeIds == "2") {
- this.domObj.find(".pointlist-select").each(function () {
- if ($(this).prop('checked') == true && _.findIndex(xjlist, function (o: any) { return o.sid == this.id }.bind(this)) == -1) {
- let geoData = $(this).data('geometry');
- let pipeArray = [];
- if (geoData.hasOwnProperty("paths")) {
- let line = new Polyline($(this).data('geometry'));
- line.setSpatialReference(new SpatialReference({ wkid: 4326 }));
- let line2 = geometryEngine.geodesicDensify(line, 10);
- geoData = line2.setSpatialReference(new SpatialReference({ wkid: 4490 })).toJson();
-
- let pipe = line2['paths'][0];
- for (var i = 0; i < pipe.length - 1; i++) {
- let polylineJson = {
- paths: [[pipe[i], pipe[i + 1]]],
- spatialReference: new SpatialReference(4326)
- }
- var measure_p = new Polyline(polylineJson);
- let length = geometryEngine.geodesicLength(measure_p, 'meters');
- measure_p.spatialReference = new SpatialReference(4490);
- pipeArray.push({
- geometry: measure_p.toJson(),
- length: length
- })
- }
- }
- xjlist.push({
- "sid": parseInt(this.id),
- "geometry": geoData,
- "address": $(this).data('address') + "",
- "device_type_id": $(this).data('device_type_id'),
- "name": $(this).data('name') + "",
- "code": $(this).data('name') + "",
- "content": "'" + JSON.stringify($(this).data("content")) + "'",
- "pipe_length": $(this).data('pipe_length'),
- "pipe": pipeArray
- });
- }
- });
- if (xjlist.length == 0) {
- this.toast.Show("请选择巡检内容!");
- return;
- } else {
- this.addData.gisInfo = xjlist;
- }
- } else {
- if (this.regionid == "" && this.xunjianSelectVal == "巡检区域") {
- this.toast.Show("请选择片区!");
- return;
- }
- }
- if (this.addData && this.objectids.length == 0 && this.addData.objectIds == "") {
- this.toast.Show("请选择巡检内容!");
- return;
- }
- if (!this.addData.objectIds && !this.addData.gisInfo) {
- this.toast.Show("请选择巡检内容!");
- return;
- }
- this.loadWait.show("正在新增巡检计划,请等待...", this.domObj);
-
- this.addData.gisInfoList.push({
- "gisInfo": this.addData.gisInfo || [],
- "gisUrl": this.addData.gisUrl,
- "objectIds": this.addData.objectIds,
- "regionId": this.addData.regionId,
- "typeId": Number(this.addData.deviceTypeIds)
- });
- var sendData2 = {
- companyId: this.AppX.appConfig.companyId,
- deptId: this.addData.deptId,
- description: this.addData.description,
- deviceTypeIds: this.addData.deviceTypeIds,
- gisInfoList: this.addData.gisInfoList,
- intervalDays: this.addData.intervalDays,
- periodId: this.addData.periodId,
- planBegindate: this.addData.planBegindate,
- planEnddate: this.addData.planEnddate,
- planMode: this.addData.planMode,
- planRate: JSON.stringify(this.addData.planRate),
- synergyUserIds: this.addData.synergyUserIds || "",
- userId: Number(this.addData.userId),
- tolerance: this.addData.plan_tolerance
- }
- this.ajaxSend.sendAjax(this, sendData2, this.config.addMissionScheduleInfo, this.ajaxSend.type.post, this.addMissionScheduleInfoCallback.bind(this));
- }
- }.bind(this));
-
- this.domObj.find('.btn_removeall').off("click").on("click", function () {
- this.devices_selected_layers.clear();
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- if (this.addData.deviceTypeIds.split(",").length > 1) {
- this.objectids = [];
- this.dataTable_current_list = {};
- this.objectIdsStr = {};
- this.gisUrlList = {};
- this.addSelectItems_more(this);
- } else {
- this.objectids = [];
- this.addSelectItems(this);
- }
- this.addData.objectIds = "";
- this.domObj.find(".pipeTypeLength").text('0');
- this.devices_selected = [];
- }.bind(this));
-
- this.domObj.find('.btn_select').off("click").on("click", function () {
- if (this.drawToolbar != null) {
- this.map.setMapCursor('default');
- this.drawToolbar.deactivate();
- this.drawToolbar = null;
- }
- this.map.setMapCursor('crosshair');
- this.drawToolbar = new Draw(this.AppX.runtimeConfig.map);
- this.drawToolbar.activate(Draw.POLYGON);
- this.drawToolbar.on("draw-end", function (evt) {
- this.map.setMapCursor('default');
- var geometry = evt.geometry;
- if (geometry == null) {
- return;
- }
- if (!geometryEngine.contains(this.currentRegionPolygon, evt.geometry) && !geometryEngine.intersects(this.currentRegionPolygon, evt.geometry)) {
- this.toast.Show("选择范围在当前片区外,请选择当前片区内的信息!");
- return;
- }
- geometry = geometryEngine.intersect(this.currentRegionPolygon, evt.geometry);
- this.drawToolbar.deactivate();
- var url = this.AppX.appConfig.gisResource.pipe.config[this.config.mapindex].url;
- if (this.addData.deviceTypeIds.split(",").length > 1) {
- var device_Type_Ids = this.addData.deviceTypeIds.split(",");
- var forCounter = 0;
- var forGpCounter = 0;
- var layernameStr = [];
-
- var outfields = null;
- this.objectIdsStr = {};
- this.loadWait.show("正在查询选择" + this.current_device_type_name + "信息,请等待...", this.domObj);
- for (let i = 0; i < device_Type_Ids.length; i++) {
- var obj = this.getDeviceType(device_Type_Ids[i]);
- var fields = this.getLayerShowFieldNames(obj.cnContactLayerName);
- var where = obj.sqlfilter;
- var param = { "where": where, "spatialRel": "esriSpatialRelIntersects", "returnGeometry": false, "geometryType": "esriGeometryPolygon", "geometry": JSON.stringify(geometry), "returnIdsOnly": true, "f": "json" };
- $.ajax({
- type: "POST",
- url: url + "/" + obj.contactLayerId + "/query",
- cache: false,
- async: false,
- data: param,
- dataType: "json",
- success: function (response) {
- forCounter++;
- if (response.error !== undefined) {
- this.AppX.runtimeConfig.toast.Show("查询失败,请联系管理员");
- return;
- }
- outfields = fields.map(e => { return e.name });
- if (!response.objectIds) {
-
-
-
- } else {
- var objid = this.getDeviceType(device_Type_Ids[forCounter - 1]);
- layernameStr.push(objid.cnContactLayerName);
-
- this.objectIdsStr[objid.cnContactLayerName] = response.objectIds.join();
- }
-
- if (forCounter == device_Type_Ids.length) {
- this.gp = new Geoprocessor(this.analyzeUrl);
- var objStr = "";
- for (var i in this.objectIdsStr) {
- objStr += this.objectIdsStr[i] + ";"
- }
-
- this.addData.objectIds = objStr;
-
-
-
-
-
-
- var options = {
- "layername": layernameStr.join(","),
- "objectids": objStr,
- "outfields": outfields.join(","),
- usertoken: this.AppX.appConfig.gisToken
- };
- var delayResult = this.gp.submitJob(
- options,
- function (jobinfo) {
-
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- let mapServerUrl = this.mapServerUrl + "/jobs/" + jobinfo.jobId;
- for (let k = 0; k < device_Type_Ids.length; k++) {
- var gpCounterId = this.getDeviceType(device_Type_Ids[k]);
- this.gisUrlList[gpCounterId.cnContactLayerName] = url + "/" + gpCounterId.contactLayerId + "/query";
- }
-
- $.ajax({
- type: "get",
- dataType: "json",
- url: this.analyzeUrl + "/jobs/" + jobinfo.jobId + "/" + jobinfo.results.summary.paramUrl + "?f=pjson",
- success: function (result) {
- var pipeTypeLength = "";
- if (result.value.result) {
- for (let j = 0; j < result.value.result.summary.layersummary.length; j++) {
- pipeTypeLength += result.value.result.summary.layersummary[j].layername + ":" + result.value.result.summary.layersummary[j].length + "米;"
- }
- this.domObj.find(".pipeTypeLength").text(pipeTypeLength);
- } else {
- this.domObj.find(".pipeTypeLength").text(result.value.message);
- }
- }.bind(this)
- })
- this.dynamicMapServer = new ArcGISDynamicMapServiceLayer(mapServerUrl);
- this.dynamicMapServer.id = this.preLayerId + "dynamicMapServer";
- this.map.addLayer(this.dynamicMapServer);
- this.addSelectItems_more(this);
- this.loadWait.hide();
- }.bind(this),
- function (jobinfo) {
- this.jobid = jobinfo.jobId;
- }.bind(this),
- function (jobinfo) {
- this.AppX.runtimeConfig.toast.show("分析失败,请联系管理员");
- this.loadWait.hide();
- console.error(jobinfo);
- }.bind(this)
- );
- }
- }.bind(this),
- error: function (results) {
- forCounter++;
- this.loadWait.hide();
- this.toast.Show("查询片区巡检信息出错!");
- return;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }.bind(this)
- });
- }
- } else {
- var Material = this.domObj.find(".MATERIAL option:selected").val()
- var obj = this.getDeviceType(this.addData.deviceTypeIds);
- var fields = this.getLayerShowFieldNames(obj.cnContactLayerName);
- this.loadWait.show("正在查询选择" + this.current_device_type_name + "信息,请等待...", this.domObj);
- var where;
- if(obj.sqlfilter) {
- where = '('+obj.sqlfilter+')';
- if(Material != '') where += ` and MATERIAL='${Material}'`
- }else{
- if(Material != '') where = `MATERIAL='${Material}'`
- }
- var param = { "where": where, "spatialRel": "esriSpatialRelIntersects", "returnGeometry": false, "geometryType": "esriGeometryPolygon", "geometry": JSON.stringify(geometry), "returnIdsOnly": true, "f": "json" };
- $.ajax({
- type: "POST",
- url: url + "/" + obj.contactLayerId + "/query",
- cache: false,
- data: param,
- dataType: "json",
- success: function (response) {
- if (response.error !== undefined) {
- this.AppX.runtimeConfig.toast.Show("查询失败,请联系管理员");
- return;
- }
- let outfields = fields.map(e => { return e.name })
- if (!response.objectIds) {
- this.loadWait.hide();
- return;
- }
- this.gp = new Geoprocessor(this.analyzeUrl);
- let data = _.union(response.objectIds, this.objectids);
- this.objectids = data;
- this.addData.objectIds = _.join(this.objectids, ",");
-
- let layerName = "";
- layerName = obj.cnContactLayerName;
-
-
-
-
-
- var options = {
- "layername": layerName,
- "objectids": this.objectids.join(","),
- "outfields": outfields.join(","),
- usertoken: this.AppX.appConfig.gisToken
- };
- var delayResult = this.gp.submitJob(
- options,
- function (jobinfo) {
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- let mapServerUrl = this.mapServerUrl + "/jobs/" + jobinfo.jobId;
- this.addData.gisUrl = url + "/" + obj.contactLayerId + "/query";
- $.ajax({
- type: "get",
- dataType: "json",
- url: this.analyzeUrl + "/jobs/" + jobinfo.jobId + "/" + jobinfo.results.summary.paramUrl + "?f=pjson",
- success: function (result) {
- this.domObj.find(".pipeTypeLength").text(result.value.result.summary.layersummary[0].length);
- }.bind(this)
- })
- this.dynamicMapServer = new ArcGISDynamicMapServiceLayer(mapServerUrl);
- this.dynamicMapServer.id = this.preLayerId + "dynamicMapServer";
- this.map.addLayer(this.dynamicMapServer);
- this.addSelectItems(this);
- this.loadWait.hide();
- }.bind(this),
- function (jobinfo) {
- this.jobid = jobinfo.jobId;
- }.bind(this),
- function (jobinfo) {
- this.AppX.runtimeConfig.toast.show("分析失败,请联系管理员");
- this.loadWait.hide();
- console.error(jobinfo);
- }.bind(this)
- );
- }.bind(this),
- error: function (results) {
- this.loadWait.hide();
- this.toast.Show("查询片区巡检信息出错!");
- }.bind(this)
- });
- }
- }.bind(this));
- }.bind(this));
-
- this.domObj.find('.btn_part_removeall').off("click").on("click", function () {
- if (this.drawToolbar != null) {
- this.map.setMapCursor('default');
- this.drawToolbar.deactivate();
- this.drawToolbar = null;
- }
- this.map.setMapCursor('crosshair');
- this.drawToolbar = new Draw(this.AppX.runtimeConfig.map);
- this.drawToolbar.activate(Draw.POLYGON);
- this.drawToolbar.on("draw-end", function (evt) {
- this.map.setMapCursor('default');
- var geometry = evt.geometry;
- if (geometry == null) {
- return;
- }
- this.drawToolbar.deactivate();
- var url = this.AppX.appConfig.gisResource.pipe.config[this.config.mapindex].url;
- var obj = this.getDeviceType(this.addData.deviceTypeIds);
- var fields = this.getLayerShowFieldNames(obj.cnContactLayerName);
- this.loadWait.show("正在查询删除的选择" + this.current_device_type_name + "信息,请等待...", this.domObj);
- var where = obj.sqlfilter;
- var param = { "where": where, "spatialRel": "esriSpatialRelIntersects", "returnGeometry": false, "geometryType": "esriGeometryPolygon", "geometry": JSON.stringify(geometry), "returnIdsOnly": true, "f": "json" };
- $.ajax({
- type: "POST",
- url: url + "/" + obj.contactLayerId + "/query",
- cache: false,
- data: param,
- dataType: "json",
- success: function (response) {
- if (response.error !== undefined) {
- this.AppX.runtimeConfig.toast.Show("查询失败,请联系管理员");
- return;
- }
- let outfields = fields.map(e => { return e.name })
- if (!response.objectIds) {
- this.loadWait.hide();
- return;
- }
- this.gp = new Geoprocessor(this.analyzeUrl);
- let data = _.difference(this.objectids, response.objectIds);
- this.objectids = data;
- this.addData.objectIds = _.join(this.objectids, ",");
-
- let layerName = "";
- layerName = obj.cnContactLayerName;
-
-
-
-
-
- var options = {
- "layername": layerName,
- "objectids": this.objectids.join(","),
- "outfields": outfields.join(","),
- usertoken: this.AppX.appConfig.gisToken
- };
- var delayResult = this.gp.submitJob(
- options,
- function (jobinfo) {
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- $.ajax({
- type: "get",
- dataType: "json",
- url: this.analyzeUrl + "/jobs/" + jobinfo.jobId + "/" + jobinfo.results.summary.paramUrl + "?f=pjson",
- success: function (result) {
- this.domObj.find(".pipeTypeLength").text(result.value.result.summary.layersummary[0].length);
- }.bind(this)
- })
- this.dynamicMapServer = new ArcGISDynamicMapServiceLayer(this.mapServerUrl + "/jobs/" + jobinfo.jobId);
- this.dynamicMapServer.id = this.preLayerId + "dynamicMapServer";
- this.map.addLayer(this.dynamicMapServer);
- this.dynamicMapServer.refresh();
- this.addSelectItems(this);
- }.bind(this),
- function (jobinfo) {
- this.jobid = jobinfo.jobId;
- }.bind(this),
- function (jobinfo) {
- this.loadWait.hide();
- this.AppX.runtimeConfig.toast.show("分析失败,请联系管理员");
- console.error(jobinfo);
- }.bind(this)
- );
- }.bind(this),
- error: function (results) {
- this.loadWait.hide();
- this.toast.Show("查询片区巡检信息出错!");
- }.bind(this)
- });
- }.bind(this));
- }.bind(this));
-
- this.domObj.find('.btn_return').off("click").on("click", function () {
- this.initEventVal();
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- }.bind(this));
-
- this.domObj.find('.btn_previous_step').off("click").on("click", function () {
- if (this.addData.deviceTypeIds == 1 || this.addData.deviceTypeIds == 2) {
- this.domObj.empty().append(this.template.split('$$')[1]);
- this.initEvent2();
- } else {
- if (this.addData.deviceTypeIds.split(",").length > 1) {
-
- this.dataTable_current_list = {};
- this.objectIdsStr = {};
- this.gisUrlList = {};
- }
- if (this.xunjianSelectVal == "巡检区域") {
- this.domObj.empty().append(this.template.split('$$')[2]);
- this.initEvent3();
- } else {
- this.domObj.empty().append(this.template.split('$$')[13]);
- this.initEvent3_1();
- }
- }
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- }.bind(this));
- }
-
- getFieldUniqueValueByAjax() {
- var url = this.AppX.appConfig.gisResource.pipe.config[this.config.mapindex].url + this.config.getUniqueValue;
- var obj = this.getDeviceType(this.addData.deviceTypeIds);
- $.ajax({
- type: "post",
- url: esri.config.defaults.io.alwaysUseProxy ? esri.config.defaults.io.proxyUrl + "?" + url : url,
- data: {
- usertoken: this.AppX.appConfig.gisToken2,
- layerid: obj.contactLayerId,
- field_name: "MATERIAL",
- f: "pjson"
- },
- success: function(res){
- var strplanpointtype = "<option value=''>全部</option>";
- var strplanlinetype = "";
- $.each(res.result.rows, function (index, item) {
- strplanpointtype += "<option value='" + item + "'>" + item + "</option>";
- }.bind(this));
- this.domObj.find(".MATERIAL").empty().append(strplanpointtype);
- }.bind(this),
- dataType: "json"
- });
- }
-
- addMissionScheduleInfoCallback(results) {
- var that = this;
- this.loadWait.hide();
- if (results.code != 1) {
- that.toast.Show(results.message);
- console.log(results.message);
- return;
- } else {
- this.devices_selected = [];
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- }
- this.missionschedule_plandetail_polylinelayer.clear();
- this.devices_selected_layers.clear();
- that.toast.Show("添加巡检计划成功!");
- this.addDataReset();
- this.initEventVal();
- }
- }
-
- deleteMissionScheduleCallback(results) {
- var that = this;
- if (results.code != 1) {
- that.toast.Show(results.message);
- return;
- } else {
- that.toast.Show("删除巡检计划成功!");
- this.getMissionSchedule();
- }
- }
-
- setGraphSymbol(type, size?) {
- var symbol = {
- "SimpleMarkerSymbol": null,
- "SimpleLineSymbol": null,
- "SimpleFillSymbol": null,
- };
- switch (type) {
- case "point":
- symbol.SimpleMarkerSymbol = new SimpleMarkerSymbol(
- {
- color: new Color(this.config.color),
- style: "diamond",
- outline: {
- color: new Color(this.config.color),
- width: 0.2
- }
- }
- );
- break;
- case "polyline":
- symbol.SimpleLineSymbol = new SimpleLineSymbol({
- color: new Color(this.config.color),
- style: "solid",
- width: size ? size : 3
- });
- break;
- case "polygon":
- symbol.SimpleFillSymbol = new SimpleFillSymbol({
- color: new Color([0, 0, 255, 0.5]),
- style: "solid",
- outline: {
- color: new Color(this.config.color),
- width: 1
- }
- });
- break;
- }
- if (symbol.SimpleMarkerSymbol != null) {
- return symbol.SimpleMarkerSymbol;
- } else if (symbol.SimpleLineSymbol != null) {
- return symbol.SimpleLineSymbol;
- } else {
- return symbol.SimpleFillSymbol;
- }
- }
-
- setGraphSymbolByType(type, color, size) {
- var symbol = {
- "SimpleMarkerSymbol": null,
- "SimpleLineSymbol": null,
- "SimpleFillSymbol": null,
- };
- switch (type) {
- case "point":
- symbol.SimpleMarkerSymbol = new SimpleMarkerSymbol(
- {
- color: new Color(color),
- style: "diamond",
- outline: {
- color: new Color(color),
- width: size
- }
- }
- );
- break;
- case "polyline":
- symbol.SimpleLineSymbol = new SimpleLineSymbol({
- color: new Color(color),
- style: "solid",
- width: size
- });
- break;
- case "polygon":
- symbol.SimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
- new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
- new Color(color), size), new Color([0, 0, 0, 0.1]));
- break;
- }
- if (symbol.SimpleMarkerSymbol != null) {
- return symbol.SimpleMarkerSymbol.setSize(size);
- } else if (symbol.SimpleLineSymbol != null) {
- return symbol.SimpleLineSymbol;
- } else {
- return symbol.SimpleFillSymbol;
- }
- }
-
- setSymbol(txt?) {
- var symbol = [];
- var fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASHDOT, new Color([255, 0, 0]), 2), new Color([0, 0, 0, 0.1]));
- var fillSymbol2 = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 255, 0]), 2), new Color([255, 255, 255, 0.3]));
- var peopleSymbol = new PictureMarkerSymbol(this.config.MarkPictureSymbol, 24, 24);
-
- var peopletextSymbol = new PictureMarkerSymbol(this.config.TextbgSymbol, txt == null ? 0 : txt.length * 90 / 6, 18);
- var warnSymbol = new PictureMarkerSymbol(this.config.WarnMarkPictureSymbol, 24, 24);
- var lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 3);
- symbol.push(peopleSymbol);
- symbol.push(peopletextSymbol);
- symbol.push(fillSymbol);
- symbol.push(fillSymbol2);
- symbol.push(warnSymbol);
- symbol.push(lineSymbol);
- return symbol;
- }
-
-
- getMissionSchedule() {
- this.loadWait.show("正在查询数据,请耐心等待...", this.domObj);
- this.clearCurrentTr();
- this.plan_addpontype_layer.clear()
- let that = this;
- let dom = this.domObj.find('#planslist_table .dataTables_scroll');
- let startTime = this.domObj.find("#plan_begindate").val();
- let endTime = this.domObj.find("#plan_enddate").val();
- that.dataTable_all_searchInfo = {
- deptId: this.domObj.find(".department option:selected").val(),
- userId: this.domObj.find(".users option:selected").val(),
- createUser: this.domObj.find(".createUser").val(),
- isResultPoint:"1",
- "orders[0].asc": false,
- "orders[0].column": 'CREATE_TIME',
- childBeginDate: startTime == "" ? "" : this.ajaxSend.conductAddTime(startTime),
- childEndDate: endTime == "" ? "" : this.ajaxSend.conductAddEndTime(endTime)
- }
- if (dom.length > 0) {
- if (that.dataTable_all) {
- that.dataTable_all.ajax.reload();
- return;
- };
- } else {
- if (that.dataTable_all) {
- that.dataTable_all.destroy();
- that.dataTable_all = null;
- };
- }
- let option = {
- that: this,
- dataTable: that.dataTable_all,
- elementId: "planslist_table",
- url: that.config.getMissionScheduleList,
- searchInfo: that.dataTable_all_searchInfo,
-
-
- displayTitle: ["部门", "姓名", "巡检名称", "巡检周期", "巡检类型", "计划开始时间", "计划结束时间", "计划完成率(%)", "巡检模式", "创建人", "创建时间", "状态"],
- displayField: ["deptName", "userIdName", "description", "preiodName", "deviceTypeName", "childBeginDate", "childEndDate", "planRate", "modeName", "createUserName", "createTime", "chilePlanStateName"],
- extentDisplayTitle: ['定位查看'],
- extentDisplayContent: [{
- field: "planInfoLook",
- fieldContent: "<a class='planInfoLook'>定位查看</a>"
- }],
- beforeTrClickEvent: undefined,
- afterTrClickEvent: function () {
- },
- drawEvent: function () {
- $.each(that.domObj.find("#planslist_table tr[class]"), function (index, item) {
- $($(item).find('td')[8]).text(that.dataTable_all.aExtentData.currentAllData[index].planRate + "%");
- })
- that.domObj.off('click', '.planInfoLook').on('click', ".planInfoLook", e => {
- let dataInfo = that.dataTable_all.aExtentData.currentTableData;
- that.ajaxSend.sendAjax(that, {id:dataInfo.id}, that.config.getMissionScheduleById+dataInfo.id, that.ajaxSend.type.get, that.showPlanInfoMap.bind(that));
- });
- that.loadWait.hide()
- },
- errmassage: "巡检计划查询失败",
- nullmessage: undefined,
- exportTitle: "巡检计划导出"
- }
- that.dataTable_all = this.ajaxSend.DataTables_check(option);
- }
- showPlanInfoMap(res){
- if(res&&res.result){
- let dataInfo=res.result;
- let that=this;
- if (that.dynamicMapServer) {
- that.map.removeLayer(that.dynamicMapServer);
- that.dynamicMapServer = null;
- }
- that.plan_addptype_layer.clear();
- if (dataInfo.deviceTypeId == 1 || dataInfo.deviceTypeId == 2) {
- if (dataInfo.pointInfo) {
- let datageo = JSON.parse(dataInfo.pointInfo);
- that.showMissionScheduleListPlans(datageo);
- } else {
- that.toast.Show("暂无坐标信息!");
- return;
- }
- } else {
- that.loadWait.show("正在查询任务范围,请等待...", that.domObj);
- let url = that.AppX.appConfig.gisResource.pipe.config[that.config.mapindex].url;
- let obj = that.getDeviceType(dataInfo.deviceTypeId);
- that.gp = new Geoprocessor(that.analyzeUrl);
- let fields = that.getLayerShowFieldNames(obj.cnContactLayerName);
- let outfields = fields.map(e => { return e.name })
-
- let layerName = "";
- layerName = obj.cnContactLayerName;
- var options = {
- "layername": layerName,
- "objectids": dataInfo.objectIds,
- "outfields": outfields.join(","),
- usertoken: that.AppX.appConfig.gisToken
- };
- var delayResult = that.gp.submitJob(
- options,
- function (jobinfo) {
- let mapServerUrl = that.mapServerUrl + "/jobs/" + jobinfo.jobId;
- that.addData.gisUrl = url + "/" + obj.contactLayerId + "/query";
- that.dynamicMapServer = new ArcGISDynamicMapServiceLayer(mapServerUrl);
- that.dynamicMapServer.id = that.preLayerId + "dynamicMapServer";
- that.map.addLayer(that.dynamicMapServer);
- $.ajax({
- type: "get",
- dataType: "json",
- url: that.analyzeUrl + "/jobs/" + jobinfo.jobId + "/" + jobinfo.results.summary.paramUrl + "?f=pjson",
- success: function (result) {
- let data = result.value.result.summary;
-
-
-
- that.map.setExtent(new Extent(data.xmin, data.ymin, data.xmax, data.ymax, that.map.spatialReference))
- }.bind(that)
- })
- that.loadWait.hide();
- }.bind(this),
- function (jobinfo) {
- that.jobid = jobinfo.jobId;
- }.bind(this),
- function (jobinfo) {
- that.AppX.runtimeConfig.toast.show("分析失败,请联系管理员");
- that.loadWait.hide();
- console.error(jobinfo);
- }.bind(this)
- );
- }
- }
- }
-
- clearCurrentTr() {
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- if (this.plan_addptype_layer) {
- this.plan_addptype_layer.clear();
- }
- }
-
- showMissionScheduleListPlans(infos) {
- if (infos != null) {
- var gxs = {
- "polygon": [],
- "polyline": [],
- "point": []
- };
- let geometrys = [];
- for (var i = 0; i < infos.length; i++) {
- var info = infos[i];
- if (info) {
- var device_type_id = info.device_type_id, color = [0, 255, 255, 1];
- if (device_type_id != "")
- color = this.config.DeviceSymbol[device_type_id];
- var pobj = null, sym = null, graphic = null;
- if (info.geometry == undefined) {
- return;
- }
- if (info.geometry.hasOwnProperty("paths")) {
- pobj = new Polyline(info.geometry);
- sym = this.setGraphSymbolByType("polyline", color, 2);
- graphic = new Graphic(pobj, sym);
- gxs.polyline.push(graphic);
- } else if (info.geometry.hasOwnProperty("rings")) {
- pobj = new Polygon(info.geometry);
- sym = this.setGraphSymbolByType("polygon", color, 1);
- graphic = new Graphic(pobj, sym);
- gxs.polygon.push(graphic);
- } else {
- pobj = new Point(info.geometry);
- sym = this.setGraphSymbolByType("point", color, 6);
- graphic = new Graphic(pobj, sym);
- gxs.point.push(graphic);
- }
- geometrys.push(pobj)
- }
- }
- gxs.polygon.forEach((p, index) => {
- this.plan_addptype_layer.add(p);
- });
- gxs.polyline.forEach((p, index) => {
- this.plan_addptype_layer.add(p);
- });
- gxs.point.forEach((p, index) => {
- this.plan_addptype_layer.add(p);
- })
- var geometry = geometryEngine.union(geometrys);
- if (geometry.type && geometry.type == "point") {
- this.map.centerAt(geometry)
- } else {
- this.map.setExtent(geometry.getExtent());
- }
- }
- }
-
- getGroup(selectType: selectType) {
- let data = {
-
- current: 1,
- size: 10000
- }
- this.ajaxSend.sendAjax(this, data, this.config.getGroupList, this.ajaxSend.type.get, this.getGroupListCallback.bind(this, selectType));
- }
- getGroupListCallback(optionType, results) {
- if (results.code != 1) {
- this.toast.Show(results.message);
- return;
- }
- let strdepartment = "";
- if (optionType == selectType.all) {
- strdepartment = ("<option selected value=''>全部</option>");
- }
- $.each(results.result.records, function (index, item) {
- if (optionType == selectType.single && this.addData.companyid) {
- if (this.addData.companyid == item.id) {
- strdepartment += "<option selected='selected' value='" + item.id + "'>" + item.name + "</option>";
- } else {
- strdepartment += "<option value='" + item.id + "'>" + item.name + "</option>";
- }
- } else {
- strdepartment += "<option value='" + item.id + "'>" + item.name + "</option>";
- }
- }.bind(this));
- this.domObj.find(".department").empty().append(strdepartment);
- this.getUser(optionType, this.domObj.find(".department").val());
- }
-
- getUser(optionType: selectType, companyid) {
- let data = {
- "current": 1,
- "size": this.config.pagemaxsize,
-
- "departmentId": companyid
- }
- this.ajaxSend.sendAjax(this, data, this.config.getUserList, this.ajaxSend.type.get, function (results) {
- var that = this;
- if (results.code != 1) {
- that.toast.Show(results.message);
- return;
- }
- let strusers = "";
- if (optionType == selectType.all) {
- strusers = "<option selected value=''>全部</option>";
- }
- if (results.result.records.length == 0) {
- strusers = "<option selected value=''>暂无巡检人员</option>"
- } else {
- $.each(results.result.records, function (index, item) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- strusers += "<option value='" + item.id + "'>" + item.realName + "</option>";
-
-
-
-
-
-
- }.bind(this));
- }
- this.domObj.find(".users").empty().append(strusers);
-
-
-
-
-
-
-
-
- if (optionType == selectType.single) {
- this.domObj.find(".subUsers").empty().append(strusers);
- var selectedUserVal = this.domObj.find(".users option:selected").val();
- var subUsersOptions = this.domObj.find(".subUsers option");
- for (var i = 0; i < subUsersOptions.length; i++) {
- if ($(subUsersOptions[i]).val() == selectedUserVal) {
- subUsersOptions[i].disabled = true;
- } else {
- subUsersOptions[i].disabled = false;
- }
- }
-
-
-
- var selectedTypeVal = this.domObj.find(".planpointtype option:selected").val();
- this.domObj.find(".users").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- });
- if (selectedTypeVal == "1") {
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- }).multiselect("disable");
- } else {
- this.domObj.find(".subUsers").multiselect("destroy").multiselect({
- maxHeight: 200,
- inheritClass: false
- });
- }
- }
- }.bind(this));
- }
-
- getPlanType() {
- let data = {
- current: 1,
- size: 10000
- }
- this.ajaxSend.sendAjax(this, data, this.config.getPlanType, this.ajaxSend.type.get, this.getPlanTypeListCallback.bind(this));
- }
- getPlanTypeListCallback(results) {
- if (results.code != 1) {
- this.toast.Show(results.message);
- return;
- }
- var strplanpointtype = "";
- var strplanlinetype = "";
- $.each(results.result.records, function (index, item) {
- if (item.type == "0") {
- strplanpointtype += "<option value='" + item.id + "' data-type='" + item.type + "' data-device_type_id='" + item.id + "'>" + item.name + "</option>";
- } else if (item.type == "1") {
- if (item.id == 2) {
- strplanpointtype += "<option value='" + item.id + "' data-type='" + item.type + "' data-device_type_id='" + item.id + "'>" + item.name + "</option>";
- } else {
- if (item.id != 15) {
- strplanlinetype += "<option value='" + item.id + "' data-type='" + item.type + "' data-device_type_id='" + item.id + "'>" + item.name + "</option>";
- }
- }
- }
- }.bind(this));
- this.domObj.find(".planpointtype").empty().append(strplanpointtype);
- this.domObj.find(".planlinetype").empty().append(strplanlinetype);
- this.domObj.find(".planpointtype").multiselect({
- maxHeight: 200,
- minwidth: 238,
- inheritClass: false
- });
- this.domObj.find(".planlinetype").multiselect({
- maxHeight: 200,
- minwidth: 238,
- inheritClass: false
- });
- this.getGroup(selectType.single);
- }
-
- getPeriod() {
- let data = {
- current: 1,
- size: 10000
- }
- this.ajaxSend.sendAjax(this, data, this.config.getPeriod, this.ajaxSend.type.get, this.getPeriodListCallback.bind(this));
- }
- getPeriodListCallback(results) {
- var that = this;
- if (results.code != 1) {
- that.toast.Show(results.message);
- return;
- }
- var strperiod = "";
- $.each(results.result.records, function (index, item) {
- if (this.addData.periodId) {
- if (this.addData.periodId == item.id) {
- strperiod += "<option selected='selected' value='" + item.id + "' data-days='" + item.intervalDays + "'>" + item.periodName + "</option>";
- } else {
- strperiod += "<option value='" + item.id + "' data-days='" + item.intervalDays + "'>" + item.periodName + "</option>";
- }
- } else {
- strperiod += "<option value='" + item.id + "' data-days='" + item.intervalDays + "'>" + item.periodName + "</option>";
- }
- }.bind(this));
- this.domObj.find(".periodid").empty().append(strperiod);
- }
-
- endDate = {
- format: 'YYYY-MM-DD',
- isinitVal: false,
- minDate: "",
- maxDate: "",
- isClear: false,
- isToday: false,
- okfun: function (obj) {
- var period_id = this.domObj.find(".periodid option:selected").val() + "";
- if (period_id == "3") {
- var startDate = this.domObj.find(".plan_begindate").val();
- var start = new Date(startDate.replace(/-/g, "/"));
- var end = new Date(obj.val.replace(/-/g, "/"));
- var res = (end - start) % (24 * 3600 * 1000 * 8);
- if (res != 0) {
- let newEnd = end - res + (24 * 3600 * 1000 * 9);
- let newEndDate = Functions.DateFormat(new Date(newEnd), "yyyy-MM-dd");
- this.domObj.find(".plan_enddate").val(newEndDate);
- this.toast.Show("当前日期不是当前周期的倍数,已自动选择当前周期结束时间");
- }
- }
- if (period_id == "4") {
- if (new Date(obj.val).getDate() > 15) {
- let day = new Date(obj.val).moveToLastDayOfMonth().toString("yyyy-MM-dd");
- this.domObj.find(".plan_enddate").val(day);
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (new Date(obj.val).getDate() < 15) {
- let day = new Date(obj.val).setDate(15);
- day = Functions.DateFormat(new Date(day), "yyyy-MM-dd")
- this.domObj.find(".plan_enddate").val(day);
- this.toast.Show("已自动选择当前周期结束时间");
- } else {
- this.domObj.find(".plan_enddate").val(new Date(obj.val).toString("yyyy-MM-dd"));
- }
- }
- if (period_id == "5") {
- let day = new Date(obj.val).moveToLastDayOfMonth().toString("yyyy-MM-dd");
- this.domObj.find(".plan_enddate").val(day);
- this.toast.Show("已自动选择当前周期结束时间");
- }
- if (period_id == "6") {
- let beginMonth = new Date(this.domObj.find(".plan_begindate").val()).getMonth();
- let endMonth = new Date(obj.val).getMonth() + 1;
- let totalMonth = endMonth - beginMonth;
- if (totalMonth % 2 == 0) {
- let tt = new Date(obj.val).moveToLastDayOfMonth()
- this.domObj.find(".plan_enddate").val(new Date(obj.val).moveToLastDayOfMonth().toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else {
- let tt = new Date(obj.val).next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(new Date(obj.val).next().month().moveToLastDayOfMonth().toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- }
-
-
- }
- if (period_id == "7") {
- let beginMonth = new Date(this.domObj.find(".plan_begindate").val()).getMonth();
- let endMonth = new Date(obj.val).getMonth() + 1;
- let totalMonth = endMonth - beginMonth;
- if (totalMonth % 3 == 0) {
- let tt = new Date(obj.val).moveToLastDayOfMonth()
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 1) {
- let tt = new Date(obj.val).next().month().next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 2) {
- let tt = new Date(obj.val).next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- }
-
-
- }
- if (period_id == "8") {
- let beginMonth = new Date(this.domObj.find(".plan_begindate").val()).getMonth();
- let endMonth = new Date(obj.val).getMonth() + 1;
- let totalMonth = endMonth - beginMonth;
- if (totalMonth % 6 == 0) {
- let tt = new Date(obj.val).moveToLastDayOfMonth()
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 1) {
- let tt = new Date(obj.val).next().month().next().month().next().month().next().month().next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 2) {
- let tt = new Date(obj.val).next().month().next().month().next().month().next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 3) {
- let tt = new Date(obj.val).next().month().next().month().next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 4) {
- let tt = new Date(obj.val).next().month().next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- } else if (totalMonth % 3 == 5) {
- let tt = new Date(obj.val).next().month().moveToLastDayOfMonth();
- this.domObj.find(".plan_enddate").val(tt.toString("yyyy-MM-dd"));
- this.toast.Show("已自动选择当前周期结束时间");
- }
-
-
- }
- }.bind(this)
- }
- startDate = {
- format: 'YYYY-MM-DD',
- isinitVal: false,
- minDate: "",
- maxDate: "",
- isClear: false,
- isToday: false,
- okfun: function (obj) {
- var period_id = this.domObj.find(".periodid option:selected").val() + "";
- var dt = new Date(obj.val.replace(/-/g, "/"));
- if (period_id == "1") {
- this.endDate.minDate = obj.val;
- } else if (period_id == "2") {
-
- this.endDate.minDate = obj.val;
- }
- else if (period_id == "3") {
- this.endDate.minDate = Functions.DateFormat(new Date(dt.getTime() + 24 * 3600000 * 8), "yyyy-MM-dd");
- }
- if (parseInt(this.domObj.find(".plan_enddate").val().replace(/-/g, "")) < parseInt(this.endDate.minDate.replace(/-/g, ""))) {
- this.domObj.find(".plan_enddate").val(this.endDate.minDate);
- }
- $.jeDate("." + this.baseClass + " .plan_enddate", this.endDate);
- }.bind(this)
- }
-
- initTimes() {
- var period_id = this.domObj.find(".periodid option:selected").val() + "";
- if (this.addData.periodId && (period_id == "undefined" || !period_id)) {
- period_id = this.addData.periodId;
- }
- if (!period_id || period_id == "undefined") {
- period_id = "1";
- }
- if (period_id != "") {
- switch (period_id) {
- case "1":
- this.domObj.find(".period_sign").attr("title", "");
-
-
-
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- this.startDate.minDate = new Date().toString("yyyy-MM-dd");
- this.endDate.minDate = new Date().toString("yyyy-MM-dd");
- this.endDate.maxDate = this.startDate.maxDate = undefined;
- break;
- case "2":
-
- this.domObj.find(".period_sign").attr("title", "从明天开始计算,在起止时间内每天重复执行");
- this.endDate.minDate = this.startDate.minDate = new Date().add(1).day().toString("yyyy-MM-dd");
-
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- case "3":
-
- this.domObj.find(".period_sign").attr("title", "一个周期计划为实际9天时间");
-
-
- this.endDate.minDate = new Date().add(8).day().toString("yyyy-MM-dd");
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- case "4":
- this.domObj.find(".period_sign").attr("title", "从每月1日或16日开始计算,结束日期15日或月底,只允许安排一个周期计划");
- if (new Date().getDate() > 15)
- {
- this.startDate.minDate = this.startDate.maxDate = new Date().next().month().toString("yyyy-MM-01");
-
- this.endDate.minDate = new Date().next().month().toString("yyyy-MM-15");
- }
- else {
- this.startDate.minDate = this.startDate.maxDate = new Date().toString("yyyy-MM-16");
-
- this.endDate.minDate = new Date().moveToLastDayOfMonth().toString("yyyy-MM-dd");
- }
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- case "5":
- this.domObj.find(".period_sign").attr("title", "从每月1日开始计算,结束日期月底,只允许安排一个周期计划");
- this.startDate.minDate = this.startDate.maxDate = new Date().next().month().toString("yyyy-MM-01");
-
- this.endDate.minDate = new Date().next().month().moveToLastDayOfMonth().toString("yyyy-MM-dd");
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- case "6":
- this.domObj.find(".period_sign").attr("title", "从每月1日开始计算,结束日期月底,只允许安排一个周期计划");
- this.startDate.minDate = this.startDate.maxDate = new Date().next().month().toString("yyyy-MM-01");
- this.endDate.minDate = new Date(this.startDate.minDate).next().month().moveToLastDayOfMonth().toString("yyyy-MM-dd");
-
-
-
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- case "7":
- this.domObj.find(".period_sign").attr("title", "从每月1日开始计算,结束日期月底,只允许安排一个周期计划");
- this.startDate.minDate = this.startDate.maxDate = new Date().next().month().toString("yyyy-MM-01");
- this.endDate.minDate = new Date(this.startDate.minDate).next().month().next().month().moveToLastDayOfMonth().toString("yyyy-MM-dd");
-
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- case "8":
- this.domObj.find(".period_sign").attr("title", "从每月1日开始计算,结束日期月底,只允许安排一个周期计划");
- this.startDate.minDate = this.startDate.maxDate = new Date().next().month().toString("yyyy-MM-01");
- this.endDate.minDate = new Date(this.startDate.minDate).next().month().next().month().next().month().next().month().next().month().moveToLastDayOfMonth().toString("yyyy-MM-dd");
-
- this.endDate.format = this.startDate.format = 'YYYY-MM-DD';
- break;
- }
- $.jeDate("." + this.baseClass + " .plan_begindate", this.startDate);
- this.domObj.find(".plan_begindate").val(this.startDate.minDate);
- $.jeDate("." + this.baseClass + " .plan_enddate", this.endDate);
- this.domObj.find(".plan_enddate").val(this.endDate.minDate);
- }
- }
-
- getFirstDate(dtype) {
- var dt = new Date((new Date()).getTime());
- return dt;
- }
-
- getDays(sdt, mouthNum) {
- var days = 0;
- var year = sdt.getFullYear();
- var mouth = sdt.getMonth() + 1;
- for (var i = 1; i <= mouthNum; i++) {
- if (mouth > 12) {
- year = year + 1;
- mouth = 1
- }
- days += this.getMouthTotalDays(year, mouth);
- mouth = mouth + 1;
- }
- return days;
- }
-
- getMouthTotalDays(year, mouth) {
- var days = 0;
- if (mouth == 2) {
- days = year % 4 == 0 ? 29 : 28;
- } else if (mouth == 1 || mouth == 3 || mouth == 5 || mouth == 7 || mouth == 8 || mouth == 10 || mouth == 12) {
- days = 31;
- } else {
- days = 30;
- }
- return days;
- }
- getLastDate(dtype, sdate) {
- var sdt = new Date(sdate);
- var year = sdt.getFullYear();
- var mouth = sdt.getMonth() + 1;
- switch (dtype + "") {
- case "3":
- sdt = new Date(sdt.getTime() + 24 * 6 * 60 * 60 * 1000);
- break;
- case "4":
- if (sdt.getDate() == 1) {
- sdt.setDate(15);
- } else {
- sdt.setDate(this.getMouthTotalDays(year, mouth));
- }
- break;
- case "5":
- case "8":
- sdt = new Date(sdt.getTime() + 24 * (this.getDays(sdt, 1) - 1) * 60 * 60 * 1000);
- break;
- case "6":
- sdt = new Date(sdt.getTime() + 24 * (this.getDays(sdt, 2) - 1) * 60 * 60 * 1000);
- break;
- case "7":
- case "9":
- sdt = new Date(sdt.getTime() + 24 * (this.getDays(sdt, 6) - 1) * 60 * 60 * 1000);
- break;
- case "10":
- sdt = new Date(sdt.getTime() + 24 * (this.getDays(sdt, 24) - 1) * 60 * 60 * 1000);
- break;
- }
- return sdt;
- }
-
- current_device_type_name = "";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- checkExistPlanDeviceByLayer(region_geometry, device_type_id, device_type_name) {
- var data = {
- current: 1,
- size: 1000,
- pointTypeIds: device_type_id
- };
- this.ajaxSend.sendAjax(this, data, this.config.getLayerId, this.ajaxSend.type.get, function (results) {
- if (results.code != 1) {
- this.toast.Show(results.message);
- return;
- }
- if (results.result.records.length == 0) {
- this.toast.show("巡检类型未绑定巡检图层!");
- return;
- } else {
- results.result.records.forEach(e => {
- let ff = 1;
- })
- }
- }.bind(this));
- if (region_geometry == "") {
- this.toast.Show("片区图形为空,请选择片区!");
- return;
- }
- var polygon;
- if (typeof (region_geometry) == "string") {
- polygon = new Polygon(JSON.parse(region_geometry));
- } else {
- polygon = new Polygon(region_geometry);
- }
- var url = this.AppX.appConfig.gisResource.pipe.config[this.config.mapindex].url;
- if (this.deviceTypes == null)
- return;
- var devicetype = this.getDeviceType(device_type_id);
- if (devicetype == null) return;
- this.loadWait.show("正在检查片区中是否有" + device_type_name + "信息,请等待...", this.domObj);
- var where = "1=1";
- if (devicetype.sqlfilter != null && devicetype.sqlfilter.length > 0)
- where += " and " + devicetype.sqlfilter;
- var param = { "where": where, "spatialRel": "esriSpatialRelContains", "returnGeometry": true, "geometryType": "esriGeometryPolygon", "geometry": JSON.stringify(polygon), "returnCountOnly": true, "returnIdsOnly": false, "f": "json" };
- $.ajax({
- type: "POST",
- url: url + "/" + devicetype.contactLayerId + "/query",
- cache: false,
- data: param,
- dataType: "json",
- success: function (response) {
- if (response.error !== undefined) {
- this.AppX.runtimeConfig.toast.Show("查询失败,请联系管理员");
- this.loadWait.hide();
- return;
- }
- var count = response.count;
- this.loadWait.hide();
- if (count > 0) {
- this.getPlanDeviceList(polygon);
- this.plan_addpontype_layer.clear();
- var graphic = new Graphic(polygon, this.setSymbol("")[2], "");
- this.plan_addpontype_layer.add(graphic);
- } else {
- this.toast.Show(" 抱歉,该片区内没有" + device_type_name + "信息!");
- }
- }.bind(this),
- error: function (results) {
- this.loadWait.hide();
- this.toast.Show("查询片区巡检信息出错!");
- }.bind(this)
- });
- }
-
- checkExistPlanDeviceByLayer_more(region_geometry, device_type_id, device_type_name) {
- var data = {
- current: 1,
- size: 1000,
- pointTypeIds: device_type_id
- };
- this.ajaxSend.sendAjax(this, data, this.config.getLayerId, this.ajaxSend.type.get, function (results) {
- if (results.code != 1) {
- this.toast.Show(results.message);
- return;
- }
- if (results.result.records.length == 0) {
- this.toast.show("巡检类型未绑定巡检图层!");
- return;
- } else {
- results.result.records.forEach(e => {
- let ff = 1;
- })
- }
- }.bind(this));
- if (region_geometry == "") {
- this.toast.Show("片区图形为空,请选择片区!");
- return;
- }
- var polygon;
- if (typeof (region_geometry) == "string") {
- polygon = new Polygon(JSON.parse(region_geometry));
- } else {
- polygon = new Polygon(region_geometry);
- }
- var url = this.AppX.appConfig.gisResource.pipe.config[this.config.mapindex].url;
- if (this.deviceTypes == null)
- return;
- var totalCount = 0;
- var forCounter = 0;
- var device_Type_Ids = device_type_id.split(",");
- for (var i = 0; i < device_Type_Ids.length; i++) {
- var devicetype = this.getDeviceType(device_Type_Ids[i]);
- if (devicetype == null) continue;
- this.loadWait.show("正在检查片区中是否有" + device_type_name + "信息,请等待...", this.domObj);
- var where = "1=1";
- if (devicetype.sqlfilter != null && devicetype.sqlfilter.length > 0)
- where += " and " + devicetype.sqlfilter;
- var param = { "where": where, "spatialRel": "esriSpatialRelContains", "returnGeometry": true, "geometryType": "esriGeometryPolygon", "geometry": JSON.stringify(polygon), "returnCountOnly": true, "returnIdsOnly": false, "f": "json" };
- $.ajax({
- type: "POST",
- url: url + "/" + devicetype.contactLayerId + "/query",
- cache: false,
- data: param,
- dataType: "json",
- success: function (response) {
- forCounter++;
- if (response.error !== undefined) {
- this.AppX.runtimeConfig.toast.Show("查询失败,请联系管理员");
- this.loadWait.hide();
- return;
- }
- var count = response.count;
- this.loadWait.hide();
- if (count > 0) {
- totalCount += count;
- } else {
-
- var data = this.addData.deviceTypeIdsTemp.split(",");
- var index = data.indexOf(device_Type_Ids[forCounter - 1]);
- if (index != -1) {
- var devicetype = this.getDeviceType(data[index]);
- this.toast.Show(" 抱歉,该片区内没有" + devicetype.cnContactLayerName + "信息!");
- data.splice(index, 1);
- this.addData.deviceTypeIds = data.join(",")
- }
- }
- if (forCounter == device_Type_Ids.length) {
- if (totalCount > 0) {
- this.getPlanDeviceList(polygon);
- this.plan_addpontype_layer.clear();
- var graphic = new Graphic(polygon, this.setSymbol("")[2], "");
- this.plan_addpontype_layer.add(graphic);
- } else {
- this.toast.Show(" 抱歉,该片区内没有" + device_type_name + "信息!");
- }
- }
- }.bind(this),
- error: function (results) {
- forCounter++;
- this.loadWait.hide();
- this.toast.Show("查询片区巡检信息出错!");
- if (forCounter == device_Type_Ids.length) {
- if (totalCount > 0) {
- this.getPlanDeviceList(polygon);
- this.plan_addpontype_layer.clear();
- var graphic = new Graphic(polygon, this.setSymbol("")[2], "");
- this.plan_addpontype_layer.add(graphic);
- } else {
- this.toast.Show(" 抱歉,该片区内没有" + device_type_name + "信息!");
- }
- }
- }.bind(this)
- });
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
- getPlanDeviceList(region_polygon?) {
-
-
-
-
-
-
- if (this.addData.deviceTypeIds.split(",").length > 1) {
- this.domObj.empty().append(this.template.split('$$')[12]);
- this.initEvent4();
- this.addSelectItems_more(this);
- } else {
- this.domObj.empty().append(this.template.split('$$')[7]);
- this.initEvent4();
- this.addSelectItems(this);
- }
-
-
-
-
-
-
-
-
-
- }
-
- getAllPlanRegion() {
- this.getAllPlanRegionToMap();
- this.loadWait.show("正在查询片区,请等待...", this.domObj);
- let that = this;
- if (that.dataTable_r) {
- that.dataTable_r.destroy();
- }
- that.dataTable_r = $(that.domObj.find("#planregionslist_table")[0]).DataTable({
- dom: 't' +
- ' <"row"' +
- ' <" information"ri>' +
- ' <" length-changing"l>' +
- ' <" pull-right pagination"p>' +
- ' <" turnToolbar">' +
- ' >',
- language: {
- "lengthMenu": "每页_MENU_条",
- "zeroRecords": "未查询到任何记录",
- "info": "共 _TOTAL_ 条",
- "infoEmpty": "",
- "infoFiltered": "",
- "processing": "查询中,请稍等...",
- "paginate": {
- "first": "首页",
- "last": "尾页",
- "next": ">",
- "previous": "<"
- },
- "search": "搜索: ",
- },
- pagingType: "simple",
- paging: true,
- scrollCollapse: false,
- processing: true,
- scrollX: true,
- scrollY: "calc(100% - 50px)",
- ordering: false,
- lengthMenu: [10, 20, 50],
- drawCallback: function (settings) {
- $(settings.nTable).find("tbody tr").off().click(function (e) {
- debugger
- that.devices_selected = [];
- that.devices_selected_layers.clear();
- let dom = $(e.currentTarget).find(".getInfo");
- if (dom.data("regionid") == null) {
- return;
- } else {
- var mapPolygon = new Polygon(dom.data("geometry"));
- that.zoom2MapHalf(mapPolygon);
- that.regionid = dom.data("regionid");
- that.regionname = dom.data("regionname");
- that.currentRegionPolygon = mapPolygon;
- that.addData.regionId = parseInt(that.regionid);
-
-
-
-
- if (that.addData.deviceTypeIdsTemp.split(",").length > 1) {
- that.checkExistPlanDeviceByLayer_more(dom.data("geometry"), that.addData.deviceTypeIdsTemp + "", that.current_device_type_name);
- } else {
- that.checkExistPlanDeviceByLayer(dom.data("geometry"), that.addData.deviceTypeIdsTemp + "", that.current_device_type_name);
- }
- }
- })
- $(settings.nTable).find("tbody").on("mouseover", "tr", function (e) {
- $(settings.nTable).find("tbody tr.active").removeClass("active");
- $(e.currentTarget).addClass("active");
- });
-
- let dom = $(settings.nTableWrapper);
- let pageInfo = that.dataTable_r.page.info();
- let addPosi = dom.find(".previous");
- let pagehtml = '<li class="addPageInfo"><span>第' + (parseInt(pageInfo.page) + 1) + '页/共' + pageInfo.pages + '页</span></li>';
- addPosi.after(pagehtml);
-
- let turnAddPosi = dom.find('.turnToolbar');
- let turnpagehtml = '<input type="number" class="addPageIndexInput" value="' + (parseInt(pageInfo.page) + 1) + '" /> <button type="button" class="btn btn-sm btn-default addPageIndexButton">跳转</button>'
- turnAddPosi.empty().append(turnpagehtml);
- turnAddPosi.find('.addPageIndexButton').off().click(e => {
- let pageIndex = (turnAddPosi.find('.addPageIndexInput').val());
- if (pageIndex > 0 && pageIndex <= pageInfo.pages) {
- that.dataTable_r.deafultPageIndex = pageIndex;
- that.dataTable_r.ajax.reload();
- } else {
- that.dataTable_r.deafultPageIndex = -10;
- that.toast.show("跳转页数超过查询范围请重新设置!");
- }
- })
- }.bind(that),
- serverSide: true,
- ajax: {
- headers: that.header,
- type: "GET",
- data: function (e) {
- let start = (e['start'] / e['length']) + 1;
- if (that.dataTable_r && that.dataTable_r.deafultPageIndex && that.dataTable_r.deafultPageIndex != -10) {
- start = parseInt(that.dataTable_r.deafultPageIndex);
- that.dataTable_r.context[0]._iDisplayStart = (start - 1) * that.dataTable_r.context[0]._iDisplayLength
- that.dataTable_r.deafultPageIndex = -10;
- }
- return {
- "current": start || that.config.pagenumber,
- "size": e['length'] || that.config.pagesize,
- "regionname": that.domObj.find(".serchcontent").val(),
- }
- },
- url: that.apiRoot + that.config.getPlanRegionList,
- dataType: "json",
- async: true,
- error: function (e) {
- that.loadWait.hide();
- that.toast.show("巡检片区查询失败");
- console.error(e);
- },
- dataSrc: function (results) {
- if (results.code == 1) {
- var value = results;
- results = {};
-
- value.recordsFiltered = value.result.total;
- results.data = [];
- if (value.result.records.length == 0) {
-
- that.loadWait.hide();
- return results.data;
- };
- $.each(value.result.records, function (i, item) {
- results.data.push({
- regionname: "<span class='getInfo' data-user_id='" + that.ajaxSend.setNullAndUndefined(item.user_id)
- + "' data-regionid='" + that.ajaxSend.setNullAndUndefined(item.id)
- + "' data-regionname='" + that.ajaxSend.setNullAndUndefined(item.regionname)
- + "' data-geometry='" + that.ajaxSend.setNullAndUndefined(item.geometry)
- + "' title='" + that.ajaxSend.setNullAndUndefined(item.regionname) + "'>" + that.ajaxSend.setNullAndUndefined(item.regionname) + "</span>",
- address: "<span title='" + that.ajaxSend.setNullAndUndefined(item.address) + "'>" + that.ajaxSend.setNullAndUndefined(item.address) + "</span>",
- notes: "<span title='" + that.ajaxSend.setNullAndUndefined(item.notes) + "'>" + that.ajaxSend.setNullAndUndefined(item.notes) + "</span>",
- });
- });
- that.loadWait.hide();
- return results.data;
- } else {
- that.toast.show(results.message);
- console.error(results.message);
- }
- }
- },
- columns: [
- { "data": "regionname" },
- { "data": "address" },
- { "data": "notes" },
- ],
- });
- }
- getAllUserList() {
-
- this.loadWait.show("正在查询人员,请等待...", this.domObj);
- let that = this;
- if (that.dataTable_User) {
- that.dataTable_User.destroy();
- }
- that.dataTable_User = $(that.domObj.find("#planuserlist_table")[0]).DataTable({
- dom: 't' +
- ' <"row"' +
- ' <" information"ri>' +
- ' <" length-changing"l>' +
- ' <" pull-right pagination"p>' +
- ' <" turnToolbar">' +
- ' >',
- language: {
- "lengthMenu": "每页_MENU_条",
- "zeroRecords": "未查询到任何记录",
- "info": "共 _TOTAL_ 条",
- "infoEmpty": "",
- "infoFiltered": "",
- "processing": "查询中,请稍等...",
- "paginate": {
- "first": "首页",
- "last": "尾页",
- "next": ">",
- "previous": "<"
- },
- "search": "搜索: ",
- },
- pagingType: "simple",
- paging: true,
- scrollCollapse: false,
- processing: true,
- scrollX: true,
- scrollY: "calc(100% - 50px)",
- ordering: false,
- lengthMenu: [10, 20, 50],
- drawCallback: function (settings) {
- $(settings.nTable).find("tbody tr").off().click(function (e) {
- that.devices_selected = [];
- that.devices_selected_layers.clear();
- let dom = $(e.currentTarget).find(".getInfo");
- if (dom.data("realname") == null) {
- return;
- } else {
-
-
- that.realName = dom.data("realname");
-
-
-
-
-
-
-
- that.serachEquipmentByUser(that.addData.deviceTypeIds, that.realName)
-
-
-
-
-
- }
- })
- $(settings.nTable).find("tbody").on("mouseover", "tr", function (e) {
- $(settings.nTable).find("tbody tr.active").removeClass("active");
- $(e.currentTarget).addClass("active");
- });
-
- let dom = $(settings.nTableWrapper);
- let pageInfo = that.dataTable_User.page.info();
- let addPosi = dom.find(".previous");
- let pagehtml = '<li class="addPageInfo"><span>第' + (parseInt(pageInfo.page) + 1) + '页/共' + pageInfo.pages + '页</span></li>';
- addPosi.after(pagehtml);
-
- let turnAddPosi = dom.find('.turnToolbar');
- let turnpagehtml = '<input type="number" class="addPageIndexInput" value="' + (parseInt(pageInfo.page) + 1) + '" /> <button type="button" class="btn btn-sm btn-default addPageIndexButton">跳转</button>'
- turnAddPosi.empty().append(turnpagehtml);
- turnAddPosi.find('.addPageIndexButton').off().click(e => {
- let pageIndex = (turnAddPosi.find('.addPageIndexInput').val());
- if (pageIndex > 0 && pageIndex <= pageInfo.pages) {
- that.dataTable_User.deafultPageIndex = pageIndex;
- that.dataTable_User.ajax.reload();
- } else {
- that.dataTable_User.deafultPageIndex = -10;
- that.toast.show("跳转页数超过查询范围请重新设置!");
- }
- })
- }.bind(that),
- serverSide: true,
- ajax: {
- headers: that.header,
- type: "GET",
- data: function (e) {
- let start = (e['start'] / e['length']) + 1;
- if (that.dataTable_User && that.dataTable_User.deafultPageIndex && that.dataTable_User.deafultPageIndex != -10) {
- start = parseInt(that.dataTable_User.deafultPageIndex);
- that.dataTable_User.context[0]._iDisplayStart = (start - 1) * that.dataTable_User.context[0]._iDisplayLength
- that.dataTable_User.deafultPageIndex = -10;
- }
- return {
- "current": start || that.config.pagenumber,
- "size": e['length'] || that.config.pagesize,
- "realName": that.domObj.find(".serchcontent").val(),
- }
- },
- url: that.apiRoot + that.config.getAllUserList,
- dataType: "json",
- async: true,
- error: function (e) {
- that.loadWait.hide();
- that.toast.show("人员查询失败");
- console.error(e);
- },
- dataSrc: function (results) {
- if (results.code == 1) {
- var value = results;
- results = {};
-
- value.recordsFiltered = value.result.total;
- results.data = [];
- if (value.result.records.length == 0) {
-
- that.loadWait.hide();
- return results.data;
- };
- $.each(value.result.records, function (i, item) {
- results.data.push({
- realName: "<span class='getInfo' data-user_id='" + that.ajaxSend.setNullAndUndefined(item.id)
- + "' data-realName='" + that.ajaxSend.setNullAndUndefined(item.realName)
- + "' title='" + that.ajaxSend.setNullAndUndefined(item.realName) + "'>" + that.ajaxSend.setNullAndUndefined(item.realName) + "</span>",
- roleName: "<span title='" + that.ajaxSend.setNullAndUndefined(item.roleName) + "'>" + that.ajaxSend.setNullAndUndefined(item.roleName) + "</span>",
- lockFlagName: "<span title='" + that.ajaxSend.setNullAndUndefined(item.lockFlagName) + "'>" + that.ajaxSend.setNullAndUndefined(item.lockFlagName) + "</span>",
- });
- });
- that.loadWait.hide();
- return results.data;
- } else {
- that.toast.show(results.message);
- console.error(results.message);
- }
- }
- },
- columns: [
- { "data": "realName" },
- { "data": "roleName" },
- { "data": "lockFlagName" },
- ],
- });
- }
- serachEquipmentByUser(device_type_id, userName) {
- var url = this.AppX.appConfig.gisResource.pipe.config[this.config.mapindex].url;
- var devicetype = this.getDeviceType(device_type_id);
- var fields = this.getLayerShowFieldNames(devicetype.cnContactLayerName);
- if (devicetype == null) return;
- this.loadWait.show("正在检查信息,请等待...", this.domObj);
- var where = "PROCENSOR like '%" + userName + "%'";
- if (devicetype.sqlfilter != null && devicetype.sqlfilter.length > 0)
- where += " and " + devicetype.sqlfilter;
- var param = { "where": where, "spatialRel": "esriSpatialRelIntersects", "returnGeometry": false, "returnIdsOnly": true, "f": "json" };
- $.ajax({
- type: "POST",
- url: url + "/" + devicetype.contactLayerId + "/query",
- cache: false,
- data: param,
- dataType: "json",
- success: function (response) {
- if (response.error !== undefined) {
- this.AppX.runtimeConfig.toast.Show("查询失败,请联系管理员");
- this.loadWait.hide();
- return;
- }
- let outfields = fields.map(e => { return e.name })
- if (!response.objectIds) {
- this.loadWait.hide();
- this.AppX.runtimeConfig.toast.Show("查询无果,该巡检人员没有绑定的设备");
- return;
- }
- this.getPlanDeviceList();
- this.gp = new Geoprocessor(this.analyzeUrl);
- let data = _.union(response.objectIds, this.objectids);
- this.objectids = data;
- this.addData.objectIds = _.join(this.objectids, ",");
- let layerName = "";
- layerName = devicetype.cnContactLayerName;
- var options = {
- "layername": layerName,
- "objectids": this.objectids.join(","),
- "outfields": outfields.join(","),
- usertoken: this.AppX.appConfig.gisToken
- };
- var delayResult = this.gp.submitJob(
- options,
- function (jobinfo) {
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- this.dynamicMapServer = null;
- }
- let mapServerUrl = this.mapServerUrl + "/jobs/" + jobinfo.jobId;
- this.addData.gisUrl = url + "/" + devicetype.contactLayerId + "/query";
- $.ajax({
- type: "get",
- dataType: "json",
- url: this.analyzeUrl + "/jobs/" + jobinfo.jobId + "/" + jobinfo.results.summary.paramUrl + "?f=pjson",
- success: function (result) {
- this.domObj.find(".pipeTypeLength").text(result.value.result.summary.layersummary[0].length);
- }.bind(this)
- })
- this.dynamicMapServer = new ArcGISDynamicMapServiceLayer(mapServerUrl);
- this.dynamicMapServer.id = this.preLayerId + "dynamicMapServer";
- this.map.addLayer(this.dynamicMapServer);
- this.addSelectItems(this);
- this.loadWait.hide();
- }.bind(this),
- function (jobinfo) {
- this.jobid = jobinfo.jobId;
- }.bind(this),
- function (jobinfo) {
- this.AppX.runtimeConfig.toast.show("分析失败,请联系管理员");
- this.loadWait.hide();
- console.error(jobinfo);
- }.bind(this)
- );
-
-
-
-
-
-
-
-
-
-
- }.bind(this),
- error: function (results) {
- this.loadWait.hide();
- this.toast.Show("查询巡检信息出错!");
- }.bind(this)
- });
- }
-
- getAllPlanRegionToMap() {
- let data = {
- "current": 1,
- "size": this.config.pagemaxsize,
- };
- this.ajaxSend.sendAjax(this, data, this.config.getPlanRegionList, this.ajaxSend.type.get, function (results) {
- var that = this;
- if (results.code != 1) {
- that.toast.Show(results.message);
- return;
- }
- this.addPolygonGraphic(results);
- }.bind(this));
- }
-
- addPolygonGraphic(queryResult) {
- if (this.plan_addpontype_layer) {
- this.plan_addpontype_layer.clear();
- }
- for (var i = 0, length = queryResult.result.records.length; i < length; i++) {
- var row = queryResult.result.records[i];
- if (row.geometry == undefined || row.geometry == "") { continue; }
- var polygon = new Polygon(JSON.parse(row.geometry));
- var graphic = new Graphic(polygon, this.setSymbol(row.regionname)[2], "");
- graphic.attr("id", "graphic" + i);
- this.plan_addpontype_layer.add(graphic);
- if (row.regionname != null && row.regionname != "") {
-
- var point = polygon.getExtent().getCenter();
- var graphictextbg = new Graphic(point, this.setSymbol(row.regionname)[1].setOffset(0, -20), "");
- this.plan_addpontype_layer.add(graphictextbg);
-
- var peopleTextSymbol = new TextSymbol(row.regionname);
- peopleTextSymbol.setOffset(0, -25);
- var font = new Font();
- font.setSize("10pt");
- font.setWeight(Font.WEIGHT_BOLD);
- peopleTextSymbol.setFont(font);
- var graphicText = new Graphic(point, peopleTextSymbol, "");
- this.plan_addpontype_layer.add(graphicText);
- }
- }
- }
-
- addSelectItems(that) {
-
- this.missionschedule_plandetail_polylinelayer.clear();
-
- var cfg = this.getDeviceType(this.addData.deviceTypeIds);
- var layerid = cfg.contactLayerId;
- var fields = this.getLayerShowFieldNames(cfg.cnContactLayerName);
- let columns = [];
- var html_trs_data = "";
- for (var i = 0; i < fields.length; i++) {
- columns.push({ "data": fields[i].name })
- html_trs_data += "<th title='" + fields[i].alias + "'>" + fields[i].alias + "</th>";
- }
- this.domObj.find(".deviceslist-title").empty().append("<tr>" + html_trs_data + "</tr>");
- that.loadWait.show("正在查询选择" + that.current_device_type_name + "信息,请等待...", that.domObj);
- if (this.dataTable_current) {
- this.dataTable_current.destroy();
- }
- let layerInforUrl = this.AppX.appConfig.gisResource.pipe.config[0].url + "/" + cfg.contactLayerId + "/query";
- that.dataTable_current = $(that.domObj.find("#deviceslist_table")[0]).DataTable({
- dom: 't' +
- ' <"row"' +
- ' <" information"ri>' +
- ' <" length-changing"l>' +
- ' <" pull-right pagination"p>' +
- ' <" turnToolbar">' +
- ' >',
- language: {
- "lengthMenu": "每页_MENU_条",
- "zeroRecords": "未查询到任何记录",
- "info": "共 _TOTAL_ 条",
- "infoEmpty": "",
- "infoFiltered": "",
- "processing": "查询中,请稍等...",
- "paginate": {
- "first": "首页",
- "last": "尾页",
- "next": ">",
- "previous": "<"
- },
- "search": "搜索: ",
- },
- pagingType: "simple",
- paging: true,
- scrollCollapse: false,
- processing: true,
- scrollX: true,
- scrollY: "calc(100% - 50px)",
- ordering: false,
- lengthMenu: [10, 20, 50],
- drawCallback: function (settings) {
- $(settings.nTable).find("tbody tr").off().click(function (e) {
- $(this).siblings('tr').removeClass('active');
- $(this).addClass('active');
- let dom = $(e.currentTarget).find(".getInfo");
- let data = that.dataTable_current.currentData[parseInt(dom.attr("index"))];
- let currentData = that.dataTable_current.currentTableData;
- if (currentData && currentData.attributes.OBJECTID == data.attributes.OBJECTID && currentData.attributes.OBJECTID) {
- return;
- } else {
- that.dataTable_current.currentTableData = data;
- let geometryobj = null;
- let mapPolygon = null;
- let GraphSymbol = null;
- that.missionschedule_plandetail_polylinelayer.clear();
- if (data.geometry.hasOwnProperty("paths")) {
- geometryobj = {
- "paths": data.geometry.paths,
- "spatialReference": { "wkid": that.map.spatialReference.wkid }
- };
- mapPolygon = new Polyline(geometryobj);
- that.zoom2MapHalf(mapPolygon);
- GraphSymbol = that.setGraphSymbol("polyline", 2);
- } else if (data.geometry.hasOwnProperty("rings")) {
- geometryobj = {
- "rings": data.geometry.rings,
- "spatialReference": { "wkid": that.map.spatialReference.wkid }
- };
- mapPolygon = new Polygon(geometryobj);
- that.zoom2MapHalf(mapPolygon);
- GraphSymbol = that.setGraphSymbol("polygon");
- } else {
- geometryobj = { "x": data.geometry.x, "y": data.geometry.y, "spatialReference": { "wkid": that.map.spatialReference.wkid } };
- mapPolygon = new Point(geometryobj);
- GraphSymbol = that.setGraphSymbol("point");
- }
- that.missionschedule_plandetail_polylinelayer.add(new Graphic(mapPolygon, GraphSymbol));
- }
- })
-
- let dom = $(settings.nTableWrapper);
- let pageInfo = that.dataTable_current.page.info();
- let addPosi = dom.find(".previous");
- let pagehtml = '<li class="addPageInfo"><span>第' + (parseInt(pageInfo.page) + 1) + '页/共' + pageInfo.pages + '页</span></li>';
- addPosi.after(pagehtml);
-
- let turnAddPosi = dom.find('.turnToolbar');
- let turnpagehtml = '<input type="number" class="addPageIndexInput" value="' + (parseInt(pageInfo.page) + 1) + '" /> <button type="button" class="btn btn-sm btn-default addPageIndexButton">跳转</button>'
- turnAddPosi.empty().append(turnpagehtml);
- turnAddPosi.find('.addPageIndexButton').off().click(e => {
- let pageIndex = (turnAddPosi.find('.addPageIndexInput').val());
- if (pageIndex > 0 && pageIndex <= pageInfo.pages) {
- that.dataTable_current.deafultPageIndex = pageIndex;
- that.dataTable_current.ajax.reload();
- } else {
- that.dataTable_current.deafultPageIndex = -10;
- that.toast.show("跳转页数超过查询范围请重新设置!");
- }
- })
- }.bind(that),
- serverSide: true,
- ajax: {
- url: esri.config.defaults.io.alwaysUseProxy ? esri.config.defaults.io.proxyUrl + "?" + layerInforUrl : layerInforUrl,
- dataType: "json",
- cache: false,
- type: "POST",
- data: function (e) {
- let start = (e['start'] / e['length']) + 1;
- if (that.dataTable_current && that.dataTable_current.deafultPageIndex && that.dataTable_current.deafultPageIndex != -10) {
- start = parseInt(that.dataTable_current.deafultPageIndex);
- that.dataTable_current.context[0]._iDisplayStart = (start - 1) * that.dataTable_current.context[0]._iDisplayLength
- that.dataTable_current.deafultPageIndex = -10;
- }
- let data = _.slice(that.objectids, (start - 1) * e["length"], start * e["length"]);
- if (data.length == 0) {
- data.push("无objectId");
- }
- var obj = that.getDeviceType(that.addData.deviceTypeIds);
- var fields = that.getLayerShowFieldNames(obj.cnContactLayerName);
- var where = obj.sqlfilter;
- let fieldDate = fields.map(e => e.name);
- var param = { "where": "", "outFields": fieldDate.join(","), "objectIds": data.join(","), "spatialRel": "esriSpatialRelIntersects", "returnGeometry": true, "geometryType": "esriGeometryPolygon", "geometry": "", "returnIdsOnly": false, "f": "json" };
- return param
- },
- error: function (e) {
- that.loadWait.hide();
- that.toast.show("巡检片区查询失败");
- console.error(e);
- },
- dataSrc: function (results) {
- if (results.error) {
- that.loadWait.hide();
- that.toast.show(results.message);
- console.error(results.message);
- results.recordsFiltered = 1;
- results.data = [];
- return results.data;
- }
- if (results.features.length > 0) {
- var value = results;
- results = {};
- value.recordsFiltered = that.objectids.length;
- results.data = [];
- that.dataTable_current.currentData = value.features;
- $.each(value.features, function (i, item) {
- var obj = that.getDeviceType(that.addData.deviceTypeIds);
- var fields = that.getLayerShowFieldNames(obj.cnContactLayerName);
- let itemdata = {};
- for (let el of fields) {
- let dataInfo = that.ajaxSend.verificationHelper.setNullAndUndefined(item.attributes[el.name]);
-
- if (typeof (dataInfo) == "number") {
-
- if (dataInfo % 1 != 0) {
- dataInfo = dataInfo.toFixed(2);
- }
- }
- itemdata[el.name] = "<span class='getInfo' index='" + i + "' title='" + dataInfo + "'>" + dataInfo + "</span>";
- }
- results.data.push(itemdata);
- });
- that.loadWait.hide();
- return results.data;
- } else {
- that.loadWait.hide();
- results.recordsFiltered = 1;
- results.data = [];
- return results.data;
- }
- }
- },
- columns: columns,
- });
- }
-
- addSelectItems_more(that) {
-
- this.missionschedule_plandetail_polylinelayer.clear();
- var device_Type_Ids = this.addData.deviceTypeIds.split(",");
-
-
-
-
-
- this.domObj.find("#myTabUl").empty();
- this.domObj.find("#myTabContent").empty();
- var forCounter = 0;
- var forDataSrcCounter = 0;
- for (let i = 0; i < device_Type_Ids.length; i++) {
- var cfg = this.getDeviceType(device_Type_Ids[i]);
- var layerid = cfg.contactLayerId;
- var fields = this.getLayerShowFieldNames(cfg.cnContactLayerName);
- var tabListr = "";
- var tabBody = "";
- if (i == 0) {
- tabListr += "<li class='nav-item active'>";
- tabListr += "<a href='#deviceslist_table_div_" + i + "' data-toggle='tab' class='nav-link active show'>" + cfg.cnContactLayerName + "</a>";
- tabListr += "</li>";
- tabBody += "<div id='deviceslist_table_div_" + i + "' class='tab-pane fade in active show'><table class='table table-bordered table-striped' id='deviceslist_table_" + i + "' cellspacing='0'>"
- tabBody += "<thead class='deviceslist-title_" + i + "'>"
- tabBody += "</thead>"
- tabBody += "</table></div>"
- } else {
- tabListr += "<li class='nav-item'>";
- tabListr += "<a href='#deviceslist_table_div_" + i + "' data-toggle='tab' class='nav-link'>" + cfg.cnContactLayerName + "</a>";
- tabListr += "</li>";
- tabBody += "<div id='deviceslist_table_div_" + i + "' class='tab-pane fade'><table class='table table-bordered table-striped' id='deviceslist_table_" + i + "' cellspacing='0'>"
- tabBody += "<thead class='deviceslist-title_" + i + "'>"
- tabBody += "</thead>"
- tabBody += "</table></div>"
- }
- this.domObj.find("#myTabUl").append(tabListr);
- this.domObj.find("#myTabContent").append(tabBody);
- let columns = [];
- var html_trs_data = "";
- for (var j = 0; j < fields.length; j++) {
- columns.push({ "data": fields[j].name })
- html_trs_data += "<th title='" + fields[j].alias + "'>" + fields[j].alias + "</th>";
- }
- this.domObj.find('.deviceslist-title_' + i + '').empty().append("<tr>" + html_trs_data + "</tr>");
-
- let layerInforUrl = this.AppX.appConfig.gisResource.pipe.config[0].url + "/" + cfg.contactLayerId + "/query";
- if (this.dataTable_current_list[i]) {
- this.dataTable_current_list[i].destroy(false);
- this.dataTable_current_list[i] = null;
- }
- that.dataTable_current_list[i] = $(that.domObj.find('#deviceslist_table_' + i + '')[0]).DataTable({
- dom: 't' +
- ' <"row"' +
- ' <" information"ri>' +
- ' <" length-changing"l>' +
- ' <" pull-right pagination"p>' +
- ' <" turnToolbar">' +
- ' >',
- language: {
- "lengthMenu": "每页_MENU_条",
- "zeroRecords": "未查询到任何记录",
- "info": "共 _TOTAL_ 条",
- "infoEmpty": "",
- "infoFiltered": "",
- "processing": "查询中,请稍等...",
- "paginate": {
- "first": "首页",
- "last": "尾页",
- "next": ">",
- "previous": "<"
- },
- "search": "搜索: ",
- },
- pagingType: "simple",
- paging: true,
- scrollCollapse: false,
- processing: true,
- scrollX: true,
- scrollY: "calc(100% - 50px)",
- ordering: false,
- lengthMenu: [10, 20, 50],
- drawCallback: function (settings) {
- $(settings.nTable).find("tbody tr").off().click(function (e) {
- let dom = $(e.currentTarget).find(".getInfo");
- let tabIndex = dom.attr("tabIndex");
- let data = that.dataTable_current_list[tabIndex].currentData[parseInt(dom.attr("index"))];
- let currentData = that.dataTable_current_list[tabIndex].currentTableData;
- if (currentData && currentData.attributes.OBJECTID == data.attributes.OBJECTID && currentData.attributes.OBJECTID) {
- return;
- } else {
- that.dataTable_current_list[tabIndex].currentTableData = data;
- let geometryobj = null;
- let mapPolygon = null;
- let GraphSymbol = null;
- that.missionschedule_plandetail_polylinelayer.clear();
- if (data.geometry.hasOwnProperty("paths")) {
- geometryobj = {
- "paths": data.geometry.paths,
- "spatialReference": { "wkid": that.map.spatialReference.wkid }
- };
- mapPolygon = new Polyline(geometryobj);
- that.zoom2MapHalf(mapPolygon);
- GraphSymbol = that.setGraphSymbol("polyline", 2);
- } else if (data.geometry.hasOwnProperty("rings")) {
- geometryobj = {
- "rings": data.geometry.rings,
- "spatialReference": { "wkid": that.map.spatialReference.wkid }
- };
- mapPolygon = new Polygon(geometryobj);
- that.zoom2MapHalf(mapPolygon);
- GraphSymbol = that.setGraphSymbol("polygon");
- } else {
- geometryobj = { "x": data.geometry.x, "y": data.geometry.y, "spatialReference": { "wkid": that.map.spatialReference.wkid } };
- mapPolygon = new Point(geometryobj);
- GraphSymbol = that.setGraphSymbol("point");
- }
- that.missionschedule_plandetail_polylinelayer.add(new Graphic(mapPolygon, GraphSymbol));
- }
- })
-
- let dom = $(settings.nTableWrapper);
- var tabindex = dom[0].id.split("_")[2];
-
- let pageInfo = that.dataTable_current_list[tabindex].page.info();
- let addPosi = dom.find(".previous");
- let pagehtml = '<li class="addPageInfo"><span>第' + (parseInt(pageInfo.page) + 1) + '页/共' + pageInfo.pages + '页</span></li>';
- addPosi.after(pagehtml);
-
- let turnAddPosi = dom.find('.turnToolbar');
- let turnpagehtml = '<input type="number" class="addPageIndexInput" value="' + (parseInt(pageInfo.page) + 1) + '" /> <button type="button" class="btn btn-sm btn-default addPageIndexButton">跳转</button>'
- turnAddPosi.empty().append(turnpagehtml);
- turnAddPosi.find('.addPageIndexButton').off().click(e => {
- let pageIndex = (turnAddPosi.find('.addPageIndexInput').val());
- if (pageIndex > 0 && pageIndex <= pageInfo.pages) {
- that.dataTable_current_list[tabindex].deafultPageIndex = pageIndex;
- that.dataTable_current_list[tabindex].ajax.reload();
- } else {
- that.dataTable_current_list[tabindex].deafultPageIndex = -10;
- that.toast.show("跳转页数超过查询范围请重新设置!");
- }
- })
- }.bind(that),
- serverSide: true,
- ajax: {
- url: esri.config.defaults.io.alwaysUseProxy ? esri.config.defaults.io.proxyUrl + "?" + layerInforUrl : layerInforUrl,
- dataType: "json",
- cache: false,
- type: "POST",
- data: function (e) {
- forCounter++;
- let start = (e['start'] / e['length']) + 1;
- let data = [];
- let objectIdsData = null;
- if (forCounter > device_Type_Ids.length) {
- var activeLi = that.domObj.find("li .active");
- var tabindex = activeLi.attr("href").split("_")[3];
- var cnContactLayerName = activeLi.html();
- if (that.dataTable_current_list[tabindex] && that.dataTable_current_list[tabindex].deafultPageIndex && that.dataTable_current_list[tabindex].deafultPageIndex != -10) {
- start = parseInt(that.dataTable_current_list[tabindex].deafultPageIndex);
- that.dataTable_current_list[tabindex].context[0]._iDisplayStart = (start - 1) * that.dataTable_current_list[tabindex].context[0]._iDisplayLength
- that.dataTable_current_list[tabindex].deafultPageIndex = -10;
- }
- objectIdsData = that.objectIdsStr[cnContactLayerName];
- }
- else {
- if (that.dataTable_current_list[forCounter - 1] && that.dataTable_current_list[forCounter - 1].deafultPageIndex && that.dataTable_current_list[forCounter - 1].deafultPageIndex != -10) {
- start = parseInt(that.dataTable_current_list[forCounter - 1].deafultPageIndex);
- that.dataTable_current_list[forCounter - 1].context[0]._iDisplayStart = (start - 1) * that.dataTable_current_list[forCounter - 1].context[0]._iDisplayLength
- that.dataTable_current_list[forCounter - 1].deafultPageIndex = -10;
- }
-
- var dataId = that.getDeviceType(device_Type_Ids[forCounter - 1]);
- objectIdsData = that.objectIdsStr[dataId.cnContactLayerName];
- }
- if (objectIdsData) {
- objectIdsData = objectIdsData.split(",");
- data = _.slice(objectIdsData, (start - 1) * e["length"], start * e["length"]);
- } else {
- data.push("无objectId");
- }
-
-
- var obj = that.getDeviceType(that.addData.deviceTypeIds.split(",")[0]);
- var fields = that.getLayerShowFieldNames(obj.cnContactLayerName);
- var where = obj.sqlfilter;
- let fieldDate = fields.map(e => e.name);
- var param = { "where": "", "outFields": fieldDate.join(","), "objectIds": data.join(","), "spatialRel": "esriSpatialRelIntersects", "returnGeometry": true, "geometryType": "esriGeometryPolygon", "geometry": "", "returnIdsOnly": false, "f": "json" };
- console.log(param);
- return param
- },
- error: function (e) {
- that.loadWait.hide();
- that.toast.show("巡检片区查询失败");
- console.error(e);
- },
- dataSrc: function (results) {
- forDataSrcCounter++;
- if (forDataSrcCounter > device_Type_Ids.length) {
- if (results.error) {
- that.loadWait.hide();
- that.toast.show(results.message);
- console.error(results.message);
- results.recordsFiltered = 1;
- results.data = [];
- return results.data;
- }
- if (results.features.length > 0) {
- var value = results;
- results = {};
- var activeLi = that.domObj.find("li .active");
- var tabindex = activeLi.attr("href").split("_")[3];
- var cnContactLayerName = activeLi.html();
- value.recordsFiltered = (that.objectIdsStr[cnContactLayerName].split(",")).length;
- results.data = [];
- that.dataTable_current_list[tabindex].currentData = value.features;
- $.each(value.features, function (j, item) {
- var obj = that.getDeviceType(that.addData.deviceTypeIds.split(",")[0]);
- var fields = that.getLayerShowFieldNames(obj.cnContactLayerName);
- let itemdata = {};
- for (let el of fields) {
- let dataInfo = that.ajaxSend.verificationHelper.setNullAndUndefined(item.attributes[el.name]);
-
- if (typeof (dataInfo) == "number") {
-
- if (dataInfo % 1 != 0) {
- dataInfo = dataInfo.toFixed(2);
- }
- }
- itemdata[el.name] = "<span class='getInfo' tabIndex='" + tabindex + "' index='" + j + "' title='" + dataInfo + "'>" + dataInfo + "</span>";
- }
- results.data.push(itemdata);
- });
- that.loadWait.hide();
- return results.data;
- }
- } else {
- if (results.error) {
- that.loadWait.hide();
- that.toast.show(results.message);
- console.error(results.message);
- results.recordsFiltered = 1;
- results.data = [];
- return results.data;
- }
- if (results.features.length > 0) {
- var value = results;
- results = {};
- var objid = that.getDeviceType(that.addData.deviceTypeIds.split(",")[forDataSrcCounter - 1]);
- value.recordsFiltered = (that.objectIdsStr[objid.cnContactLayerName].split(",")).length;
- results.data = [];
- that.dataTable_current_list[forDataSrcCounter - 1].currentData = value.features;
- $.each(value.features, function (j, item) {
- var obj = that.getDeviceType(that.addData.deviceTypeIds.split(",")[0]);
- var fields = that.getLayerShowFieldNames(obj.cnContactLayerName);
- let itemdata = {};
- for (let el of fields) {
- let dataInfo = that.ajaxSend.verificationHelper.setNullAndUndefined(item.attributes[el.name]);
-
- if (typeof (dataInfo) == "number") {
-
- if (dataInfo % 1 != 0) {
- dataInfo = dataInfo.toFixed(2);
- }
- }
- itemdata[el.name] = "<span class='getInfo' tabIndex='" + (forDataSrcCounter - 1) + "' index='" + j + "' title='" + dataInfo + "'>" + dataInfo + "</span>";
- }
- results.data.push(itemdata);
- });
- that.loadWait.hide();
- return results.data;
- } else {
- that.loadWait.hide();
- results.recordsFiltered = 1;
- results.data = [];
- return results.data;
- }
- }
- }
- },
- columns: columns,
- });
- }
- }
-
- getRegionInfo(id, device_type_id) {
- let data = {
- "current": 1,
- "size": this.config.pagemaxsize,
- "deviceTypeId": device_type_id
- };
- this.ajaxSend.sendAjax(this, data, this.config.getRegionInfo, this.ajaxSend.type.get, this.getRegionInfoCallback.bind(this).bind(this));
- }
- getRegionInfoCallback(results) {
- var that = this;
- if (results.code != 1) {
- that.toast.Show(results.message);
- return;
- }
- if (results.result.records.length == 0) {
- this.toast.show(this.toast.Show(" 抱歉,该片区内没有可以安排的巡检类型"));
- return;
- }
- var html_trs_data = "";
- var confobj = this.config.deviceForOther[this.addData.deviceTypeIds];
- var content = null;
- switch (Number(this.addData.deviceTypeIds)) {
- case 1:
- case 2:
- results.result.records.forEach((p, itemindx) => {
- content = new Object();
-
-
-
-
- html_trs_data += "<tr class=goto data-id='" + p.id
- + "' data-geometry='" + p.geometry
- + "' ><td class='checkwidth'><input type='checkbox' name='pointlist-select' class='pointlist-select' id='" + p.id
- + "' data-geometry='" + p.geometry
- + "' data-x='" + p.x
- + "' data-y='" + p.y
- + "' data-pipe_length='" + p.pipeLength
- + "' data-address='" + p.address
- + "' data-content='" + JSON.stringify(content)
- + "' data-name='" + p.pointName
- + "' data-device_type_id='" + this.addData.deviceTypeIds
- + "' data-regionname='" + p.regionName
- + "' /></td><td title='" + p.deviceTypeName + "'>" + p.deviceTypeName
- + "</td><td title='" + this.ajaxSend.verificationHelper.setNullAndUndefined(p.pointName) + "'>" + this.ajaxSend.verificationHelper.setNullAndUndefined(p.pointName)
- + "</td><td title='" + this.ajaxSend.verificationHelper.setNullAndUndefined(p.address) + "'>" + this.ajaxSend.verificationHelper.setNullAndUndefined(p.address)
-
- + "</td><td title='" + p.createTime + "'>" + p.createTime
- + "</td></tr>";
- });
- break;
- }
- this.addRegionInfoGraphic(results, this.addData.deviceTypeIds);
- this.domObj.find(".pointlist").empty().append(html_trs_data);
-
- this.domObj.off("click").on('click', '.pointlist tr', (e) => {
- this.domObj.find('tr.active').removeClass('active');
- $(e.currentTarget).addClass('active');
- var device_type_id = $(e.currentTarget).data("device_type_id");
- this.missionschedule_plandetail_polylinelayer.clear();
- if ($(e.currentTarget).data("geometry").hasOwnProperty("paths")) {
- var mappolyline = new Polyline($(e.currentTarget).data("geometry"));
- this.zoom2MapHalf(mappolyline);
- this.missionschedule_plandetail_polylinelayer.add(new Graphic(mappolyline, this.setGraphSymbol("polyline", 2)));
- } else {
- var mapPoint = new Point($(e.currentTarget).data("geometry").x, $(e.currentTarget).data("geometry").y, new SpatialReference({ wkid: this.map.spatialReference.wkid }));
- this.missionschedule_plandetail_polylinelayer.add(new Graphic(mapPoint, this.setGraphSymbol("point")));
- }
- });
-
- this.domObj.find('.pointlist-selected').off("change").on("change", function () {
- if (this.domObj.find(".pointlist-selected").prop('checked') == true) {
- this.domObj.find(".pointlist-select").each(function () {
- $(this).prop('checked', true);
- });
- } else {
- this.domObj.find(".pointlist-select").each(function () {
- $(this).prop('checked', false);
- });
- }
- this.getTypeLength();
- }.bind(this));
-
- this.domObj.find('.pointlist-select').off("change").on("change", function () {
- if (this.domObj.find(".pointlist-select:checked").length == this.domObj.find(".pointlist-select").length) {
- this.domObj.find('.pointlist-selected').prop('checked', true);
- } else {
- this.domObj.find('.pointlist-selected').prop('checked', false);
- }
- this.getTypeLength();
- }.bind(this));
- }
-
- getTypeLength() {
- let data = this.domObj.find(".pointlist-select:checked");
- if (data.length == 0) {
- this.domObj.find(".pipeTypeLength").text("0");
- } else {
- let length = 0;
- $.each(data, function (i, item) {
- length += parseFloat($(item).data('pipe_length'));
- });
- this.domObj.find(".pipeTypeLength").text(length.toFixed(2) + "");
- }
- }
-
- addRegionInfoGraphic(queryResult, device_type_id) {
- this.regionInfoGraphicLayer.clear();
- for (var i = 0, length = queryResult.result.records.length; i < length; i++) {
- var row = queryResult.result.records[i];
- if (row.geometry == undefined || row.geometry == "") { continue; }
- var point, graphic, name = "";
- switch (Number(device_type_id)) {
- case 1:
- point = new Point(JSON.parse(row.geometry));
- graphic = new Graphic(point, this.setSymbol(row.point_name)[0], { "id": row.id });
- name = row.pointName;
- break;
-
-
-
-
- case 2:
- var polyline = new Polyline(JSON.parse(row.geometry));
- point = polyline.getExtent().getCenter();
- graphic = new Graphic(polyline, this.setSymbol(row.point_name)[5], { "id": row.id });
- name = row.point_name;
- break;
- }
- this.regionInfoGraphicLayer.add(graphic);
- if (name != "") {
- var graphictextbg = new Graphic(point, this.setSymbol(name)[1].setOffset(0, -20), "");
- this.regionInfoGraphicLayer.add(graphictextbg);
-
- var peopleTextSymbol = new TextSymbol(name);
- peopleTextSymbol.setOffset(0, -25);
- var font = new Font();
- font.setSize("10pt");
- font.setWeight(Font.WEIGHT_BOLD);
- peopleTextSymbol.setFont(font);
- var graphicText = new Graphic(point, peopleTextSymbol, "");
- this.regionInfoGraphicLayer.add(graphicText);
- }
- }
- if (length > 0) {
- var extent = graphicsUtils.graphicsExtent(this.regionInfoGraphicLayer.graphics);
- if (extent != null) {
- this.zoom2MapHalf(extent);
- }
- }
- }
-
- getDistanceInfo() {
- let data = {
- }
- this.ajaxSend.sendAjax(this, data, this.config.getDistanceInfo, this.ajaxSend.type.get, function (results) {
- if (results.code != -1 && results.result.minDistanceInPlace) {
- this.distanceInfo = results.result.minDistanceInPlace
- }
- }.bind(this));
- }
-
- destroy() {
- if (this.jobid) {
- this.gp.cancelJob(this.jobid);
- }
- if (this.missionschedule_plandetail_polylinelayer) {
- this.map.removeLayer(this.missionschedule_plandetail_polylinelayer);
- this.missionschedule_plandetail_polylinelayer.clear();
- }
- if (this.regionInfoGraphicLayer) {
- this.map.removeLayer(this.regionInfoGraphicLayer);
- this.regionInfoGraphicLayer.clear();
- }
- if (this.missionschedule_planpoint_clusterLayer) {
- this.map.removeLayer(this.missionschedule_planpoint_clusterLayer);
- }
- if (this.plan_addptype_layer) {
- this.map.removeLayer(this.plan_addptype_layer);
- }
- if (this.plan_addpontype_layer) {
- this.map.removeLayer(this.plan_addpontype_layer);
- }
- if (this.devices_selected_layers) {
- this.map.removeLayer(this.devices_selected_layers);
- }
- if (this.drawToolbar != null) {
- this.map.setMapCursor('default');
- this.drawToolbar.deactivate();
- this.drawToolbar = null;
- }
- if (this.dynamicMapServer) {
- this.map.removeLayer(this.dynamicMapServer);
- }
- this.domObj.remove();
- this.afterDestroy();
- }
-
- planClear() {
- this.plan_addpontype_layer.clear();
- this.plan_addptype_layer.clear();
- this.missionschedule_plandetail_polylinelayer.clear();
- this.devices_selected_layers.clear();
- this.regionInfoGraphicLayer.clear();
- if (this.missionschedule_planpoint_clusterLayer != null) {
- this.map.removeLayer(this.missionschedule_planpoint_clusterLayer);
- this.missionschedule_planpoint_clusterLayer = null;
- }
- }
-
- private getDeviceType(devicetypeID) {
- var index = _.findIndex(this.deviceTypes, function (o) { return (o["pointTypeId"] + "") == devicetypeID; });
- if (index == -1) return null;
- var devicetype = this.deviceTypes[index];
- return devicetype;
- }
-
- private zoom2MapHalf(geo) {
- var extent = geo.getExtent();
- this.map.setExtent(extent);
- }
- private getLayerShowFieldNames(cn_layerName) {
- var layerfields = this.AppX.runtimeConfig.fieldConfig.GetLayerFields(cn_layerName);
- var showFields = layerfields.slice(0, 5);
-
- for (var i = 0; i < 5; i++) {
- var index = _.findIndex(this.config.showfieldnames, function (o: any) { return o == showFields[i].alias });
- if (index == -1) {
- var index2 = _.findIndex(layerfields, function (o: any) { return this.config.showfieldnames[i] == o.alias }.bind(this));
- if (index2 != -1)
- showFields[i] = layerfields[index2];
- }
- }
- return showFields;
- }
- }
|