App.vue 8.0 KB

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