index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <template>
  2. <div class='overview'>
  3. <!-- <van-button @click='openPreview' type='primary'>测试</van-button> -->
  4. <!-- <ImagePreview1 class='overview-img-preview' :visible.sync='showImgPreview' :imgList='imgList' /> -->
  5. <!-- 轮播 -->
  6. <div class='my-swipe'>
  7. <van-swipe :autoplay='3000' indicator-color='white' v-show='imgList.length'>
  8. <van-swipe-item v-for='(image, index) in imgList' :key='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. />
  178. <span v-else-if='noticeBarText && noticeBarText.length<25'>{{noticeBarText}}</span>
  179. <span class='text' v-else>近一个月,说明书无更新</span>
  180. <van-icon v-show='showNoticeBar' class='building-arrow' name='arrow' size='14px' />
  181. </div>
  182. </div>
  183. </template>
  184. <script>
  185. import Vue from 'vue'
  186. // vant 按需引入
  187. import { Button, Icon, Swipe, SwipeItem, Lazyload, Image as VanImage, Tab, Tabs, Empty, NoticeBar } from 'vant'
  188. Vue.use(Button).use(Icon).use(Swipe).use(SwipeItem).use(Lazyload).use(VanImage)
  189. Vue.use(Tab).use(Tabs)
  190. Vue.use(NoticeBar)
  191. Vue.use(Empty)
  192. import { mapGetters } from 'vuex'
  193. // lodash
  194. import { isEmpty } from 'lodash'
  195. // moment
  196. import moment from 'moment'
  197. import ImagePreview1 from '@/components/ImagePreview'
  198. // 接口
  199. import { queryFact, queryRecordCount } from '@/api/overview'
  200. export default {
  201. name: 'Overview',
  202. props: {},
  203. components: { ImagePreview1 },
  204. data() {
  205. return {
  206. showImgPreview: true,
  207. imgList: [],
  208. active: 0, // 激活的tab页 0:建筑综合信息 1:施工单位信息
  209. plazaName: '', //广场名称
  210. build: [], //建筑综合信息
  211. totalContractInfo: {}, //总包信息
  212. showTotalContractInfo: true, //是否显示总包信息
  213. subcontractInfo: [], //分包信息
  214. showNoticeBar: true, //底部noticeBar 显隐
  215. noticeBarText: '', //底部noticeBar 文本
  216. objtypeDict: {
  217. 1: '重要维保',
  218. 3: '综合事项',
  219. 4: '重要维修',
  220. 5: '其他事项',
  221. },
  222. }
  223. },
  224. computed: {
  225. ...mapGetters(['plazaId']),
  226. },
  227. watch: {
  228. showImgPreview(val) {
  229. console.log('========')
  230. console.log(val)
  231. },
  232. },
  233. created() {
  234. this.queryBaseInfo()
  235. this.queryRecordCountFunc()
  236. },
  237. beforeMount() {},
  238. mounted() {
  239. // debugger
  240. this.openPreview()
  241. },
  242. methods: {
  243. /**
  244. * 查询广场概况
  245. */
  246. async queryBaseInfo() {
  247. let getParams = {
  248. plazaId: this.plazaId,
  249. }
  250. let data = await queryFact({ getParams })
  251. // console.log(data)
  252. // 顶部轮播图
  253. this.imgList = data.pic2.concat(data.pic1)
  254. this.plazaName = data.plazaName
  255. // 建筑综合信息
  256. this.build = data.build
  257. //总包信息
  258. let totalContractInfoArr = data.constructions.filter((v) => v.type === '总包')
  259. if (totalContractInfoArr) {
  260. this.showTotalContractInfo = true
  261. } else {
  262. this.showTotalContractInfo = false
  263. }
  264. let totalContractInfo = {
  265. unit: totalContractInfoArr[0]?.unit || '--',
  266. name: totalContractInfoArr[0]?.lxr || '--',
  267. phone: totalContractInfoArr[0]?.lxdh || '--',
  268. professional: [],
  269. }
  270. totalContractInfoArr.map((item) => {
  271. item.professional && totalContractInfo.professional.push(item.professional)
  272. })
  273. this.totalContractInfo = totalContractInfo
  274. //分包信息,组合页面需要展示的分包信息
  275. let subcontractInfoArr = data.constructions.filter((v) => v.type === '分包')
  276. subcontractInfoArr.sort((a, b) => b.professional.localeCompare(a.professional, 'zh'))
  277. let subcontractInfo = []
  278. /**
  279. * 构造二维数组
  280. */
  281. subcontractInfo[0] = [subcontractInfoArr[0]]
  282. let __index = 0
  283. subcontractInfoArr.map((item, index) => {
  284. if (index >= 1) {
  285. if (item.professional === subcontractInfo[__index][0].professional) {
  286. subcontractInfo[__index].push(item)
  287. } else {
  288. __index++
  289. subcontractInfo[__index] = [item]
  290. }
  291. }
  292. })
  293. this.subcontractInfo = subcontractInfo
  294. // console.log(subcontractInfo)
  295. },
  296. /**
  297. * 查询近三十天说明书更新记录
  298. *
  299. */
  300. async queryRecordCountFunc() {
  301. let getParams = {
  302. plazaId: this.plazaId, //广场id 必填
  303. changeDateStartDate: moment().subtract(1, 'months').format('YYYYMMDD000000'), //变更记录开始时间 格式yyyyMMddHHmiss 必填
  304. changeDateEndDate: moment().format('YYYYMMDD000000'), //变更记录结束时间 格式yyyyMMddHHmiss 必填
  305. }
  306. let data = await queryRecordCount({ getParams })
  307. // console.log(data)
  308. // 测试数据
  309. // data = {
  310. // data: [
  311. // {
  312. // cnt: 6,
  313. // objtype: 4, //变更内容类型(1:重要维保 3:综合事项 4:重要维修 5:其他事项)
  314. // },
  315. // { cnt: 10, objtype: 1 },
  316. // { cnt: 45, objtype: 3 },
  317. // { cnt: 4, objtype: 5 },
  318. // ],
  319. // result: 'success',
  320. // }
  321. if (!data || data.result !== 'success' || !data.data.length) {
  322. this.showNoticeBar = false //底部noticeBar 显隐
  323. this.noticeBarText = ''
  324. return true
  325. }
  326. data = data.data
  327. data.sort((a, b) => a.objtype - b.objtype)
  328. this.showNoticeBar = true
  329. this.noticeBarText = ''
  330. // 文本处理
  331. let noticeBarText = '近一个月,'
  332. data.map((item) => {
  333. noticeBarText += `${this.objtypeDict[item.objtype]} ${item.cnt} 条,`
  334. })
  335. this.noticeBarText = noticeBarText.slice(0, noticeBarText.length - 1)
  336. },
  337. openPreview() {
  338. this.showImgPreview = true
  339. // this.imgList = [
  340. // 'https://img.yzcdn.cn/vant/apple-1.jpg',
  341. // 'https://img.yzcdn.cn/vant/apple-2.jpg',
  342. // 'https://img.yzcdn.cn/vant/apple-1.jpg',
  343. // 'https://img.yzcdn.cn/vant/apple-2.jpg',
  344. // 'https://img.yzcdn.cn/vant/apple-1.jpg',
  345. // 'https://img.yzcdn.cn/vant/apple-2.jpg',
  346. // 'https://img.yzcdn.cn/vant/apple-1.jpg',
  347. // 'https://img.yzcdn.cn/vant/apple-2.jpg',
  348. // ].slice(0, parseInt(Math.random() * 8 + 1))
  349. },
  350. /**
  351. * 跳转说明书更新记录
  352. */
  353. goToUpdateRecord() {
  354. if (this.showNoticeBar) {
  355. this.$router.push({ name: 'UpdateRecord', params: { initPage: true } })
  356. }
  357. },
  358. },
  359. }
  360. </script>
  361. <style lang="less" scoped>
  362. .overview {
  363. width: 100%;
  364. height: calc(100% - 150px);
  365. // background-color: lightblue;
  366. // display: flex;
  367. // flex-direction: column;
  368. // 轮播图
  369. .my-swipe {
  370. display: block;
  371. width: 343px;
  372. height: 160px;
  373. margin: 12px auto;
  374. .van-swipe {
  375. width: 100%;
  376. height: 100%;
  377. .van-swipe-item {
  378. position: relative;
  379. .type-name {
  380. display: inline-block;
  381. width: 70px;
  382. padding: 5px 0 5px 10px;
  383. position: absolute;
  384. z-index: 10;
  385. left: 0;
  386. background: linear-gradient(270deg, rgba(4, 22, 39, 0) 0%, #020d18 100%);
  387. color: #fff;
  388. font-size: 16px;
  389. border-radius: 4px;
  390. }
  391. .van-image {
  392. height: 100%;
  393. }
  394. }
  395. }
  396. }
  397. // tabs切换
  398. .overview-tabs {
  399. width: 100%;
  400. height: calc(100% - 180px);
  401. display: flex;
  402. flex-direction: column;
  403. /deep/ .van-tabs__content {
  404. flex: 1;
  405. overflow: auto;
  406. }
  407. /deep/ .van-tabs__wrap {
  408. border-bottom: 1px solid #eaeaea;
  409. .van-tabs__nav--line {
  410. box-sizing: content-box;
  411. height: 100%;
  412. width: 80%;
  413. margin: 0 auto;
  414. }
  415. .van-tab__text {
  416. font-size: 16px;
  417. }
  418. }
  419. // 建筑综合信息
  420. .buiding-tab {
  421. width: 100%;
  422. height: 100%;
  423. .building-info {
  424. width: 100%;
  425. overflow: auto;
  426. padding: 16px;
  427. .cell {
  428. width: 100%;
  429. min-height: 20px;
  430. margin-top: 12px;
  431. display: flex;
  432. .left {
  433. width: 75px;
  434. color: #666;
  435. font-size: 14px;
  436. }
  437. .right {
  438. flex: 1;
  439. color: #333;
  440. font-size: 14px;
  441. }
  442. }
  443. }
  444. }
  445. // 施工单位信息
  446. .sgdw-info {
  447. margin-top: 15px;
  448. height: calc(100% - 15px);
  449. // tab样式修改
  450. /deep/.van-tabs__nav {
  451. width: 50%;
  452. margin: 0 auto;
  453. border-color: #d4d4d4;
  454. .van-tab--active {
  455. border: 1px solid #025baa !important;
  456. background-color: rgb(229, 238, 246);
  457. }
  458. }
  459. /deep/.van-tabs__wrap {
  460. border-bottom: none;
  461. // margin: 15px 0;
  462. .van-tabs__nav--card {
  463. border-radius: 2px;
  464. border-color: #d4d4d4 !important;
  465. }
  466. .van-tab {
  467. border-radius: 2px;
  468. }
  469. }
  470. & > .van-tabs {
  471. display: flex;
  472. flex-direction: column;
  473. height: 100%;
  474. .van-tabs__content {
  475. flex: 1;
  476. overflow: auto;
  477. }
  478. }
  479. // 总包
  480. .zb {
  481. padding: 15px 18px 10px 18px;
  482. li {
  483. height: 25px;
  484. line-height: 25px;
  485. margin-bottom: 10px;
  486. display: flex;
  487. align-items: center;
  488. }
  489. i {
  490. display: inline-block;
  491. overflow: hidden;
  492. margin-right: 10px;
  493. }
  494. .title {
  495. color: #333333;
  496. font-size: 16px;
  497. font-weight: 600;
  498. }
  499. .system {
  500. padding-left: 20px;
  501. height: auto;
  502. .card {
  503. display: inline-block;
  504. height: 25px;
  505. font-size: 14px;
  506. background-color: #eff0f1;
  507. border-radius: 2px;
  508. color: #666;
  509. padding: 0 10px;
  510. margin-right: 5px;
  511. margin-bottom: 5px;
  512. }
  513. }
  514. .name,
  515. .phone {
  516. color: #333333;
  517. font-size: 14px;
  518. }
  519. }
  520. // 分包
  521. .fb {
  522. padding: 15px 18px 10px 18px;
  523. .fb-card {
  524. width: 100%;
  525. height: auto;
  526. display: flex;
  527. border-radius: 4px;
  528. border: 1px solid #d4d4d4;
  529. margin-bottom: 13px;
  530. .card-left {
  531. width: 65px;
  532. display: flex;
  533. justify-content: center;
  534. align-items: center;
  535. background: #eff0f1;
  536. border-radius: 4px 0px 0px 4px;
  537. padding: 8px;
  538. font-size: 16px;
  539. font-weight: 500;
  540. color: #333333;
  541. }
  542. .card-right {
  543. padding: 8px 16px;
  544. flex: 1;
  545. .info {
  546. .company {
  547. font-size: 14px;
  548. font-weight: 400;
  549. color: #333333;
  550. padding: 3px 0;
  551. }
  552. .name-phone {
  553. display: flex;
  554. justify-content: space-between;
  555. padding: 3px 0;
  556. font-size: 14px;
  557. font-weight: 400;
  558. color: #666666;
  559. height: auto;
  560. & > :nth-child(1) {
  561. flex: 1;
  562. padding-right: 10px;
  563. }
  564. & > :nth-child(2) {
  565. width: 100px;
  566. text-align: right;
  567. height: auto;
  568. display: inline-block;
  569. align-items: center;
  570. }
  571. }
  572. }
  573. .info + .info {
  574. border-top: 1px solid #e6e6e6;
  575. margin-top: 5px;
  576. padding-top: 5px;
  577. }
  578. }
  579. }
  580. }
  581. }
  582. }
  583. // 空状态
  584. .m-empty {
  585. // position: fixed;
  586. // top: 0;
  587. // left: 0;
  588. // width: 100%;
  589. // height: 100%;
  590. display: flex;
  591. align-items: center;
  592. /deep/ .van-empty__image {
  593. display: flex;
  594. justify-content: center;
  595. align-items: flex-end;
  596. img {
  597. width: auto !important;
  598. height: auto !important;
  599. }
  600. }
  601. }
  602. // 底部固定条
  603. .bottom {
  604. width: 100%;
  605. position: fixed;
  606. display: flex;
  607. align-items: center;
  608. justify-content: space-between;
  609. padding: 0 15px;
  610. bottom: 50px;
  611. left: 0;
  612. height: 44px;
  613. // padding-right:16px;
  614. background: #e5eef6;
  615. color: #025baa;
  616. font-size: 14px;
  617. .bottom-notice {
  618. flex: 1;
  619. }
  620. .building-arrow {
  621. // position: absolute;
  622. width: 20px;
  623. // right: 16px;
  624. }
  625. .text {
  626. // padding-left: 15px;
  627. }
  628. }
  629. }
  630. @media screen and (orientation: portrait) {
  631. .test {
  632. color: lightcoral;
  633. }
  634. }
  635. @media screen and (orientation: landscape) {
  636. .test {
  637. color: lightgreen;
  638. }
  639. }
  640. </style>