index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. /**
  2. *@author:Guoxiaohuan
  3. *@date:2020.05.26
  4. *@info 项目概况主页
  5. */
  6. <template>
  7. <div class='overview'>
  8. <div class='view-title'>
  9. <nav>
  10. <span></span>
  11. <span>项目基本信息</span>
  12. </nav>
  13. <!-- <el-button type='info' plain disabled> -->
  14. <div class='view-button' :disabled='true' @click='findxmzl' title='数字化移交系统上线后可用'>
  15. <img src='../../assets/imgs/wd.png' alt />
  16. 项目资料
  17. </div>
  18. <!-- </el-button> -->
  19. </div>
  20. <div class='view-box'>
  21. <div class='view-left'>
  22. <div class='lb-left'>
  23. <div v-if='pic2.length>0' style='height:100%'>
  24. <rotation :key='2' type='2' :rotationImg='pic2' @scan='scan'></rotation>
  25. <div class='lb-icon' @click='picClick("2")'></div>
  26. <img class='lb-img' @click='picClick("2")' src='../../assets/imgs/zk.png' alt />
  27. </div>
  28. <img v-else class='lb-left-noImg' src='@/assets/imgs/nkt.jpg' alt />
  29. </div>
  30. <div class='lb-bottom'>
  31. <nav>
  32. <span></span>
  33. <span>建筑综合信息</span>
  34. </nav>
  35. <!-- <p class='place-p1'>
  36. <span>
  37. <img src='@/assets/imgs/jz.png' alt />
  38. {{build.length>0?formatter('项目名称',build):'--'}}
  39. </span>
  40. </p>-->
  41. <p class='place-p2'>
  42. <span>
  43. <img src='@/assets/imgs/didian.png' alt />
  44. {{build.length>0?formatter('项目地址',build):'--'}}
  45. </span>
  46. </p>
  47. <div class='place-bottom'>
  48. <div class='place-box'>
  49. <div class='place-left'>
  50. <span>建筑面积</span>
  51. <span>建筑高度</span>
  52. <span>楼层分布</span>
  53. <span>车位信息</span>
  54. </div>
  55. <div class='place-right'>
  56. <span :title='`${build.length>0?formatter("建筑面积",build):"--"}`'>{{build.length>0?formatter('建筑面积',build):'--'}}</span>
  57. <span :title='`${build.length>0?formatter("建筑高度",build):"--"}`'>{{build.length>0?formatter('建筑高度',build):'--'}}</span>
  58. <span :title='`${build.length>0?formatter("楼层分布",build):"--"}`'>{{build.length>0?formatter('楼层分布',build):'--'}}</span>
  59. <span :title='`${build.length>0?formatter("车位信息",build):"--"}`'>{{build.length>0?formatter('车位信息',build):'--'}}</span>
  60. </div>
  61. </div>
  62. <div class='place-box'>
  63. <div class='place-left'>
  64. <span>租赁面积</span>
  65. <span>竣工日期</span>
  66. <span>开业日期</span>
  67. <span>移交日期</span>
  68. </div>
  69. <div class='place-right'>
  70. <span :title='`${build.length>0?formatter("租赁面积",build):"--"}`'>{{build.length>0?formatter('租赁面积',build):'--'}}</span>
  71. <span :title='`${build.length>0?formatter("竣工日期",build):"--"}`'>{{build.length>0?formatter('竣工日期',build):'--'}}</span>
  72. <span :title='`${build.length>0?formatter("开业日期",build):"--"}`'>{{build.length>0?formatter('开业日期',build):'--'}}</span>
  73. <span :title='`${build.length>0?formatter("移交日期",build):"--"}`'>{{build.length>0?formatter('移交日期',build):'--'}}</span>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class='view-right'>
  80. <div class='view-right-box'>
  81. <div class='lb-right'>
  82. <div v-if='pic1.length>0' style='height:100%'>
  83. <rotation type='2' :rotationImg='pic1' :key='1' @scan='scan'></rotation>
  84. <div class='lb-icon' @click='picClick("1")'></div>
  85. <img class='lb-img' @click='picClick("1")' src='../../assets/imgs/zk.png' alt />
  86. </div>
  87. <img v-else class='lb-left-noImg' src='@/assets/imgs/qwt.jpg' alt />
  88. </div>
  89. <div class='lb-right-bottom'>
  90. <nav>
  91. <span></span>
  92. <span>施工单位信息</span>
  93. </nav>
  94. <div class='view-right-bottom'>
  95. <el-table
  96. :data='constructions'
  97. :height='350'
  98. :cell-class-name='addClass'
  99. :span-method='objectSpanMethod'
  100. border
  101. style='font-size:12px'
  102. :header-cell-style='{background:"rgba(245,246,247,1)",fontFamily:"MicrosoftYaHei",color:"rgba(100,108,115,1)",lineHeight:"16px",fontSize:"12px"}'
  103. v-loading='loading'
  104. >
  105. <el-table-column label='序号' width='45' type='index' align='left'></el-table-column>
  106. <el-table-column label='总包/分包' prop='type' width='80' align='center'>
  107. <template slot-scope='{row}'>{{row.type||'--'}}</template>
  108. </el-table-column>
  109. <el-table-column label='专业' width='70' prop='professional'>
  110. <template slot-scope='{row}'>{{row.professional||'--'}}</template>
  111. </el-table-column>
  112. <el-table-column prop='unit ' label='施工单位'>
  113. <template slot-scope='{row}'>{{row.unit ||'--'}}</template>
  114. </el-table-column>
  115. <el-table-column label='联系人' prop width='70' :show-overflow-tooltip='true'>
  116. <template slot-scope='{row}'>{{row.lxr||'--'}}</template>
  117. </el-table-column>
  118. <el-table-column prop='phone' label='联系电话' width='110'>
  119. <template slot-scope='{row}'>{{row.lxdh||'--'}}</template>
  120. </el-table-column>
  121. </el-table>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <PicModal ref='picModal'></PicModal>
  128. </div>
  129. <!-- <div class='view-right-bottom' v-for='(item,index) in rightA' :key='index'>
  130. <div class='view-right-bottom-l'>{{item.type}}</div>
  131. <div class='view-right-bottom-r'>{{item.company}}</div>
  132. </div>-->
  133. <!-- <div class='view-left-box'>
  134. <div class='view-left-top'>
  135. <div class='view-top-imgL'>
  136. <rotation :rotationImg='rotationImg'></rotation>
  137. </div>
  138. <div class='view-top-imgR'>
  139. <rotation :rotationImg='rotationImg'></rotation>
  140. </div>
  141. </div>
  142. <div class='view-left-bottom'>
  143. <nav>
  144. <span></span>
  145. <span>建筑综合信息</span>
  146. </nav>
  147. <p class='place-p'>
  148. <span>福建省三明市梅列区东乾二路1号15幢三明万达广场4楼201室福建省三明市梅列区东乾二路1号</span>
  149. </p>
  150. <span class='place-hr'></span>
  151. <div class='place-bottom'>
  152. <div class='place-bottom-row'>
  153. <div>
  154. <span>项目名称</span>
  155. <span>建筑高度</span>
  156. <span>楼层分布</span>
  157. <span>车位信息</span>
  158. </div>
  159. <div style='min-width:172px;'>
  160. <span>三明万达广场</span>
  161. <span>裙房31.22m</span>
  162. <span>地上5层/地下2层</span>
  163. <span>地上832个/地下0个</span>
  164. </div>
  165. </div>
  166. <div class='place-bottom-row'>
  167. <div>
  168. <span>竣工日期</span>
  169. <span>开业日期</span>
  170. <span>移交日期</span>
  171. </div>
  172. <div style='min-width:172px;'>
  173. <span>2016年11月21日</span>
  174. <span>2016年12月30日</span>
  175. <span>2017年04月30日</span>
  176. </div>
  177. </div>
  178. <div class='place-bottom-row'>
  179. <div>
  180. <span style='margin-bottom:32px'>建筑面积</span>
  181. <span>租赁面积</span>
  182. </div>
  183. <div>
  184. <span>
  185. 13.07万㎡
  186. 其中地上9.90万㎡、地下3.55万㎡
  187. </span>
  188. <span>
  189. 6.45㎡
  190. 其中地上5.82万㎡,地下0.63万㎡
  191. </span>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. </div>-->
  197. </template>
  198. <script>
  199. import PicModal from './picModal'
  200. import { queryFact } from '@/api/overview'
  201. import { mapGetters } from 'vuex'
  202. export default {
  203. data() {
  204. return {
  205. loading: true,
  206. pic1: [], //区位图
  207. pic2: [], //鸟瞰图
  208. build: {}, //左下信息
  209. constructions: [], //右下数组
  210. shuzihuayijiao: '',
  211. va: '',
  212. spanArr: [], //二维数组,用于存放单元格合并规则
  213. position: 0 //用于存储相同项的开始index
  214. }
  215. },
  216. methods: {
  217. addClass({ columnIndex }) {
  218. if (columnIndex === 4) {
  219. return 'contact'
  220. }
  221. },
  222. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  223. for (let i = 1; i <= 5; i++) {
  224. if (columnIndex === i) {
  225. const _row = this.spanArr[i][rowIndex]
  226. const _col = _row > 0 ? 1 : 0
  227. // console.log('第'+rowIndex+'行','第'+i+'列','rowspan:'+_row,'colspan:'+_col)
  228. return {
  229. rowspan: _row,
  230. colspan: _col
  231. }
  232. }
  233. }
  234. },
  235. /**
  236. * 返回的数据处理
  237. */
  238. handelTableData(data) {
  239. let dict = {
  240. 总包: 0,
  241. 分包: 1
  242. }
  243. data = data.sort((a, b) => {
  244. // 按总分包排序
  245. if (a.type !== b.type) {
  246. return dict[a.type] - dict[b.type]
  247. }
  248. // 按专业排序
  249. if (a.professional !== b.professional) {
  250. return b.professional.localeCompare(a.professional)
  251. }
  252. // 按施工单位排序
  253. if (a.unit !== b.unit) {
  254. return b.unit.localeCompare(a.unit)
  255. }
  256. // 按联系人排序
  257. if (a.lxr !== b.lxr) {
  258. return b.lxr.localeCompare(a.lxr)
  259. }
  260. })
  261. data.map(item => {
  262. console.log(item)
  263. // return
  264. if (item.lxr) {
  265. let lxr = item.lxr.split(',').join('\n\r')
  266. item.lxr = lxr
  267. }
  268. return item
  269. })
  270. return data
  271. },
  272. rowspan(idx, prop) {
  273. // 第一列 总包合并一格,分包按照 第二列专业的单元格规则进行合并
  274. if (idx === 1) {
  275. // 初始化数组
  276. this.spanArr[1] = new Array(this.constructions.length).fill(0)
  277. let totalTypeLen = this.constructions.filter(a => a.type === '总包').length
  278. this.spanArr[1][0] = totalTypeLen
  279. this.spanArr[1] = this.spanArr[1].map((item, index) => {
  280. if (index > totalTypeLen - 1) {
  281. item = this.spanArr[2][index]
  282. }
  283. return item
  284. })
  285. return true
  286. }
  287. // 其他列单元格合并规则
  288. this.spanArr[idx] = []
  289. this.position = 0
  290. this.constructions.forEach((item, index) => {
  291. if (index === 0) {
  292. this.spanArr[idx].push(1)
  293. this.position = 0
  294. } else {
  295. if (this.constructions[index][prop] === this.constructions[index - 1][prop]) {
  296. this.spanArr[idx][this.position] += 1 //有相同项
  297. this.spanArr[idx].push(0) // 名称相同后往数组里面加一项0
  298. } else {
  299. this.spanArr[idx].push(1) //同列的前后两行单元格不相同
  300. this.position = index
  301. }
  302. }
  303. })
  304. },
  305. scan(val) {
  306. this.va = val
  307. },
  308. picClick(type) {
  309. if (type === '1') {
  310. this.$refs.picModal.showModal(this.pic1)
  311. // if (this.pic1.length >= this.va) {
  312. // this.$refs.picModal.showModal([this.pic1[this.va - 1]])
  313. // } else {
  314. // this.$refs.picModal.showModal(this.pic1)
  315. // }
  316. } else {
  317. this.$refs.picModal.showModal(this.pic2)
  318. // if (this.pic2.length >= this.va) {
  319. // this.$refs.picModal.showModal([this.pic2[this.va - 1]])
  320. // } else {
  321. // this.$refs.picModal.showModal(this.pic2)
  322. // }
  323. }
  324. },
  325. findxmzl() {
  326. // if (this.shuzihuayijiao) {
  327. // window.open(`${this.shuzihuayijiao}`, true)
  328. // }
  329. },
  330. query() {
  331. let params = {
  332. getParams: {
  333. plazaId: this.$store.state.plazaId
  334. // plazaId: '1000303'//这个id有3条数据
  335. }
  336. }
  337. queryFact(params).then(res => {
  338. if (res.result == 'success') {
  339. this.loading = false
  340. this.pic1 = []
  341. this.pic2 = []
  342. this.build = {}
  343. this.constructions = []
  344. this.shuzihuayijiao = ''
  345. this.pic1 = res.pic1 ? res.pic1 : []
  346. this.pic2 = res.pic2 ? res.pic2 : []
  347. this.build = res.build ? res.build : {}
  348. let constructions = []
  349. constructions = res.constructions ? res.constructions : []
  350. if (constructions.length > 0) {
  351. // this.parseTableData(constructions)
  352. let handleData = this.handelTableData(constructions)
  353. this.constructions = handleData
  354. this.rowspan(2, 'professional')
  355. this.rowspan(3, 'unit')
  356. this.rowspan(4, 'lxr')
  357. this.rowspan(5, 'lxdh')
  358. this.rowspan(1, 'type')
  359. }
  360. console.log(this.constructions)
  361. this.shuzihuayijiao = res.shuzihuayijiao ? res.shuzihuayijiao : ''
  362. if (res.plazaName) {
  363. this.$store.commit('SETPLAZENAME', res.plazaName)
  364. }
  365. }
  366. })
  367. },
  368. getImages(_url) {
  369. if (_url !== undefined) {
  370. let _u = _url.substring(7)
  371. return 'https://images.weserv.nl/?url=' + _u
  372. }
  373. },
  374. formatter(str, arrv) {
  375. if (str && arrv) {
  376. const Objs = arrv.find(e => e && e.project == str)
  377. return Objs ? Objs.basic : '--'
  378. } else {
  379. return ''
  380. }
  381. },
  382. init() {
  383. //预览是否开启
  384. // let previewUrl = location.href.split('?')[1]
  385. // if (previewUrl) {
  386. // previewUrl = Boolean(previewUrl.split('=')[1])
  387. // this.$store.commit('SETISPREVIEW', previewUrl)
  388. // }
  389. let previewUrl = this.$route.query.isPreview,
  390. plazaId = this.$route.query.plazaId
  391. if (previewUrl != '') {
  392. console.log(previewUrl)
  393. this.$store.commit('SETISPREVIEW', previewUrl)
  394. }
  395. if (plazaId) {
  396. localStorage.setItem('PLAZAID', plazaId)
  397. this.$store.commit('STOREPLAZAID', plazaId)
  398. }
  399. // let previewUrl = location.href.split('=')[1] ? location.href.split('=')[1].split('&')[0] : false,
  400. // plazaId = location.href.split('=')[2] ? location.href.split('=')[2] : '1000423'
  401. }
  402. },
  403. mounted() {
  404. this.query()
  405. },
  406. created() {
  407. this.init()
  408. },
  409. computed: {
  410. ...mapGetters(['isPreview', 'pic', 'plazaId'])
  411. },
  412. components: {
  413. PicModal
  414. }
  415. }
  416. </script>
  417. <style lang="less" scoped>
  418. .contact {
  419. div {
  420. word-break: break-all !important;
  421. white-space: pre !important;
  422. }
  423. }
  424. @import '../../assets/css/rotation.less';
  425. .overview {
  426. .view-box .view-left {
  427. overflow: hidden;
  428. .lb-left {
  429. margin-bottom: 0;
  430. }
  431. }
  432. }
  433. @media screen and (max-width: 1366px) {
  434. /*当屏幕尺寸小于1366px时,应用下面的CSS样式*/
  435. .overview .view-box .view-left .lb-bottom .place-bottom .place-box .place-right span {
  436. width: 200px;
  437. }
  438. }
  439. </style>
  440. <style lang="less">
  441. .view-right-bottom {
  442. .el-table td,
  443. .el-table th {
  444. padding: 3px 0;
  445. }
  446. }
  447. </style>