index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class='purchase-list'>
  3. <my-tabs @change="tapChange" :initIndex="initIndex"></my-tabs>
  4. <scroll-view class="purchase-body" scroll-y="true" @scrolltolower="scrolltolower" @scroll="scroll">
  5. <view v-if="initIndex === 0">
  6. <form-Create></form-Create>
  7. </view>
  8. <view v-if="initIndex === 1">
  9. <data-List v-for="(item,index) in listData" :key="index" :info="item"></data-List>
  10. <uni-fab :pattern="pattern" :horizontal="horizontal" :vertical="vertical"
  11. :direction="direction" @fabClick="fabClick" />
  12. </view>
  13. </scroll-view>
  14. </view>
  15. </template>
  16. <script>
  17. import { getTodoTaskPage, getDoneTaskPage,getMyProcessInstancePage } from "@/api/work/index"
  18. import myTabs from '../myTabs.vue'
  19. import dataList from '../dataList.vue'
  20. import formCreate from './formCreate.vue'
  21. import myPull from '@/static/js/myPull.js'
  22. export default {
  23. components:{myTabs,dataList,formCreate},
  24. data() {
  25. return {
  26. initIndex: 0,
  27. pageNo: 1,
  28. pageSize: 10,
  29. horizontal: 'right',
  30. vertical: 'bottom',
  31. direction: 'horizontal',
  32. pattern: {
  33. color: '#7A7E83',
  34. backgroundColor: '#fff',
  35. selectedColor: '#007AFF',
  36. buttonColor: '#007AFF',
  37. iconColor: '#fff'
  38. },
  39. }
  40. },
  41. onLoad(){
  42. this.refresh();
  43. },
  44. methods: {
  45. fabClick() {
  46. this.initIndex = 0;
  47. // uni.showToast({
  48. // title: '点击了悬浮按钮',
  49. // icon: 'none'
  50. // })
  51. },
  52. /**
  53. * @name 获取列表
  54. */
  55. getList(page,done){
  56. console.log(`获取第${page}页数据`);
  57. if(this.initIndex==1){
  58. getDoneTaskPage({pageNo:page,pageSize: this.pageSize}).then(response => {
  59. let dataList = response.data.list;
  60. let list = []
  61. dataList.forEach(v => {
  62. list.push({
  63. title:v.processInstance.name,
  64. status: v.name,
  65. time:v.createTime,
  66. nickname:v.processInstance.startUser.nickname
  67. })
  68. })
  69. done(list);
  70. });
  71. }
  72. },
  73. /**
  74. * @name 触底加载
  75. */
  76. scrolltolower(event){
  77. this.getList(this.page,this.__pulldone)
  78. },
  79. scroll(e){
  80. // 重新设置pulldown
  81. this.setPullDown(e.detail.scrollTop<10)
  82. },
  83. /**
  84. * @name 改变tab
  85. * @param val 索引
  86. */
  87. tapChange(val){
  88. this.initIndex=val;
  89. this.page = 1;
  90. this.getList(this.page,this.__pulldone)
  91. }
  92. },
  93. mixins:[myPull({})],
  94. }
  95. </script>
  96. <style lang='scss' scoped>
  97. .purchase-list {
  98. background-color: #f5f5f5;
  99. height: 100%;
  100. overflow: hidden;
  101. .purchase-body{
  102. height: calc(100% - 88upx);
  103. overflow: auto
  104. }
  105. }
  106. </style>