noModelDialog.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <el-dialog
  3. :visible.sync="isShow.dialogVisible"
  4. :close-on-click-modal="false"
  5. :close-on-press-escape="false"
  6. :show-close="false"
  7. :width="width"
  8. >
  9. <span slot="title">{{title}}</span>
  10. <!-- <slot name="body"></slot> -->
  11. <el-tree :props="treeArr" :data="data" @node-click="floorClick" :highlight-current="true"></el-tree>
  12. <span slot="footer" class="dialog-footer my">
  13. <el-button @click="close">取 消</el-button>
  14. <el-button type="primary" @click="confirm">确 定</el-button>
  15. </span>
  16. </el-dialog>
  17. </template>
  18. <script>
  19. import {
  20. getBuildSelect, //根据项目ID获得建筑列表
  21. getSpaceFloor //根据建筑id获取楼层id
  22. } from "@/api/scan/request";
  23. import {mapGetters, mapActions} from "vuex";
  24. import tools from '@/utils/scan/tools'
  25. export default {
  26. props: {
  27. width: {
  28. type: String,
  29. default: "40%"
  30. },
  31. title: {
  32. type: String,
  33. default: "头部信息"
  34. },
  35. isShow: {
  36. type: Object
  37. },
  38. param: {
  39. type: Object
  40. }
  41. },
  42. data() {
  43. return {
  44. treeArr: {
  45. label: "name", //label的名字
  46. children: "children", //如果有下一级children和isLeaf存在
  47. },
  48. data: null,
  49. proj: null,
  50. mess: null
  51. };
  52. },
  53. created() {
  54. this.param.ProjId = this.projectId
  55. this.param.secret = this.secret
  56. this.param.UserId = this.userId
  57. // this.getNodes()
  58. },
  59. computed: {
  60. ...mapGetters("layout", [
  61. "projectId",
  62. "secret",
  63. "userId"
  64. ])
  65. },
  66. methods: {
  67. //确定
  68. confirm() {
  69. if (!!this.mess) {
  70. this.isShow.dialogVisible = false;
  71. this.$emit("close", this.mess);
  72. } else {
  73. this.$message("请选择楼层");
  74. }
  75. },
  76. //取消
  77. close() {
  78. if (!!this.mess) {
  79. this.isShow.dialogVisible = false;
  80. } else {
  81. this.$message("请选择楼层");
  82. }
  83. },
  84. changeArr(arr) {
  85. return arr.map(item => {
  86. if (item.floors && item.floors.length) {
  87. return {
  88. code: item.id,
  89. name: item.infos.BuildLocalName,
  90. children: item.floors.map(i => {
  91. return {
  92. code: i.id,
  93. name: (i.infos.FloorLocalName || i.infos.FloorName || "未知") + this.myMess(i),
  94. map: i.infos.FloorMap || null,
  95. affected: i.affected,
  96. isChilren: 2,
  97. buildCode: item.id,
  98. buildName: item.infos.BuildLocalName,
  99. shunxu: i.infos.FloorSequenceID || 0
  100. }
  101. })
  102. }
  103. } else {
  104. return {
  105. code: item.id,
  106. name: item.infos.BuildLocalName,
  107. children: null,
  108. isChilren: 1,
  109. }
  110. }
  111. })
  112. },
  113. myMess(i) {
  114. if (i.affected) {
  115. return "(该业务空间受元空间变化影响)"
  116. } else {
  117. if (i.infos.FloorMap) {
  118. return ''
  119. } else {
  120. return "(请初始化平面图)"
  121. }
  122. }
  123. },
  124. //点击节点懒加载
  125. // getNodes() { // 物理世界 已无接口
  126. // let param = {
  127. // ProjId: this.param.ProjId,
  128. // UserId: this.param.UserId,
  129. // secret: this.param.secret
  130. // };
  131. // getSpaceFloor(param).then(res => {
  132. // if (res.data.Result == 'success') {
  133. // let data = this.changeArr(res.data.Content).map(item => {
  134. // if (item.children && item.children.length) {
  135. // item.children = tools.sortArr(item.children, "shunxu", false)
  136. // }
  137. // return item
  138. // })
  139. // this.data = data
  140. // } else {
  141. // this.$message.error(res.data.ResultMsg)
  142. // }
  143. // }).catch(() => {
  144. // this.$message.error("请求出错")
  145. // })
  146. // },
  147. //子节点被点击
  148. floorClick(data) {
  149. if (data.isChilren == 2) {
  150. this.mess = data
  151. } else { }
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="less" scoped>
  157. </style>