list.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view v-if="!refreshPage" class="uni-app">
  3. <view class="status-bar" />
  4. <view class="main-container">
  5. <wk-nav-bar :title="title" />
  6. <view class="notice-tabs tabs-nav">
  7. <view
  8. :class="{padding: !routerQuery || routerQuery.by !== 'my'}"
  9. class="wk-tabs">
  10. <view
  11. v-for="(item, index) in tabsOptions"
  12. :key="item.label"
  13. :class="{active: activeTab === index}"
  14. class="wk-tab-item"
  15. @click="handleChangeTab(index)">
  16. {{ item.label }}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="list-view">
  21. <wk-scroll-view
  22. v-if="!refreshPage"
  23. :status="listStatus"
  24. class="list-scroll"
  25. @refresh="getListFn({}, true)"
  26. @loadmore="getListFn()">
  27. <examine-item
  28. v-for="(item, index) in listData"
  29. :key="index"
  30. :item="item" />
  31. </wk-scroll-view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {MyInitiate, WaitingQueryOaExamineList} from 'API/oa/examine'
  38. import ExamineItem from './components/examineItem'
  39. import mainListMixins from '@/mixins/mainList.js'
  40. export default {
  41. name: 'OaExamineList',
  42. components: {
  43. ExamineItem
  44. },
  45. mixins: [mainListMixins],
  46. data() {
  47. return {
  48. GetListFn: null,
  49. routerQuery: {},
  50. activeTab: 0,
  51. refreshPage: false
  52. }
  53. },
  54. computed: {
  55. title() {
  56. return this.routerQuery.by === 'my' ? '我发起的' : '我审批的'
  57. },
  58. showTabs() {
  59. return this.routerQuery.by === 'examine'
  60. },
  61. tabsOptions() {
  62. if (this.routerQuery.by === 'my') {
  63. return [
  64. { label: '全部', value: { status: '', categoryId: '' } },
  65. { label: '待审批', value: { status: '0', categoryId: '' } },
  66. { label: '审批通过', value: { status: '1', categoryId: '' } },
  67. { label: '审批拒绝', value: { status: '2', categoryId: '' } }
  68. ]
  69. } else {
  70. return [
  71. { label: '待我审批的', value: { status: 1, categoryId: '' } },
  72. { label: '我已审批的', value: { status: 2, categoryId: '' } }
  73. ]
  74. }
  75. }
  76. },
  77. onLoad(options) {
  78. this.routerQuery = options
  79. if (options.by === 'my' && !options.tab) {
  80. this.activeTab = 1
  81. }
  82. if (options.tab) {
  83. this.activeTab = Number(options.tab)
  84. }
  85. this.getListFn({}, true)
  86. },
  87. onShow() {
  88. if (this.refreshPage) {
  89. this.refreshPage = false
  90. this.getListFn({}, true)
  91. }
  92. },
  93. methods: {
  94. getListFn(params = {}, refresh = false) {
  95. this.GetListFn = this.routerQuery.by === 'my' ? MyInitiate : WaitingQueryOaExamineList
  96. this.getList(params, refresh)
  97. },
  98. getParams() {
  99. return this.tabsOptions[this.activeTab].value || {}
  100. },
  101. handleChangeTab(num) {
  102. if (this.activeTab !== num) {
  103. this.activeTab = num
  104. this.getListFn({}, true)
  105. }
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. .main-container {
  112. .notice-tabs {
  113. background-color: white;
  114. .wk-tabs {
  115. justify-content: space-between;
  116. border-bottom: 1rpx solid $border-color;
  117. &.padding {
  118. padding: 0 10%;
  119. }
  120. .wk-tab-item {
  121. font-size: 28rpx;
  122. }
  123. }
  124. }
  125. .list-view {
  126. width: 100%;
  127. flex: 1;
  128. padding: 20rpx 0;
  129. overflow: hidden;
  130. }
  131. }
  132. </style>