operationModel.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. <template>
  2. <div id="distribution" class="distribution-index">
  3. <div class="left-button" v-if="!isWalk">
  4. <div :class="'menu-item pangmenzhengdao' + (node.id == pathNode.id ? ' active' :'')"
  5. v-for="(node,index) in titleList" :key="node.id" @click="selectItem(node)">
  6. {{node.name}}
  7. </div>
  8. <!-- <div class="menu-item pangmenzhengdao" @click="getWalk">记录</div>
  9. <div class="menu-item pangmenzhengdao" @click="getCamera">视角</div> -->
  10. </div>
  11. <div class="walk-box" v-else>
  12. <div class="walk-box-item">
  13. <i :class="'iconfont '+ (stop ? 'huifont-bofang':'huifont-bofangzanting')" @click="startWalk"></i>
  14. </div>
  15. <div>
  16. <el-button type="primary" size="medium" @click="stopWalkFunc">退出</el-button>
  17. </div>
  18. </div>
  19. <div :id="'previewBim'+_uid" class="previewBim"></div>
  20. <div id="distribution-drap" class="distribution-drap" v-show="drapShow" @mousedown="dragStart"
  21. @touchstart="dragStart">
  22. <div class="distribution-drap-title">
  23. <div id="title" class="distribution-drap-title-content">{{detail.title}}</div>
  24. <i id="close" class="el-icon-circle-close" @click="drapShow = false"></i>
  25. </div>
  26. <div class="distribution-drap-content">
  27. <div class="user-list">
  28. <div class="user-item" v-for="(item,index) in detail.list">
  29. <div class="user-key">{{item.name}}</div>
  30. <div class="user-value" v-if="item.value === 'operation'">
  31. <el-switch v-model="value" active-color="#13ce66">
  32. </el-switch>
  33. </div>
  34. <div class="user-value" :title="item.value" v-else>{{item.value}}</div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="image-box" v-if="detail.imageUrl">
  39. <img :src="detail.imageUrl" alt="aa.png" />
  40. </div>
  41. <div style="padding: 5px;" v-else></div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import {
  47. getBimViewToken,
  48. } from '@/httpApi/bim'
  49. import bimView from '@/uitls/controls'
  50. // import bimData from '@/config/demo'//新华医院
  51. import bimData from '@/config/demo1'
  52. export default {
  53. data() {
  54. return {
  55. roomId: 1,
  56. bimViewer: null,
  57. positionData: [],
  58. titleList: [{
  59. id: 1,
  60. name: '企业'
  61. }, {
  62. id: 2,
  63. name: '监控'
  64. }, {
  65. id: 3,
  66. name: '设备'
  67. }, {
  68. id: 4,
  69. name: '灯光'
  70. }, {
  71. id: 5,
  72. name: '漫游'
  73. }],
  74. pathNode: {
  75. id: 1,
  76. name: '企业'
  77. },
  78. renderSuccess: false,
  79. isWalk: false,
  80. walk: [{
  81. "id": "45989e46-5279-4256-b956-4134968f229f",
  82. "position": {
  83. "x": 28807.993915330604,
  84. "y": 27399.352876051573,
  85. "z": 16738.5117384898
  86. },
  87. "target": {
  88. "x": -65426.025574263804,
  89. "y": 30224.66289488717,
  90. "z": 16738.522116432978
  91. },
  92. "coordinateSystem": "world",
  93. "stayTime": 0,
  94. "timeBetweenFrames": 4
  95. }, {
  96. "id": "932ba4e5-8e61-47a9-9e95-106eb68b6179",
  97. "position": {
  98. "x": 23429.310851444443,
  99. "y": 27560.61573240541,
  100. "z": 16738.51233084135
  101. },
  102. "target": {
  103. "x": -70804.70863814997,
  104. "y": 30385.92575124101,
  105. "z": 16738.522708784523
  106. },
  107. "coordinateSystem": "world",
  108. "stayTime": 0,
  109. "timeBetweenFrames": 2
  110. }, {
  111. "id": "d6a69146-0fa4-4b96-8823-5a6acb93df10",
  112. "position": {
  113. "x": 21270.373381191373,
  114. "y": 27944.435752543206,
  115. "z": 16738.513740691003
  116. },
  117. "target": {
  118. "x": 11449.311926122491,
  119. "y": -64824.15181454667,
  120. "z": 16738.152764310379
  121. },
  122. "coordinateSystem": "world",
  123. "stayTime": 1,
  124. "timeBetweenFrames": 6
  125. }, {
  126. "id": "6f76a823-5b9a-478b-88d1-8cc701f48d91",
  127. "position": {
  128. "x": 20792.50087657239,
  129. "y": 13841.412598430225,
  130. "z": 16738.461937394382
  131. },
  132. "target": {
  133. "x": 18038.03011945137,
  134. "y": -79397.87720835117,
  135. "z": 16738.0364486589156
  136. },
  137. "coordinateSystem": "world",
  138. "stayTime": 0,
  139. "timeBetweenFrames": 2
  140. }, {
  141. "id": "9afa7778-a500-4707-8576-a25cec8710b3",
  142. "position": {
  143. "x": 20653.4160327832,
  144. "y": 13408.877024051308,
  145. "z": 16738.460348602504
  146. },
  147. "target": {
  148. "x": 112398.1176970292,
  149. "y": 2548.198234651193,
  150. "z": 16738.5192830622163
  151. },
  152. "coordinateSystem": "world",
  153. "stayTime": 1,
  154. "timeBetweenFrames": 4
  155. }, {
  156. "id": "bd51d05f-287d-45b9-addc-9da32d0e79f8",
  157. "position": {
  158. "x": 30968.639340308415,
  159. "y": 13085.285430882526,
  160. "z": 16738.459159984213
  161. },
  162. "target": {
  163. "x": 122900.33170996535,
  164. "y": 19518.523647883958,
  165. "z": 16738.434953464723
  166. },
  167. "coordinateSystem": "world",
  168. "stayTime": 0,
  169. "timeBetweenFrames": 2
  170. }, {
  171. "id": "bf6e4d38-74e2-4f51-83d3-20a7f16cdf56",
  172. "position": {
  173. "x": 32211.266434023968,
  174. "y": 13275.842610296175,
  175. "z": 16738.459859939816
  176. },
  177. "target": {
  178. "x": 30902.284349220965,
  179. "y": 105501.28094759125,
  180. "z": 16738.3274521968156
  181. },
  182. "coordinateSystem": "world",
  183. "stayTime": 1,
  184. "timeBetweenFrames": 12
  185. }, {
  186. "id": "6b309ba7-6044-41fb-815e-e878692fc437",
  187. "position": {
  188. "x": 32401.761864596003,
  189. "y": 44931.81365916862,
  190. "z": 16738.57613881422
  191. },
  192. "target": {
  193. "x": 33065.36397610181,
  194. "y": 137450.0034069327,
  195. "z": 16738.5592527883905
  196. },
  197. "coordinateSystem": "world",
  198. "stayTime": 1,
  199. "timeBetweenFrames": 2
  200. }],
  201. wt: null,
  202. stop: true,
  203. drapShow: false,
  204. detail: {
  205. title: '',
  206. list: [],
  207. imageUrl: ''
  208. },
  209. value: true
  210. }
  211. },
  212. mounted() {
  213. let width = document.getElementById('distribution').clientWidth;
  214. document.getElementById('distribution-drap').style.left = (width - 330) + 'px';
  215. document.getElementById('distribution-drap').style.top = '30px';
  216. this.init();
  217. },
  218. beforeDestroy() {
  219. if (this.bimViewer) this.bimViewer.destroy();
  220. },
  221. methods: {
  222. dragStart(evt) {
  223. let oEvent = evt || event; //获取事件对象,这个是兼容写法
  224. if (oEvent.target.id !== 'title') return;
  225. let div = document.getElementById('distribution-drap');
  226. let disX = oEvent.clientX - parseInt(div.style.left || 0);
  227. let disY = oEvent.clientY - parseInt(div.style.top || 0);
  228. div.style.left = oEvent.clientX - disX + 'px';
  229. div.style.top = oEvent.clientY - disY + 'px';
  230. document.onmousemove = function(evt) { //实时改变目标元素obox的位置
  231. let oEvent = evt || event;
  232. div.style.left = oEvent.clientX - disX + 'px';
  233. div.style.top = oEvent.clientY - disY + 'px';
  234. }
  235. //停止拖动
  236. document.onmouseup = function() {
  237. document.onmousemove = null;
  238. document.onmouseup = null;
  239. }
  240. },
  241. showDrap(type) {
  242. this.detail = bimData[type];
  243. this.drapShow = true;
  244. },
  245. getWalk() {
  246. let walk = this.bimViewer.getWalkthroughData();
  247. this.walk.push(walk);
  248. },
  249. startWalk() {
  250. if (!this.bimViewer) return;
  251. if (!this.stop) return this.pauseWalk();
  252. if (this.wt) {
  253. this.stop = false;
  254. this.wt.play();
  255. return;
  256. }
  257. this.wt = this.bimViewer.walkthrough();
  258. this.wt.setKeyFrames(this.walk);
  259. this.wt.setKeyFrameCallback(this.keyFrameCallback);
  260. this.wt.stopCallback(() => {
  261. this.wt = null;
  262. this.stop = true;
  263. this.bimViewer.clearDrawable();
  264. });
  265. this.wt.play();
  266. this.stop = false;
  267. },
  268. pauseWalk() { //暂停漫游
  269. if (!this.wt) return;
  270. this.wt.pause();
  271. this.stop = true;
  272. },
  273. stopWalk() {
  274. if (!this.wt) return;
  275. this.wt.stop();
  276. },
  277. keyFrameCallback(idx) {
  278. this.bimViewer.clearDrawable();
  279. switch (idx) {
  280. case 0:
  281. this.setWalkTip([{
  282. "x": 24050.411537689757,
  283. "y": 29350.017590535575,
  284. "z": 17302.099026757893
  285. }, {
  286. "x": 23995.61377426047,
  287. "y": 25650.002239992325,
  288. "z": 17335.244453548836
  289. }],
  290. `<div class="tips-11">
  291. <div class="title">
  292. <img src="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/34e112ef844245d79d500d120d256fbf" alt="">
  293. <div class="name">电梯</div>
  294. </div>
  295. <div class="content">
  296. <div class="item">
  297. <div class="label">状态:</div>
  298. <div class="value">运行中</div>
  299. </div>
  300. <div class="item">
  301. <div class="label">维护:</div>
  302. <div class="value">今日已检修</div>
  303. </div>
  304. </div>
  305. </div>`,
  306. -220, -40, 3
  307. );
  308. break;
  309. case 2:
  310. this.setWalkTip([{
  311. "x": 22000.02194219269,
  312. "y": 18556.11888764512,
  313. "z": 16860.98452689552
  314. }],
  315. `<div class="tips-9">
  316. <div class="line" style="width:48px;"><img src="https://static.bimface.com/attach/24ce9654e88a4218908f46279e5c4b04_line.png" height="35" width="49"/></div>
  317. <div class="article">
  318. <div class="title">
  319. <i class="iconfont huifont-shuzhuangcaidanxiala"></i>
  320. 1202
  321. </div>
  322. <div class="content">
  323. <div class="item">
  324. <div class="label">温度</div>
  325. <div class="value">16°C</div>
  326. </div>
  327. <div class="item">
  328. <div class="label">湿度</div>
  329. <div class="value">30%</div>
  330. </div>
  331. <div class="item">
  332. <div class="label">CO2</div>
  333. <div class="value">15ppm</div>
  334. </div>
  335. <div class="item">
  336. <div class="label">Tvoc</div>
  337. <div class="value">1.5ppm</div>
  338. </div>
  339. <div class="item">
  340. <div class="label">PM2.5</div>
  341. <div class="value">2.3ug/m3</div>
  342. </div>
  343. </div>
  344. </div>`,
  345. 0, -40, 2
  346. );
  347. this.setWalkTip([{
  348. "x": 22000.02194219269,
  349. "y": 21593.121086217907,
  350. "z": 16482.919997783156
  351. }],
  352. `<div class="tips-5" style="width:180px;">
  353. <div class="title"><i class="iconfont huifont-shuzhuangcaidanxiala"></i>照明设备</div>
  354. <div class="content">
  355. <div class="tips-6">
  356. <div class="item">
  357. <div class="label">灯光名称</div>
  358. <div class="value">1号照明</div>
  359. </div>
  360. <div class="item">
  361. <div class="label">灯光位置</div>
  362. <div class="value">走廊</div>
  363. </div>
  364. <div class="item">
  365. <div class="label">灯光操作</div>
  366. <div class="value">
  367. <label class="hui-switch">
  368. <input type="checkbox" id="myCheckbox">
  369. <span class="slider round"></span>
  370. </label>
  371. </div>
  372. </div>
  373. </div>
  374. </div>
  375. </div>
  376. `,
  377. 0, -40, 1
  378. );
  379. break;
  380. case 4:
  381. this.setWalkTip([{
  382. "x": 24409.083286761037,
  383. "y": 14149.986899588841,
  384. "z": 16842.24504298319
  385. }, {
  386. "x": 28737.64383719606,
  387. "y": 14149.986899588841,
  388. "z": 16881.492220074306
  389. }],
  390. `<div class="tips-9">
  391. <div class="line" style="width:48px;"><img src="https://static.bimface.com/attach/24ce9654e88a4218908f46279e5c4b04_line.png" height="35" width="49"/></div>
  392. <div class="article">
  393. <div class="title">
  394. <i class="iconfont huifont-shuzhuangcaidanxiala"></i>
  395. 1202
  396. </div>
  397. <div class="content">
  398. <div class="item">
  399. <div class="label">温度</div>
  400. <div class="value">16°C</div>
  401. </div>
  402. <div class="item">
  403. <div class="label">湿度</div>
  404. <div class="value">30%</div>
  405. </div>
  406. <div class="item">
  407. <div class="label">CO2</div>
  408. <div class="value">15ppm</div>
  409. </div>
  410. <div class="item">
  411. <div class="label">Tvoc</div>
  412. <div class="value">1.5ppm</div>
  413. </div>
  414. <div class="item">
  415. <div class="label">PM2.5</div>
  416. <div class="value">2.3ug/m3</div>
  417. </div>
  418. </div>
  419. </div>`,
  420. 0, -40, 2
  421. );
  422. break;
  423. case 6:
  424. this.setWalkTip([{
  425. "x": 31000.028548922273,
  426. "y": 19920.593446388877,
  427. "z": 16869.840184958644
  428. }, {
  429. "x": 31000.024545155615,
  430. "y": 24661.86466740186,
  431. "z": 16875.88203316609
  432. }],
  433. `<div class="tips-9">
  434. <div class="line" style="width:48px;"><img src="https://static.bimface.com/attach/24ce9654e88a4218908f46279e5c4b04_line.png" height="35" width="49"/></div>
  435. <div class="article">
  436. <div class="title">
  437. <i class="iconfont huifont-shuzhuangcaidanxiala"></i>
  438. 1202
  439. </div>
  440. <div class="content">
  441. <div class="item">
  442. <div class="label">温度</div>
  443. <div class="value">16°C</div>
  444. </div>
  445. <div class="item">
  446. <div class="label">湿度</div>
  447. <div class="value">30%</div>
  448. </div>
  449. <div class="item">
  450. <div class="label">CO2</div>
  451. <div class="value">15ppm</div>
  452. </div>
  453. <div class="item">
  454. <div class="label">Tvoc</div>
  455. <div class="value">1.5ppm</div>
  456. </div>
  457. <div class="item">
  458. <div class="label">PM2.5</div>
  459. <div class="value">2.3ug/m3</div>
  460. </div>
  461. </div>
  462. </div>`,
  463. 0, -40, 2
  464. );
  465. break;
  466. default:
  467. break;
  468. }
  469. },
  470. init() {
  471. getBimViewToken(bimData.fileId).then(this.successFunc);
  472. },
  473. selectItem(item) {
  474. this.drapShow = false;
  475. this.clearAll();
  476. if (item.id === 5) return this.setWalk();
  477. this.bimViewer.setStatus(bimData.cameraState);
  478. if (this.pathNode.id == item.id) return this.pathNode = {};
  479. this.pathNode = item;
  480. if (item.id === 1) this.setFloor();
  481. if (item.id === 2) this.setMonitor();
  482. if (item.id === 3) this.setDevice();
  483. if (item.id === 4) this.setLight();
  484. },
  485. clearAll() {
  486. if (!this.bimViewer) return;
  487. this.clearFloor();
  488. this.bimViewer.clear3DMaker();
  489. },
  490. setFloor() { //设置房间
  491. for (var i = 0; i < bimData.roomList.length; i++) {
  492. if (bimData.roomList[i].name) {
  493. this.bimViewer.addDrawable({
  494. position: bimData.roomList[i].position,
  495. offsetX: -75,
  496. offsetY: -40,
  497. html: ` <div class="tips-4">${bimData.roomList[i].name}<i class="iconfont huifont-sanjiaojiantou-xia"></i></div>`,
  498. id: 'room' + bimData.roomList[i].roomId
  499. }, data => {
  500. this.showDrap('roomDetail');
  501. })
  502. }
  503. }
  504. },
  505. clearFloor() { //清除房间
  506. let ids = bimData.roomList.filter(node => node.name).map(node => 'room' + node.roomId);
  507. this.bimViewer.clearDrawable(ids);
  508. },
  509. setMonitor() { //设置摄像头
  510. for (var i = 0; i < bimData.monitorList.length; i++) {
  511. this.bimViewer.add3DMaker('image', bimData.monitorList[i],
  512. './assets/shexiangtou.png', (data) => {
  513. this.showDrap('monitorDetail');
  514. }, 'monitor' + i);
  515. }
  516. },
  517. setDevice() {
  518. for (var i = 0; i < bimData.deviceList.length; i++) {
  519. this.bimViewer.add3DMaker('image', bimData.deviceList[i],
  520. 'http://static.bimface.com/resources/3DMarker/warner/warner_red.png', (data) => {
  521. this.showDrap('deviceDetail');
  522. }, 'device' + i);
  523. }
  524. },
  525. setLight() {
  526. for (var i = 0; i < bimData.deviceList.length; i++) {
  527. this.bimViewer.add3DMaker('image', bimData.deviceList[i],
  528. './assets/zhaoming.png', (data) => {
  529. this.showDrap('lightDetail');
  530. }, 'light' + i);
  531. }
  532. },
  533. setWalk() {
  534. this.isWalk = true;
  535. if (!this.bimViewer) return;
  536. this.bimViewer.setCamera({
  537. isPan: false,
  538. isRotate: false,
  539. isZoom: false
  540. })
  541. this.bimViewer.clearAllRooms();
  542. this.bimViewer.clearDrawable();
  543. this.bimViewer.setStatus({
  544. "name": "persp",
  545. "position": {
  546. "x": 28807.993915330604,
  547. "y": 27399.352876051566,
  548. "z": 16738.511738489797
  549. },
  550. "target": {
  551. "x": -65426.025574263804,
  552. "y": 30224.662894887166,
  553. "z": 16738.522116432974
  554. },
  555. "up": {
  556. "x": 0,
  557. "y": -0.0000036732051114073575,
  558. "z": 0.9999999999932537
  559. },
  560. "near": 9.86184145967756,
  561. "far": 26059.687483045527,
  562. "zoom": 3.075280565913524,
  563. "version": 1,
  564. "fov": 45,
  565. "aspect": 1.6274768824306474,
  566. "coordinateSystem": "world"
  567. });
  568. },
  569. stopWalkFunc() {
  570. this.bimViewer.setCamera({
  571. isPan: true,
  572. isRotate: true,
  573. isZoom: true
  574. })
  575. this.bimViewer.clearDrawable();
  576. this.isWalk = false;
  577. this.stopWalk();
  578. this.bimViewer.setStatus(bimData.cameraState);
  579. this.initFloor();
  580. if (this.pathNode.id === 1) this.setFloor();
  581. if (this.pathNode.id === 2) this.setMonitor();
  582. if (this.pathNode.id === 3) this.setDevice();
  583. if (this.pathNode.id === 4) this.setLight();
  584. },
  585. setWalkTip(data, html, x, y, type) {
  586. for (let i = 0; i < data.length; i++) {
  587. this.bimViewer.addDrawable({
  588. position: data[i],
  589. offsetX: x,
  590. offsetY: y,
  591. html: html,
  592. id: 'walktip' + type + i
  593. }, data => {
  594. if (type === 1) {
  595. this.showDrap('lightDetail');
  596. } else if (type === 2) {
  597. this.showDrap('roomDetail');
  598. } else if (type === 3) {
  599. this.showDrap('deviceDetail');
  600. }
  601. })
  602. }
  603. },
  604. returnRGBA(color) {
  605. let [r, g, b, a] = color.match(/\d+(\.\d+)?/g).map(Number);
  606. return {
  607. r,
  608. g,
  609. b,
  610. a
  611. }
  612. },
  613. getCamera() {
  614. if (!this.bimViewer) return;
  615. console.log(this.bimViewer.getCameraState());
  616. },
  617. setRoom(data) {
  618. let point = data.worldPosition;
  619. if (!point) return this.$message.warning('请点击模型范围内的点');
  620. this.positionData.push(point);
  621. this.bimViewer.add3DMaker('image', point);
  622. if (this.positionData.length == 3) {
  623. this.bimViewer.insertRooms({
  624. id: this.roomId,
  625. boundary: {
  626. "outer": this.positionData
  627. },
  628. height: 500,
  629. roomColor: this.returnRGBA('rgba(19, 206, 102, 0.6)')
  630. })
  631. this.bimViewer.clear3DMaker();
  632. this.positionData = [];
  633. this.bimViewer.editRoom({
  634. roomId: this.roomId
  635. })
  636. this.roomId++;
  637. }
  638. },
  639. successFunc(res) {
  640. if (res.state) {
  641. this.bimViewer = new bimView({
  642. dom: document.getElementById('previewBim' + this._uid),
  643. viewToken: res.data,
  644. roamAngle: bimData.roamAngle,
  645. initHomeViewer: bimData.cameraState,
  646. renderSuccess: () => {
  647. this.renderSuccess = true;
  648. this.bimViewer.setStatus(bimData.cameraState);
  649. // this.bimViewer.setToolbars(true);
  650. if (bimData.fileId == '10000892771892') this.modelRenderSuccess();
  651. },
  652. roomSaved: data => {
  653. console.log(data);
  654. },
  655. click: data => {
  656. console.log(data);
  657. // this.setRoom(data);
  658. }
  659. })
  660. }
  661. },
  662. modelRenderSuccess() {
  663. this.bimViewer.HideOthers();
  664. this.bimViewer.hideComponentsByObjectData([{
  665. "family": "TJ双扇平开门",
  666. "levelName": "A_4F(14.500)"
  667. }, {
  668. "family": "单扇推拉门",
  669. "levelName": "A_4F(14.500)"
  670. }, {
  671. "family": "TJ单扇平开门",
  672. "levelName": "A_4F(14.500)"
  673. }, {
  674. "family": "TJ子母门",
  675. "levelName": "A_4F(14.500)"
  676. }])
  677. this.bimViewer.overrideComponentsColorByObjectData([{
  678. "family": "楼板",
  679. "levelName": "A_4F(14.500)"
  680. }, {
  681. "family": "幕墙",
  682. "levelName": "A_4F(14.500)"
  683. }, {
  684. "family": "基本墙",
  685. "levelName": "A_4F(14.500)"
  686. }, {
  687. "family": "常规模型 39",
  688. "levelName": "A_4F(14.500)"
  689. }])
  690. this.initFloor();
  691. this.setFloor();
  692. },
  693. initFloor() {
  694. for (var i = 0; i < bimData.roomList.length; i++) {
  695. this.bimViewer.insertRooms({
  696. id: bimData.roomList[i].roomId,
  697. boundary: {
  698. "outer": bimData.roomList[i].boundary
  699. },
  700. height: bimData.roomList[i].height,
  701. roomColor: this.returnRGBA(bimData.roomList[i].color)
  702. })
  703. if (bimData.roomList[i].floorName) {
  704. this.bimViewer.addDrawable({
  705. position: bimData.roomList[i].position,
  706. offsetX: -30,
  707. offsetY: 5,
  708. html: ` <div class="floor-name">${bimData.roomList[i].floorName}</div>`,
  709. id: 'floor' + bimData.roomList[i].roomId
  710. }, data => {
  711. let floor = data.id.split('floor');
  712. let item = bimData.roomList.find(node => node.roomId == floor[floor.length - 1]);
  713. console.log(item);
  714. if (item.floorName === '卫生间' || item.floorName === '公共区域' || item.floorName ===
  715. '楼梯间' || item.floorName === '电梯间' || item.floorName === '设备间') return;
  716. this.showDrap('roomDetail');
  717. })
  718. }
  719. }
  720. }
  721. }
  722. }
  723. </script>
  724. <style lang="scss">
  725. .distribution-index {
  726. width: 100%;
  727. height: 100%;
  728. display: flex;
  729. flex-direction: column;
  730. position: relative;
  731. overflow: hidden;
  732. background: $--box-background;
  733. .tips-4 {
  734. cursor: pointer;
  735. }
  736. .floor-name {
  737. cursor: pointer;
  738. width: 60px;
  739. text-align: center;
  740. color: #fff;
  741. }
  742. .left-button {
  743. position: absolute;
  744. z-index: 998;
  745. display: flex;
  746. justify-content: center;
  747. left: 0;
  748. bottom: 30px;
  749. width: 100%;
  750. }
  751. .menu-item {
  752. width: 100px;
  753. height: 32px;
  754. font-size: 16px;
  755. color: #AAB5C7;
  756. line-height: 30px;
  757. letter-spacing: 2px;
  758. text-align: center;
  759. background-image: url(../../../assets/image/common/tab.png);
  760. background-size: 100% 100%;
  761. margin: 0 15px;
  762. cursor: pointer;
  763. }
  764. .menu-item.active,
  765. .menu-item:hover {
  766. color: #fff;
  767. background-image: url(../../../assets/image/common/tab_active.png);
  768. }
  769. .previewBim {
  770. flex: 1;
  771. height: 0;
  772. }
  773. .distribution-drap {
  774. position: absolute;
  775. top: 30px;
  776. right: 30px;
  777. background: $--color-background;
  778. width: 300px;
  779. border-radius: 8px;
  780. z-index: 998;
  781. right: 30px;
  782. top: 30px;
  783. .distribution-drap-title {
  784. height: 40px;
  785. display: flex;
  786. align-items: center;
  787. .distribution-drap-title-content {
  788. flex: 1;
  789. width: 0;
  790. font-weight: 500;
  791. cursor: move;
  792. padding-left: 10px;
  793. }
  794. .el-icon-circle-close {
  795. font-size: 20px;
  796. cursor: pointer;
  797. padding-right: 10px;
  798. }
  799. }
  800. .user-list {
  801. padding: 0 10px 0px 10px;
  802. font-size: 13px;
  803. .user-item {
  804. display: flex;
  805. margin-bottom: 2px;
  806. .user-value {
  807. flex: 1;
  808. width: 0;
  809. margin-left: 2px;
  810. overflow: hidden;
  811. white-space: nowrap;
  812. text-overflow: ellipsis;
  813. }
  814. }
  815. .user-item>div {
  816. background: #232A37;
  817. line-height: 34px;
  818. padding: 0 16px;
  819. }
  820. .user-item:last-child {
  821. margin-bottom: 0;
  822. }
  823. }
  824. .image-box {
  825. width: 100%;
  826. height: 150px;
  827. padding: 10px;
  828. box-sizing: border-box;
  829. img {
  830. width: 100%;
  831. height: 100%;
  832. object-fit: cover;
  833. }
  834. }
  835. }
  836. .walk-box {
  837. position: absolute;
  838. bottom: 30px;
  839. left: 50%;
  840. margin-left: -80px;
  841. display: flex;
  842. align-items: center;
  843. z-index: 998;
  844. .walk-box-item {
  845. width: 80px;
  846. height: 80px;
  847. border-radius: 80px;
  848. background: #232A37;
  849. text-align: center;
  850. line-height: 80px;
  851. cursor: pointer;
  852. margin-right: 20px;
  853. &:hover {
  854. opacity: 0.7;
  855. }
  856. }
  857. .iconfont {
  858. font-size: 36px;
  859. }
  860. }
  861. .bf-house,
  862. .bf-tree-toolbar {
  863. display: none;
  864. }
  865. }
  866. </style>