App.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <div id="app">
  3. <div :id="`fengMap${id}`" class="fengMap"></div>
  4. <router-view />
  5. </div>
  6. </template>
  7. <script>
  8. import { mapGetters, mapActions, mapMutations } from "vuex";
  9. import { SFengParser } from "@saga-web/feng-map";
  10. import { setFloor } from "@/api/public.js";
  11. window.fengmapData = null;
  12. export default {
  13. data() {
  14. return {
  15. view: "",
  16. scene: "",
  17. id: "2",
  18. canvasID: "",
  19. key: "23f30a832a862c58637a4aadbf50a566",
  20. appName: "万达可视化系统",
  21. mapServerURL: `http://map.wanda.cn/editor`,
  22. mapthemeUrl: `http://map.wanda.cn/editor/webtheme`,
  23. isMounted: false,
  24. plazaIds: ""
  25. };
  26. },
  27. /**
  28. * 刷新保存vuex信息
  29. */
  30. created() {
  31. this.$store.replaceState(
  32. Object.assign(
  33. this.$store.state,
  34. JSON.parse(localStorage.getItem("beforeunload"))
  35. )
  36. );
  37. // 刷新时,将haveFengMap 置为false,解决设备设施页面,刷新时不出新楼层图的问题
  38. this.SETHAVEFENGMAP(false);
  39. localStorage.removeItem("beforeunload");
  40. window.addEventListener("beforeunload", () => {
  41. let state = JSON.stringify(this.$store.state);
  42. localStorage.setItem("beforeunload", state);
  43. });
  44. },
  45. mounted() {
  46. this.isMounted = true;
  47. this.plazaIds = localStorage.getItem("PLAZAID");
  48. },
  49. computed: {
  50. ...mapGetters(["plazaId", "fmapID", "haveFengMap", "accessLevel"])
  51. },
  52. methods: {
  53. ...mapActions(["getfmapID"]),
  54. ...mapMutations(["SETHAVEFENGMAP"]),
  55. getFengMap() {
  56. this.getfmapID().then(() => {
  57. this.getMap();
  58. });
  59. },
  60. getMap() {
  61. //如果项目为 南昌八一路 长春重庆路 青岛台东路 则不走楼层缓存接口
  62. // if(this.plazaIds == "1001064" || this.plazaIds == "1001065" || this.plazaIds == "1001066"){
  63. // let arr = ["b2","b1","f1","f2","f3","f4","f5","f6","g80"];
  64. // setFloor({ plazaId: this.plazaIds }, arr)
  65. // .then(res => {
  66. // console.log("缓存楼层", res);
  67. // })
  68. // .catch(error => {
  69. // console.log("缓存楼层", error);
  70. // });
  71. // return
  72. // }
  73. window.fengmapData = new SFengParser(
  74. `fengMap${this.id}`,
  75. `${this.mapServerURL}/fmap/${this.fmapID}`,
  76. this.key,
  77. this.appName,
  78. null,
  79. this.mapthemeUrl
  80. );
  81. window.fengmapData.loadMap(this.fmapID, (a, b) => {
  82. const dataArr = b.map(item => {
  83. return item.gname;
  84. });
  85. // 获取主题数据
  86. window.fengmapData
  87. .loadTheme(
  88. `${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`
  89. )
  90. .then(res => {
  91. this.SETHAVEFENGMAP();
  92. });
  93. // 缓存楼层数据
  94. if (dataArr.length) {
  95. //如果项目为 南昌八一路 长春重庆路 青岛台东路 则不走楼层缓存接口
  96. if(this.plazaIds == "1001064" || this.plazaIds == "1001065" || this.plazaIds == "1001066"){
  97. let arr = ["b2","b1","f1","f2","f3","f4","f5","f6","g80"];
  98. alert('12313')
  99. setFloor({ plazaId: this.plazaIds }, arr)
  100. .then(res => {
  101. console.log("缓存楼层", res);
  102. })
  103. .catch(error => {
  104. console.log("缓存楼层", error);
  105. });
  106. return
  107. }
  108. setFloor({ plazaId: this.plazaIds }, dataArr)
  109. .then(res => {
  110. console.log("缓存楼层", res);
  111. })
  112. .catch(error => {
  113. console.log("缓存楼层", error);
  114. });
  115. }
  116. });
  117. }
  118. },
  119. watch: {
  120. plazaIds(plazaId) {
  121. console.log("获取到id", plazaId);
  122. window.fengmapData = null;
  123. // 当获取到到项目id,请求底图
  124. if (plazaId) {
  125. // 请求该项目下的楼层数据
  126. this.getFengMap();
  127. } else {
  128. window.fengmapData = null;
  129. }
  130. },
  131. isMounted(isMounted) {
  132. if (isMounted && this.plazaIds) {
  133. this.getFengMap();
  134. }
  135. }
  136. }
  137. };
  138. </script>
  139. <style lang="less">
  140. body,
  141. h1,
  142. h2,
  143. h3,
  144. h4,
  145. h5,
  146. h6,
  147. hr,
  148. p,
  149. blockquote,
  150. dl,
  151. dt,
  152. dd,
  153. ul,
  154. ol,
  155. li,
  156. pre,
  157. form,
  158. fieldset,
  159. legend,
  160. button,
  161. input,
  162. textarea,
  163. th,
  164. td {
  165. margin: 0;
  166. padding: 0;
  167. }
  168. body,
  169. button,
  170. input,
  171. select,
  172. textarea {
  173. font: 12px/1.5 Arial, "Microsoft YaHei", "\65b0\5b8b\4f53";
  174. }
  175. h1,
  176. h2,
  177. h3,
  178. h4,
  179. h5,
  180. h6 {
  181. font-size: 100%;
  182. }
  183. address,
  184. cite,
  185. dfn,
  186. var,
  187. em,
  188. i,
  189. u {
  190. font-style: normal;
  191. }
  192. ol,
  193. ul {
  194. list-style: none;
  195. }
  196. a {
  197. text-decoration: none;
  198. }
  199. a:hover {
  200. text-decoration: underline;
  201. }
  202. img {
  203. border: none;
  204. vertical-align: middle;
  205. }
  206. :focus {
  207. outline: 0;
  208. }
  209. button,
  210. input,
  211. select,
  212. textarea {
  213. font-size: 100%;
  214. }
  215. table {
  216. border-collapse: collapse;
  217. border-spacing: 0;
  218. }
  219. /* 滚动条样式 */
  220. body ::-webkit-scrollbar {
  221. width: 5px;
  222. height: 8px;
  223. }
  224. body ::-webkit-scrollbar-track {
  225. background-color: rgba(0, 0, 0, 0);
  226. border-radius: 3px;
  227. }
  228. body ::-webkit-scrollbar-thumb {
  229. border-radius: 3px;
  230. background: #e6e6e6;
  231. border: 1px solid #e6e6e6;
  232. }
  233. body ::-webkit-scrollbar-thumb:vertical:hover {
  234. background: #e6e6e6;
  235. border: 1px solid #e6e6e6;
  236. }
  237. #app {
  238. //meri-design组件select的字体颜色
  239. /deep/ .p-select-fakePlaceholder {
  240. span {
  241. span {
  242. color: #606266 !important;
  243. font-size: 13px;
  244. font-weight: normal;
  245. }
  246. }
  247. }
  248. //element 分页组件背景色
  249. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  250. background: linear-gradient(
  251. 180deg,
  252. rgba(54, 156, 247, 1) 0%,
  253. rgba(2, 91, 170, 1) 100%
  254. );
  255. }
  256. //element button
  257. /deep/ .el-button--primary,
  258. .p-button-primary {
  259. background: linear-gradient(
  260. 180deg,
  261. rgba(54, 156, 247, 1) 0%,
  262. rgba(2, 91, 170, 1) 100%
  263. );
  264. }
  265. }
  266. .clearfix::after {
  267. content: ".";
  268. display: block;
  269. height: 0;
  270. clear: both;
  271. visibility: hidden;
  272. }
  273. .clearfix {
  274. zoom: 1;
  275. }
  276. .left {
  277. float: left;
  278. }
  279. .right {
  280. float: right;
  281. }
  282. html,
  283. body {
  284. width: 100%;
  285. height: 100%;
  286. // min-width: 1920px;
  287. // background: url('./assets/images/back.jpg') no-repeat;
  288. }
  289. #app {
  290. height: 100%;
  291. width: 100%;
  292. position: relative;
  293. .fengMap {
  294. position: fixed;
  295. width: 100px;
  296. height: 100px;
  297. z-index: -1;
  298. opacity: 0;
  299. }
  300. }
  301. // element表头背景颜色修改
  302. .core-device-report,
  303. .specification-update-record {
  304. .el-table thead th {
  305. background-color: #f8f9fa;
  306. }
  307. .el-pagination.is-background .el-pager li:not(.disabled).active {
  308. background: linear-gradient(
  309. 180deg,
  310. rgba(54, 156, 247, 1) 0%,
  311. rgba(2, 91, 170, 1) 100%
  312. );
  313. }
  314. }
  315. // 说明书更新记录 element 时间控件样式重写
  316. .specification-update-record,
  317. .core-device-report {
  318. .el-input__inner {
  319. height: 32px;
  320. line-height: 32px;
  321. }
  322. .el-date-editor .el-range__icon,
  323. .el-date-editor .el-range-separator {
  324. line-height: 26px;
  325. width: 8%;
  326. }
  327. }
  328. .el-dialog__header {
  329. border-bottom: 1px solid rgba(239, 240, 241, 1);
  330. }
  331. .gantt-chart .el-dialog__title {
  332. font-weight: 500;
  333. }
  334. .img-detail-container {
  335. .el-dialog__body {
  336. padding-top: 0;
  337. padding-bottom: 0;
  338. padding-right: 0;
  339. }
  340. }
  341. </style>