index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <!--
  2. revit空间管理
  3. -->
  4. <template>
  5. <div id="graphy">
  6. <!-- <div class="graphy-left">
  7. <graphy-tree v-if="show" :param="param" @change="getPoint"></graphy-tree>
  8. </div> -->
  9. <div class='search-title'>
  10. <span class="p12">建筑楼层</span>
  11. <el-cascader placeholder='请选择' :options="options" @change="changeFloor" filterable :props="props" ref="buildfloor"></el-cascader>
  12. </div>
  13. <div class="graphy-view">
  14. <div class="graphy-main">
  15. <graphy-canvas v-if="show" @getDetails="getDetails" @resetPoint="resetPoint" ref="canvas"></graphy-canvas>
  16. </div>
  17. <div class="graphy-right">
  18. <graphy-tabs v-show="show" ref="tabs" :pointParam="pointParam" @setFalg="setFalg" @getLocation="getLocation" @getPointList="sendPointList">
  19. </graphy-tabs>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. //接口
  26. import graphyTree from "./graphyTree";
  27. import graphyTabs from "./graphyTabs";
  28. import graphyCanvas from "./graphyCanvas";
  29. import {
  30. mapGetters,
  31. mapActions
  32. } from 'vuex';
  33. import {
  34. getPT,
  35. buildingQuery,
  36. getFloor
  37. } from "@/api/scan/request"; //获取点位坐标
  38. import tools from "@/utils/scan/tools"
  39. import Handsontable from "handsontable-pro"
  40. import 'handsontable-pro/dist/handsontable.full.css'
  41. import zhCN from 'handsontable-pro/languages/zh-CN';
  42. export default {
  43. components: {
  44. graphyTree,
  45. graphyTabs,
  46. graphyCanvas
  47. },
  48. data() {
  49. return {
  50. props: {
  51. value: 'BuildID',
  52. label: 'BuildLocalName',
  53. children: 'Floor'
  54. },
  55. param: {
  56. ProjId: this.projectId, //项目id
  57. UserId: this.userId //用户id
  58. },
  59. pointParam: {
  60. ProjId: this.projectId, //项目id
  61. UserId: this.userId, //用户id
  62. fllorName: "",
  63. buildingData:[],//建筑楼层信息
  64. },
  65. options: [],
  66. map: null,
  67. pointId: null,
  68. show: false,
  69. buildVlaue: []
  70. };
  71. },
  72. mounted() {
  73. this.changeValue()
  74. this.getList()
  75. },
  76. computed: {
  77. ...mapGetters('layout', ['projectId', 'secret', 'userId'])
  78. },
  79. methods: {
  80. //修改楼层
  81. changeFloor(val) {
  82. let floorMap = "",
  83. name = ""
  84. this.options.map(item => {
  85. if (!!item.Floor && item.Floor.length) {
  86. if (item.BuildID == val[0]) {
  87. item.Floor.map(child => {
  88. if (child.BuildID == val[1]) {
  89. floorMap = child.StructureInfo ? child.StructureInfo.FloorMap : ''
  90. name = child.FloorLocalName
  91. }
  92. })
  93. }
  94. }
  95. })
  96. let obj = {
  97. code: val[1],
  98. map: floorMap,
  99. name: name,
  100. buildingData:val
  101. }
  102. this.getPoint(obj)
  103. },
  104. //获取建筑列表
  105. getList() {
  106. let param = {
  107. Cascade: [
  108. { Name: "floor", Orders: 'FloorSequenceID desc' }
  109. ],
  110. PageNumber: 1,
  111. PageSize: 50
  112. }
  113. buildingQuery(this.param, res => {
  114. res.Content.map(t => {
  115. if (t.Floor && t.Floor.length) {
  116. t.Floor = t.Floor.map(item => {
  117. if (item.FloorID == this.FloorID) return
  118. item.BuildID = item.FloorID
  119. item.BuildLocalName = item.FloorLocalName || item.FloorName
  120. return item
  121. }).filter(it => it)
  122. }
  123. })
  124. this.options = res.Content
  125. })
  126. },
  127. //获取建筑列表
  128. getList() {
  129. let param = {
  130. Cascade: [
  131. { Name: "floor", Orders: "FloorSequenceID desc", }
  132. ],
  133. PageNumber: 1,
  134. PageSize: 50
  135. }
  136. buildingQuery(param, res => {
  137. res.Content.map(t => {
  138. if (t.Floor && t.Floor.length) {
  139. t.Floor = t.Floor.map(item => {
  140. if (item.FloorID == this.FloorID) return
  141. item.BuildID = item.FloorID
  142. item.BuildLocalName = item.FloorLocalName || item.FloorName
  143. return item
  144. }).filter(it => it)
  145. }
  146. })
  147. this.options = res.Content
  148. })
  149. },
  150. changeValue() {
  151. this.$set(this.param, 'ProjId', this.projectId)
  152. this.$set(this.param, 'UserId', this.userId)
  153. this.$set(this.pointParam, 'ProjId', this.projectId)
  154. this.$set(this.pointParam, 'UserId', this.userId)
  155. this.show = true
  156. },
  157. //渲染
  158. getPoint(data) {
  159. this.pointParam.FloorId = data.code;
  160. this.pointParam.fllorName = data.name;
  161. this.pointParam.buildingData = data.buildingData
  162. this.$refs.tabs.reset(this.pointParam, data.map);
  163. console.log('无情',data.map,this.map)
  164. if (this.map != data.map) {
  165. this.map = data.map;
  166. this.$refs.canvas.getData(data);
  167. } else {
  168. return;
  169. }
  170. },
  171. //获取到点位标签坐标
  172. sendPointList(list) {
  173. if (list && list.length) {
  174. this.pointId = list[0].Id;
  175. this.$refs.canvas.doPoint(list);
  176. } else {
  177. this.$refs.canvas.doPoint([]);
  178. }
  179. },
  180. //插旗setFalg
  181. setFalg(item) {
  182. this.$refs.canvas.addPoint(item);
  183. },
  184. //定位getLocation
  185. getLocation(item) {
  186. this.$refs.canvas.locationGraphy({
  187. X: item.X,
  188. Y: item.Y * -1
  189. });
  190. },
  191. //重新获取点位信息resetPoint
  192. resetPoint() {
  193. this.$refs.tabs.reset(this.pointParam, true);
  194. },
  195. //查看详情
  196. getDetails(item) {
  197. this.$refs.tabs.getDetails(item);
  198. }
  199. },
  200. watch: {
  201. projectId() {
  202. this.map = null
  203. this.show = false
  204. this.options = []
  205. this.buildVlaue = []
  206. this.changeValue()
  207. this.getList()
  208. }
  209. }
  210. };
  211. </script>
  212. <style lang="less" scoped>
  213. #graphy {
  214. // position: relative;
  215. display: flex;
  216. flex-direction: column;
  217. .graphy-view {
  218. display: flex;
  219. background-color: #fff;
  220. flex: 1;
  221. .graphy-main {
  222. flex: 1;
  223. // position: absolute;
  224. // left: 200px;
  225. // top: 0;
  226. // right: 400px;
  227. // bottom: 0;
  228. // overflow: auto;
  229. }
  230. .graphy-right {
  231. // position: absolute;
  232. // right: 0;
  233. width: 400px; // top: 0;
  234. // bottom: 0;
  235. // border-left: 1px solid #ccc;
  236. // overflow: hidden;
  237. }
  238. }
  239. .graphy-left {
  240. // width: 200px;
  241. // height: 100%;
  242. // position: absolute;
  243. // overflow-y: auto;
  244. // left: 0;
  245. // top: 0;
  246. // bottom: 0;
  247. // border-right: 1px solid #ccc;
  248. }
  249. }
  250. </style>