feat:优化 bpm 相关代码,重点处理 back 逻辑,search 表单
This commit is contained in:
@@ -1,52 +1,53 @@
|
||||
<template>
|
||||
<view class="bpm-list">
|
||||
<view
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
class="bpm-card"
|
||||
@click="handleDetail(item)"
|
||||
>
|
||||
<view class="bpm-card-content">
|
||||
<view class="bpm-card-header">
|
||||
<view class="bpm-card-title">
|
||||
{{ item.processInstance?.name }}
|
||||
</view>
|
||||
<dict-tag :type="DICT_TYPE.BPM_TASK_STATUS" :value="item.status" />
|
||||
</view>
|
||||
<view v-if="item.processInstance?.summary?.length" class="bpm-summary">
|
||||
<view v-for="(s, idx) in item.processInstance.summary" :key="idx" class="bpm-summary-item">
|
||||
<text class="text-[#999]">{{ s.key }}:</text>
|
||||
<text>{{ s.value }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bpm-card-info">
|
||||
<view class="bpm-user">
|
||||
<view class="bpm-avatar">
|
||||
{{ item.processInstance?.startUser?.nickname?.[0] || '?' }}
|
||||
</view>
|
||||
<text class="bpm-nickname">{{ item.processInstance?.startUser?.nickname }}</text>
|
||||
</view>
|
||||
<text class="bpm-time">{{ formatDateTime(item.createTime) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="bpm-empty">
|
||||
<wd-status-tip image="content" tip="暂无已办任务" />
|
||||
</view>
|
||||
<wd-loadmore
|
||||
v-if="list.length > 0"
|
||||
:state="loadMoreState"
|
||||
@reload="loadMore"
|
||||
/>
|
||||
|
||||
<!-- 搜索弹窗 -->
|
||||
<view>
|
||||
<!-- 搜索组件 -->
|
||||
<DoneSearchForm
|
||||
v-model="searchPopupVisible"
|
||||
:search-params="queryParams"
|
||||
@search="handleSearch"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<view class="bpm-list">
|
||||
<view
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
class="bpm-card"
|
||||
@click="handleDetail(item)"
|
||||
>
|
||||
<view class="bpm-card-content">
|
||||
<view class="bpm-card-header">
|
||||
<view class="bpm-card-title">
|
||||
{{ item.processInstance?.name }}
|
||||
</view>
|
||||
<dict-tag :type="DICT_TYPE.BPM_TASK_STATUS" :value="item.status" />
|
||||
</view>
|
||||
<view v-if="item.processInstance?.summary?.length" class="bpm-summary">
|
||||
<view v-for="(s, idx) in item.processInstance.summary" :key="idx" class="bpm-summary-item">
|
||||
<text class="text-[#999]">{{ s.key }}:</text>
|
||||
<text>{{ s.value }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bpm-card-info">
|
||||
<view class="bpm-user">
|
||||
<view class="bpm-avatar">
|
||||
{{ item.processInstance?.startUser?.nickname?.[0] || '?' }}
|
||||
</view>
|
||||
<text class="bpm-nickname">{{ item.processInstance?.startUser?.nickname }}</text>
|
||||
</view>
|
||||
<text class="bpm-time">{{ formatDateTime(item.createTime) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="bpm-empty">
|
||||
<wd-status-tip image="content" tip="暂无已办任务" />
|
||||
</view>
|
||||
<wd-loadmore
|
||||
v-if="list.length > 0"
|
||||
:state="loadMoreState"
|
||||
@reload="loadMore"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -63,17 +64,13 @@ import DoneSearchForm from './done-search-form.vue'
|
||||
import './index.scss'
|
||||
|
||||
const props = defineProps<{
|
||||
searchVisible?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:searchVisible': [value: boolean]
|
||||
active?: boolean
|
||||
}>()
|
||||
|
||||
const total = ref(0)
|
||||
const list = ref<Task[]>([])
|
||||
const loadMoreState = ref<LoadMoreState>('loading')
|
||||
const searchPopupVisible = ref(false)
|
||||
const isFirstLoad = ref(true)
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
@@ -132,16 +129,18 @@ onReachBottom(() => {
|
||||
loadMore()
|
||||
})
|
||||
|
||||
watch(() => props.searchVisible, (val) => {
|
||||
searchPopupVisible.value = val ?? false
|
||||
})
|
||||
|
||||
watch(searchPopupVisible, (val) => {
|
||||
emit('update:searchVisible', val)
|
||||
/** 监听激活状态,刷新数据 */
|
||||
watch(() => props.active, (val) => {
|
||||
if (val && !isFirstLoad.value) {
|
||||
queryParams.pageNo = 1
|
||||
list.value = []
|
||||
getList()
|
||||
}
|
||||
})
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
getList()
|
||||
isFirstLoad.value = false
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user