From 54ef0d033df5b570e6e73dfa90e74c7a890af982 Mon Sep 17 00:00:00 2001 From: e <2432808546@qq.com> Date: Tue, 17 Aug 2021 16:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=82=B9=E5=87=BB=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/data/list/index.vue | 40 ++++++++++++++++++++++++++++++----- src/setting.js | 5 +++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/pages/data/list/index.vue b/src/pages/data/list/index.vue index b84d0aa..9a3d7a3 100644 --- a/src/pages/data/list/index.vue +++ b/src/pages/data/list/index.vue @@ -294,7 +294,7 @@ export default { if(e.children.length>0){// 若有下级 if(e.children[0].children.length===0){// 找到下级的下级若无子级,则赋值勾选 action = e.children[0].id - }else{// 只招两层 + }else{// 直接赋值 action = e.children[0].children[0].id } } @@ -342,7 +342,7 @@ export default { this.$refs.table.clearSelection() this.getData() }, - selectType(index,indexPath){ + selectType(index,indexPath){// 点击事件 let introduce = '' this.keyword = '' let list = this.typeList @@ -362,7 +362,37 @@ export default { } }) if(!introduce) introduce = list.find(n => n.id == indexPath[0]).introduce - this.defaultType = index + + if(indexPath.length>=2){ + let clikckId = indexPath[indexPath.length-1] + let select + function getSelect(arr){ + if(arr.length>0){ + arr.map(e=>{ + if(e.id==clikckId){ + if(e.children.length===0){ + select = e.id + }else{ + if(e.children[0].children.length>0){ + select = e.children[0].children[0].id + }else{ + select = e.children[0].id + } + } + }else{ + getSelect(e.children) + } + }) + }else{ + return + } + } + getSelect(this.typeList) + console.log(select,'dig'); + this.defaultType = select + }else{ + this.defaultType = index + } this.introduce = introduce this.previewHead = [] this.previewData = [] @@ -384,7 +414,7 @@ export default { return result }, openType(index,indexPath){ - // console.log(11,this.typeList) + console.log(11,this.typeList) let id = this.findId(this.typeList,index) this.selectType(id,indexPath) }, @@ -597,7 +627,7 @@ export default { background-color: #fff; border: 1px solid #e6e6e6; border-radius: 5px; - + input{ width: 195px; margin-left: 10px; diff --git a/src/setting.js b/src/setting.js index 03c6632..f20e49e 100644 --- a/src/setting.js +++ b/src/setting.js @@ -15,8 +15,9 @@ const Setting = { // 页面切换时,是否显示模拟的进度条 showProgressBar: true, // 接口请求地址 - // apiBaseURL: env === 'development' ? 'http://192.168.31.216:9000' : 'http://39.108.250.202:9000', - apiBaseURL: env === 'development' ? 'http://39.108.250.202:9000' : 'http://39.108.250.202:9000', + // apiBaseURL: env === 'development' ? 'http://192.168.31.125:9000' : 'http://39.108.250.202:9000', + apiBaseURL:'http://39.108.250.202:9000' , + // apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : 'http://192.168.31.151:9000', // 接口请求返回错误时,弹窗的持续时间,单位:秒 modalDuration: 3, // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice