报修任务下拉框

This commit is contained in:
2022-09-30 11:09:13 +08:00
parent a79cd24e32
commit ba4ea2112f
2 changed files with 46 additions and 16 deletions

View File

@@ -1,7 +1,11 @@
<template> <template>
<div class="dropdown-menu" :class="{'toggle_disabled': disabled === true}" ref="elemId"> <div class="dropdown-menu" :class="{'toggle_disabled': disabled === true}" ref="elemId">
<div v-if="inputed === false" class="fxrow dropdown-menu__item" @click="toggleItem"> <div v-if="inputed === false" class="dropdown-menu__item dropdown-menu__item_1">
<span class="dropdown-menu__title" :class="{'dropdown-menu__title_up': up === true,'dropdown-menu__title--active': open === true,'dropdown-menu__title--active_up': up === true && open === true}"><div class="ellipsis chose_T">{{active === '' ? '请选择' : option[active].label}}</div></span> <div class="dropdown-menu__title" :class="{'dropdown-menu__title_up': up === true,'dropdown-menu__title--active': open === true,'dropdown-menu__title--active_up': up === true && open === true}" @click="toggleItem">
<div class="ellipsis chose_T">{{active === '' ? '请选择' : option[active].label}}</div>
<div class="iconfont dropdown_icon"></div>
</div>
<div v-show="active !== '' && cancleShow === true" class="iconfont error_icon" @click="cancleDropdown"></div>
</div> </div>
<div v-if="inputed === true" class="fxrow dropdown-menu__item dropdown-menu__item_2"> <div v-if="inputed === true" class="fxrow dropdown-menu__item dropdown-menu__item_2">
<input <input
@@ -57,6 +61,10 @@ export default {
autoHeight: { autoHeight: {
type: Boolean, type: Boolean,
default: false default: false
},
cancleShow: {
type: Boolean,
default: false
} }
}, },
methods: { methods: {
@@ -79,6 +87,9 @@ export default {
}, },
handleBlur () { handleBlur () {
this.$emit('handleBlur') this.$emit('handleBlur')
},
cancleDropdown () {
this.$emit('cancleDropdown')
} }
} }
} }
@@ -133,6 +144,8 @@ export default {
justify-content center justify-content center
height inherit height inherit
width 100% width 100%
.dropdown-menu__item_1
_fj()
.dropdown-menu__item_2 .dropdown-menu__item_2
align-items flex-start align-items flex-start
.drop_input .drop_input
@@ -144,23 +157,24 @@ export default {
line-height .86rem line-height .86rem
.dropdown-menu__title .dropdown-menu__title
position relative position relative
width 100% width calc(100% - .5rem)
padding 0 .15rem padding-left .15rem
color #606266 color #606266
font-size .3rem font-size .3rem
line-height .44rem line-height .44rem
width 100% width 100%
display block _fj()
&::after // display block
position absolute // &::after
top 50% // position absolute
right .16rem // top 50%
margin-top -.1rem // right .16rem
border .06rem solid // margin-top -.1rem
border-color transparent transparent #606266 #606266 // border .06rem solid
transform rotate(-45deg) // border-color transparent transparent #606266 #606266
opacity 0.8 // transform rotate(-45deg)
content '' // opacity 0.8
// content ''
.dropdown-menu__title_2 .dropdown-menu__title_2
line-height .9rem line-height .9rem
max-width 1.4rem max-width 1.4rem
@@ -224,4 +238,15 @@ export default {
top .9rem top .9rem
.bottom .bottom
top .9rem top .9rem
.dropdown_icon
font-size .25rem
color #dcdfe6
.error_icon
width .3rem
height .3rem
font-size .25rem
line-height .3rem
color #dcdfe6
border .01rem solid #dcdfe6
margin-right .15rem
</style> </style>

View File

@@ -10,8 +10,10 @@
:option="option" :option="option"
:active="active" :active="active"
:open="open" :open="open"
:cancleShow="true"
@toggleItem="toggleItem" @toggleItem="toggleItem"
@dropdownMenu="dropdownMenu"> @dropdownMenu="dropdownMenu"
@cancleDropdown="cancleDropdown">
</dropdown-menu> </dropdown-menu>
</div> </div>
</div> </div>
@@ -93,6 +95,9 @@ export default {
this.active = i + '' this.active = i + ''
this.open = false this.open = false
}, },
cancleDropdown () {
this.active = ''
},
async _deptList () { async _deptList () {
let res = await deptList() let res = await deptList()
if (res.code === '1') { if (res.code === '1') {