Browse Source

优化

master
陈裕财 3 years ago
parent
commit
c30f6ffb5a
  1. 62
      src/views/xm/core/components/XmUserField/index.vue
  2. 24
      src/views/xm/core/xmTestPlanCase/XmTestPlanCaseEdit.vue

62
src/views/xm/core/components/XmUserField/index.vue

@ -14,7 +14,7 @@
<div v-if="disabled!==true" class="my-select" name="select" :value="myVal">
<el-select v-model="myVal" @change="onSelectChange" :clearable="clearable" filterable>
<el-option value="" disabled v-if="users && users.length>10">
<el-option :value="myVal" disabled v-if="users && users.length>10">
<el-row><el-button :type="deptUserVisible?'':'primary'" @click.stop="deptUserVisible=false">常用用户</el-button> <el-button :type="deptUserVisible?'primary':''" @click.stop="deptUserVisible=true"></el-button><el-button v-if="projectId" :type="projectVisible?'primary':''" @click.stop="projectVisible=true"></el-button> </el-row>
</el-option>
<el-option class="avatar-container" v-for="(item,index) in users" :key="index" :value="item" :label="item.username">
@ -26,7 +26,7 @@
<i v-else>&nbsp;&nbsp;</i>
</div>
</el-option>
<el-option value="" >
<el-option :value="myVal" disabled>
<el-row><el-button :type="deptUserVisible?'':'primary'" @click.stop="deptUserVisible=false">常用用户</el-button> <el-button :type="deptUserVisible?'primary':''" @click.stop="deptUserVisible=true"></el-button><el-button v-if="projectId||productId" :type="projectVisible?'primary':''" @click.stop="projectVisible=true"></el-button> </el-row>
</el-option>
</el-select>
@ -69,10 +69,7 @@
},
myVal(){
if(this.value instanceof String){
this.$emit('input',this.myVal)
}else if(this.value instanceof Object){
myVal(){
if(!this.myVal||!this.myVal.userid){
if(this.value[this.useridKey]){
this.value[this.useridKey]=""
@ -83,12 +80,10 @@
}else{
if(this.value[this.useridKey]!=this.myVal.userid){
this.value[this.useridKey]=this.myVal.userid
this.value[this.usernameKey]=this.myVal.userid
this.value[this.usernameKey]=this.myVal.username
this.$emit('input',this.value)
}
}
}
}
}
},
@ -129,13 +124,10 @@
},
methods: {
showMyValue(myVal){
showMyValue(myVal){
if(!myVal){
return ""
}else{
if(this.value instanceof String){
return myVal
}else if(this.value instanceof Object){
}else{
if(!myVal||!myVal.userid){
return ""
}
@ -145,32 +137,13 @@
return myVal.userid
}else{
return ""
}
}
}
}
},
getMyAvaterInfo(item){
return this.showMyValue(item)
},
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){
@ -185,9 +158,7 @@
}else{
return util.getColor(0)
}
}
}
}
},
getMyIcon(item){
@ -205,14 +176,11 @@
}
},
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]
}
initData(){
var myVal={}
myVal.userid=this.value[this.useridKey]
myVal.username=this.value[this.usernameKey]
this.myVal=myVal
},
onSelectChange(item){

24
src/views/xm/core/xmTestPlanCase/XmTestPlanCaseEdit.vue

@ -13,12 +13,8 @@
<span class="title-font-size">{{editForm.caseName}}</span>
</el-row>
<el-row class="padding">
<el-col :span="8" class="field-box">
<el-avatar class="avater"> {{editForm.execUsername}} </el-avatar>
<div class="msg">
<span class="field-value">{{editForm.execUsername}} </span>
<span class="field-label">执行人</span>
</div>
<el-col :span="8">
<xm-user-field label="执行人" userid-key="execUserid" username-key="execUsername" v-model="editForm" @change="editSomeFields(editForm,'execUserid',$event)"></xm-user-field>
</el-col>
<el-col :span="8">
<dict-field label="优先级" :dict="dicts['priority']" v-model="editForm.priority"></dict-field>
@ -55,7 +51,7 @@
用例类型
</el-row>
<el-row>
<dict-tag :dict="dicts['caseType']" v-model="editForm.caseType"></dict-tag>
<dict-tag :dict="dicts['caseType']" v-model="editForm.caseType" :disabled="true" ></dict-tag>
</el-row>
</el-col>
@ -65,7 +61,7 @@
紧急程度
</el-row>
<el-row>
<dict-tag :dict="dicts['priority']" v-model="editForm.priority"></dict-tag>
<dict-tag :dict="dicts['priority']" v-model="editForm.cpriority" :disabled="true"></dict-tag>
</el-row>
</el-col>
</el-row>
@ -186,12 +182,13 @@ import TestStepResult from './TestStepResult.vue';
import MyInput from '@/components/MDinput/index';
import XmMenuEdit from '../xmMenu/XmMenuEdit.vue';
import XmQuestionMng from '@/views/xm/core/xmQuestion/XmQuestionMng';//
import XmUserField from '@/views/xm/core/components/XmUserField';//
import XmQuestionAdd from '../xmQuestion/XmQuestionEdit';//
export default {
name:'xmTestPlanCaseEdit',
components: {
TestStepResult,MyInput,XmMenuEdit,XmQuestionMng,XmQuestionAdd,
TestStepResult,MyInput,XmMenuEdit,XmQuestionMng,XmQuestionAdd,XmUserField,
},
computed: {
@ -293,12 +290,19 @@ import XmQuestionMng from '@/views/xm/core/xmQuestion/XmQuestionMng';//修改
}
let params={};
params['pkList']=[row].map(i=>{ return { caseId:i.caseId, planId:i.planId}})
params[fieldName]=$event
if(fieldName=='execUserid'){
params.execUserid=$envent[0].userid
params.execUsername=$envent[0].username
}else{
params[fieldName]=$event
}
if(fieldName!='testStep'){
if(this.editForm.testStep!=this.editFormBak.testStep){
params.testStep=this.editForm.testStep
}
}
var func = editSomeFieldsXmTestPlanCase
func(params).then(res=>{
let tips = res.data.tips;

Loading…
Cancel
Save