Compare commits
6 Commits
0108dd6068
...
8c202c45dc
Author | SHA1 | Date |
---|---|---|
|
8c202c45dc | |
|
38d888f24e | |
|
fae3b7b05d | |
|
236cf1489b | |
|
5b673f9525 | |
|
708e8b47d1 |
|
@ -2,6 +2,5 @@
|
|||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/Industrial-image-management-system---web" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -143,6 +143,9 @@ importers:
|
|||
xgplayer:
|
||||
specifier: ^2.31.6
|
||||
version: 2.32.6
|
||||
xlsx:
|
||||
specifier: ^0.18.5
|
||||
version: 0.18.5
|
||||
devDependencies:
|
||||
'@antfu/eslint-config':
|
||||
specifier: ^2.16.3
|
||||
|
@ -1481,6 +1484,10 @@ packages:
|
|||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
adler-32@1.3.1:
|
||||
resolution: {integrity: sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
aieditor@1.0.13:
|
||||
resolution: {integrity: sha512-A1NIydCJgno3VvEKWPyHZlS7IF5FwBO1X4QO3GEKNcs8wMmmVGbcoVDPHON3uo9bTKaxuuIiONyfLCGHLBpW2Q==}
|
||||
|
||||
|
@ -1688,6 +1695,10 @@ packages:
|
|||
capital-case@1.0.4:
|
||||
resolution: {integrity: sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==}
|
||||
|
||||
cfb@1.2.2:
|
||||
resolution: {integrity: sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
chalk@1.1.3:
|
||||
resolution: {integrity: sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -1759,6 +1770,10 @@ packages:
|
|||
codemirror@6.0.1:
|
||||
resolution: {integrity: sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==}
|
||||
|
||||
codepage@1.15.0:
|
||||
resolution: {integrity: sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
collection-visit@1.0.0:
|
||||
resolution: {integrity: sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -1849,6 +1864,11 @@ packages:
|
|||
resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
crc-32@1.2.2:
|
||||
resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==}
|
||||
engines: {node: '>=0.8'}
|
||||
hasBin: true
|
||||
|
||||
crelt@1.0.6:
|
||||
resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==}
|
||||
|
||||
|
@ -2655,6 +2675,10 @@ packages:
|
|||
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
frac@1.1.2:
|
||||
resolution: {integrity: sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
fragment-cache@0.2.1:
|
||||
resolution: {integrity: sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -4106,6 +4130,10 @@ packages:
|
|||
resolution: {integrity: sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
ssf@0.11.2:
|
||||
resolution: {integrity: sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
stable@0.1.8:
|
||||
resolution: {integrity: sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==}
|
||||
deprecated: 'Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility'
|
||||
|
@ -4687,10 +4715,18 @@ packages:
|
|||
resolution: {integrity: sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
wmf@1.0.2:
|
||||
resolution: {integrity: sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
word-wrap@1.2.5:
|
||||
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
word@0.3.0:
|
||||
resolution: {integrity: sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==}
|
||||
engines: {node: '>=0.8'}
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -4713,6 +4749,11 @@ packages:
|
|||
resolution: {integrity: sha512-ESwYYcG8SQciPaN43tZkN3r0dS/jQ5RtyxyGbxn2+qcKgZQ861M899xq8Cab/z6qVVX+/4eIsxDbm3lfYGYzvA==}
|
||||
hasBin: true
|
||||
|
||||
xlsx@0.18.5:
|
||||
resolution: {integrity: sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==}
|
||||
engines: {node: '>=0.8'}
|
||||
hasBin: true
|
||||
|
||||
xml-name-validator@4.0.0:
|
||||
resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
|
||||
engines: {node: '>=12'}
|
||||
|
@ -6166,6 +6207,8 @@ snapshots:
|
|||
|
||||
acorn@8.11.3: {}
|
||||
|
||||
adler-32@1.3.1: {}
|
||||
|
||||
aieditor@1.0.13(@tiptap/extension-code-block@2.5.8(@tiptap/core@2.5.8(@tiptap/pm@2.5.8))(@tiptap/pm@2.5.8)):
|
||||
dependencies:
|
||||
'@tiptap/core': 2.5.8(@tiptap/pm@2.5.8)
|
||||
|
@ -6421,6 +6464,11 @@ snapshots:
|
|||
tslib: 2.6.2
|
||||
upper-case-first: 2.0.2
|
||||
|
||||
cfb@1.2.2:
|
||||
dependencies:
|
||||
adler-32: 1.3.1
|
||||
crc-32: 1.2.2
|
||||
|
||||
chalk@1.1.3:
|
||||
dependencies:
|
||||
ansi-styles: 2.2.1
|
||||
|
@ -6521,6 +6569,8 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- '@lezer/common'
|
||||
|
||||
codepage@1.15.0: {}
|
||||
|
||||
collection-visit@1.0.0:
|
||||
dependencies:
|
||||
map-visit: 1.0.0
|
||||
|
@ -6608,6 +6658,8 @@ snapshots:
|
|||
object-assign: 4.1.1
|
||||
vary: 1.1.2
|
||||
|
||||
crc-32@1.2.2: {}
|
||||
|
||||
crelt@1.0.6: {}
|
||||
|
||||
cron-parser@4.9.0:
|
||||
|
@ -7548,6 +7600,8 @@ snapshots:
|
|||
combined-stream: 1.0.8
|
||||
mime-types: 2.1.35
|
||||
|
||||
frac@1.1.2: {}
|
||||
|
||||
fragment-cache@0.2.1:
|
||||
dependencies:
|
||||
map-cache: 0.2.2
|
||||
|
@ -9049,6 +9103,10 @@ snapshots:
|
|||
dependencies:
|
||||
extend-shallow: 3.0.2
|
||||
|
||||
ssf@0.11.2:
|
||||
dependencies:
|
||||
frac: 1.1.2
|
||||
|
||||
stable@0.1.8: {}
|
||||
|
||||
static-extend@0.1.2:
|
||||
|
@ -9717,8 +9775,12 @@ snapshots:
|
|||
dependencies:
|
||||
string-width: 5.1.2
|
||||
|
||||
wmf@1.0.2: {}
|
||||
|
||||
word-wrap@1.2.5: {}
|
||||
|
||||
word@0.3.0: {}
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
|
@ -9755,6 +9817,16 @@ snapshots:
|
|||
fs-extra: 5.0.0
|
||||
xgplayer-subtitles: 1.0.19
|
||||
|
||||
xlsx@0.18.5:
|
||||
dependencies:
|
||||
adler-32: 1.3.1
|
||||
cfb: 1.2.2
|
||||
codepage: 1.15.0
|
||||
crc-32: 1.2.2
|
||||
ssf: 0.11.2
|
||||
wmf: 1.0.2
|
||||
word: 0.3.0
|
||||
|
||||
xml-name-validator@4.0.0: {}
|
||||
|
||||
y18n@5.0.8: {}
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { useAppStore, useUserStore } from '@/stores'
|
||||
|
||||
// 1
|
||||
defineOptions({ name: 'App' })
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
appStore.initTheme()
|
||||
appStore.initSiteConfig()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.loading-icon {
|
||||
animation: arco-loading-circle 1s infinite cubic-bezier(0,0,1,1);
|
||||
|
|
|
@ -6,6 +6,7 @@ import type { AttachInfoData, BusinessTypeResult } from './type'
|
|||
* 批量新增附件信息
|
||||
* @param businessType 业务类型
|
||||
* @param files 文件列表
|
||||
* @returns
|
||||
*/
|
||||
export function batchAddAttachment(businessType: string, formData: FormData) {
|
||||
return request<AttachInfoData[]>({
|
||||
|
|
|
@ -23,9 +23,9 @@ export function deleteTaskGroup(id: number) {
|
|||
return http.del(`${BASE_URL}/group/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 查询任务列表 */
|
||||
export function listTask(query: T.TaskPageQuery) {
|
||||
return http.get<PageRes<T.TaskResp[]>>(`${BASE_URL}`, query)
|
||||
/** @desc 查询任务列表(标准导出) */
|
||||
export const listTask = (params: any) => {
|
||||
return http.get('/project-task/list', params)
|
||||
}
|
||||
|
||||
/** @desc 获取任务详情 */
|
||||
|
|
|
@ -56,7 +56,7 @@ export const systemRoutes: RouteRecordRaw[] = [
|
|||
path: '/organization/hr/workload',
|
||||
name: 'HRWorkload',
|
||||
component: () => import('@/views/hr/workload/index.vue'),
|
||||
meta: { title: '工作量', icon: 'workload', hidden: false },
|
||||
meta: { title: '任务管理', icon: 'workload', hidden: false },
|
||||
},
|
||||
{
|
||||
path: '/organization/hr/attendance',
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- 考勤统计 -->
|
||||
<template>
|
||||
<GiPageLayout>
|
||||
<GiTable
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!--任务管理-->
|
||||
<template>
|
||||
<GiPageLayout>
|
||||
<a-button type="primary" style="margin-bottom: 16px" @click="openAddModal">发布任务</a-button>
|
||||
<GiTable
|
||||
row-key="id"
|
||||
title="工作量管理"
|
||||
row-key="taskId"
|
||||
title="任务记录"
|
||||
:data="dataList"
|
||||
:columns="tableColumns"
|
||||
:loading="loading"
|
||||
|
@ -11,38 +13,74 @@
|
|||
@page-change="onPageChange"
|
||||
@page-size-change="onPageSizeChange"
|
||||
@refresh="search"
|
||||
@row-click="onRowClick"
|
||||
>
|
||||
<template #top>
|
||||
<GiForm
|
||||
v-model="searchForm"
|
||||
search
|
||||
:columns="queryFormColumns"
|
||||
size="medium"
|
||||
@search="search"
|
||||
<GiForm
|
||||
v-model="searchForm"
|
||||
search
|
||||
:columns="queryFormColumns"
|
||||
size="medium"
|
||||
@search="search"
|
||||
@reset="reset"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #toolbar-left>
|
||||
<a-button type="primary" @click="openAddModal">
|
||||
<template #icon><icon-plus /></template>
|
||||
<template #default>新增工作量记录</template>
|
||||
</a-button>
|
||||
<template #status="{ record }">
|
||||
<a-tag :color="getTaskStatusColor(record.status)">{{ getTaskStatusText(record.status) }}</a-tag>
|
||||
</template>
|
||||
|
||||
<!-- 工作量显示 -->
|
||||
<template #workload="{ record }">
|
||||
<span class="font-medium text-blue-600">{{ record.workload }}小时</span>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link @click="editRecord(record)">编辑</a-link>
|
||||
<a-link status="danger" @click="deleteRecord(record)">删除</a-link>
|
||||
<a-link @click.stop="onRowClick(record)">详情</a-link>
|
||||
<a-link status="danger" @click.stop="deleteRecord(record)">删除</a-link>
|
||||
</a-space>
|
||||
</template>
|
||||
</GiTable>
|
||||
<!-- 发布任务弹窗 -->
|
||||
<a-modal v-model:visible="showAddModal" title="发布任务" @ok="handleAddTask" @cancel="showAddModal = false">
|
||||
<a-form :model="addForm" label-width="90px">
|
||||
<a-form-item label="任务ID">
|
||||
<a-input v-model="addForm.taskId" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="任务描述">
|
||||
<a-input v-model="addForm.remark" placeholder="请输入任务描述" />
|
||||
</a-form-item>
|
||||
<a-form-item label="创建时间">
|
||||
<a-input v-model="addForm.createTime" disabled />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
<!-- 任务详情弹窗 -->
|
||||
<a-modal v-model:visible="showDetailModal" title="任务详情" @ok="handleUpdateTask" @cancel="showDetailModal = false" :footer="false">
|
||||
<a-form :model="detailForm" label-width="90px">
|
||||
<a-form-item label="任务ID">
|
||||
<a-input v-model="detailForm.taskId" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="任务描述">
|
||||
<a-input v-model="detailForm.remark" />
|
||||
</a-form-item>
|
||||
<a-form-item label="分配岗位">
|
||||
<a-select v-model="detailForm.deptName" :options="deptOptions" allow-clear placeholder="请选择岗位" />
|
||||
</a-form-item>
|
||||
<a-form-item label="分配人员">
|
||||
<a-select v-model="detailForm.mainUserId" :options="userOptions" allow-clear placeholder="请选择人员" />
|
||||
</a-form-item>
|
||||
<a-form-item label="任务状态">
|
||||
<a-input :value="getTaskStatusText(detailForm.status)" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="创建时间">
|
||||
<a-input v-model="detailForm.createTime" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="完成时间">
|
||||
<a-input v-model="detailForm.finishTime" disabled />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<template #footer>
|
||||
<a-space style="float: right">
|
||||
<a-button status="danger" @click="handleDeleteTask">删除</a-button>
|
||||
<a-button type="primary" @click="handleUpdateTask">确定</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-modal>
|
||||
</GiPageLayout>
|
||||
</template>
|
||||
|
||||
|
@ -50,13 +88,52 @@
|
|||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { Message } from '@arco-design/web-vue'
|
||||
import type { TableColumnData } from '@arco-design/web-vue'
|
||||
// import { listTask } from '@/apis/project/task' // 接口调用处注释
|
||||
|
||||
// 任务状态映射
|
||||
// 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
|
||||
}
|
||||
|
||||
// 示例岗位和人员
|
||||
const deptOptions = [
|
||||
{ label: '开发', value: '开发' },
|
||||
{ label: '测试', value: '测试' },
|
||||
{ label: '运维', value: '运维' }
|
||||
]
|
||||
const userOptions = [
|
||||
{ label: '张三', value: '张三' },
|
||||
{ label: '李四', value: '李四' },
|
||||
{ label: '王五', value: '王五' }
|
||||
]
|
||||
|
||||
// 搜索表单
|
||||
let searchForm = reactive({
|
||||
userName: '',
|
||||
projectName: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
taskName: '',
|
||||
responsiblePerson: '', // mainUserId
|
||||
status: '',
|
||||
page: 1,
|
||||
size: 10
|
||||
})
|
||||
|
@ -64,119 +141,241 @@ let searchForm = reactive({
|
|||
// 查询条件配置
|
||||
const queryFormColumns = [
|
||||
{
|
||||
field: 'userName',
|
||||
label: '员工姓名',
|
||||
field: 'taskName',
|
||||
label: '任务标题',
|
||||
type: 'input' as const,
|
||||
props: {
|
||||
placeholder: '请输入员工姓名'
|
||||
placeholder: '请输入任务标题',
|
||||
style: { width: '200px' }
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'projectName',
|
||||
label: '项目名称',
|
||||
field: 'responsiblePerson',
|
||||
label: '分配用户',
|
||||
type: 'input' as const,
|
||||
props: {
|
||||
placeholder: '请输入项目名称'
|
||||
placeholder: '请输入分配用户',
|
||||
style: { width: '200px' }
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
label: '任务状态',
|
||||
type: 'select' as const,
|
||||
props: {
|
||||
placeholder: '请选择任务状态',
|
||||
options: statusOptions,
|
||||
style: { width: '200px' }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
// 表格列配置
|
||||
const tableColumns: TableColumnData[] = [
|
||||
{ title: '员工姓名', dataIndex: 'userName', width: 120 },
|
||||
{ title: '部门', dataIndex: 'deptName', width: 120 },
|
||||
{ title: '项目名称', dataIndex: 'projectName', width: 200, ellipsis: true, tooltip: true },
|
||||
{ title: '工作内容', dataIndex: 'workContent', width: 250, ellipsis: true, tooltip: true },
|
||||
{ title: '工作量(小时)', dataIndex: 'workload', slotName: 'workload', width: 120 },
|
||||
{ title: '工作日期', dataIndex: 'workDate', width: 120 },
|
||||
{ title: '任务ID', dataIndex: 'taskId', width: 80 },
|
||||
{ title: '任务标题', dataIndex: 'taskName', width: 200, ellipsis: true, tooltip: true },
|
||||
{ title: '分配用户', dataIndex: 'mainUserId', width: 120 },
|
||||
{ title: '分配部门', dataIndex: 'deptName', width: 120 },
|
||||
{ title: '任务内容', dataIndex: 'remark', width: 250, ellipsis: true, tooltip: true },
|
||||
{ title: '任务状态', dataIndex: 'status', slotName: 'status', width: 120 },
|
||||
{ title: '创建时间', dataIndex: 'createTime', width: 160 },
|
||||
{ title: '操作', slotName: 'action', width: 120, fixed: 'right' }
|
||||
]
|
||||
|
||||
// 数据状态
|
||||
const loading = ref(false)
|
||||
const dataList = ref([
|
||||
{
|
||||
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 dataList = ref<any[]>([])
|
||||
const allData = ref<any[]>([])
|
||||
const pagination = reactive({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
total: 2,
|
||||
total: 0,
|
||||
showTotal: true,
|
||||
showPageSize: true
|
||||
})
|
||||
|
||||
// 搜索和重置
|
||||
const search = async () => {
|
||||
loading.value = true
|
||||
// 模拟API请求
|
||||
setTimeout(() => {
|
||||
loading.value = false
|
||||
}, 1000)
|
||||
// 发布任务弹窗
|
||||
const showAddModal = ref(false)
|
||||
const addForm = reactive({
|
||||
taskId: '',
|
||||
remark: '',
|
||||
createTime: ''
|
||||
})
|
||||
const openAddModal = () => {
|
||||
addForm.taskId = Date.now().toString()
|
||||
addForm.remark = ''
|
||||
addForm.createTime = new Date().toLocaleString()
|
||||
showAddModal.value = true
|
||||
}
|
||||
const handleAddTask = () => {
|
||||
if (!addForm.remark) {
|
||||
Message.warning('请输入任务描述')
|
||||
return
|
||||
}
|
||||
const newTask = {
|
||||
taskId: addForm.taskId,
|
||||
taskName: addForm.remark,
|
||||
mainUserId: '',
|
||||
deptName: '',
|
||||
remark: addForm.remark,
|
||||
status: 0, // 未分配
|
||||
createTime: addForm.createTime,
|
||||
finishTime: ''
|
||||
}
|
||||
allData.value.unshift(newTask)
|
||||
filterAndPaginate()
|
||||
showAddModal.value = false
|
||||
Message.success('任务发布成功')
|
||||
}
|
||||
|
||||
const reset = () => {
|
||||
// 任务详情弹窗
|
||||
const showDetailModal = ref(false)
|
||||
const detailForm = reactive({
|
||||
taskId: '',
|
||||
taskName: '',
|
||||
mainUserId: '',
|
||||
deptName: '',
|
||||
remark: '',
|
||||
status: 0,
|
||||
createTime: '',
|
||||
finishTime: ''
|
||||
})
|
||||
let detailIndex = -1
|
||||
const onRowClick = (record: any) => {
|
||||
Object.assign(detailForm, record)
|
||||
detailIndex = allData.value.findIndex(item => item.taskId === record.taskId)
|
||||
showDetailModal.value = true
|
||||
}
|
||||
const handleUpdateTask = () => {
|
||||
if (detailIndex !== -1) {
|
||||
allData.value[detailIndex] = { ...detailForm }
|
||||
filterAndPaginate()
|
||||
showDetailModal.value = false
|
||||
Message.success('任务更新成功')
|
||||
}
|
||||
}
|
||||
const handleDeleteTask = () => {
|
||||
if (detailIndex !== -1) {
|
||||
allData.value.splice(detailIndex, 1)
|
||||
filterAndPaginate()
|
||||
showDetailModal.value = false
|
||||
Message.success('任务已删除')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取任务数据(用示例数据,接口调用处注释)
|
||||
const fetchTaskList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// const res = await listTask(params)
|
||||
// const rows = res?.rows || res?.data?.rows || []
|
||||
// allData.value = rows
|
||||
// 示例数据:
|
||||
allData.value = [
|
||||
{
|
||||
taskId: '1710000000000',
|
||||
taskName: '示例任务A',
|
||||
mainUserId: '张三',
|
||||
deptName: '开发',
|
||||
remark: '开发新功能',
|
||||
status: 1,
|
||||
createTime: '2024-05-01 10:00:00',
|
||||
finishTime: ''
|
||||
},
|
||||
{
|
||||
taskId: '1710000000001',
|
||||
taskName: '示例任务B',
|
||||
mainUserId: '',
|
||||
deptName: '',
|
||||
remark: '待分配任务',
|
||||
status: 0,
|
||||
createTime: '2024-05-02 11:00:00',
|
||||
finishTime: ''
|
||||
},
|
||||
{
|
||||
taskId: '1710000000002',
|
||||
taskName: '示例任务C',
|
||||
mainUserId: '李四',
|
||||
deptName: '测试',
|
||||
remark: '测试任务',
|
||||
status: 2,
|
||||
createTime: '2024-05-03 09:00:00',
|
||||
finishTime: '2024-05-05 18:00:00'
|
||||
}
|
||||
]
|
||||
filterAndPaginate()
|
||||
pagination.total = allData.value.length
|
||||
} catch (e) {
|
||||
Message.error('获取任务数据失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 前端筛选和分页
|
||||
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
|
||||
filterAndPaginate()
|
||||
}
|
||||
|
||||
const reset = async () => {
|
||||
Object.assign(searchForm, {
|
||||
userName: '',
|
||||
projectName: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
taskName: '',
|
||||
responsiblePerson: '',
|
||||
status: '',
|
||||
page: 1,
|
||||
size: 10
|
||||
})
|
||||
pagination.current = 1
|
||||
search()
|
||||
filterAndPaginate()
|
||||
}
|
||||
|
||||
// 分页处理
|
||||
const onPageChange = (page: number) => {
|
||||
searchForm.page = page
|
||||
pagination.current = page
|
||||
search()
|
||||
filterAndPaginate()
|
||||
}
|
||||
|
||||
const onPageSizeChange = (size: number) => {
|
||||
searchForm.size = size
|
||||
searchForm.page = 1
|
||||
pagination.pageSize = size
|
||||
pagination.current = 1
|
||||
search()
|
||||
}
|
||||
|
||||
// 操作方法
|
||||
const openAddModal = () => {
|
||||
Message.info('新增工作量记录功能开发中...')
|
||||
}
|
||||
|
||||
const editRecord = (record: any) => {
|
||||
Message.info(`编辑工作量记录: ${record.userName}`)
|
||||
filterAndPaginate()
|
||||
}
|
||||
|
||||
// 删除操作(表格操作列)
|
||||
const deleteRecord = (record: any) => {
|
||||
Message.info(`删除工作量记录: ${record.userName}`)
|
||||
const idx = allData.value.findIndex(item => item.taskId === record.taskId)
|
||||
if (idx !== -1) {
|
||||
allData.value.splice(idx, 1)
|
||||
filterAndPaginate()
|
||||
Message.success('任务已删除')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
search()
|
||||
fetchTaskList()
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue