index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  1. <template>
  2. <div class="dialog-container">
  3. <div
  4. :class="selectedSwitch ? 'big-box' : 'small-box'"
  5. v-if="show && switchConfigShow"
  6. >
  7. <div class="switch-box">
  8. <div v-for="item in switchConfig" :key="item.type" class="switch-row">
  9. <span>{{ item.label }}</span>
  10. <el-switch
  11. v-model="item.show"
  12. :active-value="true"
  13. :inactive-value="false"
  14. active-color="#7ED321"
  15. inactive-color="rgba(0,19,13,0.40)"
  16. @change="handleChange($event, item)"
  17. ></el-switch>
  18. <i
  19. :class="item.selected ? 'selected-icon' : 'normal-icon'"
  20. @click="changeSelectStatus(item)"
  21. ></i>
  22. </div>
  23. </div>
  24. <div class="selected-detail" v-if="selectedSwitch">
  25. <div class="line"></div>
  26. <div class="detail-box">
  27. <!-- 重大危险源 -->
  28. <zdwxy
  29. v-if="selectedSwitch.label === '重大危险源'"
  30. :data="wxyData"
  31. @locationEntity="locationEntity"
  32. ></zdwxy>
  33. <!-- 风险区域 -->
  34. <fxqy
  35. v-else-if="selectedSwitch.label === '风险区域'"
  36. :data="fxqyData"
  37. @locationEntity="locationEntity"
  38. ></fxqy>
  39. <tszy
  40. v-else-if="selectedSwitch.label === '特殊作业'"
  41. :data="tszyData"
  42. @locationEntity="locationEntity"
  43. ></tszy>
  44. <yinhuan
  45. v-else-if="selectedSwitch.label === '安全隐患'"
  46. :data="yhData"
  47. @locationEntity="locationEntity"
  48. ></yinhuan>
  49. <!-- 区域人员统计 -->
  50. <person v-else-if="selectedSwitch.label === '人员'"></person>
  51. <!-- 电子围栏 -->
  52. <rail
  53. v-else-if="selectedSwitch.label === '电子围栏'"
  54. :data="selectedSwitch.elements"
  55. @locationEntity="locationEntity"
  56. ></rail>
  57. <!-- 通用 -->
  58. <normal
  59. v-else
  60. :data="normalData"
  61. @locationEntity="locationEntity"
  62. :layerId="layerID"
  63. ></normal>
  64. </div>
  65. </div>
  66. <div class="show-click-box" @click="openOrClose()"></div>
  67. </div>
  68. <div class="hide-box animated" v-else @click="openOrClose()"></div>
  69. </div>
  70. </template>
  71. <script>
  72. import { mapGetters } from "vuex";
  73. import { getWXYList, getFXQYList } from "@/API/custom";
  74. import { getBuildEntity } from "@/API/model";
  75. import { getRTData } from "@/API/rtdata";
  76. import { _locate } from "@/utils";
  77. import BaseTableList from "@/views/components/base/BaseTableList";
  78. import Normal from "./layerDetail/Normal";
  79. import fxqy from "./layerDetail/fxqy";
  80. import zdwxy from "./layerDetail/zdwxy";
  81. import person from "./layerDetail/person";
  82. import tszy from "./layerDetail/tszy";
  83. import rail from "./layerDetail/rail";
  84. import yinhuan from "./layerDetail/yinhuan";
  85. import {
  86. addNewDatasource,
  87. setModelShow,
  88. flyToPerspective,
  89. } from "@/utils/mapUtil";
  90. import { getViewer } from "@/store/map/mapService";
  91. import {
  92. Entity,
  93. Cartesian2,
  94. Cartesian3,
  95. Color,
  96. NearFarScalar,
  97. PropertyBag,
  98. PolylineDashMaterialProperty,
  99. HorizontalOrigin,
  100. VerticalOrigin,
  101. LabelStyle,
  102. PolygonHierarchy,
  103. ClassificationType,
  104. CallbackProperty,
  105. } from "cesium";
  106. export default {
  107. name: "LayerControl",
  108. components: {
  109. BaseTableList,
  110. Normal,
  111. fxqy,
  112. zdwxy,
  113. person,
  114. tszy,
  115. yinhuan,
  116. rail,
  117. },
  118. data() {
  119. return {
  120. show: false,
  121. detailShows: {
  122. common: false,
  123. zdwxy: false,
  124. fxqy: false,
  125. person: false,
  126. tszy: false,
  127. yh: false,
  128. rail: false,
  129. },
  130. layerID: "",
  131. normalData: [],
  132. wxyData: [],
  133. fxqyData: [],
  134. tszyData: [],
  135. tszyIconList: [
  136. {
  137. name: "动火",
  138. url: "/Resource/Portrait/2022/01/22/491de4cdf9cf453e986d96dbdacf4b0a.png",
  139. },
  140. {
  141. name: "高处",
  142. url: "/Resource/Portrait/2022/01/22/db968bc61b1e4d8ba702fbb604a8370b.png",
  143. },
  144. {
  145. name: "吊装",
  146. url: "/Resource/Portrait/2022/01/22/6697348332fe4bd38fc631c0bff86d87.png",
  147. },
  148. {
  149. name: "盲板",
  150. url: "/Resource/Portrait/2022/01/22/c4a29923a89d4508b8f3453c86aad70f.png",
  151. },
  152. {
  153. name: "断路",
  154. url: "/Resource/Portrait/2022/01/22/5d629d1ab246442db3ef40b0915ed343.png",
  155. },
  156. {
  157. name: "动土",
  158. url: "/Resource/Portrait/2022/01/22/3d94c3a5529b46498d624977845f7712.png",
  159. },
  160. {
  161. name: "受限空间",
  162. url: "/Resource/Portrait/2022/01/22/a76f621b5b614c1a89bdbdf80db8ca46.png",
  163. },
  164. {
  165. name: "通用",
  166. url: "/Resource/Portrait/2022/01/22/60b85f13a92f4ee1a03020ba562b5757.png",
  167. },
  168. ],
  169. yhData: [],
  170. railData: [],
  171. buildingInfo: [],
  172. buildingInfoLayerId: "",
  173. curRTTags: [],
  174. };
  175. },
  176. computed: {
  177. ...mapGetters([
  178. "switchConfigShow",
  179. "switchConfig",
  180. "rtTag",
  181. "rtData",
  182. "buildId",
  183. "buildInfo",
  184. "openLayer",
  185. ]),
  186. selectedSwitch() {
  187. return this.switchConfig.find((item) => item.selected);
  188. },
  189. },
  190. watch: {
  191. selectedSwitch: {
  192. handler(val) {
  193. if (val) {
  194. // console.log(val)
  195. console.log("切换图层数据列表", val);
  196. this.layerID = val.type;
  197. this.normalData = [];
  198. if (val.elements?.length) {
  199. this.$set(this, "normalData", val.elements);
  200. }
  201. if (["建筑名称", "名称标签", "灭火器"].includes(val.name)) {
  202. this.normalData = this.buildingInfo;
  203. }
  204. }
  205. },
  206. deep: true,
  207. },
  208. buildId: {
  209. handler(val) {
  210. const layer = this.switchConfig.find(
  211. (item) => item.label === "风险区域"
  212. );
  213. //console.log('图层侧边建筑变化', val, this.buildInfo, layer);
  214. if (layer?.show) {
  215. this.getFXQYList(undefined, true);
  216. }
  217. },
  218. deep: true,
  219. },
  220. switchConfig: {
  221. handler(newVal) {
  222. // console.log("Infomation", newVal);
  223. },
  224. },
  225. switchConfigShow: {
  226. handler(newVal) {
  227. this.show = newVal ? true : false;
  228. },
  229. },
  230. openLayer: {
  231. handler(newVal) {
  232. if (Array.isArray(newVal)) {
  233. newVal.forEach((layer) => {
  234. console.log("打开图层", layer);
  235. this.openLayerByName(layer);
  236. });
  237. }
  238. },
  239. },
  240. },
  241. created() {
  242. //从配置文件加载的图层
  243. setTimeout(() => {
  244. LAYER_CONFIG_LIST.forEach((layer) => {
  245. layer.label = layer.name;
  246. layer.type = layer.code;
  247. this.$store.dispatch("globalConfig/pushSwitchConfig", layer); //设置图层开关
  248. });
  249. }, 2000);
  250. },
  251. mounted() {
  252. this.buildingInfo = BUILDING_INFO;
  253. },
  254. methods: {
  255. showInfo() {
  256. return this.show && this.switchConfigShow;
  257. },
  258. openOrClose() {
  259. if (this.show) {
  260. this.show = false;
  261. this.$store.dispatch("globalConfig/setSwitchConfigShow", false);
  262. } else {
  263. this.show = true;
  264. this.$store.dispatch("globalConfig/setSwitchConfigShow", true);
  265. }
  266. console.log("开关状态", this.show, this.switchConfigShow);
  267. return this.show;
  268. },
  269. locationEntity(entityID) {
  270. // console.log(entityID)
  271. const viewer = getViewer();
  272. let datasource = viewer.dataSources._dataSources.find((t) => {
  273. return (
  274. t && (t.name == "layer_" + this.layerID || t.name == this.layerID)
  275. );
  276. });
  277. //console.log(datasource);
  278. if (datasource) {
  279. let target = datasource.entities.getById(entityID);
  280. // console.log(target)
  281. viewer.flyTo(target, {
  282. duration: 1.5,
  283. maximumHeight: 100.0,
  284. offset: {
  285. pitch: -0.6164714757322898,
  286. heading: 0.02675787352876391,
  287. range: 65,
  288. },
  289. });
  290. }
  291. },
  292. openLayerByName(layerName) {
  293. let layer = this.switchConfig.firstOrDefault((l) => {
  294. if (l.name === layerName) {
  295. return l;
  296. }
  297. });
  298. this.show = true;
  299. if (layer) {
  300. layer.show = true;
  301. layer.selected = false;
  302. this.handleChange(true, layer);
  303. }
  304. //this.changeSelectStatus(layer);
  305. },
  306. handleChange(val, layer) {
  307. this.buildCurrentRTTags();
  308. this.$emit("handleAlwaysShow", { layerId: layer.layerId, show: val }); //常驻显示的提示框
  309. console.log("图层开关", val, layer);
  310. const { type, name, layerId } = layer;
  311. if (
  312. [
  313. "防爆扩音",
  314. "埋地泄漏",
  315. "监控探头",
  316. "摄像头",
  317. "泄漏",
  318. "周界",
  319. "火灾",
  320. "风险识别",
  321. "集气站",
  322. "井场",
  323. "汇管",
  324. "井管",
  325. "站间支线",
  326. ].includes(name)
  327. ) {
  328. this.changeLayerDisplay(val, type);
  329. } else if (name == "重大危险源") {
  330. //console.log("重大危险源图层刷新");
  331. this.getWXYList(layerId, val);
  332. } else if (name === "风险区域") {
  333. this.getFXQYList(layerId, val);
  334. } else if (name === "特殊作业" && val) {
  335. this.getWFAll(layerId);
  336. } else if (name === "安全隐患" && val) {
  337. this.getYHAll(layerId);
  338. } else if (name === "建筑名称") {
  339. this.showBuildingInfo(layerId, val);
  340. } else if (name === "人员") {
  341. this.$emit("showPersonLayer", val);
  342. } else if (name === "电子围栏") {
  343. setModelShow(MODEL_ROOF_LIST, !val);
  344. this.changeLayerDisplay(val, type);
  345. } else if (name === "名称标签") {
  346. this.showBuildingInfoByBuildId(layerId, val);
  347. } else if (name === "灭火器") {
  348. //房屋掀顶
  349. setModelShow(MODEL_ROOF_LIST, !val);
  350. }
  351. },
  352. changeLayerDisplay(state, id) {
  353. const viewer = getViewer();
  354. const dataSource = viewer.dataSources.getByName("layer_" + id);
  355. if (dataSource.length) {
  356. const entities = dataSource[0].entities.values;
  357. console.log("选中的所有实体", entities);
  358. entities.forEach((item) => {
  359. item.show = state;
  360. });
  361. let newSwitchConfig = JSON.parse(JSON.stringify(this.switchConfig));
  362. let layer = _.find(newSwitchConfig, (item) => {
  363. return item.code === id;
  364. });
  365. if (!!layer) {
  366. layer.show = state;
  367. this.$store.dispatch("globalConfig/setSwitchConfig", newSwitchConfig);
  368. }
  369. }
  370. },
  371. changeSelectStatus(item) {
  372. item.selected = !item.selected;
  373. this.$store.dispatch("globalConfig/updateSwitchSelected", item);
  374. },
  375. transPosition(pointList = []) {
  376. return pointList.reduce((pre, cur) => {
  377. const { longitude, latitude } = this.buildInfo?.gpsCoordinate0;
  378. const { x, y } = _locate(cur.x, cur.y, { x: longitude, y: latitude });
  379. pre.push([x, y, +cur.z]);
  380. return pre;
  381. }, []);
  382. },
  383. async getWXYList(layerId, show) {
  384. try {
  385. let dataSource = addNewDatasource("zdwxy");
  386. dataSource.entities.removeAll();
  387. if (!show) return;
  388. let res = await getWXYList();
  389. // console.log(res)
  390. this.wxyData = res.data.content;
  391. this.wxyData.forEach((d) => {
  392. d.GPSPoints = this.transPosition([
  393. { x: d.location.x, y: d.location.y, z: 0 },
  394. ]);
  395. // console.log(d)
  396. dataSource.entities.add(
  397. new Entity({
  398. id: d.id,
  399. name: d.name,
  400. show: true,
  401. position: Cartesian3.fromDegrees(...d.GPSPoints[0]),
  402. billboard: {
  403. image:
  404. BASE_URL +
  405. "/Resource/Portrait/2022/01/08/55e6e806417241cd9db9d5c6551f321d.png",
  406. scale: 0.1, //固定值
  407. pixelOffset: new Cartesian2(0, -80),
  408. },
  409. polyline: {
  410. positions: Cartesian3.fromDegreesArrayHeights([
  411. d.GPSPoints[0][0],
  412. d.GPSPoints[0][1],
  413. d.GPSPoints[0][2],
  414. d.GPSPoints[0][0],
  415. d.GPSPoints[0][1],
  416. 0,
  417. ]),
  418. width: 2,
  419. material: new PolylineDashMaterialProperty({
  420. color: Color.CYAN,
  421. }),
  422. },
  423. properties: new PropertyBag({
  424. type: "zdwxy",
  425. details: d,
  426. }),
  427. })
  428. );
  429. });
  430. } catch (err) {
  431. console.log(err);
  432. }
  433. },
  434. async getFXQYList(layerId, show) {
  435. console.log("风险区域图层刷新", layerId);
  436. try {
  437. let dataSource = addNewDatasource("layer_fxqy");
  438. let dataSource2 = addNewDatasource("layer_" + layerId);
  439. dataSource.entities.removeAll();
  440. dataSource2.entities.removeAll();
  441. if (!show) {
  442. setModelShow(MODEL_ROOF_LIST, false);
  443. return;
  444. }
  445. setModelShow(MODEL_ROOF_LIST, false);
  446. let res = await getFXQYList({
  447. buildId: this.buildInfo?.positioningBuildId,
  448. riskLevelArray: ["306001", "306002", "306003", "306004"],
  449. });
  450. // console.log("FXQYInfomation", res);
  451. let tempdata = res.data.content;
  452. let fxqyList = new Array();
  453. if (show) {
  454. this.fxqyData = fxqyList;
  455. } else {
  456. this.fxqyData = [];
  457. }
  458. //遍历区域
  459. tempdata.forEach((a, i) => {
  460. //遍历围栏
  461. a.rails.forEach((r, ii) => {
  462. r.riskLevel = a.riskLevel;
  463. r.riskLevelStr = a.riskLevelStr;
  464. r.GPSPoints = new Array();
  465. //遍历坐标
  466. if (r.points) {
  467. r.points.forEach((p, iii) => {
  468. p.z = -1;
  469. });
  470. r.GPSPoints = this.transPosition(r.points);
  471. fxqyList.push(r);
  472. let color = "#ff0000";
  473. let fillColor = "#ff0000";
  474. switch (r.riskLevel) {
  475. case "306001":
  476. color = "#ff0000";
  477. fillColor = "#ff0000";
  478. break;
  479. case "306002":
  480. color = "#e09213";
  481. fillColor = "#e09213";
  482. break;
  483. case "306003":
  484. color = "#d8c732";
  485. fillColor = "#d8c732";
  486. break;
  487. case "306004":
  488. color = "#001aff";
  489. fillColor = "#001aff";
  490. break;
  491. }
  492. dataSource.entities.add(
  493. new Entity({
  494. id: r.id,
  495. name: r.railName,
  496. show: true,
  497. polygon: {
  498. show: true,
  499. hierarchy: new PolygonHierarchy(
  500. Cartesian3.fromDegreesArrayHeights(
  501. r.GPSPoints.flat(Infinity)
  502. )
  503. ),
  504. material: Color.fromCssColorString(
  505. fillColor || "#fff"
  506. ).withAlpha(0.6),
  507. classificationType: ClassificationType.BOTH,
  508. },
  509. properties: new PropertyBag({
  510. type: "fxqy",
  511. details: r,
  512. }),
  513. })
  514. );
  515. dataSource2.entities.add(
  516. new Entity({
  517. id: r.id,
  518. name: r.railName,
  519. show: true,
  520. polyline: {
  521. show: true,
  522. positions: Cartesian3.fromDegreesArrayHeights(
  523. r.GPSPoints.flat(Infinity)
  524. ),
  525. perPositionHeight: true,
  526. outline: true,
  527. outlineColor:
  528. Color.fromCssColorString(color).withAlpha(0.5),
  529. outlineWidth: 1,
  530. extrudedHeight: -0.01,
  531. material: Color.fromCssColorString(
  532. fillColor || "#fff"
  533. ).withAlpha(0.35),
  534. },
  535. properties: new PropertyBag({
  536. type: "layer_" + layerId,
  537. details: r,
  538. }),
  539. })
  540. );
  541. }
  542. });
  543. });
  544. this.fxqyData = fxqyList;
  545. } catch (err) {
  546. console.log(err);
  547. }
  548. },
  549. async getWFAll(layerId) {
  550. try {
  551. this.tszyData = [];
  552. let res = await getRTData({ tags: ["udp.wf.fn.getAllTask"] });
  553. //console.log(res);
  554. let dataSource = addNewDatasource("layer_" + layerId);
  555. dataSource.entities.removeAll();
  556. res.data.forEach((d, i) => {
  557. let arr = JSON.parse(d.value);
  558. //console.log(arr);
  559. arr.forEach((dvalue) => {
  560. //let dvalue = JSON.parse(d.value)[0];
  561. dvalue.id = dvalue["编号"];
  562. this.tszyData.push(dvalue);
  563. if (dvalue.locationPoint) {
  564. let locationPoint = JSON.parse(dvalue.locationPoint);
  565. let icon = this.tszyIconList.firstOrDefault((i) => {
  566. if (dvalue.process_name.substring(0, 2) === i.name) {
  567. return i;
  568. }
  569. });
  570. if (icon == null) {
  571. icon = this.tszyIconList[7];
  572. }
  573. dataSource.entities.add(
  574. new Entity({
  575. id: dvalue["编号"],
  576. name: dvalue.bizName,
  577. show: true,
  578. position: Cartesian3.fromDegrees(
  579. locationPoint.x,
  580. locationPoint.y,
  581. locationPoint.z + 1
  582. ),
  583. billboard: {
  584. image: BASE_URL + icon.url,
  585. scale: 0.15, //固定值
  586. },
  587. properties: new PropertyBag({
  588. type: "wf",
  589. details: dvalue,
  590. }),
  591. })
  592. );
  593. }
  594. });
  595. });
  596. // console.log(this.tszyData)
  597. } catch (err) {
  598. console.log(err);
  599. }
  600. },
  601. async getYHAll(layerId) {
  602. try {
  603. this.yhData = [];
  604. let res = await getRTData({ tags: ["udp.yh.fn.getAllTask_YH"] });
  605. // console.log(res)
  606. let dataSource = addNewDatasource("layer_" + layerId);
  607. dataSource.entities.removeAll();
  608. res.data.forEach((d, i) => {
  609. let arr = JSON.parse(d.value);
  610. arr.forEach((dvalue) => {
  611. //let dvalue = JSON.parse(d.value)[0];
  612. dvalue.id = dvalue["编号"];
  613. this.yhData.push(dvalue);
  614. if (dvalue.locationPoint) {
  615. let locationPoint = JSON.parse(dvalue.locationPoint);
  616. dataSource.entities.add(
  617. new Entity({
  618. id: dvalue["编号"],
  619. name: dvalue["隐患名称"],
  620. show: true,
  621. position: Cartesian3.fromDegrees(
  622. locationPoint.x,
  623. locationPoint.y,
  624. locationPoint.z
  625. ),
  626. billboard: {
  627. image:
  628. BASE_URL +
  629. "/Resource/Portrait/2022/01/16/15e3b945623745edbc6cad6d1a721cb7.png",
  630. scale: 0.5, //固定值
  631. },
  632. properties: new Cesium.PropertyBag({
  633. type: "wf",
  634. details: dvalue,
  635. }),
  636. })
  637. );
  638. }
  639. });
  640. });
  641. // console.log(this.tszyData)
  642. } catch (err) {
  643. console.log(err);
  644. }
  645. },
  646. showBuildingInfo(layerId, show) {
  647. this.buildingInfoLayerId = "layer_" + layerId;
  648. let dataSource = addNewDatasource(this.buildingInfoLayerId);
  649. if (show) {
  650. if (dataSource.entities.values.length == 0) {
  651. this.buildingInfo.forEach((d) => {
  652. dataSource.entities.add(
  653. new Entity({
  654. id: "buildingName_" + d.id,
  655. //name: d.name,
  656. position: Cartesian3.fromDegrees(d.x, d.y, d.z),
  657. label: {
  658. text: d.name,
  659. show: new CallbackProperty((time, result) => {
  660. return this.buildingNameShowProperty(d.id);
  661. }),
  662. font: "18px Helvetica",
  663. style: LabelStyle.FILL_AND_OUTLINE,
  664. pixelOffset: new Cartesian2(0, -18),
  665. fillColor: Color.WHITE,
  666. outlineColor: Color.BLACK,
  667. outlineWidth: 2,
  668. horizontalOrigin: HorizontalOrigin.CENTER,
  669. verticalOrigin: VerticalOrigin.TOP,
  670. //scaleByDistance: new NearFarScalar(1, 2.6, 800, 0),
  671. },
  672. properties: new PropertyBag({
  673. type: "buildingName",
  674. details: d,
  675. }),
  676. })
  677. );
  678. dataSource.entities.add(
  679. new Entity({
  680. id: "buildingPerson_" + d.id,
  681. //name: d.name,
  682. position: Cartesian3.fromDegrees(d.x, d.y, d.z),
  683. label: {
  684. text: new CallbackProperty((time, result) => {
  685. return this.getPersonCount(d.id);
  686. }),
  687. show: new CallbackProperty((time, result) => {
  688. return this.buildingNameShowProperty(d.id);
  689. }),
  690. font: "18px Helvetica",
  691. style: LabelStyle.FILL,
  692. pixelOffset: new Cartesian2(0, -42),
  693. fillColor: Color.WHITE,
  694. backgroundColor: Color.DARKBLUE, //Color.WHITE, //背景颜色
  695. showBackground: true, //是否显示背景颜色
  696. outlineColor: Color.BLACK,
  697. outlineWidth: 2,
  698. horizontalOrigin: HorizontalOrigin.CENTER,
  699. verticalOrigin: VerticalOrigin.TOP,
  700. //scaleByDistance: new NearFarScalar(1, 2.6, 800, 0),
  701. },
  702. properties: new PropertyBag({
  703. type: "buildingPerson",
  704. details: d,
  705. }),
  706. })
  707. );
  708. });
  709. } else {
  710. dataSource.show = true;
  711. }
  712. } else {
  713. dataSource.show = false;
  714. }
  715. },
  716. showBuildingInfoByBuildId(layerId, show) {
  717. this.buildingInfoLayerId = "layer_" + layerId + "_" + this.buildId;
  718. let dataSource = addNewDatasource(this.buildingInfoLayerId);
  719. if (show) {
  720. if (dataSource.entities.values.length == 0) {
  721. if (
  722. !!this.buildId &&
  723. !!BuildLabels[this.buildId] &&
  724. !!BuildLabels[this.buildId].length
  725. ) {
  726. BuildLabels[this.buildId].forEach((d) => {
  727. // console.log(d)
  728. dataSource.entities.add(
  729. new Entity({
  730. position: Cartesian3.fromDegrees(d.x, d.y, d.z),
  731. label: {
  732. text: d.name,
  733. show,
  734. font: "18px Helvetica",
  735. style: LabelStyle.FILL_AND_OUTLINE,
  736. pixelOffset: new Cartesian2(0, -20),
  737. fillColor: Color.MEDIUMSPRINGGREEN,
  738. outlineColor: Color.BLACK,
  739. outlineWidth: 2,
  740. horizontalOrigin: HorizontalOrigin.CENTER,
  741. verticalOrigin: VerticalOrigin.TOP,
  742. scaleByDistance: new NearFarScalar(1, 2, 500, 0.5),
  743. },
  744. properties: new PropertyBag({
  745. type: "buildingName",
  746. details: d,
  747. }),
  748. })
  749. );
  750. });
  751. }
  752. } else {
  753. dataSource.show = true;
  754. }
  755. } else {
  756. dataSource.show = false;
  757. }
  758. },
  759. buildingNameShowProperty(id) {
  760. return this.$parent.building.curBuildingId != id;
  761. },
  762. getPersonCount(id) {
  763. return !!this.$parent.buildingPersonCount[id]
  764. ? this.$parent.buildingPersonCount[id].PersonCount.toString()
  765. : "0";
  766. },
  767. buildCurrentRTTags() {
  768. this.curRTTags = [];
  769. this.switchConfig.forEach((s) => {
  770. if (s.show) {
  771. if (!!this.rtTag["layer_" + s.layerId]) {
  772. this.curRTTags = _.concat(
  773. this.curRTTags,
  774. this.rtTag["layer_" + s.layerId]
  775. );
  776. }
  777. }
  778. });
  779. // console.log(this.curRTTags);
  780. },
  781. async getNormalRTData() {
  782. try {
  783. if (this.curRTTags.length) {
  784. let res = await getRTData({ tags: this.curRTTags });
  785. this.$store.dispatch("globalConfig/updateRTData", res.data);
  786. }
  787. } catch (err) {
  788. console.log(err);
  789. }
  790. setTimeout(() => {
  791. this.getNormalRTData();
  792. }, 3000);
  793. },
  794. },
  795. };
  796. </script>
  797. <style lang="less" scoped>
  798. .dialog-container {
  799. position: absolute;
  800. left: 0;
  801. top: 50%;
  802. transform: translate(0, -50%);
  803. box-sizing: border-box;
  804. .small-box {
  805. width: 188.156px /* 171/192 */;
  806. height: 645px /* 645/192 */;
  807. background-image: url(~@/assets/imgs/dialog/btn_leftsidebar_hlt@2x.png);
  808. background-repeat: no-repeat;
  809. background-size: 100% 100%;
  810. pointer-events: auto;
  811. }
  812. .big-box {
  813. width: 545.391px /* 507/192 */;
  814. height: 645px /* 645/192 */;
  815. background-image: url(~@/assets/imgs/dialog/btn_leftsidebar_hlt2@2x.png);
  816. background-repeat: no-repeat;
  817. background-size: 100% 100%;
  818. pointer-events: auto;
  819. .selected-detail {
  820. width: 384px /* 360/192 */;
  821. height: 100%;
  822. position: absolute;
  823. right: 0;
  824. .line {
  825. width: 1px /* 1/192 */;
  826. height: 628px /* 628/192 */;
  827. background-image: url(~@/assets/imgs/dialog/Line@2x.png);
  828. background-repeat: no-repeat;
  829. background-size: 100% 100%;
  830. margin: 8px /* 8/192 */ 10px /* 10/192 */;
  831. position: absolute;
  832. }
  833. .detail-box {
  834. width: 317.75px /* 264/192 */;
  835. height: 100%;
  836. margin-left: 27px;
  837. padding-top: 30px /* 30/192 */;
  838. .detail-search-box {
  839. // display: flex;
  840. padding: 15px /* 15/192 */ 0;
  841. .search-item {
  842. width: 100%;
  843. height: 28px /* 28/192 */;
  844. display: flex;
  845. align-items: center;
  846. margin-top: 15px /* 15/192 */;
  847. span {
  848. width: 70px /* 70/192 */;
  849. height: 28px /* 28/192 */;
  850. line-height: 28px /* 28/192 */;
  851. color: #fff;
  852. text-align: center;
  853. font-size: 14px /* 14/192 */;
  854. }
  855. .el-input {
  856. ::v-deep .el-input__inner {
  857. // width: 0.572917px/* 110/192 */;
  858. height: 28px /* 28/192 */;
  859. border-radius: 0;
  860. background: rgba(0, 0, 0, 0.4);
  861. border: 1px /* 1/192 */ solid #a8c1be;
  862. color: #fff;
  863. // padding-right: 0.182292px/* 35/192 */;
  864. }
  865. }
  866. }
  867. .search-btn-box {
  868. width: 100%;
  869. height: 28px /* 28/192 */;
  870. display: flex;
  871. justify-content: center;
  872. margin-top: 15px /* 15/192 */;
  873. .search-btn {
  874. width: 70px /* 70/192 */;
  875. height: 28px /* 28/192 */;
  876. line-height: 28px /* 28/192 */;
  877. text-align: center;
  878. font-size: 14px /* 14/192 */;
  879. color: #fff;
  880. background: rgba(0, 25, 22, 0.65);
  881. border: 1px /* 1/192 */ solid #cff3ef;
  882. cursor: pointer;
  883. }
  884. }
  885. }
  886. }
  887. }
  888. }
  889. .show-click-box {
  890. width: 31px /* 31/192 */;
  891. height: 645px /* 645/192 */;
  892. position: absolute;
  893. right: 0;
  894. z-index: 1000;
  895. cursor: pointer;
  896. }
  897. .switch-box {
  898. width: 152px /* 140/192 */;
  899. height: 645px /* 645/192 */;
  900. display: flex;
  901. flex-direction: column;
  902. position: absolute;
  903. left: 0;
  904. padding-top: 30px /* 30/192 */;
  905. padding-left: 10px /* 10/192 */;
  906. .switch-row {
  907. width: 100%;
  908. height: 40px /* 40/192 */;
  909. line-height: 40px /* 40/192 */;
  910. display: flex;
  911. justify-content: space-around;
  912. align-items: center;
  913. font-size: 13px;
  914. span {
  915. display: inline-block;
  916. width: 76.8px /* 50/192 */;
  917. color: #fff;
  918. }
  919. .el-switch {
  920. width: 30px /* 30/192 */;
  921. height: 14px /* 14/192 */;
  922. line-height: 14px /* 14/192 */;
  923. ::v-deep .el-switch__core {
  924. width: 30px !important/* 30/192 */;
  925. height: 14px /* 14/192 */;
  926. line-height: 14px /* 14/192 */;
  927. }
  928. ::v-deep .el-switch__core::after {
  929. width: 14px /* 14/192 */;
  930. height: 14px /* 14/192 */;
  931. margin-left: -14px /* 14/192 */;
  932. // top: -0.005208px/* 1/192 */;
  933. left: 14px /* 14/192 */;
  934. margin-top: -2px /* 2/192 */;
  935. margin-bottom: 2px /* 2/192 */;
  936. }
  937. }
  938. i {
  939. display: inline-block;
  940. width: 16px /* 16/192 */;
  941. height: 14px /* 14/192 */;
  942. cursor: pointer;
  943. &.normal-icon {
  944. background: url(~@/assets/imgs/dialog/icon_list_hlt@2x.png) no-repeat;
  945. background-size: 100% 100%;
  946. }
  947. &.selected-icon {
  948. background: url(~@/assets/imgs/dialog/icon_list_nor@2x.png) no-repeat;
  949. background-size: 100% 100%;
  950. }
  951. }
  952. .el-switch.is-checked {
  953. ::v-deep .el-switch__core::after {
  954. width: 14px /* 14/192 */;
  955. height: 14px /* 14/192 */;
  956. left: 30px /* 30/192 */;
  957. margin-top: -2px /* 2/192 */;
  958. margin-bottom: 2px /* 2/192 */;
  959. }
  960. }
  961. }
  962. }
  963. .hide-box {
  964. width: 31px /* 31/192 */;
  965. height: 645px /* 645/192 */;
  966. background-image: url(~@/assets/imgs/dialog/btn_leftsidebar_nor@2x.png);
  967. background-repeat: no-repeat;
  968. background-size: 100% 100%;
  969. pointer-events: auto;
  970. cursor: pointer;
  971. }
  972. }
  973. </style>