index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <!-- 设备设施 -->
  3. <div id='equipment'>
  4. <!-- 顶部八个子系统导航 -->
  5. <div class='eq-top'>
  6. <span class='eq-system' v-for='(item,index) in system' :class='item.id==systemId?"isActive":""' :key='index' @click='tabSyatem(item)'>
  7. <img :src='item.id==systemId?item.icon1:item.icon' />
  8. {{item.name}}
  9. </span>
  10. </div>
  11. <div class='eq-bottom'>
  12. <!-- 左侧选择,系统原理图等,点击进入弹窗 -->
  13. <div class='eq-left'>
  14. <ul v-for='(eve,index) in everySystem' :key='"o"+index'>
  15. <li class='li-style' :class='{"is-active": eve.id}' @click='dialogVisible(eve)'>
  16. <span class='circle'></span>
  17. <span class='hanzi'>{{eve.label}}</span>
  18. </li>
  19. </ul>
  20. </div>
  21. <!-- 右侧楼层图主体 -->
  22. <div class='eq-right'>
  23. <div class='eq-right-bottom'>
  24. <div class='title-box'>
  25. <div class='eq-title'>
  26. <span class='span1'>{{floorInfo.code}}</span>
  27. </div>
  28. </div>
  29. <div class='eq-content'>
  30. <floorMap ref='floorMap' :id='"equip"' :loadName='loadName' :type='"system"'></floorMap>
  31. <div class='legend-boxs'>
  32. <Legend
  33. :key='keyLd'
  34. :systemName='systemName'
  35. :floors='floorsArr'
  36. type='1'
  37. :editTips='`编辑${floorInfo.code}层${systemName}平面图`'
  38. ></Legend>
  39. <!-- 楼层切换组件 -->
  40. <floor-list :key='keyFL' v-if='floorsArr.length>0' :floorsArr='floorsArr' @emitFloor='emitFloor' id='system'></floor-list>
  41. <div class='additional-box' ref="additionalBox" v-if='fqPic.length>0'>
  42. <div class='additional2' @click='additionalColl' v-if='showView===3'>
  43. <img src='../../assets/imgs/bg2.png' alt />
  44. </div>
  45. <div class='additional' @click='additionalColl' v-else>
  46. <img src='../../assets/imgs/bg.png' alt />
  47. </div>
  48. <el-collapse-transition>
  49. <div v-show='showView===3' class='add-img-container' ref="addImgContainer" :style="`bottom: ${bottomOffset}px;`">
  50. <div class='add-img' ref="addImg">
  51. <img :src='fqPic[0].url' alt />
  52. </div>
  53. </div>
  54. </el-collapse-transition>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <!-- 使用 v-if解决弹窗未展示时,会调用接口的问题 -->
  62. <eq-dialog v-if='ShowDialog' ref='dialog' :systemName='systemName' :smsxt='smsxt' @emitCount='emitCount' @closeModal='closeModal'></eq-dialog>
  63. </div>
  64. </template>
  65. <script>
  66. import floorList from '@/components/floorList.vue'
  67. import floorMap from '@/components/floorMap/index.vue'
  68. import eqDialog from './eqDialog'
  69. import editList from '@/components/edit.vue'
  70. import { system } from '@/utils/plugins/components.js'
  71. import { queryPic,getPvUv } from '@/api/public.js'
  72. import { mapGetters } from 'vuex'
  73. import store from '../../store'
  74. export default {
  75. data() {
  76. return {
  77. system,
  78. everySystem: [],
  79. systemId: 1,
  80. categoryId: 'GDXT',
  81. systemName: '供电系统',
  82. floorInfo: {
  83. gname: 'f1',
  84. code: 'F1'
  85. },
  86. smsxt: '1001',
  87. dialogInfo: {},
  88. brand: [], //品牌
  89. manufacturer: [],
  90. fqPic: [],
  91. loadName: '',
  92. type: '',
  93. objCount: [],
  94. bottomOffset: 0,
  95. keyFL: 'keyFL' + new Date().getTime(),
  96. keyLd: 'keyLd_' + new Date().getTime(),
  97. ShowDialog: false //是否显示弹窗
  98. }
  99. },
  100. components: { floorList, eqDialog, floorMap, editList },
  101. watch: {
  102. // 监听currentFloor变化,重新渲染楼层组件,解决 数据与视图不照应的问题
  103. /* '$store.state.currentFloor': {
  104. handler(newV, oldV) {
  105. if (newV.seq !== oldV.seq) {
  106. // TODO: keyFL更新
  107. this.keyFL = 'keyFL' + new Date().getTime()
  108. }
  109. }
  110. } */
  111. },
  112. methods: {
  113. // 查询tab页
  114. tabSyatem(item) {
  115. this.systemId = item.id
  116. this.everySystem = item.children
  117. this.systemName = item.name
  118. this.smsxt = item.smsxt
  119. this.$cookie.set('categoryId', item.categoryId, 3)
  120. store.commit('SETCATEGORYID', item.categoryId)
  121. this.$refs.floorMap.init(this.floorInfo.gname)
  122. this.querySmsxt()
  123. this.viewLengend();
  124. // 发送pvUv
  125. let data = {
  126. type: "equipmentRouter",
  127. target: item.name,
  128. parameter: item.categoryId
  129. };
  130. getPvUv(data)
  131. .then(res => {
  132. console.log("pvuv", res);
  133. })
  134. .catch(res => {
  135. console.log("error", res);
  136. });
  137. },
  138. querySmsxt() {
  139. // 目前消防和弱电下面有特殊的数据表格
  140. if (this.smsxt == '1003' || this.smsxt == '1004') {
  141. this.queryTable(this.smsxt)
  142. }
  143. },
  144. //判断有没有原理图,如果没有则不出现系统原理图列表li
  145. emitCount(objCount) {
  146. this.objCount = objCount
  147. },
  148. emitFloor(item) {
  149. this.floorInfo = item
  150. this.$refs.floorMap.init(this.floorInfo.gname)
  151. this.init()
  152. this.querySmsxt()
  153. },
  154. dialogVisible(eve) {
  155. // console.log('dialogVisible')
  156. console.log(eve)
  157. // 点击后显示弹窗组件
  158. if (eve.label != '查看图纸') {
  159. this.ShowDialog = true
  160. this.$nextTick(() => {
  161. this.$refs.dialog.showModal(eve)
  162. })
  163. // pvuv接口记录
  164. let data = {
  165. type: "modal",
  166. target: eve.id,
  167. parameter: eve.label
  168. };
  169. getPvUv(data)
  170. .then(res => {
  171. console.log("pvuv", res);
  172. })
  173. .catch(res => {
  174. console.log("error", res);
  175. });
  176. }
  177. },
  178. /**
  179. * 关闭弹窗后,重新渲染 楼层组件
  180. * 在父组件(本组件)内将 ShowDialog 置为false
  181. * @param {Boolean} flag 弹窗组件传回的标志: 一直传回 true
  182. */
  183. closeModal(flag) {
  184. this.ShowDialog = false
  185. this.keyFL = 'keyFL' + new Date().getTime()
  186. this.keyLd = 'keyLd' + new Date().getTime()
  187. },
  188. //附加数据图片查看 showView为3展示状态
  189. additionalColl() {
  190. if (this.showView != 3) {
  191. this.$store.commit('SETSHOWVIEW', 3)
  192. this.$nextTick(() => {
  193. let p = this.$refs.additionalBox.offsetTop;
  194. let d = this.$refs.addImgContainer.offsetHeight;
  195. let bottomOffset = p + 44 - d;
  196. if (bottomOffset >= 0) {
  197. this.bottomOffset = 0;
  198. } else {
  199. this.bottomOffset = bottomOffset;
  200. }
  201. })
  202. } else {
  203. this.$store.commit('SETSHOWVIEW', 0)
  204. }
  205. },
  206. // 查询附加数据图片
  207. queryTable(system) {
  208. this.fqPic = []
  209. let picFloor = this.$cookie.get('floorMapId')
  210. let getParams = {
  211. module: '1003',
  212. floor: picFloor,
  213. system: system,
  214. plazaId: this.plazaId
  215. }
  216. queryPic({ getParams }).then(res => {
  217. // console.log('附加数据', res)
  218. this.fqPic = res.data
  219. })
  220. },
  221. init() {
  222. this.loadName = `设备设施-${this.systemName}-${this.floorInfo.code}`
  223. },
  224. // 从设备设施进入的机房
  225. queryType(val) {
  226. this.type = val
  227. },
  228. viewLengend() {
  229. if (this.legendTable.length > 0) {
  230. this.$store.commit('SETSHOWVIEW', 1)
  231. } else {
  232. this.$store.commit('SETSHOWVIEW', 0)
  233. }
  234. },
  235. smsxtQuery() {
  236. if (this.smsxt == '1001') {
  237. this.$cookie.set('categoryId', 'GDXT')
  238. } else if (this.smsxt == '1002') {
  239. this.$cookie.set('categoryId', 'NTXT')
  240. } else if (this.smsxt == '1003') {
  241. this.$cookie.set('categoryId', 'XFXT')
  242. } else if (this.smsxt == '1004') {
  243. this.$cookie.set('categoryId', 'RDXT')
  244. } else if (this.smsxt == '1005') {
  245. this.$cookie.set('categoryId', 'JPSXT')
  246. } else if (this.smsxt == '1006') {
  247. this.$cookie.set('categoryId', 'DTXT')
  248. } else if (this.smsxt == '1007') {
  249. this.$cookie.set('categoryId', 'RQYL')
  250. } else {
  251. this.$cookie.set('categoryId', 'SCPZ')
  252. }
  253. }
  254. },
  255. /* mounted() {
  256. if (this.$route.query.smsxt) {
  257. this.smsxt = this.$route.query.smsxt
  258. this.system.forEach(el => {
  259. if (el.smsxt == this.smsxt) {
  260. this.everySystem = el.children
  261. this.systemName = el.name
  262. this.systemId = el.id
  263. }
  264. })``
  265. }
  266. this.everySystem = this.system[0].children
  267. this.init()
  268. this.$refs.floorMap.init(this.floorInfo.gname)
  269. }, */
  270. mounted() {
  271. window._vm = this
  272. if (this.$route.query.smsxt) {
  273. console.log(this.$route.query.smsxt)
  274. this.smsxt = this.$route.query.smsxt
  275. this.smsxtQuery()
  276. this.system.forEach(el => {
  277. if (el.smsxt == this.smsxt) {
  278. this.everySystem = el.children
  279. this.systemName = el.name
  280. this.systemId = el.id
  281. }
  282. })
  283. }
  284. this.everySystem = this.system[0].children
  285. // 刷新时,store中有categoryId时,选中子系统状态
  286. if (this.$store.state.categoryId) {
  287. let item = this.system.filter(item => item.categoryId === this.$store.state.categoryId)[0]
  288. this.systemId = item.id
  289. this.everySystem = item.children
  290. this.systemName = item.name
  291. this.smsxt = item.smsxt
  292. // this.$refs.floorMap.init(this.floorInfo.gname)
  293. this.querySmsxt()
  294. this.viewLengend()
  295. }
  296. this.init()
  297. console.log(this.floorInfo.gname)
  298. this.$refs.floorMap.init(this.floorInfo.gname)
  299. },
  300. computed: {
  301. ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable'])
  302. }
  303. }
  304. </script>
  305. <style lang="less" scoped>
  306. #equipment {
  307. background: rgba(242, 245, 247, 1);
  308. display: flex;
  309. flex: 1;
  310. overflow: hidden;
  311. color: #1f2429;
  312. .eq-top {
  313. // margin-left: 260px;
  314. width: 100%;
  315. padding-top: 24px;
  316. position: fixed;
  317. z-index: 3;
  318. display: flex;
  319. justify-content: center;
  320. .eq-system {
  321. padding: 12px 20px;
  322. background: #fff;
  323. font-size: 16px;
  324. cursor: pointer;
  325. img {
  326. width: 16px;
  327. height: 16px;
  328. margin-right: 4px;
  329. margin-bottom: 3px;
  330. }
  331. }
  332. .isActive {
  333. color: #025baa;
  334. font-weight: bolder;
  335. background: linear-gradient(360deg, rgba(2, 91, 170, 0.1) 0%, rgba(2, 91, 170, 0) 100%);
  336. }
  337. }
  338. .eq-bottom {
  339. display: flex;
  340. flex: 1;
  341. .eq-left {
  342. position: fixed;
  343. z-index: 2;
  344. width: 260px;
  345. padding-top: 100px;
  346. color: #646c73;
  347. font-size: 14px;
  348. height: 100%;
  349. background: rgba(242, 245, 247, 1);
  350. }
  351. .li-style {
  352. margin-left: 28px;
  353. cursor: pointer;
  354. .circle {
  355. width: 6px;
  356. height: 6px;
  357. background: linear-gradient(180deg, rgba(54, 156, 247, 0.6) 0%, rgba(2, 91, 170, 0.6) 100%);
  358. border-radius: 50%;
  359. display: inline-block;
  360. margin-right: 10px;
  361. }
  362. .hanzi {
  363. padding: 10px 0 10px 6px;
  364. width: 200px;
  365. display: inline-block;
  366. &:hover {
  367. color: rgba(2, 91, 170, 1);
  368. background: linear-gradient(270deg, rgba(199, 217, 234, 0) 0%, rgba(199, 217, 234, 1) 100%);
  369. }
  370. }
  371. }
  372. .eq-right {
  373. flex: 1;
  374. .eq-right-bottom {
  375. display: flex;
  376. flex: 1;
  377. height: 100%;
  378. .title-box {
  379. position: fixed;
  380. z-index: 2;
  381. top: 146px;
  382. left: 260px;
  383. display: flex;
  384. img {
  385. margin-top: -5px;
  386. }
  387. .eq-title {
  388. width: 140px;
  389. height: 32px;
  390. background: linear-gradient(270deg, rgba(199, 217, 234, 0) 0%, rgba(199, 217, 234, 1) 100%);
  391. box-shadow: -6px 2px 8px 0px rgba(31, 36, 41, 0.1);
  392. color: #025baa;
  393. font-size: 16px;
  394. &::before {
  395. width: 2px;
  396. height: 16px;
  397. background: rgba(2, 91, 170, 1);
  398. display: inline-block;
  399. content: '';
  400. margin-right: 10px;
  401. margin-top: 8px;
  402. }
  403. .span1 {
  404. position: absolute;
  405. top: 3px;
  406. }
  407. }
  408. }
  409. .eq-content {
  410. flex: 1;
  411. .legend-boxs {
  412. position: fixed;
  413. z-index: 9;
  414. right: 32px;
  415. top: 142px;
  416. }
  417. .additional-box {
  418. position: relative;
  419. margin-top: 8px;
  420. .additional,
  421. .additional2 {
  422. width: 44px;
  423. height: 44px;
  424. border-radius: 2px;
  425. display: flex;
  426. justify-content: center;
  427. align-items: center;
  428. cursor: pointer;
  429. img {
  430. width: 20px;
  431. height: 20px;
  432. }
  433. }
  434. .additional {
  435. background: rgba(255, 255, 255, 1);
  436. box-shadow: 0px 2px 15px 0px rgba(31, 36, 41, 0.08);
  437. }
  438. .additional2 {
  439. background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
  440. box-shadow: 0px 2px 15px 0px rgba(31, 36, 41, 0.08);
  441. }
  442. .add-img-container {
  443. width: 560px;
  444. max-height: 768px;
  445. overflow-y: auto;
  446. background: #ffffff;
  447. -webkit-box-shadow: 0px 2px 8px 0px rgba(31, 36, 41, 0.06);
  448. box-shadow: 0px 2px 8px 0px rgba(31, 36, 41, 0.06);
  449. border-radius: 2px;
  450. border: 1px solid #e4e5e7;
  451. position: absolute;
  452. right: 48px;
  453. bottom: 0;
  454. padding: 20px;
  455. &::-webkit-scrollbar {
  456. display: none;
  457. }
  458. .add-img {
  459. width: 100%;
  460. height: 100%;
  461. overflow: hidden;
  462. img {
  463. width: 100%;
  464. display: block;
  465. margin: 0 auto;
  466. }
  467. }
  468. }
  469. }
  470. }
  471. }
  472. }
  473. }
  474. }
  475. @media screen and (max-width: 1600px) {
  476. /*当屏幕尺寸小于1366px时,应用下面的CSS样式*/
  477. .eq-top {
  478. margin-left: 0 !important;
  479. }
  480. #equipment .eq-bottom .eq-right .eq-right-bottom .eq-content .additional-box .add-img-container {
  481. max-height: 546px;
  482. }
  483. }
  484. </style>
  485. <style lang="less">
  486. .el-table {
  487. th {
  488. background: rgba(248, 249, 250, 1);
  489. font-size: 12px;
  490. padding: 8px 0;
  491. color: #646a73;
  492. }
  493. td {
  494. font-size: 14px;
  495. color: #1f2429;
  496. padding: 8px 0;
  497. overflow: hidden;
  498. text-overflow: ellipsis;
  499. white-space: nowrap;
  500. }
  501. }
  502. </style>