|
@@ -21,20 +21,23 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- const searchs = new Searchs(this.saveKey || this.$route.path)
|
|
|
- this.searchs = searchs
|
|
|
- const active = searchs.get()
|
|
|
- for (const key in active.form) {
|
|
|
- if (active.form.hasOwnProperty(key)) {
|
|
|
- const item = active.form[key]
|
|
|
- this.model[key] = item
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.saveKey) {
|
|
|
- this.searchs.update(this.$route.path, undefined, 'bind')
|
|
|
- }
|
|
|
+ this.setFormValue()
|
|
|
},
|
|
|
methods: {
|
|
|
+ setFormValue() {
|
|
|
+ const searchs = new Searchs(this.saveKey || this.$route.path)
|
|
|
+ this.searchs = searchs
|
|
|
+ const active = searchs.get()
|
|
|
+ for (const key in active.form) {
|
|
|
+ if (active.form.hasOwnProperty(key)) {
|
|
|
+ const item = active.form[key]
|
|
|
+ this.model[key] = item
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.saveKey) {
|
|
|
+ this.searchs.update(this.$route.path, undefined, 'bind')
|
|
|
+ }
|
|
|
+ },
|
|
|
submit(evt) {
|
|
|
evt.stopPropagation()
|
|
|
evt.stopImmediatePropagation()
|
|
@@ -44,12 +47,17 @@ export default {
|
|
|
this.$listeners.submit(evt)
|
|
|
}
|
|
|
},
|
|
|
- reset() {
|
|
|
+ reset(evt) {
|
|
|
+ evt.stopPropagation()
|
|
|
+ evt.stopImmediatePropagation()
|
|
|
+ evt.preventDefault()
|
|
|
if (this.$listeners.reset) {
|
|
|
this.$listeners.reset()
|
|
|
this.$nextTick(() => {
|
|
|
this.resetFields()
|
|
|
+ // this.setFormValue()
|
|
|
})
|
|
|
+ console.log({...this.model})
|
|
|
} else {
|
|
|
this.resetFields()
|
|
|
}
|