Browse Source

优化

master
陈裕财 3 years ago
parent
commit
4db71bd66c
  1. 84
      src/components/DateRangeField/index.vue
  2. 2
      src/components/DictField/index.vue

84
src/components/DateRangeField/index.vue

@ -1,10 +1,10 @@
<template> <template>
<div class="field-box"> <div class="field-box">
<el-avatar class="avater" :icon="getMyIcon(dateRange)" :style="{backgroundColor:getMyColor(dateRange)}">{{getMyAvaterInfo(dateRange)}}</el-avatar>
<el-avatar class="avater" :icon="avaterCpd.icon" :style="{backgroundColor:avaterCpd.color}">{{avaterCpd.innerText}}</el-avatar>
<div class="field-info"> <div class="field-info">
<slot name="field-info" :value="dateRange"> <slot name="field-info" :value="dateRange">
<span class="field-value">{{formatDateRange(dateRange) }} </span>
<span class="field-value">{{avaterCpd.innerText? avaterCpd.innerText:'无'}} </span>
<slot name="label"> <slot name="label">
<span class="field-label">{{label}}</span> <span class="field-label">{{label}}</span>
@ -32,7 +32,36 @@ export default {
name: 'date-range', name: 'date-range',
components: { }, components: { },
computed: { computed: {
avaterCpd(){
var isEmpty=this.isEmpty(this.dateRange)
var formatDate=this.formatDateRange(this.dateRange);
var obj={isNull:isEmpty,icon:'el-icon-full-screen',color:'#E4E7ED',innerText:formatDate}
if(this.getColor||this.color){
if(this.getColor){
obj.color= this.getColor(this.dateRange)
}else{
obj.color=this.color
}
}else{
if(!isEmpty){
obj.color= util.getColor(this.dateRange)
}
}
if(this.getIcon||this.icon){
if(this.getIcon){
obj.icon= this.getIcon(this.dateRange)
}else if(this.icon){
obj.icon=this.icon
}
}else {
if(!isEmpty){
obj.icon=''
}
}
return obj;
}
}, },
data(){ data(){
return { return {
@ -213,45 +242,58 @@ export default {
margin-right:5px; margin-right:5px;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
height: 40px;
line-height: 40px;
.avater { .avater {
background-color:#FF9F73; background-color:#FF9F73;
} }
.field-info { .field-info {
height: 40px;
line-height: 40px;
margin-left: 10px; margin-left: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.field-value { .field-value {
font-size: 16px;
height: 20px;
line-height: 20px;
font-size: 0.75rem;
} }
.field-label{ .field-label{
height: 40px;
font-size: 14px;
height: 20px;
line-height: 20px;
font-size: 0.75rem;
color: #C0C4CC; color: #C0C4CC;
} }
} }
.my-select{ .my-select{
height: 20px;
line-height: 20px;
margin-left: 5px; margin-left: 5px;
margin-right:5px;
display: none;
}
.btn{
margin-top: 0px;
visibility:hidden;
margin-right:5px;
max-width: 250px;
display: none;
} }
} }
.field-box:hover .btn{
visibility: visible !important;
.field-box:hover .field-label{
display: none;
} }
.field-box:hover .my-select{ .field-box:hover .my-select{
margin-left: 5px;
height: 20px;
margin-left: 5px;
display: inline; display: inline;
height: 40px;
}
.field-box:hover .field-label{
display: none;
}
}
.dashed-circle{
width:40px;
height:40px;
border:2px dashed #000000;
border-radius:40px/40px;
}
.field-box:hover .dashed-circle{
border:2px dashed #409EFF;
}
</style> </style>

2
src/components/DictField/index.vue

@ -207,7 +207,7 @@ import util from '@/common/js/util'
line-height: 20px; line-height: 20px;
margin-left: 5px; margin-left: 5px;
margin-right:5px; margin-right:5px;
max-width: 120px;
max-width: 250px;
display: none; display: none;
} }

Loading…
Cancel
Save