From e97f708ac5967d8ca176eeb0c487c2d27ddd9aae Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Mon, 8 Apr 2024 11:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=9A=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=B0=E5=8C=BA=E3=80=81=E5=9B=AD=E5=8C=BA?= =?UTF-8?q?=E3=80=81=E6=A5=BC=E5=AE=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/admin/CustomerList.vue | 190 ++++++++++++++++++++++--------- 1 file changed, 137 insertions(+), 53 deletions(-) diff --git a/src/views/admin/CustomerList.vue b/src/views/admin/CustomerList.vue index 2f00f49..36fa287 100644 --- a/src/views/admin/CustomerList.vue +++ b/src/views/admin/CustomerList.vue @@ -1,61 +1,84 @@ @@ -63,13 +86,17 @@ import { STable } from '@/components' import { getCustomerList, delCustomer } from '@/api/admin/customer' import { checkPermission } from '@/utils/permissions' +import { getTenantList } from '@/api/tenant' +import { getParkList } from '@/api/admin/park' +import { getBuildingList } from '@/api/admin/building' +import { getBuildingDetailList } from '@/api/admin/buildingDetail' export default { name: 'TableList', components: { STable }, - data () { + data() { return { labelCol: { xs: { span: 24 }, @@ -84,17 +111,31 @@ export default { // 高级搜索 展开/关闭 advanced: false, // 查询参数 - queryParam: {}, + queryParam: { + tenantId: null, + parkId: null, + buildingId: null, + name: null, + contacts: null, + phone: null + }, // 表头 columns: [ + { + title: '所属地区', + dataIndex: 'tenantName' + }, { title: '所属园区', - dataIndex: 'park.name', - fixed: 'left' + dataIndex: 'park.name' + }, + { + title: '所属楼宇', + dataIndex: 'buildingName' }, { title: '企业名称', - dataIndex: 'name' + dataIndex: 'name', }, { title: '企业类型', @@ -167,18 +208,21 @@ export default { selectedRows: [], addEnable: checkPermission('admin:customer:add'), editEnabel: checkPermission('admin:customer:edit'), - removeEnable: checkPermission('admin:customer:remove') + removeEnable: checkPermission('admin:customer:remove'), + tenantList: [], // 地区 + parkList: [], // 园区 + buildingList: [] // 楼宇 } }, filters: { - typeFilter (type) { + typeFilter(type) { const typeMap = { 'COMPANY': '公司', 'PERSON': '个人' } return typeMap[type] }, - customerStatusFilter (customerStatus) { + customerStatusFilter(customerStatus) { const customerStatusMap = { 'POTENTIAL': '潜在企业', 'PURPOSE': '意向企业', @@ -188,24 +232,64 @@ export default { return customerStatusMap[customerStatus] } }, - created () { + created() { + // 查询地区 + this.getTenantData() }, methods: { - onSelectChange (selectedRowKeys, selectedRows) { + // 查询地区 + getTenantData() { + getTenantList().then(res => { + this.tenantList = res.rows + }) + }, + // 选择地区 -> 查询园区 + selectTenant(id) { + console.log('selectTenant', id) + // 清空数据 + this.queryParam.parkId = null // 园区 + this.queryParam.buildingId = null // 楼宇 + + // 查询园区 + getParkList({ + tenantId: id + }).then(res => { + this.parkList = res.rows + }) + }, + // 选择园区 -> 查询楼宇 + selectPark(id) { + console.log('selectPark', id) + // 清空数据 + this.queryParam.buildingId = null // 楼宇 + + // 查询楼宇 + getBuildingList({ + parkId: id + }).then(res => { + this.buildingList = res.rows + }) + }, + // 选择楼宇 -> 查询楼层 + selectBuilding(id) { + console.log('selectBuilding', id) + console.log('this.queryParam', this.queryParam) + }, + onSelectChange(selectedRowKeys, selectedRows) { this.selectedRowKeys = selectedRowKeys this.selectedRows = selectedRows }, - handleAdd () { + handleAdd() { this.handleEdit() }, - handleEdit (customerId) { + handleEdit(customerId) { this.$router.push({ name: 'customerEdit', query: { customerId: customerId } }) }, - handleOk () { + handleOk() { this.$refs.table.refresh(true) console.log('handleSaveOk') }, - delByIds (ids) { + delByIds(ids) { delCustomer({ ids: ids.join(',') }).then(res => { if (res.code === 0) { this.$message.success('删除成功') @@ -221,7 +305,7 @@ export default {