leaveorgz.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-gradual-pink" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">组织架构</block>
  6. </cu-custom>
  7. <xiaolu-tree :checkList="checkList" v-if="tree.length>0" :props="prop" @sendValue="confirm" :isCheck="true" :treeNone="tree"></xiaolu-tree>
  8. </view>
  9. </template>
  10. <script>
  11. import api from '@/api/api'
  12. import XiaoluTree from'@/components/xiaolu-tree/tree.vue'
  13. export default {
  14. components: {
  15. XiaoluTree
  16. },
  17. data() {
  18. return {
  19. data:[],
  20. userUrl:'/sys/user/departList',
  21. departName:'',
  22. orgName:'',
  23. tree: [],
  24. checkList: [],
  25. backList: this.checkList,
  26. prop:{
  27. label: 'name',
  28. children: 'children',
  29. multiple:true,
  30. },
  31. max: 5,
  32. }
  33. },
  34. created(){
  35. this.querydepartName()
  36. uni.setStorageSync("orgType",2);
  37. },
  38. onLoad(option) {
  39. let { prop,arr } = option
  40. // #ifdef H5
  41. let checkList = JSON.parse(decodeURIComponent(arr));
  42. // #endif
  43. // #ifdef MP-QQ||MP-WEIXIN||APP-NVUE||APP-PLUS
  44. let checkList = JSON.parse(arr);
  45. // #endif
  46. this.prop = JSON.parse(prop)
  47. this.checkList = checkList;
  48. //this.tree=treeNode;//树形数据赋值
  49. //this.querydepartName();
  50. },
  51. methods:{
  52. confirm(val,back) {
  53. if(back){
  54. this.backConfirm(val)
  55. return
  56. }
  57. this.backList = val;
  58. },
  59. // 返回上一页传参
  60. backConfirm(val) {
  61. uni.$emit('selectSuccess',{list:val})
  62. uni.navigateBack();
  63. },
  64. querydepartName(s){
  65. this.$http.get(this.userUrl,{params:{departName:s}}).then(res=>{
  66. console.log("res",res)
  67. this.tree=res.data.departName;
  68. //this.orgName=res.data.orgName;
  69. }).catch(err => {
  70. console.log(err);
  71. });
  72. },
  73. }
  74. }
  75. </script>
  76. <style>
  77. .ins{
  78. background-color: #F1F1F1;
  79. width: 90%;
  80. height: 30px;
  81. margin:0 auto;
  82. border-radius:5px 5px 5px 5px;
  83. margin-top: 20px;
  84. }
  85. .s{
  86. list-style-type:none;
  87. margin-left: -40px;
  88. }
  89. .imgs{
  90. width: 15px;
  91. height: 15px;
  92. float: right;
  93. }
  94. .top{
  95. background-color: #5677AC;
  96. width: 100%;
  97. height: 40px;
  98. }
  99. </style>