index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="msilde">
  3. <view class="search">
  4. <u-search placeholder="搜索科室" :disabled="true" bgColor="white" :showAction="false" @click="go('/pages/department/search')"></u-search>
  5. </view>
  6. <view class="left">
  7. <view :class="{ active: index == current }" v-for="(item, index) in list" :key="index" class="item" @click="current = index">{{ item.deptName }}</view>
  8. </view>
  9. <view class="right">
  10. <view class="list" v-if="list.length > 0">
  11. <view class="item" v-for="(item, index) in list[current].children" :key="item.deptId" @click="go('/pages/department/detail?id=' + item.deptId)">
  12. <view class="title omit">{{ item.deptName }}</view>
  13. <view class="icon">&#xe62b;</view>
  14. </view>
  15. </view>
  16. <u-empty v-else text="整理资料中..."></u-empty>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. title: '',
  25. current: 0,
  26. list: []
  27. };
  28. },
  29. onLoad(e) {
  30. this.getData();
  31. },
  32. methods: {
  33. getData() {
  34. this.http.request({
  35. url: '/app/department/list',
  36. success: (res) => {
  37. this.list = res.data.data;
  38. }
  39. });
  40. },
  41. go(url) {
  42. uni.navigateTo({ url: url });
  43. }
  44. }
  45. };
  46. </script>
  47. <style lang="scss"></style>