feat: 过滤组件绑定
This commit is contained in:
parent
f9f384d030
commit
20c0b4b68d
@ -7,6 +7,7 @@
|
||||
:start-placeholder="options.attrs.startPlaceholder"
|
||||
:end-placeholder="options.attrs.endPlaceholder"
|
||||
:placeholder="options.attrs.placeholder"
|
||||
@change="dateChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@ -32,6 +33,22 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.options = this.element.options
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.setCondition()
|
||||
},
|
||||
setCondition() {
|
||||
const param = {
|
||||
component: this.element,
|
||||
value: Array.isArray(this.options.value) ? this.options.value : [this.options.value],
|
||||
operator: this.operator
|
||||
}
|
||||
this.inDraw && this.$store.dispatch('conditions/add', param)
|
||||
},
|
||||
dateChange(value) {
|
||||
this.setCondition()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
<template>
|
||||
|
||||
<el-input v-if="options!== null && options.attrs!==null" v-model="options.value" style="width: 260px" :placeholder="options.attrs.placeholder">
|
||||
<el-input
|
||||
v-if="options!== null && options.attrs!==null"
|
||||
v-model="options.value"
|
||||
style="width: 260px"
|
||||
:placeholder="options.attrs.placeholder"
|
||||
@keyup.enter.native="search"
|
||||
>
|
||||
|
||||
<el-button slot="append" icon="el-icon-search" />
|
||||
<el-button slot="append" icon="el-icon-search" @click="search" />
|
||||
</el-input>
|
||||
|
||||
</template>
|
||||
@ -23,12 +29,26 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
options: null,
|
||||
operator: 'eq',
|
||||
operator: 'like',
|
||||
values: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.options = this.element.options
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
// this.options.value && this.setCondition()
|
||||
this.setCondition()
|
||||
},
|
||||
setCondition() {
|
||||
const param = {
|
||||
component: this.element,
|
||||
value: [this.options.value],
|
||||
operator: this.operator
|
||||
}
|
||||
this.inDraw && this.$store.dispatch('conditions/add', param)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -68,7 +68,7 @@ class NumberSelectServiceImpl extends WidgetService {
|
||||
|
||||
optionDatas(datas) {
|
||||
if (!datas) return null
|
||||
return datas.map(item => {
|
||||
return datas.filter(item => !!item).map(item => {
|
||||
return {
|
||||
id: item,
|
||||
text: item
|
||||
|
||||
@ -9,7 +9,8 @@ const leftPanel = {
|
||||
const dialogPanel = {
|
||||
options: {
|
||||
attrs: {
|
||||
placeholder: '请选择'
|
||||
placeholder: '请输入关键字',
|
||||
viewIds: []
|
||||
|
||||
},
|
||||
value: ''
|
||||
|
||||
@ -12,7 +12,8 @@ const dialogPanel = {
|
||||
type: 'daterange',
|
||||
rangeSeparator: '至',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期'
|
||||
endPlaceholder: '结束日期',
|
||||
viewIds: []
|
||||
},
|
||||
value: ''
|
||||
},
|
||||
|
||||
@ -10,7 +10,8 @@ const dialogPanel = {
|
||||
options: {
|
||||
attrs: {
|
||||
type: 'date',
|
||||
placeholder: '请选择日期'
|
||||
placeholder: '请选择日期',
|
||||
viewIds: []
|
||||
},
|
||||
value: ''
|
||||
},
|
||||
|
||||
@ -10,7 +10,8 @@ const dialogPanel = {
|
||||
options: {
|
||||
attrs: {
|
||||
type: 'month',
|
||||
placeholder: '请选择年月'
|
||||
placeholder: '请选择年月',
|
||||
viewIds: []
|
||||
},
|
||||
value: ''
|
||||
},
|
||||
|
||||
@ -10,7 +10,8 @@ const dialogPanel = {
|
||||
options: {
|
||||
attrs: {
|
||||
type: 'year',
|
||||
placeholder: '请选择年份'
|
||||
placeholder: '请选择年份',
|
||||
viewIds: []
|
||||
},
|
||||
value: ''
|
||||
},
|
||||
|
||||
@ -56,10 +56,10 @@ export default {
|
||||
],
|
||||
'数字过滤组件': [
|
||||
'numberSelectWidget'
|
||||
],
|
||||
'按钮': [
|
||||
'buttonSureWidget'
|
||||
]
|
||||
// '按钮': [
|
||||
// 'buttonSureWidget'
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user