style
This commit is contained in:
parent
5b673f9525
commit
236cf1489b
|
@ -6,6 +6,7 @@ import type { AttachInfoData, BusinessTypeResult } from './type'
|
||||||
* 批量新增附件信息
|
* 批量新增附件信息
|
||||||
* @param businessType 业务类型
|
* @param businessType 业务类型
|
||||||
* @param files 文件列表
|
* @param files 文件列表
|
||||||
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function batchAddAttachment(businessType: string, formData: FormData) {
|
export function batchAddAttachment(businessType: string, formData: FormData) {
|
||||||
return request<AttachInfoData[]>({
|
return request<AttachInfoData[]>({
|
||||||
|
|
|
@ -23,9 +23,9 @@ export function deleteTaskGroup(id: number) {
|
||||||
return http.del(`${BASE_URL}/group/${id}`)
|
return http.del(`${BASE_URL}/group/${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @desc 查询任务列表 */
|
/** @desc 查询任务列表(标准导出) */
|
||||||
export function listTask(query: T.TaskPageQuery) {
|
export const listTask = (params: any) => {
|
||||||
return http.get<PageRes<T.TaskResp[]>>(`${BASE_URL}`, query)
|
return http.get('/project-task/list', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @desc 获取任务详情 */
|
/** @desc 获取任务详情 */
|
||||||
|
|
|
@ -56,7 +56,7 @@ export const systemRoutes: RouteRecordRaw[] = [
|
||||||
path: '/organization/hr/workload',
|
path: '/organization/hr/workload',
|
||||||
name: 'HRWorkload',
|
name: 'HRWorkload',
|
||||||
component: () => import('@/views/hr/workload/index.vue'),
|
component: () => import('@/views/hr/workload/index.vue'),
|
||||||
meta: { title: '工作量', icon: 'workload', hidden: false },
|
meta: { title: '任务记录', icon: 'workload', hidden: false },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/organization/hr/attendance',
|
path: '/organization/hr/attendance',
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- 考勤统计 -->
|
||||||
<template>
|
<template>
|
||||||
<GiPageLayout>
|
<GiPageLayout>
|
||||||
<GiTable
|
<GiTable
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
|
<h1>>说明:任务具体分配给某个人,至少简单的任务分配,并非项目中的任务列表,暂时调用项目中的任务列表,并不完全,</h1>
|
||||||
|
<h1>目前需要新建一个任务表,表中的内容。。。。</h1>
|
||||||
<GiPageLayout>
|
<GiPageLayout>
|
||||||
<GiTable
|
<GiTable
|
||||||
row-key="id"
|
row-key="id"
|
||||||
title="工作量管理"
|
title="任务记录"
|
||||||
:data="dataList"
|
:data="dataList"
|
||||||
:columns="tableColumns"
|
:columns="tableColumns"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
@ -13,28 +15,19 @@
|
||||||
@refresh="search"
|
@refresh="search"
|
||||||
>
|
>
|
||||||
<template #top>
|
<template #top>
|
||||||
<GiForm
|
<GiForm
|
||||||
v-model="searchForm"
|
v-model="searchForm"
|
||||||
search
|
search
|
||||||
:columns="queryFormColumns"
|
:columns="queryFormColumns"
|
||||||
size="medium"
|
size="medium"
|
||||||
@search="search"
|
@search="search"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 任务状态显示 -->
|
||||||
<template #toolbar-left>
|
<template #status="{ record }">
|
||||||
<a-button type="primary" @click="openAddModal">
|
<a-tag :color="getTaskStatusColor(record.status)">{{ getTaskStatusText(record.status) }}</a-tag>
|
||||||
<template #icon><icon-plus /></template>
|
|
||||||
<template #default>新增工作量记录</template>
|
|
||||||
</a-button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 工作量显示 -->
|
|
||||||
<template #workload="{ record }">
|
|
||||||
<span class="font-medium text-blue-600">{{ record.workload }}小时</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 操作列 -->
|
<!-- 操作列 -->
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<a-space>
|
<a-space>
|
||||||
|
@ -50,13 +43,40 @@
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import type { TableColumnData } from '@arco-design/web-vue'
|
import type { TableColumnData } from '@arco-design/web-vue'
|
||||||
|
import { listTask } from '@/apis/project/task'
|
||||||
|
|
||||||
|
// 任务状态映射
|
||||||
|
// status:0未开始,1进行中,2已完成,3已取消
|
||||||
|
const statusOptions = [
|
||||||
|
{ label: '未开始', value: 0 },
|
||||||
|
{ label: '进行中', value: 1 },
|
||||||
|
{ label: '已完成', value: 2 },
|
||||||
|
{ label: '已取消', value: 3 }
|
||||||
|
]
|
||||||
|
const getTaskStatusColor = (status: number) => {
|
||||||
|
const colorMap: Record<number, string> = {
|
||||||
|
0: 'gray',
|
||||||
|
1: 'blue',
|
||||||
|
2: 'green',
|
||||||
|
3: 'red'
|
||||||
|
}
|
||||||
|
return colorMap[status] || 'gray'
|
||||||
|
}
|
||||||
|
const getTaskStatusText = (status: number) => {
|
||||||
|
const textMap: Record<number, string> = {
|
||||||
|
0: '未开始',
|
||||||
|
1: '进行中',
|
||||||
|
2: '已完成',
|
||||||
|
3: '已取消'
|
||||||
|
}
|
||||||
|
return textMap[status] || status
|
||||||
|
}
|
||||||
|
|
||||||
// 搜索表单
|
// 搜索表单
|
||||||
let searchForm = reactive({
|
let searchForm = reactive({
|
||||||
userName: '',
|
taskName: '',
|
||||||
projectName: '',
|
responsiblePerson: '', // mainUserId
|
||||||
startDate: '',
|
status: '',
|
||||||
endDate: '',
|
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
|
@ -64,119 +84,151 @@ let searchForm = reactive({
|
||||||
// 查询条件配置
|
// 查询条件配置
|
||||||
const queryFormColumns = [
|
const queryFormColumns = [
|
||||||
{
|
{
|
||||||
field: 'userName',
|
field: 'taskName',
|
||||||
label: '员工姓名',
|
label: '任务标题',
|
||||||
type: 'input' as const,
|
type: 'input' as const,
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入员工姓名'
|
placeholder: '请输入任务标题',
|
||||||
|
style: { width: '200px' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'projectName',
|
field: 'responsiblePerson',
|
||||||
label: '项目名称',
|
label: '分配用户',
|
||||||
type: 'input' as const,
|
type: 'input' as const,
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入项目名称'
|
placeholder: '请输入分配用户',
|
||||||
|
style: { width: '200px' }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'status',
|
||||||
|
label: '任务状态',
|
||||||
|
type: 'select' as const,
|
||||||
|
props: {
|
||||||
|
placeholder: '请选择任务状态',
|
||||||
|
options: statusOptions,
|
||||||
|
style: { width: '200px' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
const tableColumns: TableColumnData[] = [
|
const tableColumns: TableColumnData[] = [
|
||||||
{ title: '员工姓名', dataIndex: 'userName', width: 120 },
|
{ title: '任务ID', dataIndex: 'taskId', width: 80 },
|
||||||
{ title: '部门', dataIndex: 'deptName', width: 120 },
|
{ title: '任务标题', dataIndex: 'taskName', width: 200, ellipsis: true, tooltip: true },
|
||||||
{ title: '项目名称', dataIndex: 'projectName', width: 200, ellipsis: true, tooltip: true },
|
{ title: '分配用户', dataIndex: 'mainUserId', width: 120 },
|
||||||
{ title: '工作内容', dataIndex: 'workContent', width: 250, ellipsis: true, tooltip: true },
|
{ title: '分配部门', dataIndex: 'deptName', width: 120 },
|
||||||
{ title: '工作量(小时)', dataIndex: 'workload', slotName: 'workload', width: 120 },
|
{ title: '任务内容', dataIndex: 'remark', width: 250, ellipsis: true, tooltip: true },
|
||||||
{ title: '工作日期', dataIndex: 'workDate', width: 120 },
|
{ title: '任务状态', dataIndex: 'status', slotName: 'status', width: 120 },
|
||||||
{ title: '创建时间', dataIndex: 'createTime', width: 160 },
|
{ title: '创建时间', dataIndex: 'createTime', width: 160 },
|
||||||
{ title: '操作', slotName: 'action', width: 120, fixed: 'right' }
|
{ title: '操作', slotName: 'action', width: 120, fixed: 'right' }
|
||||||
]
|
]
|
||||||
|
|
||||||
// 数据状态
|
// 数据状态
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const dataList = ref([
|
const dataList = ref<any[]>([])
|
||||||
{
|
const allData = ref<any[]>([])
|
||||||
id: 1,
|
|
||||||
userName: '张三',
|
|
||||||
deptName: '技术部',
|
|
||||||
projectName: '企业管理系统',
|
|
||||||
workContent: '前端开发',
|
|
||||||
workload: 8,
|
|
||||||
workDate: '2024-01-15',
|
|
||||||
createTime: '2024-01-15 10:30:00'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
userName: '李四',
|
|
||||||
deptName: '技术部',
|
|
||||||
projectName: '移动端应用',
|
|
||||||
workContent: '后端接口开发',
|
|
||||||
workload: 6,
|
|
||||||
workDate: '2024-01-15',
|
|
||||||
createTime: '2024-01-15 11:20:00'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
const pagination = reactive({
|
const pagination = reactive({
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 2,
|
total: 0,
|
||||||
showTotal: true,
|
showTotal: true,
|
||||||
showPageSize: true
|
showPageSize: true
|
||||||
})
|
})
|
||||||
|
|
||||||
// 搜索和重置
|
// 获取任务数据
|
||||||
const search = async () => {
|
const fetchTaskList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
// 模拟API请求
|
try {
|
||||||
setTimeout(() => {
|
const params: any = {
|
||||||
|
page: searchForm.page,
|
||||||
|
pageSize: searchForm.size,
|
||||||
|
taskName: searchForm.taskName,
|
||||||
|
mainUserId: searchForm.responsiblePerson,
|
||||||
|
status: searchForm.status
|
||||||
|
}
|
||||||
|
// 移除空参数
|
||||||
|
Object.keys(params).forEach(key => {
|
||||||
|
if (params[key] === '' || params[key] === undefined) delete params[key]
|
||||||
|
})
|
||||||
|
const res = await listTask(params)
|
||||||
|
// 兼容后端返回格式,优先rows,其次data
|
||||||
|
const rows = res?.rows || res?.data?.rows || []
|
||||||
|
console.log('后端返回数据:', res) // 只打印一次原始数据
|
||||||
|
allData.value = rows
|
||||||
|
filterAndPaginate()
|
||||||
|
pagination.total = rows.length
|
||||||
|
} catch (e) {
|
||||||
|
Message.error('获取任务数据失败')
|
||||||
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 1000)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const reset = () => {
|
// 前端筛选和分页
|
||||||
|
const filterAndPaginate = () => {
|
||||||
|
let filtered = allData.value
|
||||||
|
if (searchForm.taskName) {
|
||||||
|
filtered = filtered.filter((item: any) =>
|
||||||
|
item.taskName?.toLowerCase().includes(searchForm.taskName.toLowerCase())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (searchForm.responsiblePerson) {
|
||||||
|
filtered = filtered.filter((item: any) =>
|
||||||
|
item.mainUserId?.toLowerCase().includes(searchForm.responsiblePerson.toLowerCase())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (searchForm.status !== '' && searchForm.status !== undefined) {
|
||||||
|
filtered = filtered.filter((item: any) => String(item.status) === String(searchForm.status))
|
||||||
|
}
|
||||||
|
// 分页
|
||||||
|
const start = (pagination.current - 1) * pagination.pageSize
|
||||||
|
const end = start + pagination.pageSize
|
||||||
|
dataList.value = filtered.slice(start, end)
|
||||||
|
pagination.total = filtered.length
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索和重置
|
||||||
|
const search = async () => {
|
||||||
|
pagination.current = 1
|
||||||
|
await fetchTaskList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const reset = async () => {
|
||||||
Object.assign(searchForm, {
|
Object.assign(searchForm, {
|
||||||
userName: '',
|
taskName: '',
|
||||||
projectName: '',
|
responsiblePerson: '',
|
||||||
startDate: '',
|
status: '',
|
||||||
endDate: '',
|
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
pagination.current = 1
|
pagination.current = 1
|
||||||
search()
|
await fetchTaskList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页处理
|
// 分页处理
|
||||||
const onPageChange = (page: number) => {
|
const onPageChange = (page: number) => {
|
||||||
searchForm.page = page
|
|
||||||
pagination.current = page
|
pagination.current = page
|
||||||
search()
|
filterAndPaginate()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPageSizeChange = (size: number) => {
|
const onPageSizeChange = (size: number) => {
|
||||||
searchForm.size = size
|
|
||||||
searchForm.page = 1
|
|
||||||
pagination.pageSize = size
|
pagination.pageSize = size
|
||||||
pagination.current = 1
|
pagination.current = 1
|
||||||
search()
|
filterAndPaginate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作方法
|
// 操作方法
|
||||||
const openAddModal = () => {
|
|
||||||
Message.info('新增工作量记录功能开发中...')
|
|
||||||
}
|
|
||||||
|
|
||||||
const editRecord = (record: any) => {
|
const editRecord = (record: any) => {
|
||||||
Message.info(`编辑工作量记录: ${record.userName}`)
|
Message.info(`编辑任务: ${record.taskName}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteRecord = (record: any) => {
|
const deleteRecord = (record: any) => {
|
||||||
Message.info(`删除工作量记录: ${record.userName}`)
|
Message.info(`删除任务: ${record.taskName}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
search()
|
fetchTaskList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue