From 5d978c4ac8a9f9af1b8904019e6f178723884aa6 Mon Sep 17 00:00:00 2001 From: zengqiyang <492393100@qq.com> Date: Thu, 17 Apr 2025 09:53:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc/.env.development | 2 +- pc/src/api/asset/inventory.js | 7 +- pc/src/api/bak/merchant/index.js | 7 + pc/src/api/bak/merchant/lead.js | 151 ++ pc/src/api/building.js | 8 + pc/src/api/finance.js | 80 + pc/src/api/merchant.js | 358 +++- pc/src/api/project.js | 11 +- pc/src/router/modules/finance.js | 6 + pc/src/utils/auth.js | 56 + pc/src/utils/request.js | 4 +- .../asset/inventory/components/AssetForm.vue | 24 +- pc/src/views/finance/chargeStandard/index.vue | 1097 +++++++++++ .../views/merchant/clue-management/index.vue | 1742 ++++++++++++++++- .../views/merchant/intent-customer/index.vue | 1583 ++++++++++++++- .../merchant/merchant-personnel/index.vue | 775 ++++---- .../views/merchant/tag-management/index.vue | 636 +++--- pc/src/views/project/building/index.vue | 110 +- pc/src/views/project/index.vue | 21 +- .../project/room/components/RoomForm.vue | 15 +- pc/src/views/project/room/index.vue | 15 +- pc/vue.config.js | 18 +- 22 files changed, 5806 insertions(+), 920 deletions(-) create mode 100644 pc/src/api/bak/merchant/index.js create mode 100644 pc/src/api/bak/merchant/lead.js create mode 100644 pc/src/utils/auth.js create mode 100644 pc/src/views/finance/chargeStandard/index.vue diff --git a/pc/.env.development b/pc/.env.development index 445b3c2..6a0355f 100644 --- a/pc/.env.development +++ b/pc/.env.development @@ -1,4 +1,4 @@ NODE_ENV = 'development' # 开发环境API地址 -VUE_APP_BASE_API = http://192.168.137.38:8080 \ No newline at end of file +VUE_APP_BASE_API = http://192.168.137.3:8080/api \ No newline at end of file diff --git a/pc/src/api/asset/inventory.js b/pc/src/api/asset/inventory.js index 11d5315..d868449 100644 --- a/pc/src/api/asset/inventory.js +++ b/pc/src/api/asset/inventory.js @@ -83,17 +83,16 @@ export function listAssetLocationTree() { // 获取公司列表 export function listCompanies() { return request({ - url: '/system/company/list', + url: '/admin/company/getAllCompanyDetails', method: 'get' }) } // 获取用户列表 -export function listUsers(query) { +export function listUsers() { return request({ - url: '/system/user/list', + url: '/v1/member/list', method: 'get', - params: query }) } diff --git a/pc/src/api/bak/merchant/index.js b/pc/src/api/bak/merchant/index.js new file mode 100644 index 0000000..68df39a --- /dev/null +++ b/pc/src/api/bak/merchant/index.js @@ -0,0 +1,7 @@ +// 导出所有子模块 +export * from './lead' + +// 未来可以添加其他子模块,如: +// export * from './team' +// export * from './personnel' +// 等等 \ No newline at end of file diff --git a/pc/src/api/bak/merchant/lead.js b/pc/src/api/bak/merchant/lead.js new file mode 100644 index 0000000..67f447c --- /dev/null +++ b/pc/src/api/bak/merchant/lead.js @@ -0,0 +1,151 @@ +import request from '@/utils/request' + +// 线索状态API +export function getLeadStatusList() { + return request({ + url: '/bizLead/status/list', + method: 'get' + }) +} + +export function getLeadStatusDetail(id) { + return request({ + url: `/bizLead/status/${id}`, + method: 'get' + }) +} + +export function addLeadStatus(data) { + return request({ + url: '/bizLead/status', + method: 'post', + data + }) +} + +export function updateLeadStatus(data) { + return request({ + url: '/bizLead/status', + method: 'put', + data + }) +} + +export function deleteLeadStatus(id, userId) { + return request({ + url: `/bizLead/status/${id}`, + method: 'delete', + params: { userId } + }) +} + +export function checkLeadStatusName(statusName) { + return request({ + url: '/bizLead/status/checkName', + method: 'get', + params: { statusName } + }) +} + +// 线索管理API +export function getLeadList(params) { + return request({ + url: '/bizLead/list', + method: 'get', + params + }) +} + +export function getMyLeadList(params) { + return request({ + url: '/bizLead/myLeads', + method: 'get', + params + }) +} + +export function getAllLeadList(params) { + return request({ + url: '/bizLead/allLeads', + method: 'get', + params + }) +} + +export function getPublicLeadList(params) { + return request({ + url: '/bizLead/publicLeads', + method: 'get', + params + }) +} + +export function getLeadDetail(id) { + return request({ + url: `/bizLead/${id}`, + method: 'get' + }) +} + +export function addLead(data) { + return request({ + url: '/bizLead', + method: 'post', + data + }) +} + +export function updateLead(data) { + return request({ + url: '/bizLead', + method: 'put', + data + }) +} + +export function changeLeadStatus(id, statusId, userId) { + return request({ + url: `/bizLead/${id}/status`, + method: 'put', + params: { statusId, userId } + }) +} + +export function changeLeadPersonnel(id, personnelId, userId) { + return request({ + url: `/bizLead/${id}/personnel`, + method: 'put', + params: { personnelId, userId } + }) +} + +export function checkLeadPhone(phone) { + return request({ + url: '/bizLead/checkPhone', + method: 'get', + params: { phone } + }) +} + +export function convertLeadToIntention(id, userId) { + return request({ + url: `/bizLead/${id}/convert`, + method: 'post', + params: { userId } + }) +} + +export function deleteLead(id, userId) { + return request({ + url: `/bizLead/${id}`, + method: 'delete', + params: { userId } + }) +} + +export function getLeadFollowHistory(leadId) { + return request({ + url: `/bizLead/${leadId}/followHistory`, + method: 'get' + }) +} \ No newline at end of file diff --git a/pc/src/api/building.js b/pc/src/api/building.js index a8d86be..73f6970 100644 --- a/pc/src/api/building.js +++ b/pc/src/api/building.js @@ -129,4 +129,12 @@ export function getFloorListByBuilding(buildingId) { url: `/room/floor/building/${buildingId}`, method: 'get' }) +} + +// 收支账号管理 +export function getAllAccounts() { + return request({ + url: `/admin/account/getAllAccounts`, + method: 'get' + }) } \ No newline at end of file diff --git a/pc/src/api/finance.js b/pc/src/api/finance.js index 3a17024..877f7ec 100644 --- a/pc/src/api/finance.js +++ b/pc/src/api/finance.js @@ -257,4 +257,84 @@ export function getBuildingList(projectId) { url: `/business/building/list/${projectId}`, method: 'get' }) +} + +/* 收费标准相关接口 */ + +// 分页查询收费标准列表 +export function getChargingStandardPage(query) { + return request({ + url: '/finance/charging-standard/page', + method: 'get', + params: query + }) +} + +// 根据ID查询收费标准详情 +export function getChargingStandardById(id) { + return request({ + url: `/finance/charging-standard/${id}`, + method: 'get' + }) +} + +// 新增收费标准 +export function addChargingStandard(data) { + return request({ + url: '/finance/charging-standard', + method: 'post', + data: data + }) +} + +// 修改收费标准 +export function updateChargingStandard(data) { + return request({ + url: '/finance/charging-standard', + method: 'put', + data: data + }) +} + +// 删除收费标准 +export function deleteChargingStandard(id) { + return request({ + url: `/finance/charging-standard/${id}`, + method: 'delete' + }) +} + +// 更新收费标准状态(立即失效) +export function updateChargingStandardStatus(id) { + return request({ + url: `/finance/charging-standard/${id}/updateStatus`, + method: 'put' + }) +} + +// 检查收费标准名称是否存在 +export function checkChargingStandardName(standardName, id) { + return request({ + url: '/finance/charging-standard/check-name', + method: 'get', + params: { standardName, id } + }) +} + +// 根据状态查询收费标准列表 +export function getChargingStandardListByStatus(status) { + return request({ + url: '/finance/charging-standard/list-by-status', + method: 'get', + params: { status } + }) +} + +// 获取费用类型树 +export function getFeeTypeTree(params) { + return request({ + url: '/feeForeign/categories', + method: 'get', + params + }) } \ No newline at end of file diff --git a/pc/src/api/merchant.js b/pc/src/api/merchant.js index b42ca97..bcc6bcd 100644 --- a/pc/src/api/merchant.js +++ b/pc/src/api/merchant.js @@ -3,15 +3,29 @@ import request from '@/utils/request' // 招商团队相关API export function getMerchantTeamList(params) { return request({ - url: '/business/team/list', + url: '/bizTeam/list', method: 'get', params }) } +export function getMerchantTeamDetail(id) { + return request({ + url: `/bizTeam/${id}`, + method: 'get' + }) +} +// 根据项目ID获取招商团队信息 +export function getMerchantTeamByProjectId(projectId) { + return request({ + url: `/bizTeam/project/${projectId}`, + method: 'get' + }) +} + export function addMerchantTeam(data) { return request({ - url: '/business/team', + url: '/bizTeam', method: 'post', data }) @@ -19,25 +33,41 @@ export function addMerchantTeam(data) { export function updateMerchantTeam(data) { return request({ - url: '/business/team', + url: '/bizTeam', method: 'put', data }) } -export function deleteMerchantTeam(id) { +export function deleteMerchantTeam(id, userId) { return request({ - url: `/business/team/${id}`, - method: 'delete' + url: `/bizTeam/${id}`, + method: 'delete', + params: { userId } + }) +} + +export function checkTeamName(params) { + return request({ + url: '/bizTeam/checkName', + method: 'get', + params + }) +} + +export function getProjectsList() { + return request({ + url: '/bizTeam/projects', + method: 'get' }) } // 招商人员相关API -export function getMerchantPersonnelList(params) { +export function getMerchantPersonnelList(data) { return request({ - url: '/business/personnel/list', - method: 'get', - params + url: '/bizPersonnel/queryAllPersonnel', + method: 'post', + data }) } @@ -57,16 +87,33 @@ export function getPersonnelDetail(id) { export function addMerchantPersonnel(data) { return request({ - url: '/business/personnel', + url: '/bizPersonnel', method: 'post', data }) } -export function removeMerchantPersonnel(id) { +export function batchAddMerchantPersonnel(data) { return request({ - url: `/business/personnel/${id}`, - method: 'delete' + url: '/bizPersonnel/batch', + method: 'post', + data + }) +} + +export function removeMerchantPersonnel(id, userId) { + return request({ + url: `/bizPersonnel/${id}`, + method: 'delete', + params: { userId } + }) +} + +export function checkMemberExists(params) { + return request({ + url: '/bizPersonnel/checkMember', + method: 'get', + params }) } @@ -252,4 +299,285 @@ export function checkTagName(params) { method: 'get', params }) -} \ No newline at end of file +} + +// 线索状态API +export function getLeadStatusList() { + return request({ + url: '/bizLead/status/list', + method: 'get' + }) +} + +export function getLeadStatusDetail(id) { + return request({ + url: `/bizLead/status/${id}`, + method: 'get' + }) +} + +export function addLeadStatus(data) { + return request({ + url: '/bizLead/status', + method: 'post', + data + }) +} + +export function updateLeadStatus(data) { + return request({ + url: '/bizLead/status', + method: 'put', + data + }) +} + +export function deleteLeadStatus(id, userId) { + return request({ + url: `/bizLead/status/${id}`, + method: 'delete', + params: { userId } + }) +} + +export function checkLeadStatusName(statusName) { + return request({ + url: '/bizLead/status/checkName', + method: 'get', + params: { statusName } + }) +} + +// 线索管理API +export function getLeadList(params) { + return request({ + url: '/bizLead/list', + method: 'get', + params + }) +} + +export function getMyLeadList(params) { + return request({ + url: '/bizLead/myLeads', + method: 'get', + params + }) +} + +export function getAllLeadList(params) { + return request({ + url: '/bizLead/allLeads', + method: 'get', + params + }) +} + +export function getPublicLeadList(params) { + return request({ + url: '/bizLead/publicLeads', + method: 'get', + params + }) +} + +export function getLeadDetail(id) { + return request({ + url: `/bizLead/${id}`, + method: 'get' + }) +} + +export function addLead(data) { + return request({ + url: '/bizLead', + method: 'post', + data + }) +} + +export function updateLead(data) { + return request({ + url: '/bizLead', + method: 'put', + data + }) +} + +export function changeLeadStatus(id, statusId, userId) { + return request({ + url: `/bizLead/${id}/status`, + method: 'put', + params: { statusId, userId } + }) +} + +export function changeLeadPersonnel(id, personnelId, userId) { + return request({ + url: `/bizLead/${id}/personnel`, + method: 'put', + params: { personnelId, userId } + }) +} + +export function checkLeadPhone(phone) { + return request({ + url: '/bizLead/checkPhone', + method: 'get', + params: { phone } + }) +} + +export function convertLeadToIntention(id, userId) { + return request({ + url: `/bizLead/${id}/convert`, + method: 'post', + params: { userId } + }) +} + +export function deleteLead(id, userId) { + return request({ + url: `/bizLead/${id}`, + method: 'delete', + params: { userId } + }) +} + +export function getLeadFollowHistory(leadId) { + return request({ + url: `/bizLead/${leadId}/followHistory`, + method: 'get' + }) +} + +// 意向客户相关API +export function getCustomerDetail(id) { + return request({ + url: `/bizCustomer/${id}`, + method: 'get' + }) +} + +export function createCustomer(data) { + return request({ + url: '/bizCustomer', + method: 'post', + data + }) +} + +export function updateCustomer(data) { + return request({ + url: '/bizCustomer', + method: 'put', + data + }) +} + +export function deleteCustomer(id) { + return request({ + url: `/bizCustomer/${id}`, + method: 'delete' + }) +} + +export function changeCustomerPersonnel(id, personnelId) { + return request({ + url: `/bizCustomer/personnel/${id}/${personnelId}`, + method: 'put' + }) +} + +export function changeCustomerStatus(id, statusId) { + return request({ + url: `/bizCustomer/status/${id}/${statusId}`, + method: 'put' + }) +} + +export function checkCustomerPhone(params) { + return request({ + url: '/bizCustomer/checkPhone', + method: 'get', + params + }) +} + +export function getMyCustomerList(data) { + return request({ + url: '/bizCustomer/myCustomer', + method: 'post', + data + }) +} + +export function getAllCustomerList(data) { + return request({ + url: '/bizCustomer/allCustomer', + method: 'post', + data + }) +} + +export function getPublicCustomerList(data) { + return request({ + url: '/bizCustomer/publicCustomer', + method: 'post', + data + }) +} + +export function followCustomer(data) { + return request({ + url: '/bizCustomer/follow', + method: 'post', + data + }) +} + +export function getCustomerFollowHistory(customerId) { + return request({ + url: `/bizCustomer/followHistory/${customerId}`, + method: 'get' + }) +} + +export function assignCustomer(id, params) { + return request({ + url: `/bizCustomer/${id}/assign`, + method: 'post', + params + }) +} + +export function returnCustomerToPublic(id, userId) { + return request({ + url: `/bizCustomer/returnToPublic/${id}`, + method: 'post', + params: { userId } + }) +} + +export function getCustomerTagGroups() { + return request({ + url: '/bizCustomer/tags/groups', + method: 'get' + }) +} + +export function saveCustomerTags(data) { + return request({ + url: '/bizCustomer/tags', + method: 'post', + data + }) +} + +// 获取客户状态列表 +export function getCustomerStatusList() { + return request({ + url: '/bizCustomer/status/list', + method: 'get' + }) +} diff --git a/pc/src/api/project.js b/pc/src/api/project.js index 37ba84d..b84c48e 100644 --- a/pc/src/api/project.js +++ b/pc/src/api/project.js @@ -58,4 +58,13 @@ export function getAllProjectStatistics() { url: '/room/project/statistics', method: 'get' }) -} \ No newline at end of file +} + +// 获取标签列表 +export function getTagByType(data) { + return request({ + url: '/admin/tag/getTagsByType', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/pc/src/router/modules/finance.js b/pc/src/router/modules/finance.js index e0769ee..7b569d3 100644 --- a/pc/src/router/modules/finance.js +++ b/pc/src/router/modules/finance.js @@ -18,6 +18,12 @@ export default { component: () => import('@/views/finance/receiptSetting/index.vue'), name: 'ReceiptSetting', meta: { title: '收据设置', icon: 'el-icon-document' } + }, + { + path: 'chargeStandard', + component: () => import('@/views/finance/chargeStandard/index.vue'), + name: 'ChargeStandard', + meta: { title: '收费标准', icon: 'el-icon-price-tag' } } ] } \ No newline at end of file diff --git a/pc/src/utils/auth.js b/pc/src/utils/auth.js new file mode 100644 index 0000000..92f056a --- /dev/null +++ b/pc/src/utils/auth.js @@ -0,0 +1,56 @@ +/** + * 用户鉴权相关工具方法 + */ + +/** + * 获取当前登录用户ID + * @returns {string} 用户ID + */ +export function getUserId() { + // 从本地存储中获取用户信息 + const userInfo = localStorage.getItem('userInfo') + if (userInfo) { + try { + const user = JSON.parse(userInfo) + return user.id || user.userId || '' + } catch (e) { + console.error('解析用户信息失败', e) + return '' + } + } + return '' +} + +/** + * 获取用户信息 + * @returns {Object} 用户信息对象 + */ +export function getUserInfo() { + const userInfo = localStorage.getItem('userInfo') + if (userInfo) { + try { + return JSON.parse(userInfo) + } catch (e) { + console.error('解析用户信息失败', e) + return {} + } + } + return {} +} + +/** + * 保存用户信息到本地存储 + * @param {Object} userInfo 用户信息对象 + */ +export function setUserInfo(userInfo) { + if (userInfo) { + localStorage.setItem('userInfo', JSON.stringify(userInfo)) + } +} + +/** + * 清除用户信息 + */ +export function clearUserInfo() { + localStorage.removeItem('userInfo') +} \ No newline at end of file diff --git a/pc/src/utils/request.js b/pc/src/utils/request.js index 29134d3..654f76d 100644 --- a/pc/src/utils/request.js +++ b/pc/src/utils/request.js @@ -4,8 +4,8 @@ import { API_SUCCESS_CODE } from './constants' // 创建axios实例 const service = axios.create({ - // baseURL: '/', // 修改为相对路径,使用代理 - baseURL: process.env.VUE_APP_BASE_API, // 使用环境变量中的接口地址 + baseURL: '/', // 修改为相对路径,使用代理 + // baseURL: process.env.VUE_APP_BASE_API, // 使用环境变量中的接口地址 timeout: 10000 // 请求超时时间 }) diff --git a/pc/src/views/asset/inventory/components/AssetForm.vue b/pc/src/views/asset/inventory/components/AssetForm.vue index aadddb9..2e56abb 100644 --- a/pc/src/views/asset/inventory/components/AssetForm.vue +++ b/pc/src/views/asset/inventory/components/AssetForm.vue @@ -39,7 +39,7 @@ @@ -51,7 +51,7 @@ @@ -226,7 +226,7 @@ import { getAsset, addAsset, updateAsset, listCompanies, listUsers, uploadAssetImage, checkAssetCode } from '@/api/asset/inventory' import { getClassificationTree } from '@/api/asset/classification' import { getLocationTree } from '@/api/asset/location' - +import { API_SUCCESS_CODE } from '@/utils/constants' export default { name: 'AssetForm', @@ -350,7 +350,7 @@ export default { getAssetDetail() { this.loading = true getAsset(this.assetId).then(response => { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.form = response.data || {} // 如果有管理员,添加到选项中 @@ -371,7 +371,7 @@ export default { /** 获取资产分类树形选项 */ getClassificationOptions() { getClassificationTree({ status: '1' }).then(response => { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.classificationOptions = this.processClassificationTree(response.data || []) } }) @@ -404,7 +404,7 @@ export default { /** 获取位置树选项 */ getLocationOptions() { getLocationTree().then(response => { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.locationOptions = this.processLocationTree(response.data || []) } }) @@ -436,7 +436,7 @@ export default { /** 获取公司选项 */ getCompanyOptions() { listCompanies().then(response => { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.companyOptions = response.data || [] } }).catch(() => { @@ -448,9 +448,9 @@ export default { /** 远程搜索管理员 */ remoteSearchAdmin(query) { this.adminLoading = true - listUsers({ name: query }).then(response => { + listUsers().then(response => { this.adminLoading = false - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.adminOptions = response.data || [] } }).catch(() => { @@ -471,7 +471,7 @@ export default { // 检查资产编码是否已存在 if (!this.isEdit) { checkAssetCode(this.form.code).then(response => { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { if (!response.data) { this.$message.error('资产编码已存在,请更换其他编码') this.loading = false @@ -496,7 +496,7 @@ export default { saveAsset(formData) { const method = this.isEdit ? updateAsset : addAsset method(formData).then(response => { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.$message.success(this.isEdit ? '修改成功' : '新增成功') this.$emit('refresh') this.$emit('close') @@ -530,7 +530,7 @@ export default { /** 图片上传成功回调 */ handleImageSuccess(response) { - if (response.code === '000000') { + if (response.code === API_SUCCESS_CODE) { this.form.imageUrl = response.data.url } else { this.$message.error(response.msg || '上传图片失败') diff --git a/pc/src/views/finance/chargeStandard/index.vue b/pc/src/views/finance/chargeStandard/index.vue new file mode 100644 index 0000000..487f0cb --- /dev/null +++ b/pc/src/views/finance/chargeStandard/index.vue @@ -0,0 +1,1097 @@ + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + + 新增 + + + + + + + + {{ scope.row.standardName }} + + + + + {{ scope.row.chargeMode === '1' ? '周期性费用' : '一次性费用' }} + + + + + + {{ formatPriceUnit(scope.row.priceU, scope.row.chargeMode) }} + + + + + + + {{ getStatusName(scope.row.status) }} + + + + + + + {{ scope.row.bindingObjectType === '1' ? '房间' : '车位' }} + + + + + 绑定数据源+生成账单 + + + + + 立即失效 + 删除 + + + + + + + + + + + + + + {{ detailForm.standardName }} + + {{ detailForm.bindingObjectType === '1' ? '房间' : '车位' }} + + {{ detailForm.projectName }} + {{ detailForm.companyName }} + {{ detailForm.accountName }} + {{ detailForm.bankName }} + {{ detailForm.bankAccountNumber }} + + {{ detailForm.chargeMode === '1' ? '周期性费用' : '一次性费用' }} + + {{ detailForm.feeTypeName }} + {{ detailForm.effectiveDate }} + {{ detailForm.expiryDate }} + {{ detailForm.price }} + + {{ formatPriceUnit(detailForm.priceU, detailForm.chargeMode) }} + + + {{ detailForm.taxInclusiveRule === '1' ? '含税' : '不含税' }} + + + {{ detailForm.dayPriceConversionRule === '1' ? '按自然月换算' : '按年换算' }} + + {{ detailForm.decimalPrecisionPrice }} + {{ detailForm.calculationPrecision }} + + {{ detailForm.calculationPrecisionMethod === '1' ? '每步计算结果按计算精度保留' : '最终计算结果按照计算精度保留' }} + + {{ detailForm.receivableAmountPrecision }} + + {{ detailForm.calculationOrder === '1' ? '单价*面积*时间' : '单价*时间*面积' }} + + + + {{ formatPaymentTimeRule(detailForm) }} + + + {{ detailForm.billingType === '1' ? '按月计费' : '按实际天数计费' }} + + + {{ detailForm.chrgingUnitVal }} + + + {{ detailForm.remitCycleVal }}个月一付 + + + {{ formatBillDivisionMethod(detailForm.billDivisionMethod) }} + + + + {{ detailForm.lateFeeStartDays }} + + + {{ formatPercentage(detailForm.ovdueFeeRate) }} + + + {{ formatPercentage(detailForm.lateFeeUpperLimit) }} + + + {{ getStatusName(detailForm.status) }} + + {{ detailForm.createTime }} + + + + + + + + 收费设置 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ item.accountName }} + {{ item.companyName }} + + {{ item.bankAccountNumber }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + 永久生效 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 付款信息 + + + + + + + + + + + + + + + + + + + + + + + + + + 月一付 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 滞纳金设置 + + + + + + + + + + % + + + + + + % + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pc/src/views/merchant/clue-management/index.vue b/pc/src/views/merchant/clue-management/index.vue index ff17d85..a0c836d 100644 --- a/pc/src/views/merchant/clue-management/index.vue +++ b/pc/src/views/merchant/clue-management/index.vue @@ -1,23 +1,1536 @@ - 线索管理页面 - 这里是线索管理的内容,根据需求继续完善 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + 新增线索 + + + + + + + + 跟进状态列表 + + + + + + + + + + + + + + + + + + + + + {{ scope.row.statusName }} + + + + + + + + + {{ scope.row.projectName || getProjectNameById(scope.row.projectId) || '--' }} + + + + + {{ formatAreaRange(scope.row) }} + + + + + + + 跟进 + 指定分配 + 详情 + 退回公海 + + + + + + + + + + + + + + + + 基础信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 需求信息 + + + + + + m² + - + + m² + + + + + + + 元 + + + + + + 跟进人员 + + + + + 指定人员 + 加入公海 + 分配给创建人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 只能上传jpg/png文件,且不超过5MB + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + 暂无跟进记录 + + + + + + {{ getFollowStatusLabel(item.statusId) }} + + {{ item.followContent }} + + + + + + + + + + + + + + + + + + + + {{ currentLead.createTime || '--' }} + {{ currentLead.projectName || getProjectNameById(currentLead.projectId) || '--' }} + {{ currentLead.buildingName || '--' }} + {{ currentLead.customerName || '--' }} + {{ currentLead.customerPhone || '--' }} + {{ currentLead.companyName || '--' }} + {{ formatAreaRange(currentLead) || '--' }} + {{ currentLead.remark || '--' }} + + + + + {{ currentLead.personnelName || '--' }} + {{ currentLead.teamName || '--' }} + {{ currentLead.assignmentTypeDesc || '--' }} + {{ currentLead.statusName || '--' }} + {{ currentLead.lastFollowTime || '--' }} + {{ currentLead.nextFollowTime || '--' }} + + + + + {{ currentLead.industry || '--' }} + {{ currentLead.age || '--' }} + {{ currentLead.budget || '--' }} + {{ currentLead.customerDetails || '--' }} + {{ currentLead.customerLevel || '--' }} + {{ currentLead.customerLevelDesc || '--' }} + {{ currentLead.leadSource || '--' }} + {{ currentLead.leadSourceDesc || '--' }} + + + + + + + + + + {{ currentLead.customerName }} {{ currentLead.customerPhone }} + + + + + + + + + + + + + + + + + + + + + + + @@ -25,5 +1538,222 @@ export default { \ No newline at end of file + +::v-deep .el-input-number .el-input__inner { + text-align: left; +} + \ No newline at end of file diff --git a/pc/src/views/merchant/intent-customer/index.vue b/pc/src/views/merchant/intent-customer/index.vue index 53b525d..b7900b6 100644 --- a/pc/src/views/merchant/intent-customer/index.vue +++ b/pc/src/views/merchant/intent-customer/index.vue @@ -1,23 +1,1522 @@ - 意向客户页面 - 这里是意向客户的内容,根据需求继续完善 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + 新增意向客户 + + + + + + + 客户状态列表 + + + + + + + + + {{ scope.row.isInitial ? '是' : '否' }} + + + + + + + {{ scope.row.isFinal ? '是' : '否' }} + + + + + + + + + + + + + + + {{ scope.row.successRate }}% + + + + + + + {{ scope.row.statusName }} + + + + + + + + {{ scope.row.budget ? `${scope.row.budget}元` : '--' }} + + + + + {{ getProjectNameById(scope.row.projectId) }} + + + + + {{ formatAreaRange(scope.row) }} + + + + + + + {{ tag.tagName }} + + + + + + 跟进 + 详情 + 退回公海 + 打标签 + + + + + + + + + + + + + + {{ scope.row.successRate }}% + + + + + + + + {{ scope.row.budget ? `${scope.row.budget}元` : '--' }} + + + + + {{ getProjectNameById(scope.row.projectId) }} + + + + + {{ formatAreaRange(scope.row) }} + + + + + + + 指定分配 + 详情 + + + + + + + + + + + + + + + 基础信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 需求信息 + + + + + + m² + - + + m² + + + + + + + + + 元 + + + + + + + + + + + 跟进人员 + + + + + 指定人员 + 加入公海 + 分配给创建人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ item.contractNo }} + {{ item.customerName }} + + + + + + + + + + + + + + + + + + + + + + + + + + + m² + - + + m² + + + + + 元 + + + + + + + + + + + + + + + + + + + + + + + 状态: {{ history.statusName }} + 跟进人: {{ history.personnelName }} ({{ + history.personnelPhone }}) + 内容: {{ history.followContent }} + + + + 合同编号: {{ history.contractNo }} + + + + 暂无跟进历史 + + + + + + + + + + + {{ currentCustomer.customerName }} + + + + + + + + + + + + + + {{ customerDetail.createTime || '--' }} + {{ customerDetail.convertTime || '--' }} + {{ getProjectNameById(customerDetail.projectId) }} + {{ customerDetail.buildingName || '--' }} + {{ customerDetail.customerName || '--' }} + {{ customerDetail.customerPhone || '--' }} + {{ customerDetail.companyName || '--' }} + {{ customerDetail.industry || '--' }} + {{ customerDetail.expectedSignDate || '--' }} + {{ formatAreaRange(customerDetail) || '--' }} + {{ customerDetail.budget ? `${customerDetail.budget}元` : '--' + }} + {{ customerDetail.successRate ? `${customerDetail.successRate}%` : '--' + }} + + + {{ tag.tagName }} + + + {{ customerDetail.remark || '--' }} + + + + + {{ customerDetail.personnelName || '--' }} + {{ customerDetail.managerName || '--' }} + + + + + + + + + + + 暂无合同信息 + + + + + + 状态: {{ history.statusName }} + 跟进人: {{ history.personnelName }} ({{ + history.personnelPhone }}) + 内容: {{ history.followContent }} + + + + 合同编号: {{ history.contractNo }} + + + + 暂无跟进历史 + + + + + + + 状态: {{ history.statusName }} + 跟进人: {{ history.personnelName }} ({{ + history.personnelPhone }}) + 内容: {{ history.followContent }} + + + + + + + + 暂无线索跟进历史 + + + + + + + + + {{ currentCustomer.customerName }} + + + + + + + + + + + @@ -25,5 +1524,77 @@ export default { \ No newline at end of file + \ No newline at end of file diff --git a/pc/src/views/merchant/merchant-personnel/index.vue b/pc/src/views/merchant/merchant-personnel/index.vue index 5935e24..0dd6442 100644 --- a/pc/src/views/merchant/merchant-personnel/index.vue +++ b/pc/src/views/merchant/merchant-personnel/index.vue @@ -26,10 +26,14 @@ - + + + {{ scope.row.memberName }} + 招商经理 + + - @@ -58,7 +62,12 @@ class="filter-item" /> - + 搜索 重置 @@ -68,9 +77,13 @@ - - - + + + + + {{ formatProjectNames(scope.row.projectIds) }} + + @@ -95,6 +108,7 @@ :visible.sync="teamDialogVisible" width="500px" append-to-body + @open="handleOpenTeamDialog" @closed="handleCloseTeamDialog" > @@ -104,12 +118,17 @@ 选择 - {{ teamForm.managerName }} {{ teamForm.managerPhone ? `(${teamForm.managerPhone})` : '' }} + {{ teamForm.managerName }} ({{ teamForm.managerPhone }}) - + @@ -191,7 +210,7 @@ @click="handleSelectMember(item)" > {{item.memberName}} - {{item.deptName}} + {{item.teamName}} @@ -262,18 +281,17 @@ import { addMerchantTeam, updateMerchantTeam, deleteMerchantTeam, + checkTeamName, + getProjectsList, getMerchantPersonnelList, - getPersonnelByTeamId, - getPersonnelDetail, addMerchantPersonnel, + batchAddMerchantPersonnel, removeMerchantPersonnel, - getDepartmentTree, - getDepartmentMemberTree, + checkMemberExists, getManagerList, getMemberList, getMembersByDeptId, - getMemberDetail, - getProjectList + getDepartmentTree } from '@/api/merchant' import MemberSelector from '@/components/MemberSelector' @@ -322,7 +340,9 @@ export default { managerId: '', managerName: '', managerPhone: '', - projectIds: [] + projectIds: [], + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId }, teamRules: { teamName: [{ required: true, message: '请输入团队名称', trigger: 'blur' }], @@ -347,7 +367,8 @@ export default { personnelForm: { teamId: undefined, memberIds: [], - memberNames: [] + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId }, personnelRules: { teamId: [{ required: true, message: '请选择团队', trigger: 'change' }], @@ -396,23 +417,12 @@ export default { } }, created() { - this.getTeamList() - this.getPersonnelList() - this.getProjects() + this.loadProjects() this.initMockData() // 初始化模拟数据 }, methods: { // 初始化模拟数据 initMockData() { - // 模拟项目数据 - this.projectOptions = [ - { id: '1', name: '高新科技园区' }, - { id: '2', name: '软件产业园' }, - { id: '3', name: '文创产业园' }, - { id: '4', name: '生物医药园区' }, - { id: '5', name: '智能制造基地' } - ] - // 模拟部门数据 this.departmentList = [ { @@ -459,115 +469,74 @@ export default { }, // 获取项目列表 - async getProjects() { - try { - const res = await getProjectList() - if (res && res.code === '0000000000000000') { - this.projectOptions = res.data + loadProjects() { + getProjectsList().then(res => { + if (res.code === '0000000000000000') { + this.projectOptions = res.data + + // 项目列表加载完成后加载团队和人员列表 + this.getTeamList() + this.getPersonnelList() + } else { + // 如果加载失败,仍然尝试加载团队和人员列表 + this.getTeamList() + this.getPersonnelList() } - } catch (error) { - console.error('获取项目列表失败', error) - // 使用模拟数据 - } + }).catch(() => { + // 发生错误时仍然尝试加载团队和人员列表 + this.getTeamList() + this.getPersonnelList() + }) }, // 获取团队列表 - async getTeamList() { + getTeamList() { this.teamLoading = true - try { - const res = await getMerchantTeamList(this.teamQueryParams) - if (res && res.code === '0000000000000000') { - // 确保团队数据包含完整的项目信息 - this.teamTableList = (res.data.data || []).map(team => { - // 如果返回的数据中没有projectIds,但有projects字符串,则构建projectIds - if ((!team.projects || team.projects.length === 0) && team.projects) { - // 尝试构建projectIds - const projectNames = team.projects.split(','); - const projects = []; - projectNames.forEach(name => { - const project = this.projectOptions.find(p => p.name === name.trim()); - if (project) { - projects.push(project.id); - } - }); - return { ...team, projects }; - } - return team; - }); + getMerchantTeamList(this.teamQueryParams).then(res => { + if (res.code === '0000000000000000') { + this.teamTableList = res.data.list + this.teamTotal = res.data.total - this.teamTotal = res.data.total || 0 - // 更新团队选项 - this.teamOptions = this.teamTableList.map(item => ({ - id: item.id, - teamName: item.teamName - })) + // 更新团队选项 + this.teamOptions = res.data.list.map(item => ({ + id: item.id, + teamName: item.teamName + })) } - } catch (error) { - console.error('获取团队列表失败', error) - // 模拟一些数据 - this.teamTableList = [ - { - id: '1', - teamName: '园区招商团队A', - managerName: '张三', - memberCount: 5, - projects: '高新科技园区,软件产业园', - createTime: '2023-05-15' - }, - { - id: '2', - teamName: '园区招商团队B', - managerName: '李四', - memberCount: 8, - projects: '文创产业园,智能制造基地', - createTime: '2023-06-20' - } - ] - this.teamTotal = 2 - this.teamOptions = this.teamTableList.map(item => ({ - id: item.id, - teamName: item.teamName - })) - } finally { this.teamLoading = false - } + }).catch(() => { + this.teamLoading = false + }) }, // 获取人员列表 - async getPersonnelList() { + getPersonnelList() { this.loading = true - try { - // 将查询参数名称从name改为memberName - const params = { - ...this.queryParams, - memberName: this.queryParams.memberName - } - delete params.name - - const res = await getMerchantPersonnelList(params) - if (res && res.code === '0000000000000000') { + getMerchantPersonnelList(this.queryParams).then(res => { + if (res.code === '0000000000000000') { + // 确保数据中有managerFlag字段 this.personnelList = res.data.data || [] + this.personnelList.forEach(item => { + // 如果返回数据中没有managerFlag字段但有managerFlagDesc,则尝试推断 + if (item.managerFlagDesc && !item.managerFlag) { + item.managerFlag = item.managerFlagDesc === '是' ? '1' : '0' + } + }) this.total = res.data.total || 0 } else { - this.$message.error(res.message || '获取人员列表失败') this.personnelList = [] this.total = 0 } - } catch (error) { - console.error('获取人员列表失败', error) - this.$message.error('获取人员列表失败') + this.loading = false + }).catch(() => { this.personnelList = [] this.total = 0 - } finally { this.loading = false - } + }) }, // 添加团队 handleAddTeam() { - // 首先关闭可能打开的弹窗 - this.teamDialogVisible = false - // 重置临时选择的招商经理数据 this.tempSelectedMember = null this.tempSelectedMemberId = null @@ -575,66 +544,57 @@ export default { // 设置对话框标题和表单数据 this.teamDialogTitle = '新增招商团队' + + // 先重置表单数据 this.teamForm = { id: undefined, teamName: '', managerId: '', managerName: '', managerPhone: '', - projectIds: [] + projectIds: [], + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId } - // 确保在打开新增团队弹窗时重置表单验证状态 - this.$nextTick(() => { - // 打开弹窗 + // 然后打开弹窗 this.teamDialogVisible = true - - // 重置表单 - if (this.$refs.teamFormRef) { - this.$refs.teamFormRef.resetFields() - this.$refs.teamFormRef.clearValidate() - } - }) }, // 编辑团队 handleEditTeam(row) { - // 首先关闭可能打开的弹窗 - this.teamDialogVisible = false - // 设置对话框标题 this.teamDialogTitle = '编辑招商团队' - console.log(row); + // 输出调试信息,查看原始数据 + console.log('编辑团队原始数据:', row) - // 设置表单数据 + // 先设置表单数据 this.teamForm = { id: row.id, teamName: row.teamName, - managerId: row.managerId, - managerName: row.managerName, - managerPhone: row.managerPhone || '', - projectIds: row.projects || [] - } - this.selectedMember = { - id: row.managerId, - name: row.managerName, - phone: row.managerPhone || '' + managerId: row.memberId, // 使用memberId字段 + managerName: row.memberName, // 使用memberName字段 + managerPhone: row.phone || '', // 使用phone字段 + projectIds: [], + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId } - // 解析绑定项目字段,如果projectIds为空但有projects字段,则尝试从projects中提取项目ID - if (!this.teamForm.projectIds || this.teamForm.projectIds.length === 0) { - if (row.projects) { - // 尝试从projects字符串中提取项目ID - const projectNames = row.projects.split(','); - const projectIds = []; - projectNames.forEach(name => { - const project = this.projectOptions.find(p => p.name === name.trim()); - if (project) { - projectIds.push(project.id); - } - }); - this.teamForm.projectIds = projectIds; + // 设置选中的经理 + this.selectedMember = { + id: row.memberId, // 使用memberId字段 + name: row.memberName, // 使用memberName字段 + phone: row.phone || '' + } + + // 解析绑定项目字段 + if (row.projectIds) { + // 如果返回的是字符串,转为数组 + if (typeof row.projectIds === 'string') { + this.teamForm.projectIds = row.projectIds.split(','); + } else if (Array.isArray(row.projectIds)) { + this.teamForm.projectIds = [...row.projectIds]; } } @@ -651,37 +611,24 @@ export default { this.tempSelectedMember = null } - // 确保触发表单校验更新 - this.$nextTick(() => { - // 打开弹窗 + // 然后打开弹窗 this.teamDialogVisible = true - - if (this.$refs.teamFormRef) { - // 清除表单校验状态 - this.$refs.teamFormRef.clearValidate(); - // 手动触发验证以确保状态更新 - if (this.teamForm.managerId) { - this.$refs.teamFormRef.validateField('managerId'); - } - } - }); }, // 开启招商经理选择对话框 openManagerDialog() { - console.log('开启招商经理选择对话框,当前teamForm:', this.teamForm); - // 先重置所有成员的选中状态 this.resetMembersCheckStatus() + // 设置单选模式 + this.selectionMode = 'single' + // 如果已选择经理,找到对应的成员对象 if (this.teamForm.managerId && this.teamForm.managerName) { // 在allMembers中查找对应成员 const manager = this.allMembers.find(m => m.id === this.teamForm.managerId); if (manager) { - console.log('找到对应成员:', manager); - // 设置单选模式下的选中值 this.tempSelectedMemberId = manager.id; @@ -696,9 +643,6 @@ export default { // 确保成员的checked属性设置正确(对单选模式的radio按钮) manager.checked = true; - // 立即更新选中状态,确保UI更新 - this.$set(manager, 'checked', true); - // 展开包含该成员的部门 this.expandManagerDepartment(manager.deptId); @@ -710,7 +654,6 @@ export default { department: this.getDepartmentNameById(manager.deptId) }]; } else { - console.log('未找到对应成员,使用表单数据'); // 如果在allMembers中找不到,则使用表单中的信息 this.tempSelectedMemberId = this.teamForm.managerId; this.tempSelectedMember = { @@ -723,7 +666,6 @@ export default { this.tempSelectedMembers = [this.tempSelectedMember]; } } else { - console.log('没有选择经理'); this.tempSelectedMemberId = null; this.tempSelectedMember = null; this.tempSelectedMembers = []; @@ -732,11 +674,10 @@ export default { // 展开部门 this.expandDepartments(); - // 设置选择模式和其他参数 + // 设置其他参数并打开对话框 this.memberDialogVisible = true; this.memberType = 'member'; this.memberSearchKeyword = ''; - this.selectionMode = 'single'; // 单选模式 }, // 展开部门 @@ -976,107 +917,153 @@ export default { // 提交团队表单 submitTeamForm() { - this.$refs.teamFormRef.validate(async valid => { + this.$refs.teamFormRef.validate(valid => { if (valid) { - try { - const submitData = { - ...this.teamForm, - // 保证三个数据都传给后端 - managerId: this.teamForm.managerId, - managerName: this.teamForm.managerName, - managerPhone: this.teamForm.managerPhone + const method = this.teamForm.id ? updateMerchantTeam : addMerchantTeam + const message = this.teamForm.id ? '更新成功' : '新增成功' + + // 克隆表单数据 + const formData = { ...this.teamForm } + + // 重命名字段以匹配后端要求 + formData.memberId = formData.managerId + formData.memberName = formData.managerName + formData.phone = formData.managerPhone // 设置电话字段 + + // 确保有电话信息 + console.log('提交的表单数据:', formData); + + // 处理项目ID格式 + if (Array.isArray(formData.projectIds)) { + formData.projectIds = formData.projectIds.join(',') + } + + method(formData).then(res => { + if (res.code === '0000000000000000') { + this.$message.success(message) + this.teamDialogVisible = false + this.getTeamList() } + }) + } + }) + }, - if (this.teamForm.id) { - // 编辑 - const res = await updateMerchantTeam(submitData) - if (res && res.code === '0000000000000000') { - this.$message.success('编辑成功') - } else { - this.$message.error(res.message || '编辑失败') - return - } - } else { - // 新增 - const res = await addMerchantTeam(submitData) - if (res && res.code === '0000000000000000') { - this.$message.success('新增成功') - } else { - this.$message.error(res.message || '新增失败') - return - } - } - this.handleCloseTeamDialog() - this.getTeamList() - // 更新人员列表 - this.getPersonnelList() - } catch (error) { - console.error('提交失败', error) - this.$message.error('操作失败') + // 检查团队名称是否存在 + checkTeamNameExists(rule, value, callback) { + if (!value) { + callback(new Error('团队名称不能为空')) + return + } + + const params = { + teamName: value + } + + if (this.teamForm.id) { + params.excludeId = this.teamForm.id + } + + checkTeamName(params).then(res => { + if (res.code === '0000000000000000') { + if (res.data) { + callback(new Error('团队名称已存在')) + } else { + callback() } } }) }, + // 删除团队 + handleDeleteTeam(row) { + this.$confirm('确认删除该团队?', '警告', { + type: 'warning' + }).then(() => { + deleteMerchantTeam(row.id, this.$store.getters.userId).then(res => { + if (res.code === '0000000000000000') { + this.$message.success('删除成功') + this.getTeamList() + } + }) + }).catch(() => {}) + }, + // 提交人员表单 submitPersonnelForm() { - if (this.selectedMembers.length === 0) { - this.$message.warning('请选择人员') - return - } - - this.$refs.personnelFormRef.validate(async valid => { + this.$refs.personnelFormRef.validate(valid => { if (valid) { - try { - // 批量添加人员 - let successCount = 0 - let failCount = 0 - - for (const member of this.selectedMembers) { - const data = { - teamId: this.personnelForm.teamId, - memberId: member.id, - memberName: member.name, - phone: member.phone || '' + if (this.selectedMembers.length === 0) { + this.$message.warning('请选择招商人员') + return + } + + // 构建提交数据 + const personnelList = this.selectedMembers.map(member => ({ + teamId: this.personnelForm.teamId, + memberId: member.id, + memberName: member.name, + memberPhone: member.phone || '', + isManager: '0', + createUserId: this.personnelForm.createUserId, + tenantId: this.personnelForm.tenantId + })) + + if (personnelList.length === 1) { + // 单个添加 + addMerchantPersonnel(personnelList[0]).then(res => { + if (res.code === '0000000000000000') { + this.$message.success('添加成功') + this.personnelDialogVisible = false + this.getPersonnelList() } - - try { - const res = await addMerchantPersonnel(data) - if (res && res.code === '0000000000000000') { - successCount++ - } else { - failCount++ - } - } catch (error) { - console.error('添加人员失败', error) - failCount++ + }) + } else { + // 批量添加 + batchAddMerchantPersonnel(personnelList).then(res => { + if (res.code === '0000000000000000') { + this.$message.success('批量添加成功') + this.personnelDialogVisible = false + this.getPersonnelList() } - } - - if (successCount > 0) { - this.$message.success(`成功添加${successCount}名人员`) - this.handleClosePersonnelDialog() - this.getPersonnelList() - this.getTeamList() - } - - if (failCount > 0) { - this.$message.warning(`${failCount}名人员添加失败`) - } - } catch (error) { - console.error('提交失败', error) - this.$message.error('操作失败') + }) } } }) }, - // 移除已选择的人员 - removeMember(member) { - const index = this.selectedMembers.findIndex(item => item.id === member.id) - if (index !== -1) { - this.selectedMembers.splice(index, 1) - } + // 检查成员是否已存在 + checkPersonnelExists(memberId, teamId) { + return new Promise((resolve) => { + const params = { + teamId, + memberId + } + + checkMemberExists(params).then(res => { + if (res.code === '0000000000000000') { + resolve(res.data) + } else { + resolve(false) + } + }).catch(() => { + resolve(false) + }) + }) + }, + + // 移除招商人员 + handleRemovePersonnel(row) { + this.$confirm('确认移除该人员?', '警告', { + type: 'warning' + }).then(() => { + removeMerchantPersonnel(row.id, this.$store.getters.userId).then(res => { + if (res.code === '0000000000000000') { + this.$message.success('移除成功') + this.getPersonnelList() + } + }) + }).catch(() => {}) }, // 处理成员选择器确认 @@ -1084,9 +1071,24 @@ export default { if (this.selectionMode === 'single') { // 单选模式(招商经理) // 设置团队表单中的经理信息 - this.teamForm.managerId = result.id - this.teamForm.managerName = result.name - this.teamForm.managerPhone = result.phone || '' + if (!result) return; + + console.log('选择的招商经理:', result); + + // 设置团队表单中的经理数据 + this.teamForm.managerId = result.id; + this.teamForm.managerName = result.name; + this.teamForm.managerPhone = result.phone || ''; + + // 确保成员选择器关闭 + this.memberDialogVisible = false; + + // 手动触发验证经理字段 + this.$nextTick(() => { + if (this.$refs.teamFormRef) { + this.$refs.teamFormRef.validateField('managerId'); + } + }); } else { // 多选模式(招商人员) // 更新已选招商人员列表 @@ -1094,7 +1096,9 @@ export default { // 更新表单数据 this.personnelForm.memberIds = this.selectedMembers.map(member => member.id) - this.personnelForm.memberNames = this.selectedMembers.map(member => member.name) + + // 确保成员选择器关闭 + this.memberDialogVisible = false; } }, @@ -1178,182 +1182,42 @@ export default { this.getTeamList() }, - // 删除团队 - handleDeleteTeam(row) { - this.deleteDialogVisible = true - this.deleteTeamId = row.id - }, - - // 确认删除团队 - confirmDelete() { - if (!this.deleteTeamId) return + // 打开团队对话框时初始化 + handleOpenTeamDialog() { + console.log('对话框打开,当前表单状态:', this.teamForm); - deleteMerchantTeam(this.deleteTeamId).then(res => { - if (res && res.code === '0000000000000000') { - this.$message.success('删除成功') - this.getTeamList() - } else { - this.$message.error(res.message || '删除失败') - } - this.deleteDialogVisible = false - }).catch(error => { - console.error('删除团队失败', error) - this.$message.error('删除失败') - this.deleteDialogVisible = false - }) - }, - - // 移除人员 - handleRemovePersonnel(row) { - this.removeDialogVisible = true - this.removePersonnelId = row.id - }, - - // 确认移除人员 - confirmRemove() { - if (!this.removePersonnelId) return - - removeMerchantPersonnel(this.removePersonnelId).then(res => { - if (res && res.code === '0000000000000000') { - this.$message.success('移除成功') - this.getPersonnelList() - this.getTeamList() - } else { - this.$message.error(res.message || '移除失败') - } - this.removeDialogVisible = false - }).catch(error => { - console.error('移除人员失败', error) - this.$message.error('移除失败') - this.removeDialogVisible = false - }) - }, - - // 搜索成员 - searchMember() { - if (!this.memberSearchKeyword) { - return - } - - this.memberLoading = true - // 调用搜索成员接口 - getMemberList({keyword: this.memberSearchKeyword}).then(res => { - if (res && res.code === '0000000000000000') { - this.memberList = res.data - } else { - this.memberList = [] - } - }).catch(error => { - console.error('搜索成员失败', error) - this.memberList = [] - }).finally(() => { - this.memberLoading = false - }) - }, - - // 处理节点点击事件 - handleNodeClick(node) { - if (node.type === 'member') { - // 选择成员 - const selectedMember = { - id: node.id, - name: node.label, - deptId: node.deptId, - deptName: node.deptName - } - this.handleSelectMember(selectedMember) - } else if (node.type === 'dept') { - // 选择部门(用于按部门选择模式) - if (this.memberSelectMode === 'all') { - this.getMembersByDept(node.id) - } - } - }, - - // 根据部门ID获取成员 - getMembersByDept(deptId) { - if (!deptId) return - - this.memberLoading = true - getMembersByDeptId(deptId).then(res => { - if (res && res.code === '0000000000000000') { - const members = res.data - // 如果按部门选择,可以一次选择多个成员 - members.forEach(member => { - const exists = this.tempSelectedMembers.some(m => m.id === member.id) - if (!exists) { - this.tempSelectedMembers.push({ - id: member.id, - name: member.name, - deptName: member.deptName - }) + // 编辑模式下触发经理字段验证 + if (this.teamForm.id) { + this.$nextTick(() => { + if (this.$refs.teamFormRef) { + this.$refs.teamFormRef.clearValidate(); + if (this.teamForm.managerId) { + this.$refs.teamFormRef.validateField('managerId'); } - }) - } - }).catch(error => { - console.error('获取部门成员失败', error) - }).finally(() => { - this.memberLoading = false - }) - }, - - // 选择成员 - handleSelectMember(member) { - if (this.currentSelectType === 'manager') { - // 招商经理选择(单选) - this.tempSelectedMembers = [{ - id: member.id, - name: member.name, - deptName: member.deptName - }] - } else { - // 招商人员选择(多选) - const exists = this.tempSelectedMembers.some(m => m.id === member.id) - if (!exists) { - this.tempSelectedMembers.push({ - id: member.id, - name: member.name, - deptName: member.deptName - }) - } - } - }, - - // 移除临时选择的成员 - removeTempMember(member) { - const index = this.tempSelectedMembers.findIndex(item => item.id === member.id) - if (index !== -1) { - this.tempSelectedMembers.splice(index, 1) - } - }, - - // 确认成员选择 - confirmMemberSelect() { - if (this.currentSelectType === 'manager') { - // 招商经理选择 - if (this.tempSelectedMembers.length === 0) { - this.$message.warning('请选择招商经理') - return - } - - const manager = this.tempSelectedMembers[0] - this.teamForm.managerId = manager.id - this.teamForm.managerName = manager.name - } else { - // 招商人员选择 - if (this.tempSelectedMembers.length === 0) { - this.$message.warning('请选择招商人员') - return - } - - this.selectedMembers = [...this.tempSelectedMembers] - - // 更新表单数据 - this.personnelForm.memberIds = this.selectedMembers.map(member => member.id) - this.personnelForm.memberNames = this.selectedMembers.map(member => member.name) + } + }); + return; } - this.memberSelectVisible = false + // 如果是新增模式,确保表单被重置 + this.$nextTick(() => { + if (this.$refs.teamFormRef) { + this.$refs.teamFormRef.resetFields(); + this.$refs.teamFormRef.clearValidate(); + + // 确保表单值被正确初始化为默认值 + this.$set(this, 'teamForm', { + id: undefined, + teamName: '', + managerId: '', + managerName: '', + managerPhone: '', + projectIds: [], + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId + }); + } + }); }, // 关闭团队弹窗时重置表单 @@ -1372,14 +1236,16 @@ export default { this.$refs.teamFormRef.clearValidate(); // 重置表单数据,确保下次打开时不会有残留 - this.teamForm = { + this.$set(this, 'teamForm', { id: undefined, teamName: '', managerId: '', managerName: '', managerPhone: '', - projectIds: [] - }; + projectIds: [], + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId + }); } }); }, @@ -1397,7 +1263,8 @@ export default { this.personnelForm = { teamId: undefined, memberIds: [], - memberNames: [] + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId } // 确保在打开新增人员弹窗时重置表单验证状态 @@ -1430,12 +1297,33 @@ export default { this.personnelForm = { teamId: undefined, memberIds: [], - memberNames: [] + createUserId: this.$store.getters.userId, + tenantId: this.$store.getters.tenantId } } }) }, + // 格式化项目IDs为项目名称 + formatProjectNames(projectIds) { + if (!projectIds) return '-'; + + // 如果是字符串,转为数组 + const projectIdArray = typeof projectIds === 'string' + ? projectIds.split(',') + : projectIds; + + if (!projectIdArray.length) return '-'; + + // 匹配项目名称 + const projectNames = projectIdArray.map(id => { + const project = this.projectOptions.find(p => p.projectId && p.projectId.toString() === id.toString()); + return project ? project.projectName : id; + }); + + return projectNames.join(','); + }, + // 以下是保留的原有方法 // ... } @@ -1471,6 +1359,15 @@ export default { margin-bottom: 5px; } } + + // 招商经理标签样式 + .el-tag--mini { + margin-left: 5px; + padding: 0 5px; + height: 20px; + line-height: 19px; + font-size: 12px; + } .member-select-container { .member-select-header { diff --git a/pc/src/views/merchant/tag-management/index.vue b/pc/src/views/merchant/tag-management/index.vue index 1c551ba..f190844 100644 --- a/pc/src/views/merchant/tag-management/index.vue +++ b/pc/src/views/merchant/tag-management/index.vue @@ -20,8 +20,8 @@ placeholder="请输入分组名称" clearable size="small" - @keyup.enter.native="handleGroupSearch"> - + > + @@ -179,7 +179,7 @@ - + 按回车键可输入多个标签名称 + + +
这里是线索管理的内容,根据需求继续完善
这里是意向客户的内容,根据需求继续完善