<template>
|
<div class="app-container">
|
<div class="head-container">
|
<div>
|
<!-- 搜索 -->
|
<el-date-picker
|
v-model="query.fillDates"
|
type="daterange"
|
clearable
|
class="filter-item"
|
value-format="yyyy-MM-dd"
|
placeholder="请选择日报日期"
|
range-separator=" ~ "
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
style="width: 285px; margin-top: 6px;"
|
/>
|
<el-cascader
|
v-model="selectedValue"
|
:filterable="true"
|
:options="options"
|
:props="props"
|
clearable
|
placeholder="员工"
|
:show-all-levels="false"
|
:collapse-tags="true"
|
class="cascader-item"
|
@change="changeUserList"
|
/>
|
<el-select v-model="query.projectId" filterable clearable placeholder="所属项目" :loading="loadingProject" style="width: 185px; margin-top: 6px;" class="filter-item" @change="queryProjectChange" @clear="clearQueryTasks">
|
<el-option
|
v-for="item in queryProjects"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
/>
|
</el-select>
|
<el-select v-model="query.taskMongoId" filterable clearable placeholder="所属任务" :loading="loadingTask" style="width: 185px; margin-top: 6px;" class="filter-item">
|
<el-option
|
v-for="item in queryTasks"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
/>
|
</el-select>
|
<el-input v-model="query.name" filterable clearable placeholder="任务名称" style="width: 185px; margin-top: 6px;" class="filter-item" />
|
|
<rrOperation :crud="crud" />
|
|
<div style="color: red;">*检索条件【所属项目】仅包含状态为【进行中】的项目</div>
|
</div>
|
<!--表格渲染-->
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" :summary-method="getSummaries" show-summary @selection-change="crud.selectionChangeHandler">
|
<el-table-column type="selection" width="55" />
|
<el-table-column :show-overflow-tooltip="true" prop="fillDate" label="填写日期" fixed="left" min-width="100px">
|
<template slot-scope="scope">
|
{{ crud.toDate(scope.row.fillDate) }}
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" fixed="left" min-width="100px">
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.userNickName }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" min-width="140px">
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.projectName }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="taskName" label="所属任务" min-width="180px">
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.taskName }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="taskUserMongo.name" label="分配任务" min-width="180px">
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.taskUserMongo.name }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" min-width="80px" />
|
<el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" min-width="80px">
|
<template slot-scope="scope">
|
{{ scope.row.taskProgress }}%
|
</template>
|
</el-table-column>
|
<el-table-column v-if="checkPer(['task:businessLeader'])" :show-overflow-tooltip="true" prop="taskUserMongo.taskHours" label="计划工时" min-width="80px" />
|
<el-table-column v-if="checkPer(['task:businessLeader'])" :show-overflow-tooltip="true" prop="accumulateHours" label="累计工时" min-width="80px" />
|
<el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="绩效类型">
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" min-width="140px" />
|
</el-table>
|
<!--分页组件-->
|
<pagination />
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import crudTaskDaliy from '@/api/task/taskDaliy'
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
import rrOperation from '@crud/RR.operation'
|
import pagination from '@crud/Pagination'
|
import { mapGetters } from 'vuex'
|
import constant from '@/utils/constant'
|
import crudProject from '@/api/project/project'
|
import crudTask from '@/api/task/task'
|
import crudUser from '@/api/system/user'
|
|
const defaultForm = { id: null, projectId: null, taskId: null, taskName: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, todayFixedHours: 0, todayAttendanceHours: 0, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
|
export default {
|
name: 'OtherDaliy',
|
components: { pagination, rrOperation },
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
dicts: [constant.STANDARD_WORKLOAD_UNIT, constant.SETTLEMENT_STATUS],
|
cruds() {
|
return CRUD({ title: '员工任务日报', url: 'api/taskDaliy/4dept', idField: 'id', sort: 'fillDate,desc', crudMethod: { ...crudTaskDaliy }})
|
},
|
data() {
|
return {
|
permission: {
|
add: ['admin', 'taskDaliy:add'],
|
edit: ['admin', 'taskDaliy:edit'],
|
del: ['admin', 'taskDaliy:del'],
|
download: ['admin', 'taskDaliy:download']
|
},
|
queryTypeOptions: [
|
{ key: 'userId', display_name: '所属员工' },
|
{ key: 'projectId', display_name: '所属项目' },
|
{ key: 'taskId', display_name: '所属任务' },
|
{ key: 'taskUserId', display_name: '分配任务' },
|
{ key: 'TaskUserName', display_name: '任务名称' },
|
{ key: 'taskMongoId', display_name: '任务名称' }
|
],
|
// 字典:结算状态
|
settlementStatus: constant.SETTLEMENT_STATUS,
|
// 字典:绩效对象
|
performanceType: constant.PERFORMANCE_TYPE,
|
// 用户列表
|
users: [],
|
// 检索项目列表
|
queryProjects: [],
|
// 检索任务列表
|
queryTasks: [],
|
loadingProject: true,
|
loadingTask: false,
|
|
options: [],
|
selectedValue: [],
|
|
props: { multiple: true }
|
}
|
},
|
computed: {
|
...mapGetters([
|
'user'
|
])
|
},
|
mounted() {
|
this.getUser()
|
this.getQueryProject()
|
},
|
methods: {
|
changeUserList(e) {
|
var tempList = []
|
for (let i = 0; i < e.length; i++) {
|
var temp = e[i]
|
tempList.push(temp[e[i].length - 1])
|
}
|
this.query.userIds = tempList
|
},
|
// 获取用户
|
getUser() {
|
// 获取用户
|
crudUser.getAll().then(res => {
|
// 用户列表
|
this.users = res
|
})
|
|
crudUser.getUserDept().then(res => {
|
this.options = res
|
})
|
},
|
// 获取检索项目
|
getQueryProject() {
|
this.loadingProject = true
|
this.queryProjects = []
|
// 获取项目(liableUserId传''用于占位)
|
crudProject.getAll({ projectStatusIn: ['project_status_under_way'], liableUserId: this.checkPer(['task:businessLeader']) ? '' : null }).then(res => {
|
// 检索项目列表
|
this.queryProjects = res
|
this.loadingProject = false
|
})
|
},
|
// 检索项目变更
|
queryProjectChange() {
|
this.queryTasks = []
|
this.loadingTask = true
|
// 检索赋值
|
this.$set(this.query, 'taskId', null)
|
// 判断检索项目是否为空
|
if (this.query.projectId === null || this.query.projectId === '') {
|
// 检索任务列表
|
this.queryTasks = []
|
} else {
|
// 获取任务
|
crudTask.getAll({ projectId: this.query.projectId }).then(res => {
|
// 检索任务列表
|
this.queryTasks = res
|
this.loadingTask = false
|
})
|
}
|
},
|
clearQueryTasks() {
|
this.loadingTask = false
|
},
|
// 表格工时汇总
|
getSummaries(param) {
|
const { columns, data } = param
|
const sums = []
|
sums[0] = '合计'
|
columns.forEach((column, index) => {
|
if (column.property === 'consumedHours') {
|
const values = data.map(item => Number(item[column.property]))
|
if (!values.every(value => isNaN(value))) {
|
sums[index] = values.reduce((prev, curr) => {
|
const value = Number(curr)
|
if (!isNaN(value)) {
|
return prev + curr
|
} else {
|
return prev
|
}
|
}, 0)
|
sums[index] += ' 小时'
|
} else {
|
sums[index] = ''
|
}
|
}
|
})
|
return sums
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
adventTable tr:first-child {
|
display: none;
|
}
|
.cascader-item >>> .el-input__inner {
|
height: 29.5px !important;
|
line-height: 29.5px !important;
|
}
|
.cascader-item >>> .el-cascader__search-input {
|
height: 20px !important;
|
margin: 2px 0px 0px 15px !important;
|
}
|
.cascader-item >>> .el-tag {
|
margin-top: 4.5px;
|
}
|
.cascader-item >>> .el-input__suffix {
|
height: 29.5px !important;
|
}
|
.cascader-item >>> .el-input--small {
|
height: 29.5px !important;
|
}
|
.cascader-item >>> .el-cascader__tags {
|
height: 29.5px !important;
|
}
|
.cascader-item >>> .el-input--small {
|
height: 29.5px !important;
|
}
|
</style>
|