zlwu 1 år sedan
förälder
incheckning
5a482ae823

+ 2 - 1
mobile/src/common/request.js

@@ -114,7 +114,8 @@ export const request = (options) => {
             timeout: options.timeout || REQUEST_CONFIG.timeout,
             responseType: options.responseType || 'text', // 支持responseType参数
             header: {
-                'Content-Type': 'application/json',
+                // 吴自龙 注释 get方法,后台不接受json 20250811
+                // 'Content-Type': 'application/json',
                 authorization: token,
                 clientid: options.clientId || REQUEST_CONFIG.clientId,
                 // 注意:在H5环境中,浏览器会自动设置referer,手动设置会报错

+ 706 - 0
mobile/src/pages/bak/taskFinish-bak.vue

@@ -0,0 +1,706 @@
+<template>
+    <view class="task-finish-container">
+        <!-- 头部标题和操作 -->
+        <view class="header">
+            <text class="title">我的已办</text>
+            <view class="header-actions">
+                <u-icon name="search" size="20" color="#666" @click="toggleSearch"></u-icon>
+                <u-icon
+                    name="account"
+                    size="20"
+                    color="#666"
+                    style="margin-left: 16px"
+                    @click="openUserSelect"
+                ></u-icon>
+            </view>
+        </view>
+
+        <!-- 搜索栏 -->
+        <view v-if="showSearch" class="search-section">
+            <view class="search-input">
+                <u-input
+                    v-model="queryParams.nodeName"
+                    placeholder="请输入任务名称"
+                    border="bottom"
+                    clearable
+                    @confirm="handleQuery"
+                ></u-input>
+            </view>
+            <view class="search-input">
+                <u-input
+                    v-model="queryParams.flowName"
+                    placeholder="请输入流程定义名称"
+                    border="bottom"
+                    clearable
+                    @confirm="handleQuery"
+                ></u-input>
+            </view>
+            <view class="search-input">
+                <u-input
+                    v-model="queryParams.flowCode"
+                    placeholder="请输入流程定义编码"
+                    border="bottom"
+                    clearable
+                    @confirm="handleQuery"
+                ></u-input>
+            </view>
+            <view class="search-actions">
+                <u-button type="primary" size="small" @click="handleQuery">搜索</u-button>
+                <u-button size="small" @click="resetQuery">重置</u-button>
+            </view>
+        </view>
+
+        <!-- 申请人筛选显示 -->
+        <view v-if="userSelectCount > 0" class="user-filter-section">
+            <view class="filter-info">
+                <text class="filter-text">已选择 {{ userSelectCount }} 位申请人</text>
+                <u-button type="error" size="mini" @click="clearUserFilter">清除</u-button>
+            </view>
+        </view>
+
+        <!-- 内容区域 -->
+        <view class="content">
+            <!-- 加载状态 -->
+            <view v-if="loading" class="loading">
+                <u-loading-icon></u-loading-icon>
+                <text class="loading-text">加载中...</text>
+            </view>
+
+            <!-- 空数据 -->
+            <view v-else-if="taskList.length === 0" class="empty">
+                <view class="empty-content">
+                    <u-icon name="file-text" size="80" color="#ddd"></u-icon>
+                    <text class="empty-text">暂无数据</text>
+                </view>
+            </view>
+
+            <!-- 任务列表 -->
+            <view v-else class="task-list">
+                <view
+                    v-for="item in taskList"
+                    :key="item.id"
+                    class="task-item"
+                    @click="handleView(item)"
+                >
+                    <!-- 任务信息 -->
+                    <view class="task-header">
+                        <view class="task-title-row">
+                            <text class="task-name">{{ item.flowName }}</text>
+                            <view
+                                class="task-status"
+                                :style="{
+                                    backgroundColor: getStatusStyle(item.flowStatus).color,
+                                    color: 'white',
+                                }"
+                            >
+                                <text class="status-text">
+                                    {{ getStatusText(item.flowStatus) }}
+                                </text>
+                            </view>
+                        </view>
+                        <view class="task-info">
+                            <text class="task-code">{{ item.flowCode }}</text>
+                            <text class="task-category">{{ item.categoryName }}</text>
+                        </view>
+                        <text class="task-version">版本:v{{ item.version }}.0</text>
+                        <text class="task-node-name">任务:{{ item.nodeName }}</text>
+                        <text class="task-applicant">申请人:{{ item.createByName }}</text>
+
+                        <!-- 办理人信息 -->
+                        <view class="assignee-info">
+                            <text class="assignee-label">办理人:</text>
+                            <text class="assignee-name">{{ item.approveName || '无' }}</text>
+                        </view>
+
+                        <!-- 任务状态 -->
+                        <view class="task-status-info">
+                            <text class="task-status-label">任务状态:</text>
+                            <view
+                                class="task-status-tag"
+                                :style="{
+                                    backgroundColor: getTaskStatusStyle(item.flowTaskStatus).color,
+                                    color: 'white',
+                                }"
+                            >
+                                <text class="task-status-value">
+                                    {{ getTaskStatusText(item.flowTaskStatus) }}
+                                </text>
+                            </view>
+                        </view>
+
+                        <text class="task-time">{{ formatTime(item.createTime) }}</text>
+                    </view>
+
+                    <!-- 操作按钮 -->
+                    <view class="task-actions" @click.stop>
+                        <u-button type="info" size="mini" @click="handleView(item)">查看</u-button>
+                    </view>
+                </view>
+            </view>
+
+            <!-- 分页加载 -->
+            <view v-if="taskList.length > 0" class="pagination">
+                <u-loadmore v-if="hasMore" status="loading" @loadmore="loadMore">
+                    <text>正在加载更多...</text>
+                </u-loadmore>
+                <view v-else class="load-end">
+                    <text>已加载全部数据</text>
+                </view>
+            </view>
+        </view>
+
+        <!-- 申请人选择弹窗 -->
+        <u-popup v-model="showUserSelector" mode="center" width="80%" border-radius="12">
+            <view class="user-selector-popup">
+                <view class="popup-header">
+                    <text class="popup-title">选择申请人</text>
+                    <u-icon name="close" size="20" color="#666" @click="closeUserSelect"></u-icon>
+                </view>
+                <view class="popup-content">
+                    <text class="popup-tip">请输入申请人姓名或工号</text>
+                    <view class="search-user">
+                        <u-input
+                            v-model="userSearchKeyword"
+                            placeholder="搜索申请人"
+                            clearable
+                        ></u-input>
+                        <u-button
+                            type="primary"
+                            size="small"
+                            @click="searchUsers"
+                            style="margin-top: 12px"
+                        >
+                            搜索
+                        </u-button>
+                    </view>
+                    <view v-if="searchUsers.length > 0" class="user-results">
+                        <view
+                            v-for="user in searchUsers"
+                            :key="user.userId"
+                            class="user-item"
+                            :class="{ selected: selectedUserIds.includes(user.userId) }"
+                            @click="toggleUserSelect(user)"
+                        >
+                            <text class="user-name">{{ user.userName }}</text>
+                            <text class="user-dept">{{ user.deptName }}</text>
+                        </view>
+                    </view>
+                </view>
+                <view class="popup-actions">
+                    <u-button @click="closeUserSelect">取消</u-button>
+                    <u-button type="primary" @click="confirmUserSelect">确定</u-button>
+                </view>
+            </view>
+        </u-popup>
+    </view>
+</template>
+
+<script>
+import { workflowApi, getStatusStyle, formatTime, routerJump } from '@/common/workflow-api.js';
+
+export default {
+    data() {
+        return {
+            loading: false,
+            showSearch: false,
+            showUserSelector: false,
+            taskList: [],
+            total: 0,
+            hasMore: true,
+            // 用户筛选相关
+            userSelectCount: 0,
+            selectedUserIds: [],
+            userSearchKeyword: '',
+            searchUsers: [],
+            queryParams: {
+                pageNum: 1,
+                pageSize: 10,
+                nodeName: '',
+                flowName: '',
+                flowCode: '',
+                createByIds: [],
+            },
+        };
+    },
+    onLoad() {
+        this.getFinishList();
+    },
+    onReachBottom() {
+        if (this.hasMore && !this.loading) {
+            this.loadMore();
+        }
+    },
+    onPullDownRefresh() {
+        this.refreshData();
+    },
+    methods: {
+        async getFinishList() {
+            if (this.loading) return;
+
+            this.loading = true;
+            try {
+                const res = await workflowApi.pageByTaskFinish(this.queryParams);
+                if (res.code === 200) {
+                    if (this.queryParams.pageNum === 1) {
+                        this.taskList = res.rows || [];
+                    } else {
+                        this.taskList.push(...(res.rows || []));
+                    }
+                    this.total = res.total;
+                    this.hasMore = this.taskList.length < this.total;
+                } else {
+                    uni.showToast({ title: res.msg || '加载失败', icon: 'error' });
+                }
+            } catch (e) {
+                console.error('加载已办任务失败:', e);
+                uni.showToast({ title: '网络错误', icon: 'error' });
+            } finally {
+                this.loading = false;
+                uni.stopPullDownRefresh();
+            }
+        },
+
+        async loadMore() {
+            if (!this.hasMore || this.loading) return;
+
+            this.queryParams.pageNum++;
+            await this.getFinishList();
+        },
+
+        async refreshData() {
+            this.queryParams.pageNum = 1;
+            this.hasMore = true;
+            await this.getFinishList();
+        },
+
+        toggleSearch() {
+            this.showSearch = !this.showSearch;
+        },
+
+        handleQuery() {
+            this.queryParams.pageNum = 1;
+            this.hasMore = true;
+            this.refreshData();
+        },
+
+        resetQuery() {
+            this.queryParams = {
+                pageNum: 1,
+                pageSize: 10,
+                nodeName: '',
+                flowName: '',
+                flowCode: '',
+                createByIds: [],
+            };
+            this.userSelectCount = 0;
+            this.selectedUserIds = [];
+            this.hasMore = true;
+            this.refreshData();
+        },
+
+        handleView(item) {
+            this.routerJump({
+                businessId: item.businessId,
+                taskId: item.id,
+                type: 'view',
+                formCustom: item.formCustom,
+                formPath: item.formPath,
+            });
+        },
+
+        // 用户选择相关方法
+        openUserSelect() {
+            this.showUserSelector = true;
+        },
+
+        closeUserSelect() {
+            this.showUserSelector = false;
+            this.userSearchKeyword = '';
+            this.searchUsers = [];
+        },
+
+        async searchUsers() {
+            if (!this.userSearchKeyword.trim()) {
+                uni.showToast({ title: '请输入搜索关键词', icon: 'none' });
+                return;
+            }
+
+            // 这里应该调用用户搜索API,暂时模拟数据
+            this.searchUsers = [
+                { userId: '1', userName: '张三', deptName: '技术部' },
+                { userId: '2', userName: '李四', deptName: '财务部' },
+                { userId: '3', userName: '王五', deptName: '人事部' },
+            ];
+        },
+
+        toggleUserSelect(user) {
+            const index = this.selectedUserIds.findIndex((id) => id === user.userId);
+            if (index > -1) {
+                this.selectedUserIds.splice(index, 1);
+            } else {
+                this.selectedUserIds.push(user.userId);
+            }
+        },
+
+        confirmUserSelect() {
+            this.userSelectCount = this.selectedUserIds.length;
+            this.queryParams.createByIds = [...this.selectedUserIds];
+            this.closeUserSelect();
+            this.handleQuery();
+        },
+
+        clearUserFilter() {
+            this.userSelectCount = 0;
+            this.selectedUserIds = [];
+            this.queryParams.createByIds = [];
+            this.handleQuery();
+        },
+
+        getStatusText(status) {
+            const statusMap = {
+                draft: '草稿',
+                waiting: '待审批',
+                complete: '已完成',
+                cancel: '已取消',
+                back: '已退回',
+                suspend: '挂起',
+                terminate: '终止',
+            };
+            return statusMap[status] || '未知';
+        },
+
+        getTaskStatusText(status) {
+            const statusMap = {
+                agree: '同意',
+                reject: '驳回',
+                back: '退回',
+                delegate: '委托',
+                suspend: '挂起',
+                terminate: '终止',
+            };
+            return statusMap[status] || '未知';
+        },
+
+        getTaskStatusStyle(status) {
+            const styleMap = {
+                agree: { color: '#67c23a' },
+                reject: { color: '#f56c6c' },
+                back: { color: '#409eff' },
+                delegate: { color: '#e6a23c' },
+                suspend: { color: '#909399' },
+                terminate: { color: '#f56c6c' },
+            };
+            return styleMap[status] || { color: '#909399' };
+        },
+
+        getStatusStyle(status) {
+            return getStatusStyle(status);
+        },
+
+        formatTime(timeStr) {
+            return formatTime(timeStr);
+        },
+
+        routerJump(params) {
+            routerJump(params);
+        },
+    },
+};
+</script>
+
+<style scoped>
+.task-finish-container {
+    background: #f5f5f5;
+    min-height: 100vh;
+    padding-bottom: 20px;
+}
+
+.header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 16px 20px;
+    background: #fff;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
+}
+
+.title {
+    font-size: 20px;
+    font-weight: bold;
+    color: #333;
+}
+
+.header-actions {
+    display: flex;
+    align-items: center;
+}
+
+.search-section {
+    background: #fff;
+    padding: 16px 20px;
+    border-bottom: 1px solid #eee;
+}
+
+.search-input {
+    margin-bottom: 12px;
+}
+
+.search-actions {
+    display: flex;
+    gap: 12px;
+}
+
+.user-filter-section {
+    background: #fff;
+    padding: 12px 20px;
+    border-bottom: 1px solid #eee;
+}
+
+.filter-info {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.filter-text {
+    color: #007aff;
+    font-size: 14px;
+}
+
+.content {
+    flex: 1;
+}
+
+.loading {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    padding: 40px;
+}
+
+.loading-text {
+    margin-top: 8px;
+    color: #999;
+    font-size: 14px;
+}
+
+.empty {
+    padding: 40px 20px;
+}
+
+.empty-content {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+}
+
+.empty-text {
+    font-size: 14px;
+    color: #999;
+    margin-top: 12px;
+}
+
+.task-list {
+    padding: 16px 20px;
+}
+
+.task-item {
+    background: #fff;
+    border-radius: 12px;
+    padding: 16px;
+    margin-bottom: 12px;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
+    transition: box-shadow 0.2s;
+}
+
+.task-item:active {
+    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
+}
+
+.task-header {
+    margin-bottom: 12px;
+}
+
+.task-title-row {
+    display: flex;
+    justify-content: space-between;
+    align-items: flex-start;
+    margin-bottom: 8px;
+}
+
+.task-name {
+    font-size: 16px;
+    font-weight: 500;
+    color: #333;
+    flex: 1;
+    margin-right: 12px;
+}
+
+.task-status {
+    padding: 4px 8px;
+    border-radius: 12px;
+    font-size: 12px;
+    font-weight: 500;
+    white-space: nowrap;
+}
+
+.task-info {
+    display: flex;
+    justify-content: space-between;
+    margin-bottom: 6px;
+}
+
+.task-code {
+    font-size: 13px;
+    color: #666;
+}
+
+.task-category {
+    font-size: 13px;
+    color: #666;
+}
+
+.task-version,
+.task-node-name,
+.task-applicant {
+    font-size: 13px;
+    color: #666;
+    margin-bottom: 4px;
+}
+
+.assignee-info {
+    display: flex;
+    align-items: center;
+    margin-bottom: 4px;
+}
+
+.assignee-label {
+    font-size: 13px;
+    color: #666;
+    margin-right: 4px;
+}
+
+.assignee-name {
+    font-size: 13px;
+    color: #333;
+    font-weight: 500;
+}
+
+.task-status-info {
+    display: flex;
+    align-items: center;
+    margin-bottom: 4px;
+}
+
+.task-status-label {
+    font-size: 13px;
+    color: #666;
+    margin-right: 4px;
+}
+
+.task-status-tag {
+    padding: 2px 6px;
+    border-radius: 8px;
+    font-size: 12px;
+    font-weight: 500;
+}
+
+.task-time {
+    font-size: 12px;
+    color: #999;
+}
+
+.task-actions {
+    border-top: 1px solid #f0f0f0;
+    padding-top: 12px;
+}
+
+.pagination {
+    padding: 16px 20px;
+}
+
+.load-end {
+    text-align: center;
+    padding: 16px;
+}
+
+.load-end text {
+    font-size: 14px;
+    color: #999;
+}
+
+/* 弹窗样式 */
+.user-selector-popup {
+    padding: 20px;
+}
+
+.popup-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 16px;
+    padding-bottom: 12px;
+    border-bottom: 1px solid #eee;
+}
+
+.popup-title {
+    font-size: 18px;
+    font-weight: 500;
+    color: #333;
+}
+
+.popup-content {
+    margin-bottom: 16px;
+}
+
+.popup-tip {
+    font-size: 14px;
+    color: #666;
+    margin-bottom: 12px;
+}
+
+.search-user {
+    margin-bottom: 16px;
+}
+
+.user-results {
+    max-height: 200px;
+    overflow-y: auto;
+}
+
+.user-item {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 12px;
+    border: 1px solid #e6e6e6;
+    border-radius: 8px;
+    margin-bottom: 8px;
+    transition: all 0.2s;
+}
+
+.user-item.selected {
+    border-color: #007aff;
+    background: #f0f8ff;
+}
+
+.user-name {
+    font-size: 14px;
+    font-weight: 500;
+    color: #333;
+}
+
+.user-dept {
+    font-size: 12px;
+    color: #666;
+}
+
+.popup-actions {
+    display: flex;
+    justify-content: space-between;
+    gap: 12px;
+    padding-top: 12px;
+    border-top: 1px solid #eee;
+}
+</style>

