darkColorIndex.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. <!-- 底图 -->
  2. <template>
  3. <div id="floor_base" v-loading="loading" ref="graphycolor">
  4. <canvas
  5. :id="`canvas${id}`"
  6. :width="canvasWidth"
  7. :height="canvasHeight"
  8. tabindex="0"
  9. ></canvas>
  10. <!-- 地图底部操作按钮 -->
  11. <!-- <div class='strip-bottom'>
  12. <canvasFun @fit='fit' @savePng='savePng' @saveSvg='saveSvg' @saveJson='saveJson' @scale='scale' @showText='showText' ref='canvasFun'></canvasFun>
  13. </div> -->
  14. <room-box :key="`rommBox${roomKey}`" ref="boxRoom"></room-box>
  15. <equip-detail ref="equipDetail" :key="equipKey"></equip-detail>
  16. <el-popover
  17. ref="popover"
  18. placement="right"
  19. trigger="manual"
  20. v-model="visible"
  21. width="380"
  22. >
  23. <!-- <div style="text-align: right;margin-bottom: 10px;">
  24. <span style="float: left;">对应的工程信息化信息</span>
  25. <el-link icon="el-icon-close" :underline="false" @click="visible = false"></el-link>
  26. </div>-->
  27. <!-- 点击图标,出现的弹窗 -->
  28. <div
  29. v-if="equipIds.length && !tabData.pointData.length"
  30. style="margin-top: 10px"
  31. >
  32. <el-table
  33. :data="tabData.tableData"
  34. max-height="235"
  35. style="width: 100%"
  36. @row-click="handleClickEquipDetail"
  37. v-loading="eqLoading"
  38. :cell-class-name="tableCellClassName"
  39. >
  40. <el-table-column
  41. prop="sbjc"
  42. label="设备简称"
  43. width="144"
  44. :show-overflow-tooltip="true"
  45. ></el-table-column>
  46. <el-table-column
  47. prop="sl"
  48. width="50"
  49. label="数量"
  50. :show-overflow-tooltip="true"
  51. ></el-table-column>
  52. <el-table-column
  53. prop="sb_status"
  54. width="80"
  55. label="设备状态"
  56. :show-overflow-tooltip="true"
  57. ></el-table-column>
  58. <el-table-column
  59. prop="sbglgs"
  60. width="80"
  61. label="管理归属"
  62. :show-overflow-tooltip="true"
  63. ></el-table-column>
  64. <!-- <el-table-column prop="assetnum" width="80" label="设备内码" :show-overflow-tooltip='true'></el-table-column>
  65. <el-table-column label="" width="80" :show-overflow-tooltip='true'>
  66. <template slot-scope="scope">
  67. <span class="equip-detail-btn">台账详情</span>
  68. </template>
  69. </el-table-column>-->
  70. </el-table>
  71. <!-- <div style="text-align: right; margin-top: 10px;">
  72. <el-button size="mini" type="primary" @click="visible = false">关闭</el-button>
  73. </div>-->
  74. </div>
  75. <!-- 点击空间,出现的弹窗 -->
  76. <div
  77. v-else-if="!equipIds.length && tabData.pointData.length"
  78. style="margin-top: 10px"
  79. >
  80. <ul class="pointList">
  81. <li
  82. v-for="point in tabData.pointData"
  83. :key="point.id"
  84. @click="handleClickPointDeatil(point)"
  85. >
  86. <span :title="point.name">{{ point.name }}</span>
  87. <a>查看</a>
  88. </li>
  89. </ul>
  90. <div style="text-align: right; margin-top: 10px">
  91. <el-button
  92. v-show="showBtnWell"
  93. size="mini"
  94. type="primary"
  95. @click="handleClickHightLight(tabData.pointData)"
  96. >查看控制商铺范围</el-button
  97. >
  98. <!-- <el-button size="mini" type="primary" @click="visible = false">关闭</el-button> -->
  99. </div>
  100. </div>
  101. <!-- 既有空间,又有设备的弹窗 -->
  102. <el-tabs
  103. v-else-if="equipIds.length && tabData.pointData.length"
  104. v-model="activeName"
  105. >
  106. <el-tab-pane label="设备设施" name="equip">
  107. <el-table
  108. :data="tabData.tableData"
  109. max-height="235"
  110. style="width: 100%"
  111. @row-click="handleClickEquipDetail"
  112. :cell-class-name="tableCellClassName"
  113. v-loading="eqLoading"
  114. >
  115. <el-table-column
  116. prop="sbjc"
  117. label="设备简称"
  118. width="164"
  119. :show-overflow-tooltip="true"
  120. ></el-table-column>
  121. <el-table-column
  122. prop="sl"
  123. width="50"
  124. label="数量"
  125. :show-overflow-tooltip="true"
  126. align="right"
  127. ></el-table-column>
  128. <el-table-column
  129. prop="sb_status"
  130. width="70"
  131. label="设备状态"
  132. :show-overflow-tooltip="true"
  133. ></el-table-column>
  134. <el-table-column
  135. prop="sbglgs"
  136. width="70"
  137. label="管理归属"
  138. :show-overflow-tooltip="true"
  139. ></el-table-column>
  140. <!-- <el-table-column prop="assetnum" width="80" label="设备内码" :show-overflow-tooltip='true'></el-table-column>
  141. <el-table-column label="" width="80" :show-overflow-tooltip='true'>
  142. <template slot-scope="scope">
  143. <span class="equip-detail-btn">台账详情</span>
  144. </template>
  145. </el-table-column>-->
  146. </el-table>
  147. <div style="text-align: right; margin-top: 10px">
  148. <!-- <el-button size="mini" type="primary" @click="visible = false">关闭</el-button> -->
  149. </div>
  150. </el-tab-pane>
  151. <el-tab-pane label="位置" name="point">
  152. <ul class="pointList">
  153. <li
  154. v-for="point in tabData.pointData"
  155. :key="point.id"
  156. @click="handleClickPointDeatil(point)"
  157. >
  158. <span :title="point.name">{{ point.name }}</span>
  159. <a>查看</a>
  160. </li>
  161. </ul>
  162. <div style="text-align: right; margin-top: 10px">
  163. <el-button
  164. v-show="showBtnWell"
  165. size="mini"
  166. type="primary"
  167. @click="handleClickHightLight(tabData.pointData)"
  168. >查看控制商铺范围</el-button
  169. >
  170. <!-- <el-button size="mini" type="primary" @click="visible = false">关闭</el-button> -->
  171. </div>
  172. </el-tab-pane>
  173. </el-tabs>
  174. </el-popover>
  175. <span class="popStyle" :style="popoverPosition" v-popover:popover></span>
  176. </div>
  177. </template>
  178. <script>
  179. /**
  180. * @author yunxing
  181. * @date 2020年08月21日11:04
  182. * @description 停用,已拆除的状态,使用message进行提示
  183. */
  184. import { SFengParser, ProjectRf } from "@saga-web/feng-map";
  185. import {
  186. SFloorParser,
  187. ItemOrder,
  188. ItemColor,
  189. SPolygonItem,
  190. SBoardItem,
  191. } from "@saga-web/big";
  192. import { FloorView } from "@/lib/FloorView";
  193. import { FloorScene } from "@/lib/FloorScene";
  194. import RoomBox from "@/views/room/index";
  195. import canvasFun from "@/components/floorMap/canvasFunDark";
  196. import { readGroup, queryStatis, graphQuery } from "@/api/public";
  197. import { queryShops, queryAssetAll } from "@/api/equipmentList.js";
  198. import { STopologyParser } from "@/lib/parsers/STopologyParser";
  199. import { mapGetters, mapActions } from "vuex";
  200. import { SImageItem, SImageShowType, SGraphItem } from "@saga-web/graph/lib";
  201. import { SColor } from "@saga-web/draw/lib";
  202. import bus from "@/utils/bus.js";
  203. import { TipelineItem } from "../../lib/items/TipelineItem";
  204. import { SImageLegendItem } from "../../lib/items/SImageLegendItem";
  205. import equipDetail from "../../views/equipment/table/equipDetail";
  206. import { debounce } from "lodash";
  207. import { Message } from "element-ui";
  208. // import { uuid } from "@/components/mapClass/until";
  209. export default {
  210. data() {
  211. return {
  212. appName: "万达可视化系统",
  213. key: "23f30a832a862c58637a4aadbf50a566",
  214. mapServerURL: `http://mapapp.wanda.cn/editor`,
  215. canvasWidth: 600,
  216. canvasHeight: 800,
  217. loading: false, // 限制重复查询
  218. view: null,
  219. urlMsg: {},
  220. canvasID: "canvas",
  221. floorid: "", //楼层id
  222. topologyParser: null, // 解析器数据
  223. fParser: null, // 底图解析器
  224. wellMap: {}, // 电井控制商铺映射
  225. activeName: "equip",
  226. popoverPosition: {
  227. top: 0,
  228. left: 0,
  229. },
  230. statusTextPosition: {
  231. top: 0,
  232. left: 0,
  233. },
  234. visible: false,
  235. eqLoading: true,
  236. equipIds: [],
  237. tabData: {
  238. tableData: [],
  239. pointData: [],
  240. },
  241. activeItem: null,
  242. showBtnWell: false,
  243. count: 0, // 顶楼为多张图时计数器
  244. equipKey: 1, //设备弹窗使用key值,解决打开弹窗数据为上次弹窗的数据
  245. statusDisabled: ["已拆除"], //禁止跳转的设备状态
  246. roomKey: 1,
  247. shopsnumList: [], //所有与电井相关的商铺
  248. };
  249. },
  250. props: {
  251. id: {
  252. default: "1",
  253. type: String,
  254. },
  255. categoryId: {
  256. default: "",
  257. type: String,
  258. },
  259. // 弹窗高度,适配底图高度使用
  260. modalHeight: {
  261. type: [Number, undefined],
  262. default: undefined,
  263. },
  264. loadName: null,
  265. type: null,
  266. },
  267. components: { RoomBox, canvasFun, equipDetail },
  268. computed: {
  269. ...mapGetters(["plazaId", "fmapID", "haveFengMap", "bunkObj"]),
  270. },
  271. methods: {
  272. handleClickLegendItem(item, events) {
  273. this.tabData = { tableData: [], pointData: [] };
  274. this.equipIds = [];
  275. this.showBtnWell = false;
  276. this.visible = false;
  277. this.activeItem = null;
  278. this.isLoading = true;
  279. if (item.data.AttachObjectIds && item.data.AttachObjectIds.length) {
  280. const e = events[0];
  281. this.activeItem = item;
  282. item.data.AttachObjectIds.forEach((v) => {
  283. if (v.type == "Image") {
  284. if (v.id) {
  285. this.equipIds.push(v.id);
  286. }
  287. // this.tabData.tableData.push(v);
  288. } else if (v.type == "Zone") {
  289. this.tabData.pointData.push(v);
  290. }
  291. });
  292. if (this.equipIds.length) {
  293. this.eqLoading = true;
  294. let data = {
  295. plazaId: this.$store.state.plazaId,
  296. page: 1,
  297. size: this.equipIds.length,
  298. };
  299. let postParams = {
  300. assetnumList: this.equipIds,
  301. };
  302. queryAssetAll({ data, postParams }).then((res) => {
  303. this.tabData.tableData = res.data.data;
  304. this.eqLoading = false;
  305. console.log("this.tabData", this.tabData);
  306. });
  307. }
  308. this.popoverPosition.top = `${e.clientY}px`;
  309. this.popoverPosition.left = `${e.clientX}px`;
  310. this.$nextTick(() => {
  311. if (
  312. item.data.GraphElementId == "100050" ||
  313. item.data.GraphElementId == "100055" ||
  314. item.data.GraphElementId == "100056" ||
  315. item.data.GraphElementId == "100057"
  316. ) {
  317. //判断是否为电井
  318. this.showBtnWell = true;
  319. }
  320. this.visible = true;
  321. });
  322. }
  323. },
  324. // 初始化获取所有电井对应的底图商铺id
  325. wellToShop() {
  326. // 获取所有电井相关的底图
  327. const pointData = this.tabData.pointData;
  328. this.clearHightLight();
  329. let location = "";
  330. pointData.forEach((point) => {
  331. location = location + point.id ? point.id + ":wellnum;" : "";
  332. });
  333. let getParams = {
  334. plazaId: this.plazaId,
  335. floor: this.floorid,
  336. keyword: location,
  337. };
  338. queryShops({ getParams }).then((res) => {
  339. let shopsnumList = [];
  340. if (res.data && res.data.length) {
  341. for (let floor in res.data[0]) {
  342. if (res.data[0][floor].length) {
  343. res.data[0][floor].forEach((v) => {
  344. shopsnumList = shopsnumList.concat(v.shopsnumList.split(","));
  345. });
  346. }
  347. }
  348. }
  349. this.shopsnumList = shopsnumList;
  350. });
  351. },
  352. // 查看浮层设备详情
  353. handleClickEquipDetail: debounce(function (row, column, event) {
  354. // 设备状态为停用或已拆除时,弹出消息
  355. if (this.statusDisabled.includes(row?.sb_status)) {
  356. let message = `当前设备状态为“${row.sb_status}”,请复核现场情况,如有需要请前往编辑器删除。`; // `当前设备为“${row.sb_status}”状态,请前往编辑器重新编辑`
  357. // 防止出现多条message
  358. // 已经有 message时,并且this.message的message字段与message一致时, 不进行提示
  359. if (
  360. this.message &&
  361. this.message.visible &&
  362. this.message.message === message
  363. ) {
  364. return true;
  365. }
  366. this.message = Message({
  367. showClose: true,
  368. message,
  369. type: "warning",
  370. duration: 0,
  371. iconClass: "el-icon-warning-outline",
  372. customClass: "floor-map-warning",
  373. });
  374. // this.message = this.$message({
  375. // message,
  376. // type: 'warning',
  377. // })
  378. return true;
  379. }
  380. if (row.assetnum) {
  381. this.equipKey++;
  382. this.$nextTick(() => {
  383. this.$refs.equipDetail.open({ row: JSON.stringify(row) });
  384. });
  385. }
  386. }, 0),
  387. // handleClickEquipDetail(row) {
  388. // if (row.assetuid) {
  389. // window.open(`http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=assetdevic&uniqueid=${row.assetuid}`)
  390. // }
  391. // },
  392. // 查看浮层位置详情
  393. handleClickPointDeatil(point) {
  394. if (point.id && this.activeItem) {
  395. this.roomKey++;
  396. this.$nextTick(() => {
  397. this.$refs.boxRoom.open({
  398. name: this.activeItem.name,
  399. type: this.type,
  400. location: point.id,
  401. });
  402. });
  403. }
  404. },
  405. handleClickHightLight(pointData) {
  406. this.clearHightLight();
  407. pointData.forEach((point) => {
  408. let location = point.id ? point.id : "";
  409. // if (this.wellMap.hasOwnProperty(location)) {
  410. // this.wellMap[location].forEach((item) => {
  411. // item.highLightFlag = true
  412. // item.zOrder = 30
  413. // })
  414. // } else {
  415. let getParams = {
  416. plazaId: this.plazaId,
  417. floor: this.floorid,
  418. keyword: `${location}:wellnum;`,
  419. };
  420. queryShops({ getParams }).then((res) => {
  421. let shopsnumList = [];
  422. // let shopsnumItemList = []
  423. if (res.data && res.data.length) {
  424. for (let floor in res.data[0]) {
  425. if (res.data[0][floor].length) {
  426. res.data[0][floor].forEach((v) => {
  427. shopsnumList = shopsnumList.concat(v.shopsnumList.split(","));
  428. });
  429. }
  430. }
  431. }
  432. if (shopsnumList.length) {
  433. this.fParser.spaceList.forEach((item) => {
  434. if (
  435. shopsnumList.findIndex((name) => name == item.data.Name) != -1
  436. ) {
  437. item.highLightFlag = true;
  438. item.zOrder = 30;
  439. // shopsnumItemList.push(item)
  440. }
  441. });
  442. // this.wellMap[location] = shopsnumItemList
  443. }
  444. });
  445. // }
  446. });
  447. this.visible = false;
  448. },
  449. ...mapActions(["getfmapID"]),
  450. init(floorid) {
  451. this.loading = true;
  452. this.floorid = floorid;
  453. this.mapSize();
  454. // this.$refs.canvasFun.isShow = false
  455. setTimeout(() => {
  456. this.clearGraphy();
  457. this.scene = new FloorScene();
  458. if (this.haveFengMap == 1) {
  459. this.scene.selectContainer.connect(
  460. "listChange",
  461. this,
  462. this.listChange
  463. );
  464. if (this.canvasID != `canvas${this.id}`) {
  465. this.canvasID = `canvas${this.id}`;
  466. }
  467. this.getGraphDetail().then((res) => {
  468. if (res.Content.length == 1) {
  469. const data = res.Content[0];
  470. if (data.MaxY && data.MinX) {
  471. window.fengmapData.maxY = data.MaxY;
  472. window.fengmapData.minX = data.MinX;
  473. }
  474. }
  475. this.parserData(floorid);
  476. });
  477. // this.parserData(floorid);
  478. } else if (this.haveFengMap == 0) {
  479. this.view.scene = this.scene;
  480. this.readGraph();
  481. } else {
  482. this.loading = false;
  483. }
  484. }, 100);
  485. },
  486. parserData(floor) {
  487. if (floor == "g80") {
  488. // 屋顶
  489. if (window.fengmapData.frImg) {
  490. const pj = this.fmapID.split("_")[0];
  491. // 单张图片
  492. if (!ProjectRf[pj]) {
  493. let imgItem = new SImageItem(
  494. null,
  495. `${this.mapServerURL}/webtheme/${this.fmapID}/${window.fengmapData.frImg}`
  496. );
  497. imgItem.showType = SImageShowType.AutoFit;
  498. imgItem.connect("imgLoadOver", this, () => {
  499. this.readGraph();
  500. });
  501. this.scene.addItem(imgItem);
  502. this.view.scene = this.scene;
  503. // this.view.fitSceneToView()
  504. } else {
  505. // 多张图
  506. try {
  507. // 初始化0
  508. this.count = 0;
  509. ProjectRf[pj].forEach((t) => {
  510. const item = new SImageItem(
  511. null,
  512. `${this.mapServerURL}/webtheme/${this.fmapID}/${t.name}`
  513. );
  514. item.width = t.width;
  515. item.height = t.height;
  516. item.moveTo(t.x, t.y);
  517. item.connect("imgLoadOver", this, () => {
  518. this.countRf(ProjectRf[pj].length);
  519. });
  520. this.scene.addItem(item);
  521. });
  522. this.view.scene = this.scene;
  523. } catch (e) {
  524. console.log(e);
  525. }
  526. }
  527. } else {
  528. // 屋顶图不为图片
  529. this.readBaseMap(floor);
  530. }
  531. } else {
  532. if (window.fengmapData.gnameToGid[floor]) {
  533. this.readBaseMap(floor);
  534. } else {
  535. console.log("楼层不正确");
  536. }
  537. }
  538. }, // 解析底图
  539. // 解析楼地板
  540. loadBoard(floor) {
  541. window.fengmapData.loadFloor(floor, (res) => {
  542. const zone = new SBoardItem(null, res);
  543. this.scene.addItem(zone);
  544. });
  545. },
  546. readBaseMap(floor) {
  547. this.loadBoard(window.fengmapData.gnameToGid[floor]);
  548. window.fengmapData.parseData(
  549. window.fengmapData.gnameToGid[floor],
  550. (res) => {
  551. if (res.err) {
  552. console.log("errr", res.err);
  553. return;
  554. }
  555. this.fParser = new SFloorParser(null);
  556. this.fParser.parseData(res);
  557. // 改变底图演示
  558. ItemColor.spaceColor = new SColor("#0C102C");
  559. this.fParser.spaceList.forEach((t) => {
  560. this.scene.addItem(t);
  561. t.nameSize = 12;
  562. t.nameColor = "#2a2a2a";
  563. if (t.data.Name && this.bunkObj[t.data.Name]) {
  564. t.name = this.bunkObj[t.data.Name].brandname;
  565. } else {
  566. // t.name = t.data.Name
  567. t.name = "";
  568. }
  569. });
  570. this.fParser.wallList.forEach((t) => this.scene.addItem(t));
  571. this.fParser.virtualWallList.forEach((t) => this.scene.addItem(t));
  572. this.fParser.doorList.forEach((t) => this.scene.addItem(t));
  573. this.fParser.columnList.forEach((t) => this.scene.addItem(t));
  574. this.fParser.casementList.forEach((t) => this.scene.addItem(t));
  575. this.view.scene = this.scene;
  576. // this.view.fitSceneToView()
  577. this.readGraph();
  578. }
  579. );
  580. },
  581. readGraph() {
  582. this.readGroup(this.floorid)
  583. .then((data) => {
  584. if (data.Result == "failure") {
  585. this.$store.commit("SETISMESSAGE", false);
  586. this.view.fitSceneToView();
  587. this.view.minScale = this.view.scale;
  588. if (this.$refs.canvasFun) {
  589. this.$refs.canvasFun.everyScale = this.view.scale;
  590. }
  591. this.loading = false;
  592. return;
  593. } else {
  594. if (
  595. data.Data[0].Elements.Nodes.length === 0 &&
  596. data.Data[0].Elements.Markers.length === 0 &&
  597. data.Data[0].Elements.Relations.length === 0
  598. ) {
  599. this.$store.commit("SETISMESSAGE", false);
  600. } else {
  601. this.$store.commit("SETISMESSAGE", true);
  602. }
  603. }
  604. // 无返回Data处理
  605. if (!(data.Data && data.Data.length)) {
  606. this.view.fitSceneToView();
  607. this.view.minScale = this.view.scale;
  608. if (this.$refs.canvasFun) {
  609. this.$refs.canvasFun.everyScale = this.view.scale;
  610. }
  611. return false;
  612. }
  613. // 请求回来的备注
  614. if (data.Data && data.Data[0].Note) {
  615. let note = data.Data[0].Note;
  616. bus.$emit("queryRemarksMethods", note);
  617. } else {
  618. bus.$emit("queryRemarksMethods", "");
  619. }
  620. //土建装饰的图例展示
  621. if (this.$cookie.get("categoryId") == "SCPZ") {
  622. let scpzTable = [],
  623. arr = [];
  624. scpzTable = data.Data[0].Elements.Nodes || [];
  625. console.log(scpzTable);
  626. if (scpzTable.length > 0) {
  627. scpzTable.forEach((e) => {
  628. if (e.Properties.ItemExplain) {
  629. let obj = e;
  630. arr.push(obj);
  631. }
  632. });
  633. }
  634. console.log(arr);
  635. this.$store.commit("SETSCPZTABLE", arr);
  636. }
  637. if (data.Data[0].Elements.Nodes.length > 0) {
  638. this.$store.commit("SETTYPENUM", "");
  639. let Lengd = data.Data[0].Elements.Nodes;
  640. Lengd.forEach((el) => {
  641. if (el.Type == "Image" && el.Num > 1) {
  642. console.log(el.Num);
  643. this.$store.commit("SETTYPENUM", el.Num);
  644. }
  645. });
  646. }
  647. // 放到后边 $cookie graphId
  648. this.$cookie.set("graphId", data.Data[0].ID, 3);
  649. if (this.$cookie.get("graphId")) {
  650. // 得到graphId 就请求图例
  651. // 除土建装饰之外的图例展示 包括楼层功能
  652. bus.$emit("queryViewMethods");
  653. }
  654. this.topologyParser = new STopologyParser(null);
  655. this.topologyParser.parseData(data.Data[0].Elements);
  656. // 多边形
  657. this.topologyParser.zoneLegendList.forEach((t) => {
  658. this.scene.addItem(t);
  659. // t.connect('legendItemClick', t, this.handleClickLegendItem)
  660. });
  661. // 增加文字
  662. this.topologyParser.textMarkerList.forEach((t) => {
  663. this.scene.addItem(t);
  664. });
  665. // 增加图片
  666. this.topologyParser.imageMarkerList.forEach((t) => {
  667. this.scene.addItem(t);
  668. });
  669. // 增加直线
  670. this.topologyParser.lineMarkerList.forEach((t) => {
  671. this.scene.addItem(t);
  672. });
  673. // 增加图标类图例
  674. this.topologyParser.imageLegendList.forEach((t) => {
  675. t.textItem.color = new SColor("#ffffff");
  676. this.scene.addItem(t);
  677. // t.connect('legendItemClick', t, this.handleClickLegendItem)
  678. });
  679. // 增加管线类
  680. // 增加图标类图例
  681. this.topologyParser.relationList.forEach((t) => {
  682. t.selectable = true;
  683. this.scene.addItem(t);
  684. // t.connect('legendItemClick', t, this.handleClickLegendItem)
  685. });
  686. this.view.fitSceneToView();
  687. this.view.minScale = this.view.scale;
  688. if (this.$refs.canvasFun) {
  689. this.$refs.canvasFun.everyScale = this.view.scale;
  690. }
  691. this.loading = false;
  692. })
  693. .catch(() => {
  694. this.loading = false;
  695. });
  696. },
  697. // 顶楼为多张图时计数器
  698. countRf(len) {
  699. this.count++;
  700. if (len == this.count) {
  701. this.readGraph();
  702. } else {
  703. console.log("所有图片未加载完成");
  704. }
  705. },
  706. clearGraphy() {
  707. if (this.view) {
  708. this.view.scene = null;
  709. return;
  710. }
  711. this.view = new FloorView(`canvas${this.id}`);
  712. },
  713. listChange(item, ev) {
  714. // if (ev[0].length) {
  715. // let selectItem1 = ev[0][0],
  716. // location = selectItem1.data.AttachObjectIds[0] ? selectItem1.data.AttachObjectIds[0].id : ''
  717. // // 空间类型都可打开弹窗(除防火分区 编号100131,商管办公室 编号100112,铺装石材 编号100129)
  718. // if (selectItem1.data.GraphElementType == 'Zone') {
  719. // if (
  720. // selectItem1.data.GraphElementId != '100131' &&
  721. // selectItem1.data.GraphElementId != '100112' &&
  722. // selectItem1.data.GraphElementId != '100129'
  723. // ) {
  724. // if (location) {
  725. // this.$refs.boxRoom.open({ name: selectItem1.name, type: this.type, location: location })
  726. // }
  727. // }
  728. // }
  729. // // // 选中电井设置电井关联的商铺高亮
  730. // // this.setHightLight(ev[0])
  731. // }
  732. // else {
  733. // this.clearHightLight()
  734. // }
  735. if (ev[0].length) {
  736. if (
  737. !(
  738. ev[0][0] instanceof SPolygonItem ||
  739. ev[0][0] instanceof TipelineItem ||
  740. ev[0][0] instanceof SImageLegendItem
  741. )
  742. ) {
  743. this.visible = false;
  744. }
  745. } else {
  746. this.visible = false;
  747. }
  748. this.clearHightLight();
  749. },
  750. // 选中电井关联的商铺高亮
  751. setHightLight(arr) {
  752. this.clearHightLight();
  753. arr.forEach((item) => {
  754. let location = item.data.AttachObjectIds[0]
  755. ? item.data.AttachObjectIds[0].id
  756. : "";
  757. // 添加了位置类型并且选中的类型为电井类型
  758. if (
  759. (item.data.GraphElementId == "100050" ||
  760. item.data.GraphElementId == "100055" ||
  761. item.data.GraphElementId == "100056" ||
  762. item.data.GraphElementId == "100057") &&
  763. location
  764. ) {
  765. if (this.wellMap.hasOwnProperty(location)) {
  766. this.wellMap[location].forEach((item) => {
  767. item.highLightFlag = true;
  768. item.zOrder = 30;
  769. });
  770. } else {
  771. let getParams = {
  772. plazaId: this.plazaId,
  773. floor: this.floorid,
  774. keyword: `${location}:wellnum;`,
  775. };
  776. queryShops({ getParams }).then((res) => {
  777. let shopsnumList = [];
  778. let shopsnumItemList = [];
  779. if (res.data && res.data.length) {
  780. for (let floor in res.data[0]) {
  781. if (res.data[0][floor].length) {
  782. res.data[0][floor].forEach((v) => {
  783. shopsnumList = shopsnumList.concat(
  784. v.shopsnumList.split(",")
  785. );
  786. });
  787. }
  788. }
  789. }
  790. if (shopsnumList.length) {
  791. this.fParser.spaceList.forEach((item) => {
  792. if (
  793. shopsnumList.findIndex((name) => name == item.data.Name) !=
  794. -1
  795. ) {
  796. item.highLightFlag = true;
  797. item.zOrder = 30;
  798. shopsnumItemList.push(item);
  799. }
  800. });
  801. this.wellMap[location] = shopsnumItemList;
  802. }
  803. });
  804. }
  805. }
  806. });
  807. },
  808. // 清除电井关联商铺的高亮状态
  809. clearHightLight() {
  810. ItemColor.spaceHighColor = new SColor("#FBF2CC");
  811. // for (let key in this.wellMap) {
  812. // this.wellMap[key].forEach((item) => {
  813. // item.highLightFlag = false
  814. // item.zOrder = ItemOrder.spaceOrder
  815. // })
  816. // }
  817. this.fParser.spaceList.forEach((item) => {
  818. item.highLightFlag = false;
  819. item.zOrder = ItemOrder.spaceOrder;
  820. });
  821. },
  822. // 适配底图到窗口
  823. fit() {
  824. this.view.fitSceneToView();
  825. },
  826. // 保存为png
  827. savePng() {
  828. // this.view.saveImage(`${this.loadName}.png`, 'png')
  829. this.view.saveImageSize(
  830. `${this.loadName}.png`,
  831. "png",
  832. 1920 * 2,
  833. 1080 * 2
  834. );
  835. //console.log(`${this.loadName}.png`)
  836. },
  837. // 保存为svg
  838. saveSvg() {
  839. this.view.saveSceneSvg(`${this.loadName}.svg`, 6400, 4800);
  840. },
  841. // 保存为json
  842. saveJson() {
  843. this.view.saveFloorJson(`${this.loadName}.json`);
  844. },
  845. // 缩放
  846. scale(val) {
  847. if (!this.view) {
  848. return;
  849. }
  850. let scale = this.view.scale;
  851. this.view.scaleByPoint(
  852. val / scale,
  853. this.canvasWidth / 2,
  854. this.canvasHeight / 2
  855. );
  856. },
  857. // 小眼睛控制显示铺位名称
  858. showText(val) {
  859. // this.topologyParser.zoneLegendList.forEach(t => {
  860. // t.showText = val
  861. // })
  862. this.fParser.spaceList.forEach((t) => {
  863. t.showBaseName = val;
  864. });
  865. },
  866. // 读取数据
  867. readGroup(FloorID) {
  868. const data = {
  869. BuildingID: "1",
  870. FloorID: FloorID,
  871. categoryId: this.categoryId
  872. ? this.categoryId
  873. : this.$cookie.get("categoryId"),
  874. projectId: this.urlMsg.ProjectID,
  875. Pub: true,
  876. };
  877. return readGroup(data);
  878. },
  879. // 获取图最大最小值
  880. getGraphDetail() {
  881. const categoryId = this.categoryId
  882. ? this.categoryId
  883. : this.$cookie.get("categoryId");
  884. const data = {
  885. Filters: `categoryId='${categoryId}';projectId='${this.urlMsg.ProjectID}';BuildingID='1';FloorID='${this.floorid}';isPub=true`,
  886. };
  887. return graphQuery(data);
  888. },
  889. // 地图尺寸
  890. mapSize() {
  891. this.canvasWidth = this.$refs.graphycolor.offsetWidth;
  892. if (window.screen.height == "768") {
  893. this.canvasHeight = this.$refs.graphycolor.offsetHeight - 100;
  894. } else {
  895. this.canvasHeight = 570;
  896. }
  897. // 弹窗中底图高度适配
  898. if (this.modalHeight) {
  899. this.canvasHeight = this.modalHeight;
  900. }
  901. },
  902. getEvent() {
  903. bus.$on("changeShow", (res) => {
  904. this.topologyParser &&
  905. this.topologyParser.zoneLegendList.forEach((t) => {
  906. let id = t.data.GraphElementId;
  907. t.maskFlag = !(res.indexOf(id) > -1);
  908. });
  909. // this.topologyParser.textMarkerList.forEach(t => {
  910. // let id = t.data.GraphElementId
  911. // t.maskFlag = !(res.indexOf(id) > -1)
  912. // })
  913. // this.topologyParser.imageMarkerList.forEach(t => {
  914. // let id = t.data.GraphElementId
  915. // t.maskFlag = !(res.indexOf(id) > -1)
  916. // })
  917. // this.topologyParser.lineMarkerList.forEach(t => {
  918. // let id = t.data.GraphElementId
  919. // t.maskFlag = !(res.indexOf(id) > -1)
  920. // })
  921. this.topologyParser &&
  922. this.topologyParser.imageLegendList.forEach((t) => {
  923. let id = t.data.GraphElementId;
  924. t.maskFlag = !(res.indexOf(id) > -1);
  925. });
  926. this.topologyParser &&
  927. this.topologyParser.relationList.forEach((t) => {
  928. let id = t.data.GraphElementId || t.data.GraphElementID;
  929. t.maskFlag = !(res.indexOf(id) > -1);
  930. });
  931. });
  932. },
  933. /**
  934. * @description 处理popover显隐
  935. * 当点击位置不在canvas内部时 ( 如点击 页面空白,图例,楼层,设备设施左侧列表项时),将visible置为false,隐藏popover
  936. */
  937. handlePopover(e) {
  938. this.$nextTick(() => {
  939. if (!this.$refs.graphycolor.contains(e.target)) {
  940. this.visible = false;
  941. }
  942. this.showStatusText = false;
  943. this.statusText = "";
  944. // 关闭message提示
  945. if (this.message) {
  946. this.message.close();
  947. this.message = null;
  948. }
  949. });
  950. },
  951. /**
  952. * @description 设备状态列, 状态为停用或已拆除时,样式红色
  953. */
  954. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  955. if (columnIndex === 2 && this.statusDisabled.includes(row.sb_status)) {
  956. return "status-disabled";
  957. }
  958. },
  959. },
  960. watch: {
  961. "view.scale": {
  962. handler(n) {
  963. if (this.$refs.canvasFun) {
  964. let s = (n * 10) / this.view.minScale;
  965. this.$refs.canvasFun.sliderVal = s > 1000 ? 1000 : s;
  966. }
  967. },
  968. },
  969. haveFengMap() {
  970. this.init(this.floorid);
  971. },
  972. },
  973. mounted() {
  974. this.mapSize();
  975. this.getEvent();
  976. // 添加监听点击事件,处理popover显隐
  977. window.addEventListener("click", this.handlePopover, false);
  978. this.$once("hook:beforeDestroy", () => {
  979. window.removeEventListener("click", this.handlePopover);
  980. });
  981. },
  982. created() {
  983. // document.addEventListener("mousedown", () => {
  984. // this.visible = false;
  985. // })
  986. this.urlMsg = {
  987. categoryId: this.$cookie.get("categoryId"),
  988. ProjectID: this.plazaId,
  989. BuildingID: "1",
  990. FloorID: this.$cookie.get("floorMapId") || "f1",
  991. fmapID: this.fmapID,
  992. };
  993. },
  994. };
  995. </script>
  996. <style lang="less" scoped>
  997. #floor_base {
  998. position: relative;
  999. height: 100%;
  1000. .fengMap {
  1001. position: fixed;
  1002. width: 100px;
  1003. height: 100px;
  1004. z-index: -1;
  1005. }
  1006. .strip-bottom {
  1007. position: absolute;
  1008. right: 0;
  1009. bottom: 40px;
  1010. width: 100%;
  1011. }
  1012. .popStyle {
  1013. position: fixed;
  1014. }
  1015. }
  1016. </style>
  1017. <style lang="less">
  1018. a:hover {
  1019. text-decoration: none;
  1020. }
  1021. .el-popover {
  1022. .el-table {
  1023. tr {
  1024. .equip-detail-btn {
  1025. display: none;
  1026. }
  1027. }
  1028. tr:hover {
  1029. cursor: pointer;
  1030. .equip-detail-btn {
  1031. cursor: pointer;
  1032. display: inline-block;
  1033. color: #025baa;
  1034. }
  1035. }
  1036. }
  1037. .pointList {
  1038. max-height: 235px;
  1039. overflow-y: auto;
  1040. text-align: right;
  1041. li {
  1042. height: 38px;
  1043. line-height: 38px;
  1044. padding: 0 12px;
  1045. cursor: pointer;
  1046. border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  1047. span {
  1048. float: left;
  1049. width: 260px;
  1050. text-align: left;
  1051. overflow: hidden;
  1052. text-overflow: ellipsis;
  1053. white-space: nowrap;
  1054. }
  1055. a {
  1056. display: none;
  1057. color: #025baa;
  1058. font-size: 13px;
  1059. }
  1060. }
  1061. li:hover {
  1062. background-color: #f5f6f7;
  1063. a {
  1064. display: inline-block;
  1065. }
  1066. }
  1067. }
  1068. .el-button--primary {
  1069. background: linear-gradient(180deg, #369cf7 0%, #025baa 100%);
  1070. }
  1071. .el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),
  1072. .el-tabs--bottom .el-tabs__item.is-top:nth-child(2),
  1073. .el-tabs--top .el-tabs__item.is-bottom:nth-child(2),
  1074. .el-tabs--top .el-tabs__item.is-top:nth-child(2) {
  1075. padding-left: 16px;
  1076. }
  1077. .el-tabs--bottom .el-tabs__item.is-bottom:last-child,
  1078. .el-tabs--bottom .el-tabs__item.is-top:last-child,
  1079. .el-tabs--top .el-tabs__item.is-bottom:last-child,
  1080. .el-tabs--top .el-tabs__item.is-top:last-child {
  1081. padding-right: 16px;
  1082. }
  1083. .el-tabs__nav-wrap::after {
  1084. height: 0;
  1085. }
  1086. .is-active {
  1087. color: #025baa !important;
  1088. border-color: #025baa !important;
  1089. background: rgba(2, 91, 170, 0.15);
  1090. }
  1091. .el-tabs__item {
  1092. padding: 5px 16px;
  1093. height: 30px;
  1094. line-height: 20px;
  1095. font-size: 14px;
  1096. font-family: MicrosoftYaHei;
  1097. color: rgba(31, 36, 41, 1);
  1098. border: 1px solid rgba(195, 199, 203, 1);
  1099. }
  1100. .el-tabs__active-bar {
  1101. background-color: transparent !important;
  1102. }
  1103. /deep/ .el-tabs__item:last-child {
  1104. border-radius: 0px 4px 4px 0px;
  1105. }
  1106. /deep/ .el-tabs__item:nth-child(2) {
  1107. border-radius: 4px 0px 0px 4px;
  1108. }
  1109. // 设备状态
  1110. .status-disabled {
  1111. color: #c0c4cc !important;
  1112. text-decoration: line-through;
  1113. }
  1114. }
  1115. // 警告message样式修改
  1116. .floor-map-warning {
  1117. background-color: #ffa53d;
  1118. color: #fff;
  1119. font-size: 14px;
  1120. /deep/ .el-icon-warning-outline {
  1121. font-weight: 600 !important;
  1122. margin-right: 5px;
  1123. }
  1124. /deep/.el-icon-close {
  1125. color: #fff;
  1126. opacity: 0.5;
  1127. }
  1128. }
  1129. </style>