diff --git a/src/App.vue b/src/App.vue index c1ec0f0..60d3c8f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,10 +1,25 @@ diff --git a/src/assets/js/computeddata.js b/src/assets/js/computeddata.js index d11ce24..51c65af 100644 --- a/src/assets/js/computeddata.js +++ b/src/assets/js/computeddata.js @@ -369,6 +369,7 @@ class computedFunc { }) // 总数据处理 this.transBeforeData.areaName.forEach((itemName, indexName) => { + console.log(this.transBeforeData.transBeforeAreaData, 'this.transBeforeData.transBeforeAreaData') var tableLine = {} this.transBeforeData.transBeforeAreaData[indexName].forEach((dataList, dataKey) => { if (dataKey === 0) { diff --git a/src/components/advancedQuery/AdvancedQuery.vue b/src/components/advancedQuery/AdvancedQuery.vue index 3fda245..ff6079a 100644 --- a/src/components/advancedQuery/AdvancedQuery.vue +++ b/src/components/advancedQuery/AdvancedQuery.vue @@ -12,6 +12,7 @@ @open="handleOpen" @close="handleClose" @select="selectActive" + :unique-opened="true" style="border:none" > { return Object.values(item) }))), '数据表演') let AllCountData = (this.tableData.map((item, index) => { return Object.values(item) })) + // console.log(AllCountData, 'AllCountData') AllCountData.unshift(this.tableLine.map((item, index) => { return item.label })) // 将数据进行行列转换 let zhuanChange = AllCountData[0].map((col, index) => { return AllCountData.map((row, key) => { + // console.log(row[index].length, 'rowrow') return row[index].length }) }) - console.log(zhuanChange, 'AllCountData') + // 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') + // console.log(this.lieWidthArr, 'this.lieWidthArr') this.$nextTick(() => { this.$refs.table.doLayout() }) @@ -667,14 +674,51 @@ export default { * */ /* eslint-disable */ downLaSelects() { - console.log(this.$store.state.advancedSearchState, 'this.$store.state.advancedSearchState0000000000000000000000') - if (this.leftState) { - if (!this.$store.state.advancedSearchState) { - this.getDatas() - } else { - this.advancedSearchDataShow() + // console.log(this.$store.state.advancedSearchState, 'this.$store.state.advancedSearchState0000000000000000000000') + // console.log(this.leftState, 'this.leftState') + // if (this.leftState) { + // if (this.$route.query.type !== 'area') { + // if (!this.$store.state.advancedSearchState) { + // this.getDatas() + // } else { + // this.advancedSearchDataShow() + // } + // } else { + + // } + // } else { + if (this.$route.query.type !== 'area') { + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowLabelAreaState === 'defaultOnLine') {// 显示默认数据并且是显示默认线上数据 + if (!this.$store.state.advancedSearchState) { + this.getDatas() + } else { + this.advancedSearchDataShow() + } + } else if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowLabelAreaState === 'normal') {// 显示默认数据并且是正常显示数据 + if (!this.$store.state.advancedSearchState) { + this.getDatas() + } else { + this.advancedSearchDataShow() + } + } else if (this.$route.query.defaultLeftId !== 'default') {// 显示非正常数据 + if (!this.$store.state.advancedSearchState) { + this.getDatas() + } else { + this.advancedSearchDataShow() + } + } + } else { + console.log(this.$store.state.timeNum,'this.$store.state.timeNum') + if (this.$route.query.defaultLeftId === 'default' && !this.$store.state.timeNum) {// 显示非正常数据 + if (!this.$store.state.advancedSearchState) { + this.getDatas() + } else { + this.advancedSearchDataShow() + } } } + // } + this.$store.state.timeNum = false }, // 获取所有当前分类下的所有的指标、地区、时间 getInfor(classifyId) { @@ -722,7 +766,11 @@ export default { } else { console.log(this.$store.state.transBefore, 'this.transBefore else') this.$parent.childChartsCutShow() + if (this.$store.state.yesNoClickChange && this.$store.state.defaultShowLabelAreaState === 'defaultLocal') { + this.$parent.changeCutShow() + } } + console.log(this.$store.state.SelecttDimension, 'this.$store.state.SelecttDimension') }).catch((fail) => { console.log(fail) }) @@ -826,10 +874,14 @@ export default { }, // 指标解释 indexExplain(labIndexName) { + console.log(labIndexName, 'labIndexName') if (this.transBefore.termsName.indexOf(labIndexName) !== -1) { console.log('指标解释:', this.transBefore.termsExplain[this.transBefore.termsName.indexOf(labIndexName)]) this.$store.state.labelExplainData = this.transBefore.termsExplain[this.transBefore.termsName.indexOf(labIndexName)] this.$store.state.labelExplainState = true + } else { + this.$store.state.labelExplainData = labIndexName + this.$store.state.labelExplainState = true } }, // 统计数据对行,对列处理 @@ -1089,15 +1141,24 @@ export default { 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] + console.log(this.$store.state.yesNoClickZZ, '走这里') + // 转置后在请求数据 需要将数据转置 + if (this.$store.state.yesNoClickZZ && !this.leftState) { + let transBeforeAreaData = JSON.parse(JSON.stringify(res.data.data.transBeforeAreaData[0])) + brrtf.transBeforeAreaData = transBeforeAreaData[0].map((col, index) => { + return transBeforeAreaData.map((row, key) => { + return row[index] + }) + }) + } else { + brrtf.transBeforeAreaData = res.data.data.transBeforeAreaData[0] + } brrtf.transBeforeTermsData = res.data.data.transBeforeTermsData } else { brrtf.transBeforeAreaData = res.data.data.transBeforeAreaData @@ -1170,12 +1231,11 @@ export default { 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 + console.log(JSON.parse(JSON.stringify(this.transBefore)), 'JSON.parse(JSON.stringify(this.transBefore))') this.$store.state.allNochangeInitData = JSON.parse(JSON.stringify(this.transBefore)) + // this.transState = this.$store.state.yesNoClickZZ + console.log(this.$store.state.SelecttDimension, 'this.$store.state.SelecttDimension') }).catch((fail) => { console.log(fail, 2369) }) diff --git a/src/components/chartsCut/ChartsCut.vue b/src/components/chartsCut/ChartsCut.vue index 381a705..d0080ae 100644 --- a/src/components/chartsCut/ChartsCut.vue +++ b/src/components/chartsCut/ChartsCut.vue @@ -64,7 +64,10 @@ -
+
{{leftLabel[$store.state.noSelecttDimension]}}: { @@ -279,14 +295,12 @@ export default { } }) } - this.valueDimension = this.$store.newSelectChangeData + this.valueDimension = this.$store.state.newSelectChangeData + console.log(this.valueDimension, 'this.valueDimension0') // 告诉父组件数据渲染完 this.$emit('emmitStateAd', false) } - console.log(this.valueDimension, 'this.valueDimension') - } - }, - methods: { + }, // 地区维度转换筛选 handleChangeDimension () { console.log(this.valueDimension, 'this.valueDimension') @@ -383,7 +397,7 @@ export default { value: '序列', label: '序列' }) - if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState) { + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState && this.$store.state.defaultShowLabelAreaState !== 'defaultOnLine') { this.value = [this.$store.state.newSelectLabelArea.sequenceCont] } else { this.value = [this.options[1].value] @@ -403,7 +417,7 @@ export default { value: '序列', label: '序列' }) - if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState) { + if (this.$route.query.defaultLeftId === 'default' && this.$store.state.defaultShowDataState && this.$store.state.defaultShowLabelAreaState !== 'defaultOnLine') { this.value = [this.$store.state.newSelectLabelArea.sequenceCont] } else { this.value = [this.options[1].value] @@ -467,6 +481,7 @@ export default { sequenceCont: this.value[0], sequenceState: this.stateChangeSDF ? 1 : 2// 1筛选指标 2筛选地区 } + console.log(this.options, 'this.option012') }, // 聚焦显示提示的搜索框 focusShow () { @@ -677,8 +692,12 @@ export default { this.$store.state.newSelectDaaState = this.stateChangeSDF if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'dq') { this.$store.state.SelecttDimension.col = 'zb' + } else if (this.$store.state.SelecttDimension.row === 'dq' && this.$store.state.SelecttDimension.col === 'sj') { + this.$store.state.SelecttDimension.row = 'zb' } else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { this.$store.state.SelecttDimension.col = 'dq' + } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'sj') { + this.$store.state.SelecttDimension.row = 'dq' } this.$store.state.defaultShowDataState = false this.showLabelArea() @@ -719,6 +738,7 @@ export default { }, callBackValOpen (res) { // 展开回调 console.log(res, '展开') + console.log(this.$store.state.SelecttDimension, 'this.$store.state.advancedSearchState0000000000000000000000') this.changesInputStu() }, callBackValClose (res) { // 关闭回调 diff --git a/src/components/dimension/Dimension.vue b/src/components/dimension/Dimension.vue index 2efa39c..62a8893 100644 --- a/src/components/dimension/Dimension.vue +++ b/src/components/dimension/Dimension.vue @@ -77,6 +77,7 @@ export default { }, methods: { changeTabel (stateSD, strd) { + console.log(stateSD, strd, 'stateSD, strd') if (strd === 'row') { this.rowVal = stateSD } else if (strd === 'col') { @@ -85,6 +86,7 @@ export default { }, // 维度转换默认 change3D () { + console.log(this.$store.state.SelecttDimension, '3d56') this.rowVal = this.arrValueZd[this.$store.state.SelecttDimension.col] this.colVal = this.arrValueZd[this.$store.state.SelecttDimension.row] }, @@ -122,6 +124,7 @@ export default { row: this.arrValue[this.colVal], col: this.arrValue[this.rowVal] } + this.$store.state.newSelectChangeData = paramsd.area } else if ((this.arrValue[this.colVal] === 'sj' && this.arrValue[this.rowVal] === 'dq') || (this.arrValue[this.colVal] === 'dq' && this.arrValue[this.rowVal] === 'sj')) { this.$store.state.noSelecttDimension = 'zb' paramsd = { @@ -136,6 +139,7 @@ export default { row: this.arrValue[this.colVal], col: this.arrValue[this.rowVal] } + this.$store.state.newSelectChangeData = paramsd.quota } else if ((this.arrValue[this.colVal] === 'zb' && this.arrValue[this.rowVal] === 'dq') || (this.arrValue[this.colVal] === 'dq' && this.arrValue[this.rowVal] === 'zb')) { this.$store.state.noSelecttDimension = 'sj' paramsd = { @@ -150,9 +154,11 @@ export default { row: this.arrValue[this.colVal], col: this.arrValue[this.rowVal] } + this.$store.state.newSelectChangeData = paramsd.date } this.$store.state.SelecttDimension.row = this.arrValue[this.colVal] this.$store.state.SelecttDimension.col = this.arrValue[this.rowVal] + console.log(this.$store.state.SelecttDimension, 'this.$store.state.SelecttDimension0236') this.$axios({ method: 'POST', url: 'data/data/wd-trans', @@ -169,22 +175,33 @@ export default { transBefore.termsName = res.data.data.termsName transBefore.areaName = this.$store.state.transBefore.areaName transBefore.termsExplain = res.data.data.termsExplain - this.$store.newSelectChangeData = res.data.data.areaName + this.$store.newSelectChangeData = this.$store.state.dataArealabelTime.areaArr } else if ((this.arrValue[this.colVal] === 'sj' && this.arrValue[this.rowVal] === 'dq') || (this.arrValue[this.colVal] === 'dq' && this.arrValue[this.rowVal] === 'sj')) { transBefore.timeArr = res.data.data.timeArr.map((item, index) => { return item.toString() }) transBefore.termsName = this.$store.state.transBefore.termsName transBefore.areaName = res.data.data.areaName transBefore.termsExplain = this.$store.state.transBefore.termsExplain - this.$store.newSelectChangeData = res.data.data.termsName + this.$store.newSelectChangeData = this.$store.state.dataArealabelTime.quotaArr } else if ((this.arrValue[this.colVal] === 'zb' && this.arrValue[this.rowVal] === 'dq') || (this.arrValue[this.colVal] === 'dq' && this.arrValue[this.rowVal] === 'zb')) { transBefore.timeArr = this.$store.state.transBefore.timeArr.map((item, index) => { return item.toString() }) transBefore.termsName = res.data.data.termsName transBefore.areaName = res.data.data.areaName transBefore.termsExplain = res.data.data.termsExplain - this.$store.newSelectChangeData = res.data.data.timeArr.map((item, index) => { return item.toString() }) + this.$store.newSelectChangeData = this.$store.state.dataArealabelTime.timeArr } transBefore.tableExplain = res.data.data.tableExplain transBefore.transBeforeTermsData = res.data.data.transBeforeTermsData + // 转置后请求数据需要将数据转置 + // if (!this.$store.state.yesNoClickZZ) { + // let transBeforeAreaData = JSON.parse(JSON.stringify(res.data.data.transBeforeAreaData[0])) + // transBefore.transBeforeAreaData = transBeforeAreaData[0].map((col, index) => { + // return transBeforeAreaData.map((row, key) => { + // return row[index] + // }) + // }) + // } else { + // transBefore.transBeforeAreaData = res.data.data.transBeforeAreaData[0] + // } transBefore.transBeforeAreaData = res.data.data.transBeforeAreaData[0] console.log(transBefore, '000') this.$store.state.transdtr = true @@ -216,7 +233,7 @@ export default { return row[index] }) }) - this.$store.state.befaultAfter = 'wdzh' + // this.$store.state.befaultAfter = 'wdzh' } this.$store.state.yesNoClickChange = true }).catch((fail) => { @@ -226,6 +243,7 @@ export default { }, mounted() { this.change3D() + console.log(1003) } } diff --git a/src/components/noAreaDimension/NoAreaDimension.vue b/src/components/noAreaDimension/NoAreaDimension.vue index 8143929..f24e882 100644 --- a/src/components/noAreaDimension/NoAreaDimension.vue +++ b/src/components/noAreaDimension/NoAreaDimension.vue @@ -77,28 +77,28 @@ export default { }, // 维度转换默认 change3D () { - if (this.$store.state.transState) { - 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 if (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'zb') { - this.rowVal = '时间' - this.colVal = '指标' - } 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 = '地区' - } + // if (this.$store.state.transState) { + 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 if (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'zb') { + this.rowVal = '时间' + this.colVal = '指标' + } 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 = '地区' } + // } }, // 确定维度转换 trueChange () { @@ -111,15 +111,17 @@ export default { this.$store.state.noAreadimensionState = false } else { // 告诉父组件转置 + this.$store.state.SelecttDimension.col = this.arrValue[this.rowVal] + this.$store.state.SelecttDimension.row = this.arrValue[this.colVal] + console.log(this.$store.state.SelecttDimension, '非地区数据维度转换=》转置') 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.noAreadimensionState = false } } }, mounted () { console.log('我只醒了') + console.log(this.$store.state.SelecttDimension, '非地区数据维度转换=》转置') this.change3D() } } diff --git a/src/store.js b/src/store.js index 08f69f6..1c3c94b 100644 --- a/src/store.js +++ b/src/store.js @@ -121,12 +121,16 @@ export default new Vuex.Store({ defaultDataId: '', // 默认显示时间状态(本地显示或线上显示)===>defaultLocal defaultOnLine defaultShowTimeState: 'defaultOnLine', - // 默认显示地区或指标状态(本地显示或线上显示)===>defaultLocal defaultOnLine + // 默认显示地区或指标状态(本地显示或线上显示)===>defaultLocal默认本地 defaultOnLine默认线上 normal正常显示 defaultShowLabelAreaState: 'defaultOnLine', // 默认数据显示状态 true显示 false不显示 defaultShowDataState: true, + // 是否点击转置按钮 + yesNoClickZZ: false, // 是否点击维度转换的确定按钮 - yesNoClickChange: false + yesNoClickChange: false, + // 时间次数true为1次 false为非1次 + timeNum: true }, mutations: {}, diff --git a/src/views/datasweb/Datasweb.vue b/src/views/datasweb/Datasweb.vue index e39bee9..0840c54 100644 --- a/src/views/datasweb/Datasweb.vue +++ b/src/views/datasweb/Datasweb.vue @@ -542,6 +542,8 @@ export default { this.$store.state.selectDataLeft = this.defaultDataRight this.$store.state.selectfilter = this.defaultDataRight.f this.$store.state.yesNoClickChange = false + this.$store.state.timeNum = true + this.$store.state.yesNoClickZZ = false }, handleClose (key, keyPath) { console.log(key, keyPath, '关闭打印') @@ -665,6 +667,11 @@ export default { confirmButtonText: '确定' }) return + } else if (this.$store.state.advanceData.length > 101) { + this.$alert('最多选择100条数据进行查询!', '温馨提示', { + confirmButtonText: '确定' + }) + return } that.cutStateSeach = 'simpleness' that.advancedStates = true @@ -851,7 +858,11 @@ export default { } break case '转置': - if (this.$store.state.befaultAfter !== 'wdzh') { + // 是否点击转置 + this.$store.state.yesNoClickZZ = !this.$store.state.yesNoClickZZ + if (this.$store.state.befaultAfter === 'zz') { + this.$store.state.befaultAfter = 'no' + } else { this.$store.state.befaultAfter = 'zz' } this.cutStatic(0) @@ -873,6 +884,8 @@ export default { col: this.$store.state.SelecttDimension.row } this.$store.state.SelecttDimension = zhuanChange + console.log(this.$store.state.SelecttDimension, '非地区数据维度转换=》转置') + this.change3Ds() this.chartsStatusMegger.transState = !this.chartsStatusMegger.transState this.$store.state.transState = this.chartsStatusMegger.transState } else { @@ -943,47 +956,76 @@ export default { if (JSON.parse(localStorage.getItem('classFiyData'))) { // 本地存在 let arrtsBGY = JSON.parse(localStorage.getItem('classFiyData')) if (!arrtsBGY.find(item => item.type === this.$route.query.type)) { + let btyData = JSON.parse(JSON.stringify(this.$store.state.allNochangeInitData)) + if (this.$store.state.yesNoClickZZ) { + let btyAreaData = btyData.transBeforeAreaData + btyData.transBeforeAreaData = btyAreaData[0].map((col, index) => { + return btyAreaData.map((row, key) => { + return row[index] + }) + }) + } arrtsBGY.push({ type: this.$route.query.type, - allNochangeInitData: this.$store.state.allNochangeInitData, - transBefore: this.$store.state.transBefore, + allNochangeInitData: btyData, + transBefore: btyData, selectDate: { time: this.$store.state.newSelectTime, - sequence: this.$store.state.newSelectLabelArea + sequence: this.$store.state.yesNoClickChange ? { sequenceCont: this.$store.state.newSelectChangeData, sequenceState: 3 } : this.$store.state.newSelectLabelArea }, selectDataLeft: this.$store.state.selectDataLeft, // 左侧选中 SelecttDimension: this.$store.state.SelecttDimension, - yesNoClickChange: this.$store.state.yesNoClickChange// 维度转换是否被点击 + yesNoClickChange: this.$store.state.yesNoClickChange, // 维度转换是否被点击 + yesNoClickZZ: this.$store.state.yesNoClickZZ// 转置是否被点击 }) 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 + let btyData = JSON.parse(JSON.stringify(this.$store.state.allNochangeInitData)) + if (this.$store.state.yesNoClickZZ) { + let btyAreaData = btyData.transBeforeAreaData + btyData.transBeforeAreaData = btyAreaData[0].map((col, index) => { + return btyAreaData.map((row, key) => { + return row[index] + }) + }) + } + arrtsBGY.find(item => item.type === this.$route.query.type).transBefore = btyData + arrtsBGY.find(item => item.type === this.$route.query.type).allNochangeInitData = btyData + arrtsBGY.find(item => item.type === this.$route.query.type).selectDate = { + time: this.$store.state.newSelectTime, + sequence: this.$store.state.yesNoClickChange ? { sequenceCont: this.$store.state.newSelectChangeData, sequenceState: 3 } : this.$store.state.newSelectLabelArea } - 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 - + arrtsBGY.find(item => item.type === this.$route.query.type).yesNoClickZZ = this.$store.state.yesNoClickZZ localStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) } } else { // 本地不存在 + let btyData = JSON.parse(JSON.stringify(this.$store.state.allNochangeInitData)) + if (this.$store.state.yesNoClickZZ) { + let btyAreaData = btyData.transBeforeAreaData + btyData.transBeforeAreaData = btyAreaData[0].map((col, index) => { + return btyAreaData.map((row, key) => { + return row[index] + }) + }) + } localStorage.setItem('classFiyData', JSON.stringify([{ type: this.$route.query.type, - allNochangeInitData: this.$store.state.allNochangeInitData, - transBefore: this.$store.state.transBefore, + allNochangeInitData: btyData, + transBefore: btyData, selectDate: { time: this.$store.state.newSelectTime, - sequence: this.$store.state.newSelectLabelArea + sequence: this.$store.state.yesNoClickChange ? { sequenceCont: this.$store.state.newSelectChangeData, sequenceState: 3 } : this.$store.state.newSelectLabelArea // sequenceCont:,//序列选中内容 // sequenceState://序列状态 筛选指标 筛选地区 }, selectDataLeft: this.$store.state.selectDataLeft, // 左侧选中 SelecttDimension: this.$store.state.SelecttDimension, // 行列代表的是指标、地区、时间 - yesNoClickChange: this.$store.state.yesNoClickChange// 维度转换是否被点击 + yesNoClickChange: this.$store.state.yesNoClickChange, // 维度转换是否被点击 + yesNoClickZZ: this.$store.state.yesNoClickZZ// 维度转换是否被点击 }])) } } @@ -999,26 +1041,41 @@ export default { case '恢复默认':// 将分类id 和 分类数据从本地删除 this.cutStatic(0) if (this.$store.state.transBefore) { - if (JSON.parse(sessionStorage.getItem('classFiyData'))) { - let arrtsBGY = JSON.parse(sessionStorage.getItem('classFiyData')) - if (!arrtsBGY.find(item => item.id === this.defaultDataRight.id)) { - // alert('默认数据已恢复!') + if (JSON.parse(localStorage.getItem('classFiyData'))) { + let arrtsBGY = JSON.parse(localStorage.getItem('classFiyData')) + console.log(arrtsBGY) + if (!arrtsBGY.find(item => item.type === this.$route.query.type)) { this.$alert('默认数据已恢复!', '温馨提示', { - confirmButtonText: '确定' + confirmButtonText: '确定', + callback: actioon => { + this.$router.go(0) + } }) } else { arrtsBGY = arrtsBGY.filter((item, index) => { - return item.id !== this.defaultDataRight.id + console.log(item, 'item0') + return item.type !== this.$route.query.type + }) + if (arrtsBGY.length > 0) { + localStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) + } else { + localStorage.removeItem('classFiyData') + } + this.$alert('默认数据已恢复!', '温馨提示', { + confirmButtonText: '确定', + callback: actioon => { + this.$router.go(0) + } }) - sessionStorage.setItem('classFiyData', JSON.stringify(arrtsBGY)) } } else { - // alert('默认数据已恢复!') this.$alert('默认数据已恢复!', '温馨提示', { - confirmButtonText: '确定' + confirmButtonText: '确定', + callback: actioon => { + this.$router.go(0) + } }) } - this.$router.go(0) } else { this.$alert('暂无数据,恢复默认功能无法使用!', '温馨提示', { confirmButtonText: '确定' @@ -1245,28 +1302,61 @@ export default { // 调用接口请求默认显示数据 let arrData = localStorage.getItem('classFiyData') if (!arrData) { + this.$axios({ + method: 'GET', + url: 'data/data/default', + params: { + type: this.$route.query.type + } + }).then(res => { + console.log(res, '默认展示id10') + this.$store.state.defaultDataId = res.data.data + this.$store.state.selectDataLeft = res.data.data + this.$store.state.selectfilter = this.$store.state.defaultDataId.f + this.$refs.childChartsCut.searchSelect(this.$store.state.defaultDataId.f, 'default3') + this.$refs.childChartCont.getInfor(this.$store.state.defaultDataId.id) + }) return } if (JSON.parse(arrData).find(item => item.type === this.$route.query.type)) { + this.$store.state.defaultShowLabelAreaState = 'defaultLocal' 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.selectfilter = this.$store.state.selectDataLeft.f this.$store.state.SelecttDimension = JSON.parse(arrData).find(item => item.type === this.$route.query.type).SelecttDimension + this.$store.state.yesNoClickZZ = JSON.parse(arrData).find(item => item.type === this.$route.query.type).yesNoClickZZ + this.$store.state.yesNoClickChange = JSON.parse(arrData).find(item => item.type === this.$route.query.type).yesNoClickChange 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 + this.$store.state.areaDimensionState = JSON.parse(arrData).find(item => item.type === this.$route.query.type).yesNoClickChange + this.$store.state.yesNoClickChange = JSON.parse(arrData).find(item => item.type === this.$route.query.type).yesNoClickChange } 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 } + console.log(this.$store.state.SelecttDimension, 'this.$store.state.advancedSearchState0000000000000000000000') + 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) + if (this.$store.state.yesNoClickChange && this.$route.query.type === 'area') { + if ((this.$store.state.SelecttDimension.col === 'zb' && this.$store.state.SelecttDimension.row === 'sj') || (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'zb')) { + this.$store.state.noSelecttDimension = 'dq' + } else if ((this.$store.state.SelecttDimension.col === 'dq' && this.$store.state.SelecttDimension.row === 'sj') || (this.$store.state.SelecttDimension.col === 'sj' && this.$store.state.SelecttDimension.row === 'dq')) { + this.$store.state.noSelecttDimension = 'zb' + } else if ((this.$store.state.SelecttDimension.col === 'dq' && this.$store.state.SelecttDimension.row === 'zb') || (this.$store.state.SelecttDimension.col === 'zb' && this.$store.state.SelecttDimension.row === 'dq')) { + this.$store.state.noSelecttDimension = 'sj' + } + this.$store.state.newSelectChangeData = [JSON.parse(arrData).find(item => item.type === this.$route.query.type).selectDate.sequence.sequenceCont] + + // this.$refs.childChartsCut.areaDimensionDo(true) + } } else { this.$axios({ method: 'GET', @@ -1277,6 +1367,10 @@ export default { }).then(res => { console.log(res, '默认展示id') this.$store.state.defaultDataId = res.data.data + this.$store.state.selectDataLeft = res.data.data + this.$store.state.selectfilter = this.$store.state.defaultDataId.f + this.$refs.childChartsCut.searchSelect(this.$store.state.defaultDataId.f, 'default3') + this.$refs.childChartCont.getInfor(this.$store.state.defaultDataId.id) }) } }, @@ -1360,6 +1454,17 @@ export default { // 调用子组件的方法重置筛选数据 childChartContShow (res) { this.$refs.childChartCont.getInfor(res) + }, + // 调用子组件的方法重置维度转换下拉筛选数据 + changeCutShow () { + this.$refs.childChartsCut.areaDimensionDo(true) + // 重置三维转换默认选中 + this.$refs.childDimension.change3D() + }, + // 调用子组件的方法重置维度转换下拉筛选数据 + change3Ds () { + // 重置三维转换默认选中 + this.$refs.childDimension.change3D() } }, computed: {