任务中心迁移完成
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { getToken } from '@/util/auth'
|
import { getToken } from '@/util/auth'
|
||||||
|
import request from "@/util/oaRequest"
|
||||||
|
|
||||||
const BASE_URL = 'http://110.41.139.73:8080'
|
const BASE_URL = 'http://110.41.139.73:8080'
|
||||||
|
|
||||||
@@ -35,3 +36,190 @@ export function uploadImage(filePath) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传API
|
||||||
|
* @param {Object} file - 文件对象
|
||||||
|
* @param {string} file.path - 文件路径
|
||||||
|
* @param {string} file.name - 文件名
|
||||||
|
* @param {number} file.size - 文件大小
|
||||||
|
* @param {string} file.type - 文件类型
|
||||||
|
* @param {Object} options - 上传选项
|
||||||
|
* @param {Array} options.allowedTypes - 允许的文件类型扩展名数组
|
||||||
|
* @param {number} options.maxSize - 最大文件大小(MB)
|
||||||
|
* @param {number} options.extraData - 额外数据,默认为1
|
||||||
|
* @returns {Promise} 返回上传结果 { ossId, url, fileName, originalName }
|
||||||
|
*/
|
||||||
|
export function uploadFile(file, options = {}) {
|
||||||
|
const {
|
||||||
|
allowedTypes = ['doc', 'xls', 'ppt', 'txt', 'pdf', 'docx', 'xlsx', 'png', 'jpg', 'jpeg', 'zip', 'rar', '7z', 'dwg'],
|
||||||
|
maxSize = 200, // 默认200MB
|
||||||
|
extraData = 1
|
||||||
|
} = options
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// 文件类型验证
|
||||||
|
const ext = file.name.split('.').pop().toLowerCase()
|
||||||
|
if (allowedTypes && !allowedTypes.includes(ext)) {
|
||||||
|
reject(new Error(`文件格式不正确,请上传${allowedTypes.join('/')}格式文件!`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文件大小验证
|
||||||
|
if (maxSize && file.size / 1024 / 1024 > maxSize) {
|
||||||
|
reject(new Error(`上传文件大小不能超过 ${maxSize} MB!`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证文件路径
|
||||||
|
if (!file.path) {
|
||||||
|
reject(new Error('文件路径为空'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[uploadFile] 开始上传文件:', {
|
||||||
|
name: file.name,
|
||||||
|
size: file.size,
|
||||||
|
path: file.path,
|
||||||
|
type: file.type
|
||||||
|
})
|
||||||
|
|
||||||
|
// 处理文件路径(安卓平台)
|
||||||
|
let filePath = file.path
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (typeof plus !== 'undefined' && plus.io) {
|
||||||
|
if (!filePath.startsWith('/') && !filePath.startsWith('file://')) {
|
||||||
|
filePath = plus.io.convertLocalFileSystemURL(filePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
uni.uploadFile({
|
||||||
|
url: BASE_URL + '/system/oss/upload',
|
||||||
|
filePath,
|
||||||
|
name: 'file',
|
||||||
|
formData: {
|
||||||
|
isPublic: extraData
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + getToken()
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
console.log('[uploadFile] 上传响应:', res)
|
||||||
|
try {
|
||||||
|
const data = typeof res.data === 'string' ? JSON.parse(res.data) : res.data
|
||||||
|
if (data.code === 200) {
|
||||||
|
console.log('[uploadFile] 上传成功:', data.data)
|
||||||
|
resolve({
|
||||||
|
ossId: data.data.ossId,
|
||||||
|
url: data.data.url,
|
||||||
|
fileName: data.data.fileName,
|
||||||
|
originalName: file.name
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.error('[uploadFile] 上传失败:', data)
|
||||||
|
reject(data.msg || '上传失败')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[uploadFile] 解析返回数据失败:', e, res.data)
|
||||||
|
reject('上传返回格式错误')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('[uploadFile] 上传接口调用失败:', err)
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量上传文件
|
||||||
|
* @param {Array} files - 文件数组
|
||||||
|
* @param {Object} options - 上传选项
|
||||||
|
* @returns {Promise} 返回上传结果数组
|
||||||
|
*/
|
||||||
|
export function uploadFiles(files, options = {}) {
|
||||||
|
const {
|
||||||
|
allowedTypes = ['doc', 'xls', 'ppt', 'txt', 'pdf', 'docx', 'xlsx', 'png', 'jpg', 'jpeg', 'zip', 'rar', '7z', 'dwg'],
|
||||||
|
maxSize = 200,
|
||||||
|
extraData = 1,
|
||||||
|
onProgress = null
|
||||||
|
} = options
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!files || files.length === 0) {
|
||||||
|
resolve([])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = []
|
||||||
|
let completedCount = 0
|
||||||
|
let hasError = false
|
||||||
|
|
||||||
|
files.forEach((file, index) => {
|
||||||
|
uploadFile(file, { allowedTypes, maxSize, extraData })
|
||||||
|
.then(result => {
|
||||||
|
results[index] = result
|
||||||
|
completedCount++
|
||||||
|
|
||||||
|
// 调用进度回调
|
||||||
|
if (onProgress) {
|
||||||
|
onProgress({
|
||||||
|
index,
|
||||||
|
file,
|
||||||
|
result,
|
||||||
|
progress: (completedCount / files.length) * 100
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 所有文件上传完成
|
||||||
|
if (completedCount === files.length && !hasError) {
|
||||||
|
resolve(results)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
hasError = true
|
||||||
|
console.error(`文件 ${file.name} 上传失败:`, error)
|
||||||
|
reject(new Error(`文件 "${file.name}" 上传失败: ${error.message || error}`))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据OSS ID列表获取文件信息
|
||||||
|
* @param {Array} ossIds - OSS ID数组
|
||||||
|
* @returns {Promise} 返回文件信息数组
|
||||||
|
*/
|
||||||
|
// 查询OSS对象基于id串
|
||||||
|
export function listByIds(ossId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/oss/listByIds/' + ossId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据OSS ID列表获取文件信息
|
||||||
|
* @param {Array} ossIds - OSS ID数组
|
||||||
|
* @returns {Promise} 返回文件信息数组
|
||||||
|
*/
|
||||||
|
export function getFilesByIds(ossIds) {
|
||||||
|
if (!ossIds || ossIds.length === 0) {
|
||||||
|
return Promise.resolve([])
|
||||||
|
}
|
||||||
|
|
||||||
|
const ossIdString = Array.isArray(ossIds) ? ossIds.join(',') : ossIds
|
||||||
|
|
||||||
|
return request({
|
||||||
|
url: '/system/oss/listByIds/' + ossIdString,
|
||||||
|
method: 'get'
|
||||||
|
}).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
return response.data || []
|
||||||
|
} else {
|
||||||
|
throw new Error(response.msg || '获取文件信息失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
375
pages/workbench/task/components/TaskList.vue
Normal file
375
pages/workbench/task/components/TaskList.vue
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
<template>
|
||||||
|
<view class="task-list-container">
|
||||||
|
<!-- 任务列表 -->
|
||||||
|
<view class="task-list">
|
||||||
|
<uni-swipe-action>
|
||||||
|
<uni-swipe-action-item
|
||||||
|
v-for="(task, index) in taskList"
|
||||||
|
:key="task.taskId"
|
||||||
|
:right-options="getSwipeOptions(task)"
|
||||||
|
@click="handleSwipeClick($event, index)"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="task-item"
|
||||||
|
@click="handleTaskClick(task)"
|
||||||
|
>
|
||||||
|
<!-- 任务完成checkbox -->
|
||||||
|
<view v-if="config.showCheckbox && task.status === 0" class="task-checkbox">
|
||||||
|
<view v-if="task.state === 0" class="checkbox-container" @click.stop="handleTaskComplete(task)">
|
||||||
|
<view
|
||||||
|
class="custom-checkbox"
|
||||||
|
:class="{ 'checked': checkboxStates[task.taskId] }"
|
||||||
|
>
|
||||||
|
<uni-icons
|
||||||
|
v-if="checkboxStates[task.taskId]"
|
||||||
|
type="checkmarkempty"
|
||||||
|
size="16"
|
||||||
|
color="#fff"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="task.state === 1" class="checkbox-container">
|
||||||
|
<uni-icons type="checkmarkempty" size="20" color="#999"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="task.state === 2" class="checkbox-container">
|
||||||
|
<uni-icons type="checkmarkempty" size="20" color="#52c41a"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view v-else class="checkbox-container">
|
||||||
|
<view class="custom-checkbox disabled">
|
||||||
|
<uni-icons type="checkmarkempty" size="16" color="#999"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 任务内容 -->
|
||||||
|
<view class="task-content">
|
||||||
|
<view class="task-title">{{ task.taskTitle || '未命名任务' }}</view>
|
||||||
|
<view class="task-status" :class="getStatusClass(task.state)">
|
||||||
|
{{ getStatusText(task.state) }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 置顶标识 -->
|
||||||
|
<view v-if="task.ownRank === 1" class="top-badge">
|
||||||
|
<uni-icons type="arrow-up" size="12" color="#ff9500"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-swipe-action-item>
|
||||||
|
</uni-swipe-action>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 空状态 -->
|
||||||
|
<view v-if="taskList.length === 0 && !loading" class="empty-state">
|
||||||
|
<u-empty :text="config.emptyText || '暂无任务'" mode="list"></u-empty>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 加载更多 -->
|
||||||
|
<u-load-more
|
||||||
|
:status="loadMoreStatus"
|
||||||
|
@loadmore="$emit('loadMore')"
|
||||||
|
></u-load-more>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'TaskList',
|
||||||
|
props: {
|
||||||
|
// 任务列表数据
|
||||||
|
taskList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
// 加载状态
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 加载更多状态
|
||||||
|
loadMoreStatus: {
|
||||||
|
type: String,
|
||||||
|
default: 'more' // more, loading, noMore
|
||||||
|
},
|
||||||
|
// 配置对象
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
showCheckbox: true, // 是否显示checkbox
|
||||||
|
canComplete: true, // 是否可以完成任务
|
||||||
|
canDelete: true, // 是否可以删除任务
|
||||||
|
canTop: true, // 是否可以置顶任务
|
||||||
|
emptyText: '暂无任务', // 空状态文本
|
||||||
|
detailPage: '/pages/workbench/task/reportTaskDetail' // 详情页面路径
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
checkboxStates: {} // 存储checkbox的状态
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
// 获取左划操作选项
|
||||||
|
getSwipeOptions(task) {
|
||||||
|
const options = []
|
||||||
|
|
||||||
|
// 置顶功能
|
||||||
|
if (this.config.canTop) {
|
||||||
|
if (task.ownRank === 1) {
|
||||||
|
// 已置顶,显示取消置顶
|
||||||
|
options.push({
|
||||||
|
text: '取消置顶',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#999',
|
||||||
|
color: '#fff'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 未置顶,显示置顶
|
||||||
|
options.push({
|
||||||
|
text: '置顶',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#ff9500',
|
||||||
|
color: '#fff'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除功能
|
||||||
|
if (this.config.canDelete) {
|
||||||
|
options.push({
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#ff4757',
|
||||||
|
color: '#fff'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理左划操作点击
|
||||||
|
handleSwipeClick(e, index) {
|
||||||
|
const { content, position } = e
|
||||||
|
|
||||||
|
if (!content) {
|
||||||
|
console.error('Invalid swipe event:', e)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const task = this.taskList[index]
|
||||||
|
if (!task) {
|
||||||
|
console.error('Task not found at index:', index)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content.text === '置顶') {
|
||||||
|
this.$emit('setTaskTop', task, 1)
|
||||||
|
} else if (content.text === '取消置顶') {
|
||||||
|
this.$emit('setTaskTop', task, 0)
|
||||||
|
} else if (content.text === '删除') {
|
||||||
|
this.$emit('deleteTask', task)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理任务完成
|
||||||
|
handleTaskComplete(task) {
|
||||||
|
if (!this.config.canComplete) return
|
||||||
|
|
||||||
|
console.log('handleTaskComplete called, task:', task)
|
||||||
|
console.log('task.status:', task.status, 'task.state:', task.state)
|
||||||
|
|
||||||
|
// 只有单任务(status为0)且状态为0(进行中)的任务才能完成
|
||||||
|
if (task.status !== 0 || task.state !== 0) {
|
||||||
|
console.log('Task cannot be completed, status:', task.status, 'state:', task.state)
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '该任务当前状态无法完成',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先设置checkbox为选中状态
|
||||||
|
this.$set(this.checkboxStates, task.taskId, true)
|
||||||
|
|
||||||
|
console.log('Showing confirmation modal')
|
||||||
|
uni.showModal({
|
||||||
|
title: '确认完成',
|
||||||
|
content: `确定要将任务"${task.taskTitle}"标记为完成吗?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.$emit('completeTask', task)
|
||||||
|
// 清除checkbox状态
|
||||||
|
this.$set(this.checkboxStates, task.taskId, false)
|
||||||
|
} else {
|
||||||
|
// 用户取消,重置checkbox状态为false
|
||||||
|
console.log('用户取消,重置checkbox状态')
|
||||||
|
this.$set(this.checkboxStates, task.taskId, false)
|
||||||
|
console.log('checkbox状态已重置:', this.checkboxStates[task.taskId])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 跳转到任务详情页面
|
||||||
|
handleTaskClick(task) {
|
||||||
|
this.$emit('taskClick', task)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取状态文本
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.task-list-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding-bottom: 120rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-list {
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-checkbox {
|
||||||
|
margin-right: 20rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border: 2rpx solid #ddd;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #fff;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&.checked {
|
||||||
|
background-color: #ff9500;
|
||||||
|
border-color: #ff9500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-color: #ddd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
flex: 1;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
height: 88rpx;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-status {
|
||||||
|
padding: 8rpx 16rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
box-shadow: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
|
&.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 8rpx;
|
||||||
|
right: 8rpx;
|
||||||
|
background-color: #fff8e6;
|
||||||
|
border: 1rpx solid #ff9500;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 2rpx 6rpx rgba(255, 149, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 100rpx 20rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -228,6 +228,7 @@
|
|||||||
<text class="upload-icon">+</text>
|
<text class="upload-icon">+</text>
|
||||||
<text class="upload-text">选择文件</text>
|
<text class="upload-text">选择文件</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="file-list" v-if="fileList.length > 0">
|
<view class="file-list" v-if="fileList.length > 0">
|
||||||
<view
|
<view
|
||||||
class="file-item"
|
class="file-item"
|
||||||
@@ -262,7 +263,7 @@
|
|||||||
import { addTask } from '@/api/oa/task'
|
import { addTask } from '@/api/oa/task'
|
||||||
import { listProject } from '@/api/oa/project'
|
import { listProject } from '@/api/oa/project'
|
||||||
import { selectUser, deptTreeSelect } from '@/api/oa/user'
|
import { selectUser, deptTreeSelect } from '@/api/oa/user'
|
||||||
import { uploadImage } from '@/api/common/upload'
|
import { uploadFiles } from '@/api/common/upload'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CreateTask',
|
name: 'CreateTask',
|
||||||
@@ -335,9 +336,9 @@ export default {
|
|||||||
// 获取用户列表
|
// 获取用户列表
|
||||||
async getUserList() {
|
async getUserList() {
|
||||||
try {
|
try {
|
||||||
// const res = await selectUser({ pageNum: 1, pageSize: 999, deptId: 100 })
|
const res = await selectUser({ pageNum: 1, pageSize: 999, deptId: 100 })
|
||||||
const resr = await deptTreeSelect()
|
// const resr = await deptTreeSelect()
|
||||||
// this.userList = res.rows || []
|
this.userList = res.rows || []
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取用户列表失败:', error)
|
console.error('获取用户列表失败:', error)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -408,15 +409,85 @@ export default {
|
|||||||
this.closeUserPopup()
|
this.closeUserPopup()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 选择文件
|
// 选择文件
|
||||||
chooseFile() {
|
chooseFile() {
|
||||||
|
// 安卓平台使用 plus.io.pickFiles
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (typeof plus !== 'undefined' && plus.io) {
|
||||||
|
console.log('使用安卓平台文件选择API')
|
||||||
|
this.doPickFiles()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 微信小程序环境
|
||||||
|
if (typeof wx !== 'undefined' && wx.chooseMessageFile) {
|
||||||
|
wx.chooseMessageFile({
|
||||||
|
count: 5,
|
||||||
|
type: 'all',
|
||||||
|
success: (res) => {
|
||||||
|
const processedFiles = res.tempFiles.map(file => ({
|
||||||
|
name: file.name,
|
||||||
|
size: file.size,
|
||||||
|
path: file.path || file.tempFilePath,
|
||||||
|
type: file.type
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 验证文件
|
||||||
|
const validFiles = this.validateFiles(processedFiles)
|
||||||
|
if (validFiles.length > 0) {
|
||||||
|
this.fileList = [...this.fileList, ...validFiles]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('选择文件失败:', err)
|
||||||
|
uni.showToast({
|
||||||
|
title: '选择文件失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// H5平台使用 uni.chooseFile
|
||||||
|
// #ifdef H5
|
||||||
uni.chooseFile({
|
uni.chooseFile({
|
||||||
count: 5,
|
count: 5,
|
||||||
type: 'all',
|
type: 'all',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.fileList = [...this.fileList, ...res.tempFiles]
|
const processedFiles = res.tempFiles.map(file => ({
|
||||||
|
name: file.name,
|
||||||
|
size: file.size,
|
||||||
|
path: file.path || file.tempFilePath || file.url,
|
||||||
|
type: file.type
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 验证文件
|
||||||
|
const validFiles = this.validateFiles(processedFiles)
|
||||||
|
if (validFiles.length > 0) {
|
||||||
|
this.fileList = [...this.fileList, ...validFiles]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('选择文件失败:', err)
|
||||||
|
uni.showToast({
|
||||||
|
title: '选择文件失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 其他平台提示不支持
|
||||||
|
// #ifndef APP-PLUS || H5 || MP-WEIXIN
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前平台不支持文件选择',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
|
|
||||||
// 移除文件
|
// 移除文件
|
||||||
@@ -424,6 +495,139 @@ export default {
|
|||||||
this.fileList.splice(index, 1)
|
this.fileList.splice(index, 1)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 根据文件名获取文件类型
|
||||||
|
getFileType(fileName) {
|
||||||
|
const ext = fileName.split('.').pop().toLowerCase()
|
||||||
|
const typeMap = {
|
||||||
|
'jpg': 'image/jpeg',
|
||||||
|
'jpeg': 'image/jpeg',
|
||||||
|
'png': 'image/png',
|
||||||
|
'gif': 'image/gif',
|
||||||
|
'bmp': 'image/bmp',
|
||||||
|
'webp': 'image/webp',
|
||||||
|
'pdf': 'application/pdf',
|
||||||
|
'doc': 'application/msword',
|
||||||
|
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'xls': 'application/vnd.ms-excel',
|
||||||
|
'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
'ppt': 'application/vnd.ms-powerpoint',
|
||||||
|
'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||||
|
'txt': 'text/plain',
|
||||||
|
'zip': 'application/zip',
|
||||||
|
'rar': 'application/x-rar-compressed',
|
||||||
|
'7z': 'application/x-7z-compressed'
|
||||||
|
}
|
||||||
|
return typeMap[ext] || 'application/octet-stream'
|
||||||
|
},
|
||||||
|
|
||||||
|
// 执行文件选择
|
||||||
|
doPickFiles() {
|
||||||
|
try {
|
||||||
|
plus.io.pickFiles({
|
||||||
|
multiple: true,
|
||||||
|
maximum: 5,
|
||||||
|
filter: 'none',
|
||||||
|
onSuccess: (files) => {
|
||||||
|
console.log('安卓平台选择文件成功:', files)
|
||||||
|
const processedFiles = files.map(file => ({
|
||||||
|
name: file.name,
|
||||||
|
size: file.size,
|
||||||
|
path: file.path,
|
||||||
|
type: file.type || this.getFileType(file.name)
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 验证文件
|
||||||
|
const validFiles = this.validateFiles(processedFiles)
|
||||||
|
if (validFiles.length > 0) {
|
||||||
|
this.fileList = [...this.fileList, ...validFiles]
|
||||||
|
console.log('处理后的文件列表:', this.fileList)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onFail: (error) => {
|
||||||
|
console.error('安卓平台选择文件失败:', error)
|
||||||
|
// 尝试使用备用方法
|
||||||
|
this.fallbackPickFiles()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('plus.io.pickFiles 不可用:', error)
|
||||||
|
// 尝试使用备用方法
|
||||||
|
this.fallbackPickFiles()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 备用文件选择方法
|
||||||
|
fallbackPickFiles() {
|
||||||
|
// 使用 uni.chooseImage 作为备用方案
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 5,
|
||||||
|
sizeType: ['original'],
|
||||||
|
sourceType: ['album'],
|
||||||
|
success: (res) => {
|
||||||
|
console.log('备用方法选择文件成功:', res)
|
||||||
|
const processedFiles = res.tempFilePaths.map((path, index) => ({
|
||||||
|
name: `image_${Date.now()}_${index}.jpg`,
|
||||||
|
size: 0,
|
||||||
|
path: path,
|
||||||
|
type: 'image/jpeg'
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 验证文件
|
||||||
|
const validFiles = this.validateFiles(processedFiles)
|
||||||
|
if (validFiles.length > 0) {
|
||||||
|
this.fileList = [...this.fileList, ...validFiles]
|
||||||
|
console.log('处理后的文件列表:', this.fileList)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
console.error('备用方法选择文件失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '选择文件失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 验证文件
|
||||||
|
validateFiles(files) {
|
||||||
|
const allowedTypes = ['doc', 'xls', 'ppt', 'txt', 'pdf', 'docx', 'xlsx', 'png', 'jpg', 'jpeg', 'zip', 'rar', '7z', 'dwg']
|
||||||
|
const maxSize = 200 * 1024 * 1024 // 200MB
|
||||||
|
|
||||||
|
const validFiles = []
|
||||||
|
const invalidFiles = []
|
||||||
|
|
||||||
|
files.forEach(file => {
|
||||||
|
// 文件类型验证
|
||||||
|
const ext = file.name.split('.').pop().toLowerCase()
|
||||||
|
if (!allowedTypes.includes(ext)) {
|
||||||
|
invalidFiles.push(`${file.name} (格式不支持)`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文件大小验证
|
||||||
|
if (file.size > maxSize) {
|
||||||
|
invalidFiles.push(`${file.name} (超过200MB)`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
validFiles.push(file)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 显示无效文件提示
|
||||||
|
if (invalidFiles.length > 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: `以下文件不符合要求:${invalidFiles.join(', ')}`,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return validFiles
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 格式化文件大小
|
// 格式化文件大小
|
||||||
formatFileSize(size) {
|
formatFileSize(size) {
|
||||||
if (size < 1024) {
|
if (size < 1024) {
|
||||||
@@ -437,21 +641,24 @@ export default {
|
|||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
async uploadFiles() {
|
async uploadFiles() {
|
||||||
const uploadPromises = this.fileList.map(async (file) => {
|
if (this.fileList.length === 0) {
|
||||||
try {
|
return []
|
||||||
const result = await uploadImage(file.path)
|
|
||||||
return {
|
|
||||||
originalName: file.name,
|
|
||||||
url: result.url,
|
|
||||||
ossId: result.ossId
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('文件上传失败:', error)
|
try {
|
||||||
throw error
|
const results = await uploadFiles(this.fileList, {
|
||||||
|
allowedTypes: ['doc', 'xls', 'ppt', 'txt', 'pdf', 'docx', 'xlsx', 'png', 'jpg', 'jpeg', 'zip', 'rar', '7z', 'dwg'],
|
||||||
|
maxSize: 200,
|
||||||
|
extraData: 1,
|
||||||
|
onProgress: (progress) => {
|
||||||
|
console.log(`上传进度: ${progress.progress.toFixed(1)}% - ${progress.file.name}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return Promise.all(uploadPromises)
|
return results
|
||||||
|
} catch (error) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
@@ -510,13 +717,38 @@ export default {
|
|||||||
try {
|
try {
|
||||||
// 上传文件
|
// 上传文件
|
||||||
if (this.fileList.length > 0) {
|
if (this.fileList.length > 0) {
|
||||||
|
// 显示上传进度提示
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在上传文件...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
|
||||||
const uploadedFiles = await this.uploadFiles()
|
const uploadedFiles = await this.uploadFiles()
|
||||||
this.form.accessory = uploadedFiles.map(file => file.ossId).join(',')
|
|
||||||
|
// 隐藏上传进度提示
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
// 提取ossId并拼接成字符串
|
||||||
|
const ossIds = uploadedFiles.map(file => file.ossId).filter(Boolean)
|
||||||
|
this.form.accessory = ossIds.join(',')
|
||||||
|
|
||||||
|
console.log('上传完成,ossId字符串:', this.form.accessory)
|
||||||
|
} else {
|
||||||
|
this.form.accessory = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 显示提交提示
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在创建任务...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
|
||||||
// 提交任务
|
// 提交任务
|
||||||
await addTask(this.form)
|
await addTask(this.form)
|
||||||
|
|
||||||
|
// 隐藏提交提示
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '任务创建成功',
|
title: '任务创建成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
@@ -529,9 +761,16 @@ export default {
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('创建任务失败:', error)
|
console.error('创建任务失败:', error)
|
||||||
|
|
||||||
|
// 隐藏所有loading
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
// 显示错误信息
|
||||||
|
const errorMessage = error.message || '创建任务失败'
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '创建任务失败',
|
title: errorMessage,
|
||||||
icon: 'none'
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|||||||
@@ -2,16 +2,71 @@
|
|||||||
<view class="detail-container">
|
<view class="detail-container">
|
||||||
<view v-if="loading" class="loading"><u-loading mode="circle" text="加载中..." /></view>
|
<view v-if="loading" class="loading"><u-loading mode="circle" text="加载中..." /></view>
|
||||||
<view v-else-if="taskDetail">
|
<view v-else-if="taskDetail">
|
||||||
|
<!-- 任务标题 -->
|
||||||
<view class="title">{{ taskDetail.taskTitle }}</view>
|
<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="section-title">基本信息</view>
|
||||||
<view class="row"><text class="label">创建人:</text>{{ taskDetail.createUserNickName || '-' }}</view>
|
<view class="info-grid">
|
||||||
<view class="row"><text class="label">创建时间:</text>{{ taskDetail.createTime || '-' }}</view>
|
<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>
|
<view class="section-title">任务描述</view>
|
||||||
<mp-html v-if="taskDetail.content" :content="taskDetail.content" />
|
<view v-if="taskDetail.content" class="content-text">{{ taskDetail.content }}</view>
|
||||||
<view class="section-title">报工进度</view>
|
<view v-else class="empty-content">暂无任务描述</view>
|
||||||
<view v-if="taskDetail.taskItemVoList && taskDetail.taskItemVoList.length">
|
|
||||||
|
<!-- 备注 -->
|
||||||
|
<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 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.signTime || '-' }}</view>
|
||||||
<view class="item-row"><text class="item-label">进度区间:</text>{{ item.beginTime || '-' }} ~ {{ item.endTime || '-' }}</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 class="item-row"><text class="item-label">完成时间:</text>{{ item.completedTime || '-' }}</view>
|
||||||
</view>
|
</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="add-dialog-bottom">
|
||||||
<view class="dialog-title">新增报工</view>
|
<view class="dialog-title">新增报工</view>
|
||||||
<u-form :model="addForm" ref="addFormRef">
|
<u-form :model="addForm" ref="addFormRef">
|
||||||
@@ -58,6 +142,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getTask } from '@/api/oa/task.js'
|
import { getTask } from '@/api/oa/task.js'
|
||||||
import { addOaTaskItem } from '@/api/oa/taskItem.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'
|
import mpHtml from 'uni_modules/mp-html/components/mp-html/mp-html.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -66,6 +151,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
taskDetail: null,
|
taskDetail: null,
|
||||||
loading: true,
|
loading: true,
|
||||||
|
attachmentFiles: [],
|
||||||
addForm: {
|
addForm: {
|
||||||
beginTime: '',
|
beginTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
@@ -74,6 +160,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
// 判断是否为报工任务
|
||||||
|
isReportTask() {
|
||||||
|
return this.taskDetail && this.taskDetail.status == 1
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const taskId = options.id
|
const taskId = options.id
|
||||||
if (taskId) {
|
if (taskId) {
|
||||||
@@ -90,6 +182,13 @@ export default {
|
|||||||
const res = await getTask(taskId)
|
const res = await getTask(taskId)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
this.taskDetail = res.data
|
this.taskDetail = res.data
|
||||||
|
|
||||||
|
// 加载附件信息
|
||||||
|
if (res.data.accessory) {
|
||||||
|
await this.loadAttachmentFiles(res.data.accessory)
|
||||||
|
} else {
|
||||||
|
this.attachmentFiles = []
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: res.msg || '获取详情失败', icon: 'none' })
|
uni.showToast({ title: res.msg || '获取详情失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
@@ -157,6 +256,153 @@ export default {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
uni.showToast({ title: '网络错误', icon: 'none' })
|
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;
|
color: #333;
|
||||||
padding: 12rpx 0 12rpx 8rpx;
|
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>
|
</style>
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
<view class="task-container">
|
<view class="task-container">
|
||||||
<!-- 搜索栏 -->
|
<!-- 搜索栏 -->
|
||||||
<view class="search-bar">
|
<view class="search-bar">
|
||||||
|
<view class="search-container">
|
||||||
|
<view class="filter-button" @click="toggleFilterPanel">
|
||||||
|
<uni-icons type="gear" size="20" color="#666"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="search-input">
|
||||||
<u-search
|
<u-search
|
||||||
v-model="searchKeyword"
|
v-model="searchKeyword"
|
||||||
placeholder="搜索任务名称"
|
placeholder="搜索任务名称"
|
||||||
@@ -10,177 +15,84 @@
|
|||||||
@clear="handleClear"
|
@clear="handleClear"
|
||||||
></u-search>
|
></u-search>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 任务列表 -->
|
<!-- 筛选面板 -->
|
||||||
<view class="task-list">
|
<view v-if="showFilterPanel" class="filter-panel">
|
||||||
<uni-swipe-action>
|
<view class="filter-title">任务类型</view>
|
||||||
<uni-swipe-action-item
|
<view class="filter-options">
|
||||||
v-for="(task, index) in taskList"
|
|
||||||
:key="task.taskId"
|
|
||||||
:right-options="getSwipeOptions(task)"
|
|
||||||
@click="handleSwipeClick($event, index)"
|
|
||||||
>
|
|
||||||
<view
|
<view
|
||||||
class="task-item"
|
class="filter-option"
|
||||||
@click="handleTaskClick(task)"
|
:class="{ 'active': taskType === 'received' }"
|
||||||
|
@click="switchTaskType('received')"
|
||||||
>
|
>
|
||||||
<view v-if="task.status === 0" class="task-checkbox" @click.stop="handleTaskComplete(task)">
|
<uni-icons type="checkmarkempty" v-if="taskType === 'received'" size="16" color="#ff9500"></uni-icons>
|
||||||
<view v-if="task.state === 0" class="checkbox-container">
|
<text>发布给我的任务</text>
|
||||||
<u-checkbox
|
|
||||||
:value="false"
|
|
||||||
:active-color="'#ff9500'"
|
|
||||||
size="20"
|
|
||||||
></u-checkbox>
|
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="task.state === 1" class="checkbox-container">
|
<view
|
||||||
<u-icon name="checkmark" size="20" color="#999"></u-icon>
|
class="filter-option"
|
||||||
</view>
|
:class="{ 'active': taskType === 'published' }"
|
||||||
<view v-else-if="task.state === 2" class="checkbox-container">
|
@click="switchTaskType('published')"
|
||||||
<u-icon name="checkmark" size="20" color="#52c41a"></u-icon>
|
>
|
||||||
</view>
|
<uni-icons type="checkmarkempty" v-if="taskType === 'published'" size="16" color="#ff9500"></uni-icons>
|
||||||
<view v-else class="checkbox-container">
|
<text>我发布的任务</text>
|
||||||
<u-checkbox
|
|
||||||
:value="false"
|
|
||||||
:disabled="true"
|
|
||||||
:active-color="'#999'"
|
|
||||||
size="20"
|
|
||||||
></u-checkbox>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="task-content">
|
|
||||||
<view class="task-title">{{ task.taskTitle || '未命名任务' }}</view>
|
|
||||||
<view class="task-status" :class="getStatusClass(task.state)">
|
|
||||||
{{ getStatusText(task.state) }}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="task.ownRank === 1" class="top-badge">
|
|
||||||
<u-icon name="arrow-up" size="12" color="#ff9500"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-swipe-action-item>
|
|
||||||
</uni-swipe-action>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 空状态 -->
|
<!-- 任务列表组件 -->
|
||||||
<view v-if="taskList.length === 0 && !loading" class="empty-state">
|
<TaskList
|
||||||
<u-empty text="暂无发布的任务" mode="list"></u-empty>
|
:task-list="taskList"
|
||||||
</view>
|
:loading="loading"
|
||||||
|
:load-more-status="loadMoreStatus"
|
||||||
<!-- 加载更多 -->
|
:config="taskListConfig"
|
||||||
<u-load-more
|
@setTaskTop="handleSetTaskTop"
|
||||||
:status="loadMoreStatus"
|
@deleteTask="handleDeleteTask"
|
||||||
@loadmore="loadMore"
|
@completeTask="handleCompleteTask"
|
||||||
></u-load-more>
|
@taskClick="handleTaskClick"
|
||||||
|
@loadMore="handleLoadMore"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 悬浮按钮 -->
|
<!-- 悬浮按钮 -->
|
||||||
<view class="fab-button" @click="createTask">
|
<view class="fab-button" @click="createTask">
|
||||||
<u-icon name="plus" color="#fff" size="24"></u-icon>
|
<u-icon name="plus" color="#fff" size="24"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 任务详情弹窗 -->
|
|
||||||
<uni-popup ref="taskDetailPopup" type="bottom" :mask-click="true">
|
|
||||||
<view class="popup-content">
|
|
||||||
<view class="popup-header">
|
|
||||||
<text class="popup-title">任务详情</text>
|
|
||||||
<u-icon name="close" size="20" @click="closeTaskDetail"></u-icon>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<scroll-view class="popup-body" scroll-y>
|
|
||||||
<view v-if="currentTask" class="task-detail">
|
|
||||||
<view class="detail-section">
|
|
||||||
<view class="section-title">基本信息</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">任务标题:</text>
|
|
||||||
<text class="value">{{ currentTask.taskTitle }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">任务状态:</text>
|
|
||||||
<text class="value status-tag" :class="getStatusClass(currentTask.state)">
|
|
||||||
{{ getStatusText(currentTask.state) }}
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">优先级:</text>
|
|
||||||
<text class="value priority-tag" :class="getPriorityClass(currentTask.taskRank)">
|
|
||||||
{{ getPriorityText(currentTask.taskRank) }}
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">所属项目:</text>
|
|
||||||
<text class="value">{{ currentTask.projectName }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="detail-section">
|
|
||||||
<view class="section-title">时间信息</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">开始时间:</text>
|
|
||||||
<text class="value">{{ formatDate(currentTask.beginTime) }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">结束时间:</text>
|
|
||||||
<text class="value">{{ formatDate(currentTask.finishTime) }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item" v-if="currentTask.overDays > 0">
|
|
||||||
<text class="label">超期天数:</text>
|
|
||||||
<text class="value over-days">{{ currentTask.overDays }}天</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="detail-section">
|
|
||||||
<view class="section-title">人员信息</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">负责人:</text>
|
|
||||||
<text class="value">{{ currentTask.workerNickName }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">创建人:</text>
|
|
||||||
<text class="value">{{ currentTask.createUserNickName }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="detail-item">
|
|
||||||
<text class="label">创建时间:</text>
|
|
||||||
<text class="value">{{ formatDate(currentTask.createTime) }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="detail-section" v-if="currentTask.content">
|
|
||||||
<view class="section-title">任务描述</view>
|
|
||||||
<view class="task-content-text">{{ currentTask.content }}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="detail-section" v-if="currentTask.remark">
|
|
||||||
<view class="section-title">备注</view>
|
|
||||||
<view class="task-content-text">{{ currentTask.remark }}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
<!-- <view class="popup-footer">
|
|
||||||
<u-button type="primary" @click="editCurrentTask">编辑任务</u-button>
|
|
||||||
<u-button type="error" @click="deleteCurrentTask">删除任务</u-button>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
|
||||||
</uni-popup>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listTaskWork, delTask, updateTask } from '@/api/oa/task.js'
|
import TaskList from './components/TaskList.vue'
|
||||||
|
import { listTaskWork, listTaskCreate, delTask, updateTask } from '@/api/oa/task.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
TaskList
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
taskList: [],
|
|
||||||
loading: false,
|
|
||||||
searchKeyword: '',
|
searchKeyword: '',
|
||||||
|
showFilterPanel: false, // 是否显示筛选面板
|
||||||
|
taskType: 'received', // 任务类型:received-发布给我的任务, published-我发布的任务
|
||||||
|
taskList: [], // 任务列表数据
|
||||||
|
loading: false, // 加载状态
|
||||||
|
loadMoreStatus: 'more', // 加载更多状态
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
taskTitle: ''
|
taskTitle: ''
|
||||||
},
|
},
|
||||||
loadMoreStatus: 'more', // more, loading, noMore
|
total: 0, // 总数量
|
||||||
total: 0,
|
taskListConfig: {
|
||||||
currentTask: null
|
showCheckbox: true, // 是否显示checkbox
|
||||||
|
canComplete: true, // 是否可以完成任务
|
||||||
|
canDelete: false, // 是否可以删除任务
|
||||||
|
canTop: true, // 是否可以置顶任务
|
||||||
|
emptyText: '暂无发布给我的任务', // 空状态文本
|
||||||
|
detailPage: '/pages/workbench/task/reportTaskDetail' // 详情页面路径
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -190,10 +102,11 @@ export default {
|
|||||||
|
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.refreshList()
|
this.refreshList()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
this.loadMore()
|
this.handleLoadMore()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -203,7 +116,20 @@ export default {
|
|||||||
|
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
const response = await listTaskWork(this.queryParams)
|
const params = {
|
||||||
|
...this.queryParams
|
||||||
|
}
|
||||||
|
|
||||||
|
let response
|
||||||
|
// 根据任务类型调用不同的API
|
||||||
|
if (this.taskType === 'received') {
|
||||||
|
// 发布给我的任务
|
||||||
|
response = await listTaskWork(params)
|
||||||
|
} else if (this.taskType === 'published') {
|
||||||
|
// 我发布的任务
|
||||||
|
response = await listTaskCreate(params)
|
||||||
|
}
|
||||||
|
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
const { rows, total } = response
|
const { rows, total } = response
|
||||||
|
|
||||||
@@ -229,7 +155,6 @@ export default {
|
|||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -239,14 +164,6 @@ export default {
|
|||||||
this.loadTaskList()
|
this.loadTaskList()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 加载更多
|
|
||||||
loadMore() {
|
|
||||||
if (this.loadMoreStatus === 'noMore' || this.loading) return
|
|
||||||
|
|
||||||
this.queryParams.pageNum++
|
|
||||||
this.loadTaskList()
|
|
||||||
},
|
|
||||||
|
|
||||||
// 更新加载更多状态
|
// 更新加载更多状态
|
||||||
updateLoadMoreStatus(rows, total) {
|
updateLoadMoreStatus(rows, total) {
|
||||||
const currentTotal = this.taskList.length
|
const currentTotal = this.taskList.length
|
||||||
@@ -274,178 +191,48 @@ export default {
|
|||||||
this.loadTaskList()
|
this.loadTaskList()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 显示任务详情弹窗
|
// 切换筛选面板
|
||||||
showTaskDetail(task) {
|
toggleFilterPanel() {
|
||||||
this.currentTask = task
|
this.showFilterPanel = !this.showFilterPanel
|
||||||
this.$refs.taskDetailPopup.open()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 关闭任务详情弹窗
|
// 切换任务类型
|
||||||
closeTaskDetail() {
|
switchTaskType(type) {
|
||||||
this.$refs.taskDetailPopup.close()
|
if (this.taskType === type) return
|
||||||
this.currentTask = null
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取左划操作选项
|
this.taskType = type
|
||||||
getSwipeOptions(task) {
|
this.showFilterPanel = false // 选择后关闭面板
|
||||||
const options = []
|
|
||||||
|
|
||||||
if (task.ownRank === 1) {
|
// 重置搜索和分页
|
||||||
// 已置顶,显示取消置顶
|
this.searchKeyword = ''
|
||||||
options.push({
|
this.queryParams.pageNum = 1
|
||||||
text: '取消置顶',
|
this.queryParams.taskTitle = ''
|
||||||
style: {
|
|
||||||
backgroundColor: '#999',
|
// 根据任务类型更新配置
|
||||||
color: '#fff'
|
if (type === 'received') {
|
||||||
|
// 发布给我的任务:可以完成、可以置顶、不能删除
|
||||||
|
this.taskListConfig = {
|
||||||
|
showCheckbox: true,
|
||||||
|
canComplete: true,
|
||||||
|
canDelete: false,
|
||||||
|
canTop: true,
|
||||||
|
emptyText: '暂无发布给我的任务',
|
||||||
|
detailPage: '/pages/workbench/task/reportTaskDetail'
|
||||||
}
|
}
|
||||||
})
|
} else if (type === 'published') {
|
||||||
} else {
|
// 我发布的任务:不能完成、不能置顶、可以删除
|
||||||
// 未置顶,显示置顶
|
this.taskListConfig = {
|
||||||
options.push({
|
showCheckbox: false,
|
||||||
text: '置顶',
|
canComplete: false,
|
||||||
style: {
|
canDelete: true,
|
||||||
backgroundColor: '#ff9500',
|
canTop: false,
|
||||||
color: '#fff'
|
emptyText: '暂无我发布的任务',
|
||||||
|
detailPage: '/pages/workbench/task/reportTaskDetail'
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
// 重新加载数据
|
||||||
},
|
this.loadTaskList()
|
||||||
|
|
||||||
// 处理左划操作点击
|
|
||||||
async handleSwipeClick(e, index) {
|
|
||||||
console.log('swipe click event:', e, 'index:', index)
|
|
||||||
|
|
||||||
const { content, position } = e
|
|
||||||
|
|
||||||
if (!content) {
|
|
||||||
console.error('Invalid swipe event:', e)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const task = this.taskList[index]
|
|
||||||
if (!task) {
|
|
||||||
console.error('Task not found at index:', index)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.text === '置顶') {
|
|
||||||
await this.setTaskTop(task, 1)
|
|
||||||
} else if (content.text === '取消置顶') {
|
|
||||||
await this.setTaskTop(task, 0)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 设置任务置顶状态
|
|
||||||
async setTaskTop(task, ownRank) {
|
|
||||||
try {
|
|
||||||
const response = await updateTask({
|
|
||||||
taskId: task.taskId,
|
|
||||||
ownRank: ownRank
|
|
||||||
})
|
|
||||||
|
|
||||||
if (response.code === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: ownRank === 1 ? '置顶成功' : '取消置顶成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
// 重新请求数据以获取最新排序
|
|
||||||
this.refreshList()
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: response.msg || '操作失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('设置置顶失败:', error)
|
|
||||||
uni.showToast({
|
|
||||||
title: '操作失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理任务完成
|
|
||||||
async handleTaskComplete(task) {
|
|
||||||
// 只有单任务(status为0)且状态为0(进行中)的任务才能完成
|
|
||||||
if (task.status !== 0 || task.state !== 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认完成',
|
|
||||||
content: `确定要将任务"${task.taskTitle}"标记为完成吗?`,
|
|
||||||
success: async (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
await this.completeTask(task)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 完成任务
|
|
||||||
async completeTask(task) {
|
|
||||||
try {
|
|
||||||
const response = await updateTask({
|
|
||||||
taskId: task.taskId,
|
|
||||||
state: 1 // 设置为完成等待评分状态
|
|
||||||
})
|
|
||||||
|
|
||||||
if (response.code === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '任务完成',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
// 重新请求数据
|
|
||||||
this.refreshList()
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: response.msg || '操作失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('完成任务失败:', error)
|
|
||||||
uni.showToast({
|
|
||||||
title: '操作失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 删除任务
|
|
||||||
async deleteTask(task) {
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认删除',
|
|
||||||
content: `确定要删除任务"${task.taskTitle}"吗?`,
|
|
||||||
success: async (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
try {
|
|
||||||
const response = await delTask(task.taskId)
|
|
||||||
if (response.code === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '删除成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
this.refreshList()
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: response.msg || '删除失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('删除任务失败:', error)
|
|
||||||
uni.showToast({
|
|
||||||
title: '删除失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 创建任务
|
// 创建任务
|
||||||
@@ -455,69 +242,105 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 格式化日期
|
// 任务点击
|
||||||
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'
|
|
||||||
},
|
|
||||||
|
|
||||||
// 新增:区分任务类型的点击事件
|
|
||||||
handleTaskClick(task) {
|
handleTaskClick(task) {
|
||||||
if (task.status === 1) {
|
|
||||||
// 报工任务,跳转到报工任务详情页
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/workbench/task/reportTaskDetail?id=${task.taskId}`
|
url: `${this.taskListConfig.detailPage}?id=${task.taskId}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加载更多
|
||||||
|
handleLoadMore() {
|
||||||
|
if (this.loadMoreStatus === 'noMore' || this.loading) return
|
||||||
|
|
||||||
|
this.queryParams.pageNum++
|
||||||
|
this.loadTaskList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 置顶/取消置顶任务
|
||||||
|
async handleSetTaskTop(task, ownRank) {
|
||||||
|
try {
|
||||||
|
const response = await updateTask({
|
||||||
|
taskId: task.taskId,
|
||||||
|
ownRank: ownRank
|
||||||
});
|
});
|
||||||
|
if (response.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: ownRank === 1 ? '置顶成功' : '取消置顶成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
this.refreshList();
|
||||||
} else {
|
} else {
|
||||||
// 单任务,弹出详情弹窗
|
uni.showToast({
|
||||||
this.showTaskDetail(task);
|
title: response.msg || '操作失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除任务
|
||||||
|
async handleDeleteTask(task) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '确认删除',
|
||||||
|
content: `确定要删除任务"${task.taskTitle}"吗?`,
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
try {
|
||||||
|
const response = await delTask(task.taskId);
|
||||||
|
if (response.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
this.refreshList();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: response.msg || '删除失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '删除失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 完成任务
|
||||||
|
async handleCompleteTask(task) {
|
||||||
|
try {
|
||||||
|
const response = await updateTask({
|
||||||
|
taskId: task.taskId,
|
||||||
|
state: 1,
|
||||||
|
completedTime: new Date()
|
||||||
|
});
|
||||||
|
if (response.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '任务完成',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
this.refreshList();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: response.msg || '操作失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -538,6 +361,70 @@ export default {
|
|||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-button {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 1rpx solid #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 24rpx;
|
||||||
|
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||||
|
border: 1rpx solid #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-title {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-options {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border: 1rpx solid #e9ecef;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: #fff8e6;
|
||||||
|
border-color: #ff9500;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.task-list {
|
.task-list {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
}
|
}
|
||||||
@@ -562,6 +449,24 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border: 2rpx solid #ddd;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #fff;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&.checked {
|
||||||
|
background-color: #ff9500;
|
||||||
|
border-color: #ff9500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-content {
|
.task-content {
|
||||||
@@ -634,16 +539,6 @@ export default {
|
|||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 弹窗样式
|
|
||||||
.popup-content {
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 24rpx 24rpx 0 0;
|
|
||||||
max-height: 80vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
z-index: 1001;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-badge {
|
.top-badge {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 8rpx;
|
top: 8rpx;
|
||||||
@@ -658,143 +553,4 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-shadow: 0 2rpx 6rpx rgba(255, 149, 0, 0.2);
|
box-shadow: 0 2rpx 6rpx rgba(255, 149, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 32rpx 24rpx 24rpx;
|
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-title {
|
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-body {
|
|
||||||
flex: 1;
|
|
||||||
padding: 24rpx;
|
|
||||||
max-height: 60vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.task-detail {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-section {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
padding-bottom: 12rpx;
|
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-item .label {
|
|
||||||
color: #666;
|
|
||||||
width: 160rpx;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-item .value {
|
|
||||||
color: #333;
|
|
||||||
flex: 1;
|
|
||||||
|
|
||||||
&.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.task-content-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333;
|
|
||||||
line-height: 1.6;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
padding: 20rpx;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
border-left: 4rpx solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-footer {
|
|
||||||
display: flex;
|
|
||||||
gap: 20rpx;
|
|
||||||
padding: 24rpx;
|
|
||||||
border-top: 1rpx solid #f0f0f0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user