index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <template>
  2. <div class='overview'>
  3. <!-- 照片预览 -->
  4. <ImagePreview class='overview-img-preview' :key='imgKey' :visible.sync='showImgPreview' :imgList='imgPreviewList' />
  5. <!-- 轮播 -->
  6. <div class='my-swipe'>
  7. <van-swipe ref='mSwipe' :autoplay='autoplay' indicator-color='white' v-show='imgList.length'>
  8. <van-swipe-item v-for='(image, index) in imgList' :key='index' @click='openImgPreview(image,index)'>
  9. <span class='type-name' v-show='image.typename'>{{ image.typename }}</span>
  10. <van-image fit='contain' :src='image.url' />
  11. </van-swipe-item>
  12. </van-swipe>
  13. </div>
  14. <!-- tab页签 -->
  15. <van-tabs class='overview-tabs' v-model='active' color='#025BAA' title-active-color='#025BAA' :line-width='110' :line-height='2'>
  16. <!-- 建筑综合信息 -->
  17. <van-tab class='buiding-tab' title='建筑综合信息'>
  18. <div class='building-info'>
  19. <!-- <div class='cell'>
  20. <span class='left'>项目名称:</span>
  21. <span class='right'>{{plazaName}}</span>
  22. </div>-->
  23. <div class='cell' v-for='(item, index) in build' :key='index'>
  24. <span class='left'>{{ item.project }}:</span>
  25. <span class='right'>{{ item.basic }}</span>
  26. </div>
  27. <!-- <div class='cell'>
  28. <span class='left'>项目地址:</span>
  29. <span class='right'>福建省三明市梅列区东乾二路1号15幢三明万达广场4楼办公室</span>
  30. </div>
  31. <div class='cell'>
  32. <span class='left'>建筑面积:</span>
  33. <span class='right'>13.07万㎡,其中地上9.09万㎡、地下3.55万㎡</span>
  34. </div>
  35. <div class='cell'>
  36. <span class='left'>建筑高度:</span>
  37. <span class='right'>裙房31.22万m</span>
  38. </div>
  39. <div class='cell'>
  40. <span class='left'>楼层分布:</span>
  41. <span class='right'>地上5层/地下2层</span>
  42. </div>
  43. <div class='cell'>
  44. <span class='left'>车位信息:</span>
  45. <span class='right'>地下823个/地上0个</span>
  46. </div>
  47. <div class='cell'>
  48. <span class='left'>租赁面积:</span>
  49. <span class='right'>6.45㎡,其中地上5.82万㎡、地下0.63万㎡</span>
  50. </div>
  51. <div class='cell'>
  52. <span class='left'>开业时间:</span>
  53. <span class='right'>2016年11月21日</span>
  54. </div>
  55. <div class='cell'>
  56. <span class='left'>移交时间:</span>
  57. <span class='right'>6.45㎡,其中地上5.82万㎡、地下0.63万㎡</span>
  58. </div>-->
  59. </div>
  60. </van-tab>
  61. <!-- 施工单位信息 -->
  62. <van-tab title='施工单位信息' class='sgdw-info'>
  63. <van-tabs type='card' color='#E5EEF6' title-active-color='#025baa' title-inactive-color='#666666'>
  64. <van-tab title='总包'>
  65. <ul class='zb' v-if='showTotalContractInfo'>
  66. <li class='title'>
  67. <!-- <i>icon</i>中国建筑第二工程局有限公司 -->
  68. <i class='iconfont wanda-gongsiqiye'></i>
  69. {{ totalContractInfo.unit }}
  70. </li>
  71. <li class='system'>
  72. <!-- <span class='card'>消防电</span>
  73. <span class='card'>土建</span>
  74. <span class='card'>弱电</span>
  75. <span class='card'>机电</span>
  76. <span class='card'>给排水</span>-->
  77. <span class='card' v-for='(item, index) in totalContractInfo.professional' :key='index'>{{ item }}</span>
  78. </li>
  79. <li class='name'>
  80. <i class='iconfont wanda-renwu-ren'></i>
  81. {{ totalContractInfo.name }}
  82. </li>
  83. <li class='phone'>
  84. <i class='iconfont wanda-dianhua'></i>
  85. {{ totalContractInfo.phone }}
  86. </li>
  87. </ul>
  88. <ul class='zb' v-else>
  89. <!-- 暂无数据 -->
  90. <van-empty class='m-empty' description='暂无数据'>
  91. <template #image>
  92. <img class='no-data' src='../../assets/images/search_null.png' alt />
  93. </template>
  94. </van-empty>
  95. </ul>
  96. </van-tab>
  97. <van-tab title='分包'>
  98. <ul class='fb' v-if='subcontractInfo.length'>
  99. <li class='fb-card' v-for='(item, index) in subcontractInfo' :key='index'>
  100. <div class='card-left'>{{ item[0].professional }}</div>
  101. <div class='card-right'>
  102. <div class='info' v-for='(detail, dIndex) in item' :key='dIndex'>
  103. <p class='company'>{{ detail.unit }}</p>
  104. <p class='name-phone'>
  105. <span>{{ detail.lxr || '--' }}</span>
  106. <span>{{ detail.lxdh || '--' }}</span>
  107. </p>
  108. <!-- <p class='name-phone'>
  109. <span>张伟</span>
  110. <span>0411-86666924</span>
  111. </p>-->
  112. </div>
  113. </div>
  114. </li>
  115. <!-- <li class='fb-card' v-for='i in 5' :key='i'>
  116. <div class='card-left'>消防水</div>
  117. <div class='card-right'>
  118. <div class='info'>
  119. <p class='company'>大连金帝建设工程有限公司</p>
  120. <p class='name-phone'>
  121. <span>日立电梯(中国)有限公司</span>
  122. <span>0411-86666924</span>
  123. </p>
  124. <p class='name-phone'>
  125. <span>张伟</span>
  126. <span>0411-86666924</span>
  127. </p>
  128. </div>
  129. </div>
  130. </li>
  131. <li class='fb-card'>
  132. <div class='card-left'>幕墙</div>
  133. <div class='card-right'>
  134. <div class='info'>
  135. <p class='company'>大连建工机电安装工程有限公司</p>
  136. <p class='name-phone'>
  137. <span>张伟</span>
  138. <span>18612349786</span>
  139. </p>
  140. <p class='name-phone'>
  141. <span>张伟</span>
  142. <span>18612349786</span>
  143. </p>
  144. </div>
  145. <div class='info'>
  146. <p class='company'>大连建工机电安装工程有限公司</p>
  147. <p class='name-phone'>
  148. <span>张伟</span>
  149. <span>18612349786</span>
  150. </p>
  151. </div>
  152. </div>
  153. </li>-->
  154. </ul>
  155. <ul class='fb' v-else>
  156. <!-- 暂无数据 -->
  157. <van-empty class='m-empty' description='暂无数据'>
  158. <template #image>
  159. <img class='no-data' src='../../assets/images/search_null.png' alt />
  160. </template>
  161. </van-empty>
  162. </ul>
  163. </van-tab>
  164. </van-tabs>
  165. </van-tab>
  166. </van-tabs>
  167. <div class='bottom' @click='goToUpdateRecord'>
  168. <!-- <span v-if='false'>近一个月,重要维保8条,重要维修3条,其他事项5条,综合事项10条</span> -->
  169. <van-notice-bar
  170. v-if='showNoticeBar && noticeBarText.length>=25'
  171. class='bottom-notice'
  172. background='#e5eef6'
  173. color='#025baa'
  174. speed='50'
  175. scrollable
  176. :text='noticeBarText'
  177. :key='`notice_${noticeKey}`'
  178. @replay='noticeKey++'
  179. />
  180. <span v-else-if='noticeBarText && noticeBarText.length<25'>{{noticeBarText}}</span>
  181. <span class='text' v-else>近一个月,说明书无更新</span>
  182. <van-icon v-show='showNoticeBar' class='building-arrow' name='arrow' size='14px' />
  183. </div>
  184. </div>
  185. </template>
  186. <script>
  187. import Vue from 'vue'
  188. // vant 按需引入
  189. import { Button, Icon, Swipe, SwipeItem, Lazyload, Image as VanImage, Tab, Tabs, Empty, NoticeBar } from 'vant'
  190. Vue.use(Button).use(Icon).use(Swipe).use(SwipeItem).use(Lazyload).use(VanImage)
  191. Vue.use(Tab).use(Tabs)
  192. Vue.use(NoticeBar)
  193. Vue.use(Empty)
  194. import { mapGetters } from 'vuex'
  195. // lodash
  196. import { isEmpty, cloneDeep } from 'lodash'
  197. // moment
  198. import moment from 'moment'
  199. import ImagePreview from '@/components/ImagePreview'
  200. // 接口
  201. import { queryFact, queryRecordCount } from '@/api/overview'
  202. export default {
  203. name: 'Overview',
  204. props: {},
  205. components: { ImagePreview },
  206. data() {
  207. return {
  208. imgList: [], //轮播图数组
  209. showImgPreview: false, //是否显示预览大图
  210. imgKey: `img_${new Date().getTime()}`, //预览大图key值
  211. imgPreviewList: [], //预览图数组
  212. autoplay: 3000, //轮播时长,为0时停止轮播
  213. active: 0, // 激活的tab页 0:建筑综合信息 1:施工单位信息
  214. plazaName: '', //广场名称
  215. build: [], //建筑综合信息
  216. totalContractInfo: {}, //总包信息
  217. showTotalContractInfo: true, //是否显示总包信息
  218. subcontractInfo: [], //分包信息
  219. showNoticeBar: true, //底部noticeBar 显隐
  220. noticeBarText: '', //底部noticeBar 文本
  221. objtypeDict: {
  222. 1: '重要维保',
  223. 3: '综合事项',
  224. 4: '重要维修',
  225. 5: '其他事项',
  226. },
  227. noticeKey: 1,
  228. }
  229. },
  230. computed: {
  231. ...mapGetters(['plazaId']),
  232. },
  233. watch: {
  234. /**
  235. * 关闭预览大图之后,启动自动轮播
  236. */
  237. showImgPreview(newV, oldV) {
  238. if (newV !== oldV && !newV) {
  239. this.autoplay = 3000
  240. }
  241. // 预览大图切换横竖屏之后,主页面轮播图,位置错乱,重新resize恢复位置
  242. this.$refs.mSwipe.resize()
  243. this.$nextTick(() => {
  244. setTimeout(() => {
  245. this.$refs.mSwipe.resize()
  246. }, 1000)
  247. })
  248. },
  249. },
  250. created() {
  251. this.queryBaseInfo()
  252. this.queryRecordCountFunc()
  253. },
  254. beforeMount() {},
  255. mounted() {},
  256. methods: {
  257. /**
  258. * 显示预览大图,同时停止swipe轮播
  259. */
  260. openImgPreview(img, index) {
  261. this.imgKey = `img_${new Date().getTime()}`
  262. this.autoplay = 0 //点击大图预览之后,停止swiper轮播
  263. // 按照index,处理图片数组
  264. let imgPreviewList = cloneDeep(this.imgList).map((v) => v.url)
  265. imgPreviewList = [...imgPreviewList.slice(index), ...imgPreviewList.slice(0, index)]
  266. this.$nextTick(() => {
  267. this.imgPreviewList = imgPreviewList
  268. this.showImgPreview = true
  269. })
  270. },
  271. /**
  272. * 查询广场概况
  273. */
  274. async queryBaseInfo() {
  275. let getParams = {
  276. plazaId: this.plazaId,
  277. }
  278. let data = await queryFact({ getParams })
  279. // console.log(data)
  280. // 顶部轮播图
  281. this.imgList = data.pic2.concat(data.pic1)
  282. this.plazaName = data.plazaName
  283. // 建筑综合信息
  284. this.build = data.build
  285. //总包信息
  286. let totalContractInfoArr = data.constructions.filter((v) => v.type === '总包')
  287. if (totalContractInfoArr) {
  288. this.showTotalContractInfo = true
  289. } else {
  290. this.showTotalContractInfo = false
  291. }
  292. let totalContractInfo = {
  293. unit: totalContractInfoArr[0]?.unit || '--',
  294. name: totalContractInfoArr[0]?.lxr || '--',
  295. phone: totalContractInfoArr[0]?.lxdh || '--',
  296. professional: [],
  297. }
  298. totalContractInfoArr.map((item) => {
  299. item.professional && totalContractInfo.professional.push(item.professional)
  300. })
  301. this.totalContractInfo = totalContractInfo
  302. //分包信息,组合页面需要展示的分包信息
  303. let subcontractInfoArr = data.constructions.filter((v) => v.type === '分包')
  304. subcontractInfoArr.sort((a, b) => b.professional.localeCompare(a.professional, 'zh'))
  305. let subcontractInfo = []
  306. /**
  307. * 构造二维数组
  308. */
  309. subcontractInfo[0] = [subcontractInfoArr[0]]
  310. let __index = 0
  311. subcontractInfoArr.map((item, index) => {
  312. if (index >= 1) {
  313. if (item.professional === subcontractInfo[__index][0].professional) {
  314. subcontractInfo[__index].push(item)
  315. } else {
  316. __index++
  317. subcontractInfo[__index] = [item]
  318. }
  319. }
  320. })
  321. this.subcontractInfo = subcontractInfo
  322. // console.log(subcontractInfo)
  323. },
  324. /**
  325. * 查询近三十天说明书更新记录
  326. *
  327. */
  328. async queryRecordCountFunc() {
  329. let getParams = {
  330. plazaId: this.plazaId, //广场id 必填
  331. changeDateStartDate: moment().subtract(1, 'months').format('YYYYMMDD000000'), //变更记录开始时间 格式yyyyMMddHHmiss 必填
  332. changeDateEndDate: moment().format('YYYYMMDD000000'), //变更记录结束时间 格式yyyyMMddHHmiss 必填
  333. }
  334. let data = await queryRecordCount({ getParams })
  335. // console.log(data)
  336. // 测试数据
  337. // data = {
  338. // data: [
  339. // {
  340. // cnt: 6,
  341. // objtype: 4, //变更内容类型(1:重要维保 3:综合事项 4:重要维修 5:其他事项)
  342. // },
  343. // { cnt: 10, objtype: 1 },
  344. // { cnt: 45, objtype: 3 },
  345. // { cnt: 4, objtype: 5 },
  346. // ],
  347. // result: 'success',
  348. // }
  349. if (!data || data.result !== 'success' || !data.data.length) {
  350. this.showNoticeBar = false //底部noticeBar 显隐
  351. this.noticeBarText = ''
  352. return true
  353. }
  354. data = data.data
  355. data.sort((a, b) => a.objtype - b.objtype)
  356. this.showNoticeBar = true
  357. this.noticeBarText = ''
  358. // 文本处理
  359. let noticeBarText = '近一个月,'
  360. data.map((item) => {
  361. noticeBarText += `${this.objtypeDict[item.objtype]} ${item.cnt} 条,`
  362. })
  363. this.noticeBarText = noticeBarText.slice(0, noticeBarText.length - 1)
  364. },
  365. /**
  366. * 跳转说明书更新记录
  367. */
  368. goToUpdateRecord() {
  369. if (this.showNoticeBar) {
  370. this.$router.push({ name: 'UpdateRecord', params: { initPage: true } })
  371. }
  372. },
  373. },
  374. }
  375. </script>
  376. <style lang="less" scoped>
  377. .overview {
  378. width: 100%;
  379. height: calc(100% - 150px);
  380. // background-color: lightblue;
  381. // display: flex;
  382. // flex-direction: column;
  383. // 轮播图
  384. .my-swipe {
  385. display: block;
  386. width: 343px;
  387. height: 160px;
  388. margin: 12px auto;
  389. .van-swipe {
  390. width: 100%;
  391. height: 100%;
  392. .van-swipe-item {
  393. position: relative;
  394. .type-name {
  395. display: inline-block;
  396. width: 70px;
  397. padding: 5px 0 5px 10px;
  398. position: absolute;
  399. z-index: 10;
  400. left: 1px;
  401. background: linear-gradient(270deg, rgba(4, 22, 39, 0) 0%, #020d18 100%);
  402. color: #fff;
  403. font-size: 16px;
  404. border-radius: 4px;
  405. }
  406. .van-image {
  407. height: 100%;
  408. }
  409. }
  410. }
  411. }
  412. // tabs切换
  413. .overview-tabs {
  414. width: 100%;
  415. height: calc(100% - 180px);
  416. display: flex;
  417. flex-direction: column;
  418. /deep/ .van-tabs__content {
  419. flex: 1;
  420. overflow: auto;
  421. }
  422. /deep/ .van-tabs__wrap {
  423. border-bottom: 1px solid #eaeaea;
  424. .van-tabs__nav--line {
  425. box-sizing: content-box;
  426. height: 100%;
  427. width: 80%;
  428. margin: 0 auto;
  429. }
  430. .van-tab__text {
  431. font-size: 16px;
  432. }
  433. }
  434. // 建筑综合信息
  435. .buiding-tab {
  436. width: 100%;
  437. height: 100%;
  438. .building-info {
  439. width: 100%;
  440. overflow: auto;
  441. padding: 16px;
  442. .cell {
  443. width: 100%;
  444. min-height: 20px;
  445. margin-top: 12px;
  446. display: flex;
  447. .left {
  448. width: 75px;
  449. color: #666;
  450. font-size: 14px;
  451. }
  452. .right {
  453. flex: 1;
  454. color: #333;
  455. font-size: 14px;
  456. }
  457. }
  458. }
  459. }
  460. // 施工单位信息
  461. .sgdw-info {
  462. margin-top: 15px;
  463. height: calc(100% - 15px);
  464. // tab样式修改
  465. /deep/.van-tabs__nav {
  466. width: 50%;
  467. margin: 0 auto;
  468. border-color: #d4d4d4;
  469. .van-tab--active {
  470. border: 1px solid #025baa !important;
  471. background-color: rgb(229, 238, 246);
  472. }
  473. }
  474. /deep/.van-tabs__wrap {
  475. border-bottom: none;
  476. // margin: 15px 0;
  477. .van-tabs__nav--card {
  478. border-radius: 2px;
  479. border-color: #d4d4d4 !important;
  480. }
  481. .van-tab {
  482. border-radius: 2px;
  483. }
  484. }
  485. & > .van-tabs {
  486. display: flex;
  487. flex-direction: column;
  488. height: 100%;
  489. .van-tabs__content {
  490. flex: 1;
  491. overflow: auto;
  492. }
  493. }
  494. // 总包
  495. .zb {
  496. padding: 15px 18px 10px 18px;
  497. li {
  498. height: 25px;
  499. line-height: 25px;
  500. margin-bottom: 10px;
  501. display: flex;
  502. align-items: center;
  503. }
  504. i {
  505. display: inline-block;
  506. overflow: hidden;
  507. margin-right: 10px;
  508. }
  509. .title {
  510. color: #333333;
  511. font-size: 16px;
  512. font-weight: 600;
  513. }
  514. .system {
  515. padding-left: 20px;
  516. height: auto;
  517. .card {
  518. display: inline-block;
  519. height: 25px;
  520. font-size: 14px;
  521. background-color: #eff0f1;
  522. border-radius: 2px;
  523. color: #666;
  524. padding: 0 10px;
  525. margin-right: 5px;
  526. margin-bottom: 5px;
  527. }
  528. }
  529. .name,
  530. .phone {
  531. color: #333333;
  532. font-size: 14px;
  533. }
  534. }
  535. // 分包
  536. .fb {
  537. padding: 15px 18px 10px 18px;
  538. .fb-card {
  539. width: 100%;
  540. height: auto;
  541. display: flex;
  542. border-radius: 4px;
  543. border: 1px solid #d4d4d4;
  544. margin-bottom: 13px;
  545. .card-left {
  546. width: 65px;
  547. display: flex;
  548. justify-content: center;
  549. align-items: center;
  550. background: #eff0f1;
  551. border-radius: 4px 0px 0px 4px;
  552. padding: 8px;
  553. font-size: 16px;
  554. font-weight: 500;
  555. color: #333333;
  556. }
  557. .card-right {
  558. padding: 8px 16px;
  559. flex: 1;
  560. .info {
  561. .company {
  562. font-size: 14px;
  563. font-weight: 400;
  564. color: #333333;
  565. padding: 3px 0;
  566. }
  567. .name-phone {
  568. display: flex;
  569. justify-content: space-between;
  570. padding: 3px 0;
  571. font-size: 14px;
  572. font-weight: 400;
  573. color: #666666;
  574. height: auto;
  575. & > :nth-child(1) {
  576. flex: 1;
  577. padding-right: 10px;
  578. }
  579. & > :nth-child(2) {
  580. width: 100px;
  581. text-align: right;
  582. height: auto;
  583. display: inline-block;
  584. align-items: center;
  585. }
  586. }
  587. }
  588. .info + .info {
  589. border-top: 1px solid #e6e6e6;
  590. margin-top: 5px;
  591. padding-top: 5px;
  592. }
  593. }
  594. }
  595. }
  596. }
  597. }
  598. // 空状态
  599. .m-empty {
  600. // position: fixed;
  601. // top: 0;
  602. // left: 0;
  603. // width: 100%;
  604. // height: 100%;
  605. display: flex;
  606. align-items: center;
  607. /deep/ .van-empty__image {
  608. display: flex;
  609. justify-content: center;
  610. align-items: flex-end;
  611. img {
  612. width: auto !important;
  613. height: auto !important;
  614. }
  615. }
  616. }
  617. // 底部固定条
  618. .bottom {
  619. width: 100%;
  620. position: fixed;
  621. display: flex;
  622. align-items: center;
  623. justify-content: space-between;
  624. padding: 0 15px;
  625. bottom: 50px;
  626. left: 0;
  627. height: 44px;
  628. // padding-right:16px;
  629. background: #e5eef6;
  630. color: #025baa;
  631. font-size: 14px;
  632. .bottom-notice {
  633. flex: 1;
  634. }
  635. .building-arrow {
  636. // position: absolute;
  637. width: 20px;
  638. // right: 16px;
  639. }
  640. .text {
  641. // padding-left: 15px;
  642. }
  643. }
  644. }
  645. @media screen and (orientation: portrait) {
  646. .test {
  647. color: lightcoral;
  648. }
  649. }
  650. @media screen and (orientation: landscape) {
  651. .test {
  652. color: lightgreen;
  653. }
  654. }
  655. </style>