Commit f6c19666 authored by huai.li's avatar huai.li

修复查询条件

parent c529d15a
......@@ -85,6 +85,11 @@ export default {
} else {
this.clientForm['Filter[sort]'] = 'ASC'
}
},
_resetForm () {
Object.keys(this.clientForm).forEach(item => {
this.clientForm[item] = ''
})
}
},
created () {
......
......@@ -50,6 +50,10 @@ export default {
window.localStorage.clear()
this.$emit('update:headerClear')
}
},
_resetParams () {
this.$set(this.search, this.searchKey + '[keyword]', '')
}
},
props: ['title', 'searchKey', 'addTitle'],
......
......@@ -23,7 +23,13 @@ export default {
value = obj
}
}
let ret = Object.assign(value, param)
let _param = Object.assign({}, param)
Object.keys(_param).forEach(item => {
if (typeof _param[item] === 'undefined') {
delete _param[item]
}
})
let ret = Object.assign(value, _param)
l.setItem(key, JSON.stringify(ret))
return ret
},
......
......@@ -57,8 +57,8 @@ export default {
},
created () {
this.initParams()
this.init()
this.initParams()
},
methods: {
......@@ -66,12 +66,20 @@ export default {
this.$watch('clientTimeForm', (val) => {
let perid = val[this.formSearchKey + '[period]']
this.$emit('update:list', Object.assign({}, {[this.formSearchKey + '[period]']: perid}))
}, {deep: true})
}, {deep: true, immediate: true})
},
resetParams () {
this.$set(this.clientTimeForm, this.formSearchKey + '[period]', 'all')
this.clientTimeRange.from = ''
this.clientTimeRange.to = ''
},
initParams () {
this.setInitParams((ret) => {
this.$set(this.clientTimeForm, this.formSearchKey + '[period]', ret[this.formSearchKey + '[period]'] || '')
this.$set(this.clientTimeForm, this.formSearchKey + '[period]', ret[this.formSearchKey + '[period]'] || 'all')
this.clientTimeRange.from = ret[this.formSearchKey + '[from]']
this.clientTimeRange.to = ret[this.formSearchKey + '[to]']
})
},
......@@ -88,7 +96,7 @@ export default {
watch: {
'formSearchKey': {
handler (val) {
this.$set(this.clientTimeForm, val + '[period]', '')
this.$set(this.clientTimeForm, val + '[period]', 'all')
}
},
'clientTimeRange.from' (val) {
......
......@@ -7,11 +7,12 @@
:search-key="'ClientSearch'"
:add-title="'新建报销'"
@update:headerSearch="search => searchKeyword(search)"
@update:headerAdd="() => addSch()">
@update:headerAdd="() => addSch()"
@update:headerClear="() => _resetParams()">
</search-header>
<time-search-form
ref="timeSearchForm"
form-search-key="projectSearch"
form-search-key="ReimbursementSearch"
@update:list="search => timeSearchForm(search)">
</time-search-form>
<search-form
......@@ -170,6 +171,12 @@ export default {
this.getFilter()
},
_resetParams () {
this.$refs.searchHeader._resetParams()
this.$refs.timeSearchForm.resetParams()
this.$refs.clientForm._resetForm()
},
_reload () {
let params = this.setParams({
...this.form,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment