Browse Source

图层控制;部件码管理;PBS结构树

lishun 4 years ago
parent
commit
7952c82628

+ 6 - 6
src/widgets/LayerList/Widget.ts

@@ -129,6 +129,12 @@ class LayerList extends BaseWidget {
                 }
                 //判断是否属于影像图层
                 if (type == null) {
+                    //添加影像,不勾选
+                    if(item.type==="img"&&item.add){
+                        checked=!item.add;
+                        type=LayerType.Imagery;
+                        Exit=true;
+                    }
                     $.each(this.activeView.imageryLayers._layers, function (index, item_s) {
                         if (item_s.imageryProvider.credit && item.name == item_s.imageryProvider.credit.html) {
                             checked = item_s.show;
@@ -136,12 +142,6 @@ class LayerList extends BaseWidget {
                             Exit = true;
                         }
                     })
-                    //添加影像,不勾选
-                    if(item.type==="img"&&item.add){
-                        checked=!item.add;
-                        type=LayerType.Imagery;
-                        Exit=true;
-                    }
                 }
                 //判断是否属于地形图层
                 if (type == null && item.label == "地形") {

+ 3 - 1
src/widgets/LayerList/config.json

@@ -522,7 +522,9 @@
                 },
                 {
                     "label": "电子地图",
-                    "name": "vec3d"
+                    "name": "vec3d",
+                    "type":"img",
+                    "add":true
                 },
                 {
                     "label": "卫星影像",

+ 26 - 1
src/widgets/PartManagement/Widget.html

@@ -1,9 +1,34 @@
 <div class="widget-partmanagement">
+    <!-- <div class="queryAttributeContainer">
+        <fieldset class="paramsFieldset">
+            <legend class="showline">参数</legend>
+            <div>
+                <div class="treeContainer">
+                    <ul class="ztree" id="layertree"></ul>
+                </div>
+                <div class="treeBtns">
+                    <ul>
+                        <li><button class="btn btn-system btn-sm">全选</button></li>
+                        <li><button class="btn btn-system btn-sm">反选</button></li>
+                        <li><button class="btn btn-system btn-sm">取消选中</button></li>
+                    </ul>
+                </div>
+            </div>
+            <div class="queryMethod">
+                <button id="sq_circle" title="圆" class="btn btn-system btn-sm">圆域</button>
+                <button id="sq_polygon" title="多边形" class="btn btn-system btn-sm">多边形</button>
+                <button id="sq_clearBtn" class="btn btn-system btn-sm">清除</button>
+            </div>
+        </fieldset>
+    </div> -->
     <div>
         <button id="pointSelBtn" class="btn btn-primary">点选</button>
         <button id="polygonSelBtn" class="btn btn-primary">自定义选择</button>
         <button id="previewBtn" class="btn btn-primary">预览</button>
-        <button id="exportBtn" class="btn btn-primary">导出</button>
+        <button id="exportPDFBtn" class="btn btn-primary">导出PDF</button>
+    </div>
+    <div style="margin:5px 0;">
+        <button id="exportExcelBtn" class="btn btn-primary">导出Excel</button>
     </div>
     <p class="previewPar">预览</p>
     <div class="container-fluid qrcode" id="qrcode">

+ 107 - 9
src/widgets/PartManagement/Widget.ts

@@ -1,4 +1,5 @@
 import BaseWidget = require('core/BaseWidget.class');
+import AjaxSend=require('common/AjaxSend.class');
 declare let createTooltip;
 declare let CesiumToSuperMap;
 declare let Canvas2Image;
@@ -12,13 +13,17 @@ class PartManagement extends BaseWidget {
     polygonSelBtnID = "polygonSelBtn";
     screenShotImgID = "screenShotImg";
     qrcodeListID = "qrcodeList";
-    exportBtnID = "exportBtn";
+    exportPDFBtnID = "exportPDFBtn";
+    exportExcelBtnID="exportExcelBtn";
     previewBtnID = "previewBtn";
     excavatename="partmanagement";
+    layertreeID="layertree";
     viewer: Cesium.Viewer;
     toolTip = undefined;
     handler: Cesium.ScreenSpaceEventHandler = undefined;
     customDataSource: Cesium.CustomDataSource = undefined;
+    _layerTreeObj=null;
+    _ajaxsend:AjaxSend=null;
     /**
      * entity移动事件
      */
@@ -28,8 +33,10 @@ class PartManagement extends BaseWidget {
         createPdf: "/tofly-sxgk/structure/createPdf",
         downLoad: "/tofly-sxgk/commonFile/download",
         preview: "vendor/pdfjs-2.4.456-dist/web/viewer.html",
+        expXls:"/tofly-sxgk/structure/exportExcel",
         sjfw: "",
-        getPBSQRCode: "/tofly-sxgk/structure/createPic"
+        getNodeQRCode: "/tofly-sxgk/structure/createPicNode",
+        getPipeQRCode: "/tofly-sxgk/structure/createPicPipe",
     }
     fields = {
         line: {
@@ -55,6 +62,7 @@ class PartManagement extends BaseWidget {
         this.setHtml(this.template);
         this.viewer = this.activeView;
         this.initDomEvent();
+        this._ajaxsend=new AjaxSend();
         this.apiUrls.sjfw = this.AppX.appConfig.gisResource.tiplayers.config["sjfw"].url
         if (this.AppX.runtimeConfig.autoRunAdaptor) {
             this.AppX.runtimeConfig.autoRunAdaptor.addOperateEvents(this.excavatename, this.otherDestroy.bind(this), this);
@@ -63,6 +71,7 @@ class PartManagement extends BaseWidget {
         //添加数据源
         this.customDataSource = new Cesium.CustomDataSource("PartManagement");
         this.viewer.dataSources.add(this.customDataSource);
+        //this.initPipeLayers();
     }
     /**
      * 初始化DOM事件
@@ -81,22 +90,80 @@ class PartManagement extends BaseWidget {
             that.clearPictures();
             that.addPolygonSelEvent();
         });
-        this.domObj.find("#" + this.exportBtnID).off("click").on('click', function () {
+        this.domObj.find("#" + this.exportPDFBtnID).off("click").on('click', function () {
             if (that.seletFeatures) {
-                that.downLoadPDF(that.seletFeatures);
+                const pbsArra = that.seletFeatures.map(item => { return item.attributes; });
+                that.downLoadPDF(pbsArra);
+            } else {
+                that.toast.show("请选择构件");
+            }
+        });
+        this.domObj.find("#" + this.exportExcelBtnID).off("click").on('click', function () {
+            if (that.seletFeatures) {
+                that.downLoadExcel(that.seletFeatures);
             } else {
                 that.toast.show("请选择构件");
             }
         });
         this.domObj.find("#" + this.previewBtnID).off("click").on('click', function () {
             if (that.seletFeatures) {
-                that.previewPDF(that.seletFeatures);
+                const pbsArra = that.seletFeatures.map(item => { return item.attributes; });
+                that.previewPDF(pbsArra);
             } else {
                 that.toast.show("请选择构件");
             }
         });
         this.entityMoveEvent();
     }
+    /**
+     * 该方法用于初始化图层选择树
+     */
+    initPipeLayers() {
+        const that=this;
+        const layers = this.viewer.scene.layers.layerQueue;
+        const pipe = this.config.queryParameter.datasets;
+        let setting = {
+            view: {
+                addHoverDom: false,
+                removeHoverDom: false,
+                selectedMulti: false,
+                showLine: false,
+                showIcon: false
+            },
+            check: {
+                enable: true
+            },
+            data: {
+                simpleData: {
+                    enable: true,
+                    idKey: "id",
+                    pIdKey: "pId",
+                    rootPId: null
+                }
+            },
+            edit: {
+                enable: false
+            }
+        };
+        let children=[];
+        pipe.forEach(pipetype => {
+            const layer=that.viewer.scene.layers.find(pipetype.name);
+            if (layer) {
+                const node={
+                    pId:0,
+                    id:pipetype.name,
+                    name:pipetype.title,
+                    mapname:pipetype.mapname,
+                    isParent:false,
+                    checked:false
+                }
+                children.push(node);
+                //pipetype.layer = layer;
+                //this.g_pipeService.push(pipetype);
+            }
+        });
+        this._layerTreeObj=$.fn.zTree.init(this.domObj.find("#"+this.layertreeID),setting,children);
+    }
     /**
      * 该方法用于添加entity选中移动事件
      * 
@@ -443,7 +510,38 @@ class PartManagement extends BaseWidget {
             that.customDataSource.entities.add(entity);
         })
         that.createQRCode(features);
-        that.seletFeatures = features.map(item => { return item.attributes; });
+        that.seletFeatures = features;
+        //that.seletFeatures = features.map(item => { return item.attributes; });
+    }
+    /**
+     * 该方法用于导出excel
+     * @param features features对象
+     */
+    downLoadExcel(features: Array<any>){
+        const gl = this;
+        const url = this.apiUrls.expXls;
+        const arr = features.map((item, index: number) => {
+            const attr=item.attributes;
+            const key=attr["PIPE_ID"];
+            const val = attr["CODE"];
+            const pipeType=item.type==="POINT"?"node":"pipe";
+            return {"type":pipeType,"pipeId":key,"pbs":val};
+        })
+        const data={"pbss":arr};
+        const pdf = gl.apiRoot + url + "?pbss=" +encodeURIComponent(JSON.stringify(arr))+ "&access_token=" + gl.userToken;
+        window.open(pdf);
+        // this._ajaxsend.sendAjax(this,data,url,"GET",function(result){
+        //     console.log(result);
+        //     // const filename = {
+        //     //     fileName: result.result
+        //     // };
+        //     // const pdf = gl.apiRoot + downloadUrl + "?fileName=" + result.result + "&access_token=" + gl.userToken;
+        //     // window.open(pdf);
+        //     // //var qrcode = new QRCode(document.getElementById("qrcode"),{text:pbs});
+        //     // //gl.sendAjax(filename, downloadUrl, "GET", function (e) { });
+        // },function(err){
+        //     console.log(err);
+        // })
     }
     /**
      * 该方法用于下载二维码PDF
@@ -571,12 +669,12 @@ class PartManagement extends BaseWidget {
      */
     createQRCode(features: any[]) {
         const gl = this;
-        const url = this.apiUrls.getPBSQRCode;
         const qrcodeListContainer = this.domObj.find("#" + this.qrcodeListID);
         qrcodeListContainer.empty();
-        const apiUrl = this.apiRoot + url + "?access_token=" + this.userToken + "&";
-
         for (let i = 0; i < features.length; i += 2) {
+            const geoType = (features[i].type as string).toLowerCase().indexOf('line') !== -1 ? 'line' : 'point';
+            const url = geoType==="line"?this.apiUrls.getPipeQRCode:this.apiUrls.getNodeQRCode;
+            const apiUrl = this.apiRoot + url + "?access_token=" + this.userToken + "&";
             if (i === features.length - 1) {
                 const feature = features[i];
                 const code = "pbs=" + feature.attributes["CODE"];

+ 3 - 3
src/widgets/PartManagement/config.json

@@ -13,7 +13,7 @@
             },
             {
                 "title":"雨水管点",
-                "name":"NETWORK_SJ_PSYS_NODE@sxgk#1",
+                "name":"NETWORK_SJ_PSYS_Node@sxgk#1",
                 "dataset":"TF_SJ_PSYS_NODE_B_3D",
                 "dataset2D":"TF_SJ_PSYS_NODE_B",
                 "pipeType":"PS",
@@ -36,7 +36,7 @@
             },
             {
                 "title":"污水管点",
-                "name":"NETWORK_SJ_PSWS_NODE@sxgk#1",
+                "name":"NETWORK_SJ_PSWS_Node@sxgk#1",
                 "dataset":"TF_SJ_PSWS_NODE_B_3D",
                 "dataset2D":"TF_SJ_PSWS_NODE_B",
                 "pipeType":"PS",
@@ -59,7 +59,7 @@
             },
             {
                 "title":"雨污合流管点",
-                "name":"NETWORK_SJ_PSHS_NODE@sxgk#1",
+                "name":"NETWORK_SJ_PSHS_Node@sxgk#1",
                 "dataset":"TF_SJ_PSHS_NODE_B_3D",
                 "dataset2D":"TF_SJ_PSHS_NODE_B",
                 "pipeType":"PS",

+ 53 - 0
src/widgets/PartManagement/css/style.scss

@@ -1,6 +1,59 @@
 .widget-partmanagement{
     padding: 5px;
     height: auto;
+    .paramsFieldset {
+        color:#fff;
+        font-size: 0.875rem;
+        border: 1px solid #31d5ff;
+        legend.showline {
+          color: inherit;
+          width: auto;
+          padding: 0 7px;
+          font-size: 1rem;
+          border: none;
+          margin-bottom: 0;
+          margin-left: 5px;
+        }
+        .treeContainer {
+          color: inherit;
+          width: 97%;
+          display: inline-block;
+          height: 150px;
+          overflow: auto;
+          border: 1px solid #31d5ff;
+          margin-left: 5px;
+          vertical-align: top;
+          ul.ztree {
+            color: inherit;
+            li span{
+                color:#fff;
+            }
+            li a:hover{
+                background-color: unset;
+                text-decoration: underline;
+            }
+            li a.curSelectedNode{
+                color:#fff;
+                background-color: unset;
+            }
+          }
+        }
+        .treeBtns {
+          width: 30%;
+          display: inline-block;
+          ul {
+            list-style: none;
+            margin: 0 0 0 10px;
+            padding: 0;
+            li {
+              margin-bottom: 5px;
+            }
+          }
+        }
+        .queryMethod {
+          margin: 5px 5px;
+        }
+      }
     .previewPar{
         background-color: #3888cd;
         padding: 3px 0;

+ 9 - 8
src/widgets/PbsTreeManagement/Widget.html

@@ -2,9 +2,9 @@
     <ul class="nav nav-tabs" role="tablist">
         <li class="nav-item" role="presentation">
             <a class="nav-link active" href="#pbstree" data-toggle='tab' role="tab" aria-controls="pbstree"
-                aria-selected="true">结构树</a>
+                aria-selected="true">设计</a>
         </li>
-        <li class="nav-item" role="presentation">
+        <!-- <li class="nav-item" role="presentation">
             <a class="nav-link" href="#pucha" data-toggle='tab' role="tab"
                 aria-controls="pucha">普查</a>
         </li>
@@ -15,15 +15,15 @@
         <li class="nav-item" role="presentation">
             <a class="nav-link" href="#shigong" data-toggle='tab' role="tab"
                 aria-controls="shigong">施工</a>
-        </li>  
+        </li>   -->
         <li class="nav-item" role="presentation">
             <a class="nav-link" href="#chengguo" data-toggle='tab' role="tab"
-                aria-controls="chengguo">成果</a>
+                aria-controls="chengguo">竣工</a>
         </li>  
-        <li class="nav-item" role="presentation">
+        <!-- <li class="nav-item" role="presentation">
             <a class="nav-link" href="#bujian" data-toggle='tab' role="tab"
                 aria-controls="bujian">部件二维码</a>
-        </li>           
+        </li>            -->
     </ul>
     <div class="tab-content">            
         <!-- 结构树 -->
@@ -32,8 +32,9 @@
                 <div class="input-group searchbox">
                     <div class="input-group-prepend">
                         <select class="searchType" id="searchTypeSel">
-                            <option value="0">检查井</option>
-                            <option value="1">排水管</option>
+                            <option value="0">PBS编码</option>
+                            <option value="1">部件标识码</option>
+                            <option value="2">工程名称</option>
                         </select>
                     </div>
                     <input class="form-control" type="text" autocomplete="off" id="pbsSearchInput" />

+ 173 - 152
src/widgets/PbsTreeManagement/Widget.ts

@@ -12,10 +12,11 @@ class PbsTreeManagement extends BaseWidget {
     retable: any;
     reset = "";
     currentTarget = null;
-    localWindow=null;
-    treeDatas=[];
-    pbsSearchInputID="pbsSearchInput";
-    searchBtnID="searchBtn";
+    localWindow = null;
+    treeDatas = [];
+    pbsSearchInputID = "pbsSearchInput";
+    searchBtnID = "searchBtn";
+    searchTypeSelID = "searchTypeSel";
     /**
      * 启动
      */
@@ -45,104 +46,105 @@ class PbsTreeManagement extends BaseWidget {
      */
     getPbsTreeCallback(results) {
         let datas = [];
-        let num =[];
-        if (this.checkRsults(results, true)) { 
-            let indexDatas=[];         
-            $.each(results.result, function (i, item) { 
-                var pitem={
-                        id: item.prjid+"",
-                        pId: item.prjid+"",
-                        pid: item.prjid+"",
-                        name: item.prjname,
-                        value: i,
-                        open: true,
-                        isLoad:false
-                }; 
-                
-                let lstL=[item.prjid];
+        let num = [];
+        if (this.checkRsults(results, true)) {
+            let indexDatas = [];
+            $.each(results.result, function (i, item) {
+                var pitem = {
+                    id: item.prjid + "",
+                    pId: item.prjid + "",
+                    pid: item.prjid + "",
+                    name: item.prjname,
+                    value: i,
+                    open: true,
+                    isLoad: false
+                };
+
+                let lstL = [item.prjid];
                 $.each(item.structures, function (j, info) {
-                    if(info.id!=item.prjid && lstL.indexOf(info.pid)==-1){
+                    if (info.id != item.prjid && lstL.indexOf(info.pid) == -1) {
                         lstL.push(info.pid);
-                    }                   
-                }) 
+                    }
+                })
 
-                 $.each(item.structures, function (j, info) {
-                    if(info.id!=item.prjid){
-                        var obj={
-                            id: info.id+"",
-                            pId: info.pid+"",
-                            pid: info.pid+"",
-                            name: info.name+"_"+ info.code,
+                $.each(item.structures, function (j, info) {
+                    if (info.id != item.prjid) {
+                        var obj = {
+                            id: info.id + "",
+                            pId: info.pid + "",
+                            pid: info.pid + "",
+                            name: info.name + "_" + info.code,
                             value: info.code,
-                            count:info.count,
-                            open:true                         
+                            count: info.count,
+                            open: true
                         };
-                        if(lstL.indexOf(info.id)==-1 && info.count>0){
-                            obj.open=false;
-                            indexDatas.push(datas.length);                            
-                        }  
-                        datas.push(obj);                       
-                    }else{
-                        pitem.name+="_"+info.code;
-                    }                  
-                }) 
+                        if (lstL.indexOf(info.id) == -1 && info.count > 0) {
+                            obj.open = false;
+                            indexDatas.push(datas.length);
+                        }
+                        datas.push(obj);
+                    } else {
+                        pitem.name += "_" + info.code;
+                    }
+                })
 
                 datas.push(pitem);
-                               
+
             })
-            var gjUrl=this.config.getPbsBjApi;
-            this.getBjList(indexDatas,datas,gjUrl,0);
+            var gjUrl = this.config.getPbsBjApi;
+            this.getBjList(indexDatas, datas, gjUrl, 0);
             //异步加载构建            
-        }else{
+        } else {
             this.initZtree(datas);
             this.loadMask.hide();
-        }            
+        }
     }
 
-    getBjList(indexs,datas,url,index){
-        if(index==indexs.length){            
+    getBjList(indexs, datas, url, index) {
+        if (index == indexs.length) {
             this.initZtree(datas);
             this.loadMask.hide();
             return;
         }
-        let id=datas[indexs[index]].id;
-        let hjurl=url.replace("{0}",id);            
-        this.sendAjax({"id":id}, hjurl, "GET", function(results){
+        let id = datas[indexs[index]].id;
+        let hjurl = url.replace("{0}", id);
+        this.sendAjax({ "id": id }, hjurl, "GET", function (results) {
             if (this.checkRsults(results, true)) {
-                var infos=results.result;
-                for(var key in infos){
-                         let items=infos[key];
-                         let item={
-                            id: key+'_'+id,                           
-                            name: key,
-                            value: key,
-                            pid:id,
-                            pId:id,
-                            count:items.length,
-                            open: items.length>0?false:true                                
-                         };
-                         datas.push(item);
-                         items.forEach(function(obj,index){
-                            datas.push({
-                                id: item.id+"_"+obj.id,                                                           
-                                name: obj.code,
-                                value: obj.code,
-                                pid:item.id,
-                                pId:item.id,
-                                count:0,
-                                open: true,
-                                layerName:obj.layerName    
-                            });
-                         })
+                var infos = results.result;
+                for (var key in infos) {
+                    let items = infos[key];
+                    let item = {
+                        id: key + '_' + id,
+                        name: key,
+                        value: key,
+                        pid: id,
+                        pId: id,
+                        count: items.length,
+                        open: items.length > 0 ? false : true
+                    };
+                    datas.push(item);
+                    items.forEach(function (obj, index) {
+                        datas.push({
+                            id: item.id + "_" + obj.id,
+                            name: obj.code+"("+obj.pipeId+")",
+                            value: obj.code,
+                            pid: item.id,
+                            pId: item.id,
+                            count: 0,
+                            open: true,
+                            pipeId: obj.pipeId,
+                            layerName: obj.layerName
+                        });
+                    })
                 }
-                this.getBjList(indexs,datas,url,index+1);
+                this.getBjList(indexs, datas, url, index + 1);
             }
-        }.bind(this), 0,true)
+        }.bind(this), 0, true)
     }
 
 
 
-    
+
     /**
      * 构建 ztree
      * @param datas
@@ -155,51 +157,51 @@ class PbsTreeManagement extends BaseWidget {
         var that = this;
         var setting = {
             async: {
-				enable: true
-			},
-			check: {
-				enable: false
-			},
-			data: {
-				simpleData: {
-					enable: true
-				}
-			},
-			view: {
-                showLine:true,
-                showIcon:false
-			},
-			callback: {
-                onClick: function(event, treeId, treeNode){
-                    if(treeNode && treeNode.layerName){                        
-                        let lyName="",code=treeNode.value;
-                        if(treeNode.layerName.indexOf(',')>-1){
-                            lyName=treeNode.layerName.split(',')[1];
+                enable: true
+            },
+            check: {
+                enable: false
+            },
+            data: {
+                simpleData: {
+                    enable: true
+                }
+            },
+            view: {
+                showLine: true,
+                showIcon: false
+            },
+            callback: {
+                onClick: function (event, treeId, treeNode) {
+                    if (treeNode && treeNode.layerName) {
+                        let lyName = "", code = treeNode.value;
+                        if (treeNode.layerName.indexOf(',') > -1) {
+                            lyName = treeNode.layerName.split(',')[1];
                         }
-                        else{
-                            lyName=treeNode.layerName
+                        else {
+                            lyName = treeNode.layerName
                         }
-                        that.localWindow=new PipeUnitInfo({
-                            widgetPath:"widgets/PipeUnitInfo"
-                        },false,{
-                            name:lyName,//
-                            id:code
+                        that.localWindow = new PipeUnitInfo({
+                            widgetPath: "widgets/PipeUnitInfo"
+                        }, false, {
+                            name: lyName,//
+                            id: code
                         });
                     }
-                    
+
                 }
-			}
+            }
         };
-       
+
 
         $(document).ready(function () {
-            $.fn.zTree.init($("#pbsTreeDivId"), setting, zNodes); 
+            $.fn.zTree.init($("#pbsTreeDivId"), setting, zNodes);
             this.initTreeCheck("puchatree");
             this.initTreeCheck("shigongtree");
             this.initTreeCheck("shejitree");
-            this.initTreeCheck("chengguotree");           
+            this.initTreeCheck("chengguotree");
         }.bind(this));
-        
+
 
         this.domObj.find("#pbsTreeDivId").on("click", "a", function (e) {
             if (this.domObj.find("#pbsTreeDivId a").find(".active").length > 1) {
@@ -207,53 +209,72 @@ class PbsTreeManagement extends BaseWidget {
             }
             $(e.currentTarget).find(".diy").addClass("active");
             that.currentTarget = $(that.domObj.find("#pbsTreeDivId .diy.active")[1]).find(".btn_files").attr("value");
-           
+
         }.bind(this));
-        this.domObj.find('#'+this.searchBtnID).off('click').on('click',function(){
-            const code=this.domObj.find("#"+this.pbsSearchInputID).val().toString().trim();
-            if(code===''){
+        this.domObj.find("#" + this.searchTypeSelID).off('change').on('change',function(){
+            this.domObj.find("#" + this.pbsSearchInputID).val('');
+        }.bind(this))
+        this.domObj.find('#' + this.searchBtnID).off('click').on('click', function () {
+            const code = this.domObj.find("#" + this.pbsSearchInputID).val().toString().trim();
+            const searchType = this.domObj.find("#" + this.searchTypeSelID).val().toString();
+            if (code === '') {
                 return;
             }
-            this.searchPBSCode(code);
+            switch (searchType) {
+                case "0":
+                    this.searchPBSCode("name", code);
+                    break;
+                case "1":
+                    this.searchPBSCode("pipeId", code);
+                    break;
+                case "2":
+                    this.searchPBSCode("name", code);
+                    break;
+            }
+
 
         }.bind(this))
     }
 
-    initTreeCheck(id){
+    initTreeCheck(id) {
         var setting = {
             async: {
-				enable: true
-			},
-			check: {
-				enable: true
-			},
-			data: {
-				simpleData: {
-					enable: true
-				}
-			},
-			view: {
-                showLine:true,
-                showIcon:false
-			},
-			callback: {
-                onClick: function(event, treeId, treeNode){
-                                       
+                enable: true
+            },
+            check: {
+                enable: true
+            },
+            data: {
+                simpleData: {
+                    enable: true
                 }
-			}
+            },
+            view: {
+                showLine: true,
+                showIcon: false
+            },
+            callback: {
+                onClick: function (event, treeId, treeNode) {
+
+                }
+            }
         };
-       
-        $.fn.zTree.init($("#"+id), setting, this.config.nodedatas);  
-       
+
+        $.fn.zTree.init($("#" + id), setting, this.config.nodedatas);
+
     }
     /**
      * 该方法用于搜索PBS工程结构树
+     * @param {string} key ztree模糊查询关键值
+     * @param {string} code 模糊查询字符串
      */
-    searchPBSCode(code){
-        const ztreeObj=$.fn.zTree.getZTreeObj("pbsTreeDivId");
-        const nodes=ztreeObj.getNodesByParamFuzzy('name',code,null);
-        nodes.forEach(node=>{
-            ztreeObj.selectNode(node);
+    searchPBSCode(key: string, code: string) {
+
+        const ztreeObj = $.fn.zTree.getZTreeObj("pbsTreeDivId");
+        ztreeObj.cancelSelectedNode();
+        const nodes = ztreeObj.getNodesByParam(key, code, null);
+        nodes.forEach(node => {
+            ztreeObj.selectNode(node,false);
         })
     }
     /**
@@ -262,8 +283,8 @@ class PbsTreeManagement extends BaseWidget {
      * @returns 返回true或者false(true正常,false返回数据异常)
      */
     checkRsults(results, colsepopup) {
-        this.loadMask.hide();        
-        if (results.code != 1) {            
+        this.loadMask.hide();
+        if (results.code != 1) {
             console.error(results.message);
             this.toast.show(results.message);
             return false;
@@ -271,11 +292,11 @@ class PbsTreeManagement extends BaseWidget {
             return true
         }
     }
-    
+
     /**
      * 后台请求
      */
-    sendAjax(data, url, ajaxtype, callBack?, type?,isasync?) {
+    sendAjax(data, url, ajaxtype, callBack?, type?, isasync?) {
         let sendtype = "";
         let senddata = null;
         let contentType = "application/json;charset=utf-8";
@@ -295,7 +316,7 @@ class PbsTreeManagement extends BaseWidget {
         }
         $.ajax({
             headers: this.header,
-            async:isasync,
+            async: isasync,
             type: ajaxtype,
             url: this.apiRoot + url,
             contentType: contentType,
@@ -304,7 +325,7 @@ class PbsTreeManagement extends BaseWidget {
             error: function (data) {
                 console.error(data);
                 this.loadMask.hide();
-                this.toast.show("服务端ajax出错,获取数据失败!"); 
+                this.toast.show("服务端ajax出错,获取数据失败!");
             }.bind(this),
             dataType: "json",
         });
@@ -315,9 +336,9 @@ class PbsTreeManagement extends BaseWidget {
      */
     destroy() {
         if (this.localWindow && this.localWindow.infoWindow) {
-            this.localWindow.infoWindow.remove();            
-            this.AppX.appConfig.infowindow=null;
-            this.localWindow=null;
+            this.localWindow.infoWindow.remove();
+            this.AppX.appConfig.infowindow = null;
+            this.localWindow = null;
         }
         this.domObj.remove();
         this.afterDestroy();

+ 3 - 2
src/widgets/PbsTreeManagement/css/style.scss

@@ -11,10 +11,9 @@
         select{
           border: none;
           background-color: #fff;
-          width:150px;
         }
         select.searchType{
-          width:68px;
+          width:100px;
         }
         input{
           font-size: $fontsize;
@@ -119,12 +118,14 @@
         background: rgb(225, 245, 254);
 
         .nav-item {
+            width:50%;
             .nav-link {
                 font-size: 14px;
                 padding: .5rem .5rem;
             }
 
             a.nav-link {
+                text-align: center;
                 color: #495057;
 
                 :hover {

+ 104 - 38
src/widgets/PipeSpeedInfoCheck/Widget.ts

@@ -1,14 +1,21 @@
 import BaseWidget = require('core/BaseWidget.class');
+import AjaxSend = require('common/AjaxSend.class');
+import { result } from 'lodash';
 
 class PipeSpeedInfoCheck extends BaseWidget {
-    viewer = this.AppX.runtimeConfig.activeView;
+    viewer:Cesium.Viewer = this.AppX.runtimeConfig.activeView;
     baseClass = "widget-pipespeedinfocheck";
+    _ajxSend:AjaxSend=null;
     currentids = [];
     clearDateBtnID = "clearDateBtn";
     pipespeed_dateID = "pipespeed_date";
+    apiurls={
+        getProgress:"/tofly-sxgk/pbsfx/scanList"
+    };
     startup() {
         this.setHtml(this.template);
         this.initDateRangePicker();
+        this._ajxSend=new AjaxSend();
         //Date picker
         this.domObj.find('#' + this.clearDateBtnID).off('click').on('click', function () {
             this.domObj.find('#' + this.pipespeed_dateID + ' span').html('<span>选择日期范围 <i class="fa fa-calendar"></i></span>')
@@ -46,41 +53,69 @@ class PipeSpeedInfoCheck extends BaseWidget {
             function (start, end) {
                 this.domObj.find('#' + this.pipespeed_dateID + ' span').html(start.format('YYYY/MM/DD') + ' - ' + end.format('YYYY/MM/DD'));
                 //alert(start.format('YYYYMMDD') + " " + end.format('YYYYMMDD'));
-                this.showSpeedInfos(end.format('YYYY/MM/DD'));
+                this.showSpeedInfos(start.format('YYYY-MM-DD'),end.format('YYYY-MM-DD'));
             }.bind(this)
         );
     }
     /**
      * 显示进度信息
+     * @param {string} s_dt 起始日期
+     * @param {string} e_dt 终止日期
      */
-    showSpeedInfos(dt) {
-        let name = this.config.name;
-        let ly = this.viewer.scene.layers.find(name);
-        //let dt=this.domObj.find("#pipespeed_date").val();
-        let start = new Date((<string>dt).replace("-", "/").replace("-", "/"));
-        let end = new Date(this.config.date.replace("-", "/").replace("-", "/"));
-        let pbscodes=null;
-        if (ly) {
-            if (this.currentids.length > 0)
-                ly.removeObjsColor(this.currentids);
-            if (end < start) {
-                this.currentids = this.config.smids2;
-                //pbscodes=this.config.smids2;
-            } else {
-                //pbscodes = this.config.smids;
-                this.currentids = this.config.smids;
+    showSpeedInfos(s_dt,e_dt) {
+        const url=this.apiurls.getProgress;
+        const that=this;
+        const data={
+            SDate:s_dt,
+            EDate:e_dt
+        };
+        this._ajxSend.sendAjax(this,data,url,"GET",function(result){
+            if(result.code===1){
+                that.pbsInfo(result.result);   
+            }else{
+                that.toast.show('查询失败');
             }
-            ly.mixColorType=2;
-            ly.setObjsColor(this.currentids, Cesium.Color.RED);
-        }
-        //this.pbsInfo(this.config.pbscodes);
+            
+        },function(error){
+            console.log(error);
+        })
+        // let name = this.config.name;
+        // let ly = this.viewer.scene.layers.find(name);
+        // ly.selectedColor=Cesium.Color.RED;
+        // ly.selectEnabled=true;
+        // ly.multiChoose=true;
+        // ly.selectColorType=Cesium.SelectColorType.REPLACE;
+        // //let dt=this.domObj.find("#pipespeed_date").val();
+        // let start = new Date((<string>dt).replace("-", "/").replace("-", "/"));
+        // let end = new Date(this.config.date.replace("-", "/").replace("-", "/"));
+        // let pbscodes=null;
+        // if (ly) {
+        //     if (this.currentids.length > 0)
+        //         ly.removeObjsColor(this.currentids);
+        //     if (end < start) {
+        //         this.currentids = this.config.smids2;
+        //         //pbscodes=this.config.smids2;
+        //     } else {
+        //         //pbscodes = this.config.smids;
+        //         this.currentids = this.config.smids;
+        //     }
+        //     //ly.mixColorType=2;
+        //     //ly.setObjsColor(this.currentids, Cesium.Color.AQUA);
+        //         ly.setSelection(this.currentids);
+        //         ly.selectEnabled=false;
+        // }
+        // 
     }
     /**
      * 该方法用于生成查询smid条件
      * @param pbscodes
      */
-    pbsInfo(pbscodes:{point:[string],line:[string]}){
+    pbsInfo(pbscodes:{node:string[],pipe:string[]}){
         const fieldname="CODE";
+        if(pbscodes.node.length==0&&pbscodes.pipe.length==0){
+            this.toast.show("无进度信息");
+            return;
+        }
         const url=this.AppX.appConfig.gisResource.tiplayers.config["bjsmidfw"].url;
         const linelayer=(this.config.pipe as any[]).filter(item=>{
             return item.geometryType==="line";
@@ -88,25 +123,42 @@ class PipeSpeedInfoCheck extends BaseWidget {
         const pointlayer=(this.config.pipe as any[]).filter(item=>{
             return item.geometryType==="point";
         })
+        let nodeStr="";
+        pbscodes.node.forEach((item,index)=>{
+            if(index==0){
+                nodeStr+="'"+item+"'";
+            }else{
+                nodeStr+=",'"+item+"'";
+            }
+        })
+        let pipeStr="";
+        pbscodes.pipe.forEach((item,index)=>{
+            if(index==0){
+                pipeStr+="'"+item+"'";
+            }else{
+                pipeStr+=",'"+item+"'";
+            }
+            
+        })
         const pointPar=pointlayer.map(item=>{
             return new SuperMap.REST.FilterParameter({
                 name: item.mapname,
-                attributeFilter: fieldname+" in ("+pbscodes.point.join(',')+")",
+                attributeFilter: fieldname+" in ("+nodeStr+")",
                 fields: [fieldname]
             });
         })
         const linePar=linelayer.map(item=>{
             return new SuperMap.REST.FilterParameter({
                 name: item.mapname,
-                attributeFilter: fieldname+" in ("+pbscodes.line.join(',')+")",
+                attributeFilter: fieldname+" in ("+pipeStr+")",
                 fields: [fieldname]
             });
         })
-        const filterPars=pointlayer.concat(linePar);
+        const filterPars=pointPar.concat(linePar);
         const options={
             url:url,
             filterParameters:filterPars,
-            queryOption:SuperMap.REST.QueryOption.ATTRIBUTE,
+            queryOption:SuperMap.REST.QueryOption.ATTRIBUTEANDGEOMETRY,
             completed:this.queryComplete.bind(this),
             failed:function(error){
                 console.error(error);
@@ -140,23 +192,37 @@ class PipeSpeedInfoCheck extends BaseWidget {
     }
     /**
      * 查询成功
-     * @param resulte 
+     * @param result 
      */
-    queryComplete(resulte){
-        console.log(resulte);
+    queryComplete(result){
+        console.log(result);
+        const that=this;
+        if(result.currentCount===0){
+            return;
+        }
+        result.originResult.recordsets.forEach(record=>{
+            if(record.features.length==0) return false;
+            const pipe=_.find(that.config.pipe,function(item:any){
+                return item.mapname===record.datasetName;
+            })
+            const ids=record.features.map(item=>{return item.ID;});
+            const s3mNames=pipe.geometryType==="line"?[pipe.name]:pipe.WELL;
+            s3mNames.forEach(item=>{
+                const ly=that.viewer.scene.layers.find(item);
+                ly.selectedColor=Cesium.Color.RED;
+                ly.selectEnabled=true;
+                ly.multiChoose=true;
+                ly.selectColorType=pipe.geometryType==="line"?Cesium.SelectColorType.REPLACE:Cesium.SelectColorType.MIX;
+                ly.setSelection(ids);
+                ly.selectEnabled=false;
+            })
+        })
     }
     /**
      * 清除进度信息
      */
     clearSpeedInfos() {
-        if (this.currentids.length > 0) {
-            let name = this.config.name;
-            let ly = this.viewer.scene.layers.find(name);
-            if (ly) {
-                ly.removeObjsColor(this.currentids);
-            }
-            this.currentids = [];
-        }
+        this.viewer.scene.layers.releaseSelection();
     }
 }
 export =PipeSpeedInfoCheck;

+ 2 - 2
src/widgets/PipeSpeedInfoCheck/config.json

@@ -1,6 +1,6 @@
 {
-    "smids":[8,9,10],
-    "smids2":[1,2,3],
+    "smids":[1,2,3],
+    "smids2":[8,9,10],
     "pbscodes":{
         "point":[
             "WJH1-D-YYS-GDGC-JCJ-001",

+ 1 - 0
typings/globals/cesium/index.d.ts

@@ -5555,6 +5555,7 @@ declare namespace Cesium {
        */
         getSelectedLayer(): S3MTilesLayer;
         remove(layer:string, destroy:boolean):Boolean
+        releaseSelection();
     }
     class DrawHandler {
         activeEvt: Event;

+ 1 - 2
typings/index.d.ts

@@ -6,5 +6,4 @@
 /// <reference path="globals/three/Three.d.ts" />
 /// <reference path="locals/appx/index.d.ts" />
 /// <reference path="locals/jquery-ui/index.d.ts" />
-/// <reference path="locals/jquery-addon/index.d.ts" />
-
+/// <reference path="locals/jquery-addon/index.d.ts" />

+ 2 - 2
typings/locals/SuperMap/index.d.ts

@@ -1,5 +1,5 @@
-export = SuperMap;
-export as namespace SuperMap;
+//export = SuperMap;
+//export as namespace SuperMap;
 declare namespace SuperMap {
     namespace REST {
         class GetFeaturesServiceBase extends ServiceBase {

+ 2 - 2
typings/locals/appx/index.d.ts

@@ -4,8 +4,8 @@ declare var Cookies
 declare var Secret_Key;
 declare var hex_sha1;
 declare var L;
-declare var Cesium;
-declare var SuperMap;
+//declare var Cesium;
+//declare var SuperMap;
 /**
  * 应用配置对象
  */