App.vue 6.4 KB

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