Index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div id="relationshipTransfer">
  3. <van-sticky :offset-top="0">
  4. <van-nav-bar title="党支部" left-arrow @click-left="onClickLeft" />
  5. </van-sticky>
  6. <!-- <van-pull-refresh v-model="isLoading" @refresh="onRefresh"> -->
  7. <van-tree-select
  8. height="90vh"
  9. :items="partyList"
  10. :active-id.sync="activeId"
  11. :main-active-index.sync="activeIndex"
  12. />
  13. <!-- </van-pull-refresh> -->
  14. <!-- <div class="funcBtn">
  15. <van-button type="danger" @click="apply" round block>
  16. 申请转移
  17. </van-button>
  18. </div> -->
  19. </div>
  20. </template>
  21. <script>
  22. import {
  23. // PullRefresh as vanPullRefresh,
  24. NavBar as vanNavBar,
  25. // Button as vanButton,
  26. Sticky as vanSticky,
  27. TreeSelect as vanTreeSelect
  28. } from "vant";
  29. // import "vant/lib/pull-refresh/style";
  30. import "vant/lib/button/style";
  31. import "vant/lib/sticky/style";
  32. import "vant/lib/nav-bar/style";
  33. import "vant/lib/tree-select/style";
  34. import { list } from "@/api/party/party.js";
  35. import { toTree } from "@/utils/common.js";
  36. export default {
  37. name: "app",
  38. data: function() {
  39. return {
  40. isLoading: false,
  41. activeIndex: "",
  42. activeId: "",
  43. partyList: []
  44. };
  45. },
  46. methods: {
  47. onRefresh() {
  48. list().then(res => {
  49. let list = (res || []).map(v => {
  50. return {
  51. id: v.id,
  52. text: v.name,
  53. parentId: v.parentId,
  54. disabled: true
  55. };
  56. });
  57. this.partyList = toTree(list, {
  58. pidKey: "parentId",
  59. idKey: "id",
  60. disabled: true,
  61. rootId: "1"
  62. });
  63. this.isLoading = false;
  64. });
  65. },
  66. apply() {
  67. location.href = "./relationshipTransferFrom.html";
  68. },
  69. onClickLeft() {
  70. history.go(-1);
  71. }
  72. },
  73. mounted() {
  74. list().then(res => {
  75. let list = (res || []).map(v => {
  76. return {
  77. id: v.id,
  78. text: v.name,
  79. parentId: v.parentId
  80. };
  81. });
  82. this.partyList = toTree(list, {
  83. pidKey: "parentId",
  84. idKey: "id",
  85. disabled: true,
  86. rootId: "1"
  87. });
  88. console.log(this.partyList);
  89. });
  90. },
  91. beforeDestroy: function() {},
  92. components: { vanSticky, vanNavBar, vanTreeSelect }
  93. };
  94. </script>
  95. <style lang="scss">
  96. #relationshipTransfer {
  97. height: 100%;
  98. .funcBtn {
  99. position: fixed;
  100. width: 90%;
  101. left: 5%;
  102. bottom: 0.5em;
  103. }
  104. .van-tree-select {
  105. .van-sidebar {
  106. .van-sidebar-item--disabled {
  107. color: #323233;
  108. }
  109. }
  110. }
  111. .van-tree-select__item--disabled {
  112. color: #000;
  113. }
  114. }
  115. </style>