fanzhen0109

This commit is contained in:
fanzhen123
2020-01-09 18:42:40 +08:00
parent 6928ddbc11
commit f250f6698f
7 changed files with 125 additions and 29 deletions

View File

@@ -248,7 +248,7 @@ class computedFunc {
// 重定向数组 // 重定向数组
let listArrs = JSON.parse(JSON.stringify(listArr)) let listArrs = JSON.parse(JSON.stringify(listArr))
let lineArrs = JSON.parse(JSON.stringify(lineArr)) let lineArrs = JSON.parse(JSON.stringify(lineArr))
listArrs.push(0) // 必选第一项 listArrs.unshift(0) // 必选第一项
if (this.restur.tableLine.length < listArrs.length) { if (this.restur.tableLine.length < listArrs.length) {
listArrs = this.restur.tableLine.map((item, index) => { listArrs = this.restur.tableLine.map((item, index) => {
return index return index
@@ -261,10 +261,12 @@ class computedFunc {
} }
// 处理数据显示 // 处理数据显示
this.selectData.tableLine = [] this.selectData.tableLine = []
console.log(this.restur.tableLine, 'this.restur.tableLine')
console.log(listArrs, lineArrs)
listArrs.forEach((items, indexs) => { listArrs.forEach((items, indexs) => {
this.selectData.tableLine.push({ this.selectData.tableLine.push({
labelId: this.restur.tableLine[indexs].labelId, labelId: this.restur.tableLine[items].labelId,
label: this.restur.tableLine[indexs].label label: this.restur.tableLine[items].label
}) })
}) })
// this.selectData.tableLine = this.restur.tableLine // this.selectData.tableLine = this.restur.tableLine
@@ -1156,6 +1158,7 @@ class computedFunc {
dataPieMapRow () { dataPieMapRow () {
let termsLine = [] let termsLine = []
let cloneLine = JSON.parse(JSON.stringify(this.selectData.tableLine)) let cloneLine = JSON.parse(JSON.stringify(this.selectData.tableLine))
console.log(cloneLine, 'cloneLine')
cloneLine.forEach((item, index) => { cloneLine.forEach((item, index) => {
if (index !== 0) { if (index !== 0) {
termsLine.push(item.label) termsLine.push(item.label)
@@ -1187,6 +1190,7 @@ class computedFunc {
} }
} }
}) })
console.log(this.chartsDatazzPie)
return this.chartsDatazzPie return this.chartsDatazzPie
} }
// 饼图数据 ============列转换 // 饼图数据 ============列转换

View File

@@ -7,13 +7,14 @@
@rowColInd="rowColInd" @rowColInd="rowColInd"
:echartsDatartsPie="echartsDatartsPie" :echartsDatartsPie="echartsDatartsPie"
></Echarts> ></Echarts>
<el-table :data="tableData" style="width: 100%" height="360" ref="table"> <el-table :data="tableData" style="width: 100%" height="360px" ref="table">
<el-table-column <el-table-column
:prop="item.labelId" :prop="item.labelId"
:label="item.label" :label="item.label"
:fixed="index===0?true:false" :fixed="index===0?true:false"
width="180" :width="computedWidth(index)"
sortable sortable
show-overflow-tooltip
v-for="(item,index) in tableLine" v-for="(item,index) in tableLine"
:key="index" :key="index"
> >
@@ -369,7 +370,9 @@ export default {
// 高级查询数据 // 高级查询数据
startsyui: false, startsyui: false,
// 初始化左侧状态 // 初始化左侧状态
leftState: false leftState: false,
// 列宽数组
lieWidthArr: []
} }
}, },
watch: { watch: {
@@ -460,7 +463,6 @@ export default {
deep: true deep: true
}, },
downLaSelectArea (valStrinf) { downLaSelectArea (valStrinf) {
console.log(this.$store.state.AreaAllCountData, '555222000')
console.log(valStrinf, '555222000选中') console.log(valStrinf, '555222000选中')
console.log(this.$store.state.AreaAllCountData, 'kkkkk数据') console.log(this.$store.state.AreaAllCountData, 'kkkkk数据')
if (!this.$store.state.advancedSearchState) { if (!this.$store.state.advancedSearchState) {
@@ -473,9 +475,9 @@ export default {
this.$store.state.areaIndexName = valStrinf this.$store.state.areaIndexName = valStrinf
this.selectState = 2 this.selectState = 2
} }
if (this.leftState) { // if (this.leftState) {
this.getDatas() this.getDatas()
} // }
} else { } else {
console.log(this.leftState, '走这里') console.log(this.leftState, '走这里')
if (this.$store.state.newSelectDaaState) { if (this.$store.state.newSelectDaaState) {
@@ -487,9 +489,9 @@ export default {
this.$store.state.areaIndexName = valStrinf this.$store.state.areaIndexName = valStrinf
this.selectState = 2 this.selectState = 2
} }
if (this.leftState) { // if (this.leftState) {
this.advancedSearchDataShow() this.advancedSearchDataShow()
} // }
} }
}, },
// 监听行列图表转换 // 监听行列图表转换
@@ -615,17 +617,45 @@ export default {
} }
}, },
methods: { methods: {
/**
* @desc 计算列宽,返回每一列中内容最大的那个的内容长度
* @return 返回一个含有每列最大的内容的长度的数组
*
* */
lieWidthComputed () {
// 总数据
let AllCountData = (this.tableData.map((item, index) => { return Object.values(item) }))
AllCountData.unshift(this.tableLine.map((item, index) => { return item.label }))
// 将数据进行行列转换
let zhuanChange = AllCountData[0].map((col, index) => {
return AllCountData.map((row, key) => {
return row[index].length
})
})
console.log(zhuanChange, 'AllCountData')
this.lieWidthArr = zhuanChange.map((item, index) => {
return item.reduce((total, currentValue) => {
return total > currentValue ? total : currentValue
})
})
console.log(this.lieWidthArr, 'this.lieWidthArr')
this.$nextTick(() => {
this.$refs.table.doLayout()
})
},
/** /**
* @desc 请求时间完成 后就执行 * @desc 请求时间完成 后就执行
* *
* */ * */
/* eslint-disable */ /* eslint-disable */
downLaSelects() { downLaSelects() {
console.log(this.$store.state.advancedSearchState, 'this.$store.state.advancedSearchState') console.log(this.$store.state.advancedSearchState, 'this.$store.state.advancedSearchState0000000000000000000000')
if (!this.$store.state.advancedSearchState) { if (this.leftState) {
this.getDatas() if (!this.$store.state.advancedSearchState) {
} else { this.getDatas()
this.advancedSearchDataShow() } else {
this.advancedSearchDataShow()
}
} }
}, },
// 获取所有当前分类下的所有的指标、地区、时间 // 获取所有当前分类下的所有的指标、地区、时间
@@ -668,6 +698,8 @@ export default {
this.tableData = objDatasAfter.countData this.tableData = objDatasAfter.countData
console.log(objDatasAfter, 'objDatasAfter') console.log(objDatasAfter, 'objDatasAfter')
} }
// 计算列宽的数组
this.lieWidthComputed()
}, },
// 地区数据转置 // 地区数据转置
areaTrans() { areaTrans() {
@@ -681,6 +713,13 @@ export default {
}) })
}) })
console.log(this.transBefore, 'transpositionData') console.log(this.transBefore, 'transpositionData')
// let transpositionDatas = JSON.parse(JSON.stringify(this.$store.state.allNochangeInitData.transBeforeAreaData))
// this.$store.state.allNochangeInitData.transBeforeAreaData = transpositionDatas[0].map(function (col, index) {
// return transpositionDatas.map((row, key) => {
// return row[index]
// })
// })
console.log(this.$store.state.allNochangeInitData.transBeforeAreaData, 'this.$store.state.allNochangeInitData.transBeforeAreaData')
// 数据转置完成恢复 // 数据转置完成恢复
this.$store.state.transClickState = false this.$store.state.transClickState = false
} }
@@ -727,6 +766,8 @@ export default {
console.log(comTransAreabeforeLabelArea, 'comTransAreabeforeLabelArea') console.log(comTransAreabeforeLabelArea, 'comTransAreabeforeLabelArea')
this.objCompBefore = objCompAfter this.objCompBefore = objCompAfter
} }
// 计算列宽的数组
this.lieWidthComputed()
}, },
// 渲染列表数据 // 渲染列表数据
showTable() { showTable() {
@@ -857,6 +898,8 @@ export default {
} }
} }
this.chartsShow() this.chartsShow()
// 计算列宽的数组
this.lieWidthComputed()
}, },
// 图表渲染 // 图表渲染
chartsShow() { chartsShow() {
@@ -1161,6 +1204,8 @@ export default {
// 行计算样式 // 行计算样式
computedLineSty() { computedLineSty() {
return (ind) => { return (ind) => {
// console.log(this.$store.state.allNochangeInitData, 'this.$store.state.allNochangeInitData')
// console.log(this.transBefore, 'this.transBefores19')
let styStatic = false let styStatic = false
if (this.transState) { if (this.transState) {
if (this.$route.query.type !== 'area') { if (this.$route.query.type !== 'area') {
@@ -1217,12 +1262,19 @@ export default {
// 监听全局表数据的的变化从而改变渲染数据 // 监听全局表数据的的变化从而改变渲染数据
transBefores() { transBefores() {
return this.$store.state.allState return this.$store.state.allState
},
// 计算列宽
computedWidth() {
return (strings) => {
return this.lieWidthArr[strings] * 20
}
} }
}, },
created() { created() {
// 还原高级查询状态 // 还原高级查询状态
// this.$store.state.advancedSearchState = false // this.$store.state.advancedSearchState = false
this.startsyui = this.advancedStates this.startsyui = this.advancedStates
this.leftState = false
}, },
updated() { updated() {
// 重新渲染表格 // 重新渲染表格
@@ -1235,6 +1287,7 @@ export default {
// this.showTable() // this.showTable()
// 转置状态 // 转置状态
this.transState = this.chartsStatusMegger.transState this.transState = this.chartsStatusMegger.transState
this.leftState = false
} }
} }
</script> </script>
@@ -1279,10 +1332,22 @@ export default {
.slotExplain:hover { .slotExplain:hover {
cursor: pointer; cursor: pointer;
} }
/deep/ .el-table .cell { /deep/ .cell {
display: flex; display: flex !important;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
flex-wrap: nowrap;
}
/deep/ .cell > span {
// white-space: nowrap;
flex-shrink: 0;
}
/deep/ .cell > span:hover {
cursor: pointer;
}
/deep/ .cell > img {
display: inline;
flex-shrink: 0;
} }
</style> </style>

View File

@@ -353,7 +353,6 @@ export default {
this.$emit('update:loading', false) this.$emit('update:loading', false)
} }
// 调用父组件的chuFachildChartCont方法渲染 // 调用父组件的chuFachildChartCont方法渲染
// this.$parent.chuFachildChartCont()
} }
}).catch((fail) => { }).catch((fail) => {
console.log(fail) console.log(fail)
@@ -652,12 +651,12 @@ export default {
if (value[0] === '序列') { if (value[0] === '序列') {
this.stateChangeSDF = !this.stateChangeSDF this.stateChangeSDF = !this.stateChangeSDF
this.$store.state.newSelectDaaState = this.stateChangeSDF this.$store.state.newSelectDaaState = this.stateChangeSDF
this.showLabelArea()
if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'dq') { if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'dq') {
this.$store.state.SelecttDimension.col = 'zb' this.$store.state.SelecttDimension.col = 'zb'
} else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { } else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') {
this.$store.state.SelecttDimension.col = 'dq' this.$store.state.SelecttDimension.col = 'dq'
} }
this.showLabelArea()
} else { } else {
this.$emit('statertfResu', value[0]) this.$emit('statertfResu', value[0])
} }

View File

@@ -209,6 +209,15 @@ export default {
this.$store.state.areaDimensionState = false this.$store.state.areaDimensionState = false
} }
this.$store.state.allNochangeInitData = JSON.parse(JSON.stringify(this.$store.state.transBefore)) this.$store.state.allNochangeInitData = JSON.parse(JSON.stringify(this.$store.state.transBefore))
let transpositionDatas = JSON.parse(JSON.stringify(this.$store.state.allNochangeInitData.transBeforeAreaData))
if (this.$store.state.befaultAfter === 'zz') {
this.$store.state.allNochangeInitData.transBeforeAreaData = transpositionDatas[0].map(function (col, index) {
return transpositionDatas.map((row, key) => {
return row[index]
})
})
this.$store.state.befaultAfter = 'wdzh'
}
}).catch((fail) => { }).catch((fail) => {
console.log(fail, 2369) console.log(fail, 2369)
}) })

