瀏覽代碼

分页优化

chen 3 年之前
父節點
當前提交
5db25d2d43

+ 5 - 4
src/views/basic_data/dealer/dealer_list.vue

@@ -100,8 +100,8 @@ export default {
   components: {
     DealerListDetail,
   },
-  async created() {
-    await this.getList();
+  created() {
+    this.getList();
   },
   computed: {
     exParams() {
@@ -125,7 +125,7 @@ export default {
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val;
-
+      this.currentPage = 1;
       this.getList();
     },
     // 更改当前页
@@ -135,7 +135,8 @@ export default {
     },
     //搜索功能
     async searchFn() {
-      await this.getList();
+      this.currentPage = 1;
+      this.getList();
     },
     //重置
     clearFn() {

+ 18 - 36
src/views/basic_data/dealer/dealer_stock.vue

@@ -28,7 +28,7 @@
         </el-popconfirm>
       </div>
       <div class="fr">
-           <el-button type="primary" size="mini" @click="downLoadFns">导出</el-button>
+        <el-button type="primary" size="mini" @click="downLoadFns">导出</el-button>
         <el-button type="primary" size="mini" @click="downLoadFn">下载模板</el-button>
         <el-upload class="import-btn" action="" :http-request="handleImport" :file-list="importFileList" :show-file-list="false">
           <el-button type="primary" size="mini">导入</el-button>
@@ -271,7 +271,7 @@ export default {
   async created() {
     this.getTree();
     // this.getAdminWebsit(1);
-    this.getList({ pageNum: 1, pageSize: 10 });
+    this.getList();
     this.getDealerDataList({ pageNum: 1, pageSize: -1 });
     this.getUserList(1);
     // this.getSelectList({ sysDictEnum: "PRODUCT_TYPE" });
@@ -326,21 +326,13 @@ export default {
     // 导入
     async handleImport(param) {
       const file = param.file;
-
       const formData = new FormData();
       formData.append("file", file);
-
       let result = await handleImport("/customer/pt/importData", formData);
-
-      console.log(result);
       this.importFileList = [];
       if (result.code == 200) {
         this.$message.success("导入成功");
-        await this.getList({
-          customerName: this.searchForm.customerName,
-          pageNum: 1,
-          pageSize: 10,
-        });
+        await this.getList();
       } else {
         this.$message.error(result.message);
       }
@@ -349,7 +341,7 @@ export default {
     downLoadFn() {
       downloadFiles("/customer/pt/download");
     },
- //下载模板
+    //下载模板
     downLoadFns() {
       downloadFiles("/customer/pt/export");
     },
@@ -466,7 +458,7 @@ export default {
         await deleDealerStockList({ ids: res });
       }
 
-      this.getList({ pageNum: 1, pageSize: 10 });
+      this.getList();
 
       this.$message.success("删除成功");
       this.ids = [];
@@ -527,7 +519,7 @@ export default {
       this.$nextTick(() => {
         this.$refs["addForm"].clearValidate();
       });
-      this.getList({ pageNum: 1, pageSize: 10 });
+      this.getList();
       this.dialogForm = false;
     },
     //取消
@@ -563,41 +555,31 @@ export default {
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val;
-      // this.currentPage = 1
-      this.getList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        customerName: this.searchForm.customerName,
-      });
+      this.currentPage = 1;
+      this.getList();
     },
     // 更改当前页
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.getList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        customerName: this.searchForm.customerName,
-      });
+      this.getList();
     },
     //搜索功能
-    async searchFn() {
-      // console.log(this.searchForm);
+    searchFn() {
       this.currentPage = 1;
-      await this.getList({
-        customerName: this.searchForm.customerName,
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-      });
+      this.getList();
     },
     //重置
     clearFn() {
-      console.log(this.$refs.searchForm);
       this.$refs.searchForm.resetFields();
     },
     //获取列表数据
-    async getList(data) {
-      const res = await getDealerStockList(data);
-
+    async getList() {
+      let params = {
+        customerName: this.searchForm.customerName,
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+      };
+      const res = await getDealerStockList(params);
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 11 - 28
src/views/basic_data/supplier/supplier_list.vue

@@ -88,60 +88,43 @@ export default {
   },
 
   async created() {
-    await this.getList({ pageSize: 10, pageNum: 1 });
+    await this.getList();
   },
   methods: {
-    async getList(data) {
-      const res = await getList(data);
-      console.log(res);
-      this.dataList = res.data.records;
-      this.listTotal = res.data.total;
-    },
     //搜索功能
     async searchFn() {
-      console.log(this.searchForm);
-      await this.getList({ ...this.searchForm, pageNum: 1, pageSize: 10 });
+      await this.getList();
     },
     //重置
     clearFn() {
-      console.log(this.$refs.searchForm);
       this.$refs.searchForm.resetFields();
     },
 
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val;
-      this.currentPage = 1;
-      this.getList({ pageNum: 1, pageSize: this.pageSize });
+      this.getList();
     },
     // 更改当前页
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.getList({ pageNum: val, pageSize: 10 });
+      this.getList();
     },
     async editFn(id) {
       this.isShow = false;
       const res = await getInfoApi({ id });
       this.infoList = res.data;
     },
-    async getList(data) {
-      let res = await getList(data);
-      console.log(res);
+    async getList() {
+      let params = {
+        name: this.searchForm.name,
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+      };
+      let res = await getList(params);
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },
-
-    // 更改每页数量
-    handleSizeChange(val) {
-      this.pageSize = val;
-      this.currentPage = 1;
-      this.getList({ pageNum: 1, pageSize: this.pageSize });
-    },
-    // 更改当前页
-    handleCurrentChange(val) {
-      this.currentPage = val;
-      this.getList({ pageNum: val, pageSize: 10 });
-    },
   },
 };
 </script>

+ 15 - 14
src/views/basic_data/taker/taker_car.vue

@@ -180,7 +180,7 @@ export default {
     },
   },
   async created() {
-    this.getDataList({ pageNum: 1, pageSize: 10 });
+    this.getDataList();
     this.getDealerDataList({ pageNum: 1, pageSize: 10 });
   },
   methods: {
@@ -228,12 +228,8 @@ export default {
     },
     //搜索
     async searchFn() {
-      console.log(this.searchForm);
-      await this.getDataList({
-        ...this.searchForm,
-        pageNum: 1,
-        pageSize: this.pageSize,
-      });
+      this.currentPage = 1;
+      await this.getDataList();
     },
     //删除
     async delFn(ids) {
@@ -249,7 +245,7 @@ export default {
 
       this.$message.success("删除成功");
       this.ids = [];
-      this.getDataList({ pageNum: this.currentPage, pageSize: this.pageSize });
+      this.getDataList();
     },
     //获取经销商数据
     async getDealerDataList(data) {
@@ -293,13 +289,18 @@ export default {
       //   carBrand: "",
       // };
       await this.$refs.addForm.resetFields();
-      this.getDataList({ pageNum: this.currentPage, pageSize: this.pageSize });
+      this.getDataList();
       this.dialogForm = false;
     },
     //获取列表数据
-    async getDataList(data) {
-      const res = await getCarList(data);
-      console.log(res);
+    async getDataList() {
+      let params = {
+        carBrand: this.searchForm.carBrand,
+        customerName: this.searchForm.customerName,
+        pageSize: this.pageSize,
+        pageNum: this.currentPage,
+      };
+      const res = await getCarList(params);
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },
@@ -308,12 +309,12 @@ export default {
     handleSizeChange(val) {
       this.pageSize = val;
       this.currentPage = 1;
-      this.getDataList({ pageNum: 1, pageSize: this.pageSize });
+      this.getDataList();
     },
     // 更改当前页
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.getDataList({ pageNum: val, pageSize: this.pageSize });
+      this.getDataList();
     },
   },
 };

+ 20 - 18
src/views/basic_data/taker/taker_list.vue

@@ -57,8 +57,8 @@
           <el-table-column align="left" label="创建时间" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
           <el-table-column align="left" label="状态" prop="flag" min-width="100" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-tag type="success" v-if="scope.row.flag === 1">有效</el-tag>
-              <el-tag type="danger" v-else-if="scope.row.flag === 2">失效</el-tag>
+              <el-tag size="mini" type="success" v-if="scope.row.flag === 1">有效</el-tag>
+              <el-tag size="mini" type="danger" v-else-if="scope.row.flag === 2">失效</el-tag>
             </template>
           </el-table-column>
           <el-table-column align="center" label="操作" prop="caozuo" min-width="160" show-overflow-tooltip fixed="right">
@@ -266,8 +266,8 @@ export default {
       showOK: true,
     };
   },
-  async created() {
-    await this.getDataList({ pageNum: 1, pageSize: 10 });
+  created() {
+    this.getDataList();
 
     // await this.getDealerDataList({ pageNum: 1, pageSize: 10 });
   },
@@ -293,7 +293,7 @@ export default {
     async deleFn(ids) {
       await deleDataList({ ids });
       this.$message.success("删除成功");
-      this.getDataList({ pageNum: 1, pageSize: 10 });
+      this.getDataList();
     },
     //查看
     seeFn(data) {
@@ -337,7 +337,7 @@ export default {
     async stopFn(id) {
       await stopTaker({ id });
       this.$message.success("成功");
-      this.getDataList({ pageNum: 1, pageSize: this.pageSize });
+      this.getDataList();
     },
     //获取验证码
     async getCodeFn() {
@@ -361,20 +361,25 @@ export default {
       this.dealerList = res.data.records;
     },
     //获取列表数据
-    async getDataList(data) {
-      let res = await getList(data);
-      console.log(res);
+    async getDataList() {
+      let params = {
+        customerName: this.searchForm.customerName,
+        takerName: this.searchForm.takerName,
+        phoneKeyword: this.searchForm.phoneKeyword,
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+      };
+      let res = await getList(params);
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },
     //搜索功能
     async searchFn() {
-      console.log(this.searchForm);
-      await this.getDataList({ ...this.searchForm, pageNum: 1, pageSize: 10 });
+      this.currentPage = 1;
+      await this.getDataList();
     },
     //重置
     clearFn() {
-      console.log(this.$refs.searchForm);
       this.$refs.searchForm.resetFields();
     },
 
@@ -382,17 +387,15 @@ export default {
     handleSizeChange(val) {
       this.pageSize = val;
       this.currentPage = 1;
-      this.getDataList({ pageNum: 1, pageSize: this.pageSize });
+      this.getDataList();
     },
     // 更改当前页
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.getDataList({ pageNum: val, pageSize: 10 });
+      this.getDataList();
     },
     //新增
     async addDataFn() {
-      console.log(this.fileList);
-
       await this.$refs.addForm.validate();
 
       // const res = this.dealerList.filter(
@@ -434,7 +437,7 @@ export default {
       //   code: "",
       // };
       this.count = 0;
-      this.getDataList({ pageNum: 1, pageSize: 10 });
+      this.getDataList();
       this.dialogForm = false;
     },
     addFn() {
@@ -443,7 +446,6 @@ export default {
         takerName: "",
         identity: "",
         phone: "",
-
         sparePhone: "",
         expireTime: "",
         code: "",

+ 17 - 22
src/views/finance/account_list.vue

@@ -166,11 +166,7 @@ export default {
     },
   },
   created() {
-    this.getDataList({
-      pageSize: this.pageSize,
-      pageNum: this.currentPage,
-      isReconciliation: false,
-    });
+    this.getDataList();
     this.getCustomerDataList({
       pageSize: -1,
       pageNum: 1,
@@ -214,12 +210,8 @@ export default {
     },
     //搜索
     searchFn() {
-      this.getDataList({
-        ...this.searchForm,
-        pageSize: this.pageSize,
-        pageNum: this.currentPage,
-        isReconciliation: false,
-      });
+      this.currentPage = 1;
+      this.getDataList();
     },
     //改变经销商
     async changeFn(v) {
@@ -240,24 +232,27 @@ export default {
     handleSizeChange(val) {
       this.pageSize = val;
       this.currentPage = 1;
-      this.getDataList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        isReconciliation: false,
-      });
+      this.getDataList();
     },
     // 更改当前页
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.getDataList({
+      this.getDataList();
+    },
+    //获取列表
+    async getDataList() {
+      let params = {
         pageNum: this.currentPage,
         pageSize: this.pageSize,
+        customerId: this.searchForm.customerId,
+        customerWalletId: this.searchForm.customerWalletId,
+        billNo: this.searchForm.billNo,
+        startTime: this.searchForm.startTime,
+        endTime: this.searchForm.endTime,
         isReconciliation: false,
-      });
-    },
-    //获取列表
-    async getDataList(data) {
-      let res = await getFinanceStandingBookList(data);
+      };
+
+      let res = await getFinanceStandingBookList(params);
       // res.data.records.forEach((item) => {
       //   item.sums1 = [];
       //   item.sums2 = ["amount"];

+ 17 - 23
src/views/finance/components/account_list-detail.vue

@@ -146,11 +146,7 @@ export default {
     };
   },
   created() {
-    this.getDataList({
-      pageSize: this.pageSize,
-      pageNum: this.currentPage,
-      isReconciliation: true,
-    });
+    this.getDataList();
     this.getCustomerDataList({
       pageSize: -1,
       pageNum: 1,
@@ -194,12 +190,8 @@ export default {
     },
     //搜索
     searchFn() {
-      this.getDataList({
-        ...this.searchForm,
-        pageSize: this.pageSize,
-        pageNum: this.currentPage,
-        isReconciliation: false,
-      });
+      this.currentPage = 1;
+      this.getDataList();
     },
     //改变经销商
     async changeFn(v) {
@@ -216,24 +208,26 @@ export default {
     handleSizeChange(val) {
       this.pageSize = val;
       this.currentPage = 1;
-      this.getDataList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        isReconciliation: true,
-      });
+      this.getDataList();
     },
     // 更改当前页
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.getDataList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        isReconciliation: true,
-      });
+      this.getDataList();
     },
     //获取列表
-    async getDataList(data) {
-      let res = await getFinanceStandingBookList(data);
+    async getDataList() {
+      let params = {
+        pageSize: this.pageSize,
+        pageNum: this.currentPage,
+        isReconciliation: true,
+        customerId: this.searchForm.customerId,
+        customerWalletId: this.searchForm.customerWalletId,
+        billNo: this.searchForm.billNo,
+        startTime: this.searchForm.startTime,
+        endTime: this.searchForm.endTime,
+      };
+      let res = await getFinanceStandingBookList(params);
       res.data.records.forEach((item) => {
         item.sums1 = [];
         item.sums2 = ["amount"];