From f34c9a653ac5928783dfdd3cdcde736ae3e4a639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Mon, 25 Jul 2022 18:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MdpSelectUserX/index.vue | 71 +++++++------------ .../core/components/MdpSelectUserXm/index.vue | 47 ++++++------ src/views/xm/core/xmTask/XmTaskEdit.vue | 2 +- 3 files changed, 46 insertions(+), 74 deletions(-) diff --git a/src/components/MdpSelectUserX/index.vue b/src/components/MdpSelectUserX/index.vue index d599b51c..861dde54 100644 --- a/src/components/MdpSelectUserX/index.vue +++ b/src/components/MdpSelectUserX/index.vue @@ -14,7 +14,7 @@
- + 常用用户 部门用户项目组 @@ -23,7 +23,7 @@
{{item.username}} {{item.username}} - +   
@@ -52,7 +52,7 @@ avaterCpd(){ var isEmpty=this.isEmpty(this.myVal) - var username=isEmpty?"":this.myVal.username?this.myVal.username:this.myVal.userid + var username=isEmpty?"":(this.myVal.username?this.myVal.username:this.myVal.userid) var obj={isNull:isEmpty,icon:'el-icon-user',color:'#E4E7ED',innerText:username} if(this.getColor||this.color){ if(this.getColor){ @@ -79,7 +79,7 @@ }, data(){ return { - myVal:null, + myVal:{userid:'',username:''}, users:[], deptUserVisible:false, projectVisible:false, @@ -95,25 +95,23 @@ }, myVal(){ - if(this.value instanceof String){ - this.$emit('input',this.myVal) - }else if(this.value instanceof Object){ - if(!this.myVal||!this.myVal.userid){ - if(this.value[this.useridKey]){ + if(!this.myVal||!this.myVal.userid){ + if(this.value && this.value[this.useridKey]){ this.value[this.useridKey]="" this.value[this.usernameKey]="" this.$emit('input',this.value) } }else{ - if(this.value[this.useridKey]!=this.myVal.userid){ - this.value[this.useridKey]=this.myVal.userid - this.value[this.usernameKey]=this.myVal.username - this.$emit('input',this.value) + if(this.value){ + if(this.value[this.useridKey]!=this.myVal.userid){ + this.value[this.useridKey]=this.myVal.userid + this.value[this.usernameKey]=this.myVal.username + this.$emit('input',this.value) + } } - } - - } + + } } }, @@ -167,25 +165,7 @@ } return false; }, - getMyColor(item){ - if(this.value instanceof String){ - if(item){ - - if(this.getColor){ - return this.getColor(item) - } - return util.getColor(item) - - }else{ - if(this.getColor){ - return this.getColor("0") - }else{ - return util.getColor(0) - } - } - - - }else if(this.value instanceof Object){ + getMyColor(item){ if(item&&item.userid){ @@ -200,9 +180,7 @@ }else{ return util.getColor(0) } - } - - } + } }, getMyIcon(item){ @@ -218,16 +196,17 @@ return "el-icon-user" } } - }, + }, initData(){ - if(this.value instanceof String){ - this.myVal=this.value - }else if(this.value instanceof Object){ - this.myVal={} - this.myVal.userid=this.value[this.useridKey] - this.myVal.username=this.value[this.usernameKey] - } + var myVal={} + if(this.value){ + myVal.userid=this.value[this.useridKey] + myVal.username=this.value[this.usernameKey] + this.myVal=myVal + }else{ + this.myVal={userid:'',username:''} + } }, onSelectChange(item){ diff --git a/src/views/xm/core/components/MdpSelectUserXm/index.vue b/src/views/xm/core/components/MdpSelectUserXm/index.vue index 30f34b88..a7c86dcd 100644 --- a/src/views/xm/core/components/MdpSelectUserXm/index.vue +++ b/src/views/xm/core/components/MdpSelectUserXm/index.vue @@ -24,7 +24,7 @@
{{item.username}} {{item.username}} - +   
@@ -59,7 +59,7 @@ computed: { avaterCpd(){ var isEmpty=this.isEmpty(this.myVal) - var username=isEmpty?"":this.myVal.username?this.myVal.username:this.myVal.userid + var username=isEmpty?"":(this.myVal.username?this.myVal.username:this.myVal.userid) var obj={isNull:isEmpty,icon:'el-icon-user',color:'#E4E7ED',innerText:username} if(this.getColor||this.color){ if(this.getColor){ @@ -86,7 +86,7 @@ }, data(){ return { - myVal:null, + myVal:{userid:'',username:''}, users:[], deptUserVisible:false, projectVisible:false, @@ -103,18 +103,21 @@ myVal(){ if(!this.myVal||!this.myVal.userid){ - if(this.value[this.useridKey]){ + if(this.value && this.value[this.useridKey]){ this.value[this.useridKey]="" this.value[this.usernameKey]="" this.$emit('input',this.value) } }else{ - if(this.value[this.useridKey]!=this.myVal.userid){ - this.value[this.useridKey]=this.myVal.userid - this.value[this.usernameKey]=this.myVal.username - this.$emit('input',this.value) + if(this.value){ + if(this.value[this.useridKey]!=this.myVal.userid){ + this.value[this.useridKey]=this.myVal.userid + this.value[this.usernameKey]=this.myVal.username + this.$emit('input',this.value) + } } + } } @@ -192,27 +195,18 @@ } } - }, - getMyIcon(item){ - if(item){ - if(this.getIcon){ - return this.getIcon(item) - } - return "el-icon-user"; - }else{ - if(this.getIcon){ - return this.getIcon(this.myVal) - }else{ - return "el-icon-user" - } - } }, initData(){ var myVal={} - myVal.userid=this.value[this.useridKey] - myVal.username=this.value[this.usernameKey] - this.myVal=myVal + if(this.value){ + myVal.userid=this.value[this.useridKey] + myVal.username=this.value[this.usernameKey] + this.myVal=myVal + }else{ + this.myVal={userid:'',username:''} + } + }, onSelectChange(item){ @@ -256,8 +250,7 @@ }, mounted(){ var us=localStorage.getItem("mdp-his-users") - this.users=us?JSON.parse(us):[] - + this.users=us?JSON.parse(us):[] this.initData(); } diff --git a/src/views/xm/core/xmTask/XmTaskEdit.vue b/src/views/xm/core/xmTask/XmTaskEdit.vue index c299c54b..a9a5e263 100644 --- a/src/views/xm/core/xmTask/XmTaskEdit.vue +++ b/src/views/xm/core/xmTask/XmTaskEdit.vue @@ -144,7 +144,7 @@ - + 去管理竞标人