index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <div class="box">
  3. <el-container>
  4. <el-header>
  5. <div class="boxName">
  6. 第二屏详情
  7. </div>
  8. <div class="spaceName">
  9. <b>空间名称:</b>{{spaceDetails.RoomLocalName?spaceDetails.RoomLocalName:"-"}}
  10. </div>
  11. </el-header>
  12. <el-container>
  13. <el-aside width="450px">
  14. <el-scrollbar>
  15. <div class="aside-top">
  16. <div class="aside-top-left">
  17. <p><b>空间功能区类型:</b>{{spaceDetails.RoomFuncType?spaceDetails.RoomFuncType:"-"}}</p>
  18. <p><b>备注文字:</b>{{spaceDetails.Intro?spaceDetails.Intro:"-"}}</p>
  19. </div>
  20. <div class="aside-top-right">
  21. <p><b>空间二维码:</b><span v-if="!spaceDetails.RoomQRCode">-</span></p>
  22. <img :src="'/image-service/common/file_get/'+ spaceDetails.RoomQRCode +'?systemId=dataPlatform'" alt="二维码图片"
  23. v-if="spaceDetails.RoomQRCode">
  24. </div>
  25. </div>
  26. <div v-show="spaceDetails.Outline && spaceDetails.Outline[0] && spaceDetails.Outline[0].length" id="graphy" ref="graphy"
  27. style="width:400px;height:400px;">
  28. <p><b>位置图片:</b></p>
  29. <canvas id="floorCanvas" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0"></canvas>
  30. </div>
  31. <div class="space-img" v-if="spaceDetails.Pic">
  32. <div class="img-box" v-for="(item) in spaceDetails.Pic" :key='item'>
  33. <img :src="'/image-service/common/file_get?systemId=revit&key=${item}'" alt="空间图片">
  34. </div>
  35. </div>
  36. <!-- <div class="space-img" v-if="!spaceDetails.Pic">
  37. <div class="img-box">
  38. <img src="https://hbimg.huabanimg.com/bac4414614279b3f7bef2d92d6d918bba7b556f82c501-NkQLir_fw658" alt="空间图片">
  39. </div>
  40. <div class="img-box">
  41. <img src="https://hbimg.huabanimg.com/249e4a816fbc02bc50afbb04a82488f8f096937c27b66-pEQMMO_fw658" alt="空间图片">
  42. </div>
  43. <div class="img-box">
  44. <img src="https://hbimg.huabanimg.com/bac4414614279b3f7bef2d92d6d918bba7b556f82c501-NkQLir_fw658" alt="空间图片">
  45. </div>
  46. <div class="img-box">
  47. <img src="https://hbimg.huabanimg.com/249e4a816fbc02bc50afbb04a82488f8f096937c27b66-pEQMMO_fw658" alt="空间图片">
  48. </div>
  49. </div> -->
  50. </el-scrollbar>
  51. </el-aside>
  52. <el-main>
  53. <el-tabs v-model="activeTab" type='card'>
  54. <template v-for="(item,index) in tabsList">
  55. <el-tab-pane :name="item.Code" :key="index" :label="item.Name">
  56. <div v-show="activeTab === 'staticData'" style="width:100%;textAlign:left;" id="iframe-box">
  57. <!-- <iframe height="100%" width="100%" :src="iframeSrc" id="screenIframe"></iframe> -->
  58. </div>
  59. <div v-show="activeTab === 'dynamicData'" style="width:100%;textAlign:left;">
  60. <div class="main" style="height: 790px;">
  61. <el-table ref="multipleTable" :data="tableData" stripe height="100%" :header-cell-style="headerStyle">
  62. <el-table-column prop="InfoPointName" label="信息点名称">
  63. <template slot-scope="scope">
  64. <div>
  65. <span>{{ scope.row.InfoPointName}}</span>
  66. <span class="unit">{{scope.row.Unit?`${"("+scope.row.Unit+")"}`:""}}</span>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="functionNo" label="表号功能号"></el-table-column>
  71. <el-table-column prop="functionNoDynamicData" label="动态数据"></el-table-column>
  72. <el-table-column prop="LastUpdate" label="数据采集时间"></el-table-column>
  73. <template slot="empty">
  74. <div style="height: 60%;transform: translateY(50%);">
  75. <i class="icon-wushuju iconfont"></i>
  76. 数据暂无
  77. </div>
  78. </template>
  79. </el-table>
  80. </div>
  81. </div>
  82. <div v-show="activeTab === 'objectRelationship'" class="objectRelationship">
  83. <div class="objectRelationship-left">
  84. <h5>空间内设备:</h5>
  85. <eqToSpaceTable :params="params" type="Equipment"></eqToSpaceTable>
  86. </div>
  87. <div class="objectRelationship-center">
  88. <h5>服务于空间的设备:</h5>
  89. <eqToSpaceTable :params="params" type="EquipmentFor"></eqToSpaceTable>
  90. </div>
  91. <div class="objectRelationship-right">
  92. <h5>空间内系统:</h5>
  93. <syInSpaceTable :params="params" type="generalSystem"></syInSpaceTable>
  94. </div>
  95. </div>
  96. </el-tab-pane>
  97. </template>
  98. </el-tabs>
  99. </el-main>
  100. </el-container>
  101. </el-container>
  102. </div>
  103. </template>
  104. <script>
  105. import { mapGetters } from "vuex";
  106. import { queryZone, getAllbusiness, getDataDictionary, floorQuery, buildingQuery, BeatchQueryParam } from '@/api/scan/request'
  107. import eqToSpaceTable from '@/components/business_space/newTables/eqToSpaceTable'
  108. import syInSpaceTable from '@/components/business_space/newTables/syInSpaceTable'
  109. import { DivideFloorScene, SpaceItem, ZoneItem, FloorView } from "@saga-web/cad-engine/lib";
  110. import tools from "@/utils/scan/tools";
  111. export default {
  112. data() {
  113. return {
  114. tabsList: [
  115. { Code: 'staticData', Name: '静态数据' },
  116. { Code: 'dynamicData', Name: '动态数据' },
  117. { Code: 'objectRelationship', Name: '对象关系' }
  118. ],
  119. activeTab: 'staticData',
  120. checked: true,
  121. spaceDetails: {},
  122. iframeSrc: '',
  123. proId: '',
  124. params: {},
  125. view: null,
  126. scene: null,
  127. canvasWidth: 410,
  128. canvasHeight: 400,
  129. page: {
  130. pageSize: 50,
  131. pageSizes: [10, 20, 50, 100],
  132. pageNumber: 1,
  133. total: 0
  134. },
  135. tableData: [],
  136. headerStyle: {// 列表样式
  137. backgroundColor: '#e1e4e5',
  138. color: '#2b2b2b',
  139. lineHeight: '30px'
  140. },
  141. secret: ''
  142. }
  143. },
  144. components: {
  145. eqToSpaceTable,
  146. syInSpaceTable
  147. },
  148. beforeRouteEnter(to, from, next) {
  149. if (to.query.RoomID && to.query.zone) {
  150. next();
  151. }
  152. },
  153. created() {
  154. if (this.$route.name === "spaceLedger" && this.$route.query.RoomID && this.$route.query.zone) {
  155. this.getData();
  156. this.params = this.$route.query;
  157. }
  158. this.getInFormationPoitnName();
  159. },
  160. updated() { },
  161. computed: {
  162. ...mapGetters('layout', ['userId', 'projectId'])
  163. },
  164. methods: {
  165. getData() {
  166. // 获取空间数据
  167. let params = {
  168. data: {
  169. Filters: `RoomID="${this.$route.query.RoomID}"`
  170. },
  171. zone: this.$route.query.zone
  172. }
  173. queryZone(params, res => {
  174. this.spaceDetails = res.Content[0];
  175. if (this.spaceDetails.Outline && this.spaceDetails.Outline[0] && this.spaceDetails.Outline[0].length) {
  176. this.getSpaceFloor();
  177. }
  178. this.setFrame();
  179. this.getInFormationPoitnName();
  180. })
  181. },
  182. setFrame() {
  183. // 设置静态数据tab的iframe地址
  184. this.proId = localStorage.getItem('projectId');
  185. this.secret = localStorage.getItem('secret');
  186. this.iframeSrc = `${process.env.BASE_URL}:8889/#/details?perjectId=${this.proId}&secret=${this.secret}&FmId=${this.$route.query.RoomID}&type=0&code=${this.$route.query.zone}`
  187. let box = document.getElementById('iframe-box');
  188. box.innerHTML = '';
  189. let iframe = document.createElement('iframe');
  190. iframe.src = this.iframeSrc;
  191. iframe.style.width = '100%';
  192. iframe.style.height = '100%';
  193. box.appendChild(iframe);
  194. },
  195. getSpaceFloor() {
  196. // 获取业务空间楼层
  197. let params = {
  198. Filters: `FloorID='${this.spaceDetails.FloorId}'`
  199. }
  200. floorQuery(params, res => {
  201. if (res.Content[0] && res.Content[0].StructureInfo && res.Content[0].StructureInfo.FloorMap) {
  202. this.FloorMap = res.Content[0].StructureInfo.FloorMap;
  203. this.getGraphy();
  204. }
  205. })
  206. },
  207. getGraphy() {// 绘制空间位置图片
  208. let that = this;
  209. that.clearGraphy()
  210. that.scene = new DivideFloorScene();
  211. that.canvasLoading = true;
  212. that.scene.loadUrl(`/image-service/common/file_get?systemId=revit&key=${this.FloorMap}`).then(res => {
  213. that.canvasLoading = false;
  214. if (res == 'error') {
  215. this.FloorMap = '';
  216. this.$message.warning('数据解析异常');
  217. return;
  218. }
  219. that.view.scene = that.scene;
  220. that.view.fitSceneToView();
  221. let tempArr = {
  222. RoomLocalName: this.spaceDetails.RoomLocalName,
  223. OutLine: this.spaceDetails.Outline,
  224. RoomID: this.spaceDetails.RoomID,
  225. Color: "#a384fc",
  226. }
  227. that.scene.addZoneList([tempArr]);
  228. this.scene.isSpaceSelectable = false;
  229. })
  230. },
  231. clearGraphy() {
  232. if (this.view && this.view.scene) {
  233. this.view.scene = null;
  234. return
  235. }
  236. this.view = new FloorView('floorCanvas')
  237. },
  238. getInFormationPoitnName() {// 获取动态数据
  239. let secret = localStorage.getItem('secret');
  240. let params = {
  241. data: {
  242. Filters: 'InputMode in ["L1","L2","L","M"]',
  243. Orders: "sort asc",
  244. PageNumber: 1,
  245. PageSize: 500
  246. },
  247. type: this.$route.query.zone
  248. }
  249. let param = {
  250. secret: secret,
  251. ProjId: this.projectId,
  252. data: {
  253. criterias: []
  254. }
  255. }
  256. getDataDictionary(params, res => {// 获取表号功能号
  257. this.tableData = res.Content;
  258. this.tableData.map(item => {
  259. let cur = tools.dataForKey(this.spaceDetails, item.Path);
  260. item.functionNo = cur;
  261. param.data.criterias.push({
  262. id: this.spaceDetails.RoomID,
  263. code: item.InfoPointCode
  264. });
  265. })
  266. BeatchQueryParam(param, res => {// 获取动态数据
  267. res.Content.map((item, index) => {
  268. tools.setDataForKey(
  269. this.spaceDetails,
  270. this.tableData[index].Path,
  271. this.tableData[index].functionNoDynamicData = item.error ? item.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
  272. );
  273. })
  274. });
  275. })
  276. }
  277. },
  278. watch: {
  279. // 监听路由地址,并判断有RoomID和zone,重新请求空间数据
  280. "$route"(to, from) {
  281. if (this.$route.name === "spaceLedger" && this.$route.query.RoomID && this.$route.query.zone) {
  282. this.getData();
  283. }
  284. }
  285. }
  286. }
  287. </script>
  288. <style lang="less" scoped>
  289. #screenBox .screen-router[data-v-6c06ede0] {
  290. padding: 0;
  291. }
  292. .el-header {
  293. padding: 0;
  294. height: 80px !important;
  295. .boxName {
  296. color: #fff;
  297. font-size: 16px;
  298. line-height: 50px;
  299. height: 50px !important;
  300. padding: 0 10px;
  301. background-color: #3f4f62;
  302. }
  303. .spaceName {
  304. font-size: 14px;
  305. line-height: 30px;
  306. margin: 0 10px;
  307. border-bottom: 1px solid #e4e7ed;
  308. box-sizing: border-box;
  309. }
  310. }
  311. .el-aside {
  312. color: #333;
  313. border: 1px solid #e4e7ed;
  314. margin: 10px 0 0 10px;
  315. padding: 20px;
  316. box-sizing: border-box;
  317. height: calc(100% - 20px);
  318. overflow: hidden;
  319. .el-scrollbar {
  320. height: 100%;
  321. overflow: hidden !important;
  322. }
  323. .aside-top {
  324. overflow: hidden;
  325. display: flex;
  326. .aside-top-left {
  327. flex: 3;
  328. }
  329. .aside-top-right {
  330. float: right;
  331. img {
  332. margin-left: -10px;
  333. width: 140px;
  334. height: 140px;
  335. }
  336. }
  337. }
  338. .space-img {
  339. width: 100%;
  340. .img-box {
  341. float: left;
  342. position: relative;
  343. width: 50%;
  344. height: 180px;
  345. img {
  346. position: absolute;
  347. left: 50%;
  348. top: 50%;
  349. transform: translate(-50%, -50%);
  350. width: 100%;
  351. }
  352. }
  353. }
  354. }
  355. .el-scrollbar {
  356. width: 430px;
  357. }
  358. .el-main {
  359. color: #333;
  360. text-align: center;
  361. margin: -10px;
  362. padding-bottom: 0;
  363. }
  364. .objectRelationship {
  365. display: flex;
  366. .objectRelationship-left,
  367. .objectRelationship-center,
  368. .objectRelationship-right {
  369. flex: 1;
  370. margin-right: 10px;
  371. text-align: left;
  372. height: 100%;
  373. }
  374. }
  375. #pane-staticData {
  376. height: 750px;
  377. div {
  378. height: 100%;
  379. }
  380. }
  381. .unit {
  382. color: rgb(167, 167, 167);
  383. }
  384. #floorCanvas {
  385. position: static;
  386. }
  387. </style>
  388. <style>
  389. .el-scrollbar__wrap {
  390. height: 100%;
  391. overflow-x: hidden !important;
  392. overflow-y: auto !important;
  393. }
  394. </style>