Bladeren bron

品牌管理添加重置按钮

gcz 4 jaren geleden
bovenliggende
commit
def264f403
1 gewijzigde bestanden met toevoegingen van 17 en 5 verwijderingen
  1. 17 5
      src/views/pms/brand/index.vue

+ 17 - 5
src/views/pms/brand/index.vue

@@ -11,6 +11,12 @@
             size="small">
             查询结果
           </el-button>
+          <el-button
+          style="float: right;margin-right: 15px"
+          @click="handleResetSearch()"
+          size="small">
+          重置
+        </el-button>
         </div>
         <div style="margin-top: 15px">
           <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
@@ -142,6 +148,12 @@
   import {fetchList, updateShowStatus, updateFactoryStatus, deleteBrand} from '@/api/brand'
   import {createbrand,updatebrand,deletebrand} from '@/api/permissions'
 
+  const defaultListQuery = {
+    pageNo: 1,
+    pageSize: 10,
+    keyword: null
+  };
+
   export default {
     name: 'brandList',
     data() {
@@ -160,11 +172,7 @@
           }
         ],
         operateType: null,
-        listQuery: {
-          keyword: null,
-          pageNum: 1,
-          pageSize: 10
-        },
+        listQuery: Object.assign({}, defaultListQuery),
         list: null,
         total: null,
         listLoading: true,
@@ -188,6 +196,10 @@
       handleSelectionChange(val) {
         this.multipleSelection = val;
       },
+      handleResetSearch() {
+        this.listQuery = Object.assign({},defaultListQuery);
+        console.log('this.listQuery',this.listQuery);
+      },
       handleUpdate(index, row) {
         this.$router.push({path: '/pms/updateBrand', query: {id: row.id}})
       },