Merge pull request #2484 from dataease/pr@dev_filter_style_select

Pr@dev filter style select
This commit is contained in:
dataeaseShu 2022-06-23 15:07:20 +08:00 committed by GitHub
commit 745fb10a1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 15 deletions

View File

@ -48,6 +48,7 @@
:render-content="treeRenderFun" :render-content="treeRenderFun"
@node-click="_treeNodeClickFun" @node-click="_treeNodeClickFun"
@check="_treeCheckFun" @check="_treeCheckFun"
@check-change="_treeCheckChange"
/> />
<!-- 暂无数据 --> <!-- 暂无数据 -->
<div v-if="data.length === 0" class="no-data">暂无数据</div> <div v-if="data.length === 0" class="no-data">暂无数据</div>
@ -282,6 +283,9 @@ export default {
off(document, 'mouseup', this._popoverHideFun) off(document, 'mouseup', this._popoverHideFun)
}, },
methods: { methods: {
_treeCheckChange() {
this.$emit("treeCheckChange")
},
// //
_setMultipleFun() { _setMultipleFun() {
let multiple = false let multiple = false

View File

@ -11,7 +11,6 @@
:popper-append-to-body="inScreen" :popper-append-to-body="inScreen"
:size="size" :size="size"
:filterable="true" :filterable="true"
class="de-select-tag"
popper-class="coustom-de-select" popper-class="coustom-de-select"
@change="changeValue" @change="changeValue"
@focus="setOptionWidth" @focus="setOptionWidth"
@ -35,6 +34,7 @@ import { multFieldValues, linkMultFieldValues } from '@/api/dataset/dataset'
import bus from '@/utils/bus' import bus from '@/utils/bus'
import { getLinkToken, getToken } from '@/utils/auth' import { getLinkToken, getToken } from '@/utils/auth'
import customInput from '@/components/widget/DeWidget/customInput' import customInput from '@/components/widget/DeWidget/customInput'
import { textSelectWidget } from '@/components/widget/DeWidget/serviceNameFn.js'
export default { export default {
mixins: [customInput], mixins: [customInput],
@ -173,6 +173,11 @@ export default {
onBlur() { onBlur() {
this.onFocus = false this.onFocus = false
}, },
handleElTagStyle() {
setTimeout(() => {
textSelectWidget(this.$refs["deSelect"].$el, this.element.style)
}, 50)
},
initLoad() { initLoad() {
this.value = this.fillValueDerfault() this.value = this.fillValueDerfault()
this.datas = [] this.datas = []
@ -216,6 +221,7 @@ export default {
contentWidth += kid.offsetWidth contentWidth += kid.offsetWidth
}) })
this.showNumber = contentWidth > ((this.$refs.deSelect.$refs.tags.clientWidth - 30) * 0.9) this.showNumber = contentWidth > ((this.$refs.deSelect.$refs.tags.clientWidth - 30) * 0.9)
this.handleElTagStyle()
}) })
}, },
@ -270,6 +276,7 @@ export default {
<style lang="scss"> <style lang="scss">
.coustom-de-select { .coustom-de-select {
background-color: var(--BgSelectColor, #FFFFFF) !important; background-color: var(--BgSelectColor, #FFFFFF) !important;
border-color: var(--BrSelectColor, #E4E7ED) !important;
// .popper__arrow::after{ // .popper__arrow::after{
// border-bottom-color: var(--BgSelectColor, #FFFFFF) !important; // border-bottom-color: var(--BgSelectColor, #FFFFFF) !important;
// } // }
@ -292,20 +299,13 @@ export default {
background-color: rgb(245, 247, 250, .5); background-color: rgb(245, 247, 250, .5);
} }
} }
.de-select-tag {
.el-select__tags {
.el-tag {
background-color: var(--BgSelectColor, #f4f4f5) !important;
border-color: var(--BrSelectColor, #e9e9eb) !important;
color: var(--SelectColor, #909399) !important;
i { .coustom-de-select.is-multiple {
color: var(--SelectColor, #909399) !important; .el-select-dropdown__item.selected {
} background-color: rgb(245, 247, 250, .5) !important;
} }
.el-icon-close { .el-select-dropdown__item.hover {
background-color: var(--BgSelectColor, #C0C4CC) !important; background-color: rgb(245, 247, 250, .5) !important;
}
} }
} }
</style> </style>

View File

@ -16,6 +16,7 @@
@check="changeCheckNode" @check="changeCheckNode"
@select-clear="selectClear" @select-clear="selectClear"
@onFoucs="onFoucs" @onFoucs="onFoucs"
@treeCheckChange="change"
/> />
</template> </template>
@ -26,6 +27,7 @@ import bus from '@/utils/bus'
import { getLinkToken, getToken } from '@/utils/auth' import { getLinkToken, getToken } from '@/utils/auth'
import ElTreeSelect from '@/components/ElTreeSelect' import ElTreeSelect from '@/components/ElTreeSelect'
import customInput from '@/components/widget/DeWidget/customInput' import customInput from '@/components/widget/DeWidget/customInput'
import { textSelectWidget } from '@/components/widget/DeWidget/serviceNameFn.js'
export default { export default {
components: { ElTreeSelect }, components: { ElTreeSelect },
@ -217,6 +219,12 @@ export default {
this.handleCoustomStyle() this.handleCoustomStyle()
}) })
}, },
change() {
setTimeout(() => {
console.log(123, this.$refs.deSelectTree.$refs.select.$el);
textSelectWidget(this.$refs.deSelectTree.$refs.select.$el, this.element.style)
}, 50)
},
selectClear() { selectClear() {
this.changeValue(this.value) this.changeValue(this.value)
}, },
@ -366,6 +374,7 @@ export default {
<style lang="scss"> <style lang="scss">
.test-class-wrap { .test-class-wrap {
background: var(--BgSelectTreeColor, #FFFFFF) !important; background: var(--BgSelectTreeColor, #FFFFFF) !important;
border-color: var(--BrSelectTreeColor, #E4E7ED) !important;
.popper__arrow, .popper__arrow,
.popper__arrow::after { .popper__arrow::after {

View File

@ -26,11 +26,27 @@ export default {
}, },
deep: true deep: true
}, },
multiple: {
handler() {
if (!['de-select-tree', 'de-select'].includes(this.element.component)) return;
const time = setTimeout(() => {
clearTimeout(time)
this.typeTransform().forEach(ele => {
this.handlerInputStyle(ele, this.cssArr)
})
}, 100)
},
deep: true
}
}, },
computed: { computed: {
cssArr() { cssArr() {
const { brColor, wordColor, innerBgColor } = this.element.style; const { brColor, wordColor, innerBgColor } = this.element.style;
return { brColor, wordColor, innerBgColor } return { brColor, wordColor, innerBgColor }
},
multiple() {
const { multiple = false } = this.element.options.attrs
return multiple;
} }
}, },
mounted() { mounted() {

View File

@ -37,10 +37,46 @@ function textSelectGridWidget (nodeCache, name, value) {
} }
} }
} }
function textSelectTreeWidget(nodeCache, style) {
textSelectWidget(nodeCache, style)
}
function textSelectWidget(nodeCache, style) {
let elTag = nodeCache.querySelectorAll('.el-tag.el-tag--info')
if (elTag.length) {
elTag.forEach(item => {
item.style.flexWrap = 'wrap'
item.style.padding = '0'
const textNode = item.querySelector('.el-select__tags-text');
const closeNode = item.querySelector('.el-tag__close');
textNode.style.width = '100%';
textNode.style.padding = '0 20px 0 8px';
textNode.style.borderRadius = '3px';
if (closeNode) {
closeNode.style.position = 'absolute';
closeNode.style.top = '8px';
closeNode.style.right = '2px';
}
styleAttrs.forEach((ele) => {
if (ele !== 'brColor' && closeNode) {
closeNode.style[attrsMap[ele]] = style[ele];
} else {
item.style[attrsMap[ele]] = style[ele];
}
textNode.style[attrsMap[ele]] = style[ele];
})
});
}
}
export { export {
attrsMap, attrsMap,
styleAttrs, styleAttrs,
timeDateRangeWidget, timeDateRangeWidget,
textInputWidget, textInputWidget,
textSelectGridWidget, textSelectGridWidget,
textSelectTreeWidget,
textSelectWidget
} }