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/taskDaliy/index.vue | 175 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 132 insertions(+), 43 deletions(-)
diff --git a/eladmin-web-master/src/views/task/taskDaliy/index.vue b/eladmin-web-master/src/views/task/taskDaliy/index.vue
index 38704e2..3c620d6 100644
--- a/eladmin-web-master/src/views/task/taskDaliy/index.vue
+++ b/eladmin-web-master/src/views/task/taskDaliy/index.vue
@@ -121,7 +121,7 @@
end-placeholder="结束日期"
style="width: 285px;"
/>
- <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery">
+ <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" :loading="loadingProject" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery" @clear="clearQueryTasks">
<el-option
v-for="item in queryProjects"
:key="item.id"
@@ -129,7 +129,7 @@
:value="item.id"
/>
</el-select>
- <el-select v-model="query.taskMongoId" filterable clearable placeholder="所属任务" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-select v-model="query.taskMongoId" filterable clearable placeholder="所属任务" :loading="loadingTast" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
<el-option
v-for="item in queryTasks"
:key="item.id"
@@ -150,56 +150,86 @@
</el-form-item>
<el-form-item label="所属项目" prop="projectId">
<el-select v-if="queryProjects.length > 0" :key="form.projectId" v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formProjectChange">
- <el-option
- v-for="item in queryProjects"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
+ <template v-if="loadingQueryProjectsOne" #prefix>
+ <i class="el-icon-loading" />
+ </template>
+ <template v-if="!loadingQueryProjectsOne">
+ <el-option
+ v-for="item in queryProjects"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </template>
</el-select>
- <el-select v-else v-model="form" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formProjectChange">
- <el-option
- v-for="item in queryProjects"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
+ <el-select v-else v-model="form" filterable clearable :placeholder="loadingQueryProjectsOne ? '加载中' : '请选择'" style="width: 340px;" :disabled="form.flag" @change="formProjectChange">
+ <template v-if="loadingQueryProjectsOne" #prefix>
+ <i class="el-icon-loading" />
+ </template>
+ <template v-if="!loadingQueryProjectsOne">
+ <el-option
+ v-for="item in queryProjects"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </template>
</el-select>
</el-form-item>
<el-form-item label="所属任务" prop="taskId">
<el-select v-if="formTasks.length > 0" :key="form.taskId" v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskChange">
- <el-option
- v-for="item in formTasks"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
+ <template v-if="loadingQueryProjects" #prefix>
+ <i class="el-icon-loading" />
+ </template>
+ <template v-if="!loadingQueryProjects">
+ <el-option
+ v-for="item in formTasks"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </template>
</el-select>
- <el-select v-else v-model="form" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange">
- <el-option
- v-for="item in formTasks"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
+ <el-select v-else v-model="form" filterable clearable :placeholder="loadingQueryProjects ? '加载中' : '请选择'" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange">
+ <template v-if="loadingQueryProjects" #prefix>
+ <i class="el-icon-loading" />
+ </template>
+ <template v-if="!loadingQueryProjects">
+ <el-option
+ v-for="item in formTasks"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </template>
</el-select>
</el-form-item>
<el-form-item label="分配任务" prop="taskUserMongo">
<el-select v-if="formTaskUserIds.length > 0" :key="form.taskUserMongo.id" v-model="form.taskUserMongo.id" :allow-create="true" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange">
- <el-option
- v-for="item in formTaskUserIds"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
+ <template v-if="loadingQueryProjectsTwo" #prefix>
+ <i class="el-icon-loading" />
+ </template>
+ <template v-if="!loadingQueryProjects">
+ <el-option
+ v-for="item in formTaskUserIds"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </template>
</el-select>
- <el-select v-else v-model="form" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange">
- <el-option
- v-for="item in formTaskUserIds"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
+ <el-select v-else v-model="form" filterable clearable :placeholder="loadingQueryProjectsTwo ? '加载中' : '请选择'" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange">
+ <template v-if="loadingQueryProjectsTwo" #prefix>
+ <i class="el-icon-loading" />
+ </template>
+ <template v-if="!loadingQueryProjectsTwo">
+ <el-option
+ v-for="item in formTaskUserIds"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </template>
</el-select>
</el-form-item>
<el-form-item label="填写日期" prop="fillDate">
@@ -441,7 +471,12 @@
resData: true,
userIds: [],
watchFlg: false,
- editVar: ''
+ editVar: '',
+ loadingProject: true,
+ loadingTast: false,
+ loadingQueryProjectsOne: false,
+ loadingQueryProjects: false,
+ loadingQueryProjectsTwo: false
}
},
computed: {
@@ -561,6 +596,10 @@
},
// 钩子:新建 - 之前
[CRUD.HOOK.beforeToAdd]() {
+ this.formTasks = []
+ this.formTaskUserIds = []
+ this.form.taskId = null
+ this.form.taskUserMongo.id = null
this.form.userId = this.user.id
this.form.userNickName = this.user.nickName
// 判断用户最大角色级别是否是角色级别:超级管理员或角色级别:总经理
@@ -589,15 +628,24 @@
[CRUD.HOOK.beforeToEdit]() {
this.form.userId = this.user.id
this.form.userNickName = this.user.nickName
+ this.loadingQueryProjects = true
+ this.loadingQueryProjectsTwo = true
crudTask.getAllOfDaily({ projectId: this.form.projectId }).then(res => {
// 检索任务列表
+
this.formTasks = res
+ this.$nextTick().then(() => {
+ this.loadingQueryProjects = false
+ })
})
crudTaskUser.getAllTaskUser(this.form.taskUserMongo.id).then(res => {
if (res === []) {
this.formTaskUserIds = []
}
this.formTaskUserIds = res
+ this.$nextTick().then(() => {
+ this.loadingQueryProjectsTwo = false
+ })
for (let i = 0; i < this.formTaskUserIds.length; i++) {
this.userIds.push(this.formTaskUserIds[i].id)
@@ -732,12 +780,18 @@
},
// 获取检索项目
getQueryProject() {
+ this.loadingProject = true
this.queryProjects = []
+ this.loadingQueryProjectsOne = true
// 获取项目
crudProject.getRelevantOfDaily().then(res => {
// this.formProjects = res
// 检索项目列表
this.queryProjects = res
+ this.loadingProject = false
+ this.$nextTick().then(() => {
+ this.loadingQueryProjectsOne = false
+ })
})
// 获取任务列表
@@ -748,6 +802,8 @@
},
// 检索项目变更
queryProjectChange() {
+ this.queryTasks = []
+ this.loadingTast = true
// 检索赋值
this.$set(this.query, 'taskId', null)
// 判断检索项目是否为空
@@ -759,8 +815,12 @@
crudTask.getAllOfDaily({ projectId: this.query.projectId }).then(res => {
// 检索任务列表
this.queryTasks = res
+ this.loadingTast = false
})
}
+ },
+ clearQueryTasks() {
+ this.loadingTast = false
},
formDateChange() {
crudTaskDaliy.getDailyDetail({ taskUserId: this.form.taskUserMongo.id, fillDate: this.form.fillDate }).then(res => {
@@ -813,10 +873,19 @@
// 表单任务列表
this.formTasks = []
} else {
+ this.loadingQueryProjects = true
+ this.loadingQueryProjectsTwo = true
+ this.formTasks = []
+ this.formTaskUserIds = []
+ this.form.taskId = null
+ this.form.taskUserMongo.id = null
// 获取任务
crudTask.getAllOfDaily({ projectId: this.form.projectId }).then(res => {
// 检索任务列表
this.formTasks = res
+ this.$nextTick().then(() => {
+ this.loadingQueryProjects = false
+ })
if (cb) {
cb()
}
@@ -825,6 +894,9 @@
},
// 表单任务变更
formTaskChange(cb) {
+ this.formTaskUserIds = []
+ this.form.taskUserMongo.id = null
+ this.loadingQueryProjectsTwo = true
// 循环表单任务列表
for (let i = 0; i < this.formTasks.length; i++) {
// 判断是否为选中任务
@@ -837,6 +909,9 @@
this.userIds.push(res[i].id)
}
this.formTaskUserIds = res
+ this.$nextTick().then(() => {
+ this.loadingQueryProjectsTwo = false
+ })
this.form.taskProgress = res.taskProgress
this.form.consumedHours = res.consumedHours
if (cb) {
@@ -849,9 +924,10 @@
formTaskUserChange() {
this.form.consumedHours = 0
this.form.fillDate = null
- this.form.taskProgress = 0
+ // this.form.taskProgress = 0
this.form.alreadyConsumedHours = 0
this.form.taskHours = 0
+ console.log('ddd:' + this.form.taskUserMongo.id)
// 循环表单任务列表
for (let i = 0; i < this.formTaskUserIds.length; i++) {
// 判断是否为选中任务
@@ -861,10 +937,23 @@
this.tempValue = this.formTaskUserIds[i].alreadyConsumedHours
}
}
+
+ this.getTaskProgress(this.form.taskUserMongo.id)
},
quickFilling(object) {
this.currentTask = object
this.crud.toAdd()
+ this.getTaskProgress(object.id)
+ },
+ getTaskProgress(id) {
+ // 任务更改查询任务进度
+ crudTaskDaliy.getDailyTaskProgress({ taskUserId: id }).then(res => {
+ if (res !== '') {
+ this.form.taskProgress = res.taskProgress
+ } else {
+ this.form.taskProgress = 0
+ }
+ })
},
submitDialogTaskHours() {
this.centerDialogVisibleTaskHours = false
--
Gitblit v1.9.3