+ 829 - 492
mobile/src/pages/task/taskFinish.vue

@@ -1,194 +1,218 @@
 <template>
     <view class="task-finish-container">
-        <!-- 头部标题和操作 -->
-        <view class="header">
-            <text class="title">我的已办</text>
-            <view class="header-actions">
-                <u-icon name="search" size="20" color="#666" @click="toggleSearch"></u-icon>
-                <u-icon
-                    name="account"
-                    size="20"
-                    color="#666"
-                    style="margin-left: 16px"
-                    @click="openUserSelect"
-                ></u-icon>
+        <!-- 顶部导航 -->
+        <u-navbar title="我的已办" :border-bottom="false" bg-color="#3c9cff" title-color="#fff">
+            <view slot="left" @click="goBack">
+                <u-icon name="arrow-left" color="#fff" size="22"></u-icon>
             </view>
-        </view>
-
-        <!-- 搜索栏 -->
-        <view v-if="showSearch" class="search-section">
-            <view class="search-input">
-                <u-input
-                    v-model="queryParams.nodeName"
-                    placeholder="请输入任务名称"
-                    border="bottom"
-                    clearable
-                    @confirm="handleQuery"
-                ></u-input>
-            </view>
-            <view class="search-input">
-                <u-input
-                    v-model="queryParams.flowName"
-                    placeholder="请输入流程定义名称"
-                    border="bottom"
-                    clearable
-                    @confirm="handleQuery"
-                ></u-input>
-            </view>
-            <view class="search-input">
-                <u-input
-                    v-model="queryParams.flowCode"
-                    placeholder="请输入流程定义编码"
-                    border="bottom"
-                    clearable
-                    @confirm="handleQuery"
-                ></u-input>
-            </view>
-            <view class="search-actions">
-                <u-button type="primary" size="small" @click="handleQuery">搜索</u-button>
-                <u-button size="small" @click="resetQuery">重置</u-button>
-            </view>
-        </view>
-
-        <!-- 申请人筛选显示 -->
-        <view v-if="userSelectCount > 0" class="user-filter-section">
-            <view class="filter-info">
-                <text class="filter-text">已选择 {{ userSelectCount }} 位申请人</text>
-                <u-button type="error" size="mini" @click="clearUserFilter">清除</u-button>
+        </u-navbar>
+
+        <!-- 搜索区域 -->
+        <view class="search-container">
+            <u-search
+                v-model="queryParams.flowName"
+                placeholder="请输入流程定义名称"
+                :show-action="true"
+                action-text="搜索"
+                :animation="true"
+                @search="handleQuery"
+                @custom="handleQuery"
+            ></u-search>
+
+            <!-- 申请人选择 -->
+            <view class="filter-section">
+                <view class="filter-item" @click="openUserSelect">
+                    <u-icon name="account" size="20" color="#3c9cff"></u-icon>
+                    <text class="filter-text">
+                        {{
+                            selectedUsers.length > 0
+                                ? `已选择${selectedUsers.length}个申请人`
+                                : '选择申请人'
+                        }}
+                    </text>
+                    <u-badge
+                        v-if="selectedUsers.length > 0"
+                        :count="selectedUsers.length"
+                        :max="99"
+                    ></u-badge>
+                    <u-icon name="arrow-right" size="16" color="#c0c4cc"></u-icon>
+                </view>
             </view>
         </view>
 
