任务中心迁移完成
This commit is contained in:
@@ -2,16 +2,71 @@
|
||||
<view class="detail-container">
|
||||
<view v-if="loading" class="loading"><u-loading mode="circle" text="加载中..." /></view>
|
||||
<view v-else-if="taskDetail">
|
||||
<!-- 任务标题 -->
|
||||
<view class="title">{{ taskDetail.taskTitle }}</view>
|
||||
<view class="row"><text class="label">负责人:</text>{{ taskDetail.workerNickName || '-' }}</view>
|
||||
<view class="row"><text class="label">开始时间:</text>{{ taskDetail.beginTime || '-' }}</view>
|
||||
<view class="row"><text class="label">结束时间:</text>{{ taskDetail.finishTime || '-' }}</view>
|
||||
<view class="row"><text class="label">创建人:</text>{{ taskDetail.createUserNickName || '-' }}</view>
|
||||
<view class="row"><text class="label">创建时间:</text>{{ taskDetail.createTime || '-' }}</view>
|
||||
|
||||
<!-- 基本信息 -->
|
||||
<view class="section-title">基本信息</view>
|
||||
<view class="info-grid">
|
||||
<view class="info-item">
|
||||
<text class="label">任务状态:</text>
|
||||
<text class="value status-tag" :class="getStatusClass(taskDetail.state)">
|
||||
{{ getStatusText(taskDetail.state) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">优先级:</text>
|
||||
<text class="value priority-tag" :class="getPriorityClass(taskDetail.taskRank)">
|
||||
{{ getPriorityText(taskDetail.taskRank) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">负责人:</text>
|
||||
<text class="value">{{ taskDetail.workerNickName || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">创建人:</text>
|
||||
<text class="value">{{ taskDetail.createUserNickName || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">所属项目:</text>
|
||||
<text class="value">{{ taskDetail.projectName || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 时间信息 -->
|
||||
<view class="section-title">时间信息</view>
|
||||
<view class="info-grid">
|
||||
<view class="info-item">
|
||||
<text class="label">开始时间:</text>
|
||||
<text class="value">{{ formatDate(taskDetail.beginTime) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">结束时间:</text>
|
||||
<text class="value">{{ formatDate(taskDetail.finishTime) }}</text>
|
||||
</view>
|
||||
<view class="info-item" v-if="taskDetail.overDays > 0">
|
||||
<text class="label">超期天数:</text>
|
||||
<text class="value over-days">{{ taskDetail.overDays }}天</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">创建时间:</text>
|
||||
<text class="value">{{ formatDate(taskDetail.createTime) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 任务描述 -->
|
||||
<view class="section-title">任务描述</view>
|
||||
<mp-html v-if="taskDetail.content" :content="taskDetail.content" />
|
||||
<view class="section-title">报工进度</view>
|
||||
<view v-if="taskDetail.taskItemVoList && taskDetail.taskItemVoList.length">
|
||||
<view v-if="taskDetail.content" class="content-text">{{ taskDetail.content }}</view>
|
||||
<view v-else class="empty-content">暂无任务描述</view>
|
||||
|
||||
<!-- 备注 -->
|
||||
<view v-if="taskDetail.remark" class="section-title">备注</view>
|
||||
<view v-if="taskDetail.remark" class="content-text">{{ taskDetail.remark }}</view>
|
||||
|
||||
<!-- 报工进度(仅报工任务显示) -->
|
||||
<view v-if="isReportTask" class="section-title">报工进度</view>
|
||||
<view v-if="isReportTask && taskDetail.taskItemVoList && taskDetail.taskItemVoList.length">
|
||||
<view v-for="item in taskDetail.taskItemVoList" :key="item.itemId" class="item-block">
|
||||
<view class="item-row"><text class="item-label">进度时间:</text>{{ item.signTime || '-' }}</view>
|
||||
<view class="item-row"><text class="item-label">进度区间:</text>{{ item.beginTime || '-' }} ~ {{ item.endTime || '-' }}</view>
|
||||
@@ -20,11 +75,40 @@
|
||||
<view class="item-row"><text class="item-label">完成时间:</text>{{ item.completedTime || '-' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="empty-progress">暂无报工进度</view>
|
||||
<view v-if="isReportTask && (!taskDetail.taskItemVoList || taskDetail.taskItemVoList.length === 0)" class="empty-progress">
|
||||
暂无报工进度
|
||||
</view>
|
||||
|
||||
<u-button type="primary" class="add-btn" @click="openAddPopup">新增报工</u-button>
|
||||
<!-- 附件展示 -->
|
||||
<view v-if="taskDetail.accessory" class="section-title">附件</view>
|
||||
<view v-if="taskDetail.accessory" class="attachment-list">
|
||||
<view
|
||||
v-for="(file, index) in attachmentFiles"
|
||||
:key="`${file.ossId}_${index}`"
|
||||
class="attachment-item"
|
||||
@click="downloadFile(file)"
|
||||
>
|
||||
<view class="file-icon">
|
||||
<u-icon :name="getFileIcon(file.originalName)" size="24" color="#007aff"></u-icon>
|
||||
</view>
|
||||
<view class="file-info">
|
||||
<text class="file-name">{{ getFileName(file.originalName) }}</text>
|
||||
<text class="file-size">{{ formatFileSize(file.fileSize) }}</text>
|
||||
</view>
|
||||
<view class="file-action">
|
||||
<u-icon name="download" size="20" color="#007aff"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="taskDetail.accessory && attachmentFiles.length === 0" class="no-attachment">
|
||||
暂无附件
|
||||
</view>
|
||||
|
||||
<uni-popup ref="addPopup" type="bottom" :mask-click="true">
|
||||
<!-- 新增报工按钮(仅报工任务显示) -->
|
||||
<u-button v-if="isReportTask" type="primary" class="add-btn" @click="openAddPopup">新增报工</u-button>
|
||||
|
||||
<!-- 新增报工弹窗(仅报工任务显示) -->
|
||||
<uni-popup v-if="isReportTask" ref="addPopup" type="bottom" :mask-click="true">
|
||||
<view class="add-dialog-bottom">
|
||||
<view class="dialog-title">新增报工</view>
|
||||
<u-form :model="addForm" ref="addFormRef">
|
||||
@@ -58,6 +142,7 @@
|
||||
<script>
|
||||
import { getTask } from '@/api/oa/task.js'
|
||||
import { addOaTaskItem } from '@/api/oa/taskItem.js'
|
||||
import { getFilesByIds } from '@/api/common/upload.js'
|
||||
import mpHtml from 'uni_modules/mp-html/components/mp-html/mp-html.vue'
|
||||
|
||||
export default {
|
||||
@@ -66,6 +151,7 @@ export default {
|
||||
return {
|
||||
taskDetail: null,
|
||||
loading: true,
|
||||
attachmentFiles: [],
|
||||
addForm: {
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
@@ -74,6 +160,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 判断是否为报工任务
|
||||
isReportTask() {
|
||||
return this.taskDetail && this.taskDetail.status == 1
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
const taskId = options.id
|
||||
if (taskId) {
|
||||
@@ -90,6 +182,13 @@ export default {
|
||||
const res = await getTask(taskId)
|
||||
if (res.code === 200 && res.data) {
|
||||
this.taskDetail = res.data
|
||||
|
||||
// 加载附件信息
|
||||
if (res.data.accessory) {
|
||||
await this.loadAttachmentFiles(res.data.accessory)
|
||||
} else {
|
||||
this.attachmentFiles = []
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '获取详情失败', icon: 'none' })
|
||||
}
|
||||
@@ -157,6 +256,153 @@ export default {
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
// 加载附件文件信息
|
||||
async loadAttachmentFiles(accessory) {
|
||||
try {
|
||||
const ossIds = accessory.split(',').filter(id => id.trim())
|
||||
if (ossIds.length > 0) {
|
||||
const files = await getFilesByIds(ossIds)
|
||||
this.attachmentFiles = files || []
|
||||
} else {
|
||||
this.attachmentFiles = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载附件失败:', error)
|
||||
this.attachmentFiles = []
|
||||
}
|
||||
},
|
||||
|
||||
// 下载文件
|
||||
downloadFile(file) {
|
||||
// 使用uni.downloadFile下载文件
|
||||
uni.downloadFile({
|
||||
url: file.url,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
// 保存文件到本地
|
||||
uni.saveFile({
|
||||
tempFilePath: res.tempFilePath,
|
||||
success: (saveRes) => {
|
||||
uni.showToast({
|
||||
title: '文件已保存到本地',
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('保存文件失败:', err)
|
||||
uni.showToast({
|
||||
title: '保存文件失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('下载文件失败:', err)
|
||||
uni.showToast({
|
||||
title: '下载文件失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 获取文件图标
|
||||
getFileIcon(fileName) {
|
||||
const ext = fileName.split('.').pop().toLowerCase()
|
||||
const iconMap = {
|
||||
'pdf': 'file-text',
|
||||
'doc': 'file-text',
|
||||
'docx': 'file-text',
|
||||
'xls': 'file-text',
|
||||
'xlsx': 'file-text',
|
||||
'ppt': 'file-text',
|
||||
'pptx': 'file-text',
|
||||
'txt': 'file-text',
|
||||
'jpg': 'image',
|
||||
'jpeg': 'image',
|
||||
'png': 'image',
|
||||
'gif': 'image',
|
||||
'zip': 'folder',
|
||||
'rar': 'folder',
|
||||
'7z': 'folder',
|
||||
'dwg': 'file-text'
|
||||
}
|
||||
return iconMap[ext] || 'file-text'
|
||||
},
|
||||
|
||||
// 获取文件名
|
||||
getFileName(fileName) {
|
||||
if (!fileName) return ''
|
||||
return fileName.includes('/') ? fileName.split('/').pop() : fileName
|
||||
},
|
||||
|
||||
// 格式化文件大小
|
||||
formatFileSize(size) {
|
||||
if (!size) return ''
|
||||
if (size < 1024) {
|
||||
return size + 'B'
|
||||
} else if (size < 1024 * 1024) {
|
||||
return (size / 1024).toFixed(2) + 'KB'
|
||||
} else {
|
||||
return (size / (1024 * 1024)).toFixed(2) + 'MB'
|
||||
}
|
||||
},
|
||||
|
||||
// 格式化日期
|
||||
formatDate(dateStr) {
|
||||
if (!dateStr) return '未设置'
|
||||
const date = new Date(dateStr)
|
||||
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
|
||||
},
|
||||
|
||||
// 获取状态文本
|
||||
getStatusText(state) {
|
||||
const statusMap = {
|
||||
15: '申请延期',
|
||||
0: '进行中',
|
||||
1: '完成等待评分',
|
||||
2: '完成'
|
||||
}
|
||||
return statusMap[state] || '未知状态'
|
||||
},
|
||||
|
||||
// 获取状态样式类
|
||||
getStatusClass(state) {
|
||||
const classMap = {
|
||||
15: 'status-pending',
|
||||
0: 'status-processing',
|
||||
1: 'status-waiting',
|
||||
2: 'status-completed'
|
||||
}
|
||||
return classMap[state] || 'status-unknown'
|
||||
},
|
||||
|
||||
// 获取优先级文本
|
||||
getPriorityText(priority) {
|
||||
const priorityMap = {
|
||||
0: '普通',
|
||||
1: '低',
|
||||
2: '中',
|
||||
3: '高',
|
||||
4: '紧急'
|
||||
}
|
||||
return priorityMap[priority] || '未设置'
|
||||
},
|
||||
|
||||
// 获取优先级样式类
|
||||
getPriorityClass(priority) {
|
||||
const classMap = {
|
||||
0: 'priority-normal',
|
||||
1: 'priority-low',
|
||||
2: 'priority-medium',
|
||||
3: 'priority-high',
|
||||
4: 'priority-urgent'
|
||||
}
|
||||
return classMap[priority] || 'priority-unknown'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,4 +482,167 @@ export default {
|
||||
color: #333;
|
||||
padding: 12rpx 0 12rpx 8rpx;
|
||||
}
|
||||
|
||||
.attachment-list {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.attachment-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.attachment-item:hover {
|
||||
background-color: #e9ecef;
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.file-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.file-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.file-size {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.file-action {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.no-attachment {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.info-item .label {
|
||||
color: #666;
|
||||
width: 160rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-item .value {
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.content-text {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
background-color: #f8f9fa;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
border-left: 4rpx solid #1890ff;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-content {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
padding: 40rpx 0;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background-color: #fff2e8;
|
||||
color: #fa8c16;
|
||||
}
|
||||
|
||||
.status-processing {
|
||||
background-color: #e6f7ff;
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
.status-waiting {
|
||||
background-color: #fff7e6;
|
||||
color: #fa8c16;
|
||||
}
|
||||
|
||||
.status-completed {
|
||||
background-color: #f6ffed;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.priority-tag {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.priority-normal {
|
||||
background-color: #f5f5f5;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.priority-low {
|
||||
background-color: #f6ffed;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.priority-medium {
|
||||
background-color: #fff7e6;
|
||||
color: #fa8c16;
|
||||
}
|
||||
|
||||
.priority-high {
|
||||
background-color: #fff2f0;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
|
||||
.priority-urgent {
|
||||
background-color: #f9f0ff;
|
||||
color: #722ed1;
|
||||
}
|
||||
|
||||
.over-days {
|
||||
color: #ff4d4f;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user