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

修复重置按钮;

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