Explorar o código

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

haojianlong %!s(int64=4) %!d(string=hai) anos
pai
achega
504ebaa120
Modificáronse 2 ficheiros con 124 adicións e 54 borrados
  1. 5 2
      src/components/edit/attr_select.vue
  2. 119 52
      src/components/edit/edit-dialog.vue

+ 5 - 2
src/components/edit/attr_select.vue

@@ -322,7 +322,8 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
-    <editDialog ref="dialog" :attrCards="attrCards" :getmajorId="getmajorId" :InfoLocal="InfoLocal" :sysNum="imageNum" :key="new Date().getTime()" />
+    <editDialog ref="dialog" :attrCards="attrCards" :GraphElementId="GraphElementId" :InfoLocal="InfoLocal" :sysNum="imageNum" :key="new Date().getTime()" />
+<!--    <editDialog ref="dialog" :attrCards="attrCards" :getmajorId="getmajorId" :InfoLocal="InfoLocal" :sysNum="imageNum" :key="new Date().getTime()" />-->
     <!--    <editDialog ref="dialog" :typeEdit="2" :getmajorId="'1001'" :sysNum="5" />-->
   </div>
 </template>
@@ -440,7 +441,8 @@ export default {
       spinning: false,
       isEdit: false,
       getmajorId: "",
-      InfoLocal:[]
+      InfoLocal:[],
+      GraphElementId:'',//图例Id
     };
   },
   methods: {
@@ -560,6 +562,7 @@ export default {
       console.log(FENGMAP)
       console.log('newval',newval)
       const Item = newval.itemList[0];
+      this.GraphElementId = Item.data.GraphElementId;
       this.imageNum = 1; //切换item初始化
       if (Item.data && Item.data.SubType) {
         this.SubType = Item.data.SubType;

+ 119 - 52
src/components/edit/edit-dialog.vue

@@ -12,7 +12,11 @@
             <div class="left">
                 <div class="header">
                     <div class="select">
-                        <a-select style="width: 236px;margin: 0 10px" :default-value="majorId">
+                        <a-select style="width: 316px;margin: 0 10px" :default-value="'#'" :value="majorId">
+                            <a-select-option value="#"
+                                             @click="handleChange('#')">
+                               推荐
+                            </a-select-option>
                             <a-select-opt-group>
                                 <span slot="label">位置区域</span>
                                 <a-select-option v-for="item in locationList" :value="item.id"
@@ -55,9 +59,10 @@
                 </div>
                 <div class="tree" >
                     <a-spin :spinning="spinning">
-                    <a-input-search placeholder="请输入关键字" v-if="majorId||sysId" style="width: 235px;margin: 10px 10px;"  v-model="selectVal"  @search="onSearchTree" />
+                    <a-input-search placeholder="请输入关键字" v-if="selectVal ||treeData.length" style="width: 315px;margin: 10px 10px;"  v-model="selectVal"  @search="onSearchTree" />
                    <div style="height: 385px;overflow-y: scroll;">
-                       <Tree @change="getTreeId" :data="treeData"/>
+                       <Tree v-if="treeData.length" @change="getTreeId" :data="treeData"/>
+                       <div v-else style="margin: 40px 70px;">暂无推荐数据</div>
                    </div>
                     </a-spin>
                 </div>
@@ -97,7 +102,8 @@
         getQuerySmsxtBy,
         queryWzfldl,
         queryWzflByDl,
-        queryGlsmsLocation
+        queryGlsmsLocation,
+        graphElementQuery
     } from "@/api/editer";
     import bus from "@/bus";
     import {getUrlMsg} from '@/components/urlMsg.js'
@@ -108,13 +114,14 @@
         props: {
             sysNum: Number,//设备总数
             attrCards: Array,
-            getmajorId: String,
-            InfoLocal: Array
+            // getmajorId: String,
+            InfoLocal: Array,
+            GraphElementId:String
         },
         computed: {
-            majorId() {
-                return this.getmajorId || ''
-            }
+            // majorId() {
+            //     return ''
+            // }
         },
         data() {
             return {
@@ -188,7 +195,8 @@
                 selectList: [],
                 typeEdit: '',
                 selectVal:'',
-                sysId:''
+                sysId:'',
+                majorId:'#'
             }
         },
         watch: {
@@ -199,9 +207,12 @@
             },
             selectVal(val){
                 if(val==''){
-                    if(this.sysId!=''){
+                    if(this.majorId=='#'){
+                        this.tuijian();
+                    } else if(this.sysId!=''){
                         this.getQuerySmsxtBy(this.sysId, this.typeEdit)
-                    }else{
+                    }
+                    else{
                         this.getQuerySmsxtBy(this.majorId,'Image')
                     }
 
@@ -259,21 +270,60 @@
             onSearch(value) {
                 this.queryGlsmsasset()
             },
-            ChangeCheckbox(val) {
-                console.log(val)
+            // ChangeCheckbox(val) {
+            //     console.log(val)
+            // },
+            //图例搜索--推荐
+            tuijian(){
+                this.treeData = [];
+                this.spinning = true
+                graphElementQuery({
+                    "Filters": "id="+this.GraphElementId,
+                    "Projection": [
+                        "infoLocal"
+                    ]
+                }).then(res=>{
+                    this.spinning = false;
+                    let data = res.Content[0].InfoLocal;
+                    (function recursion(newObj) {
+                        newObj.map(item => {
+                            item.label = item.name;
+                            item.checked = 'unchecked';
+                            if (item.children) {
+                                recursion(item.children);
+                            }
+                        })
+                    })(data)
+                    this.treeData = data;
+                    this.treeData.length && this.treeData.map(item=>{
+                        let index = item.name.indexOf('/');
+                        item.name = item.name.slice(index+1);
+                    })
+                }).catch(()=>{
+                    this.spinning = false;
+                })
             },
             handleChange(val) {
-                console.log(val);
                 this.selectVal='';
                 this.tableData = [];
-                this.typeEdit = val.type;
-                this.sysId = val.id;
-                this.getQuerySmsxtBy(val.id, val.type)
-            },
-            handleMajor(val) {
-                this.tableData = [];
-                this.getQuerySmsxtBy(val.id)
+                this.treeData = [];
+
+                if(val=='#'){
+                    this.majorId = '#';
+                    this.tuijian();
+                }else{
+                    this.majorId = val.id;
+                    this.typeEdit = val.type;
+                    this.sysId = val.id;
+                    this.getQuerySmsxtBy(val.id, val.type)
+                }
+
+
             },
+            // handleMajor(val) {
+            //     this.tableData = [];
+            //     this.getQuerySmsxtBy(val.id)
+            // },
             chageFloor(data) {
                 this.queryGlsmsasset();
             },
@@ -282,10 +332,19 @@
             },
             //获取treeId --classstructureid
             onSearchTree(val){
+                console.log(this.majorId);
                 let arr = [];
                 const reg = new RegExp(val, 'g');
                 let flag= false;
-              if(this.typeEdit=='Zone'){
+                if(this.majorId=='#'){
+                    this.treeData.map(item=>{
+                        if(item.name.indexOf(val)!=-1){
+                            item.name=item.name.replace(reg, `<span style="color:#F96600">${val}</span>`);
+                            arr.push(item)
+                        }
+                    })
+                }
+             else if(this.typeEdit=='Zone'){
                   this.treeData.map((item)=>{
                       if(item.name.indexOf(val)!=-1){
                           item.name=item.name.replace(reg, `<span style="color:#F96600">${val}</span>`);
@@ -294,7 +353,7 @@
                   });
 
               }
-                if(this.typeEdit=='Image'){
+               else if(this.typeEdit=='Image'){
                     console.log(this.treeData);
                     this.treeData.map(item=>{
                         if(item.name.indexOf(val)!=-1){
@@ -318,7 +377,17 @@
                 }
                 this.treeData = arr;
             },
+            //获取树的数据
             getTreeId(id) {
+                console.log(id);
+                if(id.type){
+                    if(id.type==2){
+                        this.typeEdit = 'Image'
+                    }
+                    if(id.type==1){
+                        this.typeEdit = 'Zone'
+                    }
+                }
                 if (this.typeEdit == 'Image') {
                     this.classstructureid = id.id;
                 } else if (this.typeEdit == 'Zone') {
@@ -522,25 +591,25 @@
                                 })(data)
 
                                 this.treeData = data;
-                                let that = this;
-                                if (this.treeData.length && this.InfoLocal.length) {
-                                    let arr = [];
-                                    let infoLocalId = this.InfoLocal[0].id;
-                                    this.treeData.map((item, index) => {
-                                        item.children.map((item1, index1) => {
-                                            if (infoLocalId==item1.id) {
-                                                item.open = true;
-                                                item1.checked = 'checked';
-                                              this.typeEdit = 'Image'
-                                              that.classstructureid = item1.id;
-                                              that.queryGlsmsasset();
-                                            }
-
-                                            return item1
-                                        })
-                                        return item
-                                    })
-                                }
+                                // let that = this;
+                                // if (this.treeData.length && this.InfoLocal.length) {
+                                //     let arr = [];
+                                //     let infoLocalId = this.InfoLocal[0].id;
+                                //     this.treeData.map((item, index) => {
+                                //         item.children.map((item1, index1) => {
+                                //             if (infoLocalId==item1.id) {
+                                //                 item.open = true;
+                                //                 item1.checked = 'checked';
+                                //               this.typeEdit = 'Image'
+                                //               that.classstructureid = item1.id;
+                                //               that.queryGlsmsasset();
+                                //             }
+                                //
+                                //             return item1
+                                //         })
+                                //         return item
+                                //     })
+                                // }
                             }
                         } else {
                             this.$message.error('获取失败');
@@ -583,10 +652,8 @@
         created() {
             this.floorId = getUrlMsg().FloorID;
             //如果有专业就带过来
-            console.log(this.getmajorId);
-            if (this.getmajorId) {
-                this.typeEdit = 'Image';
-                this.getQuerySmsxtBy(this.getmajorId, 'Image')
+            if (this.GraphElementId) {
+              this.tuijian();
             }
             if (this.attrCards.length) {
                 this.attrCards.map(item => {
@@ -617,14 +684,14 @@
             /*overflow: auto;*/
 
             .left {
-                width: 785px;
+                width: 865px;
                 border-right: 1px solid #EFF0F1;
 
                 .header {
-                    width: 785px;
+                    width: 865px;
 
                     .select {
-                        width: 260px;
+                        width: 340px;
                         border-right: 1px solid #EFF0F1;
                         display: inline-block;
                     }
@@ -650,7 +717,7 @@
 
 
                 .tree {
-                    width: 259px;
+                    width: 339px;
                     height: 441px;
                     border-right: 1px solid #EFF0F1;
                     display: inline-block;
@@ -663,7 +730,7 @@
                 .checkbox {
                     /*margin-top: 17px;*/
                     /*margin-left: 13px;*/
-                    width: 500px;
+                    width: 525px;
                     height: 441px;
                     display: inline-block;
                     display: flex;