index - 副本.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="box">
  3. <loading></loading>
  4. </view>
  5. </template>
  6. <script>
  7. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  8. import {getDictionaryFn} from "@/api/mine/register.js"
  9. export default {
  10. components:{},
  11. data(){
  12. return{
  13. list:[],
  14. pageSize: 10,
  15. pageNum: 1,
  16. reachflag: true,
  17. wtdt:'',
  18. }
  19. },
  20. onShow() {
  21. },
  22. onUnload() {
  23. uni.$off('refreshInfoAll')
  24. },
  25. onLoad: function() {
  26. uni.$on('refreshInfoAll',(res)=>{
  27. this.getrefreshData()
  28. })
  29. // this.init();
  30. // this.getDataFn()
  31. },
  32. // 上拉触底加载更多触发事件
  33. onReachBottom() {
  34. if (this.reachflag) {
  35. this.pageNum++
  36. this.getDataFn()
  37. }
  38. },
  39. methods:{
  40. checkPermi,checkRole,
  41. init(){
  42. //工单类型
  43. getDictionaryFn('work_order_type').then(res => {
  44. if (res.code == 200) {
  45. this.gdList = res.data.map(v => {
  46. return {
  47. dictLabel: v.dictLabel,
  48. dictValue: v.dictValue
  49. }
  50. })
  51. }
  52. })
  53. },
  54. getTab(val){
  55. this.tabval=val;
  56. this.getrefreshData()
  57. },
  58. getrefreshData(){
  59. this.pageNum=1;
  60. this.list=[];
  61. this.reachflag=true;
  62. this.getDataFn()
  63. },
  64. getDetail(e){
  65. this.$tab.navigateTo(`/work/pages/detail?id=${e}`)
  66. },
  67. getDataFn(){
  68. var params={
  69. pageSize:this.pageSize,
  70. pageNum: this.pageNum,
  71. }
  72. getworkInfoList(params).then(res=>{
  73. if(res.code==200){
  74. if (res.rows.length < this.pageSize) {
  75. this.reachflag = false
  76. this.wtdt = '到底了~';
  77. } else {
  78. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  79. if (num < res.total) {
  80. this.reachflag = true
  81. this.wtdt = ''
  82. } else {
  83. this.reachflag = false
  84. this.wtdt = '到底了~';
  85. }
  86. }
  87. if (this.pageNum == 1) {
  88. this.list = res.rows;
  89. } else {
  90. this.list = this.list.concat(res.rows)
  91. }
  92. }else{
  93. this.$toast(res.msg)
  94. }
  95. })
  96. },
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. </style>