From e6d5c7d4b9e813a649b8e36152c863f87552cb1d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 10 May 2020 22:06:32 +0800 Subject: [PATCH] company filter --- test_client/src/api/crm.js | 11 +- test_client/src/views/crm/company.vue | 47 +++- test_client/src/views/crm/consumer.vue | 285 +++++++++++++++---------- test_server/crm/views.py | 12 +- 4 files changed, 227 insertions(+), 128 deletions(-) diff --git a/test_client/src/api/crm.js b/test_client/src/api/crm.js index 6149046..8ce4497 100644 --- a/test_client/src/api/crm.js +++ b/test_client/src/api/crm.js @@ -1,9 +1,10 @@ import request from '@/utils/request' -export function getCompanyList() { +export function getCompanyList(query) { return request({ url: '/crm/company/', method: 'get', + params: query }) } export function createCompany(data) { @@ -55,6 +56,14 @@ export function deleteConsumer(id) { }) } +export function deleteConsumers(data) { + return request({ + url: `/crm/consumer/deletes/`, + method: 'post', + data + }) +} + export function importConsumer(data) { return request({ url: `/crm/consumer/import/`, diff --git a/test_client/src/views/crm/company.vue b/test_client/src/views/crm/company.vue index e445d88..2bab58f 100644 --- a/test_client/src/views/crm/company.vue +++ b/test_client/src/views/crm/company.vue @@ -2,15 +2,22 @@
新增 + 刷新重置
- + @@ -69,6 +82,7 @@ import { getCompanyList, createCompany, deleteCompany, updateCompany } from "@/api/crm"; import { deepClone } from "@/utils"; import checkPermission from "@/utils/permission"; +import Pagination from "@/components/Pagination" @@ -76,16 +90,21 @@ const defaultCompany = { id: "", name: "", }; +const listQuery = { + page: 1, + limit: 20, + search: "" +} export default { + components: { Pagination }, data() { return { company: { id: "", name: "", }, - search:'', - tableData: [], - companyData:[], + listQuery:listQuery, + tableData: {count:0}, listLoading: true, dialogVisible: false, dialogType: "new", @@ -106,17 +125,23 @@ export default { checkPermission, getList() { this.listLoading = true - getCompanyList().then(response => { - this.tableData = response.data; + getCompanyList(this.listQuery).then(response => { + this.tableData = response.data this.listLoading = false }); }, resetFilter() { + this.listQuery = { + page: 1, + limit: 20, + search: "" + }; + this.getList(); + }, + handleFilter() { + this.listQuery.page = 1; this.getList(); }, - // handleFilter() { - // let newData = this.companyData.filter(data => !this.search || data.name.toLowerCase().includes(this.search.toLowerCase())) - // }, handleAdd() { this.company = Object.assign({}, defaultCompany); this.dialogType = "new"; diff --git a/test_client/src/views/crm/consumer.vue b/test_client/src/views/crm/consumer.vue index d3d0749..1968abd 100644 --- a/test_client/src/views/crm/consumer.vue +++ b/test_client/src/views/crm/consumer.vue @@ -5,9 +5,12 @@ v-model="listQuery.company" placeholder="所属单位" clearable + filterable style="width: 200px" class="filter-item" @change="handleFilter" + remote + :remote-method="searchCompany" > - --> + --> 刷新重置 - - 创建时间 - + 创建时间
新增 -

导入用户前,请下载模板并按格式录入.

-
- 下载模板 - - 上传导入 - -
- Excel导入 -
-导出Excel + type="primary" + placement="top" + width="160" + v-if="checkPermission(['consumer_import'])" + v-model="popovervisible" + > +

导入用户前,请下载模板并按格式录入.

+
+ 下载模板 + + 上传导入 + +
+ Excel导入 + + 导出Excel + 批量删除
- + - + @@ -98,27 +111,23 @@ - + -