App.vue 5.9 KB

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