index.vue 16 KB

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