|
@@ -19,125 +19,128 @@
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import drawFloor from "./drawFloor";
|
|
|
-import { mapGetters, mapActions } from "vuex";
|
|
|
-import request from "@/api/model/file.js";
|
|
|
-import { bindFloorModel } from "@/api/model/file";
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- drawFloor
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapGetters("layout", ["projectId"])
|
|
|
- },
|
|
|
- props: {
|
|
|
- alreadyRelatedModel: {
|
|
|
- default: []
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- casVal: [],
|
|
|
- jsonKey: "", //map.josn
|
|
|
- checkGraphyVisible: false,
|
|
|
- options: [],
|
|
|
- floor: {}, // 当前选中的楼层数据
|
|
|
- modelIdToFloorId: {}
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 弹窗显示
|
|
|
- showDialog(floor) {
|
|
|
- this.floor = floor;
|
|
|
- this.checkGraphyVisible = true;
|
|
|
+ import drawFloor from "./drawFloor";
|
|
|
+ import {mapGetters} from "vuex";
|
|
|
+ import request from "@/api/model/file.js";
|
|
|
+ import {bindFloorModel} from "@/api/model/file";
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ drawFloor
|
|
|
},
|
|
|
- // 关闭弹窗
|
|
|
- handleClose() {
|
|
|
- this.checkGraphyVisible = false;
|
|
|
- this.casVal = []
|
|
|
- this.$refs.drawFloorDialog.clearGraphy()
|
|
|
+ computed: {
|
|
|
+ ...mapGetters("layout", ["projectId"])
|
|
|
},
|
|
|
- // 更新楼层 平面图文件
|
|
|
- bindGraphy() {
|
|
|
- if (!this.jsonKey) {
|
|
|
- this.$message.warning("请选择模型文件");
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.alreadyRelatedModel.indexOf(this.modelIdToFloorId[this.jsonKey]) > -1) {
|
|
|
- this.$message.warning('此模型已关联该建筑下的楼层');
|
|
|
- return;
|
|
|
+ props: {
|
|
|
+ alreadyRelatedModel: {
|
|
|
+ default: []
|
|
|
}
|
|
|
- let pa = {
|
|
|
- FloorId: this.floor.FloorID,
|
|
|
- Id: this.modelIdToFloorId[this.jsonKey],
|
|
|
- BuildingId: this.floor.BuildID,
|
|
|
- Cover: true
|
|
|
- };
|
|
|
- bindFloorModel(pa, res => {
|
|
|
- this.$message.success("更新成功");
|
|
|
- this.handleClose()
|
|
|
- this.$emit('refresh', this.jsonKey)
|
|
|
- });
|
|
|
- },
|
|
|
- // 点击多级联动
|
|
|
- handleChange(val) {
|
|
|
- this.$refs.drawFloorDialog.initGraphy(val[1], 1)
|
|
|
- this.jsonKey = val[1]
|
|
|
},
|
|
|
- // 通过id查询文件夹下模型文件
|
|
|
- handleItemChange(val) {
|
|
|
- let data = {
|
|
|
- FolderId: val[0],
|
|
|
- Status: '4',
|
|
|
- ProjectId: this.projectId
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ casVal: [],
|
|
|
+ jsonKey: "", //map.josn
|
|
|
+ checkGraphyVisible: false,
|
|
|
+ options: [],
|
|
|
+ floor: {}, // 当前选中的楼层数据
|
|
|
+ modelIdToFloorId: {}
|
|
|
};
|
|
|
- request.queryFloorList(data, res => {
|
|
|
- let tempArr = res.Content.map(t => {
|
|
|
- this.modelIdToFloorId[t.CurrentModelId] = t.Id;
|
|
|
- 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)
|
|
|
- }
|
|
|
+ methods: {
|
|
|
+ // 弹窗显示
|
|
|
+ showDialog(floor) {
|
|
|
+ this.floor = floor;
|
|
|
+ this.checkGraphyVisible = true;
|
|
|
+ },
|
|
|
+ // 关闭弹窗
|
|
|
+ handleClose() {
|
|
|
+ this.checkGraphyVisible = false;
|
|
|
+ this.casVal = []
|
|
|
+ this.$refs.drawFloorDialog.clearGraphy()
|
|
|
+ },
|
|
|
+ // 更新楼层 平面图文件
|
|
|
+ bindGraphy() {
|
|
|
+ if (!this.jsonKey) {
|
|
|
+ this.$message.warning("请选择模型文件");
|
|
|
+ return
|
|
|
}
|
|
|
- }) },
|
|
|
- init() {
|
|
|
- this.getDirectory()
|
|
|
- },
|
|
|
- // 获取文件夹
|
|
|
- getDirectory() {
|
|
|
- request.queryModel("", res => {
|
|
|
- this.options = res.Content.map(t => {
|
|
|
- return {
|
|
|
- value: t.Id,
|
|
|
- label: t.Name,
|
|
|
- children: []
|
|
|
+ if (this.alreadyRelatedModel.indexOf(this.modelIdToFloorId[this.jsonKey]) > -1) {
|
|
|
+ this.$message.warning('此模型已关联该建筑下的楼层');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let pa = {
|
|
|
+ FloorId: this.floor.FloorID,
|
|
|
+ Id: this.modelIdToFloorId[this.jsonKey],
|
|
|
+ BuildingId: this.floor.BuildID,
|
|
|
+ Cover: true
|
|
|
+ };
|
|
|
+ bindFloorModel(pa, res => {
|
|
|
+ this.$message.success("更新成功");
|
|
|
+ this.handleClose()
|
|
|
+ this.$emit('refresh', this.jsonKey)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 点击多级联动
|
|
|
+ handleChange(val) {
|
|
|
+ this.$refs.drawFloorDialog.initGraphy(val[1], 1)
|
|
|
+ this.jsonKey = val[1]
|
|
|
+ },
|
|
|
+ // 通过id查询文件夹下模型文件
|
|
|
+ handleItemChange(val) {
|
|
|
+ let data = {
|
|
|
+ FolderId: val[0],
|
|
|
+ Status: '4',
|
|
|
+ ProjectId: this.projectId
|
|
|
+ };
|
|
|
+ request.queryFloorList(data, res => {
|
|
|
+ let tempArr = res.Content.map(t => {
|
|
|
+ this.modelIdToFloorId[t.CurrentModelId] = t.Id;
|
|
|
+ return {
|
|
|
+ value: t.CurrentModelId,
|
|
|
+ label: t.FloorName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(tempArr,'tempArr')
|
|
|
+ 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: []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.init()
|
|
|
- },
|
|
|
- watch: {
|
|
|
- projectId() {
|
|
|
+ created() {
|
|
|
this.init()
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ projectId() {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
#checkGraphy {
|
|
@@ -151,4 +154,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|