<template>
|
<div class="app-container">
|
<!--工具栏-->
|
<div class="head-container">
|
<div>
|
<el-select v-model="curProject" value-key="id" filterable placeholder="所属项目" style="width: 400px;" class="filter-item">
|
<el-option
|
v-for="item in projects"
|
:key="item.id"
|
:label="item.name"
|
:value="item"
|
>
|
<span style="float: left">{{ item.name }}</span>
|
</el-option>
|
</el-select>
|
<el-select
|
v-model="query.userId"
|
filterable
|
clearable
|
placeholder="所属员工"
|
style="width: 185px;"
|
class="filter-item"
|
@keyup.enter.native="crud.toQuery"
|
>
|
<el-option
|
v-for="item in users"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
<rrOperation :crud="crud" />
|
</div>
|
<!--表格渲染-->
|
<el-table
|
ref="table"
|
v-loading="crud.loading"
|
:data="crud.data"
|
size="small"
|
style="width: 100%;"
|
row-key="id"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
@selection-change="crud.selectionChangeHandler"
|
>
|
<el-table-column type="selection" width="55" />
|
<el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="180" />
|
<el-table-column :show-overflow-tooltip="true" label="计划工时" width="80">
|
<template slot-scope="scope">
|
{{ scope.row.sumPlanHours }}
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="planStartTime" label="计划开始时间" width="140" />
|
<el-table-column :show-overflow-tooltip="true" prop="planEndTime" label="计划结束时间" width="140" />
|
<el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80">
|
<template slot-scope="scope">
|
<el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" label="消耗工时" width="80">
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.consumedHours > scope.row.sumPlanHours" type="info">{{ scope.row.consumedHours }}</el-tag>
|
<el-tag v-else type="error">{{ scope.row.consumedHours }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="performanceType" label="绩效类型" width="80">
|
<template slot-scope="scope">
|
<el-tag>{{ dict.label[performanceType][scope.row.performanceType] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="tagList" label="任务分类" width="240">
|
<template slot-scope="scope">
|
<template>
|
<el-tag v-for="tag in scope.row.tagList" :key="tag">{{ tag }}</el-tag>
|
</template>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="description" label="描述" />
|
<el-table-column v-if="checkPer(['admin','task:divide','task:edit','task:del']) && crud.query.flag === true" label="操作" width="180px" align="center" fixed="right">
|
<template slot-scope="scope">
|
<udOperation :data="scope.row" :permission="permission" />
|
</template>
|
</el-table-column>
|
</el-table>
|
<!--分页组件-->
|
<pagination />
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import crudTask from '@/api/task/task'
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
import rrOperation from '@crud/RR.operation'
|
import pagination from '@crud/Pagination'
|
import constant from '@/utils/constant'
|
import crudUser from '@/api/system/user'
|
import crudProject from '@/api/project/project'
|
|
const defaultForm = { id: null, name: null, projectId: null, userIdList: [], parent: { id: null }, priority: null, tagList: [], performanceType: null, description: null, planStartTime: null, planEndTime: null, planHours: null, pieceRate: 0, planWorkload: 0, planWorkloadUnit: null, taskStatus: null, remarks: null, version: null }
|
export default {
|
name: 'UserStatistics',
|
components: { pagination, rrOperation },
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
dicts: [constant.TASK_STATUS],
|
cruds() {
|
return CRUD({ title: '任务', url: 'api/taskDaliy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTask }})
|
},
|
data() {
|
return {
|
props: { multiple: true },
|
queryTypeOptions: [
|
{ key: 'name', display_name: '名称' },
|
{ key: 'projectId', display_name: '所属项目' },
|
{ key: 'priority', display_name: '优先度' },
|
{ key: 'taskStatus', display_name: '任务状态' }
|
],
|
// // 字典:优先度
|
// priority: constant.PRIORITY,
|
// // 字典:任务分类
|
// taskClassification: constant.TAST_CLASSIFICATION,
|
// // 字典: 绩效类型
|
// performanceType: constant.PERFORMANCE_TYPE,
|
// // 字典:标准工作量单位
|
// standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
|
// // 字典:任务状态
|
// taskStatus: constant.TASK_STATUS,
|
// // 字典:批准状态-未承认
|
// approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED,
|
// // 角色级别:超级管理员
|
// roleLevelSuper: constant.ROLE_LEVEL_SUPER,
|
// // 角色级别:总经理
|
// roleLevelGeneral: constant.ROLE_LEVEL_GENERAL,
|
// CRUD状态
|
crudStatusPrepared: CRUD.STATUS.PREPARED,
|
// 用户最大角色级别
|
userRolesLevelMin: null,
|
// 项目列表
|
projects: [],
|
// 父级任务列表
|
pidTasks: [],
|
// 员工列表
|
users: [],
|
// 用户列表
|
tags: [],
|
// tag标签
|
inputVisible: false,
|
inputValue: null,
|
containUserList: [],
|
userList: [],
|
options: [],
|
selectedValue: [],
|
queryUser: [],
|
dialogVisible: false,
|
taskDetailDisabled: true,
|
calendarLoading: true,
|
isShow: false
|
}
|
},
|
created() {
|
this.crud.optShow.reset = false
|
},
|
mounted() {
|
// 获取项目
|
this.getProject()
|
// 获取员工
|
this.getUser()
|
this.getTags()
|
},
|
methods: {
|
getContainUserList(e) {
|
this.form.containUserList = e
|
},
|
getTags() {
|
crudTask.getTags().then(res => {
|
this.tags = res
|
})
|
},
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
[CRUD.HOOK.beforeRefresh]() {
|
if (!this.crud.query.projectId) {
|
return false
|
}
|
// 用户角色级别数组
|
const userRolesLevel = this.$store.state.user.user.roles.map(({ level }) => level)
|
// 用户最大角色级别
|
this.userRolesLevelMin = Math.min(...userRolesLevel)
|
|
return true
|
},
|
// 获取用户
|
getUser() {
|
// 获取用户
|
crudUser.getAll().then(res => {
|
// 用户列表
|
this.users = res
|
})
|
|
crudUser.getUserDept().then(res => {
|
this.options = res
|
})
|
},
|
// 获取项目
|
getProject() {
|
// 获取项目
|
crudProject.getRelevant({
|
'projectStatusIn': ['project_status_not_started', 'project_status_under_way'],
|
'approve_status': 'approve_status_acknowledged'
|
}).then(res => {
|
// 项目列表
|
this.projects = res
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.el-tag + .el-tag {
|
margin-left: 10px;
|
}
|
.button-new-tag {
|
margin-left: 10px;
|
height: 32px;
|
line-height: 30px;
|
padding-top: 0;
|
padding-bottom: 0;
|
}
|
.input-new-tag {
|
width: 90px;
|
margin-left: 10px;
|
vertical-align: bottom;
|
}
|
|
.block{
|
display: inline-block;
|
vertical-align: middle;
|
margin: 0 3px 10px 0;
|
|
input {
|
height: 30.5px;
|
line-height: 30.5px;
|
}
|
}
|
</style>
|