-        <!-- 内容区域 -->
-        <view class="content">
-            <!-- 加载状态 -->
-            <view v-if="loading" class="loading">
-                <u-loading-icon></u-loading-icon>
-                <text class="loading-text">加载中...</text>
+        <!-- 加载状态 -->
+        <u-loading-page
+            :loading="loading && taskList.length === 0"
+            loading-text="加载中..."
+        ></u-loading-page>
+
+        <!-- 已办任务列表 -->
+        <view v-if="!loading || taskList.length > 0" class="content-wrapper">
+            <!-- 空状态 -->
+            <view v-if="taskList.length === 0 && !loading" class="empty-container">
+                <u-empty text="暂无已办任务" mode="data"></u-empty>
             </view>
 
-            <!-- 空数据 -->
-            <view v-else-if="taskList.length === 0" class="empty">
-                <view class="empty-content">
-                    <u-icon name="file-text" size="80" color="#ddd"></u-icon>
-                    <text class="empty-text">暂无数据</text>
-                </view>
-            </view>
-
-            <!-- 任务列表 -->
-            <view v-else class="task-list">
-                <view
-                    v-for="item in taskList"
-                    :key="item.id"
-                    class="task-item"
-                    @click="handleView(item)"
-                >
-                    <!-- 任务信息 -->
-                    <view class="task-header">
-                        <view class="task-title-row">
-                            <text class="task-name">{{ item.flowName }}</text>
-                            <view
-                                class="task-status"
-                                :style="{
-                                    backgroundColor: getStatusStyle(item.flowStatus).color,
-                                    color: 'white',
-                                }"
-                            >
-                                <text class="status-text">
-                                    {{ getStatusText(item.flowStatus) }}
-                                </text>
+            <!-- 任务卡片列表 - 滚动容器 -->
+            <scroll-view
+                v-else
+                scroll-y
+                class="task-scroll-view"
+                @scrolltolower="loadMoreTasks"
+                :lower-threshold="50"
+                :refresher-enabled="true"
+                :refresher-triggered="refreshing"
+                @refresherrefresh="onRefresh"
+                @refresherrestore="onRestore"
+            >
+                <view class="task-list">
+                    <view
+                        v-for="(item, index) in taskList"
+                        :key="item.id || index"
+                        class="task-card"
+                    >
+                        <!-- 卡片头部 -->
+                        <view class="card-header">
+                            <view class="task-title">{{ item.flowName || '-' }}</view>
+                            <view class="task-status">
+                                <u-tag
+                                    :text="getFlowStatusText(item.flowStatus)"
+                                    :type="getFlowStatusType(item.flowStatus)"
+                                    size="mini"
+                                ></u-tag>
                             </view>
                         </view>
-                        <view class="task-info">
-                            <text class="task-code">{{ item.flowCode }}</text>
-                            <text class="task-category">{{ item.categoryName }}</text>
-                        </view>
-                        <text class="task-version">版本:v{{ item.version }}.0</text>
-                        <text class="task-node-name">任务:{{ item.nodeName }}</text>
-                        <text class="task-applicant">申请人:{{ item.createByName }}</text>
-
-                        <!-- 办理人信息 -->
-                        <view class="assignee-info">
-                            <text class="assignee-label">办理人:</text>
-                            <text class="assignee-name">{{ item.approveName || '无' }}</text>
-                        </view>
 
