index.vue 19 KB

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