提交新的移动端框架

This commit is contained in:
zlwu committed 2025-08-07 13:19:12 +08:00
1 parent 134f711349
commit 9bda3717fe
75 files changed
+5283 -9011

No files matched your search

@@ -1,348 +0,0 @@
<template>
<view class="iconfont-demo">
<view class="demo-header">
<text class="demo-title">iconfont 图标库演示</text>
<text class="demo-subtitle">基于iconfont.cn的图标字体</text>
</view>
<view class="demo-content">
<!-- 基础图标 -->
<view class="icon-section">
<text class="section-title">基础图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-user"></text>
<text class="icon-name">用户</text>
<text class="icon-code">icon-user</text>
</view>
<view class="icon-item">
<text class="iconfont icon-lock"></text>
<text class="icon-name">锁定</text>
<text class="icon-code">icon-lock</text>
</view>
<view class="icon-item">
<text class="iconfont icon-eye"></text>
<text class="icon-name">眼睛</text>
<text class="icon-code">icon-eye</text>
</view>
<view class="icon-item">
<text class="iconfont icon-eye-close"></text>
<text class="icon-name">关闭眼睛</text>
<text class="icon-code">icon-eye-close</text>
</view>
</view>
</view>
<!-- 操作图标 -->
<view class="icon-section">
<text class="section-title">操作图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-add"></text>
<text class="icon-name">添加</text>
<text class="icon-code">icon-add</text>
</view>
<view class="icon-item">
<text class="iconfont icon-edit"></text>
<text class="icon-name">编辑</text>
<text class="icon-code">icon-edit</text>
</view>
<view class="icon-item">
<text class="iconfont icon-delete"></text>
<text class="icon-name">删除</text>
<text class="icon-code">icon-delete</text>
</view>
<view class="icon-item">
<text class="iconfont icon-search"></text>
<text class="icon-name">搜索</text>
<text class="icon-code">icon-search</text>
</view>
<view class="icon-item">
<text class="iconfont icon-refresh"></text>
<text class="icon-name">刷新</text>
<text class="icon-code">icon-refresh</text>
</view>
<view class="icon-item">
<text class="iconfont icon-close"></text>
<text class="icon-name">关闭</text>
<text class="icon-code">icon-close</text>
</view>
</view>
</view>
<!-- 文件图标 -->
<view class="icon-section">
<text class="section-title">文件图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-download"></text>
<text class="icon-name">下载</text>
<text class="icon-code">icon-download</text>
</view>
<view class="icon-item">
<text class="iconfont icon-upload"></text>
<text class="icon-name">上传</text>
<text class="icon-code">icon-upload</text>
</view>
</view>
</view>
<!-- 状态图标 -->
<view class="icon-section">
<text class="section-title">状态图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-success" style="color: #52c41a"></text>
<text class="icon-name">成功</text>
<text class="icon-code">icon-success</text>
</view>
<view class="icon-item">
<text class="iconfont icon-warning" style="color: #faad14"></text>
<text class="icon-name">警告</text>
<text class="icon-code">icon-warning</text>
</view>
<view class="icon-item">
<text class="iconfont icon-info" style="color: #1890ff"></text>
<text class="icon-name">信息</text>
<text class="icon-code">icon-info</text>
</view>
<view class="icon-item">
<text class="iconfont icon-check" style="color: #52c41a"></text>
<text class="icon-name">确认</text>
<text class="icon-code">icon-check</text>
</view>
</view>
</view>
<!-- 社交图标 -->
<view class="icon-section">
<text class="section-title">社交图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-star" style="color: #faad14"></text>
<text class="icon-name">星星</text>
<text class="icon-code">icon-star</text>
</view>
<view class="icon-item">
<text class="iconfont icon-heart" style="color: #ff4d4f"></text>
<text class="icon-name">喜欢</text>
<text class="icon-code">icon-heart</text>
</view>
<view class="icon-item">
<text class="iconfont icon-message"></text>
<text class="icon-name">消息</text>
<text class="icon-code">icon-message</text>
</view>
<view class="icon-item">
<text class="iconfont icon-phone"></text>
<text class="icon-name">电话</text>
<text class="icon-code">icon-phone</text>
</view>
<view class="icon-item">
<text class="iconfont icon-mail"></text>
<text class="icon-name">邮件</text>
<text class="icon-code">icon-mail</text>
</view>
</view>
</view>
<!-- 导航图标 -->
<view class="icon-section">
<text class="section-title">导航图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-home"></text>
<text class="icon-name">首页</text>
<text class="icon-code">icon-home</text>
</view>
<view class="icon-item">
<text class="iconfont icon-message"></text>
<text class="icon-name">消息</text>
<text class="icon-code">icon-message</text>
</view>
<view class="icon-item">
<text class="iconfont icon-setting"></text>
<text class="icon-name">设置</text>
<text class="icon-code">icon-setting</text>
</view>
<view class="icon-item">
<text class="iconfont icon-arrow-right"></text>
<text class="icon-name">箭头右</text>
<text class="icon-code">icon-arrow-right</text>
</view>
</view>
</view>
<!-- 联系图标 -->
<view class="icon-section">
<text class="section-title">联系图标</text>
<view class="icon-grid">
<view class="icon-item">
<text class="iconfont icon-phone"></text>
<text class="icon-name">电话</text>
<text class="icon-code">icon-phone</text>
</view>
<view class="icon-item">
<text class="iconfont icon-mail"></text>
<text class="icon-name">邮箱</text>
<text class="icon-code">icon-mail</text>
</view>
<view class="icon-item">
<text class="iconfont icon-check"></text>
<text class="icon-name">确认</text>
<text class="icon-code">icon-check</text>
</view>
</view>
</view>
<!-- 使用说明 -->
<view class="usage-section">
<text class="section-title">使用方法</text>
<view class="usage-code">
<text class="code-line">
&lt;text class="iconfont icon-user"&gt;&lt;/text&gt;
</text>
<text class="code-line">
&lt;text class="iconfont icon-lock"&gt;&lt;/text&gt;
</text>
<text class="code-line">/* 自定义样式 */</text>
<text class="code-line">.custom-icon {</text>
<text class="code-line">font-size: 24px;</text>
<text class="code-line">color: #5d87ff;</text>
<text class="code-line">}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'IconFontDemo',
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.iconfont-demo {
min-height: 100vh;
background: #f8f9fa;
padding: 20px;
}
.demo-header {
text-align: center;
margin-bottom: 32px;
}
.demo-title {
display: block;
font-size: 24px;
font-weight: bold;
color: #222;
margin-bottom: 8px;
}
.demo-subtitle {
display: block;
font-size: 14px;
color: #666;
}
.demo-content {
max-width: 800px;
margin: 0 auto;
}
.icon-section {
background: #fff;
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.section-title {
display: block;
font-size: 18px;
font-weight: bold;
color: #333;
margin-bottom: 16px;
padding-bottom: 8px;
border-bottom: 2px solid #5d87ff;
}
.icon-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 16px;
}
.icon-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 16px 8px;
border: 1px solid #e9ecef;
border-radius: 8px;
background: #fafbfc;
transition: all 0.2s ease;
}
.icon-item:hover {
border-color: #5d87ff;
background: #f0f4ff;
}
.icon-item .iconfont {
width: 32px;
height: 32px;
margin-bottom: 8px;
filter: brightness(0) saturate(100%) invert(38%) sepia(87%) saturate(6400%) hue-rotate(225deg)
brightness(104%) contrast(104%);
}
.icon-name {
font-size: 14px;
color: #333;
margin-bottom: 4px;
font-weight: 500;
}
.icon-code {
font-size: 12px;
color: #666;
font-family: 'Consolas', 'Monaco', monospace;
background: #f1f3f4;
padding: 2px 6px;
border-radius: 4px;
}
.usage-section {
background: #fff;
border-radius: 12px;
padding: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.usage-code {
background: #2d3748;
border-radius: 8px;
padding: 16px;
font-family: 'Consolas', 'Monaco', monospace;
}
.code-line {
display: block;
color: #e2e8f0;
font-size: 14px;
line-height: 1.6;
margin-bottom: 4px;
}
.code-line:last-child {
margin-bottom: 0;
}
</style>
-346
View File
@@ -1,346 +0,0 @@
<template>
<view class="test-page">
<NavBar title="路由守卫测试" />
<view class="content">
<view class="test-section">
<text class="section-title">🛡️ 路由守卫测试页面</text>
<text class="section-desc">如果你能看到这个页面,说明已经通过了登录验证</text>
</view>
<view class="test-info">
<view class="info-item">
<text class="info-label">当前时间:</text>
<text class="info-value">{{ currentTime }}</text>
</view>
<view class="info-item">
<text class="info-label">登录状态:</text>
<text class="info-value" :class="isLoggedIn ? 'status-ok' : 'status-error'">
{{ isLoggedIn ? '✅ 已登录' : '❌ 未登录' }}
</text>
</view>
<view class="info-item">
<text class="info-label">Token状态:</text>
<text class="info-value" :class="hasToken ? 'status-ok' : 'status-error'">
{{ hasToken ? '✅ 有效' : '❌ 无效' }}
</text>
</view>
<view class="info-item">
<text class="info-label">用户信息:</text>
<text class="info-value">{{ userName || '未获取' }}</text>
</view>
</view>
<view class="test-buttons">
<button class="test-btn" @click="testRedirectToLogin">测试跳转登录页</button>
<button class="test-btn" @click="testClearToken">清除Token测试</button>
<button class="test-btn" @click="testNavigateWithGuard">带守卫的页面跳转</button>
<button class="test-btn" @click="refreshPageInfo">刷新页面信息</button>
</view>
<view class="log-section">
<text class="section-title">📋 测试日志</text>
<scroll-view class="log-content" scroll-y>
<view
v-for="(log, index) in logs"
:key="index"
class="log-item"
:class="log.type"
>
<text class="log-time">{{ log.time }}</text>
<text class="log-text">{{ log.message }}</text>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue';
import { userStorage } from '@/utils/request';
import { userManager, userState } from '@/utils/user';
import { checkPageAccess, guardedNavigate } from '@/utils/route-guard';
export default {
name: 'TestRoutePage',
components: {
NavBar,
},
data() {
return {
currentTime: '',
isLoggedIn: false,
hasToken: false,
userName: '',
logs: [],
};
},
onLoad() {
this.addLog('info', '页面加载开始');
// 检查页面访问权限
if (!checkPageAccess()) {
this.addLog('error', '页面访问权限检查失败,应该会自动跳转到登录页');
return;
}
this.addLog('success', '页面访问权限检查通过');
this.refreshPageInfo();
},
onShow() {
this.addLog('info', '页面显示事件触发');
// 页面显示时再次检查权限
if (!checkPageAccess()) {
this.addLog('error', '页面显示时权限检查失败');
return;
}
this.addLog('success', '页面显示时权限检查通过');
this.updateCurrentTime();
},
onUnload() {
this.addLog('info', '页面卸载');
},
methods: {
// 刷新页面信息
refreshPageInfo() {
this.updateCurrentTime();
this.checkLoginStatus();
this.checkTokenStatus();
this.loadUserInfo();
this.addLog('info', '页面信息已刷新');
},
// 更新当前时间
updateCurrentTime() {
this.currentTime = new Date().toLocaleString();
},
// 检查登录状态
checkLoginStatus() {
this.isLoggedIn = userStorage.isLoggedIn();
this.addLog('info', `登录状态检查: ${this.isLoggedIn ? '已登录' : '未登录'}`);
},
// 检查Token状态
checkTokenStatus() {
const token = userStorage.getToken();
this.hasToken = !!token;
const isExpired = userState.checkTokenExpiration();
this.addLog('info', `Token检查: ${this.hasToken ? '存在' : '不存在'}`);
if (this.hasToken) {
this.addLog('info', `Token过期检查: ${isExpired ? '已过期' : '未过期'}`);
}
},
// 加载用户信息
loadUserInfo() {
const user = userManager.getCurrentUser();
this.userName = user ? user.nickName || user.userName : '';
this.addLog('info', `用户信息: ${this.userName || '未获取到'}`);
},
// 测试跳转到登录页
testRedirectToLogin() {
this.addLog('warning', '手动跳转到登录页测试');
uni.reLaunch({
url: '/pages/login/index',
});
},
// 测试清除Token
testClearToken() {
this.addLog('warning', '清除Token进行测试');
userStorage.clearLoginInfo();
this.addLog('error', 'Token已清除,页面应该会自动跳转到登录页');
// 模拟页面重新检查权限
setTimeout(() => {
if (!checkPageAccess()) {
this.addLog('success', '权限检查失败,正在跳转登录页');
}
}, 1000);
},
// 测试带守卫的页面跳转
testNavigateWithGuard() {
this.addLog('info', '测试带权限检查的页面跳转');
const result = guardedNavigate('/pages/profile/index');
if (result) {
this.addLog('success', '跳转成功');
} else {
this.addLog('error', '跳转失败或被拦截');
}
},
// 添加日志
addLog(type, message) {
const log = {
type,
time: new Date().toLocaleTimeString(),
message,
};
this.logs.unshift(log);
// 限制日志数量
if (this.logs.length > 20) {
this.logs.pop();
}
console.log(`[${type.toUpperCase()}] ${message}`);
},
},
};
</script>
<style lang="scss" scoped>
.test-page {
min-height: 100vh;
background-color: $uni-bg-color-grey;
}
.content {
padding: 16px;
}
.test-section {
background: $uni-bg-color;
border-radius: $uni-border-radius-lg;
padding: 20px;
margin-bottom: 16px;
text-align: center;
}
.section-title {
font-size: 18px;
font-weight: 600;
color: $uni-text-color;
display: block;
margin-bottom: 8px;
}
.section-desc {
font-size: 14px;
color: $uni-text-color-grey;
line-height: 1.5;
}
.test-info {
background: $uni-bg-color;
border-radius: $uni-border-radius-lg;
padding: 16px;
margin-bottom: 16px;
}
.info-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
border-bottom: 1px solid #f0f0f0;
&:last-child {
border-bottom: none;
}
}
.info-label {
font-size: 14px;
color: $uni-text-color-grey;
}
.info-value {
font-size: 14px;
color: $uni-text-color;
font-weight: 500;
&.status-ok {
color: #52c41a;
}
&.status-error {
color: #ff4d4f;
}
}
.test-buttons {
margin-bottom: 16px;
}
.test-btn {
width: 100%;
background: $uni-color-primary;
color: $uni-text-color-inverse;
border: none;
border-radius: $uni-border-radius-base;
padding: 12px;
margin-bottom: 8px;
font-size: 14px;
&:last-child {
margin-bottom: 0;
}
&:active {
background: $uni-color-primary-dark;
}
}
.log-section {
background: $uni-bg-color;
border-radius: $uni-border-radius-lg;
padding: 16px;
}
.log-content {
max-height: 300px;
margin-top: 12px;
}
.log-item {
padding: 8px 12px;
margin-bottom: 4px;
border-radius: $uni-border-radius-base;
border-left: 3px solid;
&.info {
background: #f0f9ff;
border-left-color: #0ea5e9;
}
&.success {
background: #f0f9f4;
border-left-color: #22c55e;
}
&.warning {
background: #fffbeb;
border-left-color: #f59e0b;
}
&.error {
background: #fef2f2;
border-left-color: #ef4444;
}
}
.log-time {
font-size: 12px;
color: $uni-text-color-grey;
margin-right: 8px;
}
.log-text {
font-size: 13px;
color: $uni-text-color;
line-height: 1.4;
}
</style>
@@ -1,209 +0,0 @@
<template>
<view class="test-page">
<view class="test-header">
<text class="test-title">uview-plus 图标问题分析与解决</text>
</view>
<!-- 问题演示 -->
<view class="test-section">
<text class="section-title">❌ 问题演示 - uview-plus图标异常</text>
<view class="test-items">
<view class="test-item">
<u-icon name="logout" size="24" color="#ff4d4f"></u-icon>
<text class="test-desc">logout图标 (可能显示文字)</text>
</view>
<view class="test-item">
<u-icon name="power" size="24" color="#ff4d4f"></u-icon>
<text class="test-desc">power图标 (可能显示文字)</text>
</view>
<view class="test-item">
<u-icon name="exit" size="24" color="#ff4d4f"></u-icon>
<text class="test-desc">exit图标 (可能显示文字)</text>
</view>
</view>
</view>
<!-- 正常工作的uview图标 -->
<view class="test-section">
<text class="section-title">✅ 正常工作 - uview-plus图标</text>
<view class="test-items">
<view class="test-item">
<u-icon name="account" size="24" color="#52c41a"></u-icon>
<text class="test-desc">account图标 (正常)</text>
</view>
<view class="test-item">
<u-icon name="home" size="24" color="#52c41a"></u-icon>
<text class="test-desc">home图标 (正常)</text>
</view>
<view class="test-item">
<u-icon name="setting" size="24" color="#52c41a"></u-icon>
<text class="test-desc">setting图标 (正常)</text>
</view>
</view>
</view>
<!-- 解决方案 - 使用iconfont -->
<view class="test-section">
<text class="section-title">🎯 解决方案 - 使用iconfont自定义图标</text>
<view class="test-items">
<view class="test-item">
<text class="iconfont icon-close solution-icon"></text>
<text class="test-desc">关闭图标 (退出登录)</text>
</view>
<view class="test-item">
<text class="iconfont icon-user solution-icon"></text>
<text class="test-desc">用户图标</text>
</view>
<view class="test-item">
<text class="iconfont icon-setting solution-icon"></text>
<text class="test-desc">设置图标</text>
</view>
</view>
</view>
<!-- Unicode字符方案 -->
<view class="test-section">
<text class="section-title">🔤 备选方案 - Unicode字符</text>
<view class="test-items">
<view class="test-item">
<text class="unicode-icon">⏻</text>
<text class="test-desc">电源符号 (退出登录)</text>
</view>
<view class="test-item">
<text class="unicode-icon">❌</text>
<text class="test-desc">关闭符号</text>
</view>
<view class="test-item">
<text class="unicode-icon">⚙️</text>
<text class="test-desc">设置符号</text>
</view>
</view>
</view>
<!-- 解决方案说明 -->
<view class="solution-section">
<text class="section-title">💡 解决方案说明</text>
<view class="solution-content">
<text class="solution-text">
1. **根本原因**: uview-plus某些图标名称在当前版本字体文件中不存在
</text>
<text class="solution-text">
2. **推荐方案**: 使用项目中的iconfont自定义图标系统
</text>
<text class="solution-text">
3. **备选方案**: 使用Unicode字符(⏻ ❌ ⚙️),兼容性最好
</text>
<text class="solution-text">
4. **长期方案**: 更新uview-plus字体文件或使用其他图标库
</text>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'UviewIconTest',
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.test-page {
min-height: 100vh;
background: #f8f9fa;
padding: 20px;
}
.test-header {
text-align: center;
margin-bottom: 32px;
}
.test-title {
display: block;
font-size: 20px;
font-weight: bold;
color: #333;
}
.test-section {
background: #fff;
border-radius: 12px;
padding: 20px;
margin-bottom: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.section-title {
display: block;
font-size: 16px;
font-weight: bold;
color: #333;
margin-bottom: 16px;
padding-bottom: 8px;
border-bottom: 1px solid #eee;
}
.test-items {
display: flex;
flex-direction: column;
gap: 12px;
}
.test-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
background: #fafbfc;
border-radius: 8px;
border: 1px solid #e9ecef;
}
.test-desc {
font-size: 14px;
color: #666;
}
.solution-icon {
font-size: 24px;
color: #1890ff;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.unicode-icon {
font-size: 24px;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.solution-section {
background: #fff7e6;
border: 1px solid #ffd591;
border-radius: 12px;
padding: 20px;
}
.solution-content {
display: flex;
flex-direction: column;
gap: 8px;
}
.solution-text {
display: block;
font-size: 14px;
color: #333;
line-height: 1.6;
}
</style>
File diff suppressed because it is too large. Load diff
-1
View File
@@ -1 +0,0 @@
+32 -40
View File
@@ -17,14 +17,19 @@
<view class="input-wrapper">
<u-input
v-model="username"
placeholder="账号"
placeholder="教工号/学号"
type="text"
border="true"
:custom-style="inputStyle"
placeholder-style="color: #999; font-size: 16px"
>
<template #prefix>
<text class="iconfont icon-user input-prefix-icon"></text>
<u-icon
name="account"
size="20"
color="#b0b8c9"
class="input-prefix-icon"
/>
</template>
</u-input>
</view>
@@ -40,7 +45,12 @@
@confirm="onPasswordConfirm"
>
<template #prefix>
<text class="iconfont icon-lock input-prefix-icon"></text>
<u-icon
name="lock"
size="20"
color="#b0b8c9"
class="input-prefix-icon"
/>
</template>
</u-input>
</view>
@@ -60,7 +70,7 @@
</view>
</u-button>
</view>
<!-- 测试按钮 -->
<!-- 测试按钮(可选) -->
<!-- <view style="margin-top: 16px; display: flex; flex-direction: column; gap: 8px">
<u-button text="测试加密功能" @click="testEncryption" type="info" size="small" />
<u-button text="测试Token存储" @click="testToken" type="warning" size="small" />
@@ -79,20 +89,20 @@
</template>
<script>
import { api, userStorage } from '@/utils/request';
import { runAllTests } from '@/utils/encrypt-test';
import { testTokenStorage, getCurrentTokenInfo, clearAllLoginInfo } from '@/utils/token-test';
import { api } from '@/common/request';
import { userStorage, tokenTest } from '@/common/storage';
import { validateKeyPair } from '@/common/crypto';
export default {
name: 'LoginPage',
data() {
return {
username: 'admin',
password: 'admin123',
username: '',
password: '',
loading: false,
tenantList: [],
tenantId: '000000',
// uview-plus 输入框样式
// uview-ui 输入框样式
inputStyle: {
height: '44px',
borderRadius: '8px',
@@ -102,7 +112,7 @@ export default {
color: '#222',
padding: '0 12px 0 12px',
},
// uview-plus 按钮样式
// uview-ui 按钮样式
buttonStyle: {
width: '100%',
height: '48px',
@@ -255,17 +265,6 @@ export default {
}
},
/**
* 表单输入处理
*/
onUsernameInput(value) {
this.username = value;
},
onPasswordInput(value) {
this.password = value;
},
/**
* 键盘回车事件
*/
@@ -281,7 +280,7 @@ export default {
try {
uni.showLoading({ title: '测试中...' });
const result = await runAllTests();
const result = validateKeyPair();
uni.hideLoading();
@@ -315,8 +314,8 @@ export default {
testToken() {
console.log('🧪 开始Token存储测试...');
const result = testTokenStorage();
getCurrentTokenInfo();
const result = tokenTest.testTokenStorage();
tokenTest.getCurrentTokenInfo();
uni.showToast({
title: result ? 'Token测试通过' : 'Token测试失败',
@@ -329,7 +328,7 @@ export default {
* 检查当前Token状态
*/
checkTokenStatus() {
const info = getCurrentTokenInfo();
const info = tokenTest.getCurrentTokenInfo();
const message = info
? `Token: ${info.hasToken ? '存在' : '无'} | 登录: ${info.isLoggedIn ? '是' : '否'}`
: 'Token检查失败';
@@ -345,7 +344,7 @@ export default {
* 清除登录信息
*/
clearLogin() {
clearAllLoginInfo();
tokenTest.clearAllLoginInfo();
uni.showToast({
title: '已清除登录信息',
icon: 'success',
@@ -369,12 +368,12 @@ export default {
align-items: center;
}
.login-card {
width: 90vw;
max-width: 350px;
width: 80vw;
max-width: 320px;
background: rgba(255, 255, 255, 0.85);
border-radius: 24px;
box-shadow: 0 8px 32px 0 rgba(93, 135, 255, 0.15);
padding: 36px 20px 24px 20px;
padding: 32px 24px 20px 24px;
display: flex;
flex-direction: column;
align-items: center;
@@ -418,25 +417,18 @@ export default {
gap: 16px;
}
/* uview-plus 输入框容器 */
/* uview-ui 输入框容器 */
.input-wrapper {
position: relative;
width: 100%;
}
/* uview-plus 输入框前缀图标 */
/* uview-ui 输入框前缀图标 */
.input-prefix-icon {
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
margin-right: 8px;
filter: brightness(0) saturate(100%) invert(67%) sepia(8%) saturate(1179%) hue-rotate(195deg)
brightness(95%) contrast(88%);
}
/* uview-plus 按钮内容布局 */
/* uview-ui 按钮内容布局 */
.login-btn-content {
display: flex;
align-items: center;
+865
View File
@@ -0,0 +1,865 @@
<template>
<view class="all-task-waiting-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 class="tabs-section">
<u-tabs
v-model="currentTab"
:list="tabList"
@change="changeTab"
active-color="#007aff"
inactive-color="#606266"
></u-tabs>
</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-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-node-name">任务:{{ item.nodeName }}</text>
<text class="task-applicant">申请人:{{ item.createByName }}</text>
<!-- 办理人信息 -->
<view class="assignee-info">
<text class="assignee-label">办理人:</text>
<view v-if="currentTab === 0" class="assignee-tags">
<template v-if="item.assigneeNames">
<text
v-for="(name, index) in item.assigneeNames.split(',')"
:key="index"
class="assignee-tag"
>
{{ name }}
</text>
</template>
<text v-else class="assignee-tag no-assignee">无</text>
</view>
<text v-else class="assignee-name">{{ item.approveName || '无' }}</text>
</view>
<!-- 任务状态(已办时显示) -->
<view v-if="currentTab === 1" class="task-status-info">
<text class="task-status-label">任务状态:</text>
<text class="task-status-value">
{{ getTaskStatusText(item.flowTaskStatus) }}
</text>
</view>
<text class="task-time">{{ formatTime(item.createTime) }}</text>
</view>
<!-- 操作按钮 -->
<view class="task-actions" @click.stop>
<!-- 待办任务操作 -->
<view v-if="currentTab === 0" class="action-row">
<u-button type="primary" size="mini" @click="handleView(item)">
查看
</u-button>
<u-button
type="warning"
size="mini"
@click="handleMeddle(item)"
style="margin-left: 8px"
>
流程干预
</u-button>
</view>
<!-- 已办任务操作 -->
<view v-else class="action-row">
<u-button type="info" size="mini" @click="handleView(item)">
查看
</u-button>
</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>
</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>
<!-- 流程干预弹窗 -->
<u-popup v-model="showMeddlePopup" mode="center" width="80%" border-radius="12">
<view class="meddle-popup">
<view class="popup-header">
<text class="popup-title">流程干预</text>
<u-icon name="close" size="20" color="#666" @click="closeMeddlePopup"></u-icon>
</view>
<view class="popup-content">
<text class="popup-tip">选择干预类型</text>
<view class="meddle-options">
<u-button type="warning" @click="handleMeddleAction('delegate')">
委托办理
</u-button>
<u-button
type="error"
@click="handleMeddleAction('reject')"
style="margin-top: 12px"
>
驳回申请
</u-button>
<u-button
type="info"
@click="handleMeddleAction('suspend')"
style="margin-top: 12px"
>
挂起流程
</u-button>
</view>
</view>
<view class="popup-actions">
<u-button @click="closeMeddlePopup">取消</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,
showMeddlePopup: false,
currentTab: 0,
tabList: [{ name: '待办任务' }, { name: '已办任务' }],
taskList: [],
total: 0,
hasMore: true,
// 用户筛选相关
userSelectCount: 0,
selectedUserIds: [],
userSearchKeyword: '',
searchUsers: [],
// 流程干预相关
currentMeddleTask: null,
queryParams: {
pageNum: 1,
pageSize: 10,
nodeName: '',
flowName: '',
flowCode: '',
createByIds: [],
},
};
},
onLoad() {
this.getWaitingList();
},
onReachBottom() {
if (this.hasMore && !this.loading) {
this.loadMore();
}
},
onPullDownRefresh() {
this.refreshData();
},
methods: {
async getWaitingList() {
if (this.loading) return;
this.loading = true;
try {
const res = await workflowApi.pageByAllTaskWait(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 getFinishList() {
if (this.loading) return;
this.loading = true;
try {
const res = await workflowApi.pageByAllTaskFinish(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();
}
},
changeTab(index) {
this.currentTab = index;
this.queryParams.pageNum = 1;
this.hasMore = true;
this.taskList = [];
if (index === 0) {
this.getWaitingList();
} else {
this.getFinishList();
}
},
async loadMore() {
if (!this.hasMore || this.loading) return;
this.queryParams.pageNum++;
if (this.currentTab === 0) {
await this.getWaitingList();
} else {
await this.getFinishList();
}
},
async refreshData() {
this.queryParams.pageNum = 1;
this.hasMore = true;
if (this.currentTab === 0) {
await this.getWaitingList();
} else {
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,
instanceId: item.instanceId,
});
},
handleMeddle(item) {
this.currentMeddleTask = item;
this.showMeddlePopup = true;
},
// 用户选择相关方法
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();
},
// 流程干预相关方法
closeMeddlePopup() {
this.showMeddlePopup = false;
this.currentMeddleTask = null;
},
handleMeddleAction(action) {
const actionMap = {
delegate: '委托办理',
reject: '驳回申请',
suspend: '挂起流程',
};
uni.showToast({
title: `${actionMap[action]}功能开发中`,
icon: 'none',
});
this.closeMeddlePopup();
},
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] || '未知';
},
getStatusStyle(status) {
return getStatusStyle(status);
},
formatTime(timeStr) {
return formatTime(timeStr);
},
routerJump(params) {
routerJump(params);
},
},
};
</script>
<style scoped>
.all-task-waiting-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;
}
.tabs-section {
background: #fff;
border-bottom: 1px solid #eee;
}
.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-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-tags {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
.assignee-tag {
background: #e6f7ff;
color: #1890ff;
padding: 2px 6px;
border-radius: 4px;
font-size: 12px;
}
.assignee-tag.no-assignee {
background: #f5f5f5;
color: #999;
}
.assignee-name {
font-size: 13px;
color: #666;
}
.task-status-info {
display: flex;
align-items: center;
margin-bottom: 4px;
}
.task-status-label {
font-size: 13px;
color: #666;
margin-right: 4px;
}
.task-status-value {
font-size: 13px;
color: #333;
font-weight: 500;
}
.task-time {
font-size: 12px;
color: #999;
}
.task-actions {
border-top: 1px solid #f0f0f0;
padding-top: 12px;
}
.action-row {
display: flex;
gap: 8px;
}
.pagination {
padding: 16px 20px;
}
.load-end {
text-align: center;
padding: 16px;
}
.load-end text {
font-size: 14px;
color: #999;
}
/* 弹窗样式 */
.user-selector-popup,
.meddle-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;
}
.meddle-options {
display: flex;
flex-direction: column;
gap: 12px;
}
.popup-actions {
display: flex;
justify-content: space-between;
gap: 12px;
padding-top: 12px;
border-top: 1px solid #eee;
}
</style>
+764
View File
@@ -0,0 +1,764 @@
<template>
<view class="my-document-container">
<!-- 头部标题和操作 -->
<view class="header">
<text class="title">我发起的流程</text>
<view class="header-actions">
<u-icon name="list" size="20" color="#666" @click="toggleCategory"></u-icon>
</view>
</view>
<!-- 搜索栏 -->
<view v-if="showSearch" class="search-section">
<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="selectedCategory && selectedCategory.id" class="selected-category">
<text class="category-label">当前分类:{{ getCategoryPath(selectedCategory) }}</text>
<text class="category-clear" @click="clearCategory">清除</text>
</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="processInstanceList.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="process-list">
<view
v-for="item in processInstanceList"
:key="item.id"
class="process-item"
@click="handleView(item)"
>
<!-- 流程信息 -->
<view class="process-header">
<view class="process-title-row">
<text class="process-name">{{ item.flowName }}</text>
<u-tag
:text="getStatusText(item.flowStatus)"
:type="getStatusType(item.flowStatus)"
plain
size="mini"
/>
</view>
<text class="process-time">{{ formatTime(item.createTime) }}</text>
</view>
<!-- 操作按钮 - 方案三:简洁卡片式 -->
<view class="process-actions-card" @click.stop>
<view class="action-card-content">
<view class="status-info">
<!-- 状态信息可以在这里添加 -->
</view>
<view class="quick-actions">
<view class="quick-btn view-btn" @click="handleView(item)">
<u-icon name="eye" size="18" color="#007aff"></u-icon>
</view>
<view
v-if="canEdit(item)"
class="quick-btn edit-btn"
@click="handleEdit(item)"
>
<u-icon name="edit-pen" size="18" color="#52c41a"></u-icon>
</view>
<view
v-if="item.flowStatus === 'waiting'"
class="quick-btn cancel-btn"
@click="handleCancel(item)"
>
<u-icon name="undo" size="18" color="#faad14"></u-icon>
</view>
<view
v-if="canDelete(item)"
class="quick-btn delete-btn"
@click="handleDelete(item)"
>
<u-icon name="close" size="18" color="#ff4d4f"></u-icon>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 分页加载 -->
<view v-if="processInstanceList.length > 0 && !loading" 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
:show="showCategory"
mode="right"
width="380px"
:safe-area-inset-bottom="false"
:safe-area-inset-top="false"
@close="showCategory = false"
>
<view class="category-popup">
<!-- 弹窗头部 -->
<view class="popup-header">
<text class="popup-title">选择分类</text>
<u-icon
name="close"
size="24"
color="#666"
@click="showCategory = false"
></u-icon>
</view>
<!-- 分类树 -->
<scroll-view scroll-y class="category-tree">
<view class="tree-content">
<!-- 全部选项 -->
<view
class="tree-item"
:class="{ active: !selectedCategory || !selectedCategory.id }"
@click="selectCategory({ id: '', label: '全部' })"
>
<text class="tree-item-text">全部</text>
</view>
<!-- 如果没有数据,显示提示 -->
<view
v-if="categoryTree.length === 0"
style="padding: 20px; text-align: center"
>
<text style="color: #999">暂无分类数据</text>
</view>
<!-- 渲染树形结构 -->
<tree-node
v-for="item in categoryTree"
:key="item.id"
:node="item"
:selected-id="selectedCategory && selectedCategory.id"
@select="selectCategory"
></tree-node>
</view>
</scroll-view>
</view>
</u-popup>
</view>
</template>
<script>
import { workflowApi, getStatusStyle, formatTime, routerJump } from '@/common/workflow-api.js';
import TreeNode from '@/components/TreeNode.vue';
export default {
components: {
TreeNode,
},
data() {
return {
loading: false,
showSearch: false,
showCategory: false,
processInstanceList: [],
categoryOptions: [],
categoryTree: [],
selectedCategory: null,
total: 0,
hasMore: true,
queryParams: {
pageNum: 1,
pageSize: 10,
flowCode: '',
category: '',
},
};
},
onLoad() {
this.initData();
},
onReachBottom() {
if (this.hasMore && !this.loading) {
this.loadMore();
}
},
onPullDownRefresh() {
this.refreshData();
},
methods: {
async initData() {
await this.loadCategoryTree();
await this.getList();
},
async loadCategoryTree() {
try {
console.log('开始加载分类树...');
const res = await workflowApi.categoryTree();
console.log('API返回数据:', res);
if (res.code === 200) {
// 过滤掉"全部"选项,只保留真正的树形数据
this.categoryOptions = res.data || [];
this.categoryTree = (res.data || []).filter((item) => item.id !== '');
console.log('原始数据:', this.categoryOptions);
console.log('过滤后的树数据:', this.categoryTree);
console.log('树数据长度:', this.categoryTree.length);
} else {
console.error('API返回错误:', res.msg);
uni.showToast({
title: res.msg || '加载分类失败',
icon: 'error',
});
}
} catch (e) {
console.error('加载分类失败:', e);
uni.showToast({
title: '网络错误',
icon: 'error',
});
}
},
async getList() {
if (this.loading) return;
this.loading = true;
try {
const res = await workflowApi.pageByCurrent(this.queryParams);
if (res.code === 200) {
if (this.queryParams.pageNum === 1) {
this.processInstanceList = res.rows || [];
} else {
this.processInstanceList.push(...(res.rows || []));
}
this.total = res.total;
this.hasMore = this.processInstanceList.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.getList();
},
async refreshData() {
this.queryParams.pageNum = 1;
this.hasMore = true;
await this.getList();
},
toggleSearch() {
this.showSearch = !this.showSearch;
},
toggleCategory() {
console.log('toggleCategory clicked, current showCategory:', this.showCategory);
this.showCategory = !this.showCategory;
console.log('toggleCategory after, showCategory:', this.showCategory);
},
selectCategory(category) {
this.selectedCategory = category;
this.queryParams.category = category.id;
this.showCategory = false; // 关闭弹窗
this.handleQuery();
},
clearCategory() {
this.selectedCategory = null;
this.queryParams.category = '';
this.handleQuery();
},
getCategoryPath(category) {
if (!category || !category.id) return '全部';
// 查找分类路径
const findPath = (nodes, targetId, path = []) => {
for (const node of nodes) {
const currentPath = [...path, node.label];
if (node.id === targetId) {
return currentPath;
}
if (node.children && node.children.length > 0) {
const childPath = findPath(node.children, targetId, currentPath);
if (childPath) return childPath;
}
}
return null;
};
const path = findPath(this.categoryTree, category.id);
return path ? path.join(' > ') : category.label;
},
handleQuery() {
this.queryParams.pageNum = 1;
this.hasMore = true;
this.getList();
},
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
flowCode: '',
category: '',
};
this.selectedCategory = null;
this.hasMore = true;
this.getList();
},
handleEdit(item) {
this.routerJump({
businessId: item.businessId,
taskId: item.id,
type: 'update',
formCustom: item.formCustom,
formPath: item.formPath,
});
},
handleView(item) {
this.routerJump({
businessId: item.businessId,
taskId: item.id,
type: 'view',
formCustom: item.formCustom,
formPath: item.formPath,
});
},
async handleDelete(item) {
try {
const res = await uni.showModal({
title: '确认删除',
content: '是否确认删除该流程?',
confirmText: '删除',
confirmColor: '#f56c6c',
});
if (res.confirm) {
this.loading = true;
const deleteRes = await workflowApi.deleteByInstanceIds([item.id]);
if (deleteRes.code === 200) {
uni.showToast({ title: '删除成功', icon: 'success' });
this.refreshData();
} else {
uni.showToast({ title: deleteRes.msg || '删除失败', icon: 'error' });
}
}
} catch (e) {
console.error('删除失败:', e);
uni.showToast({ title: '删除失败', icon: 'error' });
} finally {
this.loading = false;
}
},
async handleCancel(item) {
try {
const res = await uni.showModal({
title: '确认撤销',
content: '是否确认撤销该流程申请?',
confirmText: '撤销',
confirmColor: '#e6a23c',
});
if (res.confirm) {
this.loading = true;
const cancelData = {
businessId: item.businessId,
message: '申请人撤销流程!',
};
const cancelRes = await workflowApi.cancelProcessApply(cancelData);
if (cancelRes.code === 200) {
uni.showToast({ title: '撤销成功', icon: 'success' });
this.refreshData();
} else {
uni.showToast({ title: cancelRes.msg || '撤销失败', icon: 'error' });
}
}
} catch (e) {
console.error('撤销失败:', e);
uni.showToast({ title: '撤销失败', icon: 'error' });
} finally {
this.loading = false;
}
},
getStatusText(status) {
const statusMap = {
draft: '草稿',
waiting: '待审批',
complete: '已完成',
cancel: '已取消',
back: '已退回',
suspend: '挂起',
terminate: '终止',
};
return statusMap[status] || '未知';
},
getStatusStyle(status) {
return getStatusStyle(status);
},
getStatusType(status) {
const typeMap = {
draft: 'info',
waiting: 'warning',
complete: 'success',
cancel: 'info',
back: 'error',
suspend: 'warning',
terminate: 'error',
};
return typeMap[status] || 'info';
},
formatTime(timeStr) {
return formatTime(timeStr);
},
routerJump(params) {
routerJump(params);
},
canEdit(item) {
return item.flowStatus === 'draft' || item.flowStatus === 'back';
},
canDelete(item) {
return (
item.flowStatus === 'draft' ||
item.flowStatus === 'cancel' ||
item.flowStatus === 'back'
);
},
},
};
</script>
<style scoped>
.my-document-container {
background: #f5f5f5;
min-height: 100vh;
padding-bottom: 20px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 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;
}
.selected-category {
background: #fff;
padding: 12px 20px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
}
.category-label {
font-size: 14px;
color: #333;
flex: 1;
}
.category-clear {
font-size: 14px;
color: #007aff;
padding: 4px 8px;
}
.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;
}
.process-list {
padding: 16px 20px;
}
.process-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;
}
.process-item:active {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.process-header {
margin-bottom: 12px;
}
.process-title-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 8px;
}
.process-name {
font-size: 16px;
font-weight: 500;
color: #333;
flex: 1;
margin-right: 12px;
}
.process-time {
font-size: 12px;
color: #999;
}
/* 简洁卡片式样式 */
.process-actions-card {
border-radius: 12px;
}
.action-card-content {
display: flex;
justify-content: space-between;
align-items: center;
}
.status-info {
display: flex;
flex-direction: column;
gap: 4px;
}
.quick-actions {
display: flex;
gap: 8px;
align-items: center;
}
.quick-btn {
width: 36px;
height: 36px;
border-radius: 18px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
border: 1px solid transparent;
}
.quick-btn:active {
transform: scale(0.9);
}
.quick-btn.view-btn {
background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
border-color: #91d5ff;
}
.quick-btn.view-btn:active {
background: linear-gradient(135deg, #bae7ff 0%, #91d5ff 100%);
}
.quick-btn.edit-btn {
background: linear-gradient(135deg, #f6ffed 0%, #d9f7be 100%);
border-color: #b7eb8f;
}
.quick-btn.edit-btn:active {
background: linear-gradient(135deg, #d9f7be 0%, #b7eb8f 100%);
}
.quick-btn.cancel-btn {
background: linear-gradient(135deg, #fffbe6 0%, #fff1b8 100%);
border-color: #ffe58f;
}
.quick-btn.cancel-btn:active {
background: linear-gradient(135deg, #fff1b8 0%, #ffd666 100%);
}
.quick-btn.delete-btn {
background: linear-gradient(135deg, #fff2f0 0%, #ffe2e0 100%);
border-color: #ffccc7;
}
.quick-btn.delete-btn:active {
background: linear-gradient(135deg, #ffe2e0 0%, #ffccc7 100%);
}
.pagination {
padding: 16px 20px;
}
.load-end {
text-align: center;
padding: 16px;
}
.load-end text {
font-size: 14px;
color: #999;
}
/* 分类弹窗样式 */
.category-popup {
height: 100vh;
display: flex;
flex-direction: column;
background: #fff;
}
.popup-header {
padding: 16px 20px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
}
.popup-title {
font-size: 18px;
font-weight: 500;
color: #333;
}
.category-tree {
flex: 1;
height: 0;
}
.tree-content {
padding: 8px 0;
}
.tree-item {
padding: 12px 16px;
border-bottom: 1px solid #f0f0f0;
transition: background-color 0.2s;
}
.tree-item:active {
background-color: #f5f5f5;
}
.tree-item.active {
background-color: #e6f7ff;
border-left: 3px solid #007aff;
}
.tree-item-text {
font-size: 14px;
color: #333;
}
</style>
+434
View File
@@ -0,0 +1,434 @@
<template>
<view class="task-copy-container">
<!-- 头部标题和操作 -->
<view class="header">
<text class="title">我的抄送</text>
<view class="header-actions">
<u-icon name="search" size="20" color="#666" @click="toggleSearch"></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 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>
<!-- 抄送标识 -->
<view class="copy-info">
<u-icon name="email" size="16" color="#ff9500"></u-icon>
<text class="copy-label">抄送任务</text>
</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>
</view>
</template>
<script>
import { workflowApi, getStatusStyle, formatTime, routerJump } from '@/common/workflow-api.js';
export default {
data() {
return {
loading: false,
showSearch: false,
taskList: [],
total: 0,
hasMore: true,
queryParams: {
pageNum: 1,
pageSize: 10,
nodeName: '',
flowName: '',
flowCode: '',
},
};
},
onLoad() {
this.getTaskCopyList();
},
onReachBottom() {
if (this.hasMore && !this.loading) {
this.loadMore();
}
},
onPullDownRefresh() {
this.refreshData();
},
methods: {
async getTaskCopyList() {
if (this.loading) return;
this.loading = true;
try {
const res = await workflowApi.pageByTaskCopy(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.getTaskCopyList();
},
async refreshData() {
this.queryParams.pageNum = 1;
this.hasMore = true;
await this.getTaskCopyList();
},
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: '',
};
this.hasMore = true;
this.refreshData();
},
handleView(item) {
this.routerJump({
businessId: item.businessId,
taskId: item.id,
type: 'view',
formCustom: item.formCustom,
formPath: item.formPath,
});
},
getStatusText(status) {
const statusMap = {
draft: '草稿',
waiting: '待审批',
complete: '已完成',
cancel: '已取消',
back: '已退回',
suspend: '挂起',
terminate: '终止',
};
return statusMap[status] || '未知';
},
getStatusStyle(status) {
return getStatusStyle(status);
},
formatTime(timeStr) {
return formatTime(timeStr);
},
routerJump(params) {
routerJump(params);
},
},
};
</script>
<style scoped>
.task-copy-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;
}
.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;
/* 抄送任务特殊样式 */
border-left: 4px solid #ff9500;
}
.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 {
font-size: 13px;
color: #666;
margin-bottom: 4px;
}
.copy-info {
display: flex;
align-items: center;
margin-bottom: 4px;
}
.copy-label {
font-size: 13px;
color: #ff9500;
font-weight: 500;
margin-left: 4px;
}
.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;
}
</style>
+706
View File
@@ -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>
-167
View File
@@ -1,167 +0,0 @@
<template>
<view class="initiated-container">
<view class="header">
<text class="title">我发起的流程</text>
</view>
<view v-if="loading" class="loading">加载中...</view>
<view v-else-if="workflowList.length === 0" class="empty">
<text>暂无数据</text>
</view>
<view v-else class="workflow-list">
<view
v-for="item in workflowList"
:key="item.id"
class="workflow-item touchable"
@click="gotoDetail(item)"
>
<view class="workflow-header-info">
<view class="workflow-title-row">
<text class="workflow-title">{{ item.flowName }}</text>
<view class="workflow-status" :style="getStatusColor(item.flowStatus)">
<text class="status-text">{{ getStatusText(item.flowStatus) }}</text>
</view>
</view>
<text class="workflow-code">{{ item.flowCode }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import { workflowApi, formatTime } from '@/utils/workflow-api';
export default {
data() {
return {
workflowList: [],
loading: true,
};
},
onLoad() {
this.loadWorkflowData();
},
methods: {
async loadWorkflowData() {
this.loading = true;
try {
const res = await workflowApi.pageByCurrent({ pageNum: 1, pageSize: 20 });
if (res.code === 200) {
this.workflowList = res.rows || [];
} else {
uni.showToast({ title: res.msg || '加载失败', icon: 'error' });
}
} catch (e) {
uni.showToast({ title: '网络错误', icon: 'error' });
} finally {
this.loading = false;
}
},
gotoDetail(item) {
const params = [
`businessId=${encodeURIComponent(item.businessId)}`,
`taskId=${encodeURIComponent(item.id)}`,
`type=view`,
`formCustom=${encodeURIComponent(item.formCustom || '')}`,
`formPath=${encodeURIComponent(item.formPath || '')}`,
].join('&');
uni.navigateTo({
url: `/pages/workflow/process?${params}`,
});
},
getStatusText(status) {
const statusMap = {
draft: '草稿',
waiting: '待审批',
complete: '已完成',
cancel: '已取消',
back: '已退回',
suspend: '挂起',
terminate: '终止',
};
return statusMap[status] || '未知';
},
getStatusColor(status) {
const colorMap = {
draft: 'background-color: #909399; color: white',
waiting: 'background-color: #e6a23c; color: white',
complete: 'background-color: #67c23a; color: white',
cancel: 'background-color: #f56c6c; color: white',
back: 'background-color: #409eff; color: white',
suspend: 'background-color: #909399; color: white',
terminate: 'background-color: #f56c6c; color: white',
};
return colorMap[status] || colorMap.draft;
},
formatTime,
},
};
</script>
<style scoped>
.initiated-container {
padding: 20px;
background: #fff;
min-height: 100vh;
}
.header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 20px;
}
.title {
font-size: 20px;
font-weight: bold;
}
.loading {
text-align: center;
color: #999;
margin-top: 40px;
}
.empty {
text-align: center;
color: #bbb;
margin-top: 40px;
}
.workflow-list {
margin-top: 12px;
}
.workflow-item {
background: #f8f9fa;
border-radius: 8px;
padding: 16px;
margin-bottom: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
transition: box-shadow 0.2s;
}
.workflow-item:active {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.workflow-header-info {
margin-bottom: 8px;
}
.workflow-title-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 4px;
}
.workflow-title {
font-size: 16px;
font-weight: 500;
color: #333;
flex: 1;
margin-right: 12px;
}
.workflow-status {
padding: 2px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
white-space: nowrap;
}
.workflow-code {
font-size: 12px;
color: #888;
}
</style>
-117
View File
@@ -1,117 +0,0 @@
<template>
<view class="process-container">
<view class="header">
<text class="title">流程详情</text>
<text v-if="isViewMode" class="view-mode">(只读模式)</text>
</view>
<view v-if="loading" class="loading">加载中...</view>
<view v-else>
<u-form :disabled="isViewMode">
<u-form-item label="流程名称">
<u-input v-model="processDetail.flowName" disabled />
</u-form-item>
<u-form-item label="流程编码">
<u-input v-model="processDetail.flowCode" disabled />
</u-form-item>
<u-form-item label="分类">
<u-input v-model="processDetail.categoryName" disabled />
</u-form-item>
<u-form-item label="状态">
<u-input :value="processDetail.flowStatusName || statusText" disabled />
</u-form-item>
<u-form-item label="创建时间">
<u-input :value="formatTime(processDetail.createTime)" disabled />
</u-form-item>
<!-- 可扩展更多字段 -->
</u-form>
<view v-if="!isViewMode" class="actions">
<u-button type="primary" @click="handleSubmit">提交</u-button>
</view>
</view>
</view>
</template>
<script>
import { workflowApi, formatTime, getStatusStyle } from '@/utils/workflow-api';
export default {
data() {
return {
processDetail: {},
loading: true,
isViewMode: false,
};
},
computed: {
statusText() {
const statusMap = {
draft: '草稿',
waiting: '待审批',
complete: '已完成',
cancel: '已取消',
back: '已退回',
suspend: '挂起',
terminate: '终止',
};
return statusMap[this.processDetail.flowStatus] || '未知';
},
},
onLoad(options) {
this.isViewMode = options.type === 'view';
this.loadDetail(options);
},
methods: {
async loadDetail(options) {
this.loading = true;
try {
// 使用新接口获取详情
const res = await workflowApi.processDetail(options.businessId);
if (res.code === 200 && res.data) {
this.processDetail = res.data;
} else {
uni.showToast({ title: res.msg || '加载失败', icon: 'error' });
}
} catch (e) {
uni.showToast({ title: '网络错误', icon: 'error' });
} finally {
this.loading = false;
}
},
formatTime,
handleSubmit() {
uni.showToast({ title: '提交功能开发中', icon: 'none' });
},
},
};
</script>
<style scoped>
.process-container {
padding: 20px;
background: #fff;
min-height: 100vh;
}
.header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 20px;
}
.title {
font-size: 20px;
font-weight: bold;
}
.view-mode {
color: #909399;
font-size: 14px;
}
.loading {
text-align: center;
color: #999;
margin-top: 40px;
}
.actions {
margin-top: 32px;
display: flex;
justify-content: flex-end;
}
</style>