App.vue 6.0 KB

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