index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <van-nav-bar
  3. :title="$t('processApproval.name')"
  4. left-text=""
  5. left-arrow
  6. @click-left="onClickLeft"
  7. @click-right="onClickRight"
  8. >
  9. </van-nav-bar>
  10. <van-search
  11. v-model="req.keyword"
  12. :placeholder="$t('common.pleaseEnterKeywords')"
  13. @search="onRefresh"
  14. />
  15. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  16. <div class="list">
  17. <van-list
  18. v-model:loading="loading"
  19. :finished="finished"
  20. :finished-text="$t('common.noMore')"
  21. @load="onLoad"
  22. style="margin-bottom: 60px"
  23. >
  24. <commonList
  25. :data="listData"
  26. @onClick="toDtl"
  27. :config="listConfig"
  28. ></commonList>
  29. </van-list>
  30. </div>
  31. </van-pull-refresh>
  32. </template>
  33. <script setup>
  34. import { ref, getCurrentInstance, onMounted } from 'vue'
  35. import commonList from '@/components/common-list.vue'
  36. import { useRoute } from 'vue-router'
  37. import { getUserInfo } from '@/utils/auth'
  38. const loading = ref(false)
  39. const route = useRoute()
  40. const req = ref({
  41. pageNum: 1,
  42. keyword: null,
  43. definition: '1',
  44. tenantId: getUserInfo().tenantId,
  45. })
  46. const finished = ref(false)
  47. const proxy = getCurrentInstance().proxy
  48. const listData = ref([])
  49. const listConfig = ref([
  50. {
  51. label: proxy.t('processApproval.processType'),
  52. prop: 'flowName',
  53. },
  54. {
  55. label: proxy.t('processApproval.initiator'),
  56. prop: 'createUserName',
  57. },
  58. {
  59. label: proxy.t('processApproval.processTitle'),
  60. prop: 'title',
  61. },
  62. ])
  63. const onRefresh = () => {
  64. req.value.pageNum = 1
  65. finished.value = false
  66. getList('refresh')
  67. }
  68. const onLoad = () => {
  69. getList()
  70. }
  71. const onClickLeft = () => proxy.$router.push('/main/working')
  72. const onClickRight = () => {
  73. proxy.$router.push({
  74. path: 'userAdd',
  75. query: {
  76. type: 'add',
  77. },
  78. })
  79. }
  80. proxy.uploadDdRightBtn(onClickRight, proxy.t('common.add'))
  81. const toDtl = (row) => {
  82. if (row.status != 1 && row.status != 0) {
  83. proxy.$router.push({
  84. path: '/main/processDtl',
  85. query: {
  86. flowKey: row.flowKey,
  87. id: row.id,
  88. processType: 20,
  89. version: row.version,
  90. },
  91. })
  92. return
  93. }
  94. proxy.post('flowExample/getApprovalRecord', { id: row.id }).then((res) => {
  95. if (res.data.recordList.length > 0) {
  96. let data = res.data.recordList.filter((item) => item.status === 2)
  97. let nodeType = 0
  98. if (data && data.length > 0) {
  99. nodeType = data[0].nodeType
  100. }
  101. proxy.$router.push({
  102. path: '/main/processDtl',
  103. query: {
  104. flowKey: row.flowKey,
  105. id: row.id,
  106. processType: nodeType == 1 ? 30 : 10,
  107. version: row.version,
  108. },
  109. })
  110. }
  111. })
  112. // proxy.$router.push({
  113. // path: 'processDtl',
  114. // query: {
  115. // flowKey: row.flowKey,
  116. // id: row.id,
  117. // processType: 10,
  118. // },
  119. // })
  120. }
  121. onMounted(() => {
  122. if (route.query) {
  123. getList()
  124. }
  125. })
  126. const getList = (type) => {
  127. loading.value = true
  128. const postUrl = {
  129. "1":'/flowExample/getToBeProcessedPage',
  130. "2":'/flowExample/getHaveInitiatedPage',
  131. "3":'/flowExample/getProcessedPage',
  132. }
  133. proxy
  134. .post(postUrl[route.query.status], req.value)
  135. .then((res) => {
  136. listData.value =
  137. type === 'refresh'
  138. ? res.data.rows
  139. : listData.value.concat(res.data.rows)
  140. if (req.value.pageNum * 10 >= res.data.total) {
  141. finished.value = true
  142. }
  143. req.value.pageNum++
  144. loading.value = false
  145. })
  146. .catch((err) => {
  147. loading.value = false
  148. })
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .list {
  153. min-height: 70vh;
  154. }
  155. </style>