From 4f6b93bbb577bc1d2bd6a3e19ddf1bb6617c3cf3 Mon Sep 17 00:00:00 2001 From: fanzhen123 <1575502816@qq.com> Date: Tue, 7 Jan 2020 18:22:13 +0800 Subject: [PATCH] fanzhen0107 --- src/assets/js/computeddata.js | 47 ++- .../advancedQuery/AdvancedQuery.vue | 70 ++-- src/components/chartsCont/ChartsCont.vue | 259 +++++------- src/components/chartsCut/ChartsCut.vue | 381 ++++++++++++------ src/components/nav/Nav.vue | 4 +- src/main.js | 30 +- src/router.js | 10 +- src/store.js | 10 +- src/views/datasweb/Datasweb.vue | 246 +++++------ src/views/help/Help.vue | 2 +- 10 files changed, 579 insertions(+), 480 deletions(-) diff --git a/src/assets/js/computeddata.js b/src/assets/js/computeddata.js index 29f7383..254580d 100644 --- a/src/assets/js/computeddata.js +++ b/src/assets/js/computeddata.js @@ -1216,7 +1216,7 @@ class computedFunc { } return this.chartsDatazzPie } - // 导出至EXcel tableData:表数据 tableLine:列数据 listInputVal:选中列下标 lineInputVal:选中行下标 + // 导出至EXcel tableData:表数据 tableLine:列数据 listInputVal:选中列下标 lineInputVal:选中行下标 ===》对选中的部分导出 insertCollectS (tableData, tableLine, listInputVal, lineInputVal) { // 定义一个对象用来分发数据 let objData = { @@ -1244,9 +1244,17 @@ class computedFunc { }).filter((item, index) => { return lineInputVal.indexOf(index) !== -1 }) - let hangAllDatas = yuan.map((item, index) => { - return tableLine[item].label - }) + let hangAllDatas = null + if (tableLine.length < yuan.length) { + hangAllDatas = tableLine.map((item, index) => { + return tableLine[index].label + }) + } else { + hangAllDatas = yuan.map((item, index) => { + return tableLine[item].label + }) + } + // shHangData.unshift(hangAllDatas) objData.header = hangAllDatas.map((item, index) => { return [item, index] @@ -1255,10 +1263,35 @@ class computedFunc { // 导出的数据 return objData } - // 新增指标 - // 参数 labelState:hang/lie 行列状态 labelName新增指标名称 表达式expression 表达式中指标对应的下标labelDownB type:array - insertLabelCom (labelState, labelName, expression, labelDownB) { + /* + * @desc 导出至EXcel(表中有多少数据导出多少数据) + * @param tableData [Array] 表数据 + * @param tableLine [Array] 列数据 + * + */ + exportDataAll (tableData, tableLine) { + // 定义一个对象用来分发数据 + let objData = { + header: null, + tableData: null + } + // 除了第一行剩下的行的所有选中的数据 + let shHangData = [] + shHangData = tableData.map((item, index) => { + return Object.values(item) + }) + let hangAllDatas = null + hangAllDatas = tableLine.map((item, index) => { + return tableLine[index].label + }) + // shHangData.unshift(hangAllDatas) + objData.header = hangAllDatas.map((item, index) => { + return [item, index] + }) + objData.tableData = shHangData + // 导出的数据 + return objData } } export default computedFunc diff --git a/src/components/advancedQuery/AdvancedQuery.vue b/src/components/advancedQuery/AdvancedQuery.vue index bc0a49c..3fda245 100644 --- a/src/components/advancedQuery/AdvancedQuery.vue +++ b/src/components/advancedQuery/AdvancedQuery.vue @@ -9,7 +9,6 @@ - + @@ -136,38 +135,38 @@ export default { checkboxState: false, // 查询到的数据 searchDatas: [ - { - // input选中状态 - inputState: false, - // 指标解释显示状态 - zbjsState: false, - // 指标名称 - nameText: '国内生产总值_当季值' - }, - { - // input选中状态 - inputState: false, - // 指标解释显示状态 - zbjsState: false, - // 指标名称 - nameText: '信息传输、软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值' - }, - { - // input选中状态 - inputState: false, - // 指标解释显示状态 - zbjsState: false, - // 指标名称 - nameText: '租赁和商务服务业增加值_累计值' - }, - { - // input选中状态 - inputState: false, - // 指标解释显示状态 - zbjsState: false, - // 指标名称 - nameText: '租赁和商务服务业增加值_累计值545' - } + // { + // // input选中状态 + // inputState: false, + // // 指标解释显示状态 + // zbjsState: false, + // // 指标名称 + // nameText: '国内生产总值_当季值' + // }, + // { + // // input选中状态 + // inputState: false, + // // 指标解释显示状态 + // zbjsState: false, + // // 指标名称 + // nameText: '信息传输、软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值软件和信息技术服务业增加值_当季值' + // }, + // { + // // input选中状态 + // inputState: false, + // // 指标解释显示状态 + // zbjsState: false, + // // 指标名称 + // nameText: '租赁和商务服务业增加值_累计值' + // }, + // { + // // input选中状态 + // inputState: false, + // // 指标解释显示状态 + // zbjsState: false, + // // 指标名称 + // nameText: '租赁和商务服务业增加值_累计值545' + // } ], // 选中的指标(右侧) changeActive: [], @@ -280,7 +279,6 @@ export default { this.leftCateData = res.data.data.list this.selectClassId = this.$store.state.selectDataLeft.id console.log(this.selectClassId, 'this.selectClassId000') - this.searchArealy() } }).catch((fail) => { console.log(fail) @@ -366,7 +364,7 @@ export default { }, mounted() { this.getCateData() - this.defaultOpenDataCode = this.$store.state.openOpenLeft + // this.defaultOpenDataCode = this.$store.state.openOpenLeft } } diff --git a/src/components/chartsCont/ChartsCont.vue b/src/components/chartsCont/ChartsCont.vue index b1640df..8a5183a 100644 --- a/src/components/chartsCont/ChartsCont.vue +++ b/src/components/chartsCont/ChartsCont.vue @@ -103,10 +103,10 @@ export default { type: Boolean, required: true }, - downLaSelects: { - type: String, - required: true - }, + // downLaSelects: { + // type: String, + // required: true + // }, downLaSelectArea: { type: String, required: false @@ -431,7 +431,7 @@ export default { this.showTable() } }, - immediate: true, + immediate: false, deep: true }, indStatic (newValue, oldValue) { @@ -469,69 +469,35 @@ export default { immediate: true, deep: true }, - downLaSelects (val) { - console.log(val, 'va;111') - if (val) { - this.$store.state.selectData = val - if (!this.$store.state.advancedSearchState) { - this.getDatas() - } else { - this.advancedSearchDataShow() - } - } - }, downLaSelectArea (valStrinf) { console.log(this.$store.state.AreaAllCountData, '555222000') console.log(valStrinf, '555222000选中') console.log(this.$store.state.AreaAllCountData, 'kkkkk数据') - if (!this.$store.state.advancedSearchState) { // 非高级查询 - if (this.$store.state.AreaAllCountData) { - if (this.selectState === 2) { - if (this.$store.state.AreaAllCountData.areaName.indexOf(valStrinf) !== -1) { - // 当前选中下标 - this.$store.state.selectIndexAreaLebal = this.$store.state.AreaAllCountData.areaName.indexOf(valStrinf) - // 当前选中地区名称 - this.$store.state.lebalIndexName = this.$store.state.AreaAllCountData.areaName[this.$store.state.AreaAllCountData.areaName.indexOf(valStrinf)] - let jsonData = JSON.parse(JSON.stringify(this.transBefore)) - jsonData.transBeforeAreaData = this.$store.state.AreaAllCountData.transBeforeAreaData[this.$store.state.AreaAllCountData.areaName.indexOf(valStrinf)] - this.transBefore = jsonData - this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - } else { - this.selectState = 1 - this.getDatas() - // 告诉父组件改变筛选值 - this.$emit('tellChangeFan', true) - } - } else { - console.log(this.$store.state.AreaAllCountData.termsName.indexOf(valStrinf), 'this.$store.state.AreaAllCountData.areaName.indexOf(valStrinf)') - if (this.$store.state.AreaAllCountData.termsName.indexOf(valStrinf) !== -1) { - // 当前选中下标 - this.$store.state.selectIndexAreaLebal = this.$store.state.AreaAllCountData.termsName.indexOf(valStrinf) - // 当前选中指标 - this.$store.state.lebalIndexName = this.$store.state.AreaAllCountData.termsName[this.$store.state.AreaAllCountData.termsName.indexOf(valStrinf)] - let jsonData = JSON.parse(JSON.stringify(this.transBefore)) - jsonData.transBeforeAreaData = this.$store.state.AreaAllCountData.transBeforeAreaData[this.$store.state.AreaAllCountData.termsName.indexOf(valStrinf)] - this.transBefore = jsonData - this.$store.state.noChangeData = JSON.parse(JSON.stringify(this.transBefore)) - // console.log(this.$store.state.AreaAllCountData.transBeforeAreaData[this.$store.state.AreaAllCountData.termsName.indexOf(valStrinf)], '1010111') - } else { - this.selectState = 2 - this.getDatas() - // 告诉父组件改变筛选值 - this.$emit('tellChangeFan', true) - } - } - } - } else { - console.log(valStrinf, '筛选名称') - // 筛选指标 - if (this.selectState === 1) { + if (!this.$store.state.advancedSearchState) { + if (this.$store.state.newSelectDaaState) { this.$store.state.labelIndexName = valStrinf this.$store.state.areaIndexName = '' - this.advancedSearchDataShow() - } else { // 筛选地区 + 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() } } @@ -568,21 +534,15 @@ export default { 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.$nextTick(() => { - console.log(this.hangZhiState, 'this.hangZhiState') - this.$store.state.advancedSearchState = false - if (this.leftState) { - this.getDatas() - } else { - this.leftState = true - } - }) + this.leftState = false + // 恢复高级查询状态 + this.$store.state.advancedSearchState = false } // 调接口拿到所有当前分类下的所有的指标、地区、时间 - this.getInfor(val.id) + this.getInfor([val.id]) } }, - immediate: true, + immediate: false, deep: true }, // 监听下拉状态变化 @@ -665,8 +625,21 @@ export default { } }, methods: { + /** + * @desc 请求时间完成 后就执行 + * + * */ + /* eslint-disable */ + downLaSelects() { + console.log(this.$store.state.advancedSearchState, 'this.$store.state.advancedSearchState') + if (!this.$store.state.advancedSearchState) { + this.getDatas() + } else { + this.advancedSearchDataShow() + } + }, // 获取所有当前分类下的所有的指标、地区、时间 - getInfor (classifyId) { + getInfor(classifyId) { this.$axios({ method: 'GET', url: 'data/data/classify-detail', @@ -678,13 +651,20 @@ export default { // 请求接口完成 请求成功 if (res.data.code === 200) { this.$store.state.dataArealabelTime = res.data.data + // 该分类下有数据 + this.$store.state.classifyIdDataState = true + } else { + this.$store.state.dataArealabelTime = res.data.data + // 该分类下无数据 + this.$store.state.classifyIdDataState = false } + this.$parent.childChartsCutShow() }).catch((fail) => { console.log(fail) }) }, // 非地区数据转置 - wrongAreaTrans () { + wrongAreaTrans() { if (this.transState) { // 当时间在表头上的时候 this.objCompBefore = new ComputedData(this.transBefore) var objDatasBefore = this.objCompBefore.comTransBefore() @@ -700,9 +680,8 @@ export default { } }, // 地区数据转置 - areaTrans () { + areaTrans() { console.log(this.transState, 'this.transState') - // if (true) { // 当时间在表头上的时候 console.log(this.$store.state.SelecttDimension, '2020') if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'dq') { this.objCompBefore = new ComputedData(this.transBefore) @@ -747,57 +726,10 @@ export default { console.log(comTransAreabeforeLabelArea, 'comTransAreabeforeLabelArea') this.objCompBefore = objCompAfter } - // } - // else { // 当指标名称在表头上 - // console.log(this.$store.state.SelecttDimension, '2020') - // if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'dq') { - // let objCompAfter = new ComputedData(this.transBefore) - // var objDatasAfterB = objCompAfter.comTransAreaAfter() - // this.tableLine = objDatasAfterB.tableLine - // this.tableData = objDatasAfterB.countData - // console.log(objDatasAfterB, 'objDatasAfterB') - // this.objCompBefore = objCompAfter - // } else if (this.$store.state.SelecttDimension.row === 'dq' && this.$store.state.SelecttDimension.col === 'sj') { - // this.objCompBefore = new ComputedData(this.transBefore) - // var objDatasBeforeB = this.objCompBefore.comTransAreabefore() - // this.tableLine = objDatasBeforeB.tableLine - // this.tableData = objDatasBeforeB.countData - // console.log(objDatasBeforeB, 'objDatasBeforeB') - // } else if (this.$store.state.SelecttDimension.row === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { - // let objCompAfter = new ComputedData(this.transBefore) - // var comTransAreabeforeTimeLabelB = objCompAfter.comTransAreabeforeTimeLabel() - // this.tableLine = comTransAreabeforeTimeLabelB.tableLine - // this.tableData = comTransAreabeforeTimeLabelB.countData - // console.log(comTransAreabeforeTimeLabelB, 'comTransAreabeforeTimeLabelB') - // this.objCompBefore = objCompAfter - // } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'sj') { - // let objCompAfter = new ComputedData(this.transBefore) - // var comTransAreabeforeLabelTimeB = objCompAfter.comTransAreabeforeLabelTime() - // this.tableLine = comTransAreabeforeLabelTimeB.tableLine - // this.tableData = comTransAreabeforeLabelTimeB.countData - // console.log(comTransAreabeforeLabelTimeB, 'comTransAreabeforeLabelTimeB') - // this.objCompBefore = objCompAfter - // } else if (this.$store.state.SelecttDimension.row === 'zb' && this.$store.state.SelecttDimension.col === 'dq') { - // let objCompAfter = new ComputedData(this.transBefore) - // var comTransAreabeforeLabelAreaB = objCompAfter.comTransAreabeforeLabelArea() - // this.tableLine = comTransAreabeforeLabelAreaB.tableLine - // this.tableData = comTransAreabeforeLabelAreaB.countData - // console.log(comTransAreabeforeLabelAreaB, 'comTransAreabeforeLabelAreaB') - // this.objCompBefore = objCompAfter - // } else if (this.$store.state.SelecttDimension.row === 'dq' && this.$store.state.SelecttDimension.col === 'zb') { - // let objCompAfter = new ComputedData(this.transBefore) - // var comTransAreabeforeAreaLabelB = objCompAfter.comTransAreabeforeAreaLabel() - // this.tableLine = comTransAreabeforeAreaLabelB.tableLine - // this.tableData = comTransAreabeforeAreaLabelB.countData - // console.log(comTransAreabeforeAreaLabelB, 'comTransAreabeforeAreaLabelB') - // this.objCompBefore = objCompAfter - // } - // } }, // 渲染列表数据 - showTable () { + showTable() { // 改变转置状态 - // this.transState = !this.transState console.log(121212121) if (this.areaDataState !== 'area') { // 非地区数据转置 this.wrongAreaTrans() @@ -807,7 +739,7 @@ export default { } }, // 指标解释 - indexExplain (labIndexName) { + indexExplain(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)] @@ -815,7 +747,7 @@ export default { } }, // 统计数据对行,对列处理 - dataTJComput () { + dataTJComput() { if (this.nowDataTJ.stateType === 'line') { switch (this.nowDataTJ.text) { case '无': @@ -926,7 +858,7 @@ export default { this.chartsShow() }, // 图表渲染 - chartsShow () { + chartsShow() { // 改变值行值 console.log(this.$route.query.type, '1010111') console.log(this.indStatic, 'this.indStatic') @@ -943,7 +875,7 @@ export default { this.objCompBefore.inputSelectData(this.listInputVal, this.lineInputVal) this.rowColIndex === 0 ? (this.echartsDatarts = this.objCompBefore.dataVerticalMapRow()) : (this.echartsDatarts = this.objCompBefore.dataVerticalMapCol()) this.pieStatic = false - this.lineStatic = true + // this.lineStatic = true break case 2: if (this.pieStatic) { @@ -956,28 +888,32 @@ export default { this.objCompBefore.inputSelectData(this.listInputVal, this.lineInputVal) this.rowColIndex === 0 ? (this.echartsDatarts = this.objCompBefore.dataAcrossMapRow()) : (this.echartsDatarts = this.objCompBefore.dataAcrossMapCol()) this.pieStatic = false - this.lineStatic = true + // this.lineStatic = true break case 3: console.log(this.lineStatic, this.rowColIndex, '状态改变') console.log(this.listInputVal, this.lineInputVal, '行列数据前') - // console.log(this.lineStatic, this.rowColIndex, '状态改变') + console.log(this.lineStatic, this.rowColIndex, '状态改变') if (this.lineStatic && this.rowColIndex === 0) { console.log(10086) this.lineInputVal = [0] this.listInputVal = [1, 2, 3] - this.lineStatic = true + // this.lineStatic = true } else if (!this.lineStatic && this.rowColIndex === 1) { this.lineInputVal = [0, 1, 2, 3] this.listInputVal = [1] - this.lineStatic = true + // this.lineStatic = true console.log(10087) } console.log(this.listInputVal, this.lineInputVal, '行列数据后') this.objCompBefore.inputSelectData(this.listInputVal, this.lineInputVal) this.rowColIndex === 0 ? (this.echartsDatarts = this.objCompBefore.dataPieMapRow()) : (this.echartsDatarts = this.objCompBefore.dataPieMapCol()) this.pieStatic = true - this.lineStatic = false + if (this.rowColIndex === 0) { + this.lineStatic = false + } else if (this.rowColIndex === 1) { + this.lineStatic = true + } break case 4: if (this.pieStatic) { @@ -989,42 +925,42 @@ export default { this.objCompBefore.inputSelectData(this.listInputVal, this.lineInputVal) this.rowColIndex === 0 ? (this.echartsDatarts = this.objCompBefore.dataBrokenLineMapRow()) : (this.echartsDatarts = this.objCompBefore.dataBrokenLineMapCol()) this.pieStatic = false - this.lineStatic = true + // this.lineStatic = true break } }, // 图表行列转换 - rowColInd (ind) { + rowColInd(ind) { // 0行1列 this.rowColIndex = ind + console.log(ind, this.lineStatic) // 重置默认 - this.lineStatic = true + if (ind === 0) { + this.lineStatic = true + } else if (ind === 1) { + this.lineStatic = false + } }, // 每列input选中 - listInput (ind) { + listInput(ind) { console.log(ind, '列') if (this.indStatic === 3 && this.rowColIndex === 1) { + console.log(this.listInputVal, this.lineInputVal, '好哥们1') this.listInputVal = [ind] - // this.$refs.listInputSelect[ind].checked = true + // this.$refs.lineInputSelect[ind].checked = true + console.log(this.listInputVal, this.lineInputVal, '好哥们2') } else { this.listInputVal.indexOf(ind) === -1 ? (this.listInputVal.push(ind)) : (this.listInputVal.splice(this.listInputVal.indexOf(ind), 1)) } this.chartsShow() }, // 每行input选中 - lineInput (ind) { + lineInput(ind) { console.log(ind, '行') console.log(this.rowColIndex, '行this.rowColIndex') console.log(this.indStatic, '行this.indStatic') console.log(this.$refs.lineInputSelect, '行this.lineInputSelect') if (this.indStatic === 3 && this.rowColIndex === 0) { - // this.$refs.lineInputSelect.forEach((item, index) => { - // if (index === ind) { - // item.checked = true - // } else { - // item.checked = false - // } - // }) console.log(this.listInputVal, this.lineInputVal, '好哥们1') this.lineInputVal = [ind] // this.$refs.lineInputSelect[ind].checked = true @@ -1035,7 +971,7 @@ export default { this.chartsShow() }, // 获取后台数据表中的数据 - getDatas () { + getDatas() { if (!this.$store.state.advancedSearchState) { // 初始化计算数据 if (this.transBefore) { @@ -1049,8 +985,8 @@ export default { type: this.$route.query.type === 'area' ? 2 : 1, // 1非地区 2地区 table_name: this.defaultDataRight.table_name, // 表名 id: this.defaultDataRight.id, // 分类id - area: this.downLaSelect.area, // 选中的地区 - quota: this.downLaSelect.label, // 选中的指标 + 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 // 时间 @@ -1148,7 +1084,7 @@ export default { this.$store.state.SelecttDimension.col = 'zb' this.$store.state.SelecttDimension.row = 'sj' } - // this.$emit('stateDataGet', false) + this.leftState = true }).catch((fail) => { console.log(fail, 2369) }) @@ -1158,7 +1094,7 @@ export default { } }, // 高级查询数据渲染 - advancedSearchDataShow () { + advancedSearchDataShow() { this.$axios({ method: 'POST', url: 'data/data/query', @@ -1172,7 +1108,7 @@ export default { date: this.$store.state.selectData } }).then(res => { - console.log(res, '高级查询数据展示') + console.log(res, '高级查询数据展示555666') // 请求接口完成 请求成功 if (res.data.code === 200) { let transBefore = {} @@ -1192,10 +1128,13 @@ export default { this.$store.state.noChangeData = JSON.parse(JSON.stringify(transBefore)) this.$emit('update:loading', false) } else { + this.transBefore = null this.$store.state.transBefore = null this.$store.state.noDataState = false this.$emit('update:loading', false) } + // 改变状态 + this.leftState = true // 告诉父组件我完成任务重置状态 this.$emit('prentsState', false) }).catch((fail) => { @@ -1203,7 +1142,7 @@ export default { }) }, // 兄弟组件调用此方法实现查询数据重渲染 - brotherFuncShowData () { + brotherFuncShowData() { if (this.$store.state.advancedSearchState) { this.advancedSearchDataShow() } else { @@ -1211,13 +1150,13 @@ export default { } }, // 重新初始化表格数据 - initTableData () { + initTableData() { this.objCompBefore.initAllData() } }, computed: { // 行计算样式 - computedLineSty () { + computedLineSty() { return (ind) => { let styStatic = false if (this.transState) { @@ -1245,7 +1184,7 @@ export default { } }, // 列计算样式 - computedListSty () { + computedListSty() { return (ind) => { let styStatic = false if (this.transState) { @@ -1273,22 +1212,22 @@ export default { } }, // 监听全局表数据的的变化从而改变渲染数据 - transBefores () { + transBefores() { return this.$store.state.allState } }, - created () { + created() { // 还原高级查询状态 - this.$store.state.advancedSearchState = false + // this.$store.state.advancedSearchState = false this.startsyui = this.advancedStates }, - updated () { + updated() { // 重新渲染表格 if (this.transBefore) { this.$refs.table.doLayout() } }, - mounted () { + mounted() { // console.log(new ComputedData()) // this.showTable() // 转置状态 diff --git a/src/components/chartsCut/ChartsCut.vue b/src/components/chartsCut/ChartsCut.vue index a4ea94b..7ebe000 100644 --- a/src/components/chartsCut/ChartsCut.vue +++ b/src/components/chartsCut/ChartsCut.vue @@ -11,7 +11,10 @@
-
+
{{stateChangeSDF?'指标:':'地区:'}} { console.log(fail) @@ -363,90 +368,80 @@ export default { }, // 指标地区数据渲染 showLabelArea () { - console.log(this.stateChangeSDF, '走走走') - if (!this.$store.state.advancedSearchState) { // 非高级查询 - if (this.stateChangeSDF) { // 指标 - console.log(this.$store.state.transBefore, 'thisthisthisthisthis') - this.cityDataArea = this.$store.state.transBefore.termsName.map((item, index) => { - return { 'id': '110000', 'name': item, 'parentId': '100000', 'shortName': '北京', 'cityCode': '', type: 1 } - }) - this.cityDataArea.unshift({ 'id': '110000', 'name': '-序列-', 'parentId': '100000', 'shortName': '北京', 'cityCode': '', type: 1 }) - this.cityDefaultNameArea = this.cityDataArea[1].name - this.selectpatternArea.placeholder = this.cityDataArea[1].name - - this.options = this.$store.state.transBefore.termsName.map((item, index) => { - return { - value: item, - label: item + console.log(this.stateChangeSDF, this.$store.state.dataArealabelTime, '走走走') + if (this.$store.state.classifyIdDataState) { + if (!this.$store.state.advancedSearchState) { // 非高级查询 + if (this.stateChangeSDF) { // 指标 + this.options = this.$store.state.dataArealabelTime.quotaArr.map((item, index) => { + return { + value: item, + label: item + } + }) + this.options.unshift({ + value: '序列', + label: '序列' + }) + this.value = [this.options[1].value] + console.log(this.value, 'this.options') + // 告诉父组件已经完成任务 + this.$emit('stateDFGHJ', true) + this.$emit('statertfResu', this.value[0]) + } else { // 地区 + this.options = this.$store.state.dataArealabelTime.areaArr.map((item, index) => { + return { + value: item, + label: item + } + }) + this.options.unshift({ + value: '序列', + label: '序列' + }) + this.value = [this.options[1].value] + console.log(this.value, 'this.options') + // 告诉父组件已经完成任务 + this.$emit('stateDFGHJ', true) + this.$emit('statertfResu', this.value[0]) + } + } else { // 高级查询 + if (this.$route.query.type !== 'area') { + this.$emit('stateDFGHJ', true) + } else { + if (this.stateChangeSDF) { // 指标 + this.options = this.$store.state.dataArealabelTime.quotaArr.map((item, index) => { + return { + value: item, + label: item + } + }) + this.options.unshift({ + value: '序列', + label: '序列' + }) + this.value = [this.options[1].value] + console.log(this.value, 'this.options') + // 告诉父组件已经完成任务 + this.$emit('stateDFGHJ', true) + this.$emit('statertfResu', this.value[0]) + } else { // 地区 + this.options = this.$store.state.dataArealabelTime.areaArr.map((item, index) => { + return { + value: item, + label: item + } + }) + this.options.unshift({ + value: '序列', + label: '序列' + }) + this.value = [this.options[1].value] + console.log(this.value, 'this.options') + // 告诉父组件已经完成任务 + this.$emit('stateDFGHJ', true) + this.$emit('statertfResu', this.value[0]) } - }) - this.options.unshift({ - value: '序列', - label: '序列' - }) - this.value = [this.options[1].value] - console.log(this.value, 'this.options') - // 告诉父组件已经完成任务 - this.$emit('stateDFGHJ', true) - this.$emit('statertfResu', this.value[0]) - } else { // 地区 - this.options = this.$store.state.transBefore.areaName.map((item, index) => { - return { - value: item, - label: item - } - }) - this.options.unshift({ - value: '序列', - label: '序列' - }) - this.value = [this.options[1].value] - console.log(this.value, 'this.options') - // 告诉父组件已经完成任务 - this.$emit('stateDFGHJ', true) - this.$emit('statertfResu', this.value[0]) - } - } else { // 高级查询 - if (this.stateChangeSDF) { // 指标 - console.log(this.$store.state.advanceQueryInit, 'thisthisthisthisthis') - this.cityDataArea = this.$store.state.advanceQueryInit.labelName.map((item, index) => { - return { 'id': '110000', 'name': item, 'parentId': '100000', 'shortName': '北京', 'cityCode': '', type: 1 } - }) - this.cityDataArea.unshift({ 'id': '110000', 'name': '-序列-', 'parentId': '100000', 'shortName': '北京', 'cityCode': '', type: 1 }) - this.cityDefaultNameArea = this.$store.state.labelIndexName - this.selectpatternArea.placeholder = this.$store.state.labelIndexName - - this.options = this.$store.state.advanceQueryInit.labelName.map((item, index) => { - return { - value: item, - label: item - } - }) - this.options.unshift({ - value: '序列', - label: '序列' - }) - this.value = [this.options[1].value] - console.log(this.value, 'this.options') - // 告诉父组件已经完成任务 - this.$emit('stateDFGHJ', true) - this.$emit('statertfResu', this.value[0]) - } else { // 地区 - this.options = this.$store.state.advanceQueryInit.areaName.map((item, index) => { - return { - value: item, - label: item - } - }) - this.options.unshift({ - value: '序列', - label: '序列' - }) - this.value = [this.options[1].value] - console.log(this.value, 'this.options') - // 告诉父组件已经完成任务 - this.$emit('stateDFGHJ', true) - this.$emit('statertfResu', this.value[0]) + } } } }, @@ -459,55 +454,184 @@ export default { if (this.timeUsrr !== '') { switch (this.$route.query.type) { case 'monthly': - if (this.timeUsrr[this.timeUsrr.length - 2] < 2 && this.timeUsrr.length < 7 && /^[0-9]+$/.test(this.timeUsrr)) { - if (this.timeUsrr[this.timeUsrr.length - 2] === 1 && this.timeUsrr[this.timeUsrr.length - 1] > 2) { - // alert('您查询的时间格式有误,请重新输入!') + if (!(this.timeUsrr.length === 6 || this.timeUsrr.length === 13)) { + console.log(this.timeUsrr.length, true) + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + // 对于1个输入查询的验证 + if (this.timeUsrr.length === 6) { + if (!(/^[0-9]+$/.test(this.timeUsrr) && this.timeUsrr[this.timeUsrr.length - 2] < 2)) { this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { confirmButtonText: '确定' }) - } else { - this.$store.state.selectData = this.timeUsrr - console.log(this.$store.state.selectData, '时间') - // 调用父组件(Dataweb)中的changeBrother方法来调用ChartCont组件中的brotherFuncShowData方法 - this.$parent.changeBrother() - this.timeUsrr = '' - this.childFuncChangeDown() + return + } else if (this.timeUsrr[this.timeUsrr.length - 2] === 1 && this.timeUsrr[this.timeUsrr.length - 1] > 2) { + console.log(9996) + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return } - } else { - // alert('您查询的时间格式有误,请重新输入!111') - this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { - confirmButtonText: '确定' - }) } + // 对于范围输入的验证 + if (this.timeUsrr.length === 13) { + if (!(this.timeUsrr.length === 13 && /^[0-9]+$/.test(this.timeUsrr.split('-')[0]) && /^[0-9]+$/.test(this.timeUsrr.split('-')[1]) && this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 2] < 2 && this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 2] < 2)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } else if ((this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 2] === 1 && this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 1] > 2) || (this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 2] === 1 && this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 1] > 2)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + this.$store.state.selectData = this.timeUsrr + console.log(this.$store.state.selectData, '时间') + // 调用父组件(Dataweb)中的changeBrother方法来调用ChartCont组件中的brotherFuncShowData方法 + this.$parent.changeBrother() + this.timeUsrr = '' + this.childFuncChangeDown() break case 'quarter': - let arr = ['A', 'B', 'C', 'D'] - if (arr.indexOf(this.timeUsrr[this.timeUsrr.length - 1]) !== -1 && this.timeUsrr.length < 6 && /^[0-9]+$/.test(this.timeUsrr.substring(0, 4))) { - this.$store.state.selectData = this.timeUsrr - this.$parent.changeBrother() - this.timeUsrr = '' - this.childFuncChangeDown() - } else { - // alert('您查询的时间格式有误,请重新输入!111') + if (!(this.timeUsrr.length === 5 || this.timeUsrr.length === 11)) { this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { confirmButtonText: '确定' }) + return } + let arr = ['A', 'B', 'C', 'D'] + // 对于一个季度的验证 + if (this.timeUsrr.length === 5) { + if (!(/^[0-9]+$/.test(this.timeUsrr.substring(0, 4)) && arr.indexOf(this.timeUsrr[this.timeUsrr.length - 1]) !== -1)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于季度范围的验证 + if (this.timeUsrr.length === 11) { + if (!(/^[0-9]+$/.test(this.timeUsrr.split('-')[0].substring(0, 4)) && /^[0-9]+$/.test(this.timeUsrr.split('-')[1].substring(0, 4)) && arr.indexOf(this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 1]) !== -1 && arr.indexOf(this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 1]) !== -1)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + this.$store.state.selectData = this.timeUsrr + this.$parent.changeBrother() + this.timeUsrr = '' + this.childFuncChangeDown() break case 'year': - if ((this.timeUsrr.length < 5 && /^[0-9]+$/.test(this.timeUsrr.substring(0, 4))) || (this.timeUsrr.length < 10 && (this.timeUsrr.split('-')[0] < this.timeUsrr.split('-')[1]))) { - this.$store.state.selectData = this.timeUsrr - this.$parent.changeBrother() - this.timeUsrr = '' - this.childFuncChangeDown() - } else { - // alert('您查询的时间格式有误,请重新输入!111') + if (!(this.timeUsrr.length === 4 || this.timeUsrr.length === 9)) { this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { confirmButtonText: '确定' }) + return } + // 对于一个时间的验证 + if (this.timeUsrr.length === 4) { + if (!(/^[0-9]+$/.test(this.timeUsrr))) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于时间范围的验证 + if (this.timeUsrr.length === 9) { + if (!(/^[0-9]+$/.test(this.timeUsrr.split('-')[0]) && /^[0-9]+$/.test(this.timeUsrr.split('-')[1]))) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + this.$store.state.selectData = this.timeUsrr + this.$parent.changeBrother() + this.timeUsrr = '' + this.childFuncChangeDown() break case 'area': + let arrs = ['A', 'B', 'C', 'D'] + if (!(this.timeUsrr.length === 4 || this.timeUsrr.length === 5 || this.timeUsrr.length === 6 || this.timeUsrr.length === 9 || this.timeUsrr.length === 11 || this.timeUsrr.length === 13)) { + console.log(this.timeUsrr.length, true) + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + // 对于1个输入查询的验证 + if (this.timeUsrr.length === 6) { + if (!(/^[0-9]+$/.test(this.timeUsrr) && this.timeUsrr[this.timeUsrr.length - 2] < 2)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } else if (this.timeUsrr[this.timeUsrr.length - 2] === 1 && this.timeUsrr[this.timeUsrr.length - 1] > 2) { + console.log(9996) + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于范围输入的验证 + if (this.timeUsrr.length === 13) { + if (!(this.timeUsrr.length === 13 && /^[0-9]+$/.test(this.timeUsrr.split('-')[0]) && /^[0-9]+$/.test(this.timeUsrr.split('-')[1]) && this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 2] < 2 && this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 2] < 2)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } else if ((this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 2] === 1 && this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 1] > 2) || (this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 2] === 1 && this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 1] > 2)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于一个季度的验证 + if (this.timeUsrr.length === 5) { + if (!(/^[0-9]+$/.test(this.timeUsrr.substring(0, 4)) && arrs.indexOf(this.timeUsrr[this.timeUsrr.length - 1]) !== -1)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于季度范围的验证 + if (this.timeUsrr.length === 11) { + if (!(/^[0-9]+$/.test(this.timeUsrr.split('-')[0].substring(0, 4)) && /^[0-9]+$/.test(this.timeUsrr.split('-')[1].substring(0, 4)) && arrs.indexOf(this.timeUsrr.split('-')[0][this.timeUsrr.split('-')[0].length - 1]) !== -1 && arrs.indexOf(this.timeUsrr.split('-')[1][this.timeUsrr.split('-')[1].length - 1]) !== -1)) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于一个时间的验证 + if (this.timeUsrr.length === 4) { + if (!(/^[0-9]+$/.test(this.timeUsrr))) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } + // 对于时间范围的验证 + if (this.timeUsrr.length === 9) { + if (!(/^[0-9]+$/.test(this.timeUsrr.split('-')[0]) && /^[0-9]+$/.test(this.timeUsrr.split('-')[1]))) { + this.$alert('您查询的时间格式有误,请重新输入!', '温馨提示', { + confirmButtonText: '确定' + }) + return + } + } this.$store.state.selectData = this.timeUsrr this.$parent.changeBrother() this.timeUsrr = '' @@ -525,7 +649,18 @@ export default { handleChange (value) { console.log(value) console.log(this.value, 'this.value') - this.$emit('statertfResu', value[0]) + if (value[0] === '序列') { + this.stateChangeSDF = !this.stateChangeSDF + this.$store.state.newSelectDaaState = this.stateChangeSDF + this.showLabelArea() + 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 === 'sj' && this.$store.state.SelecttDimension.col === 'zb') { + this.$store.state.SelecttDimension.col = 'dq' + } + } else { + this.$emit('statertfResu', value[0]) + } }, // 调用子组件方法改变下拉框的显示隐藏 childFuncChangeDown () { @@ -539,6 +674,10 @@ export default { }, // 当前选中的时间列表 callBackVal (res) { + console.log(res.extendData, '开始') + // 调用父组件的chuFachildChartCont方法渲染 + this.$store.state.selectData = res.extendData + this.$parent.chuFachildChartCont() if (this.$store.state.selectData !== undefined) { console.log(this.$store.state.selectData, '被选中的值') console.log(res, '被选中的值2') @@ -551,18 +690,18 @@ export default { this.changesInputStu() }, callBackValClose (res) { // 关闭回调 - console.log(res, '展开') + console.log(res, '关闭') this.changesInputStu() }, // 高级查询指标地区序列化 - serializedData (termsName, areaName) { - console.log(termsName, areaName, '10256') - this.showLabelArea() + serializedData () { + // this.showLabelArea() } }, mounted () { this.cityDataArea = this.cityDataAreas this.cityDataTime = this.cityDataAreas + // this.showLabelArea() } } diff --git a/src/components/nav/Nav.vue b/src/components/nav/Nav.vue index 1da0766..3c695c2 100644 --- a/src/components/nav/Nav.vue +++ b/src/components/nav/Nav.vue @@ -97,7 +97,7 @@ export default { ], twonav: false, colorD: false, - userName: '十画.TeFuir', + userName: null, userPic: '', // 用户名和登陆的显示隐藏 userLogin: false, @@ -333,7 +333,7 @@ export default { url: 'site/check', params: {} }).then(res => { - console.log(res, 'IP段') + // console.log(res, 'IP段') if (res.data.code === 200) { this.$store.state.normalLogin = false // 用户信息存本地 diff --git a/src/main.js b/src/main.js index 9de0970..65456b4 100644 --- a/src/main.js +++ b/src/main.js @@ -69,17 +69,27 @@ axios.interceptors.request.use(config => { }) // 返回拦截器(后) axios.interceptors.response.use(data => { - // console.log(sessionStorage.getItem('token')) - if (sessionStorage.getItem('token') && data.data.code === 403) { - Vue.prototype.$alert('您没有查看此分类下数据的权限!', '温馨提示', { - confirmButtonText: '确定' - }) - // alert('您没有查看此分类下数据的权限!') + switch (data.data.code) { + case 401: + if (sessionStorage.getItem('token')) { + Vue.prototype.$alert('登陆已过期,请重新登陆!', '温馨提示', { + confirmButtonText: '确定' + }) + sessionStorage.clear() + window.location.reload() + } + break + case 403: + Vue.prototype.$alert('您没有查看此分类下数据的权限!', '温馨提示', { + confirmButtonText: '确定' + }) + break + case 500: + Vue.prototype.$alert('内部服务器错误!', '温馨提示', { + confirmButtonText: '确定' + }) + break } - // let daraRes = [] - // if(data.data.code===200){ - // daraRes=== - // } return data }) // 将图形验证码写入 diff --git a/src/router.js b/src/router.js index 4db2376..35facad 100644 --- a/src/router.js +++ b/src/router.js @@ -106,18 +106,18 @@ let RouterObj = new Router({ ] }) RouterObj.beforeEach((to, from, next) => { - console.log(to, 'to') - console.log(from, 'from') + // console.log(to, 'to') + // console.log(from, 'from') if (to.name === 'personalCenter' || to.name === 'datasweb') { - console.log(sessionStorage.getItem('token'), 'sessionStorage.getItem()') + // console.log(sessionStorage.getItem('token'), 'sessionStorage.getItem()') if (!sessionStorage.getItem('token')) { // alert('您没有该账号的登陆权限,请重新登录后再次操作!') Vue.prototype.$alert('您没有该账号的登陆权限,请重新登录后再次操作!', '温馨提示', { confirmButtonText: '确定', callback: res => { - console.log(Vue.prototype.$auth, 'Vue.prototype.$auth') + // console.log(Vue.prototype.$auth, 'Vue.prototype.$auth') Vue.prototype.$auth.auth = true - console.log(Vue.prototype.$auth, 'Vue.prototype.$auth') + // console.log(Vue.prototype.$auth, 'Vue.prototype.$auth') if (from.name !== 'index') { next({ name: 'index', diff --git a/src/store.js b/src/store.js index 4fc9e60..4b2493e 100644 --- a/src/store.js +++ b/src/store.js @@ -97,7 +97,15 @@ export default new Vuex.Store({ labelName: [] }, // 没数据状态 - noDataState: true + noDataState: true, + // 高级查询date时间 + dateAdvance: null, + // 该分类下有无数据状态 + classifyIdDataState: false, + // 当前选中需要筛选的是指标还是地区 true指标 false地区 + newSelectDaaState: true, + // 高级查询选中的当前分类 + advancedSelectClassfiid: null }, mutations: {}, actions: { diff --git a/src/views/datasweb/Datasweb.vue b/src/views/datasweb/Datasweb.vue index b10d45b..e75c349 100644 --- a/src/views/datasweb/Datasweb.vue +++ b/src/views/datasweb/Datasweb.vue @@ -114,7 +114,7 @@
@@ -472,6 +473,15 @@ export default { } }, methods: { + /* + * @desc 触发子组件 childChartCont 的downLaSelects方法 + */ + chuFachildChartCont () { + console.log(this.$refs, 'this.$refs') + this.$nextTick(() => { + this.$refs.childChartCont.downLaSelects() + }) + }, // 地区数据维度转换状态 areaDimensionState (val) { console.log(val, 'bbbval') @@ -605,9 +615,12 @@ export default { case 4:// 导出至excel!! if (this.$store.state.transBefore) { let brt = new ComputedData() - brt.insertCollectS(this.$store.state.tableData, this.$store.state.tableLine, this.$store.state.listInputVal, this.$store.state.lineInputVal) - console.log(this.$store.state.selectDataLeft, '左侧选中数据') - let objData = brt.insertCollectS(JSON.parse(JSON.stringify(this.$store.state.tableData)), JSON.parse(JSON.stringify(this.$store.state.tableLine)), JSON.parse(JSON.stringify(this.$store.state.listInputVal)), JSON.parse(JSON.stringify(this.$store.state.lineInputVal))) + let objData = null + if (this.indStatic === 0) { + objData = brt.exportDataAll(JSON.parse(JSON.stringify(this.$store.state.tableData)), JSON.parse(JSON.stringify(this.$store.state.tableLine))) + } else { + objData = brt.insertCollectS(JSON.parse(JSON.stringify(this.$store.state.tableData)), JSON.parse(JSON.stringify(this.$store.state.tableLine)), JSON.parse(JSON.stringify(this.$store.state.listInputVal)), JSON.parse(JSON.stringify(this.$store.state.lineInputVal))) + } // 调用接口导出至excel this.$axios({ method: 'POST', @@ -653,75 +666,20 @@ export default { }) return } - this.$axios({ - method: 'GET', - url: 'data/data/quick', - params: { - type: this.$store.state.selectDataLeft.f - } - }).then(res => { - console.log(res, '时间筛选') - console.log(Object.keys(res.data.data.list)) - // 请求接口完成 请求成功 - if (res.data.code === 200) { - this.$axios({ - method: 'POST', - url: 'data/data/query', - data: { - type: this.$route.query.type === 'area' ? 2 : 1, - data: this.$store.state.advanceData, - area: '', - quota: '', - cate: 1, - f: this.$store.state.selectDataLeft.f, - date: Object.keys(res.data.data.list)[0] - - } - }).then(res => { - console.log(res, '高级查询数据展示') - // 请求接口完成 请求成功 - if (res.data.code === 200) { - let transBefore = {} - transBefore.tableExplain = res.data.data.tableExplain - transBefore.timeArr = res.data.data.timeArr.map((item, index) => { return item.toString() }) - transBefore.termsName = res.data.data.termsName - transBefore.termsExplain = res.data.data.termsExplain - transBefore.areaName = res.data.data.areaName - transBefore.transBeforeTermsData = res.data.data.transBeforeTermsData - transBefore.transBeforeAreaData = res.data.data.transBeforeAreaData[0] - console.log(transBefore, '000') - that.$store.state.transdtr = true - // 全局总数据 - that.$store.state.transBefore = transBefore - // 全局永久不变数据 - that.$store.state.noChangeData = JSON.parse(JSON.stringify(transBefore)) - that.cutStateSeach = 'simpleness' - that.advancedStates = true - // 调用子组件 的方法渲染高级查询数据 - that.$nextTick(() => { - // console.log(that.$refs.childChartsCut, 'that.$refs.childChartsCut') - // 改变高级查询状态 - that.$store.state.advancedSearchState = true - // 默认选中指标 - that.$store.state.labelIndexName = res.data.data.termsName[0] - // 初次筛选的指标和地区名称 - that.$store.state.advanceQueryInit.labelName = res.data.data.termsName - that.$store.state.advanceQueryInit.areaName = res.data.data.areaName - that.$refs.childChartsCut.serializedData(res.data.data.termsName, res.data.data.areaName) - // 恢复状态 - that.stateDFGHJ(false) - }) - } else { - that.$store.state.transBefore = null - that.advancedStates = true - } - // 告诉子组件渲染高级查询数据 - }).catch((fail) => { - console.log(fail) - }) - } - }).catch((fail) => { - console.log(fail) + that.cutStateSeach = 'simpleness' + that.advancedStates = true + // 调用子组件 的方法渲染高级查询数据 + that.$store.state.advancedSearchState = true + console.log(this.$store.state.dataArealabelTime, 'this.$store.state.dataArealabelTime') + console.log(this.$store.state.advanceData, 'this.$store.state.advanceData') + this.$store.state.advancedSelectClassfiid = this.$store.state.advanceData.map((item, index) => { + return item.classify_id + }) + this.$nextTick(() => { + // 左侧菜单数据 + this.getCateData() + this.childChartContShow(this.$store.state.advancedSelectClassfiid) + this.$store.state.labelIndexName = this.$store.state.advanceData[0].nameText }) break } @@ -1171,80 +1129,86 @@ export default { defaultSelectLie () { console.log(this.leftCateData, 'this.leftCateDatathis.leftCateDatathis.leftCateData') console.log(this.$route.query.defaultLeftId, 'this.$router.query.defaultLeftId') - 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) - } - }) + // 非高级查询 + 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') + }) + 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] + // 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].children[0] + dataDome = this.leftCateData[this.leftCateData.length - 1].children[0].children[0] } } else { - dataDome = this.leftCateData[this.leftCateData.length - 1].children[0].children[0] + dataDome = this.leftCateData[this.leftCateData.length - 1].children[0] } } else { - dataDome = this.leftCateData[this.leftCateData.length - 1].children[0] + dataDome = this.leftCateData[this.leftCateData.length - 1] } - } 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 { // 从数据更新,快速 + this.defaultDataSelectDG() + console.log(this.filterDataArr, '非导航左侧选中') + console.log(this.filterDataArr.defaultCode, '代码') + this.defaultSelectLies = this.filterDataArr.defaultCode + this.$store.state.openOpenLeft = this.filterDataArr.defaultCode + this.$store.state.selectDataLeft = this.filterDataArr.objectData + this.defaultDataRight = this.filterDataArr.objectData + this.$store.state.selectfilter = this.filterDataArr.objectData.f } - 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 { // 从数据更新,快速 - this.defaultDataSelectDG() - console.log(this.filterDataArr, '非导航左侧选中') - console.log(this.filterDataArr.defaultCode, '代码') - this.defaultSelectLies = this.filterDataArr.defaultCode - this.$store.state.openOpenLeft = this.filterDataArr.defaultCode - this.$store.state.selectDataLeft = this.filterDataArr.objectData - this.defaultDataRight = this.filterDataArr.objectData - this.$store.state.selectfilter = this.filterDataArr.objectData.f + } else { + // this.defaultDataRight = [] + // this.defaultSelectLies = [] } }, comTime (res) { @@ -1316,6 +1280,14 @@ export default { // 调用子组件的方法重置数据 changeScreenCom () { this.$refs.childChartCont.initTableData() + }, + // 调用子组件的方法重置筛选数据 + childChartsCutShow () { + this.$refs.childChartsCut.showLabelArea() + }, + // 调用子组件的方法重置筛选数据 + childChartContShow (res) { + this.$refs.childChartCont.getInfor(res) } }, computed: { @@ -1358,7 +1330,7 @@ export default { this.dataPos = this.$route.query.type // console.log(this.$route.query.type) this.initValue = this.computedNumberPx(200) - console.log(this.computedNumberPx(200)) + // console.log(this.computedNumberPx(200)) // 获取菜单信息 this.getCateData() if (this.$route.query.type !== 'area') { diff --git a/src/views/help/Help.vue b/src/views/help/Help.vue index 33f5cb3..bb7eeaa 100644 --- a/src/views/help/Help.vue +++ b/src/views/help/Help.vue @@ -34,7 +34,7 @@ 数据查询 指标查询 - 快捷按钮 + 我的收藏