提交代码
This commit is contained in:
1 parent
d9f760fe1c
commit
01588bf87d
484 files changed
+7228
-104711
No files matched your search
@@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="visible"
|
||||
mode="center"
|
||||
width="90%"
|
||||
height="70%"
|
||||
border-radius="12"
|
||||
@close="handleClose"
|
||||
>
|
||||
<view class="approval-record-container">
|
||||
<view class="header">
|
||||
<text class="title">审批记录</text>
|
||||
<u-icon name="close" size="24" @click="handleClose" />
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<u-loading-page v-if="loading" />
|
||||
<view v-else-if="recordList.length === 0" class="empty">
|
||||
<u-icon name="info-circle" size="48" color="#ccc" />
|
||||
<text class="empty-text">暂无审批记录</text>
|
||||
</view>
|
||||
<scroll-view v-else scroll-y class="record-list">
|
||||
<view v-for="(record, index) in recordList" :key="index" class="record-item">
|
||||
<view class="record-header">
|
||||
<view class="approver-info">
|
||||
<u-avatar
|
||||
:src="record.avatar || '/static/images/default-avatar.png'"
|
||||
size="60"
|
||||
/>
|
||||
<view class="approver-details">
|
||||
<text class="approver-name">
|
||||
{{ record.approverName || '未知' }}
|
||||
</text>
|
||||
<text class="approver-role">
|
||||
{{ record.roleName || '未知角色' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view :class="['status-badge', getStatusClass(record.result)]">
|
||||
{{ getStatusText(record.result) }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="record.comment" class="comment">
|
||||
<text class="comment-label">审批意见:</text>
|
||||
<text class="comment-text">{{ record.comment }}</text>
|
||||
</view>
|
||||
|
||||
<view class="record-footer">
|
||||
<text class="time">{{ formatTime(record.createTime) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request } from '@/common/request.js';
|
||||
|
||||
export default {
|
||||
name: 'ApprovalRecord',
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
loading: false,
|
||||
recordList: [],
|
||||
currentBusinessId: '',
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 打开弹窗
|
||||
async init(businessId) {
|
||||
this.currentBusinessId = businessId.toString();
|
||||
this.visible = true;
|
||||
await this.loadApprovalRecords();
|
||||
},
|
||||
|
||||
// 关闭弹窗
|
||||
handleClose() {
|
||||
this.visible = false;
|
||||
this.recordList = [];
|
||||
},
|
||||
|
||||
// 加载审批记录
|
||||
async loadApprovalRecords() {
|
||||
if (!this.currentBusinessId) return;
|
||||
|
||||
try {
|
||||
this.loading = true;
|
||||
|
||||
const response = await request({
|
||||
url: `/workflow/task/approvalRecords/${this.currentBusinessId}`,
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (response.code === 200) {
|
||||
this.recordList = response.data || [];
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: response.msg || '获取审批记录失败',
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取审批记录失败:', error);
|
||||
uni.showToast({
|
||||
title: '获取审批记录失败',
|
||||
icon: 'none',
|
||||
});
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
// 获取状态样式类
|
||||
getStatusClass(result) {
|
||||
switch (result) {
|
||||
case 'approve':
|
||||
return 'status-approve';
|
||||
case 'reject':
|
||||
return 'status-reject';
|
||||
default:
|
||||
return 'status-pending';
|
||||
}
|
||||
},
|
||||
|
||||
// 获取状态文本
|
||||
getStatusText(result) {
|
||||
switch (result) {
|
||||
case 'approve':
|
||||
return '同意';
|
||||
case 'reject':
|
||||
return '拒绝';
|
||||
default:
|
||||
return '待审批';
|
||||
}
|
||||
},
|
||||
|
||||
// 格式化时间
|
||||
formatTime(time) {
|
||||
if (!time) return '-';
|
||||
return new Date(time).toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.approval-record-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
padding: 60rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.record-list {
|
||||
height: 100%;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.record-item {
|
||||
background: #f8f9fa;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.record-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.approver-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.approver-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.approver-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.approver-role {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-approve {
|
||||
background: #e8f5e8;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.status-reject {
|
||||
background: #fff2f0;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background: #fff7e6;
|
||||
color: #fa8c16;
|
||||
}
|
||||
|
||||
.comment {
|
||||
margin-bottom: 16rpx;
|
||||
padding: 16rpx;
|
||||
background: #fff;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.comment-label {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.comment-text {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.record-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user