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 +++++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 16 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
--
Gitblit v1.9.3