vlist.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="car">
  3. <!-- tab栏 -->
  4. <view class="cartop">
  5. <view class="tabtop flexc">
  6. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  7. </view>
  8. </view>
  9. <!-- 列表 -->
  10. <view class="carlists">
  11. <box-list :datainfo="list" :sylist="sylist" :fkztList="fkztList" :wtdt="wtdt" type='visitor' @getDetail="getDetail" @getDelFn="getDelFn"></box-list>
  12. </view>
  13. <loading></loading>
  14. </view>
  15. </template>
  16. <script>
  17. import config from '@/config'
  18. const baseUrl = config.baseUrl
  19. import boxList from "@/work/components/box/list.vue"
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. import {reservList,reservDel} from "@/api/work/people.js"
  22. import {getDictionaryFn} from "@/api/system/user.js"
  23. import {houseInfolistNoPage} from "@/api/work/work.js"
  24. export default{
  25. components:{boxList},
  26. data(){
  27. return{
  28. // reset:require('@/work/static/car/reset.png'),
  29. // search:require('@/work/static/car/search.png'),
  30. // up:require('@/work/static/car/up.png'),
  31. cxrq:"",
  32. text:'',
  33. list:[],
  34. pageSize: 10,
  35. pageNum: 1,
  36. reachflag: true,
  37. wtdt:'',
  38. fkztList:[],
  39. sylist:[],
  40. tabval:"",
  41. tablist:[],
  42. userId:this.$store.state.user.userId,
  43. }
  44. },
  45. onLoad: function(e) {
  46. this.init()
  47. },
  48. // 上拉触底加载更多触发事件
  49. onReachBottom() {
  50. if (this.reachflag) {
  51. this.pageNum++
  52. this.getDataFn()
  53. }
  54. },
  55. methods:{
  56. checkPermi, checkRole,
  57. getDetail(id){
  58. this.$tab.navigateTo("/work/pages/visitor/vdetail?id="+id)
  59. },
  60. init(){
  61. // 访客状态
  62. getDictionaryFn('yuyetype').then(res=>{
  63. if(res.code==200){
  64. this.fkztList = res.data.map(v => {
  65. return {
  66. dictLabel: v.dictLabel,
  67. dictValue: v.dictValue
  68. }
  69. })
  70. }
  71. })
  72. // 来访事由
  73. getDictionaryFn('visit_reason').then(res=>{
  74. if(res.code==200){
  75. this.sylist = res.data.map(v => {
  76. return {
  77. dictLabel: v.dictLabel,
  78. dictValue: v.dictValue
  79. }
  80. })
  81. }
  82. })
  83. var params={
  84. userId:this.userId,
  85. pageSize: 100,
  86. pageNum: 1,
  87. }
  88. houseInfolistNoPage(params).then(res=>{
  89. if(res.code==200){
  90. if(res.rows&&res.rows.length){
  91. var data=res.rows[0];
  92. this.tabval=data.houseId;
  93. this.getDataFn()
  94. }
  95. this.tablist= res.rows.map(v => {
  96. return {
  97. tit: v.detailedAddress,
  98. val: v.houseId,
  99. }
  100. })
  101. }
  102. })
  103. },
  104. getConfirm(){
  105. this.getrefreshData()
  106. },
  107. getReset(){
  108. this.cxrq='';
  109. this.text='';
  110. this.getrefreshData()
  111. },
  112. getrefreshData(){
  113. this.pageNum=1;
  114. this.list=[];
  115. this.reachflag=true;
  116. this.getDataFn()
  117. },
  118. getTabFn(val){
  119. this.tabval=val;
  120. this.getrefreshData();
  121. },
  122. bindDateChangea(e){
  123. var val=e.detail.value;
  124. this.cxrq=val;
  125. },
  126. getDelFn(data){
  127. var that=this;
  128. reservDel(data).then(res=>{
  129. if(res.code==200){
  130. this.$toast("删除成功");
  131. setTimeout(function(){
  132. that.getrefreshData()
  133. },1500)
  134. }
  135. })
  136. },
  137. getDataFn(){
  138. var params={
  139. pageSize:this.pageSize,
  140. pageNum: this.pageNum,
  141. houseId:this.tabval
  142. }
  143. reservList(params).then(res=>{
  144. if(res.code==200){
  145. if (res.rows.length < this.pageSize) {
  146. this.reachflag = false
  147. this.wtdt = '到底了~';
  148. } else {
  149. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  150. if (num < res.total) {
  151. this.reachflag = true
  152. this.wtdt = ''
  153. } else {
  154. this.reachflag = false
  155. this.wtdt = '到底了~';
  156. }
  157. }
  158. var newArr=JSON.parse(JSON.stringify(res.rows))
  159. newArr.forEach(ite=>{
  160. ite.right=0;
  161. })
  162. if (this.pageNum == 1) {
  163. this.list = newArr;
  164. } else {
  165. this.list = this.list.concat(newArr)
  166. }
  167. }else{
  168. this.$toast(res.msg)
  169. }
  170. })
  171. },
  172. }
  173. }
  174. </script>
  175. <style>
  176. page{background: #F3F3F0;}
  177. </style>
  178. <style lang="scss" scoped>
  179. .car{padding: 146rpx 0 10rpx;}
  180. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  181. .topa{padding: 20rpx ;
  182. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  183. .chekt{min-width: 180rpx;
  184. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  185. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  186. }
  187. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  188. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  189. input{flex: 1;font-size: 26rpx;color: #272727;}
  190. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  191. font-size: 26rpx;
  192. color: #FFFFFF;}
  193. }
  194. }
  195. .tabtop{padding-bottom: 40rpx;padding-top: 26rpx;overflow: auto;
  196. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;flex: 0 0 auto;text-align: center;margin: 0 10rpx;padding: 0 20rpx;
  197. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  198. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  199. }
  200. }
  201. }
  202. }
  203. .carlists{padding: 0 18rpx;}
  204. </style>