Merge remote-tracking branch 'origin/dev' into dev
commit
83c702298a
|
@ -351,11 +351,16 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
|
||||||
queries = []
|
queries = []
|
||||||
for search_term_key in filterset.data.keys():
|
for search_term_key in filterset.data.keys():
|
||||||
orm_lookup = self.find_filter_lookups(orm_lookups, search_term_key)
|
orm_lookup = self.find_filter_lookups(orm_lookups, search_term_key)
|
||||||
# print(search_term_key, orm_lookup)
|
if not orm_lookup or filterset.data.get(search_term_key) == '':
|
||||||
if not orm_lookup:
|
|
||||||
continue
|
continue
|
||||||
query = Q(**{orm_lookup: filterset.data[search_term_key]})
|
filterset_data_len = len(filterset.data.getlist(search_term_key))
|
||||||
queries.append(query)
|
if filterset_data_len == 1:
|
||||||
|
query = Q(**{orm_lookup: filterset.data[search_term_key]})
|
||||||
|
queries.append(query)
|
||||||
|
elif filterset_data_len == 2:
|
||||||
|
orm_lookup += '__range'
|
||||||
|
query = Q(**{orm_lookup: filterset.data.getlist(search_term_key)})
|
||||||
|
queries.append(query)
|
||||||
if len(queries) > 0:
|
if len(queries) > 0:
|
||||||
conditions.append(reduce(operator.and_, queries))
|
conditions.append(reduce(operator.and_, queries))
|
||||||
queryset = queryset.filter(reduce(operator.and_, conditions))
|
queryset = queryset.filter(reduce(operator.and_, conditions))
|
||||||
|
|
|
@ -170,26 +170,26 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value: {
|
// value: {
|
||||||
handler (value, oldVal) {
|
// handler (value, oldVal) {
|
||||||
// 父组件收到input事件后会通过v-model改变value参数的值
|
// // 父组件收到input事件后会通过v-model改变value参数的值
|
||||||
// 然后此处会watch到value的改变,发出change事件
|
// // 然后此处会watch到value的改变,发出change事件
|
||||||
// change事件放在此处发射的好处是,当外部修改value值时,也能够触发form-data-change事件
|
// // change事件放在此处发射的好处是,当外部修改value值时,也能够触发form-data-change事件
|
||||||
this.$emit('change', value)
|
// this.$emit('change', value)
|
||||||
this.$emit('input', value)
|
// this.$emit('input', value)
|
||||||
// 如果值是被外部改变的,则修改本组件的currentValue
|
// // 如果值是被外部改变的,则修改本组件的currentValue
|
||||||
if (Array.isArray(value) && value.length === 0) {
|
// if (Array.isArray(value) && value.length === 0) {
|
||||||
this.currentValue = null
|
// this.currentValue = null
|
||||||
this.multipleSelection = null
|
// this.multipleSelection = null
|
||||||
} else {
|
// } else {
|
||||||
if (value && this.dispatch) {
|
// if (value && this.dispatch) {
|
||||||
this.dispatch('ElFormItem', 'el.form.blur')
|
// this.dispatch('ElFormItem', 'el.form.blur')
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
deep: true,
|
// deep: true,
|
||||||
immediate: true
|
// immediate: true
|
||||||
},
|
// },
|
||||||
multipleSelection: {
|
multipleSelection: {
|
||||||
handler (newValue, oldVal) {
|
handler (newValue, oldVal) {
|
||||||
const { tableConfig } = this._elProps
|
const { tableConfig } = this._elProps
|
||||||
|
@ -202,26 +202,26 @@ export default {
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
|
},
|
||||||
|
currentValue (newValue, oldVal) {
|
||||||
|
const { tableConfig } = this._elProps
|
||||||
|
const { value } = this.dict
|
||||||
|
if (newValue) {
|
||||||
|
if (!tableConfig.multiple) {
|
||||||
|
if (newValue[0]) {
|
||||||
|
this.$emit('input', newValue[0][value])
|
||||||
|
this.$emit('change', newValue[0][value])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(newValue)
|
||||||
|
const result = newValue.map((item) => {
|
||||||
|
return item[value]
|
||||||
|
})
|
||||||
|
this.$emit('input', result)
|
||||||
|
this.$emit('change', result)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// currentValue (newValue, oldVal) {
|
|
||||||
// const { tableConfig } = this._elProps
|
|
||||||
// const { value } = this.dict
|
|
||||||
// if (newValue) {
|
|
||||||
// if (!tableConfig.multiple) {
|
|
||||||
// if (newValue[0]) {
|
|
||||||
// this.$emit('input', newValue[0][value])
|
|
||||||
// this.$emit('change', newValue[0][value])
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// console.log(newValue)
|
|
||||||
// const result = newValue.map((item) => {
|
|
||||||
// return item[value]
|
|
||||||
// })
|
|
||||||
// this.$emit('input', result)
|
|
||||||
// this.$emit('change', result)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
// 给currentValue设置初始值
|
// 给currentValue设置初始值
|
||||||
|
|
|
@ -440,11 +440,11 @@ export default {
|
||||||
this.selected.length === 0
|
this.selected.length === 0
|
||||||
? sizeInMap + 'px'
|
? sizeInMap + 'px'
|
||||||
: Math.max(
|
: Math.max(
|
||||||
tags
|
tags
|
||||||
? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0)
|
? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0)
|
||||||
: 0,
|
: 0,
|
||||||
sizeInMap
|
sizeInMap
|
||||||
) + 'px'
|
) + 'px'
|
||||||
input.style.height = height
|
input.style.height = height
|
||||||
if (this.visible && this.emptyText !== false) {
|
if (this.visible && this.emptyText !== false) {
|
||||||
this.broadcast('ElSelectDropdown', 'updatePopper')
|
this.broadcast('ElSelectDropdown', 'updatePopper')
|
||||||
|
|
Loading…
Reference in New Issue