forked from github/dataease
commit
1f2d11e75a
@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<el-radio-group @change="visualChange" v-model="selectValue">
|
||||
<el-radio-group
|
||||
style="height: 40px; line-height: 40px"
|
||||
@change="visualChange"
|
||||
v-model="selectValue"
|
||||
>
|
||||
<template v-for="item in options">
|
||||
<el-radio
|
||||
:key="item.id + 'radio'"
|
||||
@ -7,7 +11,7 @@
|
||||
:value="item.id"
|
||||
v-if="radioStyle.showStyle === 'single'"
|
||||
:disabled="itemDisabled"
|
||||
/>
|
||||
/>
|
||||
<el-radio-button
|
||||
v-else
|
||||
:disabled="itemDisabled"
|
||||
@ -91,7 +95,7 @@ export default {
|
||||
},
|
||||
radioStyle: {
|
||||
handler() {
|
||||
this.setPlaceholderColor()
|
||||
this.setPlaceholderColor();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
@ -104,20 +108,20 @@ export default {
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
let styleEle = document.querySelector(`#radio-style${this.id}`)
|
||||
let styleEle = document.querySelector(`#radio-style${this.id}`);
|
||||
if (styleEle) {
|
||||
styleEle. parentElement.removeChild(styleEle)
|
||||
styleEle.parentElement.removeChild(styleEle);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setPlaceholderColor() {
|
||||
let styleEle = document.querySelector(`#radio-style${this.id}`)
|
||||
let styleEle = document.querySelector(`#radio-style${this.id}`);
|
||||
if (!styleEle) {
|
||||
styleEle = document.createElement('style')
|
||||
styleEle.id = `radio-style${this.id}`
|
||||
document.querySelector('head').appendChild(styleEle)
|
||||
styleEle = document.createElement("style");
|
||||
styleEle.id = `radio-style${this.id}`;
|
||||
document.querySelector("head").appendChild(styleEle);
|
||||
}
|
||||
styleEle.innerHTML = `#component${this.id} {\n color: transparent !important; \n border-color:transparent !important; \n background-color: transparent !important; \n } #component${this.id} .el-radio-button:not(.is-active) .el-radio-button__inner {\n color: ${this.radioStyle.wordColor}; \n border-color: ${this.radioStyle.brColor}; \n background-color: ${this.radioStyle.innerBgColor}; \n } #component${this.id} .el-radio:not(.is-check) .el-radio__label {\n color: ${this.radioStyle.wordColor}; \n }`
|
||||
styleEle.innerHTML = `#component${this.id} {\n background-color: transparent !important; \n } #component${this.id} .el-radio-button:not(.is-active) .el-radio-button__inner {\n color: ${this.radioStyle.wordColor}; \n border-color: ${this.radioStyle.brColor}; \n background-color: ${this.radioStyle.innerBgColor}; \n } #component${this.id} .el-radio:not(.is-check) .el-radio__label {\n color: ${this.radioStyle.wordColor}; \n }`;
|
||||
},
|
||||
resetList(arrays) {
|
||||
if (Array.isArray(arrays)) {
|
||||
|
@ -108,7 +108,7 @@ export default {
|
||||
computed: {
|
||||
mode() {
|
||||
let result = 'el-select'
|
||||
if (this.element.style.showMode && this.element.style.showMode === 'radio' && !this.element.options.attrs.multiple && !this.isConfig) {
|
||||
if (this.element.style.showMode && this.element.style.showMode === 'radio' && !this.element.options.attrs.multiple && !this.isConfig && this.element.options.attrs.required) {
|
||||
return 'DeRadio'
|
||||
}
|
||||
if (this.element.options && this.element.options.attrs && this.element.options.attrs.visual) {
|
||||
|
@ -236,7 +236,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<template v-if="this.curComponent.component === 'de-select' && !this.curComponent.options.attrs.multiple">
|
||||
<template v-if="this.curComponent.component === 'de-select' && !this.curComponent.options.attrs.multiple && this.curComponent.options.attrs.required">
|
||||
<el-row
|
||||
style="height: 40px;overflow: hidden;"
|
||||
>
|
||||
@ -299,7 +299,8 @@
|
||||
<el-input-number
|
||||
v-model="curComponent.style.showNum"
|
||||
:min="1"
|
||||
:max="10"
|
||||
step-strictly
|
||||
:max="20"
|
||||
controls-position="right"
|
||||
size="small"
|
||||
/>
|
||||
|
@ -520,7 +520,6 @@ export default {
|
||||
margin-right: -4px;
|
||||
margin-left: 6px;
|
||||
border-radius: 4px;
|
||||
color: #3370FF;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 22px;
|
||||
@ -528,6 +527,7 @@ export default {
|
||||
justify-content: center;
|
||||
&:hover {
|
||||
background: #3370FF1A;
|
||||
color: #3370FF;
|
||||
}
|
||||
|
||||
&.icon-icon-more::before {
|
||||
|
@ -55,6 +55,26 @@
|
||||
>{{ $t('commons.required') }}</el-checkbox>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
append-to-body
|
||||
:before-close="sureRequired"
|
||||
>
|
||||
当前组件的展示风格为平铺,如果设为非必填,那么组件的展示风格将切换为下拉展示。
|
||||
<div style="text-align: end;margin-top: 16px;">
|
||||
<span slot="footer">
|
||||
<el-button
|
||||
size="mini"
|
||||
@click="dialogVisible = false"
|
||||
>{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="sureRequired"
|
||||
>{{ $t('commons.confirm') }}</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
@ -77,18 +97,22 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
targets: []
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
sureRequired() {
|
||||
this.element.options.attrs.required = false
|
||||
this.dialogVisible = false
|
||||
},
|
||||
requiredChange(val) {
|
||||
if (val === false && (this.element.style.showMode && this.element.style.showMode === 'radio' && !this.element.options.attrs.multiple)) {
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.element.options.attrs.required = true
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$emit('required-change', val)
|
||||
},
|
||||
getTableName(tableId) {
|
||||
|
@ -161,6 +161,7 @@
|
||||
<el-input-number
|
||||
v-model="timeRange.maximumSingleQuery"
|
||||
:min="1"
|
||||
step-strictly
|
||||
size="small"
|
||||
controls-position="right"
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user