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> </slot>
</div> </div>
<slot v-if="disabled!==true" class="my-select" name="select" :dict="dict" :value="myVal"> <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> </slot>
</div> </div>
</template> </template>
@ -86,9 +86,8 @@
} }
}, },
getMyColor(item){ getMyColor(item){
if(!item){
return ""
}
if(item){
if(this.getColor){ if(this.getColor){
return this.getColor(item.id) return this.getColor(item.id)
} }
@ -96,11 +95,17 @@
return item.color return item.color
} }
return "" return ""
}else{
if(this.getColor){
return this.getColor(this.myVal)
}else{
return ""
}
}
}, },
getMyIcon(item){ getMyIcon(item){
if(!item){
return ""
}
if(item){
if(this.getIcon){ if(this.getIcon){
return this.getIcon(item.id) return this.getIcon(item.id)
} }
@ -108,6 +113,13 @@
return item.icon return item.icon
} }
return ""; return "";
}else{
if(this.getIcon){
return this.getIcon(this.myVal)
}else{
return ""
}
}
}, },
initData(){ initData(){
this.myVal=this.value 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"> <el-option :style="styleObj" v-for="(item,index) in dict" :key="index" :value="item.id" :label="item.name">
<slot :item="item" :dict="dict"> <slot :item="item" :dict="dict">
<span :style="{backgroundColor:getMyColor(item),color:'aliceblue'}" class="padding"> <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}} {{item.name}}
</span> </span>
<i v-if="myVal==item.id" class="el-icon-check"></i> <i v-if="myVal==item.id" class="el-icon-check"></i>
@ -68,10 +68,10 @@
this.myVal=this.value this.myVal=this.value
}, },
getMyColor(item){ getMyColor(item){
if(!item){
return "";
}
if(item){
if(this.getColor){ if(this.getColor){
return this.getColor(item.id) return this.getColor(item.id)
} }
@ -79,11 +79,17 @@
return item.color return item.color
} }
return "" return ""
}else{
if(this.getColor){
return this.getColor(this.myVal)
}else{
return ""
}
}
}, },
getMyIcon(item){ getMyIcon(item){
if(!item){
return "";
}
if(item){
if(this.getIcon){ if(this.getIcon){
return this.getIcon(item.id) return this.getIcon(item.id)
} }
@ -91,6 +97,13 @@
return item.icon return item.icon
} }
return ""; return "";
}else{
if(this.getIcon){
return this.getIcon(this.myVal)
}else{
return ""
}
}
}, },
onChange(data){ onChange(data){
this.$emit('change',data) this.$emit('change',data)

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

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

Loading…
Cancel
Save