index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="搜索" @clickLeft="back">
  4. <!--右菜单-->
  5. <template slot="right">
  6. <u-button type="success" size="small" class="u-reset-button" @click="openTreePicker"
  7. text="选择分类"></u-button>
  8. </template>
  9. </uni-nav-bar>
  10. <view class="top-wrapper">
  11. <view class="searchBox rx-bc">
  12. <input v-model="keyWord" placeholder="请输入关键字搜索" class="searchInput" />
  13. <view>
  14. <u-button @click="getList" type="success" class="u-reset-button" text="搜索">
  15. </u-button>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="list_box">
  20. <u-list>
  21. <view v-for="(item,index) in list">
  22. <view>{{item}}</view>
  23. </view>
  24. </u-list>
  25. </view>
  26. <view class="bottom-wrapper rx-bc">
  27. <view>
  28. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  29. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  30. </checkbox>
  31. </view>
  32. <view>
  33. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen">
  34. <view class="selBtn"> 选择( {{ checkListLen }} ) </view>
  35. </u-button>
  36. </view>
  37. </view>
  38. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
  39. :localdata="classificationList" valueKey="id" textKey="name" childrenKey="children" />
  40. </view>
  41. </template>
  42. <script>
  43. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  44. import {
  45. treeByPid,
  46. pageeLedgerMain
  47. } from '@/api/pda/workOrder.js'
  48. export default {
  49. components: {
  50. baTreePicker
  51. },
  52. data() {
  53. return {
  54. keyWord: null,
  55. categoryLevelId: null,
  56. classificationList: [],
  57. treePickerShow: false,
  58. list: [],
  59. seletedAll: false, //全选状态
  60. checkListLen: 0,
  61. }
  62. },
  63. onLoad(option) {
  64. this.getTreeList()
  65. },
  66. methods: {
  67. _seletedAll() {
  68. this.seletedAll = !this.seletedAll
  69. },
  70. openTreePicker() {
  71. this.$refs.treePicker._show()
  72. },
  73. getTreeList() {
  74. let params = {
  75. ids: [1, 5, 7, 8, 10, 14, ]
  76. }
  77. treeByPid(params).then(res => {
  78. this.classificationList = res
  79. this.confirm([res[0].id], res[0].name)
  80. })
  81. },
  82. confirm(id, name) {
  83. this.categoryLevelId = id
  84. this.getList()
  85. },
  86. getList() {
  87. let param = {
  88. categoryLevelId: this.categoryLevelId,
  89. keyWord: this.keyWord,
  90. pageNum: 1,
  91. size: -1
  92. }
  93. pageeLedgerMain(param).then(res => {
  94. this.list = res.list
  95. })
  96. },
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .content-box {
  102. height: 100vh;
  103. overflow: hidden;
  104. display: flex;
  105. flex-direction: column;
  106. background-color: $page-bg;
  107. }
  108. .searchBox {
  109. background-color: #dedede;
  110. height: 100rpx;
  111. padding: 0 20rpx;
  112. input {
  113. height: 80rpx;
  114. width: 540rpx;
  115. background: #f9f9f9 !important;
  116. padding-left: 10rpx;
  117. border-radius: 5rpx;
  118. }
  119. }
  120. .list_box {
  121. flex: 1;
  122. overflow: hidden;
  123. padding: 6rpx 0;
  124. .u-list {
  125. height: 100% !important;
  126. }
  127. }
  128. .bottom-wrapper {
  129. height: 80rpx;
  130. background: #fff;
  131. padding: 0 32rpx;
  132. /deep/ .uni-checkbox-input-checked {
  133. background-color: $theme-color !important;
  134. border-color: $theme-color !important;
  135. }
  136. }
  137. </style>