| | |
| | | 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" |
| | |
| | | :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" |
| | |
| | | </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"> |
| | |
| | | resData: true, |
| | | userIds: [], |
| | | watchFlg: false, |
| | | editVar: '' |
| | | editVar: '', |
| | | loadingProject: true, |
| | | loadingTast: false, |
| | | loadingQueryProjectsOne: false, |
| | | loadingQueryProjects: false, |
| | | loadingQueryProjectsTwo: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [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 |
| | | // 判断用户最大角色级别是否是角色级别:超级管理员或角色级别:总经理 |
| | |
| | | [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) |
| | |
| | | }, |
| | | // 获取检索项目 |
| | | 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 |
| | | }) |
| | | }) |
| | | |
| | | // 获取任务列表 |
| | |
| | | }, |
| | | // 检索项目变更 |
| | | queryProjectChange() { |
| | | this.queryTasks = [] |
| | | this.loadingTast = true |
| | | // 检索赋值 |
| | | this.$set(this.query, 'taskId', null) |
| | | // 判断检索项目是否为空 |
| | |
| | | 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 => { |
| | |
| | | // 表单任务列表 |
| | | 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() |
| | | } |
| | |
| | | }, |
| | | // 表单任务变更 |
| | | formTaskChange(cb) { |
| | | this.formTaskUserIds = [] |
| | | this.form.taskUserMongo.id = null |
| | | this.loadingQueryProjectsTwo = true |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTasks.length; i++) { |
| | | // 判断是否为选中任务 |
| | |
| | | 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) { |
| | |
| | | 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++) { |
| | | // 判断是否为选中任务 |
| | |
| | | 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 |