Blogger Information
Blog 50
fans 0
comment 0
visits 31739
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
管理组与权限修改代码练习
手机用户1580651468
Original
550 people have browsed it

管理组与权限修改代码练习

一、实战管理组练习,直接上效果图




二、组权修改关键代码及展示

一)代码

1.vue的代码片段

  1. <el-form-item label="菜单权限">
  2. <div v-for="(item,index,key) in sate.menu" :key="index">
  3. <el-checkbox-group v-model="form.rights_s">
  4. <el-checkbox :label="item.mid" :checked="item.is_s" >{{ item.label }}</el-checkbox>
  5. <template v-for="(items,indexs,keys) in item.son" :key="indexs">
  6. <el-checkbox :label="items.mid" :checked="item.is_s">{{ items.label }}</el-checkbox>
  7. </template>
  8. </el-checkbox-group>
  1. const edit=(e)=>{
  2. form.group_id=e.group_id;
  3. form.group_name=e.group_name;
  4. form.status=e.status;
  5. form.rights_s=e.rights_s;
  6. // console.log(form.rights_s);
  7. // 数据进行循环
  8. if(form.rights_s){
  9. for(let i=0;sate.menu.length>i;i++){
  10. // console.log(sate.menu[i]);
  11. sate.menu[i].is_s=0;
  12. for(let z=0;form.rights_s.length>z;z++){
  13. if(sate.menu[i].mid==form.rights_s[z]){
  14. sate.menu[i].is_s=1;
  15. }
  16. }
  17. for(let y=0;sate.menu[i].son.length>y;y++){
  18. sate.menu[i].son[y].is_s=0;
  19. for(let zz=0;form.rights_s.length>zz;zz++){
  20. if(sate.menu[i].son[y].mid==form.rights_s[zz]){
  21. sate.menu[i].son[y].is_s=1;
  22. }
  23. }
  24. }
  25. }
  26. }
  27. else{
  28. for(let i=0;sate.menu.length>i;i++){
  29. sate.menu[i].is_s=0;
  30. for(let y=0;sate.menu[i].son.length>y;y++){
  31. sate.menu[i].son[y].is_s=0;
  32. }
  33. }
  34. }
  35. sate.is_show=true;
  36. sate.button_text='修改';
  37. }

2.实现的效果图



Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments