✨ 新增未关联业务员客户列表

This commit is contained in:
caojia
2026-10-29 10:35:24 +08:00
parent d02d3dd881
commit eafc8af89a
9 changed files with 172 additions and 1 deletions
@@ -5,6 +5,7 @@ import java.util.List;
import com.bms.customer.customerinfo.domain.BmsCustomerAttachment; import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
import com.bms.customer.customerinfo.domain.BmsCustomerCompany; import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
import com.bms.customer.customerinfo.domain.BmsCustomerContact; import com.bms.customer.customerinfo.domain.BmsCustomerContact;
import com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -52,6 +53,17 @@ public class BmsCustomerController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** 查询未关联业务员的客户列表 */
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
@GetMapping("/unlinked-sales-user/list")
public TableDataInfo unlinkedSalesUserList()
{
startPage();
BmsCustomer query = new BmsCustomer();
List<UnlinkedSalesCustomerVO> list = bmsCustomerService.selectUnlinkedSalesUserCustomerList(query);
return getDataTable(list);
}
/** /**
* 客户下拉选项。 * 客户下拉选项。
* 只返回客户ID、客户编码、客户名称,供各页面下拉框使用。 * 只返回客户ID、客户编码、客户名称,供各页面下拉框使用。
@@ -2,7 +2,6 @@ package com.bms.customer.customerinfo.mapper;
import java.util.List; import java.util.List;
import com.bms.customer.customerinfo.domain.BmsCustomer; import com.bms.customer.customerinfo.domain.BmsCustomer;
import com.bms.customer.customerinfo.domain.BmsCustomerOption;
import com.bms.customer.customerinfo.domain.BmsCustomerAttachment; import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
import com.bms.customer.customerinfo.domain.BmsCustomerCompany; import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
import com.bms.customer.customerinfo.domain.BmsCustomerContact; import com.bms.customer.customerinfo.domain.BmsCustomerContact;
@@ -44,6 +43,9 @@ public interface BmsCustomerMapper
*/ */
public List<BmsCustomerOption> selectCustomerOptions(BmsCustomer query); public List<BmsCustomerOption> selectCustomerOptions(BmsCustomer query);
/** 独立分页查询未关联业务员的客户,仅按 sales_user_id 为空筛选。 */
public List<UnlinkedSalesCustomerVO> selectUnlinkedSalesUserCustomerList(BmsCustomer query);
/** 校验业务员用户ID仍对应未删除的系统用户。 */ /** 校验业务员用户ID仍对应未删除的系统用户。 */
public int countValidSalesUserId(@org.apache.ibatis.annotations.Param("salesUserId") String salesUserId); public int countValidSalesUserId(@org.apache.ibatis.annotations.Param("salesUserId") String salesUserId);
@@ -7,6 +7,7 @@ import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
import com.bms.customer.customerinfo.domain.BmsCustomerCompany; import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
import com.bms.customer.customerinfo.domain.BmsCustomerContact; import com.bms.customer.customerinfo.domain.BmsCustomerContact;
import com.bms.customer.customerinfo.domain.BmsCustomerLog; import com.bms.customer.customerinfo.domain.BmsCustomerLog;
import com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO;
/** /**
* 客户主Service接口 * 客户主Service接口
@@ -40,6 +41,9 @@ public interface IBmsCustomerService
*/ */
public List<BmsCustomer> selectBmsCustomerList(BmsCustomer bmsCustomer); public List<BmsCustomer> selectBmsCustomerList(BmsCustomer bmsCustomer);
/** 独立查询未关联业务员的客户。 */
public List<UnlinkedSalesCustomerVO> selectUnlinkedSalesUserCustomerList(BmsCustomer query);
/** /**
* 查询客户下拉选项。 * 查询客户下拉选项。
* 只返回客户ID、客户编码、客户名称;keywords 按客户名称、客户编码、对外代码模糊查询。 * 只返回客户ID、客户编码、客户名称;keywords 按客户名称、客户编码、对外代码模糊查询。
@@ -19,6 +19,7 @@ import com.bms.customer.customerinfo.mapper.BmsCustomerMapper;
import com.bms.customer.customerinfo.domain.BmsCustomer; import com.bms.customer.customerinfo.domain.BmsCustomer;
import com.bms.customer.customerinfo.domain.BmsCustomerOption; import com.bms.customer.customerinfo.domain.BmsCustomerOption;
import com.bms.customer.customerinfo.domain.BmsCustomerLog; import com.bms.customer.customerinfo.domain.BmsCustomerLog;
import com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO;
import com.bms.customer.customerinfo.service.IBmsCustomerLogService; import com.bms.customer.customerinfo.service.IBmsCustomerLogService;
import com.bms.customer.customerinfo.service.IBmsCustomerService; import com.bms.customer.customerinfo.service.IBmsCustomerService;
import com.bms.customer.customermoney.service.ICustomerMoneyService; import com.bms.customer.customermoney.service.ICustomerMoneyService;
@@ -90,6 +91,14 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
return bmsCustomerMapper.selectBmsCustomerList(bmsCustomer); return bmsCustomerMapper.selectBmsCustomerList(bmsCustomer);
} }
/** 查询未关联业务员客户,保留客户业务员维度的数据范围。 */
@Override
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "su", userField = "user_id")
public List<UnlinkedSalesCustomerVO> selectUnlinkedSalesUserCustomerList(BmsCustomer query)
{
return bmsCustomerMapper.selectUnlinkedSalesUserCustomerList(query);
}
/** /**
* 客户下拉选项。数据权限与客户列表一致,只查下拉需要的字段。 * 客户下拉选项。数据权限与客户列表一致,只查下拉需要的字段。
*/ */
@@ -0,0 +1,16 @@
package com.bms.customer.customerinfo.vo;
import lombok.Data;
/** 未关联业务员客户弹窗专用列表响应。 */
@Data
public class UnlinkedSalesCustomerVO
{
private Long customerId;
private String customerCode;
private String customerName;
private String customerCodeDw;
private String customerType;
private String isEnable;
private String sourceSalesCode;
}
@@ -112,6 +112,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by c.customer_id desc order by c.customer_id desc
</select> </select>
<select id="selectUnlinkedSalesUserCustomerList"
parameterType="com.bms.customer.customerinfo.domain.BmsCustomer"
resultType="com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO">
select c.customer_id as customerId,
c.customer_code as customerCode,
c.customer_name as customerName,
c.customer_code_dw as customerCodeDw,
c.customer_type as customerType,
c.is_enable as isEnable,
c.source_sales_code as sourceSalesCode
from ctr_customer c
left join sys_user su
on su.del_flag = '0'
and cast(su.user_id as char) = c.sales_user_id
where c.del_flag = '0'
and (c.sales_user_id is null or trim(c.sales_user_id) = '')
${params.dataScope}
order by c.customer_id desc
</select>
<resultMap type="BmsCustomerOption" id="BmsCustomerOptionResult"> <resultMap type="BmsCustomerOption" id="BmsCustomerOptionResult">
<result property="customerId" column="customer_id" /> <result property="customerId" column="customer_id" />
<result property="customerCode" column="customer_code" /> <result property="customerCode" column="customer_code" />
@@ -9,6 +9,15 @@ export function listCustomer(query) {
}) })
} }
// 分页查询未关联业务员的客户
export function listUnlinkedSalesUserCustomers(query) {
return request({
url: '/customersupplier/customerinfo/unlinked-sales-user/list',
method: 'get',
params: query
})
}
// 客户下拉选项:只返回客户ID、客户编码、客户名称 // 客户下拉选项:只返回客户ID、客户编码、客户名称
// keywords 按客户名称、客户编码、对外代码模糊查询 // keywords 按客户名称、客户编码、对外代码模糊查询
export function listCustomerOption(query) { export function listCustomerOption(query) {
@@ -0,0 +1,86 @@
<template>
<el-dialog
:model-value="modelValue"
@update:model-value="$emit('update:modelValue', $event)"
title="未关联业务员客户"
width="min(1100px, 96vw)"
append-to-body
destroy-on-close
@open="handleOpen"
>
<el-table v-loading="loading" :data="customerList" border row-key="customerId" empty-text="暂无未关联业务员的客户">
<el-table-column label="客户编码" prop="customerCode" min-width="120" align="center" />
<el-table-column label="客户名称" prop="customerName" min-width="240" show-overflow-tooltip />
<el-table-column label="对外代码" prop="customerCodeDw" min-width="140" align="center" />
<el-table-column label="源业务员工号" prop="sourceSalesCode" min-width="150" align="center" />
<el-table-column label="业务类型" prop="customerType" width="110" align="center">
<template #default="scope">
<dict-tag :options="customer_type" :value="scope.row.customerType" />
</template>
</el-table-column>
<el-table-column label="启用状态" prop="isEnable" width="110" align="center">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.isEnable" />
</template>
</el-table-column>
<el-table-column label="业务员" width="120" align="center">
<template #default>
<span class="unlinked-label">未关联</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="pageNum"
v-model:limit="pageSize"
@pagination="getList"
/>
<template #footer>
<el-button @click="$emit('update:modelValue', false)">关闭</el-button>
</template>
</el-dialog>
</template>
<script setup>
import { ref } from 'vue'
import { listUnlinkedSalesUserCustomers } from '@/api/customersuppliermanagement/customerinfo/customer'
defineProps({
modelValue: { type: Boolean, default: false }
})
defineEmits(['update:modelValue'])
const { sys_normal_disable, customer_type } = useDict('sys_normal_disable', 'customer_type')
const loading = ref(false)
const customerList = ref([])
const total = ref(0)
const pageNum = ref(1)
const pageSize = ref(10)
function handleOpen() {
pageNum.value = 1
getList()
}
function getList() {
loading.value = true
listUnlinkedSalesUserCustomers({
pageNum: pageNum.value,
pageSize: pageSize.value
}).then(response => {
customerList.value = response.rows || []
total.value = response.total || 0
}).finally(() => {
loading.value = false
})
}
</script>
<style scoped>
.unlinked-label {
color: var(--el-color-warning);
}
</style>
@@ -114,6 +114,15 @@
v-hasPermi="['customersupplier:customerinfo:remove']" v-hasPermi="['customersupplier:customerinfo:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="User"
@click="unlinkedSalesDialogVisible = true"
v-hasPermi="['customersupplier:customerinfo:list']"
>未关联业务员</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@@ -302,6 +311,8 @@
:customer-name="billCustomer.customerName" :customer-name="billCustomer.customerName"
/> />
<customer-unlinked-sales-dialog v-model="unlinkedSalesDialogVisible" />
<!-- 右键复制列值 --> <!-- 右键复制列值 -->
<table-copy-menu <table-copy-menu
ref="copyMenuRef" ref="copyMenuRef"
@@ -319,6 +330,7 @@ import { useProducts, parseProductCodes } from '@/components/ProductSelect/usePr
import { useUsers } from '@/components/UserSelect/useUsers' import { useUsers } from '@/components/UserSelect/useUsers'
import CustomerLogDialog from './components/CustomerLogDialog.vue' import CustomerLogDialog from './components/CustomerLogDialog.vue'
import CustomerBillListDialog from './customermoney/CustomerBillListDialog.vue' import CustomerBillListDialog from './customermoney/CustomerBillListDialog.vue'
import CustomerUnlinkedSalesDialog from './components/CustomerUnlinkedSalesDialog.vue'
import { useColumnSettings } from '@/utils/columnSettings' import { useColumnSettings } from '@/utils/columnSettings'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@@ -531,6 +543,7 @@ function handleCustomerMoney(row) {
/** 在客户信息列表内打开只读账单弹窗 */ /** 在客户信息列表内打开只读账单弹窗 */
const billDialogVisible = ref(false) const billDialogVisible = ref(false)
const billCustomer = ref({}) const billCustomer = ref({})
const unlinkedSalesDialogVisible = ref(false)
function handleViewBills(row) { function handleViewBills(row) {
if (!row || !row.customerId) { if (!row || !row.customerId) {
proxy.$modal.msgWarning('客户信息无效,无法查看账单') proxy.$modal.msgWarning('客户信息无效,无法查看账单')