View File

@@ -109,7 +109,9 @@ export default new Vuex.Store({
// 转置被点击了 // 转置被点击了
transClickState: false, transClickState: false,
// 初始化请求的所有数据(全局不变) // 初始化请求的所有数据(全局不变)
allNochangeInitData: null allNochangeInitData: null,
// 转置状态和维度转换状态先后(默认先点击维度转换)wdzh zz
befaultAfter: 'no'
}, },
mutations: {}, mutations: {},

View File

@@ -705,6 +705,7 @@ export default {
clickCate (hierarchy, ind, textType) { clickCate (hierarchy, ind, textType) {
switch (textType) { switch (textType) {
case '新增指标': case '新增指标':
this.cutStatic(0)
console.log(this.$store.state.transBefore, 'this.$store.state.transBefore') console.log(this.$store.state.transBefore, 'this.$store.state.transBefore')
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
this.$store.state.insertWindowState = true this.$store.state.insertWindowState = true
@@ -715,6 +716,7 @@ export default {
} }
break break
case '筛选': case '筛选':
this.cutStatic(0)
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
this.$store.state.selcettWindowState = true this.$store.state.selcettWindowState = true
} else { } else {
@@ -724,6 +726,7 @@ export default {
} }
break break
case '恢复':// 恢复 case '恢复':// 恢复
this.cutStatic(0)
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
this.$router.go(0) this.$router.go(0)
} else { } else {
@@ -733,6 +736,7 @@ export default {
} }
break break
case '清除空行空列':// 清除空行空列 case '清除空行空列':// 清除空行空列
this.cutStatic(0)
// this.$router.go(0) // this.$router.go(0)
// console.log(this.$store.state.transBefore, 'this.$store.state.transBefore') // console.log(this.$store.state.transBefore, 'this.$store.state.transBefore')
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
@@ -837,6 +841,7 @@ export default {
} }
break break
case '编辑': case '编辑':
this.cutStatic(0)
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
this.$store.state.editWindowState = true this.$store.state.editWindowState = true
} else { } else {
@@ -846,11 +851,15 @@ export default {
} }
break break
case '转置': case '转置':
if (this.$store.state.befaultAfter !== 'wdzh') {
this.$store.state.befaultAfter = 'zz'
}
this.cutStatic(0)
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
// 当前数据是地区数据时点击转置需要将数据进行转置 // 当前数据是地区数据时点击转置需要将数据进行转置
if (this.$route.query.type === 'area') { if (this.$route.query.type === 'area') {
// let transpositionData = JSON.parse(JSON.stringify(this.$store.state.transBefore.transBeforeAreaData)) // let transpositionData = JSON.parse(JSON.stringify(this.$store.state.allNochangeInitData.transBeforeAreaData))
// this.$store.state.transBefore.transBeforeAreaData = transpositionData[0].map(function (col, index) { // this.$store.state.allNochangeInitData.transBeforeAreaData = transpositionData[0].map(function (col, index) {
// return transpositionData.map((row, key) => { // return transpositionData.map((row, key) => {
// return row[index] // return row[index]
// }) // })
@@ -871,8 +880,10 @@ export default {
confirmButtonText: '确定' confirmButtonText: '确定'
}) })
} }
// this.$refs.childChartCont.lieWidthComputed()
break break
case '维度转换': case '维度转换':
this.cutStatic(0)
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
if (this.$route.query.type === 'area') { if (this.$route.query.type === 'area') {
this.$store.state.dimensionState = true this.$store.state.dimensionState = true
@@ -886,6 +897,7 @@ export default {
} }
break break
case '保存默认':// 将分类id 和 分类数据存入本地 case '保存默认':// 将分类id 和 分类数据存入本地
this.cutStatic(0)
// 获取本地保存数据 // 获取本地保存数据
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
if (JSON.parse(sessionStorage.getItem('classFiyData'))) { if (JSON.parse(sessionStorage.getItem('classFiyData'))) {
@@ -918,6 +930,7 @@ export default {
} }
break break
case '恢复默认':// 将分类id 和 分类数据从本地删除 case '恢复默认':// 将分类id 和 分类数据从本地删除
this.cutStatic(0)
if (this.$store.state.transBefore) { if (this.$store.state.transBefore) {
if (JSON.parse(sessionStorage.getItem('classFiyData'))) { if (JSON.parse(sessionStorage.getItem('classFiyData'))) {
let arrtsBGY = JSON.parse(sessionStorage.getItem('classFiyData')) let arrtsBGY = JSON.parse(sessionStorage.getItem('classFiyData'))

View File

@@ -5,7 +5,7 @@
<!-- content --> <!-- content -->
<section class="content"> <section class="content">
<!-- swiper --> <!-- swiper -->
<swiper :options="swiperOption" class="swipersty"> <swiper :options="swiperOption" class="swipersty" v-if="bannerLuBo.length">
<swiper-slide v-for="(item,index) in bannerLuBo" :key="index"> <swiper-slide v-for="(item,index) in bannerLuBo" :key="index">
<img <img
@click="loctionHref(item.url)" @click="loctionHref(item.url)"
@@ -165,11 +165,15 @@ export default {
data () { data () {
return { return {
swiperOption: { swiperOption: {
slidesPerView: 1,
spaceBetween: 30, spaceBetween: 30,
centeredSlides: true, loop: true,
autoplay: { autoplay: {
delay: 2500, delay: 2500,
disableOnInteraction: false stopOnLastSlide: false,
disableOnInteraction: true,
reverseDirection: false,
waitForTransition: false
}, },
pagination: { pagination: {
el: '.swiper-pagination', el: '.swiper-pagination',
@@ -375,7 +379,7 @@ export default {
}, },
methods: { methods: {
loctionHref (url) { loctionHref (url) {
console.log(url) console.log(url, 'url')
window.location.href = url window.location.href = url
}, },
handleClick (tab, event) { handleClick (tab, event) {