Commit 9f17d823 authored by 高宇's avatar 高宇

修复重置按钮;

parent 4742c06a
......@@ -12,6 +12,7 @@
:edit-client="editClient"
:button-title="buttonTitle"
:key-code="keyCode"
:reset-form="resetForm"
:model="model" v-if="type !== ''"></component>
</el-row>
</div>
......@@ -39,7 +40,8 @@
'buttonTitle',
'editClient',
'model',
'keyCode'],
'keyCode',
'resetForm'],
created () {
}
}
......
......@@ -12,8 +12,8 @@
<i class="fa fa-plus faa-pulse animated"></i> {{buttonTitle}}
</el-button>
</el-form-item>
<el-form-item v-if="searchKey">
<a class="btn">
<el-form-item>
<a class="btn" @click="resetForm">
<i class="fa fa-fw fa-refresh faa-spin animated-hover"></i>
</a>
</el-form-item>
......@@ -36,7 +36,7 @@
// this.$emit('update:addNew')
// }
},
props: ['model', 'searchKey', 'keyCode', 'buttonTitle', 'searchKeyword', 'addNewUser'],
props: ['model', 'searchKey', 'keyCode', 'buttonTitle', 'searchKeyword', 'addNewUser', 'resetForm'],
created () {
}
}
......
......@@ -9,6 +9,7 @@
:key-code="'keyword'"
type="keyword"
button-title="新建工作日志"
:reset-form="resetForm"
:add-new-user="addNewLog"
:search-keyword="searchKeyword"></client-header>
<client-form ref="clientForm" :filter="filter" @update:clientList="form =>{ updateForm(form) }"></client-form>
......@@ -242,13 +243,20 @@
},
updatePage (pager) {
Object.assign(this.pagenation, pager)
this.getList(true)
},
resetForm () {
this.$refs.clientForm.resetForm()
Object.keys(this.form).forEach(item => {
this.form[item] = ''
})
this.getList()
},
updateForm (form) {
Object.assign(this.form, form)
this.getList()
},
getList () {
getList (toTop) {
if (this.loading) {
return
}
......@@ -263,7 +271,9 @@
// this.pagenation.page = res.pagenation.thispage
this.totalcount = res.pagenation.totalcount
// this.totalcount = 8
this.$el.querySelector('.page-body-content').scrollTo(0, 0)
if (toTop) {
this.$el.querySelector('.page-body-content').scrollTo(0, 0)
}
}).finally(_ => {
this.loading = false
})
......
......@@ -211,9 +211,9 @@
},
updatePage (pager) {
Object.assign(this.pagenation, pager)
this.getList()
this.getList(true)
},
getList () {
getList (toTop) {
if (this.loading) {
return
}
......@@ -226,6 +226,9 @@
this.result.list = res.list
// this.pagenation.page = res.pagenation.thispage
this.totalcount = res.pagenation.totalcount
if (toTop) {
this.$el.querySelector('.page-body-content').scrollTo(0, 0)
}
}).finally(_ => {
this.loading = false
})
......
......@@ -62,13 +62,12 @@
// this.$refs['elCasc' + key][0].menuVisible = false
},
setCascader (item, key) {
console.log(item.cascader)
if (item.cascader.length === 1) {
this.clientForm[item.key] = item.cascader[0]
this.clientForm[item.itemKey] = ''
} else if (item.cascader.length === 2) {
this.clientForm[item.itemKey] = item.cascader[1]
this.clientForm[item.key] = item.cascader[0]
this.clientForm[item.itemKey] = item.cascader[0]
this.clientForm[item.key] = item.cascader[1]
} else {
this.clientForm[item.itemKey] = ''
this.clientForm[item.key] = ''
......@@ -124,6 +123,16 @@
} else {
this.clientForm['Filter[sort]'] = 'ASC'
}
},
resetForm () {
Object.keys(this.clientForm).forEach(item => {
this.clientForm[item] = ''
})
this.filter.forEach(item => {
if (item.cascader) {
item.cascader = []
}
})
}
},
mounted () {
......
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