From bdbce4e615d15f4f8423cc8ac5ee7fc66bb311ef Mon Sep 17 00:00:00 2001
From: churf <123456>
Date: Mon, 21 Aug 2023 09:38:16 +0000
Subject: [PATCH] 前端显示优化
---
eladmin-web-master/src/views/task/task/index.vue | 41 ++++++++++++--------
eladmin-web-master/src/views/task/taskUser/index.vue | 26 ++++++++++++-
2 files changed, 49 insertions(+), 18 deletions(-)
diff --git a/eladmin-web-master/src/views/task/task/index.vue b/eladmin-web-master/src/views/task/task/index.vue
index 3aa06a0..f770db3 100644
--- a/eladmin-web-master/src/views/task/task/index.vue
+++ b/eladmin-web-master/src/views/task/task/index.vue
@@ -105,6 +105,7 @@
allow-create
default-first-option
@keyup.enter.native="handleInputConfirm"
+ @change="handleInputConfirm"
>
<el-option
v-for="(item, id) in tags"
@@ -139,10 +140,10 @@
<template slot="append">小时</template>
</el-input>
</el-form-item>
- <el-form-item label="任务负责人" prop="userId">
- <el-select v-model="form.userIdList" :no-data-text=" '未任务成员' " multiple filterable clearable placeholder="请选择" style="width: 340px;">
+ <el-form-item label="任务成员" prop="containUserList">
+ <el-select v-model="form.containUserList" multiple filterable clearable placeholder="请选择" style="width: 340px;" @change="getContainUserList">
<el-option
- v-for="item in containUserList"
+ v-for="item in users"
:key="item.id"
:label="item.nickName"
:value="item.id"
@@ -152,10 +153,11 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="任务成员" prop="containUserList">
- <el-select v-model="form.containUserList" multiple filterable clearable placeholder="请选择" style="width: 340px;">
+ <el-form-item label="任务负责人" prop="userId">
+ <el-select v-model="form.userIdList" :no-data-text=" '没有任务成员' " multiple filterable clearable placeholder="请选择" style="width: 340px;">
<el-option
v-for="item in users"
+ v-show="form.containUserList != undefined && form.containUserList.some(animal => animal === item.id)"
:key="item.id"
:label="item.nickName"
:value="item.id"
@@ -351,7 +353,7 @@
tags: [],
// tag标签
inputVisible: false,
- inputValue: '',
+ inputValue: null,
containUserList: []
}
},
@@ -366,6 +368,15 @@
this.getTags()
},
methods: {
+ getContainUserList(e) {
+ console.log(e)
+ this.form.containUserList = e
+ },
+ getTags() {
+ crudTask.getTags().then(res => {
+ this.tags = res
+ })
+ },
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
if (!this.crud.query.projectId) {
@@ -381,10 +392,14 @@
if (!this.form.taskStatus) {
this.form.taskStatus = 'task_status_not_started'
}
- if (this.form.parent.id === undefined || this.form.parent.id === null || this.form.parent.id === '') {
- this.form.parent = null
+ if (this.inputValue !== null) {
+ this.form.tagList.push(this.inputValue)
}
return true
+ },
+ [CRUD.HOOK.afterSubmit]() {
+ this.inputValue = null
+ this.getTags()
},
// 钩子:新建 - 之前
[CRUD.HOOK.beforeToCU]() {
@@ -402,12 +417,6 @@
this.crud.query.flag = project.flag
this.crud.toQuery()
this.getProjectTotal()
- },
- getTags() {
- crudTask.getTags().then(res => {
- // 项目列表
- this.tags = res
- })
},
getTaskUser(even) {
this.containUserList = []
@@ -431,11 +440,11 @@
},
handleInputConfirm() {
const inputValue = this.inputValue
- if (inputValue) {
+ if (inputValue !== '') {
this.form.tagList.push(inputValue)
}
this.inputVisible = false
- this.inputValue = ''
+ this.inputValue = null
},
handleSelect(item) {
this.inputValue = item.value
diff --git a/eladmin-web-master/src/views/task/taskUser/index.vue b/eladmin-web-master/src/views/task/taskUser/index.vue
index a609966..4fdf1ea 100644
--- a/eladmin-web-master/src/views/task/taskUser/index.vue
+++ b/eladmin-web-master/src/views/task/taskUser/index.vue
@@ -131,10 +131,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" 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; " />
+ <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'" :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;">
@@ -406,6 +406,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) {
// 获取用户
--
Gitblit v1.9.3