index.vue 2.3 KB

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