personnel.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="page-body flex flex_column">
  3. <swiper class="scroll-list" :current="swiperCurrent">
  4. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
  5. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  6. <view style="height: 20rpx;" ></view>
  7. <view
  8. class="check-order-list"
  9. v-for="(item,index) in list"
  10. :key="item.id"
  11. >
  12. <view class="flex align_center justify_between">
  13. <view class="flex_1">
  14. <view class="u-name">
  15. <text style="margin-right: 0.5rem;">{{item.name}}</text>
  16. <u-icon :name="item.sex | sexFilter" size="28" :color="item.sex==1?'#00aaff':'#ffaaaa'" custom-prefix="custom-icon"></u-icon>
  17. </view>
  18. <view class="u-mobile">{{item.mobile}}</view>
  19. </view>
  20. <view @click="editPerson(item)">
  21. <u-icon size="34" name="edit-pen"></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. <view style="padding:0 30upx 30upx;">
  26. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  27. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  28. </view>
  29. </scroll-view>
  30. </swiper-item>
  31. </swiper>
  32. <view class="footer">
  33. <u-button @click="editPerson(null)" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
  34. 新增员工
  35. </u-button>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {searchEmployee, delEmployee } from '@/api/employee'
  41. import moment from 'moment'
  42. export default{
  43. name:'personnel',
  44. data(){
  45. return{
  46. status: 'loading',
  47. noDataText: '暂无数据',
  48. current: 0,
  49. swiperCurrent: 0,
  50. // 查询条件
  51. pageNo: 1,
  52. pageSize: 10,
  53. list: [],
  54. total: 0,
  55. }
  56. },
  57. onLoad() {
  58. this.getRow()
  59. },
  60. // 判断员工身份权限
  61. filters:{
  62. sexFilter(sexFilterVal){
  63. if(sexFilterVal == 1){
  64. return 'staff_icon_boy'
  65. }
  66. if(sexFilterVal == 0){
  67. return 'staff_icon_girl'
  68. }
  69. },
  70. isManagerFilter(isManagerFilterVal){
  71. if(isManagerFilterVal == 1){
  72. return '负责人'
  73. }
  74. }
  75. },
  76. methods:{
  77. // 查询列表
  78. getRow (pageNo) {
  79. let _this = this
  80. if (pageNo) {
  81. this.pageNo = pageNo
  82. }
  83. let params = {
  84. pageNo:this.pageNo,
  85. pageSize:this.pageSize
  86. }
  87. this.status = "loading"
  88. searchEmployee(params).then(res => {
  89. if (res.code == 200 || res.status == 204 || res.status == 200) {
  90. if(_this.pageNo>1){
  91. _this.list = _this.list.concat(res.data.list || [])
  92. }else{
  93. _this.list = res.data.list || []
  94. }
  95. _this.total = res.data.count || 0
  96. } else {
  97. _this.list = []
  98. _this.total = 0
  99. _this.noDataText = res.message
  100. }
  101. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  102. })
  103. },
  104. // scroll-view到底部加载更多
  105. onreachBottom() {
  106. console.log(this.list.length, this.total)
  107. if(this.list.length < this.total){
  108. this.pageNo += 1
  109. this.getRow()
  110. }else{
  111. this.status = "nomore"
  112. }
  113. },
  114. // 编辑员工
  115. editPerson(row){
  116. this.$store.state.vuex_nowStaffData = row;
  117. uni.navigateTo({
  118. url: "/pages/storeManage/addPerson"
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="less">
  125. .page-body{
  126. height: 100vh;
  127. padding:0;
  128. .scroll-list{
  129. flex-grow: 1;
  130. .check-order-list{
  131. background: #ffffff;
  132. padding: 10upx 20upx;
  133. margin: 0 25rpx 25rpx 25rpx;
  134. border-radius: 20upx;
  135. box-shadow: 1px 1px 3px #EEEEEE;
  136. > view{
  137. padding: 0.8rem 0.5rem;
  138. .u-name{
  139. font-size: 32rpx;
  140. margin-bottom: 0.5rem;
  141. }
  142. .u-mobile{
  143. color: #999;
  144. }
  145. }
  146. }
  147. }
  148. .footer{
  149. padding: 0.6rem;
  150. background: #ffffff;
  151. }
  152. }
  153. </style>