-                        <!-- 任务状态 -->
-                        <view class="task-status-info">
-                            <text class="task-status-label">任务状态:</text>
-                            <view
-                                class="task-status-tag"
-                                :style="{
-                                    backgroundColor: getTaskStatusStyle(item.flowTaskStatus).color,
-                                    color: 'white',
-                                }"
-                            >
-                                <text class="task-status-value">
-                                    {{ getTaskStatusText(item.flowTaskStatus) }}
-                                </text>
+                        <!-- 卡片内容 -->
+                        <view class="card-content">
+                            <view class="info-item">
+                                <text class="label">流程名称:</text>
+                                <text class="value">{{ item.flowName || '-' }}</text>
+                            </view>
+                            <view class="info-item">
+                                <text class="label">流程分类:</text>
+                                <text class="value">{{ item.categoryName || '-' }}</text>
+                            </view>
+                            <view class="info-item">
+                                <text class="label">版本号:</text>
+                                <text class="value">v{{ item.version || '1' }}.0</text>
+                            </view>
+                            <view class="info-item">
+                                <text class="label">任务名称:</text>
+                                <text class="value">{{ item.nodeName || '-' }}</text>
+                            </view>
+                            <view class="info-item">
+                                <text class="label">申请人:</text>
+                                <text class="value">{{ item.createByName || '-' }}</text>
+                            </view>
+                            <view class="info-item">
+                                <text class="label">办理人:</text>
+                                <u-tag
+                                    :text="item.approveName || '无'"
+                                    type="success"
+                                    size="mini"
+                                ></u-tag>
+                            </view>
+                            <!-- <view class="info-item">
+                                <text class="label">任务状态:</text>
+                                <u-tag
+                                    :text="getTaskStatusText(item.flowTaskStatus)"
+                                    :type="getTaskStatusType(item.flowTaskStatus)"
+                                    size="mini"
+                                ></u-tag>
+                            </view> -->
+                            <view class="info-item">
+                                <text class="label">创建时间:</text>
+                                <text class="value">{{ formatTime(item.createTime) }}</text>
                             </view>
                         </view>
 
-                        <text class="task-time">{{ formatTime(item.createTime) }}</text>
-                    </view>
-
-                    <!-- 操作按钮 -->
-                    <view class="task-actions" @click.stop>
-                        <u-button type="info" size="mini" @click="handleView(item)">查看</u-button>
+                        <!-- 操作按钮 -->
+                        <view class="card-actions">
+                            <view class="action-btn info-btn" @click="handleView(item)">
+                                <u-icon name="eye" size="16" color="#3c9cff"></u-icon>
+                                <text class="btn-text">查看</text>
+                            </view>
+                        </view>
                     </view>
                 </view>
-            </view>
 
-            <!-- 分页加载 -->
-            <view v-if="taskList.length > 0" class="pagination">
-                <u-loadmore v-if="hasMore" status="loading" @loadmore="loadMore">
-                    <text>正在加载更多...</text>
-                </u-loadmore>
-                <view v-else class="load-end">
-                    <text>已加载全部数据</text>
+                <!-- 加载状态提示 -->
+                <view v-if="taskList.length > 0" class="load-status">
+                    <view v-if="loadmoreStatus === 'loading'" class="loading-tip">
+                        <u-loading-icon></u-loading-icon>
+                        <text class="loading-text">正在加载...</text>
+                    </view>
+                    <view v-else-if="loadmoreStatus === 'nomore'" class="nomore-tip">
+                        <text class="nomore-text">没有更多数据了</text>
+                    </view>
                 </view>
-            </view>
+            </scroll-view>
         </view>
 
         <!-- 申请人选择弹窗 -->
-        <u-popup v-model="showUserSelector" mode="center" width="80%" border-radius="12">
-            <view class="user-selector-popup">
+        <u-popup
+            :show="userSelectDialog.visible"
+            mode="bottom"
+            :round="14"
+            @close="cancelUserSelect"
+        >
+            <view class="user-select-popup">
                 <view class="popup-header">
                     <text class="popup-title">选择申请人</text>
-                    <u-icon name="close" size="20" color="#666" @click="closeUserSelect"></u-icon>
+                    <u-icon
+                        name="close"
+                        @click="cancelUserSelect"
+                        size="24"
+                        color="#909399"
+                    ></u-icon>
                 </view>
+
                 <view class="popup-content">
-                    <text class="popup-tip">请输入申请人姓名或工号</text>
-                    <view class="search-user">
-                        <u-input
-                            v-model="userSearchKeyword"
-                            placeholder="搜索申请人"
-                            clearable
-                        ></u-input>
-                        <u-button
-                            type="primary"
-                            size="small"
-                            @click="searchUsers"
-                            style="margin-top: 12px"
-                        >
-                            搜索
-                        </u-button>
-                    </view>
-                    <view v-if="searchUsers.length > 0" class="user-results">
+                    <u-search
+                        v-model="userSearchKeyword"
+                        placeholder="搜索用户名或姓名"
+                        :show-action="false"
+                        @input="searchUsers"
+                        style="height: 60rpx !important"
+                    ></u-search>
+
+                    <scroll-view scroll-y class="user-list" @scrolltolower="loadMoreUsers">
                         <view
-                            v-for="user in searchUsers"
+                            v-for="user in userList"
                             :key="user.userId"
                             class="user-item"
-                            :class="{ selected: selectedUserIds.includes(user.userId) }"
                             @click="toggleUserSelect(user)"
                         >
-                            <text class="user-name">{{ user.userName }}</text>
-                            <text class="user-dept">{{ user.deptName }}</text>
+                            <view class="user-info">
+                                <u-avatar :text="getAvatarText(user.nickName)" size="40"></u-avatar>
+                                <view class="user-details">
+                                    <text class="user-name">{{ user.nickName }}</text>
+                                    <text class="user-username">{{ user.userName }}</text>
+                                </view>
+                            </view>
+                            <u-checkbox
+                                v-model="user.selected"
+                                @change="onCheckboxChange(user, $event)"
+                                @click.stop
+                            ></u-checkbox>
                         </view>
-                    </view>
+
+                        <!-- 用户列表加载更多 -->
+                        <u-loadmore
+                            v-if="userList.length > 0"
+                            :status="userLoadmoreStatus"
+                            margin-top="10"
+                            margin-bottom="10"
+                        ></u-loadmore>
+                    </scroll-view>
                 </view>
-                <view class="popup-actions">
-                    <u-button @click="closeUserSelect">取消</u-button>
-                    <u-button type="primary" @click="confirmUserSelect">确定</u-button>
+
+                <view class="popup-footer">
+                    <u-button @click="cancelUserSelect" type="info" size="default">取消</u-button>
+                    <u-button @click="confirmUserSelect" type="primary" size="default">
+                        确定
+                    </u-button>
                 </view>
             </view>
         </u-popup>
@@ -196,511 +220,824 @@
 </template>
 
 <script>
