Bladeren bron

Merge branch 'infoPoint' of git.sagacloud.cn:web/ibms into infoPoint

zhangyu 5 jaren geleden
bovenliggende
commit
be40e9586c

+ 1 - 1
src/components/ready/buildfloor/addConnectivity.vue

@@ -7,7 +7,7 @@
       </div>
     </el-row>
     <span slot="footer" class="dialog-footer">
-      <el-button size="small">取消</el-button>
+      <el-button size="small" @click="connectDialogVis=false">取消</el-button>
       <el-button size="small" type="primary" @click="save">确认</el-button>
     </span>
   </el-dialog>

+ 61 - 68
src/views/ready/buildfloor/drawGraphy/checkGraphy.vue

@@ -1,29 +1,16 @@
 <template>
-  <el-dialog
-    id="checkGraphy"
-    title="添加平面图"
-    :visible.sync="checkGraphyVisible"
-    width="40%"
-    :before-close="handleClose"
-  >
+  <el-dialog id="checkGraphy" title="添加平面图" :visible.sync="checkGraphyVisible" width="40%" @close="handleClose">
     <div class="bodys">
-      <el-cascader :props="props" :show-all-levels="false" @change="handleChange" placeholder="请选择模型文件"></el-cascader>
+      <el-cascader :options="options" :show-all-levels="false" :props="props" @change="handleChange" @active-item-change='handleItemChange' clearable
+        placeholder="请选择模型文件" v-model="casVal"></el-cascader>
       <div>
         <el-button type="text">上传图片</el-button>
       </div>
       <!-- 展示框 -->
       <div class="showBox">
-        <drawFloor
-          ref="drawFloor"
-          :findGraphyItemId="findGraphyItemId"
-          :dataKey="dataKey"
-          :point="point"
-          :pointWidth="pointWidth"
-          :cadWidth="720"
-          :cadHeight="300"
-          :isScale="true"
-        ></drawFloor>
+        <drawFloor ref="drawFloor" :findGraphyItemId="findGraphyItemId" :dataKey="dataKey" :point="point" :pointWidth="pointWidth" :cadWidth="720"
+          :cadHeight="300" :isScale="true"></drawFloor>
       </div>
     </div>
     <span slot="footer" class="dialog-footer">
@@ -47,66 +34,40 @@ export default {
   },
   data() {
     return {
-      value: "",
+      casVal:[],
       dataKey: "", //url
       jsonKey: "", //map.josn
       point: [40703.54760591985, 42678.14510522981], //坐标
       pointWidth: 2000,
       findGraphyItemId: "", //高亮的i
       checkGraphyVisible: false,
+      options: [],
       props: {
-        //联级框
-        lazy: true,
-        lazyLoad(node, resolve) {
-          const { level } = node;
-          if (level == 0) {
-            request.queryModel("", res => {
-              const nodes = Array.from(res.Content).map(item => ({
-                value: item.Id,
-                label: item.Name,
-                leaf: level >= 1
-              }));
-              // 通过调用resolve将子节点数据返回,通知组件数据加载完成
-              resolve(nodes);
-            });
-          } else {
-            // 查询楼层文件
-            let data = {
-              FolderId: node.value,
-              ProjectId: this.projectId
-            };
-            request.queryFloorList(data, res => {
-              const nodes = Array.from(res.Content).map(item => ({
-                value: item.Url,
-                label: item.FloorName,
-                leaf: level >= 1
-              }));
-              // 通过调用resolve将子节点数据返回,通知组件数据加载完成
-              resolve(nodes);
-            });
-          }
-        }
+        value: 'value',
+        label: 'label',
+        children: 'children'
       },
-      floor:'', // 当前选中的楼层数据
+      floor: '', // 当前选中的楼层数据
     };
   },
   methods: {
     // 弹窗显示
-    showDialog(floor){
+    showDialog(floor) {
       this.floor = floor;
       this.checkGraphyVisible = true;
     },
     // 关闭弹窗
     handleClose() {
       this.checkGraphyVisible = false;
+      this.casVal = []
     },
     // 更新楼层 平面图文件
     bindGraphy() {
-      if(!this.jsonKey){
+      if (!this.jsonKey) {
         this.$message.warning("请选择模型文件");
         return
       }
-      if(!this.floor.StructureInfo){
+      if (!this.floor.StructureInfo) {
         this.floor.StructureInfo = {}
       }
       this.floor.StructureInfo.FloorMap = this.jsonKey
@@ -119,15 +80,6 @@ export default {
         this.$emit('refresh')
       });
     },
-    initOption() {
-      // let data = {
-      //   FloorName: item.FloorLocalName,
-      //   ProjectId: this.projectId
-      // };
-    },
-    queryModel() {
-      return new Promose((resolve, reject) => {});
-    },
     // 点击多级联动
     handleChange(val) {
       console.log(val)
@@ -136,15 +88,56 @@ export default {
       this.jsonKey = val[1]
       // this.jsonKey = val[1];
       // this.dataKey = `/image-service/common/file_get/${this.jsonKey}?systemId=revit`;
-    }
+    },
+    // 通过id查询文件夹下模型文件
+    handleItemChange(val) {
+      let data = {
+        FolderId: val[0],
+        ProjectId: this.projectId
+      };
+      request.queryFloorList(data, res => {
+        let tempArr = res.Content.map(t => {
+          return {
+            value: t.CurrentModelId,
+            label: t.FloorName
+          }
+        })
+        this.pushChild(this.options, tempArr, val[0])
+      })
+    },
+    // 将模型文件list填到相应的文件夹下
+    pushChild(options, arr, Code) {
+      options.map(option => {
+        if (option.value == Code) {
+          option.children = arr;
+        } else {
+          if (option.children) {
+            this.pushChild(option.children, arr, Code)
+          }
+        }
+      })    },
+    init() {
+      this.getDirectory()
+    },
+    // 获取文件夹
+    getDirectory() {
+      request.queryModel("", res => {
+        this.options = res.Content.map(t => {
+          return {
+            value: t.Id,
+            label: t.Name,
+            children: []
+          }
+        })
+      });
+    },
   },
-  mounted() {
-    this.initOption();
+  created(){
+    this.init()
   },
   watch: {
     projectId() {
-      // todo
-      this.initOption();
+      this.init()
     }
   }
 };