App.vue 8.5 KB

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