Commit aa243f73 authored by xingyuji's avatar xingyuji

Merge branch 'develop' into 'master'

fix: 导出字段问题;产品类型选择框无值的问题;表格字体换行问题;供应套数总为0的问题

修复四个主要问题
fix: 导出字段问题;产品类型选择框无值的问题;表格字体换行问题;供应套数总为0的问题

See merge request !12
parents 98001018 2dadbb4f
......@@ -8,7 +8,7 @@ export function plateAnalysis(data) {
export function plateAnalysisHouseImg(data) {
return xhr.post('/bnsproject/bns-project/withProjectAndProduct/getRegionProductImg', data)
}
// 导出数据
// 获取导出数据结构
export function exportExcelJson(data) {
return xhr.post('/bnsproject/bns-project/withProjectAndProduct/getRegionProductJson', data)
}
......@@ -18,3 +18,7 @@ export function queryProductionType(type) {
type
})
}
// 导出
export function exportAsExcel(data) {
return xhr.downloadFile('/bnsregion/bns-region/downloadCP',data)
}
......@@ -148,7 +148,7 @@
import { demoData } from "./tableHeader";
import { getRegionPlate } from "../../assets/js/api/plateSupplyManage";
import { unitArea } from "./unitArea";
import {plateAnalysis, queryProductionType, exportExcelJson} from "../../assets/js/api/projectManage";
import {plateAnalysis, queryProductionType, exportExcelJson, exportAsExcel} from "../../assets/js/api/projectManage";
export default {
name: "ProductAnalysis",
......@@ -169,16 +169,15 @@
}
},
histogramData: {
columns: ['roomInfo'],
columns: [],
rows: [
{ 'roomInfo': '南向面宽' }
]
},
map: {
'nxmk': '南向面宽',
'qjsmk': '起居室面宽',
'zwmk': '主卧面宽',
'kwmk': '客卧面宽'
'nxmkAvg': '南向面宽',
'qjsmkAvg': '起居室面宽',
'zwmkAvg': '主卧面宽',
'kwmkAvg': '客卧面宽'
}, // 房屋数据 map匹配
histogramTableData: [],
chartSettings : {
......@@ -190,30 +189,63 @@
type: 'bar',
barWidth: 30
}
},
regionOptions: [],
regionVal: '',
plateOptions: [],
plateVal: '',
timeOptions: [],
timeVal: '',
houseTypeOptions: [],
houseTypeVal: '',
areaInterval: '0-70',
areaIntervalData: unitArea,
showMode: 0,
colorsArr: colors,
headerTable: tableHeader,
}, //柱状图设置柱的宽度
regionOptions: [], // 区域数据
regionVal: '', //区域id绑定
plateOptions: [], // 板块数据
plateVal: '', // 板块值绑定
timeOptions: [], // 年份数据
timeVal: '', //年份下拉框绑定
houseTypeOptions: [], // 产品类型下拉框数据
houseTypeVal: '', // 产品类型下拉框绑定
areaInterval: '0-70', // 面积区间 下拉框取值
areaIntervalData: unitArea, // 面积区间-固定数据
showMode: 0, // 板块产品分析-显示户型还是分析
colorsArr: colors, // 图表颜色风格
headerTable: tableHeader, // 多级表头-表头数据
plateMap: {
// 格式为 regionId: plateData 即区域Id所对应的下属板块数据
},
exportLoading: false
exportLoading: false, // 导出lodaing
exportExcelSave: null // 保存的excel表格数据
}
},
methods: {
// 导出板块产品分析-图表数据
exportPlateAnalysis () {
if(this.exportExcelSave) {
this.exportLoading = true
exportAsExcel({
title: this.exportExcelSave.title,
dataJsonTwo: JSON.stringify(this.exportExcelSave.detilProductJsonDtoList)
}).then(res => {
if(res) {
const url = window.URL.createObjectURL(new Blob([res], { type: 'application/vnd.ms-excel;charset=utf-8' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', this.exportExcelSave.title.replace(/;/g, '-')) // 自定义下载文件名
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
this.$message({
type: 'success',
message: '导出完成'
})
this.exportLoading = false
} else {
this.$message({
type: 'warning',
message: '无结果'
})
this.exportLoading = false
}
}).catch(() => {
this.exportLoading = false
})
}
},
// 区域变化后 根据区域map匹配对应的下属板块
changePlateForRegion (region) {
this.plateVal = ''
if(this.plateMap[region] && this.plateMap[region].length > 0) {
......@@ -222,6 +254,7 @@
this.plateOptions = []
}
},
// 根据下拉框的值 筛选图表数据
getPlateAnalysisData() {
let temp = {
adminRegion: this.regionVal,
......@@ -239,24 +272,33 @@
// 处理 面宽数据 格式: { roomInfo: '南向面宽', '产品1': num, '产品2': num2 }
let histomData = []
let colum = ['roomInfo']
Object.keys(this.map).forEach(key => {
let singleData = {}
res.data.barDetilDtoList.forEach(item => {
if(colum.length - 1 !== res.data.barDetilDtoList.length) {
colum.push(item.production)
}
if(!singleData.roomInfo) {
singleData.roomInfo = this.map[key]
}
singleData[item.production] = item[key]
if(res.data.barDetilDtoList && res.data.barDetilDtoList.length > 0) {
Object.keys(this.map).forEach(key => {
// 单条数据预备对象
let singleData = {}
res.data.barDetilDtoList.forEach(item => {
// 将产品名称加入到
if(colum.length - 1 !== res.data.barDetilDtoList.length) {
colum.push(item.production)
}
if(!singleData.roomInfo) {
singleData.roomInfo = this.map[key]
}
singleData[item.production] = item[key]
})
histomData.push(singleData)
})
histomData.push(singleData)
})
}
this.histogramData.columns = colum
this.histogramData.rows = histomData
console.log(this.histogramData)
})
exportExcelJson(temp).then(res => {
console.log(res)
try {
this.exportExcelSave = JSON.parse(res.data)
} catch (e) {
this.exportExcelSave = null
}
})
},
getRegionAndPlate(callback) {
......@@ -282,7 +324,7 @@
if(!this.plateMap[item.adminRegionId]) {
this.plateMap[item.adminRegionId] = item.resultRegionDTOS
}
if(item.resultRegionDTOS && item.resultRegionDTOS.length > 0) {
if(item.resultRegionDTOS && item.resultRegionDTOS.length > 0 && !this.regionVal && !this.plateVal) {
this.plateOptions = item.resultRegionDTOS
this.regionVal = item.adminRegionId
this.plateVal = item.resultRegionDTOS[0].regionId
......@@ -290,19 +332,28 @@
}
})
}
callback && callback()
if(callback) {
callback()
}
})
},
getProductType (callback) {
queryProductionType('product_Type').then(res => {
console.log(res)
this.houseTypeOptions = res.data
try {
const product_type = JSON.parse(sessionStorage.getItem('plateAnalysisQuery')).productType
this.houseTypeVal = product_type || res.data[0].businessId
} catch (e) {
this.houseTypeVal = ''
const plateAnalysisQuery = sessionStorage.getItem('plateAnalysisQuery')
if(plateAnalysisQuery) {
const product_type = JSON.parse(plateAnalysisQuery).productType
if(product_type) {
this.houseTypeVal = product_type
} else {
this.houseTypeVal = res.data[0] ? res.data[0].businessId : ''
}
} else {
this.houseTypeVal = res.data[0] ? res.data[0].businessId : ''
}
callback && callback()
console.log(this.houseTypeVal)
callback()
})
}
},
......@@ -376,6 +427,7 @@
border-color: #d1ccc0;
background-color: #dedede;
text-align center
white-space nowrap
}
table.table td {
border-width: 1px;
......@@ -384,6 +436,7 @@
border-color: #d1ccc0;
background-color: #ffffff;
text-align center
white-space nowrap
}
}
.supplyAnalysisTable{
......
......@@ -112,17 +112,17 @@
<el-collapse v-model="soildInfoChange" class="sys-collapse">
<el-card :body-style="{padding: '0'}" class="box-card" v-for="(item,index) in dataType.plateRegion.resultBnsLandDTOS" :key="index">
<el-collapse-item :title="item.name" :name="index">
<p>行政分区:{{dataType.plateRegion.adminRegionName}}</p>
<p>所属板块: {{dataType.plateRegion.name}}</p>
<p>土地面积:{{item.landArea}}m<sup>2</sup></p>
<p>容积率:{{item.plotRatio}}%</p>
<p>建筑面积:{{item.builtArea}}m<sup>2</sup></p>
<p>建筑密度:{{item.builtDensity}}%</p>
<p>楼面价:{{item.floorPrice}}/m<sup>2</sup></p>
<p>成交日期:{{item.dealDate}}</p>
<p>成交价:{{item.dealPrice}}亿元</p>
<p>溢价率:{{item.premium}}%</p>
<p>受让方:{{item.assignee}}</p>
<p>行政分区:{{dataType.plateRegion.adminRegionName || '--'}}</p>
<p>所属板块: {{dataType.plateRegion.name || '--'}}</p>
<p>土地面积:{{item.landArea || '--'}}m<sup>2</sup></p>
<p>容积率:{{item.plotRatio || '--'}}%</p>
<p>建筑面积:{{item.builtArea || '--'}}m<sup>2</sup></p>
<p>建筑密度:{{item.builtDensity || '--'}}%</p>
<p>楼面价:{{item.floorPrice || '--'}}/m<sup>2</sup></p>
<p>成交日期:{{item.dealDate || '--'}}</p>
<p>成交价:{{item.dealPrice || '--'}}亿元</p>
<p>溢价率:{{item.premium || '--'}}%</p>
<p>受让方:{{item.assignee || '--'}}</p>
</el-collapse-item>
</el-card>
</el-collapse>
......@@ -134,12 +134,12 @@
</div>
<div class="infomationContainer">
<div class="propertyListName" style="color: #1482f0" @click="toPropertyDetail(item.businessId)">{{item.name}}</div>
<p>价格:{{item.price}}/m<sup>2</sup></p>
<p>产品类型: {{item.productType}}</p>
<p>占地面积:{{item.landArea}}<sup>2</sup></p>
<p>建筑面积:{{item.totalArea}}<sup>2</sup></p>
<p>容积率:{{item.plotRatio}}</p>
<p>开盘时间:{{item.openTime}}</p>
<p>价格:{{item.price || '--'}}/m<sup>2</sup></p>
<p>产品类型: {{item.productType || '--'}}</p>
<p>占地面积:{{item.landArea || '--'}}<sup>2</sup></p>
<p>建筑面积:{{item.totalArea || '--'}}<sup>2</sup></p>
<p>容积率:{{item.plotRatio || '--'}}</p>
<p>开盘时间:{{item.openTime || '--'}}</p>
</div>
</el-card>
</div>
......@@ -153,7 +153,7 @@
<p class="propertyDetail"
v-for="(val, key, index) in propertyDetailDataMap"
:key="index"
v-html="val.name + ':' + (propertyDetailData[key] || '---') + val.defaultSetting">
v-html="val.name + ':' + (propertyDetailData[key] || '--') + val.defaultSetting">
</p>
</div>
</div>
......
......@@ -158,7 +158,7 @@
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', `${this.regionVal}${this.plateVal}板块${this.timeVal}年份供求信息`) // 自定义下载文件名
link.setAttribute('download', `${this.regionVal}-${this.plateVal}-${this.timeVal}年份供求信息`) // 自定义下载文件名
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
......@@ -201,11 +201,11 @@
})
areaRange.push(areaRangeMap[key])
rate.push(res.data[key] ? (res.data[key].rate || 0) : 0)
supplyNumber.push(res.data[key] ? (res.data[key].supplyNumber || 0) : 0)
supplyNumber.push(res.data[key] ? (res.data[key].suplyNumber || 0) : 0)
dealNumber.push(res.data[key] ? (res.data[key].dealNumber || 0) : 0)
exportList.push({
areaRange: areaRangeMap[key],
supplyNumber: res.data[key] ? (res.data[key].supplyNumber || 0) : 0,
supplyNumber: res.data[key] ? (res.data[key].suplyNumber || 0) : 0,
dealNumber: res.data[key] ? (res.data[key].dealNumber || 0) : 0
})
})
......@@ -318,6 +318,7 @@
border-color: #d1ccc0;
background-color: #dedede;
text-align center
white-space nowrap
}
table.table td {
border-width: 1px;
......@@ -326,6 +327,7 @@
border-color: #d1ccc0;
background-color: #ffffff;
text-align center
white-space nowrap
}
.tips {
font-size 16px
......
......@@ -119,11 +119,11 @@
<th>卫生间数</th>
</tr>
<tr v-for="item in supplyData.rows">
<td>{{item.production}}</td>
<td>{{item.kjNum}}</td>
<td>{{item.jsNum}}</td>
<td>{{item.tingNum}}</td>
<td>{{item.wsjNum}}</td>
<td>{{item.production || '--'}}</td>
<td>{{item.kjNum || '--'}}</td>
<td>{{item.jsNum || '--'}}</td>
<td>{{item.tingNum || '--'}}</td>
<td>{{item.wsjNum || '--'}}</td>
</tr>
</table>
</el-col>
......@@ -140,11 +140,11 @@
<th>客卧面宽</th>
</tr>
<tr v-for="item in supplyTableData">
<td>{{item.production}}</td>
<td>{{item.nxmk}}</td>
<td>{{item.qjsmk}}</td>
<td>{{item.zwmk}}</td>
<td>{{item.kwmk}}</td>
<td>{{item.production || '--'}}</td>
<td>{{item.nxmk || '--'}}</td>
<td>{{item.qjsmk || '--'}}</td>
<td>{{item.zwmk || '--'}}</td>
<td>{{item.kwmk || '--'}}</td>
</tr>
</table>
</el-col>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment