123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <template>
- <van-nav-bar
- :title="$t('processApproval.name')"
- left-text=""
- left-arrow
- @click-left="onClickLeft"
- @click-right="onClickRight"
- >
- </van-nav-bar>
- <van-search
- v-model="req.keyword"
- :placeholder="$t('common.pleaseEnterKeywords')"
- @search="onRefresh"
- />
- <van-pull-refresh v-model="loading" @refresh="onRefresh">
- <div class="list">
- <van-list
- v-model:loading="loading"
- :finished="finished"
- :finished-text="$t('common.noMore')"
- @load="onLoad"
- style="margin-bottom: 60px"
- >
- <commonList
- :data="listData"
- @onClick="toDtl"
- :config="listConfig"
- ></commonList>
- </van-list>
- </div>
- </van-pull-refresh>
- </template>
- <script setup>
- import { ref, getCurrentInstance, onMounted } from 'vue'
- import commonList from '@/components/common-list.vue'
- import { useRoute } from 'vue-router'
- import { getUserInfo } from '@/utils/auth'
- const loading = ref(false)
- const route = useRoute()
- const req = ref({
- pageNum: 1,
- keyword: null,
- definition: '1',
- tenantId: getUserInfo().tenantId,
- })
- const finished = ref(false)
- const proxy = getCurrentInstance().proxy
- const listData = ref([])
- const listConfig = ref([
- {
- label: proxy.t('processApproval.processType'),
- prop: 'flowName',
- },
- {
- label: proxy.t('processApproval.initiator'),
- prop: 'createUserName',
- },
- {
- label: proxy.t('processApproval.processTitle'),
- prop: 'title',
- },
- ])
- const onRefresh = () => {
- req.value.pageNum = 1
- finished.value = false
- getList('refresh')
- }
- const onLoad = () => {
- getList()
- }
- const onClickLeft = () => proxy.$router.push('/main/working')
- const onClickRight = () => {
- proxy.$router.push({
- path: 'userAdd',
- query: {
- type: 'add',
- },
- })
- }
- proxy.uploadDdRightBtn(onClickRight, proxy.t('common.add'))
- const toDtl = (row) => {
- if (row.status != 1 && row.status != 0) {
- proxy.$router.push({
- path: '/main/processDtl',
- query: {
- flowKey: row.flowKey,
- id: row.id,
- processType: 20,
- version: row.version,
- },
- })
- return
- }
- proxy.post('flowExample/getApprovalRecord', { id: row.id }).then((res) => {
- if (res.data.recordList.length > 0) {
- let data = res.data.recordList.filter((item) => item.status === 2)
- let nodeType = 0
- if (data && data.length > 0) {
- nodeType = data[0].nodeType
- }
- proxy.$router.push({
- path: '/main/processDtl',
- query: {
- flowKey: row.flowKey,
- id: row.id,
- processType: nodeType == 1 ? 30 : 10,
- version: row.version,
- },
- })
- }
- })
- // proxy.$router.push({
- // path: 'processDtl',
- // query: {
- // flowKey: row.flowKey,
- // id: row.id,
- // processType: 10,
- // },
- // })
- }
- onMounted(() => {
- if (route.query) {
-
- getList()
- }
- })
- const getList = (type) => {
- loading.value = true
- const postUrl = {
- "1":'/flowExample/getToBeProcessedPage',
- "2":'/flowExample/getHaveInitiatedPage',
- "3":'/flowExample/getProcessedPage',
- }
- proxy
- .post(postUrl[route.query.status], req.value)
- .then((res) => {
- listData.value =
- type === 'refresh'
- ? res.data.rows
- : listData.value.concat(res.data.rows)
- if (req.value.pageNum * 10 >= res.data.total) {
- finished.value = true
- }
- req.value.pageNum++
- loading.value = false
- })
- .catch((err) => {
- loading.value = false
- })
- }
- </script>
- <style lang="scss" scoped>
- .list {
- min-height: 70vh;
- }
- </style>
|