--no commit message
Showing
1 changed file
with
39 additions
and
14 deletions
| ... | @@ -71,6 +71,8 @@ export default { | ... | @@ -71,6 +71,8 @@ export default { |
| 71 | //左侧树形结构数据 | 71 | //左侧树形结构数据 |
| 72 | treedata: [], | 72 | treedata: [], |
| 73 | sfqdata: [], | 73 | sfqdata: [], |
| 74 | keyy:"", | ||
| 75 | iskey:"", | ||
| 74 | defaultNode: "", | 76 | defaultNode: "", |
| 75 | defaultProps: { | 77 | defaultProps: { |
| 76 | value: "id", | 78 | value: "id", |
| ... | @@ -109,12 +111,12 @@ export default { | ... | @@ -109,12 +111,12 @@ export default { |
| 109 | return item.bdcdyid ==val.bdcdyid; | 111 | return item.bdcdyid ==val.bdcdyid; |
| 110 | }); | 112 | }); |
| 111 | this.activeName=index | 113 | this.activeName=index |
| 112 | this.setstyle(index,0); | 114 | this.setstyle(index,0,this.iskey); |
| 113 | } else { | 115 | } else { |
| 114 | this.sfqdata.push(loadsfqData(res.result, val.bdcdyh, val.bdcdyid)); | 116 | this.sfqdata.push(loadsfqData(res.result, val.bdcdyh, val.bdcdyid)); |
| 115 | this.activeName = this.sfqdata.length - 1; | 117 | this.activeName = this.sfqdata.length - 1; |
| 116 | this.$nextTick(() => { | 118 | this.$nextTick(() => { |
| 117 | this.setstyle(this.sfqdata.length - 1,0); | 119 | this.setstyle(this.sfqdata.length - 1,0,this.iskey); |
| 118 | }) | 120 | }) |
| 119 | } | 121 | } |
| 120 | } | 122 | } |
| ... | @@ -146,9 +148,17 @@ export default { | ... | @@ -146,9 +148,17 @@ export default { |
| 146 | { linShi: 0, xianShi: 0, liShi: 0 }, | 148 | { linShi: 0, xianShi: 0, liShi: 0 }, |
| 147 | this.formData.bdcdylx || "" | 149 | this.formData.bdcdylx || "" |
| 148 | ); | 150 | ); |
| 149 | this.$refs.tree.setCurrentKey(this.defaultNode.id); //data[0].id为默认选中的节点 | 151 | this.sfqdata[0].children.forEach((item,index) => { |
| 150 | this.loadComponent(this.defaultNode.form); | 152 | if( item.id==this.defaultNode.id){ |
| 151 | this.setstyle(0,0); | 153 | this.iskey=index |
| 154 | } | ||
| 155 | }) | ||
| 156 | // this.$refs.tree.setCurrentKey(this.defaultNode.id); //data[0].id为默认选中的节点 | ||
| 157 | // this.loadComponent(this.defaultNode.form); | ||
| 158 | |||
| 159 | this.setstyle(0,0,this.iskey); | ||
| 160 | |||
| 161 | |||
| 152 | }); | 162 | }); |
| 153 | } | 163 | } |
| 154 | }); | 164 | }); |
| ... | @@ -173,20 +183,26 @@ export default { | ... | @@ -173,20 +183,26 @@ export default { |
| 173 | * @author: renchao | 183 | * @author: renchao |
| 174 | * 设置样式和点击定位到当前功能 | 184 | * 设置样式和点击定位到当前功能 |
| 175 | */ | 185 | */ |
| 176 | setstyle(newindex,index) { | 186 | setstyle(newindex,index,key) { |
| 177 | if(index==0){ | 187 | if(key!=undefined||this.keyy==index){ |
| 178 | this.loadComponent(this.$refs.sfq[newindex].$children[0].$attrs.re.form); | 188 | if(key!=undefined){ |
| 189 | this.keyy=key | ||
| 179 | } | 190 | } |
| 180 | let dpme = this.$refs.sfq[newindex].$children[0].$el | 191 | this.loadComponent(this.$refs.sfq[newindex].$children[this.keyy].$attrs.re.form); |
| 181 | if (index != 0) { | 192 | let dpme = this.$refs.sfq[newindex].$children[this.keyy].$el |
| 182 | dpme.style.backgroundColor = "#ffffff"; | ||
| 183 | dpme.style.color = "black"; | ||
| 184 | dpme.style.border = "none"; | ||
| 185 | } else { | ||
| 186 | dpme.style.backgroundColor = "#f5f5f5"; | 193 | dpme.style.backgroundColor = "#f5f5f5"; |
| 187 | dpme.style.color = "#0079fe"; | 194 | dpme.style.color = "#0079fe"; |
| 188 | dpme.style.borderRight = "4px solid #0079fe"; | 195 | dpme.style.borderRight = "4px solid #0079fe"; |
| 196 | }else{ | ||
| 197 | let dpme = this.$refs.sfq[newindex].$children[this.keyy].$el | ||
| 198 | dpme.style.backgroundColor = "#ffffff"; | ||
| 199 | dpme.style.color = "black"; | ||
| 200 | dpme.style.border = "none"; | ||
| 189 | } | 201 | } |
| 202 | |||
| 203 | |||
| 204 | |||
| 205 | |||
| 190 | }, | 206 | }, |
| 191 | /** | 207 | /** |
| 192 | * @description: addlist | 208 | * @description: addlist |
| ... | @@ -195,12 +211,21 @@ export default { | ... | @@ -195,12 +211,21 @@ export default { |
| 195 | * 新增列表功能 | 211 | * 新增列表功能 |
| 196 | */ | 212 | */ |
| 197 | addlist(data, index) { | 213 | addlist(data, index) { |
| 214 | if(index!=undefined){ | ||
| 198 | let newindex= this.sfqdata.findIndex((item) => { | 215 | let newindex= this.sfqdata.findIndex((item) => { |
| 199 | return item.bdcdyid ==data.bdcdyid; | 216 | return item.bdcdyid ==data.bdcdyid; |
| 200 | }); | 217 | }); |
| 201 | this.setstyle(newindex,index); | 218 | this.setstyle(newindex,index); |
| 202 | this.currentSelectProps.bdcdyid = data.bdcdyid; | 219 | this.currentSelectProps.bdcdyid = data.bdcdyid; |
| 203 | this.loadComponent(data.form); | 220 | this.loadComponent(data.form); |
| 221 | }else{ | ||
| 222 | let newindex= this.sfqdata.findIndex((item) => { | ||
| 223 | return item.bdcdyid ==data.bdcdyid; | ||
| 224 | }); | ||
| 225 | this.setstyle(newindex,index,this.iskey); | ||
| 226 | this.currentSelectProps.bdcdyid = data.bdcdyid; | ||
| 227 | } | ||
| 228 | |||
| 204 | }, | 229 | }, |
| 205 | /** | 230 | /** |
| 206 | * @description: loadComponent | 231 | * @description: loadComponent | ... | ... |
-
Please register or sign in to post a comment