浏览代码

更新重置时条件有问题

lex-xin 4 年之前
父节点
当前提交
9053d8ddfa

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

@@ -62,6 +62,11 @@ export default {
       default: ''
     }
   },
+  data() {
+    return {
+      pageInformation: null
+    }
+  },
   computed: {
     currentPage: {
       get () {
@@ -92,6 +97,7 @@ export default {
     if (this.sync) {
       const searchs = new Searchs(this.saveKey || this.$route.path)
       const active = searchs.get()
+      this.pageInformation = active
       if (active && active.page) {
         for (const key in active.page) {
           if (active.page.hasOwnProperty(key)) {
@@ -105,8 +111,14 @@ export default {
         searchs.update(this.$route.path, undefined, 'bind')
       }
     }
+    window.addEventListener('watchStorage', this.watchStorage)
   },
   methods: {
+    watchStorage() {
+      let page = this.pageInformation && this.pageInformation.page ? this.pageInformation.page : null
+      this.currentPage = page && page.page ? page.page : 1
+
+    },
     syncStore() {
       if (this.sync) {
         const searchs = new Searchs(this.saveKey || this.$route.path)
@@ -127,6 +139,9 @@ export default {
       }
       this.syncStore()
     }
+  },
+  destroyed() {
+    window.removeEventListener('watchStorage', this.watchStorage)
   }
 }
 </script>

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

@@ -53,15 +53,19 @@ export default {
       evt.stopPropagation()
       evt.stopImmediatePropagation()
       evt.preventDefault()
+      let setItemEvent = new Event('watchStorage')
+      window.dispatchEvent(setItemEvent)
+
       if (this.$listeners.reset) {
-        this.$listeners.reset()
         if (this.noclear == undefined) {
           this.$nextTick(() => {
             this.resetFields()
             // this.setFormValue()
           })
+        } else {
+          this.resetFields()
         }
-
+        this.$listeners.reset()
       } else {
         this.resetFields()
       }

+ 1 - 0
src/views/businessManager/orderManager/income.vue

@@ -576,6 +576,7 @@ export default {
         lessActualAmount: null,
         orderDate:[]
       };
+      // this.pageInfo.page = 1;
       this.getNow()
       this.getList();
     },

+ 8 - 1
src/views/businessManager/shopManager/purchase-llist.vue

@@ -94,6 +94,11 @@
             </template>
           </el-table-column> -->
         </el-table>
+        <pagination sync :total.sync="pageInfo.total"
+                    :page.sync="pageInfo.page"
+                    :limit.sync="pageInfo.limit"
+                    :page-sizes="pageInfo.page_size"
+                    @pagination="getList" />
       </div>
     </div>
     <el-dialog title="新增进货清单"
@@ -108,6 +113,7 @@
   </div>
 </template>
 <script>
+import pagination from '@/components/Pagination/index'
 import dayjs from 'dayjs'
 import purchaseForm from './purchase-form'
 import { getGoodsProcurements } from '@/api/businessManager'
@@ -119,7 +125,8 @@ const initSearchForm = {
 
 export default {
   components: {
-    purchaseForm
+    purchaseForm,
+    pagination
   },
   data () {
     let query = this.$route.query