Merge pull request #2113 from dataease/pr@dev@feat_share_head_border

style: 分享仪表板头部样式增加下划线
This commit is contained in:
fit2cloud-chenyw 2022-04-14 15:08:31 +08:00 committed by GitHub
commit f9aa4182d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 118 additions and 1 deletions

View File

@ -0,0 +1,117 @@
<template>
<el-select v-model="selected" multiple v-bind="$attrsAll" v-on="$listenserAll" @change="onChange">
<el-option v-for="item in mdoptionsList" :key="item.key" :label="item.label" :value="item.value" />
<slot name="default" />
</el-select>
</template>
<script>
export default {
name: 'ElSelectAll',
props: {
value: {
type: Array,
default: () => {
return []
}
},
options: {
type: Array,
default: () => {
return []
}
}
},
data() {
const selected = this.value || []
return {
selected,
mdoptionsValue: [],
oldMdoptionsValue: [],
mdoptionsList: []
}
},
computed: {
$attrsAll() {
// const val = this.$vnode.data.model && this.$vnode.data.model.value;
const result = {
// value: val,
...this.$attrs
}
return result
},
$listenserAll() {
const _this = this
return Object.assign({}, this.$listeners, {
change: () => {
this.$emit('change', (_this.selected || []).filter(v => {
return v !== 'all'
}))
},
input: () => {
this.$emit('input', (_this.selected || []).filter(v => {
return v !== 'all'
}))
}
})
}
},
watch: {
selected: {
immediate: true,
deep: true,
handler(val) {
this.$emit('input', (val || []).filter(v => {
return v !== 'all'
}))
}
},
options: {
immediate: true,
deep: true,
handler(val) {
if ((!val || val.length === 0) && !this.$slots) {
this.mdoptionsList = []
} else {
this.mdoptionsList = [{
key: 'all',
value: 'all',
label: '全部'
}, ...val]
}
}
}
},
mounted() {
},
methods: {
onChange(val) {
// eslint-disable-next-line no-debugger
const allValues = []
//
for (const item of this.mdoptionsList) {
allValues.push(item.value)
}
//
const oldVal = this.oldMdoptionsValue.length === 1 ? [] : this.oldMdoptionsValue[1] || []
//
if (val.includes('all')) this.selected = allValues
//
if (oldVal.includes('all') && !val.includes('all')) this.selected = []
//
//
if (oldVal.includes('all') && val.includes('all')) {
const index = val.indexOf('all')
val.splice(index, 1) //
this.selected = val
}
//
if (!oldVal.includes('all') && !val.includes('all')) {
if (val.length === allValues.length - 1) this.selected = ['all'].concat(val)
}
//
this.oldMdoptionsValue[1] = this.selected
}
}
}
</script>

View File

@ -23,7 +23,7 @@
</el-link> --> </el-link> -->
</el-col> </el-col>
</el-row> </el-row>
<el-row style="display: flex;"> <el-row style="display: flex;border-bottom: 1px solid;border-bottom-color:#E6E6E6;">
<el-col style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;font-size: 14px; width: 90px;"> <el-col style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;font-size: 14px; width: 90px;">
<span>{{ $t('panel.share_to') }}</span> <span>{{ $t('panel.share_to') }}</span>
</el-col> </el-col>