From d0c51ac702c57f2cae84a8d879a5b605f2dab630 Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Thu, 28 Sep 2023 09:50:45 +0000
Subject: [PATCH] 修改
---
eladmin-web-master/src/views/task/taskUser/index.vue | 269 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 239 insertions(+), 30 deletions(-)
diff --git a/eladmin-web-master/src/views/task/taskUser/index.vue b/eladmin-web-master/src/views/task/taskUser/index.vue
index 13c906b..91bc073 100644
--- a/eladmin-web-master/src/views/task/taskUser/index.vue
+++ b/eladmin-web-master/src/views/task/taskUser/index.vue
@@ -24,11 +24,19 @@
@change="getTaskDatas"
/>
</div>
- <div v-loading="infinite" class="infinite-list" style="overflow:auto;height:500px">
- <el-card v-for="task in taskDatas" :key="task.id" class="box-card" :class="{ 'active': task === selectedTask }" style="margin-bottom: 10px;" shadow="hover">
+ <div v-if="!infinite" class="infinite-list" style="overflow:auto;height:500px">
+ <el-card v-for="task in taskDatas" :key="task.id" class="box-card" :class="{ 'active': task === selectedTask }" style="margin-bottom: 10px;cursor:pointer" shadow="hover">
+ <!-- <el-tooltip class="item" effect="dark" placement="top-start" :open-delay="1000" enterable> -->
+ <!-- <div slot="content" class="slot-style">
+ <div @click="showTaskDetail(task)">
+ <h4 style="cursor: pointer;">查看详细</h4>
+ </div>
+ </div> -->
<div @click="handleNodeClick(task)">
{{ task.name }}
+ <i class="el-icon-search" style="float: right;" @click="showTaskDetail(task)" />
</div>
+ <!-- </el-tooltip> -->
</el-card>
</div>
</el-card>
@@ -54,6 +62,67 @@
</el-col>
<!--任务分配数据-->
<el-col :span="18">
+ <el-dialog
+ title="分配详情"
+ :visible.sync="dialogVisible_taskUser"
+ width="600px"
+ @closed="setNull"
+ @close="dialogVisible_taskUser = false"
+ >
+
+ <div v-if="steps.length > 0" v-loading="dialogLoading_taskUser">
+ <el-card v-if="steps.length > 0">
+ <div style="width: 35%;float: left">
+ 任务名称:{{ TaskName }}
+ <p v-for="(item,index) in taskUserDetail" :key="index">
+ {{ index }} 共消耗 {{ item }} 工时
+ </p>
+ </div>
+ <div style="width: 65%;float: right">
+ <el-progress :percentage="taskProgress" style="width: 80%;margin-left: 55px" :color="ProgressStatus" :format="formatTaskProgress" />
+ <br>
+ <i>任务预计时长:{{ expectedHours }}小时</i><i style="margin-left: 40px">任务实际用时:{{ actualHours }}小时</i>
+ </div>
+ </el-card>
+ </div>
+ <br>
+ <div v-if="steps.length > 0" v-loading="dialogLoading_taskUser" class="block" style="height: 500px; overflow: auto;">
+ <el-timeline>
+ <el-timeline-item v-for="(item,index) in steps" :key="index" :timestamp="item.fillDate" :color="item.color">
+ <el-card>
+ <h4>
+ {{ item.title }}
+ <el-tooltip class="item" effect="dark" :content="item.remarks" placement="top-start">
+ <i v-if="item.flag" class="el-icon-s-comment" style="float: right" />
+ </el-tooltip></h4>
+ </el-card>
+ </el-timeline-item>
+ </el-timeline>
+ </div>
+ <div v-else v-loading="dialogLoading_taskUser" class="block">
+ <p>暂无信息</p></div>
+ </el-dialog>
+
+ <el-dialog
+ title="任务详情"
+ :visible.sync="dialogVisible_task"
+ width="300px"
+ @closed="setNull"
+ @close="dialogLoading_task = false"
+ >
+ <div v-if="taskDetail" v-loading="dialogLoading_task">
+ <el-card style="padding-top: 10px">
+ <div v-for="(item,index) in taskDetail" :key="index" style="padding-top: 10px">
+ <span>{{ index }} 分配时长: {{ item }} 小时</span><br>
+ </div>
+ </el-card>
+ </div>
+ <div v-else>
+ <el-card style="padding-top: 10px">
+ <span>暂无数据</span><br>
+ </el-card>
+ </div>
+ </el-dialog>
<!--工具栏-->
<div class="head-container">
<div>
@@ -131,10 +200,10 @@
<el-input v-model="form.name" style="width: 340px;" />
</el-form-item>
<el-form-item label="任务开始时间" prop="taskStartDate">
- <el-date-picker v-model="form.taskStartDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" poper-class="no-atTheMoment1" :picker-options=" {disabledDate} " style="width: 340px;" />
+ <el-date-picker v-model="form.taskStartDate" popper-class="hide-time" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options=" {disabledDate} " style="width: 340px; " @change="checkStartTime(form.taskStartDate)" />
</el-form-item>
<el-form-item label="任务结束时间" prop="taskEndDate">
- <el-date-picker v-model="form.taskEndDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" poper-class="no-atTheMoment2" :picker-options=" {disabledDate} " style="width: 340px;" />
+ <el-date-picker v-model="form.taskEndDate" popper-class="hide-time" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options=" {disabledDate} " style="width: 340px;" @change="checkEndTime(form.taskEndDate)" />
</el-form-item>
<el-form-item label="任务工时" prop="taskHours">
<el-input v-model="form.taskHours" style="width: 340px;">
@@ -142,7 +211,7 @@
</el-input>
</el-form-item>
<el-form-item label="所属员工" prop="userId">
- <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;">
+ <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.start">
<el-option
v-for="item in users"
:key="item.id"
@@ -165,13 +234,10 @@
</el-form-item>
<el-form-item v-if="form.newTaskProgress === 100" label="任务状态">
<el-switch
- v-model="form.Is_ok"
+ v-model="form.is_ok"
v-permission="permission.list"
active-text="已完成"
/>
- </el-form-item>
- <el-form-item label="备注" style="margin-top: 30px">
- <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -179,7 +245,6 @@
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
- <!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
@@ -191,7 +256,7 @@
<el-table-column type="selection" width="55" />
<el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="270">
<template slot-scope="scope">
- <el-tag>{{ scope.row.name }}</el-tag>
+ <el-tag slot="reference">{{ scope.row.name }}</el-tag>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" />
@@ -199,12 +264,23 @@
<el-table-column :show-overflow-tooltip="true" prop="taskHours" label="任务工时" width="80" />
<el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100">
<template slot-scope="scope">
- <el-tag v-if="scope.row.userNickName">{{ scope.row.userNickName }}</el-tag>
- <el-tag v-else>未指定</el-tag>
+ <el-tooltip class="item" effect="light" :open-delay="1000" placement="top" :disabled="!flag">
+ <div slot="content" class="slot-style">
+ <div @click="showDetail(scope.row)">
+ <h4 style="cursor: pointer;">查看详情</h4>
+ </div>
+ </div>
+ <el-tag v-if="scope.row.userNickName" style="cursor: pointer;">{{ scope.row.userNickName }}</el-tag>
+ <el-tag v-else>未指定</el-tag>
+ </el-tooltip>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="performanceHours" label="绩效工时" width="80" />
- <el-table-column :show-overflow-tooltip="true" prop="newTaskProgress" label="任务进度" width="80" />
+ <el-table-column :show-overflow-tooltip="true" label="任务进度" width="80">
+ <template slot-scope="scope">
+ <span style="margin-left: 10px">{{ scope.row.newTaskProgress }}%</span>
+ </template>
+ </el-table-column>
<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>
@@ -239,6 +315,7 @@
</template>
</el-table-column>
</el-table>
+ <!--表格渲染-->
<!--分页组件-->
<pagination />
<!--表单组件-->
@@ -258,7 +335,6 @@
</el-row>
</div>
</template>
-
<script>
import crudTaskUser from '@/api/task/taskUser'
import crudTask from '@/api/task/task'
@@ -273,7 +349,7 @@
import { mapGetters } from 'vuex'
import constant from '@/utils/constant'
import UploadExcelComponent from '@/components/UploadExcel/index.vue'
-const defaultForm = { id: null, userId: null, projectId: null, task: { id: null }, taskStartDate: null, taskEndDate: null, taskHours: null, newTaskProgress: null, taskStatus: null, remarks: null, divideUserIds: [], Is_ok: false }
+const defaultForm = { id: null, userId: null, projectId: null, task: { id: null }, taskStartDate: null, taskEndDate: null, taskHours: null, newTaskProgress: null, taskStatus: null, remarks: null, divideUserIds: [], is_ok: null }
export default {
name: 'TaskUser',
// eslint-disable-next-line vue/no-unused-components
@@ -359,7 +435,19 @@
uploading: true,
flag: false,
infinite: false,
- selectedTask: ''
+ selectedTask: '',
+ dialogVisible_taskUser: false,
+ dialogLoading_taskUser: true,
+ dialogVisible_task: false,
+ dialogLoading_task: true,
+ steps: [],
+ TaskName: '',
+ expectedHours: '',
+ actualHours: '',
+ taskUserDetail: {},
+ taskDetail: {},
+ taskProgress: '',
+ ProgressStatus: ''
}
},
computed: {
@@ -383,11 +471,40 @@
})
return true
},
+ [CRUD.HOOK.afterSubmit]() {
+ this.formTasks = []
+ this.form.name = null
+ this.form.performanceHours = null
+ this.form.start = false
+ },
+ [CRUD.HOOK.afterEditError]() {
+ this.formTasks = []
+ this.form.name = null
+ this.form.performanceHours = null
+ this.form.start = false
+ },
+ [CRUD.HOOK.afterEditCancel]() {
+ this.formTasks = []
+ this.form.name = null
+ this.form.performanceHours = null
+ this.form.start = false
+ },
+ [CRUD.HOOK.afterAddCancel]() {
+ this.formTasks = []
+ this.form.name = null
+ this.form.performanceHours = null
+ this.form.start = false
+ },
+ [CRUD.HOOK.afterAddError]() {
+ this.formTasks = []
+ this.form.name = null
+ this.form.performanceHours = null
+ this.form.start = false
+ },
[CRUD.HOOK.beforeToCU]() {
- // this.form.taskId = this.query.taskId
- // this.form.taskName = this.selectedTaskName
this.form.task.id = this.query.taskId
this.form.task.name = this.selectedTaskName
+ this.form.projectId = this.projectId
},
[CRUD.HOOK.beforeSubmit]() {
if (!this.form.taskStatus) {
@@ -400,6 +517,28 @@
},
disabledDate(time) {
return time.getTime() < new Date(this.planStartTime) - 8.64e7 || time.getTime() > new Date(this.planEndTime).getTime()
+ },
+ checkStartTime(time) {
+ if (time > this.planEndTime || time < this.planStartTime) {
+ this.form.taskStartDate = null
+ this.$notify({
+ title: '无效时间',
+ type: 'error',
+ duration: 2500
+ })
+ return
+ }
+ },
+ checkEndTime(time) {
+ if (time > this.planEndTime || time < this.planStartTime) {
+ this.form.taskEndDate = null
+ this.$notify({
+ title: '无效时间',
+ type: 'error',
+ duration: 2500
+ })
+ return
+ }
},
// 获取用户
getUser(taskId) {
@@ -527,7 +666,7 @@
},
unPick(e) {
- crudTaskUser.addTaskUser({ 'TaskId': e.id }).then(res => {
+ crudTaskUser.addTaskUser({ 'TaskId': e.id, 'projectId': this.projectId }).then(res => {
this.pickFlg = false
if (res === 1) {
this.$notify({
@@ -547,26 +686,95 @@
})
},
taskCompleted() {
+ const selectData = this.$refs.table.selection
+ var changesId = []
+ for (var i = 0; i < selectData.length; i++) {
+ if (selectData[i].newTaskProgress !== 100) {
+ this.$notify.error({
+ title: '任务进度未达到100%'
+ })
+ return
+ }
+ changesId.push(selectData[i].id)
+ }
+ // 当程序执行到这里时,说明选择的都是已经达到100的任务
+ crudTaskUser.changeStatus(changesId).then(res => {
+ this.crud.toQuery()
+ this.$notify.success({
+ title: '确认成功'
+ })
+ })
+ },
+ showDetail(e) {
+ this.dialogVisible_taskUser = true
+ this.TaskName = e.name
+ this.expectedHours = e.performanceHours
+ this.actualHours = 0
+ // 发送taskUser,获取所有的日报信息,并在后台进行处理,将处理后的结果返回给前端的steps中,进行显示
+ crudTaskUser.getTaskUserDetail(e.id).then(res => {
+ this.steps = res
+ for (let i = 0; i < this.steps.length; i++) {
+ this.taskUserDetail[this.steps[i].taskUserName] = this.steps[i].alreadyConsumeHours
+ }
+ // console.log(this.taskUserDetail)
+ // this.taskUserDetail.map((key, value) => {
+ // console.log(key)
+ // console.log(value)
+ // })
+ // var key = this.taskUserDetail.keySet();
+ for (var key in this.taskUserDetail) {
+ this.actualHours += this.taskUserDetail[key]
+ }
+
+ this.taskProgress = Math.round(this.actualHours / this.expectedHours * 100)
+ if (this.taskProgress > 100) {
+ this.taskProgress = 100
+ }
+ if (this.taskProgress === 100) {
+ this.ProgressStatus = '#F56C6C'
+ }
+ if (this.taskProgress < 100) {
+ this.ProgressStatus = '#409EFF'
+ }
+ // this.taskUserDetail.forEach(function(value,key){
+ // console.log(value,key);
+ // });
+ this.dialogLoading_taskUser = false
+ })
+ },
+ setNull() {
+ this.taskUserDetail = {}
+ this.dialogLoading_taskUser = true
+ this.dialogLoading_task = true
+ },
+ showTaskDetail(e) {
+ console.log(e.id)
+ this.dialogVisible_task = true
+ crudTaskUser.getTaskDetail(e.id).then(res => {
+ for (let i = 0; i < res.length; i++) {
+ this.taskDetail[res[i].nickName] = res[i].assignedWork
+ }
+ this.dialogLoading_task = false
+ })
+ },
+ formatTaskProgress(percentage) {
+ return percentage === 100 ? '实际消耗已超出计划时长' : `${percentage}%`
}
}
}
</script>
-<style rel="stylesheet/scss" lang="scss">
+<style rel="stylesheet/scss" lang="scss" >
- .el-picker-panel.no-atTheMoment1 {
- .el-button--text.el-picker-panel__link-btn {
+ /*.el-picker-panel__footer{*/
+ /* display: none;*/
+ /*}*/
+ .hide-time .el-button--text {
display: none;
}
- }
- .el-picker-panel.no-atTheMoment2{
- .el-button--text.el-picker-panel__link-btn{
- display: none;
- }
- }
- .tree-scroll {
+ .tree-scroll {
height: 100%;
width: 100%;
}
@@ -596,4 +804,5 @@
/* 添加长亮效果的样式 */
color: #1890ff;
}
+
</style>
--
Gitblit v1.9.3