index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  22. <label class="listBox rx-bs">
  23. <view class="listBox-sel">
  24. <checkbox :value="item.code" color="#fff" :disabled="item.disabled"
  25. :checked="item.checked" />
  26. </view>
  27. <view class="listBox-con">
  28. <view class="listBox-top rx-bc">
  29. <view> {{ item.assetName }}</view>
  30. <view class="code">{{ item.assetCode}}</view>
  31. </view>
  32. <view class="listBox-bottom rx">
  33. <view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  34. class="items">
  35. {{ itm.label }}:{{ item[itm.prop] }}
  36. </view>
  37. </view>
  38. </view>
  39. </label>
  40. </checkbox-group>
  41. <u-empty v-if='list.length == 0' style='margin-top: 20vh;' iconSize='150' textSize='32' text='暂无数据'>
  42. </u-empty>
  43. </u-list>
  44. </view>
  45. <view class="bottom-wrapper rx-bc">
  46. <view>
  47. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  48. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  49. </checkbox>
  50. </view>
  51. <view>
  52. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen">
  53. <view class="selBtn"> 选择( {{ checkListLen }} ) </view>
  54. </u-button>
  55. </view>
  56. </view>
  57. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
  58. :localdata="classificationList" valueKey="id" textKey="name" childrenKey="children" />
  59. </view>
  60. </template>
  61. <script>
  62. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  63. import {
  64. tableHeader
  65. } from '../../common.js'
  66. import {
  67. treeByPid,
  68. pageeLedgerMain
  69. } from '@/api/pda/workOrder.js'
  70. export default {
  71. components: {
  72. baTreePicker
  73. },
  74. data() {
  75. return {
  76. keyWord: null,
  77. categoryLevelId: null,
  78. classificationList: [],
  79. treePickerShow: false,
  80. list: [],
  81. seletedAll: false, //全选状态
  82. checkListLen: 0,
  83. }
  84. },
  85. //选择的列表长度
  86. computed: {
  87. },
  88. onLoad(option) {
  89. this.getTreeList()
  90. },
  91. methods: {
  92. _seletedAll() {
  93. this.seletedAll = !this.seletedAll
  94. },
  95. openTreePicker() {
  96. this.$refs.treePicker._show()
  97. },
  98. tableH(type) {
  99. return tableHeader(type)
  100. },
  101. getTreeList() {
  102. let params = {
  103. ids: [1, 5, 7, 8, 10, 14, ]
  104. }
  105. treeByPid(params).then(res => {
  106. this.classificationList = res
  107. this.confirm([res[0].id], res[0].name)
  108. })
  109. },
  110. confirm(id, name) {
  111. this.categoryLevelId = id
  112. this.getList()
  113. },
  114. getList() {
  115. let param = {
  116. categoryLevelId: this.categoryLevelId,
  117. keyWord: this.keyWord,
  118. pageNum: 1,
  119. size: -1
  120. }
  121. this.list = []
  122. pageeLedgerMain(param).then(res => {
  123. this.list.push(
  124. ...res.list.map(i => {
  125. return {
  126. checked: false,
  127. ...i
  128. }
  129. })
  130. )
  131. })
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .content-box {
  138. height: 100vh;
  139. overflow: hidden;
  140. display: flex;
  141. flex-direction: column;
  142. background-color: $page-bg;
  143. }
  144. .searchBox {
  145. background-color: #dedede;
  146. height: 100rpx;
  147. padding: 0 20rpx;
  148. input {
  149. height: 80rpx;
  150. width: 540rpx;
  151. background: #f9f9f9 !important;
  152. padding-left: 10rpx;
  153. border-radius: 5rpx;
  154. }
  155. }
  156. .list_box {
  157. flex: 1;
  158. overflow: hidden;
  159. padding: 6rpx 0;
  160. .u-list {
  161. height: 100% !important;
  162. }
  163. }
  164. .bottom-wrapper {
  165. height: 80rpx;
  166. background: #fff;
  167. padding: 0 32rpx;
  168. /deep/ .uni-checkbox-input-checked {
  169. background-color: $theme-color !important;
  170. border-color: $theme-color !important;
  171. }
  172. }
  173. .listBox {
  174. padding: 4rpx 24rpx;
  175. background: #fff;
  176. /deep/ .uni-checkbox-input-checked {
  177. background-color: $theme-color !important;
  178. border-color: $theme-color !important;
  179. }
  180. .listBox-con {
  181. width: 650rpx;
  182. font-weight: 400;
  183. }
  184. .listBox-top {
  185. margin-top: 6rpx;
  186. color: #090A0A;
  187. font-size: 28rpx;
  188. font-style: normal;
  189. }
  190. .listBox-bottom {
  191. color: #090A0A;
  192. font-size: 24rpx;
  193. font-style: normal;
  194. flex-wrap: wrap;
  195. .items {
  196. width: 50%;
  197. margin-top: 6rpx;
  198. }
  199. }
  200. }
  201. </style>