Browse Source

优化

master
陈裕财 4 years ago
parent
commit
597d14d150
  1. 26
      src/components/DictField/index.vue
  2. 27
      src/components/DictSelect/index.vue
  3. 1
      src/views/xm/core/xmTestPlanCase/TestStepResult.vue

26
src/components/DictField/index.vue

@ -12,7 +12,7 @@
</slot>
</div>
<slot v-if="disabled!==true" class="my-select" name="select" :dict="dict" :value="myVal">
<dict-select :dict="dict" v-model="myVal" @change="onChange"></dict-select>
<dict-select :dict="dict" v-model="myVal" @change="onChange" :get-icon="getIcon" :get-color="getColor"></dict-select>
</slot>
</div>
</template>
@ -86,9 +86,8 @@
}
},
getMyColor(item){
if(!item){
return ""
}
if(item){
if(this.getColor){
return this.getColor(item.id)
}
@ -96,11 +95,17 @@
return item.color
}
return ""
}else{
if(this.getColor){
return this.getColor(this.myVal)
}else{
return ""
}
}
},
getMyIcon(item){
if(!item){
return ""
}
if(item){
if(this.getIcon){
return this.getIcon(item.id)
}
@ -108,6 +113,13 @@
return item.icon
}
return "";
}else{
if(this.getIcon){
return this.getIcon(this.myVal)
}else{
return ""
}
}
},
initData(){
this.myVal=this.value

27
src/components/DictSelect/index.vue

@ -4,7 +4,7 @@
<el-option :style="styleObj" v-for="(item,index) in dict" :key="index" :value="item.id" :label="item.name">
<slot :item="item" :dict="dict">
<span :style="{backgroundColor:getMyColor(item),color:'aliceblue'}" class="padding">
<i v-if="item.icon||getIcon" :class="getMyIcon(item)" ></i>
<i :class="getMyIcon(item)" ></i>
{{item.name}}
</span>
<i v-if="myVal==item.id" class="el-icon-check"></i>
@ -68,10 +68,10 @@
this.myVal=this.value
},
getMyColor(item){
if(!item){
return "";
}
if(item){
if(this.getColor){
return this.getColor(item.id)
}
@ -79,11 +79,17 @@
return item.color
}
return ""
}else{
if(this.getColor){
return this.getColor(this.myVal)
}else{
return ""
}
}
},
getMyIcon(item){
if(!item){
return "";
}
if(item){
if(this.getIcon){
return this.getIcon(item.id)
}
@ -91,6 +97,13 @@
return item.icon
}
return "";
}else{
if(this.getIcon){
return this.getIcon(this.myVal)
}else{
return ""
}
}
},
onChange(data){
this.$emit('change',data)

1
src/views/xm/core/xmTestPlanCase/TestStepResult.vue

@ -125,6 +125,7 @@
getExecStatusIcon(execStatus){
debugger;
var icons=['el-icon-arrow-up','el-icon-right','el-icon-check','el-icon-minus','el-icon-close'];
if(!execStatus){
return icons[0]

Loading…
Cancel
Save