From ca8fac994df4df5b168c88554d897c4a7257ddef Mon Sep 17 00:00:00 2001 From: fanzhen123 <1575502816@qq.com> Date: Sun, 12 Jan 2020 17:25:17 +0800 Subject: [PATCH] fanzhen0108 --- src/assets/js/computeddata.js | 6 + src/components/chartsCont/ChartsCont.vue | 404 ++++++++++-------- src/components/chartsCut/ChartsCut.vue | 57 ++- src/components/dimension/Dimension.vue | 1 + src/components/editCom/EditCom.vue | 369 +++++++++++++--- .../noAreaDimension/NoAreaDimension.vue | 27 +- src/store.js | 17 +- src/views/datasweb/Datasweb.vue | 238 +++++++---- 8 files changed, 758 insertions(+), 361 deletions(-) diff --git a/src/assets/js/computeddata.js b/src/assets/js/computeddata.js index cb263ad..d11ce24 100644 --- a/src/assets/js/computeddata.js +++ b/src/assets/js/computeddata.js @@ -520,8 +520,14 @@ class computedFunc { labelId: 'table_line' + dataRs.tableLine.length }) let bth = dataRs.countData.map((item, index) => { + // console.log(item, 'item002255') var arr = Object.values(item) arr.shift() + if (arr.length < 2) { + arr.push('0') + arr.push('0') + } + console.log(arr, 'arr000') return math.add(...arr).toFixed(2) }) dataRs.countData.forEach((item, index) => { diff --git a/src/components/chartsCont/ChartsCont.vue b/src/components/chartsCont/ChartsCont.vue index d1fcbb7..c79a50f 100644 --- a/src/components/chartsCont/ChartsCont.vue +++ b/src/components/chartsCont/ChartsCont.vue @@ -62,7 +62,7 @@ -
{{transBefore.tableExplain}}
+
暂无数据
@@ -108,10 +108,6 @@ export default { // type: String, // required: true // }, - downLaSelectArea: { - type: String, - required: false - }, showTableState: { type: Boolean, required: true @@ -372,7 +368,9 @@ export default { // 初始化左侧状态 leftState: false, // 列宽数组 - lieWidthArr: [] + lieWidthArr: [], + // 指标或地区次数 true为1次 false为非1次 + labelAreaNum: true } }, watch: { @@ -405,6 +403,8 @@ export default { tableData: { handler () { this.$store.state.tableData = this.tableData + // console.log('需要保存默认的数据') + this.needSaveDefaultData() }, immediate: true, deep: true @@ -462,38 +462,6 @@ export default { immediate: true, deep: true }, - downLaSelectArea (valStrinf) { - console.log(valStrinf, '555222000选中') - console.log(this.$store.state.AreaAllCountData, 'kkkkk数据') - if (!this.$store.state.advancedSearchState) { - if (this.$store.state.newSelectDaaState) { - this.$store.state.labelIndexName = valStrinf - this.$store.state.areaIndexName = '' - this.selectState = 1 - } else { - this.$store.state.labelIndexName = '' - this.$store.state.areaIndexName = valStrinf - this.selectState = 2 - } - // if (this.leftState) { - this.getDatas() - // } - } else { - console.log(this.leftState, '走这里') - if (this.$store.state.newSelectDaaState) { - this.$store.state.labelIndexName = valStrinf - this.$store.state.areaIndexName = '' - this.selectState = 1 - } else { - this.$store.state.labelIndexName = '' - this.$store.state.areaIndexName = valStrinf - this.selectState = 2 - } - // if (this.leftState) { - this.advancedSearchDataShow() - // } - } - }, // 监听行列图表转换 rowColIndex (newVal, oldVal) { if (this.transBefore) { @@ -504,35 +472,31 @@ export default { defaultDataRight: { handler (val) { console.log(val, '左侧数据变化') + this.$store.state.defaultShowDataState = false + // 还原转置状态和行列状态 + this.transState = true + this.chartsStatusMegger.transState = this.transState + if (this.$route.query.type !== 'area') { + this.$store.state.SelecttDimension = { + row: 'sj', + col: 'zb' + } + } else { + this.$store.state.SelecttDimension = { + row: 'sj', + col: 'dq' + } + } if (val) { // 初始化公共数据 - // console.log(this.objCompBefore, 'this.objCompBefore') - if (JSON.parse(sessionStorage.getItem('classFiyData')) && JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id)) { - this.transBefore = {} - this.transBefore.tableExplain = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.tableExplain - this.transBefore.timeArr = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.timeArr.map((item, index) => { return item.toString() }) - this.transBefore.termsName = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.termsName - this.transBefore.termsExplain = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.termsExplain - this.transBefore.areaName = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.areaName - this.transBefore.transBeforeTermsData = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.transBeforeTermsData - this.transBefore.transBeforeAreaData = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.transBeforeAreaData - console.log(this.transBefore, '000kkkkkkkkkkkkk') - this.$store.state.transdtr = true - // 全局总数据 - this.$store.state.transBefore = this.transBefore - // 全局永久不变数据 - this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - } else { - console.log(this.defaultDataRight, '获取左侧选中数据555') - console.log(this.$store.state.selectData, 'this.$store.state.selectData') - console.log(this.$store.state.selectfilter, 'this.$store.state.selectfilter') - this.leftState = false - // 恢复高级查询状态 - this.$store.state.advancedSearchState = false - } + // console.log(this.defaultDataRight, '获取左侧选中数据555') + this.leftState = false + // 恢复高级查询状态 + this.$store.state.advancedSearchState = false // 调接口拿到所有当前分类下的所有的指标、地区、时间 this.getInfor([val.id]) } + // 默认数据关闭 }, immediate: false, deep: true @@ -540,24 +504,24 @@ export default { // 监听下拉状态变化 stateTells (val) { console.log(val, 'jjjjjj') - if (val) { - if (JSON.parse(sessionStorage.getItem('classFiyData')) && JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id)) { - this.transBefore = {} - this.transBefore.tableExplain = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.tableExplain - this.transBefore.timeArr = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.timeArr.map((item, index) => { return item.toString() }) - this.transBefore.termsName = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.termsName - this.transBefore.termsExplain = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.termsExplain - this.transBefore.areaName = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.areaName - this.transBefore.transBeforeTermsData = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.transBeforeTermsData - this.transBefore.transBeforeAreaData = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.transBeforeAreaData - console.log(this.transBefore, '000') - // this.$store.state.transdtr = true - // 全局总数据 - this.$store.state.transBefore = this.transBefore - // 全局永久不变数据 - this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - } - } + // if (val) { + // if (JSON.parse(sessionStorage.getItem('classFiyData')) && JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id)) { + // this.transBefore = {} + // this.transBefore.tableExplain = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.tableExplain + // this.transBefore.timeArr = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.timeArr.map((item, index) => { return item.toString() }) + // this.transBefore.termsName = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.termsName + // this.transBefore.termsExplain = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.termsExplain + // this.transBefore.areaName = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.areaName + // this.transBefore.transBeforeTermsData = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.transBeforeTermsData + // this.transBefore.transBeforeAreaData = JSON.parse(sessionStorage.getItem('classFiyData')).find(item => item.id === this.defaultDataRight.id).data.transBeforeAreaData + // console.log(this.transBefore, '000') + // // this.$store.state.transdtr = true + // // 全局总数据 + // this.$store.state.transBefore = this.transBefore + // // 全局永久不变数据 + // this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) + // } + // } }, // 筛选 statesDf (val) { @@ -617,6 +581,60 @@ export default { } }, methods: { + /** + * @desc 显示默认的数据 + * + * */ + showSaveDefaultData () { + + }, + /** + * @desc 调接口显示表格数据 + * @param valStrinf string 当前选中的时间 + * + * */ + downLaSelectArea (valStrinf) { + console.log(valStrinf, '555222000选中') + console.log(this.$store.state.AreaAllCountData, 'kkkkk数据') + if (this.$store.state.defaultShowDataState && this.labelAreaNum) { + this.transBefore = this.$store.state.transBefore + } else { + if (!this.$store.state.advancedSearchState) { + if (this.$store.state.newSelectDaaState) { + this.$store.state.labelIndexName = valStrinf + this.$store.state.areaIndexName = '' + this.selectState = 1 + } else { + this.$store.state.labelIndexName = '' + this.$store.state.areaIndexName = valStrinf + this.selectState = 2 + } + this.getDatas() + } else { + console.log(this.leftState, '走这里') + if (this.$store.state.newSelectDaaState) { + this.$store.state.labelIndexName = valStrinf + this.$store.state.areaIndexName = '' + this.selectState = 1 + } else { + this.$store.state.labelIndexName = '' + this.$store.state.areaIndexName = valStrinf + this.selectState = 2 + } + this.advancedSearchDataShow() + } + } + this.labelAreaNum = false + }, + /** + * @desc 计算需要保存默认的数据 + * @return 返回一个保存默认数据的对象改变store中的数据 + * + * */ + needSaveDefaultData () { + // console.log(this.tableLine) + // console.log(this.tableData) + }, /** * @desc 计算列宽,返回每一列中内容最大的那个的内容长度 * @return 返回一个含有每列最大的内容的长度的数组 @@ -677,8 +695,34 @@ export default { this.$store.state.dataArealabelTime = res.data.data // 该分类下无数据 this.$store.state.classifyIdDataState = false + // ======================= + this.$store.state.transdtr = true + this.transBefore = null + // 全局总数据 + this.$store.state.transBefore = null + this.$store.state.allNochangeInitData = null + this.$store.state.noChangeData = null + // 调用父组件的comTime方法告诉父组件重置状态 + this.$store.state.noDataState = false + this.leftState = true + } + if (this.$store.state.defaultShowDataState && this.$route.query.type !== 'area') { + this.$store.state.transdtr = true + // 全局总数据 + this.transBefore = this.$store.state.transBefore + this.leftState = true + console.log(this.$store.state.transBefore, 'this.transBefore if') + console.log(this.$store.state.SelecttDimension, 'this.$store.state.SelecttDimension') + if (this.$store.state.SelecttDimension.col === 'zb' && this.$store.state.SelecttDimension.row === 'sj') { + this.transState = true + } else if (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'zb') { + this.transState = false + } + this.chartsStatusMegger.transState = this.transState + } else { + console.log(this.$store.state.transBefore, 'this.transBefore else') + this.$parent.childChartsCutShow() } - this.$parent.childChartsCutShow() }).catch((fail) => { console.log(fail) }) @@ -692,8 +736,8 @@ export default { this.tableData = objDatasBefore.countData console.log(objDatasBefore, 'objDatasBefore') } else { // 当指标名称在表头上 - let objCompAfter = new ComputedData(this.transBefore) - var objDatasAfter = objCompAfter.comTransAfter() + this.objCompBefore = new ComputedData(this.transBefore) + var objDatasAfter = this.objCompBefore.comTransAfter() this.tableLine = objDatasAfter.tableLine this.tableData = objDatasAfter.countData console.log(objDatasAfter, 'objDatasAfter') @@ -1022,58 +1066,79 @@ export default { this.objCompBefore.initAllData() } console.log(this.$store.state.selectData, '执行') - this.$axios({ - method: 'GET', - url: 'data/data/detail', - params: { - type: this.$route.query.type === 'area' ? 2 : 1, // 1非地区 2地区 - table_name: this.defaultDataRight.table_name, // 表名 - id: this.defaultDataRight.id, // 分类id - area: this.$store.state.areaIndexName, // 选中的地区 - quota: this.$store.state.labelIndexName, // 选中的指标 - cate: this.selectState, // 1筛选指标 2筛选地区 - f: this.$store.state.selectfilter, // year=>年度分类,monthly=>月度分类,quarter=>季度分类 - data: this.$store.state.selectData // 时间 - } - }).then(res => { - console.log(res, '获取数据展示数据') - // 请求接口完成 请求成功 - if (res.data.code === 200) { - if (res.data.data.areaName.length !== 0) { - if (this.downLaSelect.area === '' || this.downLaSelect.label === '') { - console.log(this.downLaSelect.area, 'this.downLaSelect.area') - let brrtf = {} - // this.transBefore = {} - brrtf.tableExplain = res.data.data.tableExplain - brrtf.timeArr = res.data.data.timeArr.map((item, index) => { return item.toString() }) - brrtf.termsName = res.data.data.termsName - brrtf.termsExplain = res.data.data.termsExplain - brrtf.areaName = res.data.data.areaName - if (this.$route.query.type === 'area') { - console.log('走这里') - brrtf.transBeforeAreaData = res.data.data.transBeforeAreaData[0] - brrtf.transBeforeTermsData = res.data.data.transBeforeTermsData + console.log(this.$store.state.selectDataLeft, '左侧选中') + if (this.$store.state.selectDataLeft) { + this.$axios({ + method: 'GET', + url: 'data/data/detail', + params: { + type: this.$route.query.type === 'area' ? 2 : 1, // 1非地区 2地区 + table_name: this.$store.state.selectDataLeft.table_name, // 表名 + id: this.$store.state.selectDataLeft.id, // 分类id + area: this.$store.state.areaIndexName, // 选中的地区 + quota: this.$store.state.labelIndexName, // 选中的指标 + cate: this.selectState, // 1筛选指标 2筛选地区 + f: this.$store.state.selectfilter, // year=>年度分类,monthly=>月度分类,quarter=>季度分类 + data: this.$store.state.selectData // 时间 + } + }).then(res => { + console.log(res, '获取数据展示数据') + // 请求接口完成 请求成功 + if (res.data.code === 200) { + if (res.data.data.areaName.length !== 0) { + if (this.downLaSelect.area === '' || this.downLaSelect.label === '') { + console.log(this.downLaSelect.area, 'this.downLaSelect.area') + let brrtf = {} + // this.transBefore = {} + brrtf.tableExplain = res.data.data.tableExplain + brrtf.timeArr = res.data.data.timeArr.map((item, index) => { return item.toString() }) + brrtf.termsName = res.data.data.termsName + brrtf.termsExplain = res.data.data.termsExplain + brrtf.areaName = res.data.data.areaName + if (this.$route.query.type === 'area') { + console.log('走这里') + brrtf.transBeforeAreaData = res.data.data.transBeforeAreaData[0] + brrtf.transBeforeTermsData = res.data.data.transBeforeTermsData + } else { + brrtf.transBeforeAreaData = res.data.data.transBeforeAreaData + brrtf.transBeforeTermsData = res.data.data.transBeforeTermsData[0] + } + console.log(brrtf, 'brrtf') + this.transBefore = brrtf + console.log(this.transBefore, '000') + this.$store.state.transdtr = true + // 全局总数据 + this.$store.state.transBefore = this.transBefore + // 全局永久不变数据 + this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) + if (this.selectState === 1) { + this.$store.state.labelArea = this.transBefore.termsName + } else { + this.$store.state.labelArea = this.transBefore.areaName + } + this.$store.state.AreaAllCountData = res.data.data + // 告诉父组件我完成任务重置状态 + this.$emit('prentsState', false) + console.log(this.$store.state.noChangeData, 'this.$store.state.noChangeDatathis.$store.state.noChangeDatathis.$store.state.noChangeData') } else { - brrtf.transBeforeAreaData = res.data.data.transBeforeAreaData - brrtf.transBeforeTermsData = res.data.data.transBeforeTermsData[0] + this.transBefore = {} + this.transBefore.tableExplain = res.data.data.tableExplain + this.transBefore.timeArr = res.data.data.timeArr.map((item, index) => { return item.toString() }) + this.transBefore.termsName = res.data.data.termsName + this.transBefore.termsExplain = res.data.data.termsExplain + this.transBefore.areaName = res.data.data.areaName + this.transBefore.transBeforeTermsData = res.data.data.transBeforeTermsData + this.transBefore.transBeforeAreaData = res.data.data.transBeforeAreaData + console.log(this.transBefore, '000') + this.$store.state.transdtr = true + // 全局总数据 + this.$store.state.transBefore = this.transBefore + // 全局永久不变数据 + this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) + + // 告诉父组件我完成任务重置状态 + this.$emit('prentsState', false) } - console.log(brrtf, 'brrtf') - this.transBefore = brrtf - console.log(this.transBefore, '000') - this.$store.state.transdtr = true - // 全局总数据 - this.$store.state.transBefore = this.transBefore - // 全局永久不变数据 - this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - if (this.selectState === 1) { - this.$store.state.labelArea = this.transBefore.termsName - } else { - this.$store.state.labelArea = this.transBefore.areaName - } - this.$store.state.AreaAllCountData = res.data.data - // 告诉父组件我完成任务重置状态 - this.$emit('prentsState', false) - console.log(this.$store.state.noChangeData, 'this.$store.state.noChangeDatathis.$store.state.noChangeDatathis.$store.state.noChangeData') } else { this.transBefore = {} this.transBefore.tableExplain = res.data.data.tableExplain @@ -1089,50 +1154,32 @@ export default { this.$store.state.transBefore = this.transBefore // 全局永久不变数据 this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - // 告诉父组件我完成任务重置状态 this.$emit('prentsState', false) } + this.hangZhiState = true + this.$emit('update:loading', false) } else { - this.transBefore = {} - this.transBefore.tableExplain = res.data.data.tableExplain - this.transBefore.timeArr = res.data.data.timeArr.map((item, index) => { return item.toString() }) - this.transBefore.termsName = res.data.data.termsName - this.transBefore.termsExplain = res.data.data.termsExplain - this.transBefore.areaName = res.data.data.areaName - this.transBefore.transBeforeTermsData = res.data.data.transBeforeTermsData - this.transBefore.transBeforeAreaData = res.data.data.transBeforeAreaData - console.log(this.transBefore, '000') - this.$store.state.transdtr = true + this.transBefore = null + // this.$store.state.transdtr = null // 全局总数据 - this.$store.state.transBefore = this.transBefore - // 全局永久不变数据 - this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - // 告诉父组件我完成任务重置状态 - this.$emit('prentsState', false) + this.$store.state.transBefore = null + this.$store.state.noChangeData = null + // 调用父组件的comTime方法告诉父组件重置状态 + this.$parent.comTime({ name: '', extendData: '', active: true }) + this.$store.state.noDataState = false + this.$emit('update:loading', false) } - this.hangZhiState = true - this.$emit('update:loading', false) - } else { - this.transBefore = null - // this.$store.state.transdtr = null - // 全局总数据 - this.$store.state.transBefore = null - this.$store.state.noChangeData = null - // 调用父组件的comTime方法告诉父组件重置状态 - this.$parent.comTime({ name: '', extendData: '', active: true }) - this.$store.state.noDataState = false - this.$emit('update:loading', false) - } - if (this.$route.query.type !== 'area') { - this.$store.state.SelecttDimension.col = 'zb' - this.$store.state.SelecttDimension.row = 'sj' - } - this.leftState = true - this.$store.state.allNochangeInitData = JSON.parse(JSON.stringify(this.transBefore)) - }).catch((fail) => { - console.log(fail, 2369) - }) + if (this.$route.query.type !== 'area') { + this.$store.state.SelecttDimension.col = 'zb' + this.$store.state.SelecttDimension.row = 'sj' + } + this.leftState = true + this.$store.state.allNochangeInitData = JSON.parse(JSON.stringify(this.transBefore)) + }).catch((fail) => { + console.log(fail, 2369) + }) + } } else { this.transBefore = this.$store.state.transBefore this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) @@ -1201,6 +1248,11 @@ export default { } }, computed: { + // 计算表说明字符串 + computedTableExplain() { + this.transBefore.tableExplain ? this.transBefore.tableExplain = this.transBefore.tableExplain : this.transBefore.tableExplain = '' + return this.transBefore.tableExplain.replace(/\\n/gm, "
") + }, // 行计算样式 computedLineSty() { return (ind) => { @@ -1288,6 +1340,9 @@ export default { // 转置状态 this.transState = this.chartsStatusMegger.transState this.leftState = false + if (this.$route.query.defaultLeftId !== 'default') { + this.$store.state.defaultShowDataState = false + } } } @@ -1300,22 +1355,19 @@ export default { } .chartsCont { margin: 1.5rem 0; - // border: 0.0625rem solid red; padding: 0 1.5rem; & > .tableExplain { padding: 0.75rem; margin: 1.75rem auto; - // width: 53.375rem; height: 18rem; border: 0.0625rem solid rgba(172, 172, 172, 0.38); border-radius: 0.5rem; box-shadow: 0rem 0.1875rem 1rem 0rem rgba(172, 172, 172, 0.38); - // line-height: 1.8rem; overflow-y: scroll; - font-size: 1rem; + font-size: 1.2rem; font-weight: normal; font-stretch: normal; - line-height: 1.5rem; + line-height: 2rem; letter-spacing: 0.125rem; color: #333333; } diff --git a/src/components/chartsCut/ChartsCut.vue b/src/components/chartsCut/ChartsCut.vue index 2cac26f..381a705 100644 --- a/src/components/chartsCut/ChartsCut.vue +++ b/src/components/chartsCut/ChartsCut.vue @@ -203,7 +203,9 @@ export default { value: '', label: '' } - ] + ], + // 默认数据显示状态 + defaultStateShowData: true } }, watch: { @@ -214,9 +216,9 @@ export default { if (val) { // 初始化公共数据 if (this.$route.query.type !== 'area') { - this.searchSelect(this.$route.query.type) + this.searchSelect(this.$route.query.type, null) } else { - this.searchSelect(val.f) + this.searchSelect(val.f, null) } } }, @@ -309,7 +311,7 @@ export default { // 改变选中值索引 if (this.$store.state.selectData !== undefined) { console.log(this.$store.state.selectData, '被选中的值') - console.log(resu[2], '被选中的值2') + console.log(resu[2], '被选中的值2000') this.$store.state.selectData = resu[2].indexID this.showInputStu = false @@ -330,7 +332,7 @@ export default { this.stateRTY = false }, // 查询下拉筛选条件 - searchSelect (type) { + searchSelect (type, defaultDataSelect) { this.$axios({ method: 'GET', url: 'data/data/quick', @@ -344,9 +346,9 @@ export default { this.cityDataTime = Object.keys(res.data.data.list).map((item, index) => { return { name: Object.values(res.data.data.list)[index], extendData: item } }) - // 默认选中第一个 - this.cityDefaultNameTime = { name: this.cityDataTime[0].name, activeIndex: 0 } - this.$store.state.selectData = this.cityDataTime[0].extendData + // 默认选最后一个 + this.cityDefaultNameTime = { name: this.cityDataTime[this.cityDataTime.length - 1].name, activeIndex: this.cityDataTime.length - 1 } + this.$store.state.selectData = this.cityDataTime[this.cityDataTime.length - 1].extendData // 告诉父组件我获取到了 this.$emit('stateTell', true) if (!this.$route.query.type !== 'area') { @@ -381,7 +383,11 @@ export default { value: '序列', label: '序列' }) - this.value = [this.options[1].value] + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState) { + this.value = [this.$store.state.newSelectLabelArea.sequenceCont] + } else { + this.value = [this.options[1].value] + } console.log(this.value, 'this.options') // 告诉父组件已经完成任务 this.$emit('stateDFGHJ', true) @@ -397,7 +403,11 @@ export default { value: '序列', label: '序列' }) - this.value = [this.options[1].value] + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState) { + this.value = [this.$store.state.newSelectLabelArea.sequenceCont] + } else { + this.value = [this.options[1].value] + } console.log(this.value, 'this.options') // 告诉父组件已经完成任务 this.$emit('stateDFGHJ', true) @@ -418,7 +428,12 @@ export default { value: '序列', label: '序列' }) - this.value = [this.options[1].value] + console.log(this.$store.state.defaultShowDataState, 'this.$store.state.defaultShowDataState1') + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState) { + this.value = [this.$store.state.newSelectLabelArea.sequenceCont] + } else { + this.value = [this.options[1].value] + } console.log(this.value, 'this.options') // 告诉父组件已经完成任务 this.$emit('stateDFGHJ', true) @@ -434,7 +449,12 @@ export default { value: '序列', label: '序列' }) - this.value = [this.options[1].value] + console.log(this.$store.state.defaultShowDataState, 'this.$store.state.defaultShowDataState2') + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState) { + this.value = [this.$store.state.newSelectLabelArea.sequenceCont] + } else { + this.value = [this.options[1].value] + } console.log(this.value, 'this.options') // 告诉父组件已经完成任务 this.$emit('stateDFGHJ', true) @@ -443,6 +463,10 @@ export default { } } } + this.$store.state.newSelectLabelArea = { + sequenceCont: this.value[0], + sequenceState: this.stateChangeSDF ? 1 : 2// 1筛选指标 2筛选地区 + } }, // 聚焦显示提示的搜索框 focusShow () { @@ -656,8 +680,13 @@ export default { } else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { this.$store.state.SelecttDimension.col = 'dq' } + this.$store.state.defaultShowDataState = false this.showLabelArea() } else { + this.$store.state.newSelectLabelArea = { + sequenceCont: value[0], + sequenceState: this.stateChangeSDF ? 1 : 2// 1筛选指标 2筛选地区 + } this.$emit('statertfResu', value[0]) } }, @@ -681,6 +710,10 @@ export default { console.log(this.$store.state.selectData, '被选中的值') console.log(res, '被选中的值2') this.$store.state.selectData = res.extendData + this.$store.state.newSelectTime = { + name: res.name, + value: res.extendData + } this.$emit('comTime', res) } }, diff --git a/src/components/dimension/Dimension.vue b/src/components/dimension/Dimension.vue index 2b2db54..2efa39c 100644 --- a/src/components/dimension/Dimension.vue +++ b/src/components/dimension/Dimension.vue @@ -218,6 +218,7 @@ export default { }) this.$store.state.befaultAfter = 'wdzh' } + this.$store.state.yesNoClickChange = true }).catch((fail) => { console.log(fail, 2369) }) diff --git a/src/components/editCom/EditCom.vue b/src/components/editCom/EditCom.vue index 1ee81fd..7a58235 100644 --- a/src/components/editCom/EditCom.vue +++ b/src/components/editCom/EditCom.vue @@ -225,55 +225,264 @@ export default { } } } else { - if (!this.$store.state.selectLabelHang) { - this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { - return { - text: item, - state: true, - id: index - } - }) - } else { - this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { - let state = true - if (this.$store.state.selectLabelHang.indexOf(index) === -1) { - state = false - } else { - state = true - } - console.log(state, 'state') - return { - text: item, - state: state, - id: index - } - }) + if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'sj') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } } } } else if (newVal === 'lie') { - if (!this.$store.state.selectLabelLie) { - this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { - return { - text: item, - state: true, - id: index - } - }) - } else { - this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { - let state = true - if (this.$store.state.selectLabelLie.indexOf(index) === -1) { - state = false + // 行列新增渲染 + if (this.$route.query.type === 'area') { + if (this.$store.state.SelecttDimension.row === 'dq' && this.$store.state.SelecttDimension.col === 'sj') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.areaName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) } else { - state = true + this.datalist = this.$store.state.noChangeData.areaName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) } - console.log(state, 'state') - return { - text: item, - state: state, - id: index + } else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'dq') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) } - }) + } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'sj') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } else if (this.$store.state.SelecttDimension.row === 'dq' && this.$store.state.SelecttDimension.col === 'zb') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.areaName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.areaName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'dq') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } + } else { + if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'sj') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } } } } @@ -487,6 +696,7 @@ export default { }) } } else if (this.$store.state.SelecttDimension.row === 'dq' && this.$store.state.SelecttDimension.col === 'sj') { + console.log('编辑!') if (!this.$store.state.selectLabelHang) { this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { return { @@ -613,29 +823,56 @@ export default { } } } else { - if (!this.$store.state.selectLabelHang) { - this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { - return { - text: item, - state: true, - id: index - } - }) - } else { - this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { - let state = true - if (this.$store.state.selectLabelHang.indexOf(index) === -1) { - state = false - } else { - state = true - } - console.log(state, 'state') - return { - text: item, - state: state, - id: index - } - }) + if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.termsName.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } + } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'sj') { + if (!this.$store.state.selectLabelHang) { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + return { + text: item, + state: true, + id: index + } + }) + } else { + this.datalist = this.$store.state.noChangeData.timeArr.map((item, index) => { + let state = true + if (this.$store.state.selectLabelHang.indexOf(index) === -1) { + state = false + } else { + state = true + } + console.log(state, 'state') + return { + text: item, + state: state, + id: index + } + }) + } } } // console.log(this.datalist, 'this.dataList') diff --git a/src/components/noAreaDimension/NoAreaDimension.vue b/src/components/noAreaDimension/NoAreaDimension.vue index e5ab30d..8143929 100644 --- a/src/components/noAreaDimension/NoAreaDimension.vue +++ b/src/components/noAreaDimension/NoAreaDimension.vue @@ -12,7 +12,6 @@
指标
时间
-
@@ -79,20 +78,25 @@ export default { // 维度转换默认 change3D () { if (this.$store.state.transState) { - if (this.$route.query.type !== 'area') { + console.log(this.$store.state.SelecttDimension, 'this.$store.state.SelecttDimension') + if (this.$store.state.SelecttDimension.col === 'zb' && this.$store.state.SelecttDimension.row === 'sj') { this.rowVal = '指标' this.colVal = '时间' - } else { - this.rowVal = '地区' - this.colVal = '时间' - } - } else { - if (this.$route.query.type !== 'area') { + } else if (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'zb') { this.rowVal = '时间' this.colVal = '指标' - } else { + } else if (this.$store.state.SelecttDimension.col === 'dq' && this.$store.state.SelecttDimension.row === 'sj') { + this.rowVal = '地区' + this.colVal = '时间' + } else if (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'dq') { this.rowVal = '时间' this.colVal = '地区' + } else if (this.$store.state.SelecttDimension.col === 'dq' && this.$store.state.SelecttDimension.row === 'zb') { + this.rowVal = '地区' + this.colVal = '指标' + } else if (this.$store.state.SelecttDimension.col === 'zb' && this.$store.state.SelecttDimension.row === 'dq') { + this.rowVal = '指标' + this.colVal = '地区' } } }, @@ -108,13 +112,14 @@ export default { } else { // 告诉父组件转置 this.$emit('changeSetZZ', true) - this.$store.state.SelecttDimension.col = this.arrValue[this.rowVal] - this.$store.state.SelecttDimension.row = this.arrValue[this.colVal] + // this.$store.state.SelecttDimension.col = this.arrValue[this.rowVal] + // this.$store.state.SelecttDimension.row = this.arrValue[this.colVal] this.$store.state.noAreadimensionState = false } } }, mounted () { + console.log('我只醒了') this.change3D() } } diff --git a/src/store.js b/src/store.js index 5c82ef3..08f69f6 100644 --- a/src/store.js +++ b/src/store.js @@ -111,7 +111,22 @@ export default new Vuex.Store({ // 初始化请求的所有数据(全局不变) allNochangeInitData: null, // 转置状态和维度转换状态先后(默认先点击维度转换)wdzh zz - befaultAfter: 'no' + befaultAfter: 'no', + // =======>保存默认用 + // 当前选中的时间 object + newSelectTime: null, + // 当前选中的指标或者地区 + newSelectLabelArea: null, + // 默认数据所需查询的数据 + defaultDataId: '', + // 默认显示时间状态(本地显示或线上显示)===>defaultLocal defaultOnLine + defaultShowTimeState: 'defaultOnLine', + // 默认显示地区或指标状态(本地显示或线上显示)===>defaultLocal defaultOnLine + defaultShowLabelAreaState: 'defaultOnLine', + // 默认数据显示状态 true显示 false不显示 + defaultShowDataState: true, + // 是否点击维度转换的确定按钮 + yesNoClickChange: false }, mutations: {}, diff --git a/src/views/datasweb/Datasweb.vue b/src/views/datasweb/Datasweb.vue index d84c7f6..e39bee9 100644 --- a/src/views/datasweb/Datasweb.vue +++ b/src/views/datasweb/Datasweb.vue @@ -111,10 +111,10 @@ :style="{'width':(left!=initValue?left>initValue?(25.375+computedNumberRem(left-initValue)):(25.375-computedNumberRem(initValue-left)):25.375)+'rem','height':'100%'}" > - + @@ -207,7 +207,6 @@ @prentsState="prentsState" :downLaSelects="downLaSelect" @stateDataGet="stateDataGet" - :downLaSelectArea="downLaSelectArea" :showTableState="showTableState" @statertyui="statertyui" :areaDimensionStateS="areaDimensionStateS" @@ -334,7 +333,7 @@ export default { return { loading: true, // 左侧当前默认 - defaultSelectLies: null, + defaultSelectLies: [], // 右侧默认显示数据 defaultDataRight: null, // 菜单配置 @@ -542,6 +541,7 @@ export default { this.defaultDataRight = datart this.$store.state.selectDataLeft = this.defaultDataRight this.$store.state.selectfilter = this.defaultDataRight.f + this.$store.state.yesNoClickChange = false }, handleClose (key, keyPath) { console.log(key, keyPath, '关闭打印') @@ -900,25 +900,92 @@ export default { this.cutStatic(0) // 获取本地保存数据 if (this.$store.state.transBefore) { - if (JSON.parse(sessionStorage.getItem('classFiyData'))) { - let arrtsBGY = JSON.parse(sessionStorage.getItem('classFiyData')) - console.log(this.defaultDataRight.id, 'this.defaultDataRight.id') - if (!arrtsBGY.find(item => item.id === this.defaultDataRight.id)) { - arrtsBGY.push({ - id: this.defaultDataRight.id, - data: this.$store.state.transBefore - }) - sessionStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) - } else { - console.log('走这里') - arrtsBGY.find(item => item.id === this.defaultDataRight.id).data = this.$store.state.transBefore - sessionStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) + if (this.$route.query.type !== 'area') { // 非地区数据 + if (JSON.parse(localStorage.getItem('classFiyData'))) { // 本地存在 + let arrtsBGY = JSON.parse(localStorage.getItem('classFiyData')) + if (!arrtsBGY.find(item => item.type === this.$route.query.type)) { + arrtsBGY.push({ + type: this.$route.query.type, + allNochangeInitData: this.$store.state.allNochangeInitData, + transBefore: this.$store.state.transBefore, + selectDate: { + time: this.$store.state.newSelectTime + }, + selectDataLeft: this.$store.state.selectDataLeft, // 左侧选中 + SelecttDimension: this.$store.state.SelecttDimension// 左侧选中 + }) + localStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) + } else { + console.log('走这里') + arrtsBGY.find(item => item.type === this.$route.query.type).transBefore = this.$store.state.transBefore + arrtsBGY.find(item => item.type === this.$route.query.type).allNochangeInitData = this.$store.state.allNochangeInitData + arrtsBGY.find(item => item.type === this.$route.query.type).selectDate = { + time: this.$store.state.newSelectTime + } + arrtsBGY.find(item => item.type === this.$route.query.type).selectDataLeft = this.$store.state.selectDataLeft + arrtsBGY.find(item => item.type === this.$route.query.type).SelecttDimension = this.$store.state.SelecttDimension + + localStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) + } + } else { // 本地不存在 + localStorage.setItem('classFiyData', JSON.stringify([{ + type: this.$store.state.selectDataLeft.f, + allNochangeInitData: this.$store.state.allNochangeInitData, + transBefore: this.$store.state.transBefore, + selectDate: { + time: this.$store.state.newSelectTime + }, + selectDataLeft: this.$store.state.selectDataLeft, // 左侧选中 + SelecttDimension: this.$store.state.SelecttDimension + }])) + } + } else { // 地区数据 + if (JSON.parse(localStorage.getItem('classFiyData'))) { // 本地存在 + let arrtsBGY = JSON.parse(localStorage.getItem('classFiyData')) + if (!arrtsBGY.find(item => item.type === this.$route.query.type)) { + arrtsBGY.push({ + type: this.$route.query.type, + allNochangeInitData: this.$store.state.allNochangeInitData, + transBefore: this.$store.state.transBefore, + selectDate: { + time: this.$store.state.newSelectTime, + sequence: this.$store.state.newSelectLabelArea + }, + selectDataLeft: this.$store.state.selectDataLeft, // 左侧选中 + SelecttDimension: this.$store.state.SelecttDimension, + yesNoClickChange: this.$store.state.yesNoClickChange// 维度转换是否被点击 + }) + localStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) + } else { + console.log('走这里') + arrtsBGY.find(item => item.type === this.$route.query.type).transBefore = this.$store.state.transBefore + arrtsBGY.find(item => item.type === this.$route.query.type).allNochangeInitData = this.$store.state.allNochangeInitData + arrtsBGY.find(item => item.type === this.$route.query.type).selectDate = { + time: this.$store.state.newSelectTime + } + arrtsBGY.find(item => item.type === this.$route.query.type).selectDate.sequence = this.$store.state.newSelectLabelArea + arrtsBGY.find(item => item.type === this.$route.query.type).selectDataLeft = this.$store.state.selectDataLeft + arrtsBGY.find(item => item.type === this.$route.query.type).SelecttDimension = this.$store.state.SelecttDimension + arrtsBGY.find(item => item.type === this.$route.query.type).yesNoClickChange = this.$store.state.yesNoClickChange + + localStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) + } + } else { // 本地不存在 + localStorage.setItem('classFiyData', JSON.stringify([{ + type: this.$route.query.type, + allNochangeInitData: this.$store.state.allNochangeInitData, + transBefore: this.$store.state.transBefore, + selectDate: { + time: this.$store.state.newSelectTime, + sequence: this.$store.state.newSelectLabelArea + // sequenceCont:,//序列选中内容 + // sequenceState://序列状态 筛选指标 筛选地区 + }, + selectDataLeft: this.$store.state.selectDataLeft, // 左侧选中 + SelecttDimension: this.$store.state.SelecttDimension, // 行列代表的是指标、地区、时间 + yesNoClickChange: this.$store.state.yesNoClickChange// 维度转换是否被点击 + }])) } - } else { - sessionStorage.setItem('classFiyData', JSON.stringify([{ - id: this.defaultDataRight.id, - data: this.$store.state.transBefore - }])) } this.$alert('默认数据已保存!', '温馨提示', { confirmButtonText: '确定' @@ -1155,72 +1222,7 @@ export default { console.log(this.$route.query.defaultLeftId, 'this.$router.query.defaultLeftId') // 非高级查询 if (!this.$store.state.advancedSearchState) { - if (this.$route.query.defaultLeftId === 'default') { // 从导航中点击 - let stateStatic = [] - this.leftCateData.forEach((item1, index1) => { - if (index1 === this.leftCateData.length - 1) { - stateStatic.push('' + index1) - if (item1.children) { - item1.children.forEach((item2, index2) => { - if (index2 === 0) { - stateStatic.push('' + index1 + '-' + index2) - if (item2.children) { - item2.children.forEach((item3, index3) => { - if (index3 === 0) { - stateStatic.push('' + index1 + '-' + index2 + '-' + index3) - if (item3.children) { - item3.children.forEach((item4, index4) => { - if (index4 === 0) { - stateStatic.push('' + index1 + '-' + index2 + '-' + index3 + '-' + index4) - if (item4.children) { - item4.children.forEach((item5, index5) => { - if (index5 === 0) { - stateStatic.push('' + index1 + '-' + index2 + '-' + index3 + '-' + index4 + '-' + index5) - } - }) - } - } - }) - } - } - }) - } - } - }) - } - } - }) - this.defaultSelectLies = stateStatic - console.log(this.defaultSelectLies, 'stateStatic') - this.$store.state.openOpenLeft = stateStatic - let dataDome = [] - console.log(stateStatic, '数据') - console.log(this.leftCateData[this.leftCateData.length - 1], '数据length-1') - - // console.log(this.leftCateData[this.leftCateData.length - 1].children[0].children[0].children[0].children[0], '1') - if (this.leftCateData[this.leftCateData.length - 1].children !== undefined) { - if (this.leftCateData[this.leftCateData.length - 1].children[0].children !== undefined) { - if (this.leftCateData[this.leftCateData.length - 1].children[0].children[0].children !== undefined) { - if (this.leftCateData[this.leftCateData.length - 1].children[0].children[0].children[0].children !== undefined) { - dataDome = this.leftCateData[this.leftCateData.length - 1].children[0].children[0].children[0].children[0] - } else { - dataDome = this.leftCateData[this.leftCateData.length - 1].children[0].children[0].children[0] - } - } else { - dataDome = this.leftCateData[this.leftCateData.length - 1].children[0].children[0] - } - } else { - dataDome = this.leftCateData[this.leftCateData.length - 1].children[0] - } - } else { - dataDome = this.leftCateData[this.leftCateData.length - 1] - } - this.defaultDataRight = dataDome - this.$store.state.selectDataLeft = this.defaultDataRight - console.log(this.defaultDataRight, '1250') - console.log(this.$store.state.selectDataLeft, '12500') - this.$store.state.selectfilter = this.defaultDataRight.f - } else { // 从数据更新,快速 + if (this.$route.query.defaultLeftId !== 'default') { // 从数据更新,快速 this.defaultDataSelectDG() console.log(this.filterDataArr, '非导航左侧选中') console.log(this.filterDataArr.defaultCode, '代码') @@ -1229,10 +1231,53 @@ export default { this.$store.state.selectDataLeft = this.filterDataArr.objectData this.defaultDataRight = this.filterDataArr.objectData this.$store.state.selectfilter = this.filterDataArr.objectData.f + } else { + // 处理默认显示数据 + this.defaultShowData() + } + } + }, + // 默认选中的数据 + defaultShowData () { + // 调用子组件showSaveDefaultData方法显示默认数据 + // this.$refs.childChartCont.showSaveDefaultData() + // 本地存在保存的数据 + // 调用接口请求默认显示数据 + let arrData = localStorage.getItem('classFiyData') + if (!arrData) { + return + } + if (JSON.parse(arrData).find(item => item.type === this.$route.query.type)) { + console.log(JSON.parse(arrData).find(item => item.type === this.$route.query.type)) + // 调用子组件 searchSelect 方法渲染下拉 + // 赋值数据 + // console.log(JSON.parse(arrData).find(item => item.type === this.$route.query.type).transBefore, '赋值数据') + this.$refs.childChartsCut.searchSelect(JSON.parse(arrData).find(item => item.type === this.$route.query.type).selectDataLeft.f, JSON.parse(arrData).find(item => item.type === this.$route.query.type).selectDate) + this.$refs.childChartCont.getInfor(JSON.parse(arrData).find(item => item.type === this.$route.query.type).selectDataLeft.id) + this.$store.state.selectDataLeft = JSON.parse(arrData).find(item => item.type === this.$route.query.type).selectDataLeft + this.$store.state.SelecttDimension = JSON.parse(arrData).find(item => item.type === this.$route.query.type).SelecttDimension + if (this.$route.query.type === 'area') { + let changeDarat = JSON.parse(JSON.stringify(JSON.parse(arrData).find(item => item.type === this.$route.query.type).allNochangeInitData)) + this.$store.state.transBefore = JSON.parse(JSON.stringify(changeDarat)) + this.$store.state.noChangeData = JSON.parse(JSON.stringify(changeDarat)) + this.$store.state.allNochangeInitData = JSON.parse(JSON.stringify(changeDarat)) + this.$store.state.newSelectLabelArea = JSON.parse(arrData).find(item => item.type === this.$route.query.type).selectDate.sequence + } else { + this.$store.state.transBefore = JSON.parse(arrData).find(item => item.type === this.$route.query.type).allNochangeInitData + this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.$store.state.transBefore)) + this.$store.state.allNochangeInitData = JSON.parse(arrData).find(item => item.type === this.$route.query.type).allNochangeInitData } } else { - // this.defaultDataRight = [] - // this.defaultSelectLies = [] + this.$axios({ + method: 'GET', + url: 'data/data/default', + params: { + type: this.$route.query.type + } + }).then(res => { + console.log(res, '默认展示id') + this.$store.state.defaultDataId = res.data.data + }) } }, comTime (res) { @@ -1276,6 +1321,8 @@ export default { console.log(val, '1010110') this.downLaSelectArea = val this.indStatic = 0 + // 调用childChartCont组件方法获取数据 + this.$refs.childChartCont.downLaSelectArea(this.downLaSelectArea) }, // 重置清除空行空列状态 statertyui (val) { @@ -1307,6 +1354,7 @@ export default { }, // 调用子组件的方法重置筛选数据 childChartsCutShow () { + console.log('kfa555') this.$refs.childChartsCut.showLabelArea() }, // 调用子组件的方法重置筛选数据