Commit c9091069 authored by wangjiankun's avatar wangjiankun

fix: 导出、下载技术资料添加权限按钮

parent 6fc39822
......@@ -361,3 +361,10 @@
background-color: #3974CA!important;
border-color: #3974CA!important;
}
.el-button.is-disabled {
color: #C0C4CC!important;
cursor: not-allowed!important;
background-image: none!important;
background-color: #FFF!important;
border-color: #EBEEF5!important;
}
......@@ -3,8 +3,9 @@
<el-container>
<el-aside :width="isCollapse ? 'auto' : '200px'">
<div class="logo-title-sign">
<img src="@assets/img/tenio-logo.png" width="21" height="21">
<b>户型地图大数据</b>
<!-- <img src="@assets/img/tenio-logo.png" width="21" height="21">-->
<!-- <b>户型地图大数据</b>-->
<img src="@assets/img/logo.png" alt="">
</div>
<transition name="fade">
<el-menu
......@@ -97,7 +98,6 @@ export default {
searchByUserInfo() {
getUserInfo().then((res) => {
console.log(res);
if(res.code === '200'){
this.avatar = res.data.headImg;
this.userName = res.data.realName
......
......@@ -42,8 +42,12 @@ const user = {
setToken(data.Authentication)
commit('SET_TOKEN', data.Authentication)
commit('SET_AUTH', data.authorities)
sessionStorage.setItem('auth', data.authorities.split(','))
sessionStorage.setItem('userName', username)
if(username === 'admin') {
sessionStorage.setItem('access', 'master')
} else {
sessionStorage.setItem('access', data.authorities)
console.log(sessionStorage.getItem('access'))
}
resolve()
}).catch(error => {
reject(error)
......
......@@ -59,7 +59,13 @@
</el-radio-group>
</div>
<div style="width: 100%;text-align: right">
<el-button type="primary" size="small" :loading="exportLoading" :disabled="exportLoading" @click="exportPlateAnalysis">导出数据</el-button>
<el-button
:title="!haveAuth('dataAnalysisExport') ? '无权限' : ''"
type="primary"
size="small"
:loading="exportLoading"
:disabled="!haveAuth('dataAnalysisExport')"
@click="exportPlateAnalysis">导出数据</el-button>
</div>
</div>
<el-card :body-style="{padding: '0'}">
......@@ -183,11 +189,11 @@
import {downloadFile} from "../../assets/js/public";
export default {
name: "ProductAnalysis",
components:{
components: {
unitCard,
multiHeaderTable
},
data () {
data() {
return {
pieData: {
columns: ['productionPie', 'supplication'],
......@@ -206,8 +212,7 @@
},
histogramData: {
columns: [],
rows: [
]
rows: []
},
map: {
'nxmkAvg': '南向面宽',
......@@ -216,8 +221,8 @@
'kwmkAvg': '客卧面宽'
}, // 房屋数据 map匹配
histogramTableData: [],
chartSettings : {
axisSite: { right: ['下单率'] },
chartSettings: {
axisSite: {right: ['下单率']},
yAxisType: ['normal']
},
extend: {
......@@ -229,8 +234,10 @@
show: true,
fontSize: 11,
position: "top",
formatter:function(params){ //标签内容
if(params.data == 0) { return '' }
formatter: function (params) { //标签内容
if (params.data == 0) {
return ''
}
return params.data.toFixed(1)
}
}
......@@ -258,14 +265,10 @@
// 储存分页数据
pageList: [],
// 产品1: { page1: array[6] }
pageListMap: {
},
pageListMap: {},
// 多级表头数据
productionProjectData: [],
supplyRateMap: {
}, // 供应套数占比map
supplyRateMap: {}, // 供应套数占比map
unitDetailJsonExport: '' // 户型详细信息导出json处理后保存
}
},
......@@ -276,15 +279,15 @@
this.pageList[index].page = currentPage
},
// 导出板块产品分析-图表数据
exportPlateAnalysis () {
if(this.exportExcelSave) {
exportPlateAnalysis() {
if (this.exportExcelSave) {
this.exportLoading = true
exportAsExcel({
title: this.exportExcelSave.title,
dataJsonTwo: JSON.stringify(this.exportExcelSave.detilProductJsonDtoList),
dataJson: this.unitDetailJsonExport
}).then(res => {
if(res) {
if (res) {
const title = this.exportExcelSave.title.replace(/;/g, '-')
downloadFile(res, title, 'application/vnd.ms-excel;charset=utf-8').then(() => {
this.$message({
......@@ -306,9 +309,9 @@
}
},
// 区域变化后 根据区域map匹配对应的下属板块
changePlateForRegion (region) {
changePlateForRegion(region) {
this.plateVal = ''
if(this.plateMap[region] && this.plateMap[region].length > 0) {
if (this.plateMap[region] && this.plateMap[region].length > 0) {
this.plateOptions = this.plateMap[region]
} else {
this.plateOptions = []
......@@ -335,13 +338,15 @@
plateAnalysis(temp).then((res) => {
let supplyResult = 0
try {
res.data.pieDetilProductDtoList.forEach(item => { supplyResult += item.supplication })
res.data.pieDetilProductDtoList.forEach(item => {
supplyResult += item.supplication
})
} catch (e) {
supplyResult = 0
}
try {
res.data.pieDetilProductDtoList.forEach((item) => {
if(supplyResult === 0 && item.supplication === 0) {
if (supplyResult === 0 && item.supplication === 0) {
this.supplyRateMap[item.productionPie] = 0 + '%'
} else {
this.supplyRateMap[item.productionPie] = Number((item.supplication / supplyResult) * 100).toFixed(2) + '%'
......@@ -355,17 +360,17 @@
// 处理 面宽数据 格式: { roomInfo: '南向面宽', '产品1': num, '产品2': num2 }
let histomData = []
let colum = ['roomInfo']
if(res.data.barDetilDtoList && res.data.barDetilDtoList.length > 0) {
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) {
if (colum.length - 1 !== res.data.barDetilDtoList.length) {
colum.push(item.production)
}
if(!singleData.roomInfo) {
if (!singleData.roomInfo) {
singleData.roomInfo = this.map[key]
}
singleData[item.production] = item[key]
......@@ -377,13 +382,13 @@
this.histogramData.rows = histomData
// 处理多级表头数据
let resultArray = []
if(res.data.productQueryMap) {
if (res.data.productQueryMap) {
Object.keys(res.data.productQueryMap).forEach(item => {
let singleProduct = {
productionName: item,
productionProperties: []
}
if(res.data.productQueryMap[item]) {
if (res.data.productQueryMap[item]) {
res.data.productQueryMap[item].forEach(propertySinle => {
const singleData = {}
singleData.projectName = propertySinle.projectName
......@@ -397,9 +402,13 @@
singleData.masterRoomWidth = propertySinle.bnsProduct.masterRoomWidth
singleData.guestRoomWidth = propertySinle.bnsProduct.guestRoomWidth
try {
singleData.fileUrl = propertySinle.productImgList.find(item => { return item.fileOrder === 0 }).fileUrl
singleData.fileUrl = propertySinle.productImgList.find(item => {
return item.fileOrder === 0
}).fileUrl
// singleData.fileUrl = '/2020-07-29/project/33d5876350b04258b7c560a413689a47.jpg'
singleData.imgUrl = process.env.VUE_APP_OSS_SRC + propertySinle.productImgList.find(item => { return item.fileOrder === 0 }).fileUrl
singleData.imgUrl = process.env.VUE_APP_OSS_SRC + propertySinle.productImgList.find(item => {
return item.fileOrder === 0
}).fileUrl
// singleData.imgUrl = process.env.VUE_APP_OSS_SRC + '/2020-07-29/project/33d5876350b04258b7c560a413689a47.jpg'
} catch (e) {
singleData.fileUrl = ''
......@@ -407,9 +416,9 @@
}
singleData.imgList = propertySinle.productImgList || []
propertySinle.familyFunc.forEach(item => {
if(item.list) {
if (item.list) {
item.list.forEach(item2 => {
if(item2.checkboxGroup && item2.checkboxGroup.length > 0) {
if (item2.checkboxGroup && item2.checkboxGroup.length > 0) {
const value = item2.checkboxGroup[0]
singleData[item.parentName + '-' + item2.functionName] = propertyMapFunction[value]
} else {
......@@ -434,15 +443,14 @@
null: '--'
}
let dealArr = JSON.parse(JSON.stringify(resultArray)).map((item => {
if(item.productionProperties && item.productionProperties.length > 0) {
if (item.productionProperties && item.productionProperties.length > 0) {
item.productionProperties.map(item2 => {
Object.keys(tableDataType).forEach(key => {
if(tableDataType[key] === 'string') {
if (tableDataType[key] === 'string') {
item2[key] = item2[key] ? item2[key] : '--'
}
else if(tableDataType[key] === 'boolean') {
} else if (tableDataType[key] === 'boolean') {
item2[key] = booleanMap[item2[key]]
} else if(tableDataType[key] === 'img') {
} else if (tableDataType[key] === 'img') {
item2[key] = item2[key] ? item2[key] : null
}
})
......@@ -472,9 +480,9 @@
} catch (e) {
plateAnalysisQuery = undefined
}
if(plateAnalysisQuery && plateAnalysisQuery.adminRegion && plateAnalysisQuery.regionId) {
if (plateAnalysisQuery && plateAnalysisQuery.adminRegion && plateAnalysisQuery.regionId) {
res.data.forEach(item => {
if(!this.plateMap[item.adminRegionId]) {
if (!this.plateMap[item.adminRegionId]) {
this.plateMap[item.adminRegionId] = item.resultRegionDTOS
}
if (item.adminRegionId === plateAnalysisQuery.adminRegion) {
......@@ -483,14 +491,14 @@
})
this.regionVal = plateAnalysisQuery.adminRegion ? plateAnalysisQuery.adminRegion : ''
this.plateVal = plateAnalysisQuery.regionId ? plateAnalysisQuery.regionId : ''
this.timeVal = plateAnalysisQuery.year ? plateAnalysisQuery.year: new Date().getFullYear()
this.timeVal = plateAnalysisQuery.year ? plateAnalysisQuery.year : new Date().getFullYear()
this.areaInterval = plateAnalysisQuery.areaVal ? plateAnalysisQuery.areaVal : '0-70'
} else {
res.data.forEach(item => {
if(!this.plateMap[item.adminRegionId]) {
if (!this.plateMap[item.adminRegionId]) {
this.plateMap[item.adminRegionId] = item.resultRegionDTOS
}
if(item.resultRegionDTOS && item.resultRegionDTOS.length > 0 && !this.regionVal && !this.plateVal) {
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
......@@ -507,19 +515,19 @@
// }
})
}
if(callback) {
if (callback) {
callback()
}
})
},
// 获取产品类型下拉框数据 并赋保存的搜索值或者第一个值
getProductType (callback) {
getProductType(callback) {
queryProductionType('product_Type').then(res => {
this.houseTypeOptions = res.data
const plateAnalysisQuery = sessionStorage.getItem('plateAnalysisQuery')
if(plateAnalysisQuery) {
if (plateAnalysisQuery) {
const product_type = JSON.parse(plateAnalysisQuery).productType
if(product_type) {
if (product_type) {
this.houseTypeVal = product_type
} else {
this.houseTypeVal = res.data[0] ? res.data[0].businessId : ''
......@@ -529,13 +537,13 @@
this.houseTypeVal = res.data[0] ? res.data[0].businessId : ''
// this.houseTypeVal = res.data.find(item => { return item.name === '洋房' }).businessId
}
if(callback) {
if (callback) {
callback()
}
})
},
// 获取户型信息----产品户型图与图片
getPlateProductionIng () {
getPlateProductionIng() {
let temp = {
adminRegion: this.regionVal,
regionId: this.plateVal,
......@@ -563,19 +571,21 @@
plateAnalysisHouseImg(temp).then(res => {
let productionList = []
let pageList = []
if(res.data && res.data.length > 0) {
if (res.data && res.data.length > 0) {
res.data.forEach(item => {
let single = {}
single.productGroupName = item.productGroupName
let children = []
if(item.productQueryDtoList) {
if (item.productQueryDtoList) {
item.productQueryDtoList.forEach((item2) => {
let unit = {}
unit.unitHouse = (item2.bnsProduct.roomNumber || 0) + '-' + (item2.bnsProduct.hallNumber || 0) + '-' + (item2.bnsProduct.toiletNumber || 0)
unit.unitName = item2.projectName
unit.unitArea = item2.bnsProduct.unitArea
try {
unit.imgUrl = item2.productImgList.find(item => { return item.fileOrder === 0 }).fileUrl
unit.imgUrl = item2.productImgList.find(item => {
return item.fileOrder === 0
}).fileUrl
} catch (e) {
unit.imgUrl = ''
}
......@@ -603,12 +613,12 @@
// 注意截取数组不要用splice 要用slice
const productionListCopy = JSON.parse(JSON.stringify(productionList))
productionListCopy.forEach(item => {
if(!this.pageListMap[item.productGroupName]) {
if (!this.pageListMap[item.productGroupName]) {
this.pageListMap[item.productGroupName] = {}
}
item.children.forEach((item2, index2) => {
if(index2 % 6 === 0) {
this.pageListMap[item.productGroupName][index2/ 6 + 1] = item.children.slice(index2,index2 + 6)
if (index2 % 6 === 0) {
this.pageListMap[item.productGroupName][index2 / 6 + 1] = item.children.slice(index2, index2 + 6)
}
})
})
......@@ -616,6 +626,20 @@
})
}
},
computed: {
haveAuth() {
return (accessName) => {
const auth = sessionStorage.getItem('access')
if (auth === 'master') {
return true
}
if (!auth) {
return false
} else {
return auth.split(',').includes(accessName)
}
}
},
created() {
window.eventBus.$on('searchParamChange', (searchResult) => {
this.$router.push({
......@@ -625,7 +649,7 @@
})
},
beforeMount() {
for(let i = new Date().getFullYear(); i>= 1980; i--) {
for (let i = new Date().getFullYear(); i >= 1980; i--) {
this.timeOptions.push({
value: i,
label: i + '年'
......@@ -640,7 +664,7 @@
},
mounted() {
window.addEventListener('beforeunload', () => {
if(this.regionVal && this.plateVal) {
if (this.regionVal && this.plateVal) {
sessionStorage.setItem('plateAnalysisQuery', JSON.stringify({
adminRegion: this.regionVal,
regionId: this.plateVal,
......@@ -652,7 +676,7 @@
})
},
beforeDestroy() {
if(this.regionVal && this.plateVal) {
if (this.regionVal && this.plateVal) {
sessionStorage.setItem('plateAnalysisQuery', JSON.stringify({
adminRegion: this.regionVal,
regionId: this.plateVal,
......@@ -663,6 +687,7 @@
}
}
}
}
</script>
<style lang="stylus">
......
......@@ -33,7 +33,13 @@
</el-select>
</div>
<div style="width: 100%; text-align: right" >
<el-button type="primary" :loading="exportLoading" :disabled="exportLoading" size="small" @click="exportSupplyDataForeExcel">导出数据</el-button>
<el-button
:title="!haveAuth('supplyDemandExport') ? '无权限' : ''"
type="primary"
:loading="exportLoading"
:disabled="!haveAuth('supplyDemandExport')"
size="small"
@click="exportSupplyDataForeExcel">导出数据</el-button>
</div>
</div>
<el-card :body-style="{ padding: '0' }">
......@@ -279,8 +285,23 @@
}
}
},
computed: {
haveAuth() {
return (accessName) => {
const auth = sessionStorage.getItem('access')
if (auth === 'master') {
return true
}
if (!auth) {
return false
} else {
return auth.split(',').includes(accessName)
}
}
}
},
mounted() {
for(let i = new Date().getFullYear(); i>= 1980; i--) {
for(let i = new Date().getFullYear(); i>= 2014; i--) {
this.timeOptions.push({
value: i,
label: i + '年'
......
......@@ -11,9 +11,8 @@
</div>
<div class="bannerOptions">
<el-button type="danger"
v-if="haveAuth"
:title="propertyData.fileList.length === 0 ? '未查询到技术资料' : ''"
:disabled="propertyData.fileList.length === 0" @click="downloadDataFlag = true" >下载技术资料</el-button>
:title="!haveAuth('downloadFile') ? '无权限' : (propertyData.fileList.length === 0 ? '未查询到技术资料' : '')"
:disabled="propertyData.fileList.length === 0 || !haveAuth('downloadFile')" @click="downloadDataFlag = true" >下载技术资料</el-button>
<el-radio-group v-model="bannerType" @change="scorllTop">
<el-radio-button :label="0">总图</el-radio-button>
<el-radio-button :label="1">立面</el-radio-button>
......@@ -123,7 +122,12 @@
<div class="salesInfomation" v-if="bannerType !== 2">
<div class="title" style="padding-left: 20px">销售信息</div>
<div style="text-align: right;padding-right: 20px">
<el-button type="primary" :disabled="propertyExportLoading" :loading="propertyExportLoading" @click="propertySaleInfoExport">导出数据</el-button>
<el-button
:title="!haveAuth('propertyDetails') ? '无权限' : ''"
:disabled="!haveAuth('propertyDetails')"
:loading="propertyExportLoading"
type="primary"
@click="propertySaleInfoExport">导出数据</el-button>
</div>
<div ref="imgExport" class="container">
<el-row class="firstRow supplyDataDetail">
......@@ -841,15 +845,14 @@
},
computed: {
haveAuth() {
const userName = sessionStorage.getItem('userName')
if(userName === 'admin') {
return true
}
const auth = sessionStorage.getItem('auth')
return (accessName) => {
const auth = sessionStorage.getItem('access')
if(auth === 'master') { return true }
if(!auth) {
return false
} else {
return auth.split(',').includes('downloadFile')
return auth.split(',').includes(accessName)
}
}
},
colum () {
......
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