Browse Source

优化

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

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

@ -14,7 +14,7 @@
<div v-if="disabled!==true" class="my-select" name="select" :value="myVal"> <div v-if="disabled!==true" class="my-select" name="select" :value="myVal">
<el-select v-model="myVal" @change="onSelectChange" :clearable="clearable" filterable> <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-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>
<el-option class="avatar-container" v-for="(item,index) in users" :key="index" :value="item" :label="item.username"> <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> <i v-else>&nbsp;&nbsp;</i>
</div> </div>
</el-option> </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-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-option>
</el-select> </el-select>
@ -70,9 +70,6 @@
}, },
myVal(){ 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.myVal||!this.myVal.userid){
if(this.value[this.useridKey]){ if(this.value[this.useridKey]){
this.value[this.useridKey]="" this.value[this.useridKey]=""
@ -83,14 +80,12 @@
}else{ }else{
if(this.value[this.useridKey]!=this.myVal.userid){ if(this.value[this.useridKey]!=this.myVal.userid){
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) this.$emit('input',this.value)
} }
} }
} }
}
}, },
props: { props: {
projectId:{ projectId:{
@ -133,9 +128,6 @@
if(!myVal){ if(!myVal){
return "" return ""
}else{ }else{
if(this.value instanceof String){
return myVal
}else if(this.value instanceof Object){
if(!myVal||!myVal.userid){ if(!myVal||!myVal.userid){
return "" return ""
} }
@ -147,30 +139,11 @@
return "" return ""
} }
} }
}
}, },
getMyAvaterInfo(item){ getMyAvaterInfo(item){
return this.showMyValue(item) return this.showMyValue(item)
}, },
getMyColor(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){
if(item&&item.userid){ if(item&&item.userid){
@ -187,8 +160,6 @@
} }
} }
}
}, },
getMyIcon(item){ getMyIcon(item){
if(item){ if(item){
@ -206,13 +177,10 @@
}, },
initData(){ 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={}
myVal.userid=this.value[this.useridKey]
myVal.username=this.value[this.usernameKey]
this.myVal=myVal
}, },
onSelectChange(item){ onSelectChange(item){

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

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

Loading…
Cancel
Save