-import { workflowApi, getStatusStyle, formatTime, routerJump } from '@/common/workflow-api.js';
+import { request } from '@/common/request.js';
+import { getDict, getDictTagType } from '@/common/dict.js';
 
 export default {
+    name: 'TaskFinish',
     data() {
         return {
             loading: false,
-            showSearch: false,
-            showUserSelector: false,
+            refreshing: false, // 下拉刷新状态
             taskList: [],
             total: 0,
-            hasMore: true,
-            // 用户筛选相关
-            userSelectCount: 0,
-            selectedUserIds: [],
-            userSearchKeyword: '',
-            searchUsers: [],
+            loadmoreStatus: 'loadmore', // loadmore, loading, nomore
+
+            // 查询参数
             queryParams: {
                 pageNum: 1,
                 pageSize: 10,
-                nodeName: '',
-                flowName: '',
-                flowCode: '',
-                createByIds: [],
+                flowName: '', // 流程定义名称
+                createByIds: [], // 申请人IDs
+            },
+
+            // 流程状态字典
+            flowStatusDict: [],
+            // 任务状态字典
+            taskStatusDict: [],
+
+            // 申请人选择相关
+            userSelectDialog: {
+                visible: false,
+            },
+            selectedUsers: [], // 已选择的申请人
+            userList: [], // 用户列表
+            userSearchKeyword: '', // 用户搜索关键词
+            userSearchTimer: null, // 搜索防抖定时器
+
+            // 用户列表分页参数
+            userListParams: {
+                pageNum: 1,
+                pageSize: 20,
+                total: 0,
             },
+            userListLoading: false, // 用户列表加载状态
+            userLoadmoreStatus: 'loadmore', // 用户列表加载更多状态
         };
     },
-    onLoad() {
-        this.getFinishList();
-    },
-    onReachBottom() {
-        if (this.hasMore && !this.loading) {
-            this.loadMore();
-        }
-    },
-    onPullDownRefresh() {
-        this.refreshData();
+
+    async created() {
+        await this.loadDicts();
+        await this.getList();
     },
+
     methods: {
-        async getFinishList() {
-            if (this.loading) return;
+        // 返回上一页
+        goBack() {
+            uni.navigateBack();
+        },
+
+        // 加载字典数据
+        async loadDicts() {
+            try {
+                const [flowStatusDict, taskStatusDict] = await Promise.all([
+                    getDict('wf_business_status'),
+                    getDict('wf_task_status'),
+                ]);
+
+                this.flowStatusDict = flowStatusDict;
+                this.taskStatusDict = taskStatusDict;
+
+                console.log('字典数据加载完成:', {
+                    flowStatusDict: this.flowStatusDict,
+                    taskStatusDict: this.taskStatusDict,
+                });
+            } catch (error) {
+                console.error('加载字典数据失败:', error);
+            }
+        },
+
+        // 获取流程状态显示文本
+        getFlowStatusText(status) {
+            if (!this.flowStatusDict || this.flowStatusDict.length === 0) {
+                // 字典未加载时的降级处理
+                const statusMap = {
+                    0: '待提交',
+                    1: '审批中',
+                    2: '已通过',
+                    3: '已拒绝',
+                    4: '已撤回',
+                    5: '已终止',
+                    6: '已作废',
+                };
+                return statusMap[status] || '未知';
+            }
+
+            const statusItem = this.flowStatusDict.find((item) => item.value == status);
+            return statusItem ? statusItem.label : '未知';
+        },
+
+        // 获取流程状态标签类型
+        getFlowStatusType(status) {
+            const fallbackMap = {
+                0: 'info', // 待提交
+                1: 'warning', // 审批中
+                2: 'success', // 已通过
+                3: 'error', // 已拒绝
+                4: 'info', // 已撤回
+                5: 'error', // 已终止
+                6: 'error', // 已作废
+            };
+            return getDictTagType(this.flowStatusDict, status, fallbackMap);
+        },
+
+        // 获取任务状态显示文本
+        getTaskStatusText(status) {
+            if (!this.taskStatusDict || this.taskStatusDict.length === 0) {
+                // 字典未加载时的降级处理
+                const statusMap = {
+                    0: '待处理',
+                    1: '已处理',
+                    2: '已拒绝',
+                    3: '已撤回',
+                };
+                return statusMap[status] || '未知';
+            }
+            console.log('this.taskStatusDict:', this.taskStatusDict);
+            console.log('status:', status);
+            const statusItem = this.taskStatusDict.find((item) => item.value == status);
+            console.log('statusItem:', statusItem);
+            return statusItem ? statusItem.label : '未知';
+        },
+
+        // 获取任务状态标签类型
+        getTaskStatusType(status) {
+            const fallbackMap = {
+                0: 'warning', // 待处理
+                1: 'success', // 已处理
+                2: 'error', // 已拒绝
+                3: 'info', // 已撤回
+            };
+            return getDictTagType(this.taskStatusDict, status, fallbackMap);
+        },
+
+        // 获取已办任务列表
+        async getList(isLoadMore = false) {
+            if (!isLoadMore) {
+                this.loading = true;
+                this.queryParams.pageNum = 1;
+            } else {
+                this.loadmoreStatus = 'loading';
+            }
 
-            this.loading = true;
             try {
-                const res = await workflowApi.pageByTaskFinish(this.queryParams);
-                if (res.code === 200) {
-                    if (this.queryParams.pageNum === 1) {
-                        this.taskList = res.rows || [];
+                const res = await request({
+                    url: '/workflow/task/pageByTaskFinish',
+                    method: 'GET',
+                    params: {
+                        pageNum: this.queryParams.pageNum,
+                        pageSize: this.queryParams.pageSize,
+                        flowName: this.queryParams.flowName || undefined,
+                        createByIds:
+                            this.queryParams.createByIds.length > 0
+                                ? this.queryParams.createByIds
+                                : undefined,
+                    },
+                });
+
+                if (res && res.code === 200) {
+                    const newList = res.rows || [];
+
+                    if (isLoadMore) {
+                        this.taskList = [...this.taskList, ...newList];
+                        // 判断是否还有更多数据:检查当前页数据量 AND 总数据量
+                        if (
+                            newList.length < this.queryParams.pageSize ||
+                            this.taskList.length >= (res.total || this.total)
+                        ) {
+                            this.loadmoreStatus = 'nomore';
+                        } else {
+                            this.loadmoreStatus = 'loadmore';
+                        }
+                        // 更新总数量(防止首次加载时total未正确设置)
+                        this.total = res.total || this.total || 0;
                     } else {
-                        this.taskList.push(...(res.rows || []));
+                        this.taskList = newList;
+                        this.total = res.total || 0;
+                        // 重置加载更多状态
+                        if (this.taskList.length >= this.total) {
+                            this.loadmoreStatus = 'nomore';
+                        } else {
+                            this.loadmoreStatus = 'loadmore';
+                        }
                     }
-                    this.total = res.total;
-                    this.hasMore = this.taskList.length < this.total;
+
+                    console.log(
+                        '已办任务列表加载完成,当前任务数量:',
+                        this.taskList.length,
+                        '总数量:',
+                        this.total,
+                    );
                 } else {
-                    uni.showToast({ title: res.msg || '加载失败', icon: 'error' });
+                    if (!isLoadMore) {
+                        this.taskList = [];
+                        this.total = 0;
+                    }
+                    uni.showToast({
+                        title: res?.msg || '获取已办任务失败',
+                        icon: 'none',
+                    });
+                    if (isLoadMore) {
+                        this.loadmoreStatus = 'loadmore';
+                    }
+                }
+            } catch (error) {
+                console.error('获取已办任务失败:', error);
+                if (!isLoadMore) {
+                    this.taskList = [];
+                    this.total = 0;
+                }
+                uni.showToast({
+                    title: '获取已办任务失败',
+                    icon: 'none',
+                });
+                if (isLoadMore) {
+                    this.loadmoreStatus = 'loadmore';
                 }
-            } catch (e) {
-                console.error('加载已办任务失败:', e);
-                uni.showToast({ title: '网络错误', icon: 'error' });
             } finally {
-                this.loading = false;
-                uni.stopPullDownRefresh();
+                if (!isLoadMore) {
+                    this.loading = false;
+                }
             }
         },
 
-        async loadMore() {
-            if (!this.hasMore || this.loading) return;
+        // 搜索操作
+        handleQuery() {
+            this.queryParams.pageNum = 1;
+            this.getList();
+        },
+
+        // 加载更多任务
+        loadMoreTasks() {
+            if (this.loadmoreStatus === 'nomore' || this.loadmoreStatus === 'loading') {
+                return;
+            }
 
             this.queryParams.pageNum++;
-            await this.getFinishList();
+            this.getList(true);
         },
 
-        async refreshData() {
+        // 下拉刷新
+        onRefresh() {
+            console.log('开始下拉刷新');
+            this.refreshing = true;
             this.queryParams.pageNum = 1;
-            this.hasMore = true;
-            await this.getFinishList();
+            this.getList().finally(() => {
+                // 确保刷新状态重置
+                setTimeout(() => {
+                    this.refreshing = false;
+                }, 500);
+            });
         },
 
-        toggleSearch() {
-            this.showSearch = !this.showSearch;
+        // 重置刷新状态
+        onRestore() {
+            console.log('刷新状态重置');
+            this.refreshing = false;
         },
 
-        handleQuery() {
-            this.queryParams.pageNum = 1;
-            this.hasMore = true;
-            this.refreshData();
+        // 格式化时间
+        formatTime(timeStr) {
+            if (!timeStr) return '-';
+            try {
+                const date = new Date(timeStr);
+                if (isNaN(date.getTime())) return timeStr;
+
+                const year = date.getFullYear();
+                const month = String(date.getMonth() + 1).padStart(2, '0');
+                const day = String(date.getDate()).padStart(2, '0');
+                const hours = String(date.getHours()).padStart(2, '0');
+                const minutes = String(date.getMinutes()).padStart(2, '0');
+                const seconds = String(date.getSeconds()).padStart(2, '0');
+
+                return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+            } catch (error) {
+                console.error('时间格式化失败:', error);
+                return timeStr;
+            }
         },
 
-        resetQuery() {
-            this.queryParams = {
-                pageNum: 1,
-                pageSize: 10,
-                nodeName: '',
-                flowName: '',
-                flowCode: '',
-                createByIds: [],
-            };
-            this.userSelectCount = 0;
-            this.selectedUserIds = [];
-            this.hasMore = true;
-            this.refreshData();
+        // 查看按钮操作
+        handleView(row) {
+            console.log('查看已办任务详情:', row);
+
+            // 动态跳转到formPath对应的路径,携带businessId和taskId参数
+            if (row.formPath) {
+                // 确保路径以pages开头
+                let fullPath = row.formPath;
+
+                // 统一处理路径:去掉开头的/,然后添加pages前缀
+                if (!fullPath.startsWith('pages/')) {
+                    // 如果以/开头,先去掉/
+                    if (fullPath.startsWith('/')) {
+                        fullPath = fullPath.substring(1);
+                    }
+                    // 添加pages前缀
+                    fullPath = `pages/${fullPath}`;
+                }
+
+                const url = `/${fullPath}?id=${row.businessId}&taskId=${row.id}&type=view`;
+
+                // 添加调试信息
+                console.log('查看任务 - 原始formPath:', row.formPath);
+                console.log('查看任务 - 处理后的fullPath:', fullPath);
+                console.log('查看任务 - 最终跳转URL:', url);
+
+                // 使用navigateTo进行跳转
+                uni.navigateTo({
+                    url: url,
+                    fail: (err) => {
+                        console.error('查看页面跳转失败:', err);
+                        // 如果跳转失败,使用原有逻辑作为备选
+                        this.fallbackView(row);
+                    },
+                });
+            } else {
+                // 如果没有formPath,使用原有逻辑作为备选
+                this.fallbackView(row);
+            }
         },
 
-        handleView(item) {
-            this.routerJump({
-                businessId: item.businessId,
-                taskId: item.id,
-                type: 'view',
-                formCustom: item.formCustom,
-                formPath: item.formPath,
-            });
+        // 备选查看方法(原有逻辑)
+        fallbackView(row) {
+            console.log('使用备选查看逻辑:', row);
+            // 根据表单类型跳转到对应的查看页面
+            if (row.formCustom === 'Y') {
+                // 自定义表单
+                uni.navigateTo({
+                    url: `/pages/workflow/form/custom?businessId=${row.businessId}&taskId=${
+                        row.id
+                    }&type=view&formPath=${encodeURIComponent(row.formPath || '')}`,
+                });
+            } else {
+                // 默认表单或其他类型
+                uni.navigateTo({
+                    url: `/pages/workflow/view/index?businessId=${row.businessId}&taskId=${row.id}&type=view`,
+                });
+            }
         },
 
-        // 用户选择相关方法
+        // 打开申请人选择
         openUserSelect() {
-            this.showUserSelector = true;
+            this.userSelectDialog.visible = true;
+            // 重置分页数据
+            this.userListParams.pageNum = 1;
+            this.userListParams.total = 0;
+            this.userLoadmoreStatus = 'loadmore';
+            this.userSearchKeyword = '';
+            this.loadUserList();
         },
 
-        closeUserSelect() {
-            this.showUserSelector = false;
+        // 取消申请人选择
+        cancelUserSelect() {
+            this.userSelectDialog.visible = false;
             this.userSearchKeyword = '';
-            this.searchUsers = [];
+            // 重置用户列表分页数据
+            this.userListParams.pageNum = 1;
+            this.userListParams.total = 0;
+            this.userLoadmoreStatus = 'loadmore';
         },
 
-        async searchUsers() {
-            if (!this.userSearchKeyword.trim()) {
-                uni.showToast({ title: '请输入搜索关键词', icon: 'none' });
-                return;
-            }
+        // 确认申请人选择
+        confirmUserSelect() {
+            // 获取当前弹窗中选中的用户
+            const currentSelected = this.userList.filter((user) => user.selected);
 
-            // 这里应该调用用户搜索API,暂时模拟数据
-            this.searchUsers = [
-                { userId: '1', userName: '张三', deptName: '技术部' },
-                { userId: '2', userName: '李四', deptName: '财务部' },
-                { userId: '3', userName: '王五', deptName: '人事部' },
-            ];
-        },
+            console.log('确认选择 - 用户列表:', this.userList);
+            console.log('确认选择 - 选中的用户:', currentSelected);
 
-        toggleUserSelect(user) {
-            const index = this.selectedUserIds.findIndex((id) => id === user.userId);
-            if (index > -1) {
-                this.selectedUserIds.splice(index, 1);
+            if (currentSelected.length > 0) {
+                // 如果有选中的用户,更新已选择的用户列表
+                this.selectedUsers = currentSelected;
+                this.queryParams.createByIds = currentSelected.map((user) => user.userId);
+                console.log('更新选中用户:', this.selectedUsers);
             } else {
-                this.selectedUserIds.push(user.userId);
+                // 如果没有选中任何用户,清空已选择的用户列表
+                this.selectedUsers = [];
+                this.queryParams.createByIds = [];
+                console.log('清空选中用户');
             }
-        },
 
-        confirmUserSelect() {
-            this.userSelectCount = this.selectedUserIds.length;
-            this.queryParams.createByIds = [...this.selectedUserIds];
-            this.closeUserSelect();
+            this.userSelectDialog.visible = false;
             this.handleQuery();
         },
 
-        clearUserFilter() {
-            this.userSelectCount = 0;
-            this.selectedUserIds = [];
-            this.queryParams.createByIds = [];
-            this.handleQuery();
+        // 切换用户选择状态
+        toggleUserSelect(user) {
+            this.$set(user, 'selected', !user.selected);
+            console.log('切换用户选择:', user.nickName, '选中状态:', user.selected);
         },
 
-        getStatusText(status) {
-            const statusMap = {
-                draft: '草稿',
-                waiting: '待审批',
-                complete: '已完成',
-                cancel: '已取消',
-                back: '已退回',
-                suspend: '挂起',
-                terminate: '终止',
-            };
-            return statusMap[status] || '未知';
+        // checkbox变化处理
+        onCheckboxChange(user, value) {
+            console.log('Checkbox变化:', user.nickName, '新值:', value);
+            this.$set(user, 'selected', value);
         },
 
-        getTaskStatusText(status) {
-            const statusMap = {
-                agree: '同意',
-                reject: '驳回',
-                back: '退回',
-                delegate: '委托',
-                suspend: '挂起',
-                terminate: '终止',
-            };
-            return statusMap[status] || '未知';
-        },
+        // 加载用户列表
+        async loadUserList(isLoadMore = false) {
+            if (!isLoadMore) {
+                this.userListLoading = true;
+                this.userListParams.pageNum = 1;
+            } else {
+                this.userLoadmoreStatus = 'loading';
+            }
 
-        getTaskStatusStyle(status) {
-            const styleMap = {
-                agree: { color: '#67c23a' },
-                reject: { color: '#f56c6c' },
-                back: { color: '#409eff' },
-                delegate: { color: '#e6a23c' },
-                suspend: { color: '#909399' },
-                terminate: { color: '#f56c6c' },
-            };
-            return styleMap[status] || { color: '#909399' };
+            try {
+                const res = await request({
+                    url: '/system/user/listByOr',
+                    method: 'GET',
+                    params: {
+                        pageNum: this.userListParams.pageNum,
+                        pageSize: this.userListParams.pageSize,
+                        status: '0',
+                        userName: this.userSearchKeyword || undefined,
+                        nickName: this.userSearchKeyword || undefined,
+                    },
+                });
+
+                if (res && res.code === 200) {
+                    const newUsers = (res.rows || []).map((user) => ({
+                        ...user,
+                        selected: false,
+                    }));
+
+                    if (isLoadMore) {
+                        // 加载更多,追加数据
+                        this.userList = [...this.userList, ...newUsers];
+                        // 判断是否还有更多数据
+                        if (newUsers.length < this.userListParams.pageSize) {
+                            this.userLoadmoreStatus = 'nomore';
+                        } else {
+                            this.userLoadmoreStatus = 'loadmore';
+                        }
+                    } else {
+                        // 首次加载或搜索,替换数据
+                        this.userList = newUsers;
+                        this.userListParams.total = res.total || 0;
+                        // 重置加载更多状态
+                        if (this.userList.length >= this.userListParams.total) {
+                            this.userLoadmoreStatus = 'nomore';
+                        } else {
+                            this.userLoadmoreStatus = 'loadmore';
+                        }
+                    }
+
+                    console.log(
+                        '加载用户列表完成,当前用户数量:',
+                        this.userList.length,
+                        '总数量:',
+                        this.userListParams.total,
+                    );
+                } else {
+                    if (!isLoadMore) {
+                        this.userList = [];
+                        this.userListParams.total = 0;
+                    }
+                    uni.showToast({
+                        title: res?.msg || '获取用户列表失败',
+                        icon: 'none',
+                    });
+                    if (isLoadMore) {
+                        this.userLoadmoreStatus = 'loadmore';
+                    }
+                }
+            } catch (error) {
+                console.error('获取用户列表失败:', error);
+                if (!isLoadMore) {
+                    this.userList = [];
+                    this.userListParams.total = 0;
+                }
+                uni.showToast({
+                    title: '获取用户列表失败',
+                    icon: 'none',
+                });
+                if (isLoadMore) {
+                    this.userLoadmoreStatus = 'loadmore';
+                }
+            } finally {
+                if (!isLoadMore) {
+                    this.userListLoading = false;
+                }
+            }
         },
 
-        getStatusStyle(status) {
-            return getStatusStyle(status);
+        // 搜索用户(防抖处理)
+        searchUsers() {
+            if (this.userSearchTimer) {
+                clearTimeout(this.userSearchTimer);
+            }
+
+            this.userSearchTimer = setTimeout(() => {
+                // 搜索时重置分页数据
+                this.userListParams.pageNum = 1;
+                this.userListParams.total = 0;
+                this.userLoadmoreStatus = 'loadmore';
+                this.loadUserList();
+            }, 500);
         },
 
-        formatTime(timeStr) {
-            return formatTime(timeStr);
+        // 加载更多用户
+        loadMoreUsers() {
+            if (this.userLoadmoreStatus === 'nomore' || this.userLoadmoreStatus === 'loading') {
+                return;
+            }
+
+            this.userListParams.pageNum++;
+            this.loadUserList(true);
         },
 
-        routerJump(params) {
-            routerJump(params);
+        // 获取头像显示文字(取前两个字符)
+        getAvatarText(nickName) {
+            if (!nickName) return '';
+            // 取前两个字符,如果只有一个字符则返回该字符
+            return nickName.length > 1 ? nickName.substring(0, 1) : nickName;
         },
     },
 };
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 .task-finish-container {
-    background: #f5f5f5;
+    background-color: #f5f6fa;
     min-height: 100vh;
-    padding-bottom: 20px;
 }
 
-.header {
+.search-container {
+    padding: 20rpx;
+    background-color: #fff;
+    box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
+}
+
+.filter-section {
+    margin-top: 20rpx;
+}
+
+.filter-item {
     display: flex;
-    justify-content: space-between;
     align-items: center;
-    padding: 16px 20px;
-    background: #fff;
-    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
+    padding: 24rpx;
+    background-color: #f8f9fa;
+    border-radius: 12rpx;
+    border: 1px solid #e4e7ed;
+
+    &:active {
+        background-color: #f0f0f0;
+    }
 }
 
-.title {
-    font-size: 20px;
-    font-weight: bold;
-    color: #333;
+.filter-text {
+    flex: 1;
+    margin-left: 16rpx;
+    font-size: 28rpx;
+    color: #303133;
 }
 
-.header-actions {
+.content-wrapper {
+    padding: 20rpx;
+    height: calc(100vh - 280rpx); /* 减去导航栏和搜索区域的高度 */
     display: flex;
-    align-items: center;
+    flex-direction: column;
 }
 
-.search-section {
-    background: #fff;
-    padding: 16px 20px;
-    border-bottom: 1px solid #eee;
+.task-scroll-view {
+    flex: 1;
+    height: 100%;
 }
 
-.search-input {
-    margin-bottom: 12px;
+.empty-container {
+    padding: 100rpx 20rpx;
 }
 
-.search-actions {
+.task-list {
     display: flex;
-    gap: 12px;
+    flex-direction: column;
+    gap: 20rpx;
 }
 
-.user-filter-section {
-    background: #fff;
-    padding: 12px 20px;
-    border-bottom: 1px solid #eee;
+.task-card {
+    background-color: #fff;
+    border-radius: 16rpx;
+    box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
+    overflow: hidden;
 }
 
-.filter-info {
+.card-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
+    padding: 24rpx;
+    border-bottom: 1px solid #f0f0f0;
 }
 
-.filter-text {
-    color: #007aff;
-    font-size: 14px;
+.task-title {
+    font-size: 32rpx;
+    font-weight: bold;
+    color: #303133;
+    flex: 1;
 }
 
-.content {
-    flex: 1;
+.task-status {
+    margin-left: 16rpx;
+}
+
+.card-content {
+    padding: 24rpx;
 }
 
-.loading {
+.info-item {
     display: flex;
-    flex-direction: column;
     align-items: center;
-    padding: 40px;
+    margin-bottom: 16rpx;
+
+    &:last-child {
+        margin-bottom: 0;
+    }
 }
 
-.loading-text {
-    margin-top: 8px;
-    color: #999;
-    font-size: 14px;
+.label {
+    font-size: 28rpx;
+    color: #606266;
+    min-width: 140rpx;
+    margin-right: 16rpx;
+}
+
+.value {
+    font-size: 28rpx;
+    color: #303133;
+    flex: 1;
+    word-break: break-all;
 }
 
-.empty {
-    padding: 40px 20px;
+.card-actions {
+    display: flex;
+    justify-content: flex-end;
+    padding: 20rpx;
+    border-top: 1px solid #f0f0f0;
 }
 
-.empty-content {
+.action-btn {
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: center;
+    padding: 16rpx 40rpx;
+    border-radius: 12rpx;
+    background-color: #f8f9fa;
+    min-width: 120rpx;
+    transition: all 0.3s ease;
+
+    &:active {
+        transform: scale(0.95);
+        opacity: 0.8;
+    }
 }
 
-.empty-text {
-    font-size: 14px;
-    color: #999;
-    margin-top: 12px;
-}
-
-.task-list {
-    padding: 16px 20px;
+.btn-text {
+    font-size: 24rpx;
+    margin-top: 8rpx;
+    color: #303133;
+    font-weight: 500;
 }
 
-.task-item {
-    background: #fff;
-    border-radius: 12px;
-    padding: 16px;
-    margin-bottom: 12px;
-    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
-    transition: box-shadow 0.2s;
-}
+.info-btn {
+    background-color: rgba(60, 156, 255, 0);
 
-.task-item:active {
-    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
+    .btn-text {
+        color: #3c9cff;
+    }
 }
 
-.task-header {
-    margin-bottom: 12px;
+// 申请人选择弹窗样式
+.user-select-popup {
+    background-color: #fff;
+    border-radius: 14rpx 14rpx 0 0;
+    overflow: hidden;
+    height: 80vh;
+    display: flex;
+    flex-direction: column;
 }
 
-.task-title-row {
+.popup-header {
     display: flex;
     justify-content: space-between;
-    align-items: flex-start;
-    margin-bottom: 8px;
-}
-
-.task-name {
-    font-size: 16px;
-    font-weight: 500;
-    color: #333;
-    flex: 1;
-    margin-right: 12px;
+    align-items: center;
+    padding: 24rpx;
+    border-bottom: 1px solid #f0f0f0;
+    flex-shrink: 0; /* 防止头部被压缩 */
 }
 
-.task-status {
-    padding: 4px 8px;
-    border-radius: 12px;
-    font-size: 12px;
-    font-weight: 500;
-    white-space: nowrap;
+.popup-title {
+    font-size: 32rpx;
+    font-weight: bold;
+    color: #303133;
 }
 
-.task-info {
+.popup-content {
+    flex: 1;
+    padding: 24rpx 24rpx 0 24rpx; /* 底部不需要padding,由footer提供 */
     display: flex;
-    justify-content: space-between;
-    margin-bottom: 6px;
-}
-
-.task-code {
-    font-size: 13px;
-    color: #666;
+    flex-direction: column;
+    overflow: hidden; /* 防止内容溢出 */
 }
 
-.task-category {
-    font-size: 13px;
-    color: #666;
+.popup-footer {
+    padding: 24rpx;
+    border-top: 1px solid #f0f0f0;
+    display: flex;
+    gap: 20rpx;
+    flex-shrink: 0; /* 防止底部按钮区域被压缩 */
+    background-color: #fff; /* 确保背景色一致 */
 }
 
-.task-version,
-.task-node-name,
-.task-applicant {
-    font-size: 13px;
-    color: #666;
-    margin-bottom: 4px;
+.user-list {
+    margin-top: 20rpx;
+    flex: 1; /* 使用弹性布局,自动占满剩余空间 */
+    overflow-y: auto; /* 添加垂直滚动条 */
+    min-height: 0; /* 确保flex子元素可以收缩 */
 }
 
-.assignee-info {
+.user-item {
     display: flex;
     align-items: center;
-    margin-bottom: 4px;
-}
+    justify-content: space-between;
+    padding: 20rpx 0;
+    border-bottom: 1px solid #f8f9fa;
 
-.assignee-label {
-    font-size: 13px;
-    color: #666;
-    margin-right: 4px;
-}
+    &:last-child {
+        border-bottom: none;
+    }
 
-.assignee-name {
-    font-size: 13px;
-    color: #333;
-    font-weight: 500;
+    &:active {
+        background-color: #f8f9fa;
+    }
 }
 
-.task-status-info {
+.user-info {
     display: flex;
     align-items: center;
-    margin-bottom: 4px;
+    flex: 1;
 }
 
-.task-status-label {
-    font-size: 13px;
-    color: #666;
-    margin-right: 4px;
+.user-details {
+    margin-left: 20rpx;
+    flex: 1;
 }
 
-.task-status-tag {
-    padding: 2px 6px;
-    border-radius: 8px;
-    font-size: 12px;
+.user-name {
+    display: block;
+    font-size: 28rpx;
+    color: #303133;
     font-weight: 500;
 }
 
-.task-time {
-    font-size: 12px;
-    color: #999;
+.user-username {
+    display: block;
+    font-size: 24rpx;
+    color: #909399;
+    margin-top: 4rpx;
 }
 
-.task-actions {
-    border-top: 1px solid #f0f0f0;
-    padding-top: 12px;
-}
-
-.pagination {
-    padding: 16px 20px;
-}
-
-.load-end {
+// 加载状态提示样式
+.load-status {
+    padding: 30rpx 20rpx;
     text-align: center;
-    padding: 16px;
-}
-
-.load-end text {
-    font-size: 14px;
-    color: #999;
 }
 
-/* 弹窗样式 */
-.user-selector-popup {
-    padding: 20px;
-}
-
-.popup-header {
+.loading-tip {
     display: flex;
-    justify-content: space-between;
     align-items: center;
-    margin-bottom: 16px;
-    padding-bottom: 12px;
-    border-bottom: 1px solid #eee;
-}
-
-.popup-title {
-    font-size: 18px;
-    font-weight: 500;
-    color: #333;
-}
-
-.popup-content {
-    margin-bottom: 16px;
+    justify-content: center;
+    color: #909399;
 }
 
-.popup-tip {
-    font-size: 14px;
-    color: #666;
-    margin-bottom: 12px;
+.loading-text {
+    margin-left: 16rpx;
+    font-size: 28rpx;
 }
 
-.search-user {
-    margin-bottom: 16px;
+.nomore-tip {
+    color: #c0c4cc;
 }
 
-.user-results {
-    max-height: 200px;
-    overflow-y: auto;
+.nomore-text {
+    font-size: 26rpx;
 }
 
-.user-item {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    padding: 12px;
-    border: 1px solid #e6e6e6;
-    border-radius: 8px;
-    margin-bottom: 8px;
-    transition: all 0.2s;
+// uview组件样式调整
+::v-deep .u-search {
+    background-color: #f5f6fa;
+    /* 清除默认的 flex: 1 */
+    flex: none;
 }
 
-.user-item.selected {
-    border-color: #007aff;
-    background: #f0f8ff;
+// 弹窗内搜索框样式优化
+.popup-content ::v-deep .u-search {
+    background-color: #f8f9fa;
+    border-radius: 8rpx;
+    margin-bottom: 0; /* 移除默认margin */
 }
 
-.user-name {
-    font-size: 14px;
-    font-weight: 500;
-    color: #333;
+.popup-content ::v-deep .u-search__content {
+    height: 60rpx; /* 设置搜索框高度 */
+    border-radius: 8rpx;
 }
 
-.user-dept {
-    font-size: 12px;
-    color: #666;
+.popup-content ::v-deep .u-input {
+    font-size: 28rpx; /* 调整输入框字体大小 */
 }
 
-.popup-actions {
-    display: flex;
-    justify-content: space-between;
-    gap: 12px;
-    padding-top: 12px;
-    border-top: 1px solid #eee;
+::v-deep .u-tag {
+    margin: 0;
 }
 </style>

+ 16 - 6
mobile/src/pages/task/taskWaiting.vue

@@ -71,8 +71,8 @@
                     <!-- 卡片内容 -->
                     <view class="card-content">
                         <view class="info-item">
-                            <text class="label">流程编码:</text>
-                            <text class="value">{{ item.flowCode || '-' }}</text>
+                            <text class="label">流程名称:</text>
+                            <text class="value">{{ item.flowName || '-' }}</text>
                         </view>
                         <view class="info-item">
                             <text class="label">流程分类:</text>
@@ -332,12 +332,17 @@ export default {
 
                     if (isLoadMore) {
                         this.taskList = [...this.taskList, ...newList];
-                        // 判断是否还有更多数据
-                        if (newList.length < this.queryParams.pageSize) {
+                        // 判断是否还有更多数据:检查当前页数据量 AND 总数据量
+                        if (
+                            newList.length < this.queryParams.pageSize ||
+                            this.taskList.length >= (res.total || this.total)
+                        ) {
                             this.loadmoreStatus = 'nomore';
                         } else {
                             this.loadmoreStatus = 'loadmore';
                         }
+                        // 更新总数量(防止首次加载时total未正确设置)
+                        this.total = res.total || this.total || 0;
                     } else {
                         this.taskList = newList;
                         this.total = res.total || 0;
@@ -565,12 +570,17 @@ export default {
                     if (isLoadMore) {
                         // 加载更多,追加数据
                         this.userList = [...this.userList, ...newUsers];
-                        // 判断是否还有更多数据
-                        if (newUsers.length < this.userListParams.pageSize) {
+                        // 判断是否还有更多数据:检查当前页数据量 AND 总数据量
+                        if (
+                            newUsers.length < this.userListParams.pageSize ||
+                            this.userList.length >= (res.total || this.userListParams.total)
+                        ) {
                             this.userLoadmoreStatus = 'nomore';
                         } else {
                             this.userLoadmoreStatus = 'loadmore';
                         }
+                        // 更新总数量(防止首次加载时total未正确设置)
+                        this.userListParams.total = res.total || this.userListParams.total || 0;
                     } else {
                         // 首次加载或搜索,替换数据
                         this.userList = newUsers;