index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="car">
  3. <!-- 列表 -->
  4. <view class="carlists">
  5. <car-list :datainfo="list" :fwlxList="fwlxList" :wtdt="wtdt" type='feeset' @getDetail="getDetail" @getDelFn="getDelFn"></car-list>
  6. </view>
  7. <block v-if="checkPermi(['wuYe:feeSettings:add'])">
  8. <view style="height: 100rpx;"></view>
  9. <view class="rfbtn" @click="getFeeSetFn">添加设置</view>
  10. </block>
  11. <loading></loading>
  12. </view>
  13. </template>
  14. <script>
  15. import config from '@/config'
  16. const baseUrl = config.baseUrl
  17. import carList from "@/work/components/car/list.vue"
  18. import {getDictionaryFn} from "@/api/system/user.js"
  19. import {feesetList,feesetDel} from "@/api/work/manage.js"
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. export default{
  22. components:{carList},
  23. data(){
  24. return{
  25. list:[],
  26. pageSize: 10,
  27. pageNum: 1,
  28. reachflag: true,
  29. wtdt:'',
  30. fwlxList:[]
  31. }
  32. },
  33. onUnload() {
  34. uni.$off('refsetList')
  35. },
  36. onLoad: function() {
  37. uni.$on('refsetList',(res)=>{
  38. this.getrefreshData()
  39. })
  40. this.init()
  41. this.getDataFn()
  42. },
  43. // 上拉触底加载更多触发事件
  44. onReachBottom() {
  45. if (this.reachflag) {
  46. this.pageNum++
  47. this.getDataFn()
  48. }
  49. },
  50. methods:{
  51. checkPermi, checkRole,
  52. init(){
  53. // 房屋类型
  54. getDictionaryFn('house_type').then(res=>{
  55. if(res.code==200){
  56. this.fwlxList = res.data.map(v => {
  57. return {
  58. dictLabel: v.dictLabel,
  59. dictValue: v.dictValue
  60. }
  61. })
  62. }
  63. })
  64. },
  65. getDetail(id){
  66. this.$tab.navigateTo("/work/pages/fee/set?id="+id)
  67. },
  68. getFeeSetFn(){
  69. this.$tab.navigateTo("/work/pages/fee/set")
  70. },
  71. getAddFn(){
  72. },
  73. getrefreshData(){
  74. this.pageNum=1;
  75. this.list=[];
  76. this.reachflag=true;
  77. this.getDataFn()
  78. },
  79. getDelFn(data){
  80. var that=this;
  81. feesetDel(data).then(res=>{
  82. if(res.code==200){
  83. this.$toast("删除成功");
  84. setTimeout(function(){
  85. that.getrefreshData()
  86. },1500)
  87. }
  88. })
  89. },
  90. getDataFn(){
  91. var params={
  92. pageSize:this.pageSize,
  93. pageNum: this.pageNum,
  94. }
  95. feesetList(params).then(res=>{
  96. if(res.code==200){
  97. if (res.rows.length < this.pageSize) {
  98. this.reachflag = false
  99. this.wtdt = '到底了~';
  100. } else {
  101. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  102. if (num < res.total) {
  103. this.reachflag = true
  104. this.wtdt = ''
  105. } else {
  106. this.reachflag = false
  107. this.wtdt = '到底了~';
  108. }
  109. }
  110. var newArr=JSON.parse(JSON.stringify(res.rows))
  111. newArr.forEach(ite=>{
  112. ite.right=0;
  113. })
  114. if (this.pageNum == 1) {
  115. this.list = newArr;
  116. } else {
  117. this.list = this.list.concat(newArr)
  118. }
  119. }else{
  120. this.$toast(res.msg)
  121. }
  122. })
  123. },
  124. }
  125. }
  126. </script>
  127. <style>
  128. page{background: #F3F3F0;}
  129. </style>
  130. <style lang="scss" scoped>
  131. .car{padding: 24rpx 0 10rpx;}
  132. .carlists{padding: 0 18rpx;}
  133. </style>