Bläddra i källkod

修改分页问题

wolyshaw 4 år sedan
förälder
incheckning
1694c360b1

+ 1 - 0
src/components/Pagination/index.vue

@@ -79,6 +79,7 @@ export default {
   mounted() {
     if (this.sync) {
       const searchs = new Searchs(this.$route.fullPath)
+      console.log(searchs)
       const active = searchs.get()
       if (active && active.page) {
         for (const key in active.page) {

+ 27 - 2
src/components/save-form/index.vue

@@ -1,5 +1,6 @@
 <template>
   <el-form
+    class="save-form"
     v-bind="{...$attrs, ...$props}"
     v-on="$listeners"
     ref="form"
@@ -11,14 +12,14 @@
 import { Searchs } from '@/helpers'
 export default {
   name: 'save-form',
-  props: ['model'],
+  props: ['model', 'save-key'],
   data() {
     return {
       searchs: null
     }
   },
   mounted() {
-    const searchs = new Searchs(this.$route.fullPath)
+    const searchs = new Searchs(this['save-key'] || this.$route.fullPath)
     this.searchs = searchs
     const active = searchs.get()
     for (const key in active.form) {
@@ -29,6 +30,9 @@ export default {
     }
   },
   methods: {
+    save(search = null, type = 'form') {
+      this.searchs.update(search, undefined, type)
+    },
     validate(FC) {
       this.$refs.form.validate(valid => {
         FC(valid)
@@ -45,3 +49,24 @@ export default {
   },
 }
 </script>
+<style lang="less" scoped>
+.save-form{
+  /deep/ .el-input__inner{
+    width: 180px;
+  }
+  /deep/ .el-form-item__content .el-col {
+    width: 180px;
+  }
+  /deep/ .el-col.line{
+    width: 15px!important;
+    text-align: center;
+  }
+  /deep/ .el-date-editor--daterange{
+    width: 375px;
+  }
+  /deep/ .el-form-item__content .el-col:last-child .el-form-item{
+    margin-right: 0;
+  }
+}
+
+</style>

+ 1 - 1
src/helpers/index.js

@@ -22,7 +22,7 @@ export class Searchs {
     let json = {}
     try {
       const val = sessionStorage.getItem(this.saveKey)
-      json = JSON.parse(val) || {}
+      json = JSON.parse(val) || initSearch
     } catch (error) {}
     return json
   }

+ 1 - 1
src/views/accompaniment/index.vue

@@ -187,7 +187,7 @@ export default {
         const res = await QueryPage({
           ...this.searchForm,
           page: this.rules.page,
-          limit: this.rules.limit,
+          rows: this.rules.limit,
         })
         this.tableList = res.data.rows
         this.$set(this.rules, 'total', res